@tileflow/dev 0.1.0-alpha.19 → 0.1.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  import {
2
- createTileflowBuildArtifacts,
2
+ createTileflowArtifactSession,
3
3
  tileflowArtifactSessionSchemaVersion
4
- } from "./chunk-O7PE6FB2.js";
4
+ } from "./chunk-XTRHREXO.js";
5
5
  import {
6
6
  normalizeTileflowBasePath
7
- } from "./chunk-VEB43KDS.js";
7
+ } from "./chunk-RSBV4L2Y.js";
8
8
  import {
9
9
  TileflowStyleValidationError
10
10
  } from "./chunk-KDFTE4Q5.js";
@@ -12,9 +12,10 @@ import {
12
12
  TileflowValidationError,
13
13
  defaultTileflowApiUrl,
14
14
  defaultTileflowConfigPath
15
- } from "./chunk-BKHIZ7H2.js";
15
+ } from "./chunk-6MGFMKG3.js";
16
16
 
17
17
  // src/server.ts
18
+ import { open } from "fs/promises";
18
19
  import {
19
20
  getTileflowStyleFontFaces,
20
21
  tileflowMapIdSchema,
@@ -1371,15 +1372,11 @@ function renderTileflowComparisonHtml(options) {
1371
1372
  const semanticOwner = typeof contribution?.owner === "string" ? contribution.owner : undefined;
1372
1373
  const semanticTarget = typeof contribution?.target === "string" ? contribution.target : undefined;
1373
1374
  if (!semanticOwner || !semanticTarget) return [];
1374
- const effects = Array.isArray(contribution.effects) ? contribution.effects : [];
1375
+ const operations = Array.isArray(contribution.operations) ? contribution.operations : [];
1375
1376
  const authoringPaths = [...new Set([
1376
1377
  "modules." + semanticOwner,
1377
1378
  ...causalStringArray(contribution.authoringPaths),
1378
- ...effects.flatMap((effect) =>
1379
- (effect?.kind === "add" || effect?.kind === "patch") && typeof effect.target === "string"
1380
- ? ["compilerEffects." + effect.target + "." + effect.kind]
1381
- : []
1382
- )
1379
+ ...(operations.length > 0 ? ["modules." + semanticOwner + ".renderStack"] : [])
1383
1380
  ])];
1384
1381
  const themeTokens = causalArray(contribution.themeTokens);
1385
1382
  return [{
@@ -1673,6 +1670,11 @@ function createTileflowNodeRequest(request) {
1673
1670
  const protocol = getNodeHeader(request, "x-forwarded-proto") ?? "http";
1674
1671
  const host = getNodeHeader(request, "host") ?? "localhost";
1675
1672
  return new Request(`${protocol}://${host}${request.url ?? "/"}`, {
1673
+ headers: Object.fromEntries(
1674
+ Object.entries(request.headers).flatMap(
1675
+ ([name, value]) => value === void 0 ? [] : [[name, Array.isArray(value) ? value.join(", ") : value]]
1676
+ )
1677
+ ),
1676
1678
  method: request.method
1677
1679
  });
1678
1680
  }
@@ -1706,7 +1708,26 @@ function createTileflowDevRequestHandler(options = {}) {
1706
1708
  const configPath = options.config ?? defaultTileflowConfigPath;
1707
1709
  const cwd = options.cwd ?? process.cwd();
1708
1710
  const apiBaseUrl = options.apiBaseUrl ?? defaultTileflowApiUrl;
1709
- return async function handleTileflowDevRequest(request) {
1711
+ let ownedSessionPromise;
1712
+ let closed = false;
1713
+ let lastOrigin;
1714
+ const loadOwnedSession = (origin) => {
1715
+ lastOrigin = origin;
1716
+ ownedSessionPromise ??= createTileflowArtifactSession({
1717
+ assetBaseUrl: `${origin}${basePath}`,
1718
+ config: configPath,
1719
+ cwd,
1720
+ inspection: options.inspection,
1721
+ styleBaseUrl: options.styleBaseUrl ?? `${origin}${basePath}`,
1722
+ apiBaseUrl
1723
+ }).catch((error) => {
1724
+ ownedSessionPromise = void 0;
1725
+ throw error;
1726
+ });
1727
+ return ownedSessionPromise;
1728
+ };
1729
+ const handleTileflowDevRequest = async (request) => {
1730
+ if (closed) return jsonResponse2({ error: "Tileflow request handler is closed." }, 503);
1710
1731
  if (request.method !== "GET" && request.method !== "HEAD") {
1711
1732
  return jsonResponse2({ error: "Method not allowed" }, 405);
1712
1733
  }
@@ -1715,6 +1736,7 @@ function createTileflowDevRequestHandler(options = {}) {
1715
1736
  if (path === null) {
1716
1737
  return jsonResponse2({ error: "Not found" }, 404);
1717
1738
  }
1739
+ let acquisition;
1718
1740
  try {
1719
1741
  if (path === "/__events") {
1720
1742
  return options.session ? eventStreamResponse(options.session) : jsonResponse2({ error: "Live events require a development session." }, 404);
@@ -1723,27 +1745,10 @@ function createTileflowDevRequestHandler(options = {}) {
1723
1745
  const runtimeResponse = (await import("./preview-assets-6LYL7GP7.js")).getTileflowPreviewRuntimeResponse(path);
1724
1746
  if (runtimeResponse) return runtimeResponse;
1725
1747
  }
1726
- let artifacts;
1727
- let state;
1728
- if (options.session) {
1729
- artifacts = getSessionArtifacts(options.session);
1730
- state = options.session.getState();
1731
- } else {
1732
- artifacts = await createTileflowBuildArtifacts({
1733
- assetBaseUrl: `${url.origin}${basePath}`,
1734
- config: configPath,
1735
- cwd,
1736
- inspection: options.inspection,
1737
- styleBaseUrl: options.styleBaseUrl ?? `${url.origin}${basePath}`,
1738
- apiBaseUrl
1739
- });
1740
- state = {
1741
- artifacts,
1742
- generation: 1,
1743
- lastGoodGeneration: 1,
1744
- status: "ready"
1745
- };
1746
- }
1748
+ const session = options.session ?? await loadOwnedSession(url.origin);
1749
+ acquisition = session.acquireArtifacts();
1750
+ const artifacts = acquisition?.artifacts;
1751
+ const state = session.getState();
1747
1752
  if (path === "/__status") {
1748
1753
  return jsonResponse2(createTileflowArtifactStatus(state));
1749
1754
  }
@@ -1765,19 +1770,27 @@ function createTileflowDevRequestHandler(options = {}) {
1765
1770
  theme: requestedTheme
1766
1771
  }) : void 0;
1767
1772
  const previewStyle = preview ? artifacts?.styles[preview.mapName]?.[preview.themeName] : void 0;
1768
- const isStreetsPreview = preview !== void 0 && previewStyle?.metadata?.["tileflow:root"] === "streets";
1773
+ const isSemanticPreview = preview !== void 0 && previewStyle?.metadata?.["tileflow:compiler"] === "tileflow-semantic";
1769
1774
  const fontFaces = previewStyle ? getTileflowStyleFontFaces(previewStyle) : [];
1770
1775
  return htmlResponse(
1771
1776
  renderTileflowPreviewHtml(
1772
1777
  preview,
1773
1778
  basePath,
1774
1779
  createTileflowArtifactStatus(state),
1775
- isStreetsPreview,
1780
+ isSemanticPreview,
1776
1781
  fontFaces
1777
1782
  )
1778
1783
  );
1779
1784
  }
1780
1785
  if (!artifacts) return unavailableArtifactsResponse(state);
1786
+ if (path.startsWith("/tilesets/")) {
1787
+ const fileName = path.replace(/^\/+/, "");
1788
+ const localTileset = artifacts.localTilesets?.find(
1789
+ (candidate) => candidate.fileName === fileName
1790
+ );
1791
+ if (!localTileset) return jsonResponse2({ error: "Unknown local tileset." }, 404);
1792
+ return localTilesetResponse(request, localTileset);
1793
+ }
1781
1794
  if (path.startsWith("/generations/") && "files" in artifacts) {
1782
1795
  const fileName = path.replace(/^\/+/, "");
1783
1796
  const asset = artifacts.files?.find((candidate) => candidate.fileName === fileName);
@@ -1826,8 +1839,77 @@ function createTileflowDevRequestHandler(options = {}) {
1826
1839
  } catch (error) {
1827
1840
  options.onError?.(error);
1828
1841
  return tileflowErrorResponse(error);
1842
+ } finally {
1843
+ await acquisition?.release();
1829
1844
  }
1830
1845
  };
1846
+ return Object.assign(handleTileflowDevRequest, {
1847
+ async close() {
1848
+ if (closed) return;
1849
+ closed = true;
1850
+ const ownedSession = await ownedSessionPromise?.catch(() => void 0);
1851
+ await ownedSession?.close();
1852
+ },
1853
+ async refresh() {
1854
+ if (closed) return;
1855
+ if (options.session) {
1856
+ await options.session.refresh("request-handler");
1857
+ return;
1858
+ }
1859
+ if (!lastOrigin) return;
1860
+ await (await loadOwnedSession(lastOrigin)).refresh("request-handler");
1861
+ }
1862
+ });
1863
+ }
1864
+ async function localTilesetResponse(request, file) {
1865
+ const headers = new Headers({
1866
+ "Access-Control-Allow-Origin": "*",
1867
+ "Access-Control-Expose-Headers": "ETag",
1868
+ "Accept-Ranges": "bytes",
1869
+ "Cache-Control": "no-store",
1870
+ "Content-Type": "application/vnd.pmtiles",
1871
+ ETag: file.etag
1872
+ });
1873
+ if (request.method === "HEAD") {
1874
+ headers.set("Content-Length", String(file.byteLength));
1875
+ return new Response(null, { headers, status: 200 });
1876
+ }
1877
+ const range = parseLocalTilesetRange(request.headers.get("range"), file.byteLength);
1878
+ if (!range) {
1879
+ headers.set("Content-Range", `bytes */${file.byteLength}`);
1880
+ return new Response(null, { headers, status: 416 });
1881
+ }
1882
+ const length = range.end - range.start + 1;
1883
+ if (length > 16 * 1024 * 1024) {
1884
+ headers.set("Content-Range", `bytes */${file.byteLength}`);
1885
+ return new Response(null, { headers, status: 416 });
1886
+ }
1887
+ const handle = await open(file.sourcePath, "r");
1888
+ try {
1889
+ const bytes = new Uint8Array(length);
1890
+ let read = 0;
1891
+ while (read < length) {
1892
+ const result = await handle.read(bytes, read, length - read, range.start + read);
1893
+ if (result.bytesRead === 0) throw new Error("Local PMTiles snapshot ended during read.");
1894
+ read += result.bytesRead;
1895
+ }
1896
+ headers.set("Content-Length", String(length));
1897
+ headers.set("Content-Range", `bytes ${range.start}-${range.end}/${file.byteLength}`);
1898
+ return new Response(bytes, { headers, status: 206 });
1899
+ } finally {
1900
+ await handle.close();
1901
+ }
1902
+ }
1903
+ function parseLocalTilesetRange(value, size) {
1904
+ const match = value?.match(/^bytes=(\d+)-(\d*)$/u);
1905
+ if (!match) return null;
1906
+ const start = Number(match[1]);
1907
+ const requestedEnd = match[2] ? Number(match[2]) : size - 1;
1908
+ const end = Math.min(requestedEnd, size - 1);
1909
+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(requestedEnd) || start < 0 || start >= size || requestedEnd < start) {
1910
+ return null;
1911
+ }
1912
+ return { end, start };
1831
1913
  }
1832
1914
  function createTileflowArtifactStatus(state) {
1833
1915
  return {
@@ -1838,10 +1920,6 @@ function createTileflowArtifactStatus(state) {
1838
1920
  ...state.status === "invalid" ? { diagnostics: state.diagnostics } : {}
1839
1921
  };
1840
1922
  }
1841
- function getSessionArtifacts(session) {
1842
- const state = session.getState();
1843
- return state.status === "ready" ? state.artifacts : session.getLastGoodArtifacts();
1844
- }
1845
1923
  function unavailableArtifactsResponse(state) {
1846
1924
  return jsonResponse2(
1847
1925
  {
@@ -1907,7 +1985,7 @@ function getRequestPathname(url) {
1907
1985
  }
1908
1986
  }
1909
1987
  function isOwnedTileflowRequestPath(path) {
1910
- return path === "/" || path === "/build-manifest.json" || path === "/manifest.json" || path === "/__events" || path === "/__status" || getTileflowStyleInspectionSelection(path) !== void 0 || path.startsWith("/generations/") || path.startsWith("/icons/") || getTileflowStyleSelection(path) !== void 0 || path.startsWith("/fonts/") || path.startsWith("/__runtime/");
1988
+ return path === "/" || path === "/build-manifest.json" || path === "/manifest.json" || path === "/__events" || path === "/__status" || getTileflowStyleInspectionSelection(path) !== void 0 || path.startsWith("/generations/") || path.startsWith("/icons/") || path.startsWith("/tilesets/") || getTileflowStyleSelection(path) !== void 0 || path.startsWith("/fonts/") || path.startsWith("/__runtime/");
1911
1989
  }
1912
1990
  function tileflowErrorResponse(error) {
1913
1991
  if (error instanceof Error && "code" in error && error.code === "PREVIEW_SELECTION_INVALID") {
@@ -22,25 +22,40 @@ function createTileflowCommandSummary(input) {
22
22
  }
23
23
  function createTileflowStructuredDiagnostics(error, cwd, defaults) {
24
24
  const inheritedCode = optionalField(error, "code");
25
+ const inheritedDomain = optionalField(error, "domain") ?? optionalField(error, "owner") ?? optionalNestedField(error, "domain") ?? optionalNestedField(error, "owner");
26
+ const inheritedLevel = optionalField(error, "level") ?? optionalNestedField(error, "level");
27
+ const inheritedMessage = optionalField(error, "message") ?? optionalNestedField(error, "message");
28
+ const inheritedPath = optionalField(error, "path") ?? optionalNestedField(error, "path");
25
29
  const inheritedPhase = optionalField(error, "phase") ?? optionalNestedField(error, "phase");
30
+ const inheritedSeverity = optionalField(error, "severity") ?? optionalNestedField(error, "severity");
31
+ const inheritedSuggestion = optionalField(error, "suggestion") ?? optionalNestedField(error, "suggestion");
32
+ const inheritedTarget = optionalField(error, "target") ?? optionalNestedField(error, "target");
26
33
  const issues = getIssues(error);
27
34
  const candidates = issues.length ? issues : [
28
35
  {
29
- message: error instanceof Error ? error.message : "The Tileflow command failed.",
30
- path: ""
36
+ message: inheritedMessage ?? (error instanceof Error ? error.message : "The Tileflow command failed."),
37
+ path: inheritedPath ?? ""
31
38
  }
32
39
  ];
33
40
  const diagnostics = candidates.map((issue) => {
34
41
  const phase = normalizePhase(issue.phase ?? inheritedPhase, defaults.phase);
35
42
  const code = normalizeCode(issue.code ?? inheritedCode, defaults.code);
36
- const severity = normalizeSeverity(issue.severity ?? issue.level, defaults.severity ?? "error");
43
+ const severity = normalizeSeverity(
44
+ issue.severity ?? issue.level ?? inheritedSeverity ?? inheritedLevel,
45
+ defaults.severity ?? "error"
46
+ );
47
+ const domain = sanitizeDiagnosticContext(issue.domain ?? issue.owner ?? inheritedDomain, cwd);
48
+ const target = sanitizeDiagnosticContext(issue.target ?? inheritedTarget, cwd);
49
+ const suggestion = issue.suggestion ?? inheritedSuggestion;
37
50
  return {
38
51
  phase,
39
52
  code,
40
- path: boundText(sanitizePath(issue.path ?? "", cwd), 300),
53
+ ...domain ? { domain } : {},
54
+ path: boundText(sanitizePath(issue.path ?? inheritedPath ?? "", cwd), 300),
55
+ ...target ? { target } : {},
41
56
  severity,
42
57
  message: boundText(sanitizeMessage(issue.message, cwd), 300),
43
- suggestion: issue.suggestion ? boundText(sanitizeMessage(issue.suggestion, cwd), 300) : suggestionForDiagnostic(code, phase)
58
+ suggestion: suggestion ? boundText(sanitizeMessage(suggestion, cwd), 300) : suggestionForDiagnostic(code, phase)
44
59
  };
45
60
  });
46
61
  diagnostics.sort(compareDiagnostics);
@@ -64,7 +79,9 @@ function createTileflowCommandFailureDocument(command, error, cwd, defaults) {
64
79
  ok: false,
65
80
  phase: primary.phase,
66
81
  code: primary.code,
82
+ ...primary.domain ? { domain: primary.domain } : {},
67
83
  path: primary.path,
84
+ ...primary.target ? { target: primary.target } : {},
68
85
  severity: primary.severity,
69
86
  message: primary.message,
70
87
  suggestion: primary.suggestion,
@@ -95,12 +112,15 @@ function getIssues(error) {
95
112
  return [
96
113
  {
97
114
  ...typeof candidate.code === "string" ? { code: candidate.code } : {},
115
+ ...typeof candidate.domain === "string" ? { domain: candidate.domain } : {},
98
116
  ...typeof candidate.level === "string" ? { level: candidate.level } : {},
99
117
  message: candidate.message,
118
+ ...typeof candidate.owner === "string" ? { owner: candidate.owner } : {},
100
119
  ...typeof candidate.path === "string" ? { path: candidate.path } : {},
101
120
  ...typeof candidate.phase === "string" ? { phase: candidate.phase } : {},
102
121
  ...typeof candidate.severity === "string" ? { severity: candidate.severity } : {},
103
- ...typeof candidate.suggestion === "string" ? { suggestion: candidate.suggestion } : {}
122
+ ...typeof candidate.suggestion === "string" ? { suggestion: candidate.suggestion } : {},
123
+ ...typeof candidate.target === "string" ? { target: candidate.target } : {}
104
124
  }
105
125
  ];
106
126
  })
@@ -129,6 +149,11 @@ function sanitizePath(value, cwd) {
129
149
  const local = relative(canonicalPath(cwd), canonicalPath(value)).replaceAll(sep, "/");
130
150
  return local.startsWith("../") || local === ".." ? "(external)" : local || ".";
131
151
  }
152
+ function sanitizeDiagnosticContext(value, cwd) {
153
+ if (!value) return void 0;
154
+ const sanitized = boundText(sanitizeMessage(value, cwd), 300);
155
+ return sanitized || void 0;
156
+ }
132
157
  function localPathAliases(path) {
133
158
  return [.../* @__PURE__ */ new Set([resolve(path), canonicalPath(path)])].sort(
134
159
  (left, right) => right.length - left.length
@@ -169,7 +194,7 @@ function suggestionForDiagnostic(code, phase) {
169
194
  return "Review the reported path and run the command again.";
170
195
  }
171
196
  function compareDiagnostics(left, right) {
172
- return diagnosticSeverityRank(left.severity) - diagnosticSeverityRank(right.severity) || compareCodeUnits(left.path, right.path) || compareCodeUnits(left.phase, right.phase) || compareCodeUnits(left.code, right.code) || compareCodeUnits(left.message, right.message) || compareCodeUnits(left.suggestion, right.suggestion);
197
+ return diagnosticSeverityRank(left.severity) - diagnosticSeverityRank(right.severity) || compareCodeUnits(left.path, right.path) || compareCodeUnits(left.domain ?? "", right.domain ?? "") || compareCodeUnits(left.target ?? "", right.target ?? "") || compareCodeUnits(left.phase, right.phase) || compareCodeUnits(left.code, right.code) || compareCodeUnits(left.message, right.message) || compareCodeUnits(left.suggestion, right.suggestion);
173
198
  }
174
199
  function diagnosticSeverityRank(severity) {
175
200
  return severity === "error" ? 0 : severity === "warning" ? 1 : 2;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getFirstTileflowMapName
3
- } from "./chunk-BKHIZ7H2.js";
3
+ } from "./chunk-6MGFMKG3.js";
4
4
 
5
5
  // src/preview.ts
6
6
  import {
7
7
  defaultTileflowRuntimeView,
8
8
  normalizeTileflowCaptureScene,
9
- parseTileflowMap,
9
+ parseResolvedTileflowMap,
10
10
  resolveThemeSelection
11
11
  } from "@tileflow/core";
12
12
 
@@ -140,7 +140,7 @@ function normalizeTileflowLandmarkManifest(candidate, manifestUrl) {
140
140
  }
141
141
 
142
142
  // src/preview-html.ts
143
- function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPreview, fontFaces = []) {
143
+ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isSemanticPreview, fontFaces = []) {
144
144
  const styleUrl = preview ? `${basePath}/styles/${preview.mapName}/${preview.themeName}.json` : void 0;
145
145
  const mapOptions = preview ? previewMapOptions(preview) : void 0;
146
146
  const viewportCss = preview?.viewport ? `
@@ -261,6 +261,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
261
261
  <script type="module">
262
262
  import {loadTileflowStyleFonts} from "${basePath}/__runtime/tileflow-browser.js";
263
263
  import {registerTileflowContourProtocol} from "${basePath}/__runtime/tileflow-browser.js";
264
+ import {registerTileflowPmtilesProtocol} from "${basePath}/__runtime/tileflow-browser.js";
264
265
 
265
266
  const initialStatus = ${JSON.stringify(initialStatus)};
266
267
  const normalizeTileflowLandmarkManifest = ${normalizeTileflowLandmarkManifest.toString()};
@@ -272,7 +273,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
272
273
  const previewLabel = ${JSON.stringify(preview?.label)};
273
274
  const styleUrl = ${JSON.stringify(styleUrl)};
274
275
  const previewMapOptions = ${JSON.stringify(mapOptions)};
275
- const isStreetsPreview = ${JSON.stringify(isStreetsPreview)};
276
+ const isSemanticPreview = ${JSON.stringify(isSemanticPreview)};
276
277
  const previewFontFaces = ${serializeInlineJson(fontFaces)};
277
278
  const treeSearchParameters = new URL(location.href).searchParams;
278
279
  const requestedTreeRenderer = treeSearchParameters.get("treeRenderer");
@@ -364,6 +365,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
364
365
  let threeCoreRuntimePromise;
365
366
  let buildingWireframeRuntimePromise;
366
367
  let landmarkRuntimePromise;
368
+ let pmtilesRuntimePromise;
367
369
  const landmarkManifestPromises = new Map();
368
370
  const landmarkManifestMaximumBytes = 1024 * 1024;
369
371
  const landmarkManifestTimeoutMs = 10000;
@@ -402,7 +404,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
402
404
  import("${basePath}/__runtime/three-addons/loaders/GLTFLoader.js"),
403
405
  import("${basePath}/__runtime/three-addons/loaders/DRACOLoader.js"),
404
406
  import("${basePath}/__runtime/three-addons/libs/meshopt_decoder.module.js"),
405
- import("${basePath}/__runtime/pmtiles.js")
407
+ loadPmtilesRuntime()
406
408
  ]).then(([, gltfLoaderModule, dracoLoaderModule, meshoptDecoderModule, pmtilesModule]) => {
407
409
  GLTFLoader = gltfLoaderModule.GLTFLoader;
408
410
  DRACOLoader = dracoLoaderModule.DRACOLoader;
@@ -418,6 +420,17 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
418
420
  return landmarkRuntimePromise;
419
421
  }
420
422
 
423
+ function loadPmtilesRuntime() {
424
+ if (!pmtilesRuntimePromise) {
425
+ pmtilesRuntimePromise = import("${basePath}/__runtime/pmtiles.js").then((pmtilesModule) => {
426
+ PMTiles = pmtilesModule.PMTiles;
427
+ FetchSource = pmtilesModule.FetchSource;
428
+ return pmtilesModule;
429
+ });
430
+ }
431
+ return pmtilesRuntimePromise;
432
+ }
433
+
421
434
  function waitForLandmarkManifest(promise, signal) {
422
435
  if (!signal) return promise;
423
436
  if (signal.aborted) return Promise.reject(new DOMException("Aborted", "AbortError"));
@@ -3096,7 +3109,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
3096
3109
 
3097
3110
  function addTreeLayerIfConfigured(map, styleLayers) {
3098
3111
  const styleLayer = styleLayers.find(
3099
- (layer) => layer.id === "streets-vegetation-trees"
3112
+ (layer) => layer.id === "tileflow-vegetation-trees"
3100
3113
  );
3101
3114
  if (
3102
3115
  !styleLayer ||
@@ -3631,14 +3644,14 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
3631
3644
  }
3632
3645
  const firstForegroundLabel = styleLayers.find(
3633
3646
  (layer) =>
3634
- (layer.id.startsWith("streets-label-") &&
3635
- !layer.id.startsWith("streets-label-road-")) ||
3636
- layer.id.startsWith("streets-poi-")
3647
+ (layer.id.startsWith("tileflow-label-") &&
3648
+ !layer.id.startsWith("tileflow-label-road-")) ||
3649
+ layer.id.startsWith("tileflow-poi-")
3637
3650
  )?.id;
3638
3651
  const treeLayer = map.getLayer("tileflow-vegetation-trees-3d")
3639
3652
  ? "tileflow-vegetation-trees-3d"
3640
- : map.getLayer("streets-vegetation-trees")
3641
- ? "streets-vegetation-trees"
3653
+ : map.getLayer("tileflow-vegetation-trees")
3654
+ ? "tileflow-vegetation-trees"
3642
3655
  : firstForegroundLabel;
3643
3656
  map.addLayer(createLandmarkLayer(map, configLayer, fallbackLayers), treeLayer);
3644
3657
  }
@@ -3741,7 +3754,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
3741
3754
 
3742
3755
  update() {
3743
3756
  const treeLayer = this.map.getStyle()?.layers?.find(
3744
- (layer) => layer.id === "streets-vegetation-trees"
3757
+ (layer) => layer.id === "tileflow-vegetation-trees"
3745
3758
  );
3746
3759
  if (treeLayer) {
3747
3760
  const visibility = this.enabled ? "visible" : "none";
@@ -3871,6 +3884,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
3871
3884
  maplibregl.setWorkerCount?.(mapWorkerCount);
3872
3885
  await loadTileflowStyleFonts(styleUrl, {fontFaces: previewFontFaces});
3873
3886
  registerTileflowContourProtocol({addProtocol: maplibregl.addProtocol});
3887
+ registerTileflowPmtilesProtocol({addProtocol: maplibregl.addProtocol});
3874
3888
  const map = new maplibregl.Map({
3875
3889
  collectResourceTiming: mapBenchmarkEnabled,
3876
3890
  container: "map",
@@ -3891,7 +3905,7 @@ function renderTileflowPreviewHtml(preview, basePath, initialStatus, isStreetsPr
3891
3905
  map.addControl(new maplibregl.NavigationControl(), "top-right");
3892
3906
  let threeDimensionalControl;
3893
3907
  let treeControl;
3894
- if (isStreetsPreview) {
3908
+ if (isSemanticPreview) {
3895
3909
  threeDimensionalControl = new ThreeDimensionalControl();
3896
3910
  treeControl = new TreeControl();
3897
3911
  map.addControl(threeDimensionalControl, "top-right");
@@ -4157,7 +4171,7 @@ function resolveTileflowPreview(project, selection = {}) {
4157
4171
  `Tileflow scene "${selection.scene}" references an unknown map: ${normalized.map}`
4158
4172
  );
4159
4173
  }
4160
- const map2 = parseTileflowMap(project.maps[normalized.map]);
4174
+ const map2 = parseResolvedTileflowMap(project.maps[normalized.map]);
4161
4175
  const selectedTheme2 = resolvePreviewTheme(map2, normalized.theme);
4162
4176
  return {
4163
4177
  camera: normalized.camera,
@@ -4172,7 +4186,7 @@ function resolveTileflowPreview(project, selection = {}) {
4172
4186
  if (!map) {
4173
4187
  throw new TileflowPreviewSelectionError(`Unknown Tileflow map: ${mapName}`);
4174
4188
  }
4175
- const resolvedMap = parseTileflowMap(map);
4189
+ const resolvedMap = parseResolvedTileflowMap(map);
4176
4190
  const selectedTheme = resolvePreviewTheme(resolvedMap, selection.theme);
4177
4191
  return {
4178
4192
  camera: {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTileflowCommandSummary
3
- } from "./chunk-ZRI6PNFL.js";
3
+ } from "./chunk-LNCTVFUD.js";
4
4
  import {
5
5
  assertValidTileflowStyle,
6
6
  sanitizeDiagnosticSecrets
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  defaultTileflowConfigPath,
10
10
  loadValidTileflowConfigWithInputs
11
- } from "./chunk-BKHIZ7H2.js";
11
+ } from "./chunk-6MGFMKG3.js";
12
12
 
13
13
  // src/inspect.ts
14
14
  import { isAbsolute, relative, resolve, win32 } from "path";
@@ -713,6 +713,9 @@ function sortInspectableValue(value) {
713
713
  Object.keys(value).sort(compareCodeUnits2).map((key) => [key, sortInspectableValue(value[key])])
714
714
  );
715
715
  }
716
+ function sanitizeTileflowInspectableValue(value, cwd) {
717
+ return sanitizeInspectValue(value, cwd);
718
+ }
716
719
  function sanitizeInspectValue(value, cwd, seen = /* @__PURE__ */ new WeakSet(), path = []) {
717
720
  if (typeof value === "string") return sanitizeInspectString(value, cwd, path);
718
721
  if (value === null || typeof value === "boolean" || typeof value === "number") return value;
@@ -797,5 +800,6 @@ export {
797
800
  inspectTileflowFeatures,
798
801
  inspectTileflowConfig,
799
802
  inspectLoadedTileflowConfig,
800
- TileflowConfigInspectionError
803
+ TileflowConfigInspectionError,
804
+ sanitizeTileflowInspectableValue
801
805
  };