refactor: consume external road compiler

This commit is contained in:
2026-08-26 09:23:46 +08:00
parent b78cb6e990
commit 5cde08090e
48 changed files with 257 additions and 15626 deletions

View File

@@ -5,7 +5,8 @@ const assert = require("assert");
const fs = require("fs");
const path = require("path");
const client = path.join(__dirname, "..", "packages", "road-compiler", "workbench", "client");
const packageRoot = path.dirname(require.resolve("@osm-asset/road-compiler/package.json"));
const client = path.join(packageRoot, "workbench", "client");
const html = fs.readFileSync(path.join(client, "index.html"), "utf8");
assert.match(html, /id="width" type="number" min="1" step="0\.01"/);
assert.match(html, /data-layer="sidewalks" type="checkbox" checked> 路缘与步行带/);
@@ -81,7 +82,7 @@ assert.match(app, /fromLonLat/);
assert.match(app, /armFeatures\.push\(new Feature/);
assert.match(app, /headFeatures\.push\(new Feature/);
assert.match(app, /faceFeatures\.push\(new Feature/);
const server = fs.readFileSync(path.join(__dirname, "..", "packages", "road-compiler", "workbench", "server.js"), "utf8");
const server = fs.readFileSync(path.join(packageRoot, "workbench", "server.js"), "utf8");
assert.match(server, /\/api\/traffic-signals\/generate/);
assert.match(server, /function startWorkbench\(/);
assert.match(server, /context\.compileFresh\(\)/, "workbench regeneration must use the host-provided fresh compiler callback");