Skip to content

Commit 7dd2a0a

Browse files
committed
chore(deps): bump maplibre-gl to 6.0.0
Clears blocker 2 of #1489 and carries the GeoLibre-side migration. Blocker 1's two external packages are handled by a temporary shim rather than being waited on, so the whole tree builds, tests, and runs on v6 today. v6 is ESM-only with no default export and no CJS build. **Blocker 2 — the frontend suite.** The plugin packages' `exports` maps are correct; the problem was our own module scope. Every workspace package is `"type": "module"`, but the root package.json is not, so tsx compiled all 256 test files to CJS, which selects the `require` condition and loads `.cjs` entries that `require("maplibre-gl")`. `tests/package.json` puts them in ESM scope, and the 29 ERR_PACKAGE_PATH_NOT_EXPORTED failures go to zero. This is a swap, not an addition — v5 ships no ESM build, so it cannot land without the bump. **Blocker 1 — the two external packages.** `@esri/maplibre-arcgis` and `@geoman-io/maplibre-geoman-free` still default-import maplibre-gl in their published ESM. Both are rewritten to namespace imports at load: a Vite plugin for the app build, a Node loader hook for `node --test` (Vite cannot reach the test runner), and an `optimizeDeps.exclude` entry because the dependency optimizer runs outside the plugin pipeline. The two lists are kept in step by `tests/maplibre-shim-parity.test.ts`, and the Vite plugin errors if a package stops matching, so a package that ships a fix cannot be silently shimmed forever. **The worker.** v6 ships its worker as a separate file located at runtime with `new URL("./maplibre-gl-worker.mjs", import.meta.url)` — a computed string no bundler can see. The asset was never emitted, and the URL resolved next to the hashed app chunk, where the SPA fallback answered with index.html, so the request hung instead of 404ing. Tile parsing was silently degraded: the same 25s window pulled 39 tiles before the fix and 68 after. Fixed by emitting the worker through Vite and pointing `setWorkerUrl` at it. Also: - 30 files migrated to `import * as maplibregl from "maplibre-gl"`. - Root `overrides` pin, because `@maplibre/maplibre-gl-directions` still peers `^5.0.0` and would otherwise resolve a second hoisted copy, making `Map` a different nominal type across package boundaries. - `packages/map/src/dynamic-style-property.ts` holds the casts for property names computed at runtime, now that set/getPaint/LayoutProperty are generic over `keyof AllPaintProperties`. - Geoman's `gm:*` events need a cast: `Map#on`/`off`'s catch-all overload narrowed from `type: string` to `keyof MapEventType`. - `GeoAgentSyncableTools`' map slice uses method syntax so a real `Map` still satisfies it under `strictFunctionTypes`. - GeolocateControl is constructed through a factory so tests can substitute a fake — the sealed v6 namespace rejects assignment (same root cause as #1509). - jsPDF is imported by name: its `node` export condition resolves a CJS bundle whose default is the module object, which only surfaced once the tests moved to ESM scope. Verified: test:frontend 4236 passed / 0 failed, coverage 86.93/84.15/71.13, tsc -b + vite build clean, lint 0 errors, test:worker clean. e2e 19/23 locally with all four failures reproducing on this machine independent of the bump (each passes in isolation). Dev server, production build, Geoman's toolbar and the Esri package all verified in a browser.
1 parent a3de391 commit 7dd2a0a

49 files changed

Lines changed: 405 additions & 133 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/geolibre-desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"i18next": "^26.3.6",
6363
"jspdf": "^4.2.1",
6464
"mapillary-js": "^4.1.2",
65-
"maplibre-gl": "^5.24.0",
65+
"maplibre-gl": "^6.0.0",
6666
"maplibre-gl-3d-tiles": "^0.5.6",
6767
"maplibre-gl-basemap-control": "^0.13.0",
6868
"maplibre-gl-components": "^0.30.0",

apps/geolibre-desktop/src/components/layout/FieldCollectionDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
22
import { useTranslation } from "react-i18next";
3-
import maplibregl from "maplibre-gl";
3+
import * as maplibregl from "maplibre-gl";
44
import type { MapController } from "@geolibre/map";
55
import {
66
getAttributeFormField,

apps/geolibre-desktop/src/components/layout/GeoreferencerDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
22
import { useTranslation } from "react-i18next";
3-
import type maplibregl from "maplibre-gl";
3+
import type * as maplibregl from "maplibre-gl";
44
import type { MapController } from "@geolibre/map";
55
import { DEFAULT_LAYER_STYLE, type GeoLibreLayer, useAppStore } from "@geolibre/core";
66
import {

apps/geolibre-desktop/src/components/layout/GpsTrackingDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback, useEffect, useRef, useState } from "react";
22
import { useTranslation } from "react-i18next";
33
import type { Feature, FeatureCollection } from "geojson";
4-
import maplibregl from "maplibre-gl";
4+
import * as maplibregl from "maplibre-gl";
55
import type { MapController } from "@geolibre/map";
66
import { useAppStore } from "@geolibre/core";
77
import {

apps/geolibre-desktop/src/components/layout/MapContextMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
DropdownMenuSeparator,
88
DropdownMenuTrigger,
99
} from "@geolibre/ui";
10-
import type maplibregl from "maplibre-gl";
10+
import type * as maplibregl from "maplibre-gl";
1111
import { BookOpen, Braces, Crosshair, Earth, MapIcon, MapPin, ZoomIn } from "lucide-react";
1212
import { useCallback, useEffect, useRef, useState, type RefObject } from "react";
1313
import { useTranslation } from "react-i18next";

apps/geolibre-desktop/src/components/layout/PixelTimeSeriesControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
useState,
2323
} from "react";
2424
import { useTranslation } from "react-i18next";
25-
import maplibregl from "maplibre-gl";
25+
import * as maplibregl from "maplibre-gl";
2626
import type { MapController } from "@geolibre/map";
2727
import { clamp } from "../../lib/clamp";
2828
import { type ChartDomain, resolveChartDomain } from "../../lib/chart-domain";

apps/geolibre-desktop/src/components/layout/RemoteCursorsOverlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useAppStore, type CollaborationPresence } from "@geolibre/core";
2-
import maplibregl from "maplibre-gl";
2+
import * as maplibregl from "maplibre-gl";
33
import { useEffect, useRef } from "react";
44
import type { RefObject } from "react";
55
import type { MapController } from "@geolibre/map";

apps/geolibre-desktop/src/components/panels/LayerPanelPlaceSearch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
useState,
1010
} from "react";
1111
import { useTranslation } from "react-i18next";
12-
import maplibregl from "maplibre-gl";
12+
import * as maplibregl from "maplibre-gl";
1313
import {
1414
type GeocodeMatch,
1515
geocodeForward,

apps/geolibre-desktop/src/components/storymap/StoryMapHandoutDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type RefObject, useCallback, useEffect, useMemo, useRef, useState } from "react";
2-
import maplibregl from "maplibre-gl";
2+
import * as maplibregl from "maplibre-gl";
33
import { useTranslation } from "react-i18next";
44
import type { StoryActiveSlideMode, StoryChapter, StoryMap } from "@geolibre/core";
55
import type { MapController } from "@geolibre/map";

apps/geolibre-desktop/src/components/storymap/StoryMapPresenter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "react";
1111
import { createPortal } from "react-dom";
1212
import { useTranslation } from "react-i18next";
13-
import maplibregl from "maplibre-gl";
13+
import * as maplibregl from "maplibre-gl";
1414
import {
1515
useAppStore,
1616
type StoryActiveSlideMode,

0 commit comments

Comments
 (0)