spb/internetpressure
Public
TypeScript 36.3%
Python 31.8%
Go 18%
JavaScript 9.8%
Shell 1.9%
SQL 1.4%
CSS 0.5%
1#!/usr/bin/env node2/**3 * MapLibre GL ≥ 6 is ESM-only and spawns a *module* worker resolved from `import.meta.url`4 * (`./maplibre-gl-worker.mjs`). Under Next/Turbopack that URL points at a chunk, so the worker 404s and no tile or5 * GeoJSON is ever parsed (black map). We serve the worker + its shared chunk from /public and call6 * `setWorkerUrl('/maplibre/maplibre-gl-worker.mjs')` before creating the map (see components/map/WorldMap.tsx).7 * Runs on `predev` / `prebuild` so the copy always matches the installed version.8 */9import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';10import { createRequire } from 'node:module';11import path from 'node:path';1213const require = createRequire(import.meta.url);14const dist = path.dirname(require.resolve('maplibre-gl/package.json')) + '/dist';15const out = path.resolve(import.meta.dirname, '../public/maplibre');16mkdirSync(out, { recursive: true });17for (const f of ['maplibre-gl-worker.mjs', 'maplibre-gl-shared.mjs']) copyFileSync(path.join(dist, f), path.join(out, f));18const version = JSON.parse(readFileSync(path.join(dist, '../package.json'), 'utf8')).version;19writeFileSync(path.join(out, 'VERSION'), `${version}\n`);20console.log(`[maplibre] worker ${version} → public/maplibre/`);21