tempo-sdk 0.0.99 → 0.0.102

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 (170) hide show
  1. package/README.md +3 -403
  2. package/dist/assets/editor.d.ts +43 -65
  3. package/dist/assets/editor.js +1 -573
  4. package/dist/assets/index.d.ts +11 -61
  5. package/dist/assets/index.js +1 -338
  6. package/dist/assets/parser.d.ts +68 -78
  7. package/dist/assets/parser.js +1 -33
  8. package/dist/astro/asset-preview-client.d.ts +3 -2
  9. package/dist/astro/asset-preview-client.js +1 -93
  10. package/dist/astro/controls.d.ts +1 -3
  11. package/dist/astro/controls.js +1 -7
  12. package/dist/astro/document-client.d.ts +5 -6
  13. package/dist/astro/document-client.js +1 -78
  14. package/dist/astro/runtime.d.ts +23 -11
  15. package/dist/astro/runtime.js +1 -86
  16. package/dist/astro.d.ts +19 -13
  17. package/dist/astro.js +1 -818
  18. package/dist/canvas/astro-contract.d.ts +0 -3
  19. package/dist/canvas/astro-contract.js +1 -9
  20. package/dist/canvas/astro.d.ts +3 -4
  21. package/dist/canvas/astro.js +1 -42
  22. package/dist/canvas/editor.d.ts +187 -183
  23. package/dist/canvas/editor.js +1 -1094
  24. package/dist/canvas/flutter-preview.d.ts +0 -1
  25. package/dist/canvas/flutter-preview.js +1 -9
  26. package/dist/canvas/index.d.ts +46 -100
  27. package/dist/canvas/index.js +1 -3926
  28. package/dist/canvas/interact-projection.d.ts +7 -5
  29. package/dist/canvas/interact-projection.js +1 -12
  30. package/dist/canvas/parser.d.ts +10 -303
  31. package/dist/canvas/parser.js +1 -30
  32. package/dist/canvas/svelte.d.ts +6 -7
  33. package/dist/canvas/svelte.js +1 -91
  34. package/dist/canvas/vue.d.ts +9 -49
  35. package/dist/canvas/vue.js +1 -264
  36. package/dist/chunk-CXCUJCXD.js +1 -0
  37. package/dist/chunk-FH6TMWFA.js +1 -0
  38. package/dist/chunk-FL7FSJSL.js +1 -0
  39. package/dist/chunk-GQIOB5SV.js +1 -0
  40. package/dist/chunk-HBQ7FFH7.js +1 -0
  41. package/dist/chunk-JRJOWLCN.js +1 -0
  42. package/dist/chunk-LJCBFTMP.js +1 -0
  43. package/dist/chunk-M3GN2KUH.js +1 -0
  44. package/dist/chunk-MPIHFFML.js +1 -0
  45. package/dist/chunk-T5TY3U2H.js +1 -0
  46. package/dist/chunk-XO2BSHWM.js +1 -0
  47. package/dist/chunk-XUSV3KOD.js +1 -0
  48. package/dist/chunk-ZXBMP6RV.js +1 -0
  49. package/dist/{controls-uCaQ3CNX.d.ts → controls-DKslABtM.d.ts} +0 -3
  50. package/dist/expo/plugin.cjs +1 -1928
  51. package/dist/expo/plugin.js +1 -8
  52. package/dist/expo-babel-plugin.cjs +1 -1928
  53. package/dist/expo-babel-plugin.d.cts +46 -40
  54. package/dist/expo-babel-plugin.d.ts +46 -40
  55. package/dist/expo-babel-plugin.js +1 -8
  56. package/dist/flutter-preview-path.d.ts +23 -7
  57. package/dist/flutter-preview-path.js +1 -16
  58. package/dist/index.d.ts +33 -45
  59. package/dist/index.js +1 -20
  60. package/dist/nextjs/plugin.cjs +1 -413
  61. package/dist/nextjs/plugin.js +1 -7
  62. package/dist/nextjs-loader.cjs +1 -2277
  63. package/dist/nextjs.cjs +1 -484
  64. package/dist/nextjs.d.cts +2 -58
  65. package/dist/nextjs.d.ts +2 -58
  66. package/dist/nextjs.js +1 -17
  67. package/dist/nuxt/runtime/identity.d.ts +2 -4
  68. package/dist/nuxt/runtime/identity.js +1 -18
  69. package/dist/nuxt.d.ts +31 -92
  70. package/dist/nuxt.js +1 -5854
  71. package/dist/{page-DwLnOM5d.d.ts → page-Bc8PekIX.d.ts} +1 -5
  72. package/dist/parser.d-MO5ciJ5n.d.ts +236 -0
  73. package/dist/{storyboard-CMJVBSXn.d.ts → storyboard.contract.d-UQ4MUYN5.d.ts} +3 -25
  74. package/dist/svelte.d.ts +8 -18
  75. package/dist/svelte.js +1 -917
  76. package/dist/types-CfUgM2w4.d.ts +57 -0
  77. package/dist/v1-client-compat-n0E0XxuX.d.ts +5 -0
  78. package/dist/vue.d.ts +17 -58
  79. package/dist/vue.js +1 -1501
  80. package/package.json +12 -62
  81. package/dist/assets/editor.js.map +0 -1
  82. package/dist/assets/index.js.map +0 -1
  83. package/dist/assets/parser.js.map +0 -1
  84. package/dist/astro/asset-preview-client.js.map +0 -1
  85. package/dist/astro/controls.js.map +0 -1
  86. package/dist/astro/document-client.js.map +0 -1
  87. package/dist/astro/runtime.js.map +0 -1
  88. package/dist/astro.js.map +0 -1
  89. package/dist/canvas/astro-contract.js.map +0 -1
  90. package/dist/canvas/astro.js.map +0 -1
  91. package/dist/canvas/editor.js.map +0 -1
  92. package/dist/canvas/flutter-preview.js.map +0 -1
  93. package/dist/canvas/index.js.map +0 -1
  94. package/dist/canvas/interact-projection.js.map +0 -1
  95. package/dist/canvas/parser.js.map +0 -1
  96. package/dist/canvas/svelte.js.map +0 -1
  97. package/dist/canvas/vue.js.map +0 -1
  98. package/dist/chunk-27WT3XUG.js +0 -455
  99. package/dist/chunk-27WT3XUG.js.map +0 -1
  100. package/dist/chunk-5HIIF354.js +0 -67
  101. package/dist/chunk-5HIIF354.js.map +0 -1
  102. package/dist/chunk-65B52AR7.js +0 -11
  103. package/dist/chunk-65B52AR7.js.map +0 -1
  104. package/dist/chunk-6HYKKP5N.js +0 -2658
  105. package/dist/chunk-6HYKKP5N.js.map +0 -1
  106. package/dist/chunk-6SOP4XU6.js +0 -1891
  107. package/dist/chunk-6SOP4XU6.js.map +0 -1
  108. package/dist/chunk-AFXE462X.js +0 -1253
  109. package/dist/chunk-AFXE462X.js.map +0 -1
  110. package/dist/chunk-BQPKOVI5.js +0 -115
  111. package/dist/chunk-BQPKOVI5.js.map +0 -1
  112. package/dist/chunk-CYDF4LYJ.js +0 -342
  113. package/dist/chunk-CYDF4LYJ.js.map +0 -1
  114. package/dist/chunk-CYQE3TLC.js +0 -37
  115. package/dist/chunk-CYQE3TLC.js.map +0 -1
  116. package/dist/chunk-DI2ZFAWL.js +0 -14
  117. package/dist/chunk-DI2ZFAWL.js.map +0 -1
  118. package/dist/chunk-EGRHWZRV.js +0 -1
  119. package/dist/chunk-EGRHWZRV.js.map +0 -1
  120. package/dist/chunk-FGWGY3G3.js +0 -157
  121. package/dist/chunk-FGWGY3G3.js.map +0 -1
  122. package/dist/chunk-HOBTDB6G.js +0 -112
  123. package/dist/chunk-HOBTDB6G.js.map +0 -1
  124. package/dist/chunk-I7VF4ZOV.js +0 -630
  125. package/dist/chunk-I7VF4ZOV.js.map +0 -1
  126. package/dist/chunk-JVVHU3A7.js +0 -1077
  127. package/dist/chunk-JVVHU3A7.js.map +0 -1
  128. package/dist/chunk-MIXQVPDH.js +0 -8606
  129. package/dist/chunk-MIXQVPDH.js.map +0 -1
  130. package/dist/chunk-MU7S7NU7.js +0 -183
  131. package/dist/chunk-MU7S7NU7.js.map +0 -1
  132. package/dist/chunk-OX2YKYSL.js +0 -13
  133. package/dist/chunk-OX2YKYSL.js.map +0 -1
  134. package/dist/chunk-PYAJHLXO.js +0 -903
  135. package/dist/chunk-PYAJHLXO.js.map +0 -1
  136. package/dist/chunk-SGN7BDRE.js +0 -16
  137. package/dist/chunk-SGN7BDRE.js.map +0 -1
  138. package/dist/chunk-SGTGDLOX.js +0 -285
  139. package/dist/chunk-SGTGDLOX.js.map +0 -1
  140. package/dist/chunk-T364NBR3.js +0 -1440
  141. package/dist/chunk-T364NBR3.js.map +0 -1
  142. package/dist/chunk-U66QI3EN.js +0 -1524
  143. package/dist/chunk-U66QI3EN.js.map +0 -1
  144. package/dist/chunk-WTXOWQ7N.js +0 -47
  145. package/dist/chunk-WTXOWQ7N.js.map +0 -1
  146. package/dist/chunk-X5DJKVBT.js +0 -1308
  147. package/dist/chunk-X5DJKVBT.js.map +0 -1
  148. package/dist/chunk-ZT7HJ6YU.js +0 -38
  149. package/dist/chunk-ZT7HJ6YU.js.map +0 -1
  150. package/dist/chunk-ZW26VZHX.js +0 -3169
  151. package/dist/chunk-ZW26VZHX.js.map +0 -1
  152. package/dist/controls-reader-5MFHYBZZ.js +0 -192
  153. package/dist/controls-reader-5MFHYBZZ.js.map +0 -1
  154. package/dist/expo/plugin.cjs.map +0 -1
  155. package/dist/expo/plugin.js.map +0 -1
  156. package/dist/expo-babel-plugin.cjs.map +0 -1
  157. package/dist/expo-babel-plugin.js.map +0 -1
  158. package/dist/flutter-preview-path.js.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/nextjs/plugin.cjs.map +0 -1
  161. package/dist/nextjs/plugin.js.map +0 -1
  162. package/dist/nextjs-loader.cjs.map +0 -1
  163. package/dist/nextjs.cjs.map +0 -1
  164. package/dist/nextjs.js.map +0 -1
  165. package/dist/nuxt/runtime/identity.js.map +0 -1
  166. package/dist/nuxt.js.map +0 -1
  167. package/dist/svelte.js.map +0 -1
  168. package/dist/types-C8OIU-kc.d.ts +0 -106
  169. package/dist/v1-client-compat-qxaXEDm_.d.ts +0 -23
  170. package/dist/vue.js.map +0 -1
@@ -1,342 +0,0 @@
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.99",
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
- // sdk-package-files.ts
278
- import { readFileSync as readFileSync2, realpathSync } from "fs";
279
- import { dirname, join } from "path";
280
- var SDK_PACKAGE_NAME = "tempo-sdk";
281
- var SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;
282
- function createSdkFileMatcher() {
283
- const ownerIsSdkByDirectory = /* @__PURE__ */ new Map();
284
- const nearestPackageIsSdk = (startDirectory) => {
285
- const visited = [];
286
- let directory = startDirectory;
287
- let isSdk = false;
288
- while (true) {
289
- const cached = ownerIsSdkByDirectory.get(directory);
290
- if (cached !== void 0) {
291
- isSdk = cached;
292
- break;
293
- }
294
- visited.push(directory);
295
- const manifest = readPackageManifest(directory);
296
- if (manifest !== void 0) {
297
- isSdk = manifest?.name === SDK_PACKAGE_NAME;
298
- break;
299
- }
300
- const parent = dirname(directory);
301
- if (parent === directory) break;
302
- directory = parent;
303
- }
304
- for (const entry of visited) ownerIsSdkByDirectory.set(entry, isSdk);
305
- return isSdk;
306
- };
307
- return (file) => {
308
- if (file.replace(/\\/g, "/").includes(SDK_NODE_MODULES_SEGMENT)) {
309
- return true;
310
- }
311
- let realFile = file;
312
- try {
313
- realFile = realpathSync.native(file);
314
- } catch {
315
- }
316
- return nearestPackageIsSdk(dirname(realFile));
317
- };
318
- }
319
- function readPackageManifest(directory) {
320
- let text;
321
- try {
322
- text = readFileSync2(join(directory, "package.json"), "utf8");
323
- } catch {
324
- return void 0;
325
- }
326
- try {
327
- const manifest = JSON.parse(text);
328
- return manifest && typeof manifest === "object" ? manifest : null;
329
- } catch {
330
- return null;
331
- }
332
- }
333
-
334
- export {
335
- TEMPO_HOST_IDENTITY_ENDPOINT,
336
- TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,
337
- TEMPO_WORKSPACE_NONCE_META_NAME,
338
- TEMPO_VUE_ANNOTATION_PLUGIN_NAME,
339
- createTempoHostIdentity,
340
- createSdkFileMatcher
341
- };
342
- //# sourceMappingURL=chunk-CYDF4LYJ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts","../sdk-package-files.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.99\",\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 spec;\n return TEMPO_SDK_CHANNEL;\n}\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\n/** This package's published name, as declared in its package.json. */\nexport const SDK_PACKAGE_NAME = \"tempo-sdk\";\n\nconst SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;\n\n/**\n * A predicate for \"this file belongs to tempo-sdk itself\". The SDK's own\n * components (storyboard shells, error boundaries, admission gates) are\n * canvas plumbing, never authored UI, so no annotation entry point may stamp\n * source locations on them — the canvas treats every stamped element as user\n * code.\n *\n * A project can reach SDK files under many spellings: a published copy in\n * node_modules, a pnpm store path, a workspace link, a symlink, or a source\n * alias into a checkout. Ownership is therefore decided by where the file\n * really lives — the nearest package.json above its real path declares this\n * package — and not by the id's spelling or the caller's include/exclude\n * patterns. A package nested inside the SDK checkout (the demo apps) has its\n * own package.json and stays annotatable.\n */\nexport function createSdkFileMatcher(): (file: string) => boolean {\n // Directory → whether its nearest enclosing package.json is this package.\n const ownerIsSdkByDirectory = new Map<string, boolean>();\n\n const nearestPackageIsSdk = (startDirectory: string): boolean => {\n const visited: string[] = [];\n let directory = startDirectory;\n let isSdk = false;\n while (true) {\n const cached = ownerIsSdkByDirectory.get(directory);\n if (cached !== undefined) {\n isSdk = cached;\n break;\n }\n visited.push(directory);\n const manifest = readPackageManifest(directory);\n if (manifest !== undefined) {\n isSdk = manifest?.name === SDK_PACKAGE_NAME;\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const entry of visited) ownerIsSdkByDirectory.set(entry, isSdk);\n return isSdk;\n };\n\n return (file) => {\n if (file.replace(/\\\\/g, \"/\").includes(SDK_NODE_MODULES_SEGMENT)) {\n return true;\n }\n let realFile = file;\n try {\n realFile = realpathSync.native(file);\n } catch {\n // Virtual or not-yet-written ids keep their authored spelling.\n }\n return nearestPackageIsSdk(dirname(realFile));\n };\n}\n\n/** The package.json in `directory`: `undefined` when there is none, `null`\n * when one exists but cannot be read as a manifest (still a package\n * boundary, just not this package). */\nfunction readPackageManifest(\n directory: string,\n): { name?: unknown } | null | undefined {\n let text: string;\n try {\n text = readFileSync(join(directory, \"package.json\"), \"utf8\");\n } catch {\n return undefined;\n }\n try {\n const manifest: unknown = JSON.parse(text);\n return manifest && typeof manifest === \"object\" ? manifest : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EAEX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EAEf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,oBAAoB;AAAA,MAClB,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,WAAW;AAAA,MACT,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,IACX;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,I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S,uBAAsB,IAAI,OAAO,KAAK;AACnE,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,SAAS;AACf,QAAI,KAAK,QAAQ,OAAO,GAAG,EAAE,SAAS,wBAAwB,GAAG;AAC/D,aAAO;AAAA,IACT;AACA,QAAI,WAAW;AACf,QAAI;AACF,iBAAW,aAAa,OAAO,IAAI;AAAA,IACrC,QAAQ;AAAA,IAER;AACA,WAAO,oBAAoB,QAAQ,QAAQ,CAAC;AAAA,EAC9C;AACF;AAKA,SAAS,oBACP,WACuC;AACvC,MAAI;AACJ,MAAI;AACF,WAAOA,cAAa,KAAK,WAAW,cAAc,GAAG,MAAM;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,WAAoB,KAAK,MAAM,IAAI;AACzC,WAAO,YAAY,OAAO,aAAa,WAAW,WAAW;AAAA,EAC/D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["readFileSync"]}
@@ -1,37 +0,0 @@
1
- // canvas/flutter-preview.ts
2
- function parseFlutterPreview(value) {
3
- const prefix = `preview ${JSON.stringify(value)}`;
4
- if (value.includes("\\"))
5
- return {
6
- error: `${prefix} uses a backslash; use "/" (paths in canvases are POSIX).`
7
- };
8
- const hash = value.lastIndexOf("#");
9
- if (hash < 0)
10
- return {
11
- error: `${prefix} needs "#<function>" after the file, e.g. "../../lib/cards.dart#productCard".`
12
- };
13
- const file = value.slice(0, hash);
14
- const functionName = value.slice(hash + 1);
15
- if (!file.startsWith("./") && !file.startsWith("../"))
16
- return {
17
- error: file.startsWith("lib/") ? `${prefix} is no longer relative to a Flutter app folder; write the path from this canvas file, starting with "./" or "../".` : `${prefix} must be a path relative to this canvas file and start with "./" or "../", like a relative import.`
18
- };
19
- if (!file.endsWith(".dart"))
20
- return { error: `${prefix} must name a .dart file.` };
21
- if (/[?#]/.test(file) || file.includes("//"))
22
- return {
23
- error: `${prefix} must not contain "?", "#", or empty path segments.`
24
- };
25
- if (!/^[A-Za-z$][A-Za-z0-9_$]*$/.test(functionName))
26
- return {
27
- error: `${prefix}: ${JSON.stringify(functionName)} is not a public Dart function name.`
28
- };
29
- return { file, functionName };
30
- }
31
- var FLUTTER_PREVIEW_KEY_ATTRIBUTE = "data-tempo-flutter-preview-key";
32
-
33
- export {
34
- parseFlutterPreview,
35
- FLUTTER_PREVIEW_KEY_ATTRIBUTE
36
- };
37
- //# sourceMappingURL=chunk-CYQE3TLC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../canvas/flutter-preview.ts"],"sourcesContent":["/** The authored Flutter reference is relative to the canvas, like an import. */\nexport function parseFlutterPreview(\n value: string,\n): { file: string; functionName: string } | { error: string } {\n const prefix = `preview ${JSON.stringify(value)}`;\n if (value.includes(\"\\\\\"))\n return {\n error: `${prefix} uses a backslash; use \"/\" (paths in canvases are POSIX).`,\n };\n const hash = value.lastIndexOf(\"#\");\n if (hash < 0)\n return {\n error: `${prefix} needs \"#<function>\" after the file, e.g. \"../../lib/cards.dart#productCard\".`,\n };\n const file = value.slice(0, hash);\n const functionName = value.slice(hash + 1);\n if (!file.startsWith(\"./\") && !file.startsWith(\"../\"))\n return {\n error: file.startsWith(\"lib/\")\n ? `${prefix} is no longer relative to a Flutter app folder; write the path from this canvas file, starting with \"./\" or \"../\".`\n : `${prefix} must be a path relative to this canvas file and start with \"./\" or \"../\", like a relative import.`,\n };\n if (!file.endsWith(\".dart\"))\n return { error: `${prefix} must name a .dart file.` };\n if (/[?#]/.test(file) || file.includes(\"//\"))\n return {\n error: `${prefix} must not contain \"?\", \"#\", or empty path segments.`,\n };\n if (!/^[A-Za-z$][A-Za-z0-9_$]*$/.test(functionName))\n return {\n error: `${prefix}: ${JSON.stringify(functionName)} is not a public Dart function name.`,\n };\n return { file, functionName };\n}\n\nexport const FLUTTER_PREVIEW_KEY_ATTRIBUTE = \"data-tempo-flutter-preview-key\";\n\nexport interface FlutterPreviewProblem {\n key: string | null;\n preview: string;\n canvasFile: string;\n storyboardId: string;\n code: string;\n message: string;\n}\n"],"mappings":";AACO,SAAS,oBACd,OAC4D;AAC5D,QAAM,SAAS,WAAW,KAAK,UAAU,KAAK,CAAC;AAC/C,MAAI,MAAM,SAAS,IAAI;AACrB,WAAO;AAAA,MACL,OAAO,GAAG,MAAM;AAAA,IAClB;AACF,QAAM,OAAO,MAAM,YAAY,GAAG;AAClC,MAAI,OAAO;AACT,WAAO;AAAA,MACL,OAAO,GAAG,MAAM;AAAA,IAClB;AACF,QAAM,OAAO,MAAM,MAAM,GAAG,IAAI;AAChC,QAAM,eAAe,MAAM,MAAM,OAAO,CAAC;AACzC,MAAI,CAAC,KAAK,WAAW,IAAI,KAAK,CAAC,KAAK,WAAW,KAAK;AAClD,WAAO;AAAA,MACL,OAAO,KAAK,WAAW,MAAM,IACzB,GAAG,MAAM,uHACT,GAAG,MAAM;AAAA,IACf;AACF,MAAI,CAAC,KAAK,SAAS,OAAO;AACxB,WAAO,EAAE,OAAO,GAAG,MAAM,2BAA2B;AACtD,MAAI,OAAO,KAAK,IAAI,KAAK,KAAK,SAAS,IAAI;AACzC,WAAO;AAAA,MACL,OAAO,GAAG,MAAM;AAAA,IAClB;AACF,MAAI,CAAC,4BAA4B,KAAK,YAAY;AAChD,WAAO;AAAA,MACL,OAAO,GAAG,MAAM,KAAK,KAAK,UAAU,YAAY,CAAC;AAAA,IACnD;AACF,SAAO,EAAE,MAAM,aAAa;AAC9B;AAEO,IAAM,gCAAgC;","names":[]}
@@ -1,14 +0,0 @@
1
- // assets/types.ts
2
- var UNRESOLVED_VALUE = Object.freeze({
3
- $unresolved: true
4
- });
5
- function isUnresolvedValue(value) {
6
- return typeof value === "object" && value !== null && $unresolvedKey in value && value.$unresolved === true;
7
- }
8
- var $unresolvedKey = "$unresolved";
9
-
10
- export {
11
- UNRESOLVED_VALUE,
12
- isUnresolvedValue
13
- };
14
- //# sourceMappingURL=chunk-DI2ZFAWL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../assets/types.ts"],"sourcesContent":["/**\n * Shared data-model types for the asset system's static pipeline: the parser\n * (`tempo-sdk/assets/parser`), the source editor (`tempo-sdk/assets/editor`),\n * and downstream consumers (`@tempo-modules/asset-libraries` index + MCP\n * tools). Everything here must stay JSON-serializable — parse results cross\n * IPC and MCP boundaries verbatim.\n *\n * See specs/asset-libraries.md §3 for the full parsing contract.\n */\n\nexport type AssetSourceSpan = { start: number; end: number };\n\n/** Stable machine-readable identifiers for every parse/edit problem. */\nexport type AssetParseErrorCode =\n // structural — the declaration's identity cannot be trusted; excluded from the index\n | \"misimported_define_asset\"\n | \"non_identifier_component\"\n | \"unknown_binding\"\n | \"imported_binding\"\n | \"non_top_level_binding\"\n | \"config_not_object_literal\"\n | \"invalid_call_arguments\"\n | \"duplicate_declaration\"\n | \"non_top_level_call\"\n | \"unparseable_source\"\n | \"invalid_control\"\n | \"invalid_variant_config\"\n // structural — emitted by the workspace index builder (@tempo-modules/\n // asset-libraries), never by the per-file parser: these need workspace\n // context (canvas-dir location, cross-file identity) the parser lacks\n | \"component_declaration_outside_canvas\"\n | \"duplicate_asset_declaration\"\n // degraded/info — canvas-pointer docstring validation, emitted by the\n // workspace index builder for canvas-declared components: the component's\n // defining file must carry a comment naming the declaring canvas's path\n | \"missing_canvas_pointer\"\n | \"stale_canvas_pointer\"\n | \"canvas_pointer_unverified\"\n // degraded — emitted by the workspace index builder: a canvas self-\n // registration is redundant when files in the same canvas folder also\n // declare component references (those already link the canvas via\n // canvasPath — self-registration is strictly for component-less\n // foundations pages)\n | \"redundant_canvas_declaration\"\n // degraded — the declaration is indexed; the issue is carried as a warning\n | \"non_literal_library\"\n | \"empty_library_name\"\n | \"duplicate_library\"\n | \"empty_variants\"\n | \"variants_on_canvas\"\n | \"unresolved_prop_value\"\n | \"not_exported\";\n\nexport type AssetParseError = {\n code: AssetParseErrorCode;\n message: string;\n /** \"structural\": the declaration is excluded from the index — readers must\n * fail closed. \"degraded\": the declaration is indexed; this is a warning\n * carried on the entry. \"info\": advisory note carried on the entry —\n * best-effort validation that could not run to a verdict; never a\n * failure. Mirrors CanvasParseError's severity split. */\n severity: \"structural\" | \"degraded\" | \"info\";\n span?: AssetSourceSpan;\n};\n\n/**\n * A config value the parser could not resolve statically (identifier\n * reference, call result, JSX, spread, …). The `$unresolved` shape is the\n * wire format everywhere (index, IPC, MCP) — no translation layers.\n * A user literally writing `{ $unresolved: true }` as a prop value is\n * indistinguishable from this marker; that collision is accepted.\n */\nexport type UnresolvedValue = { $unresolved: true };\n\nexport const UNRESOLVED_VALUE: UnresolvedValue = Object.freeze({\n $unresolved: true,\n});\n\nexport function isUnresolvedValue(value: unknown): value is UnresolvedValue {\n return (\n typeof value === \"object\" &&\n value !== null &&\n $unresolvedKey in value &&\n (value as UnresolvedValue).$unresolved === true\n );\n}\n\nconst $unresolvedKey = \"$unresolved\" satisfies keyof UnresolvedValue;\n\n/** Statically-readable config value: JSON literals plus the UNRESOLVED marker. */\nexport type StaticValue =\n | string\n | number\n | boolean\n | null\n | UnresolvedValue\n | StaticValue[]\n | { [key: string]: StaticValue };\n\nexport type ParsedAssetVariant = {\n name: string;\n /** Statically validated JSX template. Never evaluated as a function during insertion. */\n render?: { jsx: StaticValue };\n /** One dynamic value does not discard the variant — it parses to UNRESOLVED. */\n props: Record<string, StaticValue>;\n hasUnresolvedValues: boolean;\n};\n\nexport type AssetExportKind = \"named\" | \"default\" | \"none\";\n\n/** Source spans that power the surgical editor (specs/asset-libraries.md §4). */\nexport type AssetSpans = {\n /** The whole `defineAsset(...)` expression statement, semicolon included. */\n call: AssetSourceSpan;\n /** The config ObjectExpression (second argument). */\n config: AssetSourceSpan;\n /** The `libraries` array expression, only when the value is an array\n * literal. A `librariesProperty` without `libraries` means the property\n * exists but its value is dynamic — the editor must refuse to touch it. */\n libraries?: AssetSourceSpan;\n /** The whole `libraries: <value>` property, whenever the key is present.\n * Lets the editor remove the property outright when its array empties. */\n librariesProperty?: AssetSourceSpan;\n /** One span per statically-known `libraries` entry, in source order,\n * index-aligned with ParsedAssetDeclaration.libraries. */\n libraryItems: AssetSourceSpan[];\n};\n\n/** Reference-declaration target: defineAsset's first argument is an imported\n * binding, and the asset's identity is the import itself. Purely syntactic —\n * the parser records the import statement's module specifier plus the name\n * imported from it (\"default\" for default imports); resolution to a\n * workspace identity happens in @tempo-modules/asset-libraries. */\nexport type ParsedAssetReference = {\n importSpecifier: string;\n importedName: string;\n};\n\nexport type ParsedAssetDeclaration = {\n /** The identifier passed as defineAsset's first argument. */\n bindingName: string;\n exportKind: AssetExportKind;\n /** Deduplicated, statically-known entries only. */\n libraries: string[];\n /** What this asset is and when to reach for it (and when not). */\n usageInstructions?: string;\n variants: ParsedAssetVariant[];\n /** Present iff the declaration targets an imported binding. */\n reference?: ParsedAssetReference;\n spans: AssetSpans;\n /** Degraded-severity notes scoped to this declaration. */\n warnings: AssetParseError[];\n};\n\nexport type ParsedAssetFile = {\n filePath: string;\n /** Declarations whose identity parsed cleanly (may carry warnings). */\n declarations: ParsedAssetDeclaration[];\n /** Structural errors: file-level problems and rejected declarations. */\n errors: AssetParseError[];\n};\n\n/** Typed failures shared by the editor operations (§4.1) and the MCP write\n * tools that surface them (§7.3). */\nexport type AssetEditFailureCode =\n | \"asset_not_found\"\n | \"config_not_editable\"\n | \"export_not_found\"\n | \"already_defined\"\n | \"not_definable\";\n"],"mappings":";AA0EO,IAAM,mBAAoC,OAAO,OAAO;AAAA,EAC7D,aAAa;AACf,CAAC;AAEM,SAAS,kBAAkB,OAA0C;AAC1E,SACE,OAAO,UAAU,YACjB,UAAU,QACV,kBAAkB,SACjB,MAA0B,gBAAgB;AAE/C;AAEA,IAAM,iBAAiB;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-EGRHWZRV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,157 +0,0 @@
1
- import {
2
- literalJsxChild
3
- } from "./chunk-MU7S7NU7.js";
4
-
5
- // ../../modules/annotation/annotate-file.ts
6
- import { parseSync as parseSync2 } from "oxc-parser";
7
-
8
- // ../../modules/file-parser/utils.ts
9
- function getTagName(name) {
10
- switch (name.type) {
11
- case "JSXIdentifier":
12
- return name.name;
13
- case "JSXNamespacedName":
14
- return `${name.namespace.name}:${name.name.name}`;
15
- case "JSXMemberExpression":
16
- return getJSXMemberExpressionName(name);
17
- }
18
- }
19
- function getJSXMemberExpressionName(node) {
20
- const object = node.object.type === "JSXIdentifier" ? node.object.name : getJSXMemberExpressionName(node.object);
21
- return `${object}.${node.property.name}`;
22
- }
23
-
24
- // ../../modules/file-parser/walk.ts
25
- import visitorKeysImport from "oxc-parser/src-js/generated/visit/keys.js";
26
- var importedKeys = visitorKeysImport;
27
- var visitorKeys = importedKeys.default ?? importedKeys;
28
- function walk(node, callbacks, parent = null) {
29
- if (node === null || node === void 0 || typeof node !== "object") return;
30
- if (Array.isArray(node)) {
31
- for (const child of node) {
32
- walk(child, callbacks, parent);
33
- }
34
- return;
35
- }
36
- const record = node;
37
- const type = record.type;
38
- if (typeof type === "string" && type in callbacks) {
39
- callbacks[type](node, parent);
40
- }
41
- const enclosing = typeof type === "string" ? node : parent;
42
- for (const value of Object.values(record)) {
43
- if (value !== null && typeof value === "object") {
44
- walk(value, callbacks, enclosing);
45
- }
46
- }
47
- }
48
-
49
- // ../../modules/file-parser/scope-analyzer/types.ts
50
- var ScopeFlags = {
51
- Top: 1 << 0,
52
- Function: 1 << 1,
53
- Block: 1 << 2,
54
- Catch: 1 << 3,
55
- Class: 1 << 4,
56
- For: 1 << 5,
57
- Switch: 1 << 6,
58
- Module: 1 << 7,
59
- StrictMode: 1 << 8,
60
- ClassStaticBlock: 1 << 9,
61
- TsModuleBlock: 1 << 10,
62
- TsConditional: 1 << 11,
63
- Type: 1 << 12,
64
- Enum: 1 << 13
65
- };
66
-
67
- // ../../modules/file-parser/scope-analyzer/scopeAnalyzer.ts
68
- import { parseSync } from "oxc-parser";
69
-
70
- // ../../modules/annotation/annotate-file.ts
71
- function formatPropValue(value) {
72
- if (value === void 0) return null;
73
- if (typeof value === "function") return value.toString();
74
- return JSON.stringify(value);
75
- }
76
- function formatProps(props) {
77
- return Object.entries(props).map(([key, value]) => {
78
- const formatted = formatPropValue(value);
79
- if (formatted === null) return null;
80
- return ` ${key}={${formatted}}`;
81
- }).filter((s) => s !== null).join("");
82
- }
83
- function getExistingAttributeNames(element) {
84
- const names = /* @__PURE__ */ new Set();
85
- for (const attr of element.openingElement.attributes ?? []) {
86
- if (attr.type !== "JSXAttribute") continue;
87
- names.add(getTagName(attr.name));
88
- }
89
- return names;
90
- }
91
- function removeExistingProps(props, existingNames) {
92
- return Object.fromEntries(
93
- Object.entries(props).filter(([key]) => !existingNames.has(key))
94
- );
95
- }
96
- var FRAGMENT_TAG_NAMES = /* @__PURE__ */ new Set(["Fragment", "React.Fragment"]);
97
- function annotateFile(source, filename, computeAnnotatedProps) {
98
- const parseResult = parseSync2(filename, source);
99
- const insertions = [];
100
- const staticChildren = /* @__PURE__ */ new WeakSet();
101
- const noteChildren = (node) => {
102
- for (const child of node.children) {
103
- const literal = literalJsxChild(child);
104
- if (literal) staticChildren.add(literal);
105
- }
106
- };
107
- walk(parseResult.program, {
108
- JSXFragment(node) {
109
- noteChildren(node);
110
- },
111
- JSXElement(node, parent) {
112
- const element = node;
113
- noteChildren(element);
114
- const tagName = getTagName(element.openingElement.name);
115
- if (FRAGMENT_TAG_NAMES.has(tagName)) return;
116
- const parentType = parent?.type ?? null;
117
- const props = removeExistingProps(
118
- computeAnnotatedProps({
119
- element,
120
- tagName,
121
- parentType,
122
- ...staticChildren.has(element) ? { isStaticJsxChild: true } : {}
123
- }),
124
- getExistingAttributeNames(element)
125
- );
126
- if (Object.keys(props).length === 0) return;
127
- const openingElement = element.openingElement;
128
- let insertPos = openingElement.end - 1;
129
- if (openingElement.selfClosing) {
130
- insertPos--;
131
- while (insertPos > openingElement.start && /\s/.test(source[insertPos - 1])) {
132
- insertPos--;
133
- }
134
- }
135
- insertions.push({ position: insertPos, text: formatProps(props) });
136
- }
137
- });
138
- insertions.sort((a, b) => a.position - b.position);
139
- const chunks = [];
140
- let lastPos = 0;
141
- for (const { position, text } of insertions) {
142
- chunks.push(source.slice(lastPos, position));
143
- chunks.push(text);
144
- lastPos = position;
145
- }
146
- chunks.push(source.slice(lastPos));
147
- return {
148
- annotatedSource: chunks.join(""),
149
- elementsAnnotated: insertions.length,
150
- parseResult
151
- };
152
- }
153
-
154
- export {
155
- annotateFile
156
- };
157
- //# sourceMappingURL=chunk-FGWGY3G3.js.map