/** * Part of the maplibre-gl module this file uses. Declared structurally so that tests need not * load the real bundle. * * @internal */ export interface IMapLibreWorkerConfig { getWorkerUrl: () => string; setWorkerUrl: (url: string) => void; } /** * URL of the self-contained MapLibre worker file that this package ships, relative to this module. * * @remarks * maplibre-gl 6 does not inline its web worker. It resolves `maplibre-gl-worker.mjs` next to its * own module through `import.meta.url`, which does not survive bundling. The build of this package * bundles the worker and its shared chunk into `worker/maplibre-gl-worker.js` (see * `scripts/build.sh`), and this URL points at that file relative to this module. * * The relative path is the same from `src/next/map/runtime/` and from `esm/next/map/runtime/`, so * it also holds when a dev server aliases this package to its sources. webpack and Vite recognise * the `new URL("...", import.meta.url)` pattern and emit the file as an asset. Other bundlers do * not: esbuild leaves a URL that resolves next to the bundle and does not exist, and webpack with * `parser.javascript.url: false` (Angular CLI) inlines a build-time `file:` URL. The URL must * therefore be checked before MapLibre uses it, see {@link resolveMapLibreWorkerUrl}. * * @internal */ export declare function getBundledMapLibreWorkerUrl(): string; /** * Resolves the URL MapLibre starts its worker from: the bundled worker file when the bundler * emitted it next to the page, the inline worker otherwise. * * @param assetUrl - URL of the bundled worker file, defaults to {@link getBundledMapLibreWorkerUrl} * @internal */ export declare function resolveMapLibreWorkerUrl(assetUrl?: string): Promise; /** * Creates the function that points MapLibre at a worker unless a worker URL is configured already. * * @remarks * The worker URL is global to the maplibre-gl module. A consumer that called maplibre's own * `setWorkerUrl` before the first map is created keeps its own worker; this is also the way to * host the worker file yourself on a page whose content security policy does not allow `blob:` * workers. Otherwise the bundled worker is resolved once and shared by all maps, which is why the * cache lives in the created function: tests create their own, the runtime uses * {@link ensureMapLibreWorkerUrl}. * * @param resolveWorkerUrl - resolves the URL of the worker this package ships * @internal */ export declare function createMapLibreWorkerUrlEnsurer(resolveWorkerUrl?: () => Promise): (maplibregl: IMapLibreWorkerConfig) => Promise; /** * Points MapLibre at a worker unless a worker URL is configured already, see * {@link createMapLibreWorkerUrlEnsurer}. * * @internal */ export declare const ensureMapLibreWorkerUrl: (maplibregl: IMapLibreWorkerConfig) => Promise; //# sourceMappingURL=mapWorker.d.ts.map