tempo-sdk 0.0.69 → 0.0.75

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 (109) hide show
  1. package/dist/assets/index.js +3 -3
  2. package/dist/astro/asset-preview-client.js +2 -2
  3. package/dist/astro.js +17 -11
  4. package/dist/astro.js.map +1 -1
  5. package/dist/canvas/astro.d.ts +1 -1
  6. package/dist/canvas/astro.js +2 -2
  7. package/dist/canvas/editor.d.ts +15 -5
  8. package/dist/canvas/editor.js +13 -8
  9. package/dist/canvas/editor.js.map +1 -1
  10. package/dist/canvas/flutter-preview.d.ts +18 -0
  11. package/dist/canvas/flutter-preview.js +9 -0
  12. package/dist/canvas/flutter-preview.js.map +1 -0
  13. package/dist/canvas/index.d.ts +33 -2
  14. package/dist/canvas/index.js +1134 -26
  15. package/dist/canvas/index.js.map +1 -1
  16. package/dist/canvas/interact-projection.js +5 -4
  17. package/dist/canvas/parser.d.ts +142 -3
  18. package/dist/canvas/parser.js +14 -1
  19. package/dist/canvas/svelte.d.ts +1 -1
  20. package/dist/canvas/svelte.js +2 -2
  21. package/dist/canvas/vue.d.ts +74 -0
  22. package/dist/canvas/vue.js +264 -0
  23. package/dist/canvas/vue.js.map +1 -0
  24. package/dist/{chunk-6BSLP7P3.js → chunk-2YX4WVFH.js} +49 -7
  25. package/dist/chunk-2YX4WVFH.js.map +1 -0
  26. package/dist/chunk-5HIIF354.js +67 -0
  27. package/dist/chunk-5HIIF354.js.map +1 -0
  28. package/dist/{chunk-FE6TYCLF.js → chunk-5VIBKVFO.js} +2 -2
  29. package/dist/{chunk-FE6TYCLF.js.map → chunk-5VIBKVFO.js.map} +1 -1
  30. package/dist/{chunk-77DZCV5Z.js → chunk-CXIW4IKC.js} +2 -2
  31. package/dist/chunk-CYQE3TLC.js +37 -0
  32. package/dist/chunk-CYQE3TLC.js.map +1 -0
  33. package/dist/{chunk-WTQQOLXM.js → chunk-DNSCVLKV.js} +1571 -1410
  34. package/dist/chunk-DNSCVLKV.js.map +1 -0
  35. package/dist/chunk-EGRHWZRV.js +1 -0
  36. package/dist/chunk-EGRHWZRV.js.map +1 -0
  37. package/dist/{chunk-EYKOOLPL.js → chunk-GKDDNDG3.js} +1039 -134
  38. package/dist/chunk-GKDDNDG3.js.map +1 -0
  39. package/dist/{chunk-KOSJXE4G.js → chunk-H6BQZOAW.js} +4 -3
  40. package/dist/chunk-HOBTDB6G.js +112 -0
  41. package/dist/chunk-HOBTDB6G.js.map +1 -0
  42. package/dist/chunk-HZXQPM4W.js +285 -0
  43. package/dist/chunk-HZXQPM4W.js.map +1 -0
  44. package/dist/chunk-SGN7BDRE.js +16 -0
  45. package/dist/chunk-SGN7BDRE.js.map +1 -0
  46. package/dist/{chunk-F23JGM4U.js → chunk-UBTL6JUF.js} +6 -2
  47. package/dist/{chunk-F23JGM4U.js.map → chunk-UBTL6JUF.js.map} +1 -1
  48. package/dist/{chunk-2JRAG36X.js → chunk-WBMO4ZYO.js} +2 -2
  49. package/dist/chunk-WBMO4ZYO.js.map +1 -0
  50. package/dist/{chunk-K3EYTZLL.js → chunk-WTXOWQ7N.js} +3 -1
  51. package/dist/chunk-WTXOWQ7N.js.map +1 -0
  52. package/dist/{chunk-Q2A46HHW.js → chunk-XFPFWTWX.js} +276 -43
  53. package/dist/chunk-XFPFWTWX.js.map +1 -0
  54. package/dist/chunk-XMFVWJUY.js +342 -0
  55. package/dist/chunk-XMFVWJUY.js.map +1 -0
  56. package/dist/{chunk-PXDTH36X.js → chunk-Y72PIE3I.js} +212 -20
  57. package/dist/chunk-Y72PIE3I.js.map +1 -0
  58. package/dist/{chunk-6IR5JY6W.js → chunk-YECMP34I.js} +41 -9
  59. package/dist/chunk-YECMP34I.js.map +1 -0
  60. package/dist/{chunk-NSKYOKG5.js → chunk-ZXC7SZIT.js} +278 -26
  61. package/dist/chunk-ZXC7SZIT.js.map +1 -0
  62. package/dist/{controls-reader-SNMI2UY7.js → controls-reader-Z7OQWYWQ.js} +4 -3
  63. package/dist/{controls-reader-SNMI2UY7.js.map → controls-reader-Z7OQWYWQ.js.map} +1 -1
  64. package/dist/expo/plugin.cjs +301 -58
  65. package/dist/expo/plugin.cjs.map +1 -1
  66. package/dist/expo/plugin.js +1 -1
  67. package/dist/expo-babel-plugin.cjs +301 -58
  68. package/dist/expo-babel-plugin.cjs.map +1 -1
  69. package/dist/expo-babel-plugin.js +1 -1
  70. package/dist/flutter-preview-path.d.ts +9 -0
  71. package/dist/flutter-preview-path.js +16 -0
  72. package/dist/flutter-preview-path.js.map +1 -0
  73. package/dist/index.d.ts +16 -15
  74. package/dist/index.js +9 -6
  75. package/dist/nextjs/plugin.cjs +46 -5
  76. package/dist/nextjs/plugin.cjs.map +1 -1
  77. package/dist/nextjs/plugin.js +1 -1
  78. package/dist/nextjs-loader.cjs +343 -68
  79. package/dist/nextjs-loader.cjs.map +1 -1
  80. package/dist/nextjs.cjs +48 -6
  81. package/dist/nextjs.cjs.map +1 -1
  82. package/dist/nextjs.d.cts +9 -1
  83. package/dist/nextjs.d.ts +9 -1
  84. package/dist/nextjs.js +1 -1
  85. package/dist/nuxt/runtime/identity.d.ts +24 -0
  86. package/dist/nuxt/runtime/identity.js +18 -0
  87. package/dist/nuxt/runtime/identity.js.map +1 -0
  88. package/dist/nuxt.d.ts +102 -0
  89. package/dist/nuxt.js +5673 -0
  90. package/dist/nuxt.js.map +1 -0
  91. package/dist/{storyboard-4YdTYq_e.d.ts → storyboard-CMJVBSXn.d.ts} +9 -3
  92. package/dist/svelte.d.ts +4 -2
  93. package/dist/svelte.js +21 -88
  94. package/dist/svelte.js.map +1 -1
  95. package/dist/vue.d.ts +66 -0
  96. package/dist/vue.js +1403 -0
  97. package/dist/vue.js.map +1 -0
  98. package/package.json +48 -5
  99. package/dist/chunk-2JRAG36X.js.map +0 -1
  100. package/dist/chunk-6BSLP7P3.js.map +0 -1
  101. package/dist/chunk-6IR5JY6W.js.map +0 -1
  102. package/dist/chunk-EYKOOLPL.js.map +0 -1
  103. package/dist/chunk-K3EYTZLL.js.map +0 -1
  104. package/dist/chunk-NSKYOKG5.js.map +0 -1
  105. package/dist/chunk-PXDTH36X.js.map +0 -1
  106. package/dist/chunk-Q2A46HHW.js.map +0 -1
  107. package/dist/chunk-WTQQOLXM.js.map +0 -1
  108. /package/dist/{chunk-77DZCV5Z.js.map → chunk-CXIW4IKC.js.map} +0 -0
  109. /package/dist/{chunk-KOSJXE4G.js.map → chunk-H6BQZOAW.js.map} +0 -0
@@ -113,8 +113,9 @@ function unwrap(node) {
113
113
  }
114
114
 
115
115
  export {
116
- sourceVersionHash,
117
116
  EXPRESSION_FACTS_ATTRIBUTE,
118
- expressionFacts
117
+ DYNAMIC_SLOT_FACT,
118
+ expressionFacts,
119
+ sourceVersionHash
119
120
  };
120
- //# sourceMappingURL=chunk-KOSJXE4G.js.map
121
+ //# sourceMappingURL=chunk-H6BQZOAW.js.map
@@ -0,0 +1,112 @@
1
+ // annotation-identity.ts
2
+ import { existsSync, readFileSync, statSync } from "fs";
3
+ import { dirname, isAbsolute, join, relative, resolve } from "path";
4
+ function resolveAnnotationIdentity(filename, boundary) {
5
+ const absoluteFilename = resolve(filename);
6
+ const sourcePath = relative(boundary.sourceRoot, absoluteFilename);
7
+ const outsideSourceRoot = !sourcePath || /^\.\.(?:[\\/]|$)/.test(sourcePath) || isAbsolute(sourcePath);
8
+ if (outsideSourceRoot) return null;
9
+ if (sourcePath.split(/[\\/]/).includes("node_modules")) return null;
10
+ const filepath = relative(boundary.root, absoluteFilename).replace(
11
+ /\\/g,
12
+ "/"
13
+ );
14
+ if (!filepath || isAbsolute(filepath)) return null;
15
+ return { absoluteFilename, filepath };
16
+ }
17
+ function readModifiedTs(absoluteFilename) {
18
+ return Math.trunc(statSync(absoluteFilename).mtimeMs);
19
+ }
20
+ function defaultSourceRoot(root) {
21
+ let dir = resolve(root);
22
+ for (; ; ) {
23
+ if (isWorkspaceRoot(dir)) return dir;
24
+ const parent = dirname(dir);
25
+ if (parent === dir) return resolve(root);
26
+ dir = parent;
27
+ }
28
+ }
29
+ function isWorkspaceRoot(dir) {
30
+ if (existsSync(join(dir, "pnpm-workspace.yaml"))) return true;
31
+ try {
32
+ const manifest = JSON.parse(
33
+ readFileSync(join(dir, "package.json"), "utf8")
34
+ );
35
+ return manifest?.workspaces != null;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
40
+
41
+ // ../../modules/template-edits/index.ts
42
+ var InvalidStringEditError = class extends Error {
43
+ constructor(message) {
44
+ super(message);
45
+ this.name = "InvalidStringEditError";
46
+ }
47
+ };
48
+ function applyStringEdits(source, edits) {
49
+ const sorted = validateStringEdits(source, edits);
50
+ let nextSource = source;
51
+ for (const edit of sorted) {
52
+ nextSource = nextSource.slice(0, edit.start) + edit.replacement + nextSource.slice(edit.end);
53
+ }
54
+ return nextSource;
55
+ }
56
+ function validateStringEdits(source, edits) {
57
+ return validateEditShape(edits, source.length);
58
+ }
59
+ function validateEditShape(edits, sourceLength) {
60
+ const sorted = [...edits].sort(
61
+ (left, right) => right.start - left.start || right.end - left.end
62
+ );
63
+ for (const edit of sorted) {
64
+ if (!Number.isInteger(edit.start) || !Number.isInteger(edit.end)) {
65
+ throw new InvalidStringEditError("edit offsets must be integers");
66
+ }
67
+ if (edit.start < 0 || edit.end < edit.start || sourceLength !== void 0 && edit.end > sourceLength) {
68
+ throw new InvalidStringEditError(
69
+ sourceLength === void 0 ? `edit [${edit.start}, ${edit.end}) is not a valid source range` : `edit [${edit.start}, ${edit.end}) is outside source length ${sourceLength}`
70
+ );
71
+ }
72
+ }
73
+ for (let index = 0; index < sorted.length - 1; index += 1) {
74
+ const later = sorted[index];
75
+ const earlier = sorted[index + 1];
76
+ if (!later || !earlier) continue;
77
+ if (earlier.start === later.start && (earlier.start === earlier.end || later.start === later.end)) {
78
+ throw new InvalidStringEditError(
79
+ `an insertion and another edit at offset ${earlier.start} have ambiguous order`
80
+ );
81
+ }
82
+ if (earlier.end > later.start) {
83
+ throw new InvalidStringEditError(
84
+ `edits [${earlier.start}, ${earlier.end}) and [${later.start}, ${later.end}) overlap`
85
+ );
86
+ }
87
+ }
88
+ return sorted;
89
+ }
90
+ function mapOffsetThroughStringEdits(offset, edits) {
91
+ if (!Number.isInteger(offset) || offset < 0) {
92
+ throw new InvalidStringEditError(
93
+ "the mapped source offset must be a non-negative integer"
94
+ );
95
+ }
96
+ let delta = 0;
97
+ for (const edit of [...validateEditShape(edits)].reverse()) {
98
+ if (offset < edit.start) break;
99
+ if (offset < edit.end) return null;
100
+ delta += edit.replacement.length - (edit.end - edit.start);
101
+ }
102
+ return offset + delta;
103
+ }
104
+
105
+ export {
106
+ applyStringEdits,
107
+ mapOffsetThroughStringEdits,
108
+ resolveAnnotationIdentity,
109
+ readModifiedTs,
110
+ defaultSourceRoot
111
+ };
112
+ //# sourceMappingURL=chunk-HOBTDB6G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../annotation-identity.ts","../../../modules/template-edits/index.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative, resolve } from \"node:path\";\n\n/** The two directories a framework annotator's options name: `root`, which\n * annotation identity is relative to, and `sourceRoot`, the boundary of the\n * files it may stamp. Host sidecars set `sourceRoot` to the project root\n * while stamps stay relative to the host root; an app's own dev server uses\n * {@link defaultSourceRoot}. */\nexport interface AnnotationBoundary {\n root: string;\n sourceRoot: string;\n}\n\n/**\n * The identity the Svelte and Vue annotators stamp a file with, or null when\n * the file is not theirs to stamp: outside `sourceRoot` or under a\n * `node_modules` directory. `filepath` is relative to `root` with forward\n * slashes, the `data-tempo-filepath` every stamp of the file carries. Pure\n * path logic: a caller adds its own framework and SDK checks.\n */\nexport function resolveAnnotationIdentity(\n filename: string,\n boundary: AnnotationBoundary,\n): { absoluteFilename: string; filepath: string } | null {\n const absoluteFilename = resolve(filename);\n const sourcePath = relative(boundary.sourceRoot, absoluteFilename);\n const outsideSourceRoot =\n !sourcePath ||\n /^\\.\\.(?:[\\\\/]|$)/.test(sourcePath) ||\n isAbsolute(sourcePath);\n if (outsideSourceRoot) return null;\n if (sourcePath.split(/[\\\\/]/).includes(\"node_modules\")) return null;\n const filepath = relative(boundary.root, absoluteFilename).replace(\n /\\\\/g,\n \"/\",\n );\n if (!filepath || isAbsolute(filepath)) return null;\n return { absoluteFilename, filepath };\n}\n\n/** The file's modification time as stamps carry it: whole milliseconds. */\nexport function readModifiedTs(absoluteFilename: string): number {\n return Math.trunc(statSync(absoluteFilename).mtimeMs);\n}\n\n/**\n * The source boundary an annotator uses when its options name none: the root\n * of the package-manager workspace that contains `root` (a folder with\n * `pnpm-workspace.yaml`, or a `package.json` declaring `workspaces`), else\n * `root` itself.\n *\n * An app in a monorepo usually renders much of its UI from workspace\n * packages (vben-admin's apps/web-antd draws its layout from\n * packages/effects/*). Vite serves those by their real paths outside the app\n * folder, so a boundary at the app folder left every such element unstamped\n * on the app's route boards, and canvas edits to it fell back to AI. Tempo's\n * canvas host already stamps them (its boundary is the project root), and\n * React apps do too (their JSX filter has no folder boundary). Installed\n * packages stay out: {@link resolveAnnotationIdentity} refuses any path\n * through `node_modules`.\n */\nexport function defaultSourceRoot(root: string): string {\n let dir = resolve(root);\n for (;;) {\n if (isWorkspaceRoot(dir)) return dir;\n const parent = dirname(dir);\n if (parent === dir) return resolve(root);\n dir = parent;\n }\n}\n\nfunction isWorkspaceRoot(dir: string): boolean {\n if (existsSync(join(dir, \"pnpm-workspace.yaml\"))) return true;\n try {\n const manifest = JSON.parse(\n readFileSync(join(dir, \"package.json\"), \"utf8\"),\n );\n return manifest?.workspaces != null;\n } catch {\n return false;\n }\n}\n","/**\n * The string-edit algebra both template editors plan in (Svelte and Vue):\n * a plan is a list of simultaneous edits in the source's original\n * coordinates, applied tail first, and an anchor is carried through them.\n * One module so the two editors cannot drift; moved verbatim from\n * `svelte-editor/edits.ts`. The Svelte annotator applies these edits, so\n * the SDK ships this file (the publish guard covers it).\n */\n\n/** One edit in original coordinates: `[start, end)` becomes `replacement`. */\nexport interface StringEdit {\n start: number;\n end: number;\n replacement: string;\n}\n\nexport class InvalidStringEditError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"InvalidStringEditError\";\n }\n}\n\n/**\n * Apply simultaneous original-coordinate edits from the end of the source.\n * Invalid, out-of-bounds, or overlapping edits throw before source is changed.\n */\nexport function applyStringEdits(\n source: string,\n edits: readonly StringEdit[],\n): string {\n const sorted = validateStringEdits(source, edits);\n let nextSource = source;\n for (const edit of sorted) {\n nextSource =\n nextSource.slice(0, edit.start) +\n edit.replacement +\n nextSource.slice(edit.end);\n }\n return nextSource;\n}\n\n/** Validate and return edits sorted from greatest to least start offset. */\nexport function validateStringEdits(\n source: string,\n edits: readonly StringEdit[],\n): readonly StringEdit[] {\n return validateEditShape(edits, source.length);\n}\n\nfunction validateEditShape(\n edits: readonly StringEdit[],\n sourceLength?: number,\n): readonly StringEdit[] {\n const sorted = [...edits].sort(\n (left, right) => right.start - left.start || right.end - left.end,\n );\n\n for (const edit of sorted) {\n if (!Number.isInteger(edit.start) || !Number.isInteger(edit.end)) {\n throw new InvalidStringEditError(\"edit offsets must be integers\");\n }\n if (\n edit.start < 0 ||\n edit.end < edit.start ||\n (sourceLength !== undefined && edit.end > sourceLength)\n ) {\n throw new InvalidStringEditError(\n sourceLength === undefined\n ? `edit [${edit.start}, ${edit.end}) is not a valid source range`\n : `edit [${edit.start}, ${edit.end}) is outside source length ${sourceLength}`,\n );\n }\n }\n\n for (let index = 0; index < sorted.length - 1; index += 1) {\n const later = sorted[index];\n const earlier = sorted[index + 1];\n if (!later || !earlier) continue;\n if (\n earlier.start === later.start &&\n (earlier.start === earlier.end || later.start === later.end)\n ) {\n throw new InvalidStringEditError(\n `an insertion and another edit at offset ${earlier.start} have ambiguous order`,\n );\n }\n if (earlier.end > later.start) {\n throw new InvalidStringEditError(\n `edits [${earlier.start}, ${earlier.end}) and [${later.start}, ${later.end}) overlap`,\n );\n }\n }\n\n return sorted;\n}\n\n/**\n * Map an original-source UTF-16 offset through simultaneous StringEdits.\n * Returns null when the offset was inside replaced source and therefore has\n * no exact surviving identity.\n */\nexport function mapOffsetThroughStringEdits(\n offset: number,\n edits: readonly StringEdit[],\n): number | null {\n if (!Number.isInteger(offset) || offset < 0) {\n throw new InvalidStringEditError(\n \"the mapped source offset must be a non-negative integer\",\n );\n }\n let delta = 0;\n for (const edit of [...validateEditShape(edits)].reverse()) {\n if (offset < edit.start) break;\n if (offset < edit.end) return null;\n delta += edit.replacement.length - (edit.end - edit.start);\n }\n return offset + delta;\n}\n"],"mappings":";AAAA,SAAS,YAAY,cAAc,gBAAgB;AACnD,SAAS,SAAS,YAAY,MAAM,UAAU,eAAe;AAmBtD,SAAS,0BACd,UACA,UACuD;AACvD,QAAM,mBAAmB,QAAQ,QAAQ;AACzC,QAAM,aAAa,SAAS,SAAS,YAAY,gBAAgB;AACjE,QAAM,oBACJ,CAAC,cACD,mBAAmB,KAAK,UAAU,KAClC,WAAW,UAAU;AACvB,MAAI,kBAAmB,QAAO;AAC9B,MAAI,WAAW,MAAM,OAAO,EAAE,SAAS,cAAc,EAAG,QAAO;AAC/D,QAAM,WAAW,SAAS,SAAS,MAAM,gBAAgB,EAAE;AAAA,IACzD;AAAA,IACA;AAAA,EACF;AACA,MAAI,CAAC,YAAY,WAAW,QAAQ,EAAG,QAAO;AAC9C,SAAO,EAAE,kBAAkB,SAAS;AACtC;AAGO,SAAS,eAAe,kBAAkC;AAC/D,SAAO,KAAK,MAAM,SAAS,gBAAgB,EAAE,OAAO;AACtD;AAkBO,SAAS,kBAAkB,MAAsB;AACtD,MAAI,MAAM,QAAQ,IAAI;AACtB,aAAS;AACP,QAAI,gBAAgB,GAAG,EAAG,QAAO;AACjC,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK,QAAO,QAAQ,IAAI;AACvC,UAAM;AAAA,EACR;AACF;AAEA,SAAS,gBAAgB,KAAsB;AAC7C,MAAI,WAAW,KAAK,K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AAG;AACzD,UAAM,QAAQ,OAAO,KAAK;AAC1B,UAAM,UAAU,OAAO,QAAQ,CAAC;AAChC,QAAI,CAAC,SAAS,CAAC,QAAS;AACxB,QACE,QAAQ,UAAU,MAAM,UACvB,QAAQ,UAAU,QAAQ,OAAO,MAAM,UAAU,MAAM,MACxD;AACA,YAAM,IAAI;AAAA,QACR,2CAA2C,QAAQ,KAAK;AAAA,MAC1D;AAAA,IACF;AACA,QAAI,QAAQ,MAAM,MAAM,OAAO;AAC7B,YAAM,IAAI;AAAA,QACR,UAAU,QAAQ,KAAK,KAAK,QAAQ,GAAG,UAAU,MAAM,KAAK,KAAK,MAAM,GAAG;AAAA,MAC5E;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAOO,SAAS,4BACd,QACA,OACe;AACf,MAAI,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,GAAG;AAC3C,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,MAAI,QAAQ;AACZ,aAAW,QAAQ,CAAC,GAAG,kBAAkB,KAAK,CAAC,EAAE,QAAQ,GAAG;AAC1D,QAAI,SAAS,KAAK,MAAO;AACzB,QAAI,SAAS,KAAK,IAAK,QAAO;AAC9B,aAAS,KAAK,YAAY,UAAU,KAAK,MAAM,KAAK;AAAA,EACtD;AACA,SAAO,SAAS;AAClB;","names":[]}
@@ -0,0 +1,285 @@
1
+ // host-identity.ts
2
+ import { readFileSync } from "fs";
3
+ import { resolve } from "path";
4
+
5
+ // package.json
6
+ var package_default = {
7
+ name: "tempo-sdk",
8
+ version: "0.0.75",
9
+ publishConfig: {
10
+ tag: "sdk-v2-latest"
11
+ },
12
+ type: "module",
13
+ description: "Tempo SDK \u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types",
14
+ repository: {
15
+ type: "git",
16
+ url: "git+https://github.com/TempoLabsAI/tempo-monorepo.git",
17
+ directory: "tempo-modules/tempo-sdk"
18
+ },
19
+ exports: {
20
+ "./astro/controls": {
21
+ types: "./dist/astro/controls.d.ts",
22
+ import: "./dist/astro/controls.js",
23
+ default: "./dist/astro/controls.js"
24
+ },
25
+ "./astro": {
26
+ types: "./dist/astro.d.ts",
27
+ import: "./dist/astro.js"
28
+ },
29
+ "./astro/client": {
30
+ types: "./astro/client.d.ts"
31
+ },
32
+ "./canvas/astro": {
33
+ types: "./dist/canvas/astro.d.ts",
34
+ import: "./dist/canvas/astro.js"
35
+ },
36
+ "./canvas/astro-contract": {
37
+ types: "./dist/canvas/astro-contract.d.ts",
38
+ import: "./dist/canvas/astro-contract.js"
39
+ },
40
+ ".": {
41
+ types: "./dist/index.d.ts",
42
+ import: "./dist/index.js"
43
+ },
44
+ "./canvas": {
45
+ types: "./dist/canvas/index.d.ts",
46
+ import: "./dist/canvas/index.js"
47
+ },
48
+ "./canvas/svelte": {
49
+ types: "./dist/canvas/svelte.d.ts",
50
+ import: "./dist/canvas/svelte.js"
51
+ },
52
+ "./canvas/vue": {
53
+ types: "./dist/canvas/vue.d.ts",
54
+ import: "./dist/canvas/vue.js"
55
+ },
56
+ "./canvas/interact-projection": {
57
+ types: "./dist/canvas/interact-projection.d.ts",
58
+ import: "./dist/canvas/interact-projection.js"
59
+ },
60
+ "./canvas/parser": {
61
+ types: "./dist/canvas/parser.d.ts",
62
+ import: "./dist/canvas/parser.js"
63
+ },
64
+ "./canvas/editor": {
65
+ types: "./dist/canvas/editor.d.ts",
66
+ import: "./dist/canvas/editor.js"
67
+ },
68
+ "./assets": {
69
+ types: "./dist/assets/index.d.ts",
70
+ import: "./dist/assets/index.js"
71
+ },
72
+ "./assets/parser": {
73
+ types: "./dist/assets/parser.d.ts",
74
+ import: "./dist/assets/parser.js"
75
+ },
76
+ "./assets/editor": {
77
+ types: "./dist/assets/editor.d.ts",
78
+ import: "./dist/assets/editor.js"
79
+ },
80
+ "./nextjs": {
81
+ types: "./dist/nextjs.d.ts",
82
+ import: "./dist/nextjs.js",
83
+ require: "./dist/nextjs.cjs"
84
+ },
85
+ "./nextjs/plugin": {
86
+ types: "./dist/nextjs/plugin.d.ts",
87
+ import: "./dist/nextjs/plugin.js"
88
+ },
89
+ "./nuxt": {
90
+ types: "./dist/nuxt.d.ts",
91
+ import: "./dist/nuxt.js"
92
+ },
93
+ "./expo": {
94
+ types: "./dist/expo-babel-plugin.d.ts",
95
+ import: "./dist/expo-babel-plugin.js",
96
+ require: "./dist/expo-babel-plugin.cjs"
97
+ },
98
+ "./expo/plugin": {
99
+ types: "./dist/expo/plugin.d.ts",
100
+ import: "./dist/expo/plugin.js",
101
+ require: "./dist/expo/plugin.cjs"
102
+ },
103
+ "./svelte": {
104
+ types: "./dist/svelte.d.ts",
105
+ import: "./dist/svelte.js"
106
+ },
107
+ "./vue": {
108
+ types: "./dist/vue.d.ts",
109
+ import: "./dist/vue.js"
110
+ },
111
+ "./astro/asset-preview-client": {
112
+ types: "./dist/astro/asset-preview-client.d.ts",
113
+ import: "./dist/astro/asset-preview-client.js"
114
+ },
115
+ "./flutter-preview-path": {
116
+ types: "./dist/flutter-preview-path.d.ts",
117
+ import: "./dist/flutter-preview-path.js"
118
+ },
119
+ "./canvas/flutter-preview": {
120
+ types: "./dist/canvas/flutter-preview.d.ts",
121
+ import: "./dist/canvas/flutter-preview.js"
122
+ }
123
+ },
124
+ files: [
125
+ "dist",
126
+ "astro/client.d.ts"
127
+ ],
128
+ scripts: {
129
+ clean: "rm -rf dist",
130
+ build: "pnpm run clean && tsup",
131
+ "build:if-missing": "test -f dist/index.js || pnpm run build",
132
+ prepare: "pnpm run build",
133
+ prepublishOnly: "pnpm build",
134
+ demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
135
+ "demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
136
+ "demo:nuxt": "pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev",
137
+ test: "vitest run",
138
+ "test:browser": "vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts",
139
+ "test:watch": "vitest",
140
+ "test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
141
+ "test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
142
+ "test:nextjs:production": "vitest run nextjs-production.test.ts",
143
+ "test:nextjs": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts"
144
+ },
145
+ dependencies: {
146
+ "@rollup/pluginutils": "^5.1.0",
147
+ "oxc-parser": "^0.110.0"
148
+ },
149
+ optionalDependencies: {
150
+ "@astrojs/compiler-rs": "0.5.1"
151
+ },
152
+ peerDependencies: {
153
+ astro: "^7.0.0",
154
+ "@babel/core": "^7.0.0",
155
+ h3: "^1.12.0",
156
+ next: "^13 || ^14 || ^15 || ^16",
157
+ nuxt: "^3.18.0 || ^4.0.0",
158
+ react: "^18 || ^19",
159
+ svelte: "^5.0.0",
160
+ vite: "^5 || ^6 || ^7 || ^8",
161
+ vue: "^3.3.0"
162
+ },
163
+ peerDependenciesMeta: {
164
+ astro: {
165
+ optional: true
166
+ },
167
+ react: {
168
+ optional: true
169
+ },
170
+ "@babel/core": {
171
+ optional: true
172
+ },
173
+ h3: {
174
+ optional: true
175
+ },
176
+ next: {
177
+ optional: true
178
+ },
179
+ nuxt: {
180
+ optional: true
181
+ },
182
+ svelte: {
183
+ optional: true
184
+ },
185
+ vite: {
186
+ optional: true
187
+ },
188
+ vue: {
189
+ optional: true
190
+ }
191
+ },
192
+ devDependencies: {
193
+ "@astrojs/react": "7.0.1",
194
+ "@babel/core": "^7.29.0",
195
+ "@babel/types": "^7.29.0",
196
+ "@modules/annotation": "workspace:*",
197
+ "@modules/astro-editor": "workspace:*",
198
+ "@modules/file-parser": "workspace:*",
199
+ "@modules/frame-pool": "workspace:*",
200
+ "@modules/iframe-projection": "workspace:*",
201
+ "@modules/svelte-editor": "workspace:*",
202
+ "@modules/vue-editor": "workspace:*",
203
+ "@nuxt/kit": "^4.6.2",
204
+ "@types/babel__core": "^7.20.5",
205
+ "@types/node": "^25.0.8",
206
+ "@types/react": "catalog:",
207
+ "@types/react-dom": "catalog:",
208
+ "@vitejs/plugin-react": "catalog:",
209
+ "@vitejs/plugin-vue": "6.0.10",
210
+ astro: "7.3.8",
211
+ h3: "^1.15.11",
212
+ "magic-string": "^0.30.21",
213
+ nuxt: "^4.6.2",
214
+ playwright: "^1.58.2",
215
+ "react-dom": "catalog:",
216
+ "react-dom18": "npm:react-dom@18.3.1",
217
+ react18: "npm:react@18.3.1",
218
+ svelte: "5.56.9",
219
+ tsup: "^8.5.1",
220
+ typescript: "catalog:",
221
+ vite: "catalog:",
222
+ vitest: "catalog:",
223
+ vue: "3.5.44"
224
+ }
225
+ };
226
+
227
+ // release-channel.ts
228
+ var TEMPO_SDK_CHANNEL = package_default.publishConfig.tag;
229
+ function sdkChannelGeneration(channel) {
230
+ if (typeof channel !== "string") return null;
231
+ const match = /^sdk-v([1-9]\d*)-latest$/.exec(channel);
232
+ return match ? Number(match[1]) : null;
233
+ }
234
+ if (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {
235
+ throw new Error("tempo-sdk publishConfig.tag must be sdk-v<N>-latest");
236
+ }
237
+
238
+ // host-identity.ts
239
+ var TEMPO_HOST_IDENTITY_ENDPOINT = "/__tempo/identity";
240
+ var TEMPO_HOST_IDENTITY_CAPABILITY_HEADER = "x-tempo-host-identity";
241
+ var TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;
242
+ var TEMPO_WORKSPACE_NONCE_ENV = "TEMPO_WORKSPACE_NONCE";
243
+ var TEMPO_WORKSPACE_NONCE_META_NAME = "tempo-workspace-nonce";
244
+ var WORKSPACE_NONCE_RELATIVE_PATH = ".tempo/workspace-nonce";
245
+ var MAX_WORKSPACE_NONCE_LENGTH = 128;
246
+ var TEMPO_VUE_ANNOTATION_PLUGIN_NAME = "tempo-vue-source-annotation";
247
+ function normalizeWorkspaceNonce(value) {
248
+ const nonce = value?.trim() ?? "";
249
+ return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH ? nonce : "";
250
+ }
251
+ function readTempoWorkspaceNonce(root = process.cwd()) {
252
+ const fromEnvironment = normalizeWorkspaceNonce(
253
+ process.env[TEMPO_WORKSPACE_NONCE_ENV]
254
+ );
255
+ if (fromEnvironment) return fromEnvironment;
256
+ try {
257
+ return normalizeWorkspaceNonce(
258
+ readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), "utf-8")
259
+ );
260
+ } catch {
261
+ return "";
262
+ }
263
+ }
264
+ function createTempoHostIdentity(framework, options = {}) {
265
+ return {
266
+ tempoHost: true,
267
+ contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,
268
+ workspaceNonce: readTempoWorkspaceNonce(options.root),
269
+ sdkVersion: package_default.version,
270
+ sdkChannel: TEMPO_SDK_CHANNEL,
271
+ pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),
272
+ framework,
273
+ ...options.capabilities ? { capabilities: options.capabilities } : {}
274
+ };
275
+ }
276
+
277
+ export {
278
+ TEMPO_HOST_IDENTITY_ENDPOINT,
279
+ TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,
280
+ TEMPO_WORKSPACE_NONCE_META_NAME,
281
+ TEMPO_VUE_ANNOTATION_PLUGIN_NAME,
282
+ readTempoWorkspaceNonce,
283
+ createTempoHostIdentity
284
+ };
285
+ //# sourceMappingURL=chunk-HZXQPM4W.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport { TEMPO_SDK_CHANNEL } from \"./release-channel\";\n\nimport sdkPackage from \"./package.json\" with { type: \"json\" };\n\nexport const TEMPO_HOST_IDENTITY_ENDPOINT = \"/__tempo/identity\";\nexport const TEMPO_HOST_IDENTITY_CAPABILITY_HEADER = \"x-tempo-host-identity\";\nexport const TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;\nexport const TEMPO_WORKSPACE_NONCE_ENV = \"TEMPO_WORKSPACE_NONCE\";\nexport const TEMPO_WORKSPACE_NONCE_META_NAME = \"tempo-workspace-nonce\";\n\nconst WORKSPACE_NONCE_RELATIVE_PATH = \".tempo/workspace-nonce\";\nconst MAX_WORKSPACE_NONCE_LENGTH = 128;\n\nexport type TempoHostFramework = \"vite\" | \"nextjs\" | \"nuxt\" | \"astro\";\n\n/**\n * The name of `tempoVuePlugin()`'s annotating plugin. A Vite server that runs\n * it reports the `vueSourceAnnotation` capability, which is what proves an\n * app's Vue templates are stamped: `pluginActive` only proves\n * `tempoVitePlugin()`, and a Vue app with that alone serves route documents\n * whose layers carry no `.vue` source.\n */\nexport const TEMPO_VUE_ANNOTATION_PLUGIN_NAME = \"tempo-vue-source-annotation\";\n\n/** Optional features a host's served identity vouches for. */\nexport interface TempoHostIdentityCapabilities {\n /** 1 when the server renders Astro components for the canvas. */\n astroComponents?: number;\n /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */\n vueSourceAnnotation?: number;\n}\n\nexport interface TempoHostIdentity<\n Framework extends TempoHostFramework = TempoHostFramework,\n> {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n sdkChannel: string;\n pluginActive: boolean;\n framework: Framework;\n capabilities?: TempoHostIdentityCapabilities;\n}\n\nfunction normalizeWorkspaceNonce(value: string | undefined): string {\n const nonce = value?.trim() ?? \"\";\n return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH\n ? nonce\n : \"\";\n}\n\nexport function readTempoWorkspaceNonce(root = process.cwd()): string {\n const fromEnvironment = normalizeWorkspaceNonce(\n process.env[TEMPO_WORKSPACE_NONCE_ENV],\n );\n if (fromEnvironment) return fromEnvironment;\n try {\n return normalizeWorkspaceNonce(\n readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), \"utf-8\"),\n );\n } catch {\n return \"\";\n }\n}\n\nexport function createTempoHostIdentity<Framework extends TempoHostFramework>(\n framework: Framework,\n options: {\n root?: string;\n pluginActive?: boolean;\n capabilities?: TempoHostIdentityCapabilities;\n } = {},\n): TempoHostIdentity<Framework> {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n sdkChannel: TEMPO_SDK_CHANNEL,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.75\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return sp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records.ts
2
+ var TEMPO_VUE_SOURCE_REGISTRY_GLOBAL = "__TEMPO_VUE_SOURCE_REGISTRY__";
3
+ var TEMPO_VUE_INVOCATION_MARKER_PREFIX = "__tempo_c";
4
+ function readTempoVueInvocationMarker(functionName) {
5
+ const match = /^__tempo_c(\d+)$/.exec(functionName);
6
+ if (!match) return null;
7
+ const offset = Number(match[1]);
8
+ return Number.isSafeInteger(offset) ? offset : null;
9
+ }
10
+
11
+ export {
12
+ TEMPO_VUE_SOURCE_REGISTRY_GLOBAL,
13
+ TEMPO_VUE_INVOCATION_MARKER_PREFIX,
14
+ readTempoVueInvocationMarker
15
+ };
16
+ //# sourceMappingURL=chunk-SGN7BDRE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../modules/vue-editor/records.ts"],"sourcesContent":["/**\n * The source registry contract between `tempoVuePlugin`, which writes one\n * record per annotated `.vue` file, and the projection's Vue reader, which\n * joins them against the runtime. Dependency-free (types, constants and pure\n * helpers only) so the browser-side projection producer can import it.\n */\n\nimport type { VueJsonValue } from \"./types\";\n\n/**\n * Where a component's non-prop attributes (`class`, `style`, anything not\n * declared) land when it is invoked:\n * - `single-element`: on its one root element.\n * - `single-component`: on its one root component, which decides in turn.\n * - `multi-root`: nowhere automatically (several roots, or a `v-for` root).\n * - `inherit-attrs-false`: nowhere automatically (`inheritAttrs: false`).\n * - `explicit-attrs`: wherever the template binds `$attrs`.\n * - `unknown`: the file does not say literally (a computed `inheritAttrs`,\n * mixins, a slot, built-in or dynamic root, no template).\n */\nexport type VueRootFallthrough =\n | \"single-element\"\n | \"single-component\"\n | \"multi-root\"\n | \"inherit-attrs-false\"\n | \"explicit-attrs\"\n | \"unknown\";\n\n/** The page global the annotated modules register their records under,\n * keyed by `filepath`. */\nexport const TEMPO_VUE_SOURCE_REGISTRY_GLOBAL = \"__TEMPO_VUE_SOURCE_REGISTRY__\";\n\n/** A component invocation's marker is a vnode hook named\n * `__tempo_c<offset>`, where `<offset>` is the UTF-16 offset of the\n * invocation's `<` in the file that wrote it. */\nexport const TEMPO_VUE_INVOCATION_MARKER_PREFIX = \"__tempo_c\";\n\n/** The invocation offset a marker function's name carries, or null when the\n * name is not a Tempo marker. */\nexport function readTempoVueInvocationMarker(\n functionName: string,\n): number | null {\n const match = /^__tempo_c(\\d+)$/.exec(functionName);\n if (!match) return null;\n const offset = Number(match[1]);\n return Number.isSafeInteger(offset) ? offset : null;\n}\n\nexport interface TempoVueComponentSourceRecord {\n readonly kind: \"component\";\n /** The tag as written: `Card`, `ui-button`, `component`. */\n readonly name: string;\n /** Exact UTF-16 offset of the invocation's `<` in the authored source. */\n readonly position: number;\n readonly className?: string;\n readonly style?: string;\n /** Literal author metadata on a component invocation, even when the\n * component does not forward it to a DOM host. */\n readonly locked?: boolean;\n /** Props written as expressions, space separated as the canvas names them\n * (`:class` is `className`), directives in their own spelling\n * (`v-model`, `@click`), and `#slot` when the tag's slot is dynamic; the\n * Vue form of the JSX `data-tempo-expr` stamp, which an invocation has no\n * element to carry. Empty when an object bind is the only one, absent\n * when there is none. */\n readonly expressions?: string;\n /** Each prop the invocation passes as a JSON literal (`label=\"Hi\"`,\n * `:count=\"3\"`), by the name the component declares, as the props panel\n * reads it. The layer publishes them as `data-tempo-component-prop-*`,\n * so the history of a prop edit can check what the file holds after a\n * reload. Absent when it passes none. */\n readonly literalProps?: Readonly<Record<string, VueJsonValue>>;\n /** The invocation itself passes a literal `class` (or none) with nothing\n * that can override it. Whether it reaches the DOM also depends on the\n * invoked file's `rootFallthrough`, which the reader joins. */\n readonly supportsClassName: boolean;\n readonly supportsStyle: boolean;\n}\n\n/** A native element's record. Its expression facts live only in the\n * element's own `data-tempo-expr` stamp, which the reader takes from the\n * DOM, so the record does not repeat them. */\nexport interface TempoVueHostSourceRecord {\n readonly kind: \"host\";\n readonly name: string;\n readonly position: number;\n readonly className?: string;\n readonly style?: string;\n readonly supportsClassName: boolean;\n readonly supportsStyle: boolean;\n}\n\nexport interface TempoVueSourceRegistryRecord {\n /** Absolute path, as @vitejs/plugin-vue's dev build sets `type.__file`. */\n readonly filename: string;\n /** Equals the hosts' `data-tempo-filepath`. */\n readonly filepath: string;\n readonly modifiedTs: number;\n readonly sourceVersion: string;\n /** One per marked invocation, in source order. */\n readonly components: readonly TempoVueComponentSourceRecord[];\n /** One per stamped native element, in source order. */\n readonly hosts: readonly TempoVueHostSourceRecord[];\n readonly rootFallthrough: VueRootFallthrough;\n}\n"],"mappings":";AA8BO,IAAM,mCAAmC;AAKzC,IAAM,qCAAqC;AAI3C,SAAS,6BACd,cACe;AACf,QAAM,QAAQ,mBAAmB,KAAK,YAAY;AAClD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,SAAS,OAAO,MAAM,CAAC,CAAC;AAC9B,SAAO,OAAO,cAAc,MAAM,IAAI,SAAS;AACjD;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXPRESSION_FACTS_ATTRIBUTE,
3
3
  expressionFacts
4
- } from "./chunk-KOSJXE4G.js";
4
+ } from "./chunk-H6BQZOAW.js";
5
5
 
6
6
  // annotation-strategy.ts
7
7
  import { realpathSync, statSync } from "fs";
@@ -22,6 +22,9 @@ var HTML_VOID_ELEMENTS = /* @__PURE__ */ new Set([
22
22
  "track",
23
23
  "wbr"
24
24
  ]);
25
+ function cleanModuleId(id) {
26
+ return id.replace(/[?#].*$/, "");
27
+ }
25
28
  function isIntrinsicElement(tagName) {
26
29
  return tagName.length > 0 && tagName[0] === tagName[0].toLowerCase();
27
30
  }
@@ -101,7 +104,8 @@ function computeTempoAnnotatedProps(params) {
101
104
  }
102
105
 
103
106
  export {
107
+ cleanModuleId,
104
108
  appendModuleVersionRecord,
105
109
  computeTempoAnnotatedProps
106
110
  };
107
- //# sourceMappingURL=chunk-F23JGM4U.js.map
111
+ //# sourceMappingURL=chunk-UBTL6JUF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../annotation-strategy.ts"],"sourcesContent":["import { realpathSync, statSync } from \"node:fs\";\nimport { relative } from \"node:path\";\n\nimport type {\n ElementInfo,\n PropValue,\n} from \"../../modules/annotation/annotate-file.ts\";\nimport {\n EXPRESSION_FACTS_ATTRIBUTE,\n expressionFacts,\n} from \"../../modules/annotation/expression-facts.ts\";\nimport { sourceVersionHash } from \"../../modules/annotation/source-version.ts\";\n\nexport const DEFAULT_EXCLUDE = [\"**/node_modules/**\"] as const;\n\n/**\n * Static per-component declaration of whether a custom component accepts\n * `children`. Supplied by callers that know this from a fixed table (e.g. the\n * Expo plugin's React Native host-component overrides). The Vite/Next.js\n * plugins supply no overrides — custom components are left without a\n * `supports-children` flag and consumers treat their support as unknown.\n */\nexport interface ElementTypeSupport {\n supportsChildren: boolean;\n}\n\n/** HTML void elements that cannot have children (self-closing only). */\nexport const HTML_VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nexport type ComputeAnnotatedProps = (\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n) => Record<string, PropValue>;\n\nexport function cleanModuleId(id: string): string {\n return id.replace(/[?#].*$/, \"\");\n}\n\nexport function resolveCanonicalRoot(root: string): string {\n try {\n return realpathSync.native(root);\n } catch {\n return root;\n }\n}\n\nexport function isIntrinsicElement(tagName: string): boolean {\n return tagName.length > 0 && tagName[0] === tagName[0]!.toLowerCase();\n}\n\nexport function hasJsxAttribute(info: ElementInfo, attrName: string): boolean {\n for (const attr of info.element.openingElement.attributes) {\n const name = (attr as { name?: { name?: unknown } }).name;\n if (name?.name === attrName) return true;\n }\n return false;\n}\n\nexport function defaultComputeAnnotatedProps(\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n): Record<string, PropValue> {\n return {\n \"data-tempo-filepath\": filepath,\n \"data-tempo-position\": info.element.openingElement.start,\n \"data-tempo-modifiedts\": modifiedtsMs,\n // Content-hash identity of the file this element was annotated from. The\n // canvas reconcile loop equality-compares it against the write pipeline's\n // computed version to decide whether a capture reflects a given edit.\n \"data-tempo-source-version\": sourceVersion,\n };\n}\n\n/**\n * Appends the module version record: one guarded statement that runs when the\n * browser evaluates the module and pushes `{file, modifiedTs, sourceVersion}`\n * onto `globalThis.__TEMPO_MODULE_VERSIONS__`, keyed by the same `filepath`\n * the element stamps carry. The projection producer joins these records to\n * React's refresh so the canvas learns that a write reached the host even\n * when the write left no element of the file on a board (V2-498).\n *\n * It is appended to every filtered module, JSX or not: a write that removes a\n * file's last element is exactly the case that needs it. It goes at the end\n * so it never displaces a leading directive such as \"use client\", and adds no\n * line above existing code so positions and source maps are unchanged. The\n * `window` guard keeps server-side evaluation (Next server components, SSR)\n * from recording anything.\n */\nexport function appendModuleVersionRecord(\n source: string,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n): string {\n const record = JSON.stringify({\n file: filepath,\n modifiedTs: modifiedtsMs,\n sourceVersion,\n });\n return `${source}\\n;typeof window !== \"undefined\" && (globalThis.__TEMPO_MODULE_VERSIONS__ || (globalThis.__TEMPO_MODULE_VERSIONS__ = [])).push(${record});\\n`;\n}\n\nexport function computeTempoAnnotatedProps(params: {\n info: ElementInfo;\n filepath: string;\n modifiedtsMs: number;\n sourceVersion: string;\n computeAnnotatedProps?: ComputeAnnotatedProps;\n elementSupportOverrides?: ReadonlyMap<string, ElementTypeSupport>;\n}): Record<string, PropValue> {\n const {\n info,\n filepath,\n modifiedtsMs,\n sourceVersion,\n computeAnnotatedProps,\n elementSupportOverrides,\n } = params;\n\n const userProps = {\n ...(computeAnnotatedProps\n ? computeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion)\n : defaultComputeAnnotatedProps(\n info,\n filepath,\n modifiedtsMs,\n sourceVersion,\n )),\n // Only a caller that knows the parent can say whether the slot is a JSX\n // child; without it every element would read as a dynamic slot.\n ...(info.parentType !== undefined &&\n !hasJsxAttribute(info, EXPRESSION_FACTS_ATTRIBUTE)\n ? {\n [EXPRESSION_FACTS_ATTRIBUTE]: expressionFacts(\n info.element,\n info.parentType,\n ),\n }\n : {}),\n };\n\n if (isIntrinsicElement(info.tagName)) {\n return {\n ...userProps,\n \"data-tempo-supports-children\": hasJsxAttribute(\n info,\n \"data-tempo-supports-children\",\n )\n ? undefined\n : !HTML_VOID_ELEMENTS.has(info.tagName),\n };\n }\n\n const override = elementSupportOverrides?.get(info.tagName);\n if (override) {\n return {\n ...userProps,\n \"data-tempo-supports-children\": hasJsxAttribute(\n info,\n \"data-tempo-supports-children\",\n )\n ? undefined\n : override.supportsChildren,\n };\n }\n\n // Custom component with no static override: emit no `data-tempo-supports-*`\n // flags. Determining them required a per-file TypeScript program, which was\n // removed for being the dominant cost of devserver startup. Consumers treat\n // the absent flags as \"unknown\" and fall back to their own defaults.\n return userProps;\n}\n\nexport function getFileAnnotationContext(params: {\n source: string;\n filename: string;\n root: string;\n canonicalizeFilename?: boolean;\n}): {\n cleanFilename: string;\n filepath: string;\n modifiedtsMs: number;\n sourceVersion: string;\n} {\n const rawCleanFilename = cleanModuleId(params.filename);\n let cleanFilename = rawCleanFilename;\n if (params.canonicalizeFilename) {\n try {\n cleanFilename = realpathSync.native(rawCleanFilename);\n } catch {\n cleanFilename = rawCleanFilename;\n }\n }\n return {\n cleanFilename,\n filepath: relative(params.root, cleanFilename),\n modifiedtsMs: Math.trunc(statSync(cleanFilename).mtimeMs),\n // Hashed once per file per transform (the context is built once, reused\n // for every element) so the per-element funnel just forwards the token.\n sourceVersion: sourceVersionHash(params.source),\n };\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAc,gBAAgB;AACvC,SAAS,gBAAgB;AA0BlB,IAAM,qBAAqB,oBAAI,IAAI;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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AAA,QAC9B;AAAA,QACA;AAAA,MACF,IACI,SACA,CAAC,mBAAmB,IAAI,KAAK,OAAO;AAAA,IAC1C;AAAA,EACF;AAEA,QAAM,WAAW,yBAAyB,IAAI,KAAK,OAAO;AAC1D,MAAI,UAAU;AACZ,WAAO;AAAA,MACL,GAAG;AAAA,MACH,gCAAgC;AAAA,QAC9B;AAAA,QACA;AAAA,MACF,IACI,SACA,SAAS;AAAA,IACf;AAAA,EACF;AAMA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../annotation-strategy.ts"],"sourcesContent":["import { realpathSync, statSync } from \"node:fs\";\nimport { relative } from \"node:path\";\n\nimport type {\n ElementInfo,\n PropValue,\n} from \"../../modules/annotation/annotate-file.ts\";\nimport {\n EXPRESSION_FACTS_ATTRIBUTE,\n expressionFacts,\n} from \"../../modules/annotation/expression-facts.ts\";\nimport { sourceVersionHash } from \"../../modules/annotation/source-version.ts\";\n\nexport const DEFAULT_EXCLUDE = [\"**/node_modules/**\"] as const;\n\n/**\n * Static per-component declaration of whether a custom component accepts\n * `children`. Supplied by callers that know this from a fixed table (e.g. the\n * Expo plugin's React Native host-component overrides). The Vite/Next.js\n * plugins supply no overrides — custom components are left without a\n * `supports-children` flag and consumers treat their support as unknown.\n */\nexport interface ElementTypeSupport {\n supportsChildren: boolean;\n}\n\n/** HTML void elements that cannot have children (self-closing only). */\nexport const HTML_VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nexport type ComputeAnnotatedProps = (\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n) => Record<string, PropValue>;\n\nexport function cleanModuleId(id: string): string {\n return id.replace(/[?#].*$/, \"\");\n}\n\nexport function resolveCanonicalRoot(root: string): string {\n try {\n return realpathSync.native(root);\n } catch {\n return root;\n }\n}\n\nexport function isIntrinsicElement(tagName: string): boolean {\n return tagName.length > 0 && tagName[0] === tagName[0]!.toLowerCase();\n}\n\nexport function hasJsxAttribute(info: ElementInfo, attrName: string): boolean {\n for (const attr of info.element.openingElement.attributes) {\n const name = (attr as { name?: { name?: unknown } }).name;\n if (name?.name === attrName) return true;\n }\n return false;\n}\n\nexport function defaultComputeAnnotatedProps(\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n): Record<string, PropValue> {\n return {\n \"data-tempo-filepath\": filepath,\n \"data-tempo-position\": info.element.openingElement.start,\n \"data-tempo-modifiedts\": modifiedtsMs,\n // Content-hash identity of the file this element was annotated from. The\n // canvas reconcile loop equality-compares it against the write pipeline's\n // computed version to decide whether a capture reflects a given edit.\n \"data-tempo-source-version\": sourceVersion,\n };\n}\n\n/**\n * Appends the module version record: one guarded statement that runs when the\n * browser evaluates the module and pushes `{file, modifiedTs, sourceVersion}`\n * onto `globalThis.__TEMPO_MODULE_VERSIONS__`, keyed by the same `filepath`\n * the element stamps carry. The projection producer joins these records to\n * React's refresh so the canvas learns that a write reached the host even\n * when the write left no element of the file on a board (V2-498).\n *\n * It is appended to every filtered module, JSX or not: a write that removes a\n * file's last element is exactly the case that needs it. It goes at the end\n * so it never displaces a leading directive such as \"use client\", and adds no\n * line above existing code so positions and source maps are unchanged. The\n * `window` guard keeps server-side evaluation (Next server components, SSR)\n * from recording anything.\n */\nexport function appendModuleVersionRecord(\n source: string,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n): string {\n const record = JSON.stringify({\n file: filepath,\n modifiedTs: modifiedtsMs,\n sourceVersion,\n });\n return `${source}\\n;typeof window !== \"undefined\" && (globalThis.__TEMPO_MODULE_VERSIONS__ || (globalThis.__TEMPO_MODULE_VERSIONS__ = [])).push(${record});\\n`;\n}\n\nexport function computeTempoAnnotatedProps(params: {\n info: ElementInfo;\n filepath: string;\n modifiedtsMs: number;\n sourceVersion: string;\n computeAnnotatedProps?: ComputeAnnotatedProps;\n elementSupportOverrides?: ReadonlyMap<string, ElementTypeSupport>;\n}): Record<string, PropValue> {\n const {\n info,\n filepath,\n modifiedtsMs,\n sourceVersion,\n computeAnnotatedProps,\n elementSupportOverrides,\n } = params;\n\n const userProps = {\n ...(computeAnnotatedProps\n ? computeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion)\n : defaultComputeAnnotatedProps(\n info,\n filepath,\n modifiedtsMs,\n sourceVersion,\n )),\n // Only a caller that knows the parent can say whether the slot is a JSX\n // child; without it every element would read as a dynamic slot.\n ...(info.parentType !== undefined &&\n !hasJsxAttribute(info, EXPRESSION_FACTS_ATTRIBUTE)\n ? {\n [EXPRESSION_FACTS_ATTRIBUTE]: expressionFacts(\n info.element,\n info.parentType,\n ),\n }\n : {}),\n };\n\n if (isIntrinsicElement(info.tagName)) {\n return {\n ...userProps,\n \"data-tempo-supports-children\": hasJsxAttribute(\n info,\n \"data-tempo-supports-children\",\n )\n ? undefined\n : !HTML_VOID_ELEMENTS.has(info.tagName),\n };\n }\n\n const override = elementSupportOverrides?.get(info.tagName);\n if (override) {\n return {\n ...userProps,\n \"data-tempo-supports-children\": hasJsxAttribute(\n info,\n \"data-tempo-supports-children\",\n )\n ? undefined\n : override.supportsChildren,\n };\n }\n\n // Custom component with no static override: emit no `data-tempo-supports-*`\n // flags. Determining them required a per-file TypeScript program, which was\n // removed for being the dominant cost of devserver startup. Consumers treat\n // the absent flags as \"unknown\" and fall back to their own defaults.\n return userProps;\n}\n\nexport function getFileAnnotationContext(params: {\n source: string;\n filename: string;\n root: string;\n canonicalizeFilename?: boolean;\n}): {\n cleanFilename: string;\n filepath: string;\n modifiedtsMs: number;\n sourceVersion: string;\n} {\n const rawCleanFilename = cleanModuleId(params.filename);\n let cleanFilename = rawCleanFilename;\n if (params.canonicalizeFilename) {\n try {\n cleanFilename = realpathSync.native(rawCleanFilename);\n } catch {\n cleanFilename = rawCleanFilename;\n }\n }\n return {\n cleanFilename,\n filepath: relative(params.root, cleanFilename),\n modifiedtsMs: Math.trunc(statSync(cleanFilename).mtimeMs),\n // Hashed once per file per transform (the context is built once, reused\n // for every element) so the per-element funnel just forwards the token.\n sourceVersion: sourceVersionHash(params.source),\n };\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAc,gBAAgB;AACvC,SAAS,gBAAgB;AA0BlB,IAAM,qBAAqB,oBAAI,IAAI;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AASM,SAAS,cAAc,IAAoB;AAChD,SAAO,GAAG,QAAQ,WAAW,EAAE;AACjC;AAUO,SAAS,mBAAmB,SAA0B;AAC3D,SAAO,QAAQ,SAAS,KAAK,QAAQ,CAAC,MAAM,QAAQ,CAAC,EAAG,YAAY;AACtE;AAEO,SAAS,gBAAgB,MAAmB,UAA2B;AAC5E,aAAW,QAAQ,KAAK,QAAQ,eAAe,YAAY;AACzD,UAAM,OAAQ,KAAuC;AACrD,QAAI,MAAM,SAAS,SAAU,QAAO;AAAA,EACtC;AACA,SAAO;AACT;AAEO,SAAS,6BACd,MACA,UACA,cACA,eAC2B;AAC3B,SAAO;AAAA,IACL,uBAAuB;AAAA,IACvB,uBAAuB,KAAK,QAAQ,eAAe;AAAA,IACnD,yBAAyB;AAAA;AAAA;AAAA;AAAA,IAIzB,6BAA6B;AAAA,EAC/B;AACF;AAiBO,SAAS,0BACd,QACA,UACA,cACA,eACQ;AACR,QAAM,SAAS,KAAK,UAAU;AAAA,IAC5B,MAAM;AAAA,IACN,YAAY;AAAA,IACZ;AAAA,EACF,CAAC;AACD,SAAO,GAAG,MAAM;AAAA,+HAAkI,MAAM;AAAA;AAC1J;AAEO,SAAS,2BAA2B,QAOb;AAC5B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,YAAY;AAAA,IAChB,GAAI,wBACA,sBAAsB,MAAM,UAAU,cAAc,aAAa,IACjE;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA;AAAA;AAAA,IAGJ,GAAI,KAAK,eAAe,UACxB,CAAC,gBAAgB,MAAM,0BAA0B,IAC7C;AAAA,MACE,CAAC,0BAA0B,GAAG;AAAA,QAC5B,KAAK;AAAA,QACL,KAAK;AAAA,MACP;AAAA,IACF,IACA,CAAC;AAAA,EACP;AAEA,MAAI,mBAAmB,KAAK,OAAO,GAAG;AACpC,WAAO;AAAA,MACL,GAAG;AAAA,MACH,gCAAgC;AAAA,QAC9B;AAAA,QACA;AAAA,MACF,IACI,SACA,CAAC,mBAAmB,IAAI,KAAK,OAAO;AAAA,IAC1C;AAAA,EACF;AAEA,QAAM,WAAW,yBAAyB,IAAI,KAAK,OAAO;AAC1D,MAAI,UAAU;AACZ,WAAO;AAAA,MACL,GAAG;AAAA,MACH,gCAAgC;AAAA,QAC9B;AAAA,QACA;AAAA,MACF,IACI,SACA,SAAS;AAAA,IACf;AAAA,EACF;AAMA,SAAO;AACT;","names":[]}
@@ -213,7 +213,7 @@ function captureHead(doc, resource) {
213
213
  if (tagName === "META") {
214
214
  const httpEquiv = child.getAttribute("http-equiv")?.toLowerCase();
215
215
  const name = child.getAttribute("name")?.toLowerCase();
216
- if (httpEquiv === "content-security-policy" || name === "content-security-policy") {
216
+ if (httpEquiv === "content-security-policy" || name === "content-security-policy" || name === "theme-color") {
217
217
  continue;
218
218
  }
219
219
  }
@@ -433,4 +433,4 @@ export {
433
433
  getHeadTracker,
434
434
  captureHead
435
435
  };
436
- //# sourceMappingURL=chunk-2JRAG36X.js.map
436
+ //# sourceMappingURL=chunk-WBMO4ZYO.js.map