map-gl-offline 0.8.8 → 0.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.esm.js +37 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +7397 -40
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/font.d.ts +5 -1
- package/dist/types/tile.d.ts +16 -10
- package/dist/utils/constants.d.ts +6 -1
- package/dist/utils/sqlJsLoader.d.ts +1 -2
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -194,10 +194,15 @@ const MAPBOX_API = {
|
|
|
194
194
|
* Matching is done against the tileset segment of the tile URL template
|
|
195
195
|
* (e.g. `https://api.mapbox.com/v4/mapbox.indoor-v3/{z}/{x}/{y}.vector.pbf`
|
|
196
196
|
* or `mapbox://mapbox.indoor-v3`).
|
|
197
|
+
*
|
|
198
|
+
* The ids below are the ones the live Mapbox Standard style declares — note
|
|
199
|
+
* that the landmark-POI tileset is `mapbox.mapbox-landmark-pois-v1` (doubled
|
|
200
|
+
* `mapbox` segment), unlike the other two. The matcher is delimiter-anchored,
|
|
201
|
+
* so an approximate id silently never matches.
|
|
197
202
|
*/
|
|
198
203
|
const MAPBOX_STANDARD_SPARSE_TILESETS = [
|
|
199
204
|
'mapbox.indoor-v3',
|
|
200
|
-
'mapbox.landmark-pois-v1',
|
|
205
|
+
'mapbox.mapbox-landmark-pois-v1',
|
|
201
206
|
'mapbox.procedural-buildings-v1',
|
|
202
207
|
];
|
|
203
208
|
// Map Providers
|
|
@@ -3302,15 +3307,42 @@ function configureSqlJs(config) {
|
|
|
3302
3307
|
sqlJsPromise = null;
|
|
3303
3308
|
}
|
|
3304
3309
|
/**
|
|
3305
|
-
*
|
|
3306
|
-
*
|
|
3310
|
+
* Resolve the `initSqlJs` factory.
|
|
3311
|
+
*
|
|
3312
|
+
* Bundler builds resolve the npm package via dynamic `import()`, so `sql.js`
|
|
3313
|
+
* only ships with bundles that actually call MBTiles code. The UMD/CDN build
|
|
3314
|
+
* has no module resolver, so the import throws there — fall back to the
|
|
3315
|
+
* `initSqlJs` global that sql.js's own `<script>` build defines.
|
|
3316
|
+
*/
|
|
3317
|
+
async function resolveInitSqlJs() {
|
|
3318
|
+
let importError;
|
|
3319
|
+
try {
|
|
3320
|
+
const mod = (await import('sql.js'));
|
|
3321
|
+
if (typeof mod?.default === 'function')
|
|
3322
|
+
return mod.default;
|
|
3323
|
+
}
|
|
3324
|
+
catch (error) {
|
|
3325
|
+
// Bare specifier not resolvable (UMD/CDN), or the module threw while
|
|
3326
|
+
// initialising. Either way, try the global before giving up.
|
|
3327
|
+
importError = error;
|
|
3328
|
+
}
|
|
3329
|
+
const globalInit = globalThis.initSqlJs;
|
|
3330
|
+
if (typeof globalInit === 'function')
|
|
3331
|
+
return globalInit;
|
|
3332
|
+
// Preserve the original failure — a module that resolved but threw is a
|
|
3333
|
+
// very different problem from one that couldn't be resolved at all.
|
|
3334
|
+
throw new Error('sql.js could not be loaded. Install `sql.js` when bundling, or load ' +
|
|
3335
|
+
'https://cdn.jsdelivr.net/npm/sql.js/dist/sql-wasm.js before map-gl-offline ' +
|
|
3336
|
+
'when using the UMD build.', importError !== undefined ? { cause: importError } : undefined);
|
|
3337
|
+
}
|
|
3338
|
+
/**
|
|
3339
|
+
* Lazily initialise `sql.js`.
|
|
3307
3340
|
*/
|
|
3308
3341
|
async function getSqlJs() {
|
|
3309
3342
|
if (sqlJsPromise)
|
|
3310
3343
|
return sqlJsPromise;
|
|
3311
3344
|
sqlJsPromise = (async () => {
|
|
3312
|
-
const
|
|
3313
|
-
const initSqlJs = mod.default;
|
|
3345
|
+
const initSqlJs = await resolveInitSqlJs();
|
|
3314
3346
|
const options = {};
|
|
3315
3347
|
if (currentConfig.wasmBinary) {
|
|
3316
3348
|
options.wasmBinary = currentConfig.wasmBinary;
|