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

visgl / loaders.gl / 20352515932

18 Dec 2025 09:56PM UTC coverage: 35.115% (-28.4%) from 63.485%
20352515932

push

github

web-flow
feat(loader-utils): Export is-type helpers (#3258)

1188 of 1998 branches covered (59.46%)

Branch coverage included in aggregate %.

147 of 211 new or added lines in 13 files covered. (69.67%)

30011 existing lines in 424 files now uncovered.

37457 of 108056 relevant lines covered (34.66%)

0.79 hits per line

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

60.0
/modules/loader-utils/src/lib/module-utils/js-module-utils.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
import {log} from '../log-utils/log';
1✔
6

1✔
7
/**
1✔
8
 * Register application-imported modules
1✔
9
 * These modules are typically to big to bundle, or may have issues on some bundlers/environments
1✔
10
 */
1✔
11
export function registerJSModules(modules?: Record<string, any>): void {
1✔
UNCOV
12
  globalThis.loaders ||= {};
×
UNCOV
13
  globalThis.loaders.modules ||= {};
×
UNCOV
14
  Object.assign(globalThis.loaders.modules, modules);
×
UNCOV
15
}
×
16

1✔
17
/**
1✔
18
 * Get a pre-registered application-imported module, warn if not present
1✔
19
 */
1✔
20
export function checkJSModule(name: string, caller: string): void {
1✔
UNCOV
21
  const module = globalThis.loaders?.modules?.[name];
×
UNCOV
22
  if (!module) {
×
UNCOV
23
    log.warn(`${caller}: ${name} library not installed`)();
×
UNCOV
24
  }
×
UNCOV
25
}
×
26

1✔
27
/**
1✔
28
 * Get a pre-registered application-imported module, throw if not present
1✔
29
 */
1✔
30
export function getJSModule<ModuleT = any>(name: string, caller: string): ModuleT {
1✔
UNCOV
31
  const module = globalThis.loaders?.modules?.[name];
×
UNCOV
32
  if (!module) {
×
33
    throw new Error(`${caller}: ${name} library not installed`);
×
34
  }
×
UNCOV
35
  return module;
×
UNCOV
36
}
×
37

1✔
38
/**
1✔
39
 * Get a pre-registered application-imported module, return null if not present
1✔
40
 */
1✔
41
export function getJSModuleOrNull<ModuleT = any>(name: string): ModuleT | null {
1✔
UNCOV
42
  const module = globalThis.loaders?.modules?.[name];
×
UNCOV
43
  return module || null;
×
UNCOV
44
}
×
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