From 1b998993ddae700da3660f41429f21797a11d169 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Thu, 3 Sep 2026 07:37:13 +0200 Subject: [PATCH] Update maplibre-gl to 6.x maplibre-gl ships ES modules only since 6.0, with no UMD build left to concatenate, so the GL bundle is rolled up by esbuild instead. It still exposes the `maplibregl` global, and Leaflet is aliased to the instance the page already loaded rather than embedded a second time. The tile parsing worker can no longer be inlined; it is built beside the bundle as maps-gl.worker.min.js, and the bundle points maplibre at it from its own script URL, so no template has to know where plugin resources are served from. Keep the bundler sources out of released archives --- bin/release | 2 +- build/leaflet-global.js | 10 + build/maps-gl.js | 19 ++ gulpfile.js | 49 +++- package-lock.json | 576 +++++++++++++++++++++++++++++++++++----- package.json | 3 +- 6 files changed, 578 insertions(+), 81 deletions(-) create mode 100644 build/leaflet-global.js create mode 100644 build/maps-gl.js diff --git a/bin/release b/bin/release index 354af6a..8480822 100755 --- a/bin/release +++ b/bin/release @@ -412,7 +412,7 @@ def add_libs(rel_name, galette_archive): if os.path.exists(target): os.remove(target) - for todrop in ['.github', 'bin', 'node_modules', 'tests']: + for todrop in ['.github', 'bin', 'build', 'node_modules', 'tests']: target = os.path.join(npm_dir, todrop) if os.path.exists(target): shutil.rmtree(target) diff --git a/build/leaflet-global.js b/build/leaflet-global.js new file mode 100644 index 0000000..4350f2f --- /dev/null +++ b/build/leaflet-global.js @@ -0,0 +1,10 @@ +/** + * This file is part of Galette Maps plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2012-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +// Leaflet is already loaded by maps-main.bundle.min.js; hand the bundler that +// instance instead of a second copy, or the plugin would extend a Leaflet the +// page never sees. +module.exports = window.L; diff --git a/build/maps-gl.js b/build/maps-gl.js new file mode 100644 index 0000000..504b395 --- /dev/null +++ b/build/maps-gl.js @@ -0,0 +1,19 @@ +/** + * This file is part of Galette Maps plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2012-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import * as maplibregl from 'maplibre-gl'; +// Registers L.maplibreGL on the Leaflet the page already loaded (see the +// `leaflet` alias in gulpfile.js). +import '@maplibre/maplibre-gl-leaflet'; + +// The worker is shipped next to this bundle; derive its URL from our own +//