• 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

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

5
import type {LoaderWithParser} from '@loaders.gl/loader-utils';
6
import {mergeOptions} from '@loaders.gl/loader-utils';
7
import {XMLLoaderWithParser, XMLLoaderOptions} from './xml-loader-with-parser';
8
import {HTMLLoader as HTMLLoaderMetadata} from './html-loader';
9

10
const {preload: _HTMLLoaderPreload, ...HTMLLoaderMetadataWithoutPreload} = HTMLLoaderMetadata;
5✔
11

12
export type HTMLLoaderOptions = XMLLoaderOptions;
13

14
/**
15
 * Loader for HTML files
16
 * Essentially a copy of the XMLLoaderWithParser with different mime types, file extensions and content tests.
17
 * This split enables applications can control whether they want HTML responses to be parsed by the XML loader or not.
18
 * This loader does not have any additional understanding of the structure of HTML or the document.
19
 */
20
export const HTMLLoaderWithParser = {
5✔
21
  ...HTMLLoaderMetadataWithoutPreload,
22
  parse: async (arrayBuffer: ArrayBuffer, options?: XMLLoaderOptions) =>
NEW
23
    parseTextSync(new TextDecoder().decode(arrayBuffer), options),
×
24
  parseTextSync: (text: string, options?: XMLLoaderOptions) => parseTextSync(text, options)
2✔
25
} as const satisfies LoaderWithParser<any, never, HTMLLoaderOptions>;
26

27
function parseTextSync(text: string, options?: XMLLoaderOptions): any {
28
  // fast-xml-parser can recognize HTML entities
29
  // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#htmlentities
30
  // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/5.Entities.md
31
  options = mergeOptions(options, {
2✔
32
    xml: {
33
      _parser: 'fast-xml-parser',
34
      _fastXML: {
35
        htmlEntities: true
36
      }
37
    }
38
  });
39

40
  return XMLLoaderWithParser.parseTextSync?.(text, options);
2✔
41
}
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