• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 24907303489

24 Apr 2026 07:12PM UTC coverage: 59.423% (+0.09%) from 59.334%
24907303489

push

github

web-flow
feat: Dynamic import loaders (#3405)

11252 of 20783 branches covered (54.14%)

Branch coverage included in aggregate %.

1164 of 1518 new or added lines in 244 files covered. (76.68%)

41 existing lines in 18 files now uncovered.

23432 of 37585 relevant lines covered (62.34%)

16317.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/modules/obj/src/mtl-loader.ts
1
// loaders.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
6
import type {MTLMaterial, ParseMTLOptions} from './lib/parse-mtl';
7
import {MTLFormat} from './mtl-format';
8

9
// __VERSION__ is injected by babel-plugin-version-inline
10
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
11
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
12!
12

13
export type MTLLoaderOptions = LoaderOptions & {
14
  mtl?: ParseMTLOptions;
15
};
16

17
/**
18
 * Preloads the parser-bearing MTL loader implementation.
19
 */
20
async function preload() {
21
  const {MTLLoaderWithParser} = await import('./mtl-loader-with-parser');
2✔
22
  return MTLLoaderWithParser;
2✔
23
}
24

25
/**
26
 * Metadata-only loader for the MTL material format
27
 * Parses a Wavefront .mtl file specifying materials
28
 */
29
export const MTLWorkerLoader = {
12✔
30
  ...MTLFormat,
31

32
  dataType: null as unknown as MTLMaterial[],
33
  batchType: null as never,
34

35
  version: VERSION,
36
  worker: true,
37
  text: true,
UNCOV
38
  testText: (text: string): boolean => text.includes('newmtl'),
×
39
  options: {
40
    mtl: {}
41
  },
42
  preload
43
} as const satisfies Loader<MTLMaterial[], never, LoaderOptions>;
44

45
// MTLLoader
46

47
/**
48
 * Metadata-only loader for the MTL material format
49
 */
50
export const MTLLoader = {
12✔
51
  ...MTLWorkerLoader
52
} as const satisfies Loader<MTLMaterial[], never, MTLLoaderOptions>;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc