• 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

55.56
/modules/mvt/src/tilejson-loader-with-parser.ts
1
// loaders.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
6
import type {TileJSON} from './lib/parse-tilejson';
7
import {parseTileJSON} from './lib/parse-tilejson';
8
import {TileJSONLoader as TileJSONLoaderMetadata} from './tilejson-loader';
9

10
const {preload: _TileJSONLoaderPreload, ...TileJSONLoaderMetadataWithoutPreload} =
11
  TileJSONLoaderMetadata;
4✔
12

13
export type TileJSONLoaderOptions = LoaderOptions & {
14
  /** Options for the TileJSONLoaderWithParser */
15
  tilejson?: {
16
    /** Max number of unique values */
17
    maxValues?: number;
18
  };
19
};
20

21
/**
22
 * Loader for TileJSON metadata
23
 */
24
export const TileJSONLoaderWithParser = {
4✔
25
  ...TileJSONLoaderMetadataWithoutPreload,
26
  parse: async (arrayBuffer: ArrayBuffer, options?: TileJSONLoaderOptions) => {
NEW
27
    const jsonString = new TextDecoder().decode(arrayBuffer);
×
NEW
28
    const json = JSON.parse(jsonString);
×
NEW
29
    const tilejsonOptions = {...TileJSONLoaderWithParser.options.tilejson, ...options?.tilejson};
×
NEW
30
    return parseTileJSON(json, tilejsonOptions) as TileJSON;
×
31
  },
32
  parseTextSync: (text: string, options?: TileJSONLoaderOptions) => {
33
    const json = JSON.parse(text);
10✔
34
    const tilejsonOptions = {...TileJSONLoaderWithParser.options.tilejson, ...options?.tilejson};
10✔
35
    return parseTileJSON(json, tilejsonOptions) as TileJSON;
10✔
36
  }
37
} as const satisfies LoaderWithParser<TileJSON, never, TileJSONLoaderOptions>;
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