feat: v0.1.0 — scaffold + MapLibre map with EU airports

This commit is contained in:
2026-09-16 18:24:27 +00:00
parent fd2a887524
commit 30e33a08cf
23 changed files with 10813 additions and 5 deletions
+20
View File
@@ -0,0 +1,20 @@
import { promises as fs } from 'node:fs';
import path from 'node:path';
// Serves maplibre-gl dist files (worker + its relative imports) straight from
// node_modules so they always match the installed version. MapLibre cannot derive
// working URLs for these when bundled by Turbopack/webpack, and the worker script
// uses a relative import ("./maplibre-gl-shared.mjs") that must resolve against
// this same prefix.
export async function GET(_req: Request, ctx: { params: Promise<{ file: string }> }) {
const { file } = await ctx.params;
if (!/^[\w.-]+\.mjs$/.test(file)) return new Response('not found', { status: 404 });
try {
const body = await fs.readFile(
path.join(process.cwd(), 'node_modules', 'maplibre-gl', 'dist', file),
);
return new Response(body, { headers: { 'content-type': 'text/javascript' } });
} catch {
return new Response('not found', { status: 404 });
}
}