From 3956dd4b5c4b82aacc0f97a5ea5ef5042d3e35a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 15:17:53 +0000 Subject: [PATCH 1/4] [CHORE](deps)(deps): Bump maplibre-gl from 5.24.0 to 6.0.0 Bumps [maplibre-gl](https://github.com/maplibre/maplibre-gl-js) from 5.24.0 to 6.0.0. - [Release notes](https://github.com/maplibre/maplibre-gl-js/releases) - [Changelog](https://github.com/maplibre/maplibre-gl-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/maplibre/maplibre-gl-js/compare/v5.24.0...v6.0.0) --- updated-dependencies: - dependency-name: maplibre-gl dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 153 ++++++++++++++++------------------------------ package.json | 2 +- 2 files changed, 55 insertions(+), 100 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9e697236..4a1d1e07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "clsx": "^2.1.1", "docusaurus-plugin-llms": "^0.5.0", "js-yaml": "^5.2.2", - "maplibre-gl": "^5.24.0", + "maplibre-gl": "^6.0.0", "pmtiles": "^4.4.1", "prism-react-renderer": "^2.1.0", "raw-loader": "^4.0.2", @@ -5305,11 +5305,12 @@ "license": "MIT" }, "node_modules/@mapbox/jsonlint-lines-primitives": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", - "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.3.tgz", + "integrity": "sha512-0SElaV0uMxEnxzBhhX9WTuPyUeMsAN/SS0i16tjuba4/mio63MG9khjC1a0JAiPGXAwvwm4UfHJURCN7nyudQg==", + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">= 22" } }, "node_modules/@mapbox/point-geometry": { @@ -5325,52 +5326,42 @@ "license": "BSD-2-Clause" }, "node_modules/@mapbox/unitbezier": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", - "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-1.0.0.tgz", + "integrity": "sha512-fqd515fjBmANKGGsQ286E2Wvj/XvDFpGzwJxq4CI6jMQue6Oy04uCKp+JWKF00xRTmk6cEu1jPJ9p3xqH8YWqQ==", "license": "BSD-2-Clause" }, "node_modules/@mapbox/vector-tile": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-2.0.4.tgz", - "integrity": "sha512-AkOLcbgGTdXScosBWwmmD7cDlvOjkg/DetGva26pIRiZPdeJYjYKarIlb4uxVzi6bwHO6EWH82eZ5Nuv4T5DUg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-3.0.0.tgz", + "integrity": "sha512-Qf10S1uIHMk20ri/IVBnpS+esUEkVaR5Hftmz88jTInrpmWgPGJfPe3LVjjlE77trLx8tH6qjTG7uWH9hIq/0Q==", "license": "BSD-3-Clause", "dependencies": { "@mapbox/point-geometry": "~1.1.0", "@types/geojson": "^7946.0.16", - "pbf": "^4.0.1" - } - }, - "node_modules/@mapbox/whoots-js": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", - "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", - "license": "ISC", - "engines": { - "node": ">=6.0.0" + "pbf": "^5.0.0" } }, "node_modules/@maplibre/geojson-vt": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/@maplibre/geojson-vt/-/geojson-vt-6.1.0.tgz", - "integrity": "sha512-2eIY4gZxeKIVOZVNkAMb+5NgXhgsMQpOveTQAvnp53LYqHGJZDidk7Ew0Tged9PThidpbS+NFTh0g4zivhPDzQ==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@maplibre/geojson-vt/-/geojson-vt-6.1.1.tgz", + "integrity": "sha512-FVMOcmSP/yqol45t7StApEyTL5/vmqBCuFhH9n+fFuINenhaX+YgHHIt1yJ86S8kln3uJLcMvmEU2cfn6E2eCQ==", "license": "ISC", "dependencies": { - "kdbush": "^4.0.2" + "kdbush": "^4.1.0" } }, "node_modules/@maplibre/maplibre-gl-style-spec": { - "version": "24.8.1", - "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-24.8.1.tgz", - "integrity": "sha512-zxa92qF96ZNojLxeAjnaRpjVCy+swoUNJvDhtpC90k7u5F0TMr4GmvNqMKvYrMoPB8d7gRSXbMG1hBbmgESIsw==", + "version": "26.2.1", + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-26.2.1.tgz", + "integrity": "sha512-QFKCXkOeSzOr8jF75jm6kySOg+dUvOehPhRi68gcOYPHb7U5JloUq0dJW0Y5/fZV8ygfT0Vp2RWodvq+fyxFWA==", "license": "ISC", "dependencies": { - "@mapbox/jsonlint-lines-primitives": "~2.0.2", - "@mapbox/unitbezier": "^0.0.1", + "@mapbox/jsonlint-lines-primitives": "^2.0.3", + "@mapbox/unitbezier": "^1.0.0", "json-stringify-pretty-compact": "^4.0.0", "minimist": "^1.2.8", "quickselect": "^3.0.0", - "rw": "^1.3.3", "tinyqueue": "^3.0.0" }, "bin": { @@ -5380,35 +5371,25 @@ } }, "node_modules/@maplibre/mlt": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/@maplibre/mlt/-/mlt-1.1.8.tgz", - "integrity": "sha512-8vtfYGidr1rNkv5IwIoU2lfe3Oy+Wa8HluzQYcQi9cveU9K3pweAal/poQj4GJ0K/EW4bTQp2wVAs09g2yDRZg==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/@maplibre/mlt/-/mlt-1.1.12.tgz", + "integrity": "sha512-ZeK5w2TTeHOajcLaEQs1KZXw2V9wIKo1PmThlxlsHoXsQsYlBqLJzPOd6tJHRtGTChUY3DPPmjXRArYVvAbmZw==", "license": "(MIT OR Apache-2.0)", "dependencies": { "@mapbox/point-geometry": "^1.1.0" } }, "node_modules/@maplibre/vt-pbf": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@maplibre/vt-pbf/-/vt-pbf-4.3.0.tgz", - "integrity": "sha512-jIvp8F5hQCcreqOOpEt42TJMUlsrEcpf/kI1T2v85YrQRV6PPXUcEXUg5karKtH6oh47XJZ4kHu56pUkOuqA7w==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@maplibre/vt-pbf/-/vt-pbf-4.3.2.tgz", + "integrity": "sha512-j6p0AdjvAR19Z3XaCysle7A4ZSo08tYOzxD0Y9NQylwPAkwJJeYub5b2eVucdeDh7erhv69DahoLOevDRERRUw==", "license": "MIT", "dependencies": { "@mapbox/point-geometry": "^1.1.0", - "@mapbox/vector-tile": "^2.0.4", - "@maplibre/geojson-vt": "^5.0.4", "@types/geojson": "^7946.0.16", - "@types/supercluster": "^7.1.3", - "pbf": "^4.0.1", - "supercluster": "^8.0.1" + "pbf": "^5.1.0" } }, - "node_modules/@maplibre/vt-pbf/node_modules/@maplibre/geojson-vt": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@maplibre/geojson-vt/-/geojson-vt-5.0.4.tgz", - "integrity": "sha512-KGg9sma45S+stfH9vPCJk1J0lSDLWZgCT9Y8u8qWZJyjFlP8MNP1WGTxIMYJZjDvVT3PDn05kN1C95Sut1HpgQ==", - "license": "ISC" - }, "node_modules/@mdx-js/mdx": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.1.tgz", @@ -7533,15 +7514,6 @@ "@types/node": "*" } }, - "node_modules/@types/supercluster": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.3.tgz", - "integrity": "sha512-Z0pOY34GDFl3Q6hUFYf3HkTwKEE02e7QgtJppBt+beEAxnyOpJua+voGFvxINBHa06GwLFFym7gRPY2SiKIfIA==", - "license": "MIT", - "dependencies": { - "@types/geojson": "*" - } - }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", @@ -10853,9 +10825,9 @@ "license": "MIT" }, "node_modules/earcut": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.2.tgz", - "integrity": "sha512-X7hshQbLyMJ/3RPhyObLARM2sNxxmRALLKx1+NVFFnQ9gKzmCrxm9+uLIAdBcvc8FNLpctqlQ2V6AE92Ol9UDQ==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.2.3.tgz", + "integrity": "sha512-vnS4AVwp1KHAF13i1vp1/2D5evWy3k5u/iW/B81QVsUZtV8cv2tU0b2VNFlqvh4kYwrFMDdjPCfAmfyJW9y14Q==", "license": "ISC" }, "node_modules/eastasianwidth": { @@ -14343,9 +14315,9 @@ } }, "node_modules/kdbush": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz", - "integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.1.0.tgz", + "integrity": "sha512-e9vurzrXJQrFX6ckpHP3bvj5l+9CnYzkxDNnNQ1h2QTqdWsUAJgXiKdGNcOa1EY85dU8KbQ+z/FdQdB7P+9yfQ==", "license": "ISC" }, "node_modules/keyv": { @@ -14850,27 +14822,25 @@ } }, "node_modules/maplibre-gl": { - "version": "5.24.0", - "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-5.24.0.tgz", - "integrity": "sha512-ALyFxgtd5R+65UqZ/++lOqwWcC0SNho9c27fYSyLmG7AfnAul2o46F05aDJGPbFU57wos9dgcIySHs0Xe6ia3A==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-6.0.0.tgz", + "integrity": "sha512-1wBgEhzTZfA+cDpFdt0fM1mJA5mJ90fifORJ7D8JcKLJCvPT/iTx9bNxkP7DqEYde65DJd7gE7h83khwNRqdyg==", "license": "BSD-3-Clause", "dependencies": { - "@mapbox/jsonlint-lines-primitives": "^2.0.2", "@mapbox/point-geometry": "^1.1.0", - "@mapbox/tiny-sdf": "^2.1.0", - "@mapbox/unitbezier": "^0.0.1", - "@mapbox/vector-tile": "^2.0.4", - "@mapbox/whoots-js": "^3.1.0", - "@maplibre/geojson-vt": "^6.1.0", - "@maplibre/maplibre-gl-style-spec": "^24.8.1", - "@maplibre/mlt": "^1.1.8", - "@maplibre/vt-pbf": "^4.3.0", + "@mapbox/tiny-sdf": "^2.2.0", + "@mapbox/unitbezier": "^1.0.0", + "@mapbox/vector-tile": "^3.0.0", + "@maplibre/geojson-vt": "^6.1.1", + "@maplibre/maplibre-gl-style-spec": "^26.1.0", + "@maplibre/mlt": "^1.1.12", + "@maplibre/vt-pbf": "^4.3.2", "@types/geojson": "^7946.0.16", - "earcut": "^3.0.2", + "earcut": "^3.2.3", "gl-matrix": "^3.4.4", - "kdbush": "^4.0.2", + "kdbush": "^4.1.0", "murmurhash-js": "^1.0.0", - "pbf": "^4.0.1", + "pbf": "^5.1.2", "potpack": "^2.1.0", "quickselect": "^3.0.0", "tinyqueue": "^3.0.0" @@ -18407,9 +18377,9 @@ "license": "MIT" }, "node_modules/pbf": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pbf/-/pbf-4.0.1.tgz", - "integrity": "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-5.1.2.tgz", + "integrity": "sha512-mnvGdvOrIvJOBGUEdGkrVXjN8E/VkIJCkf2eS1DH2yv82ORUlLttmDt0rWY38yYZmVwciZwBUvHM20qxBZf40w==", "license": "BSD-3-Clause", "dependencies": { "resolve-protobuf-schema": "^2.1.0" @@ -20190,9 +20160,9 @@ "license": "ISC" }, "node_modules/protocol-buffers-schema": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", - "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.1.tgz", + "integrity": "sha512-VG2K63Igkiv9p76tk1lilczEK1cT+kCjKtkdhw1dQZV3k3IXJbd3o6Ho8b9zJZaHSnT2hKe4I+ObmX9w6m5SmQ==", "license": "MIT" }, "node_modules/proxy-addr": { @@ -21289,12 +21259,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/rw": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", - "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", - "license": "BSD-3-Clause" - }, "node_modules/safe-array-concat": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", @@ -22425,15 +22389,6 @@ "postcss": "^8.4.31" } }, - "node_modules/supercluster": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz", - "integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==", - "license": "ISC", - "dependencies": { - "kdbush": "^4.0.2" - } - }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", diff --git a/package.json b/package.json index 1a4f9e8c..133db6b4 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "clsx": "^2.1.1", "docusaurus-plugin-llms": "^0.5.0", "js-yaml": "^5.2.2", - "maplibre-gl": "^5.24.0", + "maplibre-gl": "^6.0.0", "pmtiles": "^4.4.1", "prism-react-renderer": "^2.1.0", "raw-loader": "^4.0.2", From b33346bfb940dfc2ae74141e639818a70cc86f15 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 5 Aug 2026 16:04:27 +0000 Subject: [PATCH 2/4] fix: use maplibre v6 ESM imports Co-authored-by: lowlydba <16843041+lowlydba@users.noreply.github.com> --- src/components/buildings-map.js | 8 +++----- src/components/map.js | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/buildings-map.js b/src/components/buildings-map.js index 88b7f785..2497b684 100644 --- a/src/components/buildings-map.js +++ b/src/components/buildings-map.js @@ -1,6 +1,9 @@ import { useRef, useEffect, useState } from 'react'; import BrowserOnly from '@docusaurus/BrowserOnly'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import * as maplibregl from 'maplibre-gl'; +import 'maplibre-gl/dist/maplibre-gl.css'; +import { Protocol } from 'pmtiles'; import '../css/map.css'; function GlobalBuildingsMapInner() { @@ -16,11 +19,6 @@ function GlobalBuildingsMapInner() { useEffect(() => { if (map.current) return; // stops map from intializing more than once - // Dynamic imports for browser-only modules - const maplibregl = require('maplibre-gl'); - require('maplibre-gl/dist/maplibre-gl.css'); - const { Protocol } = require('pmtiles'); - let protocol = new Protocol(); maplibregl.addProtocol('pmtiles', protocol.tile); diff --git a/src/components/map.js b/src/components/map.js index 67ecad38..ee3e85e8 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -1,5 +1,8 @@ import { useRef, useEffect, useState } from 'react'; import BrowserOnly from '@docusaurus/BrowserOnly'; +import * as maplibregl from 'maplibre-gl'; +import 'maplibre-gl/dist/maplibre-gl.css'; +import { Protocol } from 'pmtiles'; import '../css/map.css'; import { Admins, Buildings, Places, Transportation, Land, Landuse, Water } from './layers.js'; @@ -13,11 +16,6 @@ function MapInner() { useEffect(() => { if (map.current) return; // stops map from intializing more than once - // Dynamic imports for browser-only modules - const maplibregl = require('maplibre-gl'); - require('maplibre-gl/dist/maplibre-gl.css'); - const { Protocol } = require('pmtiles'); - let protocol = new Protocol(); maplibregl.addProtocol('pmtiles', protocol.tile); From f974b5eb3bb576830272439cdef2c8db05870f40 Mon Sep 17 00:00:00 2001 From: John McCall Date: Wed, 5 Aug 2026 13:03:09 -0400 Subject: [PATCH 3/4] [BUG] fix maplibre-gl v6 map embeds not rendering (#467) * [BUG] fix maplibre-gl v6 map embeds not rendering maplibre-gl v6 ships ESM-only. Its worker (maplibre-gl-worker.mjs) statically imports a sibling chunk (maplibre-gl-shared.mjs), and per the v5->v6 migration guide, bundler consumers must call setWorkerUrl() explicitly since import.meta.url no longer resolves the worker inside a bundle. Rspack's asset handling for new URL(..., import.meta.url) only emits the referenced file, not its sibling import, so maplibre-gl-shared.mjs 404s (silently, since the dev server's SPA fallback serves index.html for the missing path with a text/html content type). The worker then fails an opaque module load, the map never fires load/idle, and nothing past the background layer paints, matching the blank map on the branch deploy. Copy both worker files verbatim into static/ via a prestart/prebuild script instead, and point setWorkerUrl() at that static path with useBaseUrl() so it respects the site's baseUrl in PR preview deploys. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: John McCall * Chain worker copy into build/start instead of npm pre-hooks sustainable-npm@v3.0.0 defaults ignore-scripts to true in CI, which silently skips npm's automatic pre/post lifecycle hooks (prestart, prebuild) while still running the script explicitly invoked by npm run. That's why static/maplibre never got populated on the staging PR preview even though the fix worked locally. Verified by setting ignore-scripts=true locally and confirming npm run build still copies the worker files into build/maplibre. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: John McCall --------- Signed-off-by: John McCall Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lowlydba <16843041+lowlydba@users.noreply.github.com> --- .gitignore | 1 + eslint.config.mjs | 2 +- package.json | 7 ++++--- scripts/copy-maplibre-worker.mjs | 22 ++++++++++++++++++++++ src/components/buildings-map.js | 8 ++++++++ src/components/map.js | 8 ++++++++ 6 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 scripts/copy-maplibre-worker.mjs diff --git a/.gitignore b/.gitignore index e69485b2..f39dce80 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .docusaurus node_modules/ build/ +static/maplibre/ diff --git a/eslint.config.mjs b/eslint.config.mjs index 1add0b56..ab745cbc 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -37,6 +37,6 @@ export default [ }, prettier, { - ignores: ['build/', '.docusaurus/', 'node_modules/'], + ignores: ['build/', '.docusaurus/', 'node_modules/', 'static/maplibre/'], }, ]; diff --git a/package.json b/package.json index 79b50296..bc4649a7 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,12 @@ "private": true, "scripts": { "fetch-og": "node scripts/fetch-og-images.mjs", + "copy-maplibre-worker": "node scripts/copy-maplibre-worker.mjs", "docusaurus": "docusaurus", - "start": "npm run docusaurus start", - "build": "npm run docusaurus build", + "start": "npm run copy-maplibre-worker && npm run docusaurus start", + "build": "npm run copy-maplibre-worker && npm run docusaurus build", "swizzle": "docusaurus swizzle", - "deploy": "docusaurus deploy", + "deploy": "npm run copy-maplibre-worker && docusaurus deploy", "clear": "docusaurus clear", "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", diff --git a/scripts/copy-maplibre-worker.mjs b/scripts/copy-maplibre-worker.mjs new file mode 100644 index 00000000..d1209d11 --- /dev/null +++ b/scripts/copy-maplibre-worker.mjs @@ -0,0 +1,22 @@ +// MapLibre GL JS v6 ships ESM-only, and its worker (maplibre-gl-worker.mjs) +// statically imports a sibling chunk (maplibre-gl-shared.mjs). Neither Rspack +// nor webpack's `new URL(..., import.meta.url)` asset handling follows that +// relative import when copying the worker as a build asset, so the sibling +// never lands next to it and the worker fails to load at runtime with an +// opaque error. Copying both files verbatim into static/ (served as-is, +// unprocessed, by Docusaurus) keeps them side by side and importable. +// See src/components/map.js and src/components/buildings-map.js, and the +// MapLibre v5->v6 migration guide's ESM/worker section. +import { copyFileSync, mkdirSync } from 'node:fs'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const source = join(__dirname, '..', 'node_modules', 'maplibre-gl', 'dist'); +const destination = join(__dirname, '..', 'static', 'maplibre'); + +mkdirSync(destination, { recursive: true }); + +for (const file of ['maplibre-gl-worker.mjs', 'maplibre-gl-shared.mjs']) { + copyFileSync(join(source, file), join(destination, file)); +} diff --git a/src/components/buildings-map.js b/src/components/buildings-map.js index 2497b684..209b30c0 100644 --- a/src/components/buildings-map.js +++ b/src/components/buildings-map.js @@ -1,6 +1,7 @@ import { useRef, useEffect, useState } from 'react'; import BrowserOnly from '@docusaurus/BrowserOnly'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import useBaseUrl from '@docusaurus/useBaseUrl'; import * as maplibregl from 'maplibre-gl'; import 'maplibre-gl/dist/maplibre-gl.css'; import { Protocol } from 'pmtiles'; @@ -15,10 +16,17 @@ function GlobalBuildingsMapInner() { const { siteConfig: { customFields }, } = useDocusaurusContext(); + const workerUrl = useBaseUrl('/maplibre/maplibre-gl-worker.mjs'); useEffect(() => { if (map.current) return; // stops map from intializing more than once + // MapLibre GL JS v6 ships ESM-only and can no longer locate its worker + // via import.meta.url inside a bundled chunk, so it must be pointed at + // a statically-served copy explicitly. See scripts/copy-maplibre-worker.mjs + // and the MapLibre v5->v6 migration guide. + maplibregl.setWorkerUrl(workerUrl); + let protocol = new Protocol(); maplibregl.addProtocol('pmtiles', protocol.tile); diff --git a/src/components/map.js b/src/components/map.js index ee3e85e8..8495acd4 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -1,5 +1,6 @@ import { useRef, useEffect, useState } from 'react'; import BrowserOnly from '@docusaurus/BrowserOnly'; +import useBaseUrl from '@docusaurus/useBaseUrl'; import * as maplibregl from 'maplibre-gl'; import 'maplibre-gl/dist/maplibre-gl.css'; import { Protocol } from 'pmtiles'; @@ -12,10 +13,17 @@ function MapInner() { const [lng] = useState(-122.33); const [lat] = useState(47.6); const [zoom] = useState(13); + const workerUrl = useBaseUrl('/maplibre/maplibre-gl-worker.mjs'); useEffect(() => { if (map.current) return; // stops map from intializing more than once + // MapLibre GL JS v6 ships ESM-only and can no longer locate its worker + // via import.meta.url inside a bundled chunk, so it must be pointed at + // a statically-served copy explicitly. See scripts/copy-maplibre-worker.mjs + // and the MapLibre v5->v6 migration guide. + maplibregl.setWorkerUrl(workerUrl); + let protocol = new Protocol(); maplibregl.addProtocol('pmtiles', protocol.tile); From 2f6f5ff418f043d28841463c22f99b2fcade9dcc Mon Sep 17 00:00:00 2001 From: John McCall Date: Wed, 5 Aug 2026 13:08:51 -0400 Subject: [PATCH 4/4] [BUG] Fix DuckDB query tests 403 on STAC fetch and stale fallback release Send a real User-Agent (CloudFront 403s Python-urllib from Actions runners), retry the STAC fetch, and source the fallback release from docusaurus.config.js so there's a single pin to keep fresh. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: John McCall --- scripts/test_queries.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/scripts/test_queries.py b/scripts/test_queries.py index 1cf4cffd..228b5703 100644 --- a/scripts/test_queries.py +++ b/scripts/test_queries.py @@ -22,12 +22,12 @@ import tempfile import time from pathlib import Path -from urllib.request import urlopen +from urllib.request import Request, urlopen import duckdb STAC_URL = "https://stac.overturemaps.org/catalog.json" -FALLBACK_RELEASE = "2026-05-20.0" +DOCUSAURUS_CONFIG = Path(__file__).parent.parent / "docusaurus.config.js" QUERIES_DIR = Path(__file__).parent.parent / "src" / "queries" / "duckdb" # Colorize SQL in the log to set it apart from status lines (GitHub Actions @@ -74,13 +74,28 @@ def limit_copy(stmt: str) -> str: return f"{prefix}SELECT * FROM (\n{inner}\n) _q LIMIT 0{suffix}" +def fallback_release() -> str: + """Reuse the docusaurus fallback so there's one release pin to keep fresh.""" + m = re.search(r"const fallback = '(\d{4}-\d{2}-\d{2}\.\d+)'", DOCUSAURUS_CONFIG.read_text()) + if not m: + sys.exit("No fallback release found in docusaurus.config.js") + return m.group(1) + + def fetch_release() -> str: - try: - with urlopen(STAC_URL, timeout=10) as r: - return json.loads(r.read())["latest"] - except Exception as exc: - print(f" STAC fetch failed ({exc}), falling back to {FALLBACK_RELEASE}") - return FALLBACK_RELEASE + # CloudFront 403s the default Python-urllib user agent from some networks + # (GitHub Actions runners included), so send a real one and retry. + req = Request(STAC_URL, headers={"User-Agent": "overture-docs-query-tests"}) + for attempt in range(1, 4): + try: + with urlopen(req, timeout=10) as r: + return json.loads(r.read())["latest"] + except Exception as exc: + print(f" STAC fetch attempt {attempt} failed ({exc})") + time.sleep(2 * attempt) + fallback = fallback_release() + print(f" Falling back to {fallback} from docusaurus.config.js") + return fallback def split_statements(sql: str) -> list[str]: