@tileflow/capture 0.1.0-alpha.26 → 0.1.0-alpha.28

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.
Files changed (2) hide show
  1. package/dist/index.js +42 -1
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -317,6 +317,11 @@ import { open } from "fs/promises";
317
317
  import { createRequire as createRequire2 } from "module";
318
318
  import { dirname as dirname2, join as join2 } from "path";
319
319
  import { getTileflowStyleFontFaces } from "@tileflow/core/runtime";
320
+ import {
321
+ createTileflowLineBackgroundGlyphResponder,
322
+ parseTileflowLineBackgroundGlyphPath,
323
+ tileflowLineBackgroundGlyphRoute
324
+ } from "@tileflow/dev/artifacts";
320
325
  import { assertValidTileflowStyle, TileflowStyleValidationError } from "@tileflow/dev/validation";
321
326
 
322
327
  // src/assets.ts
@@ -336,7 +341,8 @@ var tileflowBrowserModule = `${readFileSync2(
336
341
  "utf8"
337
342
  )}
338
343
  globalThis.__tileflowRegisterContourProtocol = registerTileflowContourProtocol;
339
- globalThis.__tileflowRegisterPmtilesProtocol = registerTileflowPmtilesProtocol;`;
344
+ globalThis.__tileflowRegisterPmtilesProtocol = registerTileflowPmtilesProtocol;
345
+ globalThis.__tileflowAttachAtmosphere = attachTileflowAtmosphere;`;
340
346
  async function captureStandaloneTileflowScene(input) {
341
347
  if (input.scene.target.kind !== "map") {
342
348
  throw new TileflowCaptureError(
@@ -408,6 +414,7 @@ async function captureStandaloneTileflowScene(input) {
408
414
  );
409
415
  const fontFaces = getTileflowStyleFontFaces(input.style);
410
416
  const remoteOrigins = /* @__PURE__ */ new Set();
417
+ let lineBackgroundGlyphs;
411
418
  let syntheticAssetFailure;
412
419
  const resourceFailures = [];
413
420
  let pageFailed = false;
@@ -438,6 +445,35 @@ async function captureStandaloneTileflowScene(input) {
438
445
  return;
439
446
  }
440
447
  }
448
+ if (url.origin === tileflowSyntheticAssetOrigin && url.pathname.startsWith(`/${tileflowLineBackgroundGlyphRoute}/`)) {
449
+ const glyphRequest = parseTileflowLineBackgroundGlyphPath(url.pathname);
450
+ const upstream = glyphRequest ? input.lineBackgroundGlyphs?.[glyphRequest.mapName] : void 0;
451
+ if (!glyphRequest || !upstream || url.search !== "") {
452
+ syntheticAssetFailure = url.pathname.slice(1) || "unknown";
453
+ await route.abort("blockedbyclient");
454
+ return;
455
+ }
456
+ const provider = new URL(
457
+ upstream.replace("{fontstack}", "stack").replace("{range}", "0-255")
458
+ );
459
+ if (!isLoopbackUrl(provider)) remoteOrigins.add(provider.origin);
460
+ lineBackgroundGlyphs ??= createTileflowLineBackgroundGlyphResponder({
461
+ cwd: input.glyphCacheDirectory ?? process.cwd()
462
+ });
463
+ const response = await lineBackgroundGlyphs(
464
+ upstream,
465
+ glyphRequest.fontStack,
466
+ glyphRequest.range
467
+ );
468
+ if (response.status !== 200) recordResourceFailure(url.toString(), response.status);
469
+ await route.fulfill({
470
+ body: Buffer.from(await response.arrayBuffer()),
471
+ contentType: response.headers.get("content-type") ?? "application/x-protobuf",
472
+ headers: { "Access-Control-Allow-Origin": "*" },
473
+ status: response.status
474
+ });
475
+ return;
476
+ }
441
477
  if (url.origin === tileflowSyntheticAssetOrigin) {
442
478
  const fileName = decodeURIComponent(url.pathname.slice(1));
443
479
  const localTileset = url.search === "" ? localTilesets.get(fileName) : void 0;
@@ -917,6 +953,7 @@ window.__tileflowCaptureLoad = async function(input) {
917
953
  style: input.style
918
954
  });
919
955
  window.__tileflowMap = map;
956
+ window.__tileflowAttachAtmosphere(map);
920
957
  return await waitForMapEvent(map, "load", input.mapEventTimeoutMs);
921
958
  } catch (error) {
922
959
  return {status: "failed", reason: "error", message: String(error?.message || error || "")};
@@ -1871,6 +1908,10 @@ var TileflowCaptureSessionImpl = class {
1871
1908
  assets: [...artifacts.assets, ...prepared.assets ?? []],
1872
1909
  browser,
1873
1910
  ...artifacts.localTilesets ? { localTilesets: artifacts.localTilesets } : {},
1911
+ ...artifacts.lineBackgroundGlyphs ? {
1912
+ glyphCacheDirectory: resolve(this.#options.cwd ?? process.cwd()),
1913
+ lineBackgroundGlyphs: artifacts.lineBackgroundGlyphs
1914
+ } : {},
1874
1915
  scene,
1875
1916
  signal,
1876
1917
  style,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/capture",
3
- "version": "0.1.0-alpha.26",
3
+ "version": "0.1.0-alpha.28",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Deterministic local visual capture and comparison for Tileflow maps.",
6
6
  "engines": {
@@ -48,8 +48,8 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@tileflow/core": ">=0.1.0-alpha.28 <0.1.0-beta.0",
52
- "@tileflow/dev": ">=0.1.0-alpha.26 <0.1.0-beta.0",
51
+ "@tileflow/core": ">=0.1.0-alpha.30 <0.1.0-beta.0",
52
+ "@tileflow/dev": ">=0.1.0-alpha.28 <0.1.0-beta.0",
53
53
  "maplibre-gl": "6.9.0",
54
54
  "pixelmatch": "7.2.0",
55
55
  "playwright": "1.62.1",
@@ -68,13 +68,13 @@
68
68
  "vite": "^8.0.16",
69
69
  "vue": "^3.5.39",
70
70
  "webpack": "5.108.3",
71
- "@tileflow/maps": "0.1.0-alpha.5",
72
- "@tileflow/next": "0.1.0-alpha.24",
73
- "@tileflow/svelte": "0.1.0-alpha.25",
74
- "@tileflow/react": "0.1.0-alpha.26",
71
+ "@tileflow/maps": "0.1.0-alpha.7",
72
+ "@tileflow/react": "0.1.0-alpha.28",
75
73
  "@tileflow/vite": "0.1.0-alpha.24",
76
- "@tileflow/vue": "0.1.0-alpha.25",
77
- "@tileflow/webpack": "0.1.0-alpha.24"
74
+ "@tileflow/vue": "0.1.0-alpha.27",
75
+ "@tileflow/webpack": "0.1.0-alpha.24",
76
+ "@tileflow/next": "0.1.0-alpha.24",
77
+ "@tileflow/svelte": "0.1.0-alpha.27"
78
78
  },
79
79
  "scripts": {
80
80
  "build": "tsup src/index.ts src/receipt.ts --format esm --dts --clean --platform node",