diff --git a/docs/maplibre-v6-migration.md b/docs/maplibre-v6-migration.md new file mode 100644 index 0000000..c96a51d --- /dev/null +++ b/docs/maplibre-v6-migration.md @@ -0,0 +1,251 @@ +# MapLibre GL JS v6 Migration Research + +_Pelorus Nav v0.2.2 · MapLibre 5.24.0 → 6.x · Research date: 2026-05-03_ + +--- + +## Summary + +**Recommendation:** Wait for v6.0.0 stable before migrating. As of this writing the latest release is **6.0.0-6** (pre-release, published 2026-05-01). The stable `5.24.0` we ship is the last v5 release. + +**Risk level: Medium.** None of the v6 breaking changes are show-stoppers for Pelorus Nav. The bulk of the work is TypeScript-level: tightened `{get,set}PaintProperty` / `{get,set}LayoutProperty` types will require a typecheck pass, and `GeoJSONSource.setData` loses its second parameter (we don't pass it, so zero changes needed there). The big win is WebGL 2 exclusivity — Android WebView has supported WebGL 2 since Android 8.0, which covers our entire target fleet. The ESM-only distribution is a non-issue for a Vite project. + +The `@maplibre/maplibre-gl-style-spec` pinning concern (we're on exactly 24.8.1 because 24.8.2 stripped public type exports) should resolve naturally: once we point at `maplibre-gl@6`, the style-spec it re-exports will be the v6-bundled version and the separate `@maplibre/maplibre-gl-style-spec` dependency can likely be dropped entirely (all our style-spec imports that come from there are also available as re-exports from `maplibre-gl` itself). + +--- + +## Pre-release Status + +v6.0.0 has **not shipped as stable.** Pre-release cadence (all April–May 2026): + +| Tag | Date | Key change | +|---|---|---| +| 6.0.0-0 | 2026-04-27 | Hash control → URLSearchParams | +| 6.0.0-1 | 2026-04-27 | setData type narrowing; `__$json__` encoding for nested GeoJSON | +| 6.0.0-2 | 2026-04-28 | **WebGL 1 removed; WebGL 2 required** | +| 6.0.0-3 | 2026-04-29 | `GeoJSONSource.setData` second param removed; TS target → ES2022 | +| 6.0.0-4 | 2026-04-29 | `zoomLevelsToOverscale` default 4 (was `undefined`) | +| 6.0.0-5 | 2026-04-29 | **ESM-only; UMD / CSP bundles dropped** | +| 6.0.0-6 | 2026-05-01 | Rolldown bundler; `terrainSkirtLength` option | + +--- + +## Breaking Changes + +### 1. WebGL 2 required (6.0.0-2) +WebGL 1 support is fully removed. Map instantiation will throw (or display an error) on WebGL-1-only browsers. + +**Our exposure:** None in practice. +- Android WebView has supported WebGL 2 since Android 8.0 (API 26). Capacitor's `minSdkVersion` already requires ≥ 26. +- Desktop browsers (Chrome 56+, Firefox 51+, Safari 15+) are all fine. +- The `Map._showWebGL2Error` override hook is available if a custom error UI is needed. + +**Effort:** Trivial. Add a note to `PLAN.md` and close. + +--- + +### 2. ESM-only distribution (6.0.0-5) +The UMD bundle (`maplibre-gl.js`) and CSP-specific bundle (`maplibre-gl-csp.js`) are gone. Only `maplibre-gl.mjs` is published. + +**Our exposure:** None. +- We use Vite, which has always resolved via ESM package exports. +- We have no `