tempo-sdk 0.0.66 → 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 (110) hide show
  1. package/dist/assets/index.js +27 -5
  2. package/dist/assets/index.js.map +1 -1
  3. package/dist/astro/asset-preview-client.js +2 -2
  4. package/dist/astro.js +96 -31
  5. package/dist/astro.js.map +1 -1
  6. package/dist/canvas/astro.d.ts +1 -1
  7. package/dist/canvas/astro.js +2 -2
  8. package/dist/canvas/editor.d.ts +15 -5
  9. package/dist/canvas/editor.js +13 -8
  10. package/dist/canvas/editor.js.map +1 -1
  11. package/dist/canvas/flutter-preview.d.ts +18 -0
  12. package/dist/canvas/flutter-preview.js +9 -0
  13. package/dist/canvas/flutter-preview.js.map +1 -0
  14. package/dist/canvas/index.d.ts +33 -2
  15. package/dist/canvas/index.js +1134 -26
  16. package/dist/canvas/index.js.map +1 -1
  17. package/dist/canvas/interact-projection.js +5 -4
  18. package/dist/canvas/parser.d.ts +142 -3
  19. package/dist/canvas/parser.js +14 -1
  20. package/dist/canvas/svelte.d.ts +1 -1
  21. package/dist/canvas/svelte.js +2 -2
  22. package/dist/canvas/vue.d.ts +74 -0
  23. package/dist/canvas/vue.js +264 -0
  24. package/dist/canvas/vue.js.map +1 -0
  25. package/dist/{chunk-6W6UKDSY.js → chunk-2YX4WVFH.js} +49 -7
  26. package/dist/chunk-2YX4WVFH.js.map +1 -0
  27. package/dist/chunk-5HIIF354.js +67 -0
  28. package/dist/chunk-5HIIF354.js.map +1 -0
  29. package/dist/{chunk-FE6TYCLF.js → chunk-5VIBKVFO.js} +2 -2
  30. package/dist/{chunk-FE6TYCLF.js.map → chunk-5VIBKVFO.js.map} +1 -1
  31. package/dist/{chunk-77DZCV5Z.js → chunk-CXIW4IKC.js} +2 -2
  32. package/dist/chunk-CYQE3TLC.js +37 -0
  33. package/dist/chunk-CYQE3TLC.js.map +1 -0
  34. package/dist/{chunk-DELFOKU3.js → chunk-DNSCVLKV.js} +1571 -1410
  35. package/dist/chunk-DNSCVLKV.js.map +1 -0
  36. package/dist/chunk-EGRHWZRV.js +1 -0
  37. package/dist/chunk-EGRHWZRV.js.map +1 -0
  38. package/dist/{chunk-EYKOOLPL.js → chunk-GKDDNDG3.js} +1039 -134
  39. package/dist/chunk-GKDDNDG3.js.map +1 -0
  40. package/dist/{chunk-KOSJXE4G.js → chunk-H6BQZOAW.js} +4 -3
  41. package/dist/chunk-HOBTDB6G.js +112 -0
  42. package/dist/chunk-HOBTDB6G.js.map +1 -0
  43. package/dist/chunk-HZXQPM4W.js +285 -0
  44. package/dist/chunk-HZXQPM4W.js.map +1 -0
  45. package/dist/chunk-SGN7BDRE.js +16 -0
  46. package/dist/chunk-SGN7BDRE.js.map +1 -0
  47. package/dist/{chunk-F23JGM4U.js → chunk-UBTL6JUF.js} +6 -2
  48. package/dist/{chunk-F23JGM4U.js.map → chunk-UBTL6JUF.js.map} +1 -1
  49. package/dist/{chunk-2JRAG36X.js → chunk-WBMO4ZYO.js} +2 -2
  50. package/dist/chunk-WBMO4ZYO.js.map +1 -0
  51. package/dist/{chunk-K3EYTZLL.js → chunk-WTXOWQ7N.js} +3 -1
  52. package/dist/chunk-WTXOWQ7N.js.map +1 -0
  53. package/dist/{chunk-Q2A46HHW.js → chunk-XFPFWTWX.js} +276 -43
  54. package/dist/chunk-XFPFWTWX.js.map +1 -0
  55. package/dist/chunk-XMFVWJUY.js +342 -0
  56. package/dist/chunk-XMFVWJUY.js.map +1 -0
  57. package/dist/{chunk-PXDTH36X.js → chunk-Y72PIE3I.js} +212 -20
  58. package/dist/chunk-Y72PIE3I.js.map +1 -0
  59. package/dist/{chunk-6IR5JY6W.js → chunk-YECMP34I.js} +41 -9
  60. package/dist/chunk-YECMP34I.js.map +1 -0
  61. package/dist/{chunk-NSKYOKG5.js → chunk-ZXC7SZIT.js} +278 -26
  62. package/dist/chunk-ZXC7SZIT.js.map +1 -0
  63. package/dist/{controls-reader-SNMI2UY7.js → controls-reader-Z7OQWYWQ.js} +4 -3
  64. package/dist/{controls-reader-SNMI2UY7.js.map → controls-reader-Z7OQWYWQ.js.map} +1 -1
  65. package/dist/expo/plugin.cjs +301 -58
  66. package/dist/expo/plugin.cjs.map +1 -1
  67. package/dist/expo/plugin.js +1 -1
  68. package/dist/expo-babel-plugin.cjs +301 -58
  69. package/dist/expo-babel-plugin.cjs.map +1 -1
  70. package/dist/expo-babel-plugin.js +1 -1
  71. package/dist/flutter-preview-path.d.ts +9 -0
  72. package/dist/flutter-preview-path.js +16 -0
  73. package/dist/flutter-preview-path.js.map +1 -0
  74. package/dist/index.d.ts +16 -15
  75. package/dist/index.js +9 -6
  76. package/dist/nextjs/plugin.cjs +46 -5
  77. package/dist/nextjs/plugin.cjs.map +1 -1
  78. package/dist/nextjs/plugin.js +1 -1
  79. package/dist/nextjs-loader.cjs +343 -68
  80. package/dist/nextjs-loader.cjs.map +1 -1
  81. package/dist/nextjs.cjs +48 -6
  82. package/dist/nextjs.cjs.map +1 -1
  83. package/dist/nextjs.d.cts +9 -1
  84. package/dist/nextjs.d.ts +9 -1
  85. package/dist/nextjs.js +1 -1
  86. package/dist/nuxt/runtime/identity.d.ts +24 -0
  87. package/dist/nuxt/runtime/identity.js +18 -0
  88. package/dist/nuxt/runtime/identity.js.map +1 -0
  89. package/dist/nuxt.d.ts +102 -0
  90. package/dist/nuxt.js +5673 -0
  91. package/dist/nuxt.js.map +1 -0
  92. package/dist/{storyboard-4YdTYq_e.d.ts → storyboard-CMJVBSXn.d.ts} +9 -3
  93. package/dist/svelte.d.ts +4 -2
  94. package/dist/svelte.js +21 -88
  95. package/dist/svelte.js.map +1 -1
  96. package/dist/vue.d.ts +66 -0
  97. package/dist/vue.js +1403 -0
  98. package/dist/vue.js.map +1 -0
  99. package/package.json +48 -5
  100. package/dist/chunk-2JRAG36X.js.map +0 -1
  101. package/dist/chunk-6IR5JY6W.js.map +0 -1
  102. package/dist/chunk-6W6UKDSY.js.map +0 -1
  103. package/dist/chunk-DELFOKU3.js.map +0 -1
  104. package/dist/chunk-EYKOOLPL.js.map +0 -1
  105. package/dist/chunk-K3EYTZLL.js.map +0 -1
  106. package/dist/chunk-NSKYOKG5.js.map +0 -1
  107. package/dist/chunk-PXDTH36X.js.map +0 -1
  108. package/dist/chunk-Q2A46HHW.js.map +0 -1
  109. /package/dist/{chunk-77DZCV5Z.js.map → chunk-CXIW4IKC.js.map} +0 -0
  110. /package/dist/{chunk-KOSJXE4G.js.map → chunk-H6BQZOAW.js.map} +0 -0
@@ -10,12 +10,12 @@ import { resolve } from "path";
10
10
  // package.json
11
11
  var package_default = {
12
12
  name: "tempo-sdk",
13
- version: "0.0.66",
13
+ version: "0.0.75",
14
14
  publishConfig: {
15
15
  tag: "sdk-v2-latest"
16
16
  },
17
17
  type: "module",
18
- description: "Tempo SDK \u2014 Vite, Next.js, Expo, Svelte and Astro canvas integration, source annotations and storyboard types",
18
+ description: "Tempo SDK \u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types",
19
19
  repository: {
20
20
  type: "git",
21
21
  url: "git+https://github.com/TempoLabsAI/tempo-monorepo.git",
@@ -54,6 +54,10 @@ var package_default = {
54
54
  types: "./dist/canvas/svelte.d.ts",
55
55
  import: "./dist/canvas/svelte.js"
56
56
  },
57
+ "./canvas/vue": {
58
+ types: "./dist/canvas/vue.d.ts",
59
+ import: "./dist/canvas/vue.js"
60
+ },
57
61
  "./canvas/interact-projection": {
58
62
  types: "./dist/canvas/interact-projection.d.ts",
59
63
  import: "./dist/canvas/interact-projection.js"
@@ -87,6 +91,10 @@ var package_default = {
87
91
  types: "./dist/nextjs/plugin.d.ts",
88
92
  import: "./dist/nextjs/plugin.js"
89
93
  },
94
+ "./nuxt": {
95
+ types: "./dist/nuxt.d.ts",
96
+ import: "./dist/nuxt.js"
97
+ },
90
98
  "./expo": {
91
99
  types: "./dist/expo-babel-plugin.d.ts",
92
100
  import: "./dist/expo-babel-plugin.js",
@@ -101,9 +109,21 @@ var package_default = {
101
109
  types: "./dist/svelte.d.ts",
102
110
  import: "./dist/svelte.js"
103
111
  },
112
+ "./vue": {
113
+ types: "./dist/vue.d.ts",
114
+ import: "./dist/vue.js"
115
+ },
104
116
  "./astro/asset-preview-client": {
105
117
  types: "./dist/astro/asset-preview-client.d.ts",
106
118
  import: "./dist/astro/asset-preview-client.js"
119
+ },
120
+ "./flutter-preview-path": {
121
+ types: "./dist/flutter-preview-path.d.ts",
122
+ import: "./dist/flutter-preview-path.js"
123
+ },
124
+ "./canvas/flutter-preview": {
125
+ types: "./dist/canvas/flutter-preview.d.ts",
126
+ import: "./dist/canvas/flutter-preview.js"
107
127
  }
108
128
  },
109
129
  files: [
@@ -118,8 +138,9 @@ var package_default = {
118
138
  prepublishOnly: "pnpm build",
119
139
  demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
120
140
  "demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
141
+ "demo:nuxt": "pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev",
121
142
  test: "vitest run",
122
- "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 canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts",
143
+ "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",
123
144
  "test:watch": "vitest",
124
145
  "test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
125
146
  "test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
@@ -136,10 +157,13 @@ var package_default = {
136
157
  peerDependencies: {
137
158
  astro: "^7.0.0",
138
159
  "@babel/core": "^7.0.0",
160
+ h3: "^1.12.0",
139
161
  next: "^13 || ^14 || ^15 || ^16",
162
+ nuxt: "^3.18.0 || ^4.0.0",
140
163
  react: "^18 || ^19",
141
164
  svelte: "^5.0.0",
142
- vite: "^5 || ^6 || ^7 || ^8"
165
+ vite: "^5 || ^6 || ^7 || ^8",
166
+ vue: "^3.3.0"
143
167
  },
144
168
  peerDependenciesMeta: {
145
169
  astro: {
@@ -151,14 +175,23 @@ var package_default = {
151
175
  "@babel/core": {
152
176
  optional: true
153
177
  },
178
+ h3: {
179
+ optional: true
180
+ },
154
181
  next: {
155
182
  optional: true
156
183
  },
184
+ nuxt: {
185
+ optional: true
186
+ },
157
187
  svelte: {
158
188
  optional: true
159
189
  },
160
190
  vite: {
161
191
  optional: true
192
+ },
193
+ vue: {
194
+ optional: true
162
195
  }
163
196
  },
164
197
  devDependencies: {
@@ -168,14 +201,21 @@ var package_default = {
168
201
  "@modules/annotation": "workspace:*",
169
202
  "@modules/astro-editor": "workspace:*",
170
203
  "@modules/file-parser": "workspace:*",
204
+ "@modules/frame-pool": "workspace:*",
205
+ "@modules/iframe-projection": "workspace:*",
171
206
  "@modules/svelte-editor": "workspace:*",
207
+ "@modules/vue-editor": "workspace:*",
208
+ "@nuxt/kit": "^4.6.2",
172
209
  "@types/babel__core": "^7.20.5",
173
210
  "@types/node": "^25.0.8",
174
211
  "@types/react": "catalog:",
175
212
  "@types/react-dom": "catalog:",
176
213
  "@vitejs/plugin-react": "catalog:",
214
+ "@vitejs/plugin-vue": "6.0.10",
177
215
  astro: "7.3.8",
216
+ h3: "^1.15.11",
178
217
  "magic-string": "^0.30.21",
218
+ nuxt: "^4.6.2",
179
219
  playwright: "^1.58.2",
180
220
  "react-dom": "catalog:",
181
221
  "react-dom18": "npm:react-dom@18.3.1",
@@ -184,7 +224,8 @@ var package_default = {
184
224
  tsup: "^8.5.1",
185
225
  typescript: "catalog:",
186
226
  vite: "catalog:",
187
- vitest: "catalog:"
227
+ vitest: "catalog:",
228
+ vue: "3.5.44"
188
229
  }
189
230
  };
190
231
 
@@ -229,7 +270,8 @@ function createTempoHostIdentity(framework, options = {}) {
229
270
  sdkVersion: package_default.version,
230
271
  sdkChannel: TEMPO_SDK_CHANNEL,
231
272
  pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),
232
- framework
273
+ framework,
274
+ ...options.capabilities ? { capabilities: options.capabilities } : {}
233
275
  };
234
276
  }
235
277
 
@@ -410,4 +452,4 @@ export {
410
452
  nextjs_default,
411
453
  _internal
412
454
  };
413
- //# sourceMappingURL=chunk-6W6UKDSY.js.map
455
+ //# sourceMappingURL=chunk-2YX4WVFH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../nextjs.ts","../host-identity.ts","../package.json","../release-channel.ts"],"sourcesContent":["/**\n * Next.js plugin that registers the tempo-annotate loader for Webpack and\n * Turbopack. Mirrors the user-facing pattern of `@next/mdx`: a higher-order\n * function that takes plugin options, returns a function that takes the user's\n * `next.config`, and returns a new config with the plugin's loader rules\n * merged in.\n *\n * See SPEC_NEXTJS.md (in this directory) for the full design rationale.\n *\n * @example\n * ```js\n * // next.config.js\n * const tempoNextjsPlugin = require(\"tempo-sdk/nextjs\");\n * module.exports = tempoNextjsPlugin()({ reactStrictMode: true });\n * ```\n */\n\nimport { existsSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, resolve } from \"node:path\";\n\nimport type {\n ElementInfo,\n PropValue,\n} from \"../../modules/annotation/annotate-file.ts\";\nimport {\n createTempoHostIdentity,\n type TempoHostIdentity,\n} from \"./host-identity.ts\";\n\n// ---------------------------------------------------------------------------\n// Types. We keep these minimal and self-contained rather than depending on\n// Next.js types — the plugin file is loaded by `next.config.js` evaluation,\n// before `next` itself is fully resolved in some environments.\n// ---------------------------------------------------------------------------\n\nexport type ComputeAnnotatedProps = (\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n) => Record<string, PropValue>;\n\nexport interface TempoNextjsOptions {\n /** Path to a JS/TS module that default-exports a `ComputeAnnotatedProps`\n * function. Resolved relative to the project root (CWD where the user\n * invokes `next dev` / `next build`). Turbopack does not allow function-\n * valued loader options, so this must be a path. */\n computeAnnotatedPropsModule?: string;\n\n /** File patterns to include. Default: `[\"**\\/*.tsx\", \"**\\/*.jsx\"]`. */\n include?: string | RegExp | Array<string | RegExp>;\n\n /** File patterns to exclude. Default: `[\"**\\/node_modules\\/**\"]`. */\n exclude?: string | RegExp | Array<string | RegExp>;\n\n /** Auto-inject `<meta name=\"tempo-project-root\">` into JSX `<head>`.\n * Default: `true`. */\n autoInjectRootMeta?: boolean;\n\n /** Run the loader during production builds too. Default: `false`. */\n productionBuild?: boolean;\n}\n\ninterface TurbopackRule {\n condition?: unknown;\n loaders?: Array<{ loader: string; options?: unknown } | string>;\n}\n\ninterface TurbopackConfig {\n rules?: Record<string, TurbopackRule | TurbopackRule[]>;\n [key: string]: unknown;\n}\n\ninterface NextConfigLike {\n webpack?:\n | ((\n config: unknown,\n context: { dev: boolean; [k: string]: unknown },\n ) => unknown)\n | null;\n turbopack?: TurbopackConfig;\n experimental?: { turbo?: TurbopackConfig; [k: string]: unknown };\n [key: string]: unknown;\n}\n\ntype NextConfigInput = NextConfigLike | undefined;\n\ninterface WebpackHookContext {\n dev: boolean;\n [key: string]: unknown;\n}\n\ninterface WebpackConfigLike {\n module?: { rules?: unknown[] };\n [key: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst TURBOPACK_RULE_KEY = \"*.{tsx,jsx}\";\n\nconst requireFromHere = createRequire(\n typeof import.meta.url === \"string\" && import.meta.url.length > 0\n ? import.meta.url\n : __filename,\n);\n\nfunction resolveLoaderPath(): string {\n // Production: dist/nextjs.{js,cjs} sits next to dist/nextjs-loader.cjs.\n // Development: source nextjs.ts sits at <pkg>/nextjs.ts; the built\n // loader is at <pkg>/dist/nextjs-loader.cjs. Try both so unit tests\n // running directly against the .ts source file still find the loader.\n for (const candidate of [\"./nextjs-loader.cjs\", \"./dist/nextjs-loader.cjs\"]) {\n try {\n return requireFromHere.resolve(candidate);\n } catch {\n // try next candidate\n }\n }\n throw new Error(\n \"tempo-sdk/nextjs: could not resolve nextjs-loader.cjs. \" +\n \"Run `pnpm build` in the tempo-sdk package to produce the dist/ output.\",\n );\n}\n\ninterface NextVersionInfo {\n major: number;\n minor: number;\n}\n\nfunction detectNextVersion(): NextVersionInfo | null {\n try {\n const pkg = requireFromHere(\"next/package.json\") as { version: string };\n const m = /^(\\d+)\\.(\\d+)/.exec(pkg.version);\n if (!m) return null;\n return { major: Number(m[1]), minor: Number(m[2]) };\n } catch {\n return null;\n }\n}\n\n/** Should the wrapper write to `experimental.turbo` instead of `turbopack`? */\nfunction useExperimentalTurbo(version: NextVersionInfo | null): boolean {\n if (!version) return false;\n if (version.major < 15) return true;\n if (version.major === 15 && version.minor < 3) return true;\n return false;\n}\n\n/** Should the wrapper omit Turbopack registration entirely? Some pre-13 versions\n * error on unknown config keys. */\nfunction shouldOmitTurbopack(version: NextVersionInfo | null): boolean {\n if (!version) return false;\n return version.major < 13;\n}\n\nfunction buildTurbopackRule(\n loaderPath: string,\n options: TempoNextjsOptions,\n): TurbopackRule {\n const loaderOptions: Record<string, unknown> = {};\n if (options.computeAnnotatedPropsModule !== undefined) {\n loaderOptions.computeAnnotatedPropsModule =\n options.computeAnnotatedPropsModule;\n }\n if (options.autoInjectRootMeta !== undefined) {\n loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;\n }\n\n // {all: [{not: \"foreign\"}, \"development\"]} — exclude node_modules / Next\n // internals AND only run during `next dev`. The \"development\" condition is\n // a Turbopack built-in; it matches both `next dev` and `next build` in dev\n // mode but is inert during a production `next build`.\n const condition = options.productionBuild\n ? { not: \"foreign\" }\n : { all: [{ not: \"foreign\" }, \"development\"] };\n\n return {\n condition,\n loaders: [{ loader: loaderPath, options: loaderOptions }],\n };\n}\n\nfunction mergeTurbopackRules(\n existing: TurbopackConfig | undefined,\n newRule: TurbopackRule,\n): TurbopackConfig {\n const existingRule = existing?.rules?.[TURBOPACK_RULE_KEY];\n let mergedRule: TurbopackRule | TurbopackRule[];\n if (!existingRule) {\n mergedRule = newRule;\n } else if (Array.isArray(existingRule)) {\n mergedRule = [...existingRule, newRule];\n } else {\n mergedRule = [existingRule, newRule];\n }\n return {\n ...existing,\n rules: {\n ...existing?.rules,\n [TURBOPACK_RULE_KEY]: mergedRule,\n },\n };\n}\n\nfunction buildWebpackHook(\n loaderPath: string,\n options: TempoNextjsOptions,\n userWebpack: NextConfigLike[\"webpack\"],\n): NonNullable<NextConfigLike[\"webpack\"]> {\n const loaderOptions: Record<string, unknown> = {};\n if (options.computeAnnotatedPropsModule !== undefined) {\n loaderOptions.computeAnnotatedPropsModule =\n options.computeAnnotatedPropsModule;\n }\n if (options.autoInjectRootMeta !== undefined) {\n loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;\n }\n\n const allowProduction = options.productionBuild === true;\n\n return (configIn, context) => {\n const config = configIn as WebpackConfigLike;\n const ctx = context as WebpackHookContext;\n if (ctx.dev || allowProduction) {\n config.module ??= {};\n config.module.rules ??= [];\n config.module.rules.push({\n test: /\\.(tsx|jsx)$/,\n exclude: /node_modules/,\n enforce: \"pre\",\n use: [{ loader: loaderPath, options: loaderOptions }],\n });\n }\n if (typeof userWebpack === \"function\") {\n return userWebpack(config, context);\n }\n return config;\n };\n}\n\n// ---------------------------------------------------------------------------\n// tempoProjectRoot — sync helper for Pages Router users (Section 6.4)\n// ---------------------------------------------------------------------------\n\nlet cachedTempoProjectRoot: string | null = null;\n\n/**\n * Returns the canonical project root that the Tempo loader uses to compute\n * `data-tempo-filepath` values. Use this in `pages/_document.tsx` to set the\n * content of `<meta name=\"tempo-project-root\">`, ensuring the manual meta tag\n * value matches what the loader produces.\n */\nexport function tempoProjectRoot(): string {\n if (cachedTempoProjectRoot !== null) return cachedTempoProjectRoot;\n\n // Walk upward from CWD looking for the nearest package.json. CWD is what\n // Next.js itself uses as the project root when the user invokes\n // `next dev` / `next build` — the loader's `rootContext` matches.\n let dir = process.cwd();\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (existsSync(resolve(dir, \"package.json\"))) break;\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n let canonical = dir;\n try {\n canonical = realpathSync.native(dir);\n } catch {\n // Keep `dir` as fallback.\n }\n cachedTempoProjectRoot = canonical;\n return canonical;\n}\n\n/** Request-time identity for a Next route served by a Tempo-enabled host. */\nexport function tempoHostIdentity(): TempoHostIdentity<\"nextjs\"> {\n return createTempoHostIdentity(\"nextjs\");\n}\n\n/** Reset the cached project root. For tests only. */\nexport function _resetTempoProjectRoot(): void {\n cachedTempoProjectRoot = null;\n}\n\n// ---------------------------------------------------------------------------\n// tempoNextjsPlugin — the wrapper\n// ---------------------------------------------------------------------------\n\n/**\n * Higher-order function that wraps a Next.js config to register the\n * tempo-annotate loader with both Webpack and Turbopack. No-op when\n * `process.env.TEMPO` is not set.\n *\n * @example\n * ```js\n * // next.config.js\n * const tempoNextjsPlugin = require(\"tempo-sdk/nextjs\");\n * module.exports = tempoNextjsPlugin()({ reactStrictMode: true });\n * ```\n */\nexport function tempoNextjsPlugin(\n pluginOptions: TempoNextjsOptions = {},\n): (inputConfig?: NextConfigLike) => NextConfigLike {\n return (inputConfigArg?: NextConfigLike): NextConfigLike => {\n const inputConfig: NextConfigLike = inputConfigArg ?? {};\n\n if (!process.env.TEMPO) return inputConfig;\n\n // Routed through `_internal.*` so unit tests can spy on these helpers\n // without rewiring the imports.\n const loaderPath = _internal.resolveLoaderPath();\n const version = _internal.detectNextVersion();\n const omitTurbopack = _internal.shouldOmitTurbopack(version);\n const useExperimental = _internal.useExperimentalTurbo(version);\n\n const newRule = buildTurbopackRule(loaderPath, pluginOptions);\n\n const existingTurbo = useExperimental\n ? inputConfig.experimental?.turbo\n : inputConfig.turbopack;\n const mergedTurbo = mergeTurbopackRules(existingTurbo, newRule);\n\n const webpackHook = buildWebpackHook(\n loaderPath,\n pluginOptions,\n inputConfig.webpack ?? null,\n );\n\n const next: NextConfigLike = {\n ...inputConfig,\n webpack: webpackHook,\n };\n\n // Tempo-owned build cache: the supervisor always points managed Next hosts\n // at `.next/tempo`, isolating them from the user's own `next dev` cache.\n // A suffixed sibling is selected only after Next reports a lock conflict\n // for the stable directory. Runs outside Tempo never receive this variable.\n const distDirOverride = process.env.TEMPO_NEXT_DIST_DIR;\n if (distDirOverride) {\n next.distDir = distDirOverride;\n }\n\n if (!omitTurbopack) {\n if (useExperimental) {\n next.experimental = {\n ...inputConfig.experimental,\n turbo: mergedTurbo,\n };\n } else {\n next.turbopack = mergedTurbo;\n }\n }\n\n return next;\n };\n}\n\nexport default tempoNextjsPlugin;\n\n// ---------------------------------------------------------------------------\n// Type re-exports for users writing custom strategies.\n// ---------------------------------------------------------------------------\n\nexport type {\n ElementInfo,\n PropValue,\n} from \"../../modules/annotation/annotate-file.ts\";\n\n// Internal exports used by tests.\nexport const _internal = {\n buildTurbopackRule,\n mergeTurbopackRules,\n buildWebpackHook,\n detectNextVersion,\n useExperimentalTurbo,\n shouldOmitTurbopack,\n resolveLoaderPath,\n};\n","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 spec;\n return TEMPO_SDK_CHANNEL;\n}\n"],"mappings":";AAiBA,SAAS,YAAY,oBAAoB;AACzC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,WAAAA,gBAAe;;;ACnBjC,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,I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O,SAAS,kBACd,gBAAoC,CAAC,GACa;AAClD,SAAO,CAAC,mBAAoD;AAC1D,UAAM,cAA8B,kBAAkB,CAAC;AAEvD,QAAI,CAAC,QAAQ,IAAI,MAAO,QAAO;AAI/B,UAAM,aAAa,UAAU,kBAAkB;AAC/C,UAAM,UAAU,UAAU,kBAAkB;AAC5C,UAAM,gBAAgB,UAAU,oBAAoB,OAAO;AAC3D,UAAM,kBAAkB,UAAU,qBAAqB,OAAO;AAE9D,UAAM,UAAU,mBAAmB,YAAY,aAAa;AAE5D,UAAM,gBAAgB,kBAClB,YAAY,cAAc,QAC1B,YAAY;AAChB,UAAM,cAAc,oBAAoB,eAAe,OAAO;AAE9D,UAAM,cAAc;AAAA,MAClB;AAAA,MACA;AAAA,MACA,YAAY,WAAW;AAAA,IACzB;AAEA,UAAM,OAAuB;AAAA,MAC3B,GAAG;AAAA,MACH,SAAS;AAAA,IACX;AAMA,UAAM,kBAAkB,QAAQ,IAAI;AACpC,QAAI,iBAAiB;AACnB,WAAK,UAAU;AAAA,IACjB;AAEA,QAAI,CAAC,eAAe;AAClB,UAAI,iBAAiB;AACnB,aAAK,eAAe;AAAA,UAClB,GAAG,YAAY;AAAA,UACf,OAAO;AAAA,QACT;AAAA,MACF,OAAO;AACL,aAAK,YAAY;AAAA,MACnB;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,iBAAQ;AAYR,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["resolve","resolve"]}
@@ -0,0 +1,67 @@
1
+ import {
2
+ parseFlutterPreview
3
+ } from "./chunk-CYQE3TLC.js";
4
+
5
+ // flutter-preview-path.ts
6
+ import { lstatSync, realpathSync } from "fs";
7
+ import path from "path";
8
+ function canonicalPathAllowMissing(file) {
9
+ const absolute = path.resolve(file);
10
+ try {
11
+ return realpathSync.native(absolute);
12
+ } catch (error) {
13
+ const code = error.code;
14
+ if (code !== "ENOENT" && code !== "ENOTDIR") throw error;
15
+ let isLink = false;
16
+ try {
17
+ isLink = lstatSync(absolute).isSymbolicLink();
18
+ } catch (statError) {
19
+ if (statError.code !== "ENOENT" && statError.code !== "ENOTDIR")
20
+ throw statError;
21
+ }
22
+ if (isLink) throw error;
23
+ const parent = path.dirname(absolute);
24
+ if (parent === absolute) throw error;
25
+ return path.join(
26
+ canonicalPathAllowMissing(parent),
27
+ path.basename(absolute)
28
+ );
29
+ }
30
+ }
31
+ function flutterPreviewKey(hostRoot, file, functionName) {
32
+ return `${path.relative(canonicalPathAllowMissing(hostRoot), canonicalPathAllowMissing(file)).split(path.sep).join("/")}#${functionName}`;
33
+ }
34
+ function flutterPreviewForCanvas(key, canvasFile, hostRoot) {
35
+ const hash = key.lastIndexOf("#");
36
+ if (hash < 0) throw new Error("Flutter preview key has no function");
37
+ const file = path.resolve(
38
+ canonicalPathAllowMissing(hostRoot),
39
+ key.slice(0, hash)
40
+ );
41
+ const relative = path.relative(path.dirname(canonicalPathAllowMissing(canvasFile)), file).split(path.sep).join("/");
42
+ return `${relative.startsWith(".") ? relative : `./${relative}`}#${key.slice(hash + 1)}`;
43
+ }
44
+ function pathInside(root, file) {
45
+ const relative = path.relative(root, file);
46
+ return relative === "" || relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
47
+ }
48
+ function rebaseFlutterPreview(preview, fromCanvas, toCanvas) {
49
+ const parsed = parseFlutterPreview(preview);
50
+ if ("error" in parsed) throw new Error(parsed.error);
51
+ const fromRoot = path.dirname(canonicalPathAllowMissing(fromCanvas));
52
+ const file = path.resolve(fromRoot, parsed.file);
53
+ return flutterPreviewForCanvas(
54
+ flutterPreviewKey(fromRoot, file, parsed.functionName),
55
+ toCanvas,
56
+ fromRoot
57
+ );
58
+ }
59
+
60
+ export {
61
+ canonicalPathAllowMissing,
62
+ flutterPreviewKey,
63
+ flutterPreviewForCanvas,
64
+ pathInside,
65
+ rebaseFlutterPreview
66
+ };
67
+ //# sourceMappingURL=chunk-5HIIF354.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../flutter-preview-path.ts"],"sourcesContent":["import { parseFlutterPreview } from \"./canvas/flutter-preview\";\nimport { lstatSync, realpathSync } from \"node:fs\";\nimport path from \"node:path\";\n\n/** Resolve existing ancestors, preserving the same identity before files appear. */\nexport function canonicalPathAllowMissing(file: string): string {\n const absolute = path.resolve(file);\n try {\n return realpathSync.native(absolute);\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code !== \"ENOENT\" && code !== \"ENOTDIR\") throw error;\n // A dangling link is not a missing ordinary path; do not invent its target.\n let isLink = false;\n try {\n isLink = lstatSync(absolute).isSymbolicLink();\n } catch (statError) {\n if (\n (statError as NodeJS.ErrnoException).code !== \"ENOENT\" &&\n (statError as NodeJS.ErrnoException).code !== \"ENOTDIR\"\n )\n throw statError;\n }\n if (isLink) throw error;\n const parent = path.dirname(absolute);\n if (parent === absolute) throw error;\n return path.join(\n canonicalPathAllowMissing(parent),\n path.basename(absolute),\n );\n }\n}\n\nexport function flutterPreviewKey(\n hostRoot: string,\n file: string,\n functionName: string,\n): string {\n return `${path.relative(canonicalPathAllowMissing(hostRoot), canonicalPathAllowMissing(file)).split(path.sep).join(\"/\")}#${functionName}`;\n}\n\nexport function flutterPreviewForCanvas(\n key: string,\n canvasFile: string,\n hostRoot: string,\n): string {\n const hash = key.lastIndexOf(\"#\");\n if (hash < 0) throw new Error(\"Flutter preview key has no function\");\n const file = path.resolve(\n canonicalPathAllowMissing(hostRoot),\n key.slice(0, hash),\n );\n const relative = path\n .relative(path.dirname(canonicalPathAllowMissing(canvasFile)), file)\n .split(path.sep)\n .join(\"/\");\n return `${relative.startsWith(\".\") ? relative : `./${relative}`}#${key.slice(hash + 1)}`;\n}\n\nexport function pathInside(root: string, file: string): boolean {\n const relative = path.relative(root, file);\n return (\n relative === \"\" ||\n (relative !== \"..\" &&\n !relative.startsWith(`..${path.sep}`) &&\n !path.isAbsolute(relative))\n );\n}\n\n/** Rebase from immutable copy-time provenance, independent of the host's root. */\nexport function rebaseFlutterPreview(\n preview: string,\n fromCanvas: string,\n toCanvas: string,\n): string {\n const parsed = parseFlutterPreview(preview);\n if (\"error\" in parsed) throw new Error(parsed.error);\n const fromRoot = path.dirname(canonicalPathAllowMissing(fromCanvas));\n const file = path.resolve(fromRoot, parsed.file);\n return flutterPreviewForCanvas(\n flutterPreviewKey(fromRoot, file, parsed.functionName),\n toCanvas,\n fromRoot,\n );\n}\n"],"mappings":";;;;;AACA,SAAS,WAAW,oBAAoB;AACxC,OAAO,UAAU;AAGV,SAAS,0BAA0B,MAAsB;AAC9D,QAAM,WAAW,KAAK,QAAQ,IAAI;AAClC,MAAI;AACF,WAAO,aAAa,OAAO,QAAQ;AAAA,EACrC,SAAS,OAAO;AACd,UAAM,OAAQ,MAAgC;AAC9C,QAAI,SAAS,YAAY,SAAS,UAAW,OAAM;AAEnD,QAAI,SAAS;AACb,QAAI;AACF,eAAS,UAAU,QAAQ,EAAE,eAAe;AAAA,IAC9C,SAAS,WAAW;AAClB,UACG,UAAoC,SAAS,YAC7C,UAAoC,SAAS;AAE9C,cAAM;AAAA,IACV;AACA,QAAI,OAAQ,OAAM;AAClB,UAAM,SAAS,KAAK,QAAQ,QAAQ;AACpC,QAAI,WAAW,SAAU,OAAM;AAC/B,WAAO,KAAK;AAAA,MACV,0BAA0B,MAAM;AAAA,MAChC,KAAK,SAAS,QAAQ;AAAA,IACxB;AAAA,EACF;AACF;AAEO,SAAS,kBACd,UACA,MACA,cACQ;AACR,SAAO,GAAG,KAAK,SAAS,0BAA0B,QAAQ,GAAG,0BAA0B,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,CAAC,IAAI,YAAY;AACzI;AAEO,SAAS,wBACd,KACA,YACA,UACQ;AACR,QAAM,OAAO,IAAI,YAAY,GAAG;AAChC,MAAI,OAAO,EAAG,OAAM,IAAI,MAAM,qCAAqC;AACnE,QAAM,OAAO,KAAK;AAAA,IAChB,0BAA0B,QAAQ;AAAA,IAClC,IAAI,MAAM,GAAG,IAAI;AAAA,EACnB;AACA,QAAM,WAAW,KACd,SAAS,KAAK,QAAQ,0BAA0B,UAAU,CAAC,GAAG,IAAI,EAClE,MAAM,KAAK,GAAG,EACd,KAAK,GAAG;AACX,SAAO,GAAG,SAAS,WAAW,GAAG,IAAI,WAAW,KAAK,QAAQ,EAAE,IAAI,IAAI,MAAM,OAAO,CAAC,CAAC;AACxF;AAEO,SAAS,WAAW,MAAc,MAAuB;AAC9D,QAAM,WAAW,KAAK,SAAS,MAAM,IAAI;AACzC,SACE,aAAa,MACZ,aAAa,QACZ,CAAC,SAAS,WAAW,KAAK,KAAK,GAAG,EAAE,KACpC,CAAC,KAAK,WAAW,QAAQ;AAE/B;AAGO,SAAS,qBACd,SACA,YACA,UACQ;AACR,QAAM,SAAS,oBAAoB,OAAO;AAC1C,MAAI,WAAW,OAAQ,OAAM,IAAI,MAAM,OAAO,KAAK;AACnD,QAAM,WAAW,KAAK,QAAQ,0BAA0B,UAAU,CAAC;AACnE,QAAM,OAAO,KAAK,QAAQ,UAAU,OAAO,IAAI;AAC/C,SAAO;AAAA,IACL,kBAAkB,UAAU,MAAM,OAAO,YAAY;AAAA,IACrD;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JVVHU3A7.js";
4
4
  import {
5
5
  sourceVersionHash
6
- } from "./chunk-KOSJXE4G.js";
6
+ } from "./chunk-H6BQZOAW.js";
7
7
 
8
8
  // ../../modules/astro-editor/parse.ts
9
9
  import { parse } from "@astrojs/compiler-rs";
@@ -1511,4 +1511,4 @@ export {
1511
1511
  annotateAstroSource,
1512
1512
  readAstroControls
1513
1513
  };
1514
- //# sourceMappingURL=chunk-FE6TYCLF.js.map
1514
+ //# sourceMappingURL=chunk-5VIBKVFO.js.map