mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-24 05:43:06 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 293ec89db4 |
@@ -35,6 +35,13 @@ updates:
|
||||
# tooling supports it.
|
||||
- dependency-name: typescript
|
||||
update-types: [version-update:semver-major]
|
||||
# mapbox-gl 3.33 and later read the worker registry key before handling
|
||||
# Set and Error, and maplibre-gl, bundled beside it, stamps that key on
|
||||
# both built-ins: every vector tile then fails with "reading 'omit'".
|
||||
# glWorkerRegistry.test.ts fails on a version with that order; it moves
|
||||
# by hand once mapbox-gl checks the built-ins first again.
|
||||
- dependency-name: mapbox-gl
|
||||
versions: ['>=3.33.0']
|
||||
|
||||
# plugin-sdk is standalone with a lockfile of its own and ships to npm.
|
||||
- package-ecosystem: npm
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@
|
||||
"iso-3166-2": "^1.0.0",
|
||||
"leaflet": "^1.9.4",
|
||||
"lucide-react": "^0.577.0",
|
||||
"mapbox-gl": "^3.35.2",
|
||||
"mapbox-gl": "3.32.0",
|
||||
"maplibre-gl": "6.19.0",
|
||||
"modern-screenshot": "4.7.0",
|
||||
"plyr": "^3.8.5",
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { createRequire } from 'node:module';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// mapbox-gl and maplibre-gl ship in the same bundle, and both pass messages to
|
||||
// their workers through a class registry that stamps `_classRegistryKey` on
|
||||
// constructors. maplibre stamps the built-ins Set and Error globally. mapbox-gl
|
||||
// 3.33 and later read that key before their own Set and Error handling, find no
|
||||
// entry for "Set" in their registry and throw "Cannot read properties of
|
||||
// undefined (reading 'omit')" for every vector tile, so the Mapbox basemap stays
|
||||
// blank while raster layers still load. These read the shipped files because the
|
||||
// clash only exists between the two real libraries.
|
||||
const requireFromClient = createRequire(import.meta.url);
|
||||
|
||||
function distFile(pkg: string, file: string): string {
|
||||
const root = dirname(requireFromClient.resolve(`${pkg}/package.json`));
|
||||
return readFileSync(join(root, 'dist', file), 'utf8');
|
||||
}
|
||||
|
||||
function functionBody(source: string, signature: string): string {
|
||||
const start = source.indexOf(signature);
|
||||
expect(start, `${signature} not found`).toBeGreaterThan(-1);
|
||||
return source.slice(start, source.indexOf('\n}\n', start));
|
||||
}
|
||||
|
||||
describe('GL worker class registry', () => {
|
||||
it('FE-COMP-GLWORKERREGISTRY-001: maplibre-gl stamps the global Set and Error', () => {
|
||||
const maplibre = distFile('maplibre-gl', 'maplibre-gl-dev.mjs');
|
||||
expect(maplibre).toMatch(/register\("Set", Set\)/);
|
||||
expect(maplibre).toMatch(/register\("Error", Error\)/);
|
||||
});
|
||||
|
||||
it('FE-COMP-GLWORKERREGISTRY-002: mapbox-gl handles Set and Error before it reads the registry key', () => {
|
||||
const serialize = functionBody(
|
||||
distFile('mapbox-gl', 'mapbox-gl-dev.js'),
|
||||
'function serialize(input, transferables)'
|
||||
);
|
||||
const registryRead = serialize.indexOf('._classRegistryKey');
|
||||
expect(registryRead).toBeGreaterThan(-1);
|
||||
expect(serialize.indexOf('instanceof Set')).toBeGreaterThan(-1);
|
||||
expect(serialize.indexOf('instanceof Set')).toBeLessThan(registryRead);
|
||||
expect(serialize.indexOf('instanceof Error')).toBeLessThan(registryRead);
|
||||
});
|
||||
});
|
||||
Generated
+4
-4
@@ -91,7 +91,7 @@
|
||||
"iso-3166-2": "^1.0.0",
|
||||
"leaflet": "^1.9.4",
|
||||
"lucide-react": "^0.577.0",
|
||||
"mapbox-gl": "^3.35.2",
|
||||
"mapbox-gl": "3.32.0",
|
||||
"maplibre-gl": "6.19.0",
|
||||
"modern-screenshot": "4.7.0",
|
||||
"plyr": "^3.8.5",
|
||||
@@ -17859,9 +17859,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mapbox-gl": {
|
||||
"version": "3.35.2",
|
||||
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-3.35.2.tgz",
|
||||
"integrity": "sha512-xM+0319FNTS2iOxl0Jelousi31L+ckzOxaXKkIlelanSe2jMlRRNVv3ESezPj6eUGlTDrfaxefk5QM6wQ3ICgg==",
|
||||
"version": "3.32.0",
|
||||
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-3.32.0.tgz",
|
||||
"integrity": "sha512-+P4qrlyejQYLyz1Bfzoe+d5Ff5vAghH54RNHm1q2VeAZqkSjQ5e1XlovQoSHlf4xqpRJtJG58kn8nkLwPMQung==",
|
||||
"license": "SEE LICENSE IN LICENSE.txt",
|
||||
"workspaces": [
|
||||
"src/style-spec",
|
||||
|
||||
Reference in New Issue
Block a user