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
package/dist/nextjs.cjs CHANGED
@@ -39,12 +39,12 @@ var import_node_path = require("path");
39
39
  // package.json
40
40
  var package_default = {
41
41
  name: "tempo-sdk",
42
- version: "0.0.66",
42
+ version: "0.0.75",
43
43
  publishConfig: {
44
44
  tag: "sdk-v2-latest"
45
45
  },
46
46
  type: "module",
47
- description: "Tempo SDK \u2014 Vite, Next.js, Expo, Svelte and Astro canvas integration, source annotations and storyboard types",
47
+ description: "Tempo SDK \u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types",
48
48
  repository: {
49
49
  type: "git",
50
50
  url: "git+https://github.com/TempoLabsAI/tempo-monorepo.git",
@@ -83,6 +83,10 @@ var package_default = {
83
83
  types: "./dist/canvas/svelte.d.ts",
84
84
  import: "./dist/canvas/svelte.js"
85
85
  },
86
+ "./canvas/vue": {
87
+ types: "./dist/canvas/vue.d.ts",
88
+ import: "./dist/canvas/vue.js"
89
+ },
86
90
  "./canvas/interact-projection": {
87
91
  types: "./dist/canvas/interact-projection.d.ts",
88
92
  import: "./dist/canvas/interact-projection.js"
@@ -116,6 +120,10 @@ var package_default = {
116
120
  types: "./dist/nextjs/plugin.d.ts",
117
121
  import: "./dist/nextjs/plugin.js"
118
122
  },
123
+ "./nuxt": {
124
+ types: "./dist/nuxt.d.ts",
125
+ import: "./dist/nuxt.js"
126
+ },
119
127
  "./expo": {
120
128
  types: "./dist/expo-babel-plugin.d.ts",
121
129
  import: "./dist/expo-babel-plugin.js",
@@ -130,9 +138,21 @@ var package_default = {
130
138
  types: "./dist/svelte.d.ts",
131
139
  import: "./dist/svelte.js"
132
140
  },
141
+ "./vue": {
142
+ types: "./dist/vue.d.ts",
143
+ import: "./dist/vue.js"
144
+ },
133
145
  "./astro/asset-preview-client": {
134
146
  types: "./dist/astro/asset-preview-client.d.ts",
135
147
  import: "./dist/astro/asset-preview-client.js"
148
+ },
149
+ "./flutter-preview-path": {
150
+ types: "./dist/flutter-preview-path.d.ts",
151
+ import: "./dist/flutter-preview-path.js"
152
+ },
153
+ "./canvas/flutter-preview": {
154
+ types: "./dist/canvas/flutter-preview.d.ts",
155
+ import: "./dist/canvas/flutter-preview.js"
136
156
  }
137
157
  },
138
158
  files: [
@@ -147,8 +167,9 @@ var package_default = {
147
167
  prepublishOnly: "pnpm build",
148
168
  demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
149
169
  "demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
170
+ "demo:nuxt": "pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev",
150
171
  test: "vitest run",
151
- "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",
172
+ "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",
152
173
  "test:watch": "vitest",
153
174
  "test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
154
175
  "test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
@@ -165,10 +186,13 @@ var package_default = {
165
186
  peerDependencies: {
166
187
  astro: "^7.0.0",
167
188
  "@babel/core": "^7.0.0",
189
+ h3: "^1.12.0",
168
190
  next: "^13 || ^14 || ^15 || ^16",
191
+ nuxt: "^3.18.0 || ^4.0.0",
169
192
  react: "^18 || ^19",
170
193
  svelte: "^5.0.0",
171
- vite: "^5 || ^6 || ^7 || ^8"
194
+ vite: "^5 || ^6 || ^7 || ^8",
195
+ vue: "^3.3.0"
172
196
  },
173
197
  peerDependenciesMeta: {
174
198
  astro: {
@@ -180,14 +204,23 @@ var package_default = {
180
204
  "@babel/core": {
181
205
  optional: true
182
206
  },
207
+ h3: {
208
+ optional: true
209
+ },
183
210
  next: {
184
211
  optional: true
185
212
  },
213
+ nuxt: {
214
+ optional: true
215
+ },
186
216
  svelte: {
187
217
  optional: true
188
218
  },
189
219
  vite: {
190
220
  optional: true
221
+ },
222
+ vue: {
223
+ optional: true
191
224
  }
192
225
  },
193
226
  devDependencies: {
@@ -197,14 +230,21 @@ var package_default = {
197
230
  "@modules/annotation": "workspace:*",
198
231
  "@modules/astro-editor": "workspace:*",
199
232
  "@modules/file-parser": "workspace:*",
233
+ "@modules/frame-pool": "workspace:*",
234
+ "@modules/iframe-projection": "workspace:*",
200
235
  "@modules/svelte-editor": "workspace:*",
236
+ "@modules/vue-editor": "workspace:*",
237
+ "@nuxt/kit": "^4.6.2",
201
238
  "@types/babel__core": "^7.20.5",
202
239
  "@types/node": "^25.0.8",
203
240
  "@types/react": "catalog:",
204
241
  "@types/react-dom": "catalog:",
205
242
  "@vitejs/plugin-react": "catalog:",
243
+ "@vitejs/plugin-vue": "6.0.10",
206
244
  astro: "7.3.8",
245
+ h3: "^1.15.11",
207
246
  "magic-string": "^0.30.21",
247
+ nuxt: "^4.6.2",
208
248
  playwright: "^1.58.2",
209
249
  "react-dom": "catalog:",
210
250
  "react-dom18": "npm:react-dom@18.3.1",
@@ -213,7 +253,8 @@ var package_default = {
213
253
  tsup: "^8.5.1",
214
254
  typescript: "catalog:",
215
255
  vite: "catalog:",
216
- vitest: "catalog:"
256
+ vitest: "catalog:",
257
+ vue: "3.5.44"
217
258
  }
218
259
  };
219
260
 
@@ -258,7 +299,8 @@ function createTempoHostIdentity(framework, options = {}) {
258
299
  sdkVersion: package_default.version,
259
300
  sdkChannel: TEMPO_SDK_CHANNEL,
260
301
  pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),
261
- framework
302
+ framework,
303
+ ...options.capabilities ? { capabilities: options.capabilities } : {}
262
304
  };
263
305
  }
264
306
 
@@ -1 +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\" | \"astro\";\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}\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: { root?: string; pluginActive?: boolean } = {},\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 };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.66\",\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK — Vite, Next.js, Expo, Svelte and Astro canvas integration, source annotations and storyboard types\",\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/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 \"./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 \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.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 \"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 canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.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 \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\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/svelte-editor\": \"workspace:*\",\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 \"astro\": \"7.3.8\",\n \"magic-string\": \"^0.30.21\",\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 }\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,IAAAA,kBAAyC;AACzC,yBAA8B;AAC9B,IAAAC,oBAAiC;;;ACnBjC,qBAA6B;AAC7B,uBAAwB;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,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,OAA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../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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,IAAAA,kBAAyC;AACzC,yBAA8B;AAC9B,IAAAC,oBAAiC;;;ACnBjC,qBAA6B;AAC7B,uBAAwB;;;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,IACA,2BAA2B;AAAA,MACzB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,YAAY;AAAA,MACV,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,mBAAmB;AAAA,MACjB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,gBAAgB;AAAA,MACd,OAAS;AAAA,MACT,QAAU;AAA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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":["import_node_fs","import_node_path"]}
package/dist/nextjs.d.cts CHANGED
@@ -11,7 +11,14 @@ interface ElementInfo {
11
11
  /** Supported prop value types. `undefined` values are skipped. */
12
12
  type PropValue = string | number | boolean | null | undefined | ((...args: unknown[]) => unknown) | object;
13
13
 
14
- type TempoHostFramework = "vite" | "nextjs" | "astro";
14
+ type TempoHostFramework = "vite" | "nextjs" | "nuxt" | "astro";
15
+ /** Optional features a host's served identity vouches for. */
16
+ interface TempoHostIdentityCapabilities {
17
+ /** 1 when the server renders Astro components for the canvas. */
18
+ astroComponents?: number;
19
+ /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */
20
+ vueSourceAnnotation?: number;
21
+ }
15
22
  interface TempoHostIdentity<Framework extends TempoHostFramework = TempoHostFramework> {
16
23
  tempoHost: true;
17
24
  contractVersion: number;
@@ -20,6 +27,7 @@ interface TempoHostIdentity<Framework extends TempoHostFramework = TempoHostFram
20
27
  sdkChannel: string;
21
28
  pluginActive: boolean;
22
29
  framework: Framework;
30
+ capabilities?: TempoHostIdentityCapabilities;
23
31
  }
24
32
 
25
33
  /**
package/dist/nextjs.d.ts CHANGED
@@ -11,7 +11,14 @@ interface ElementInfo {
11
11
  /** Supported prop value types. `undefined` values are skipped. */
12
12
  type PropValue = string | number | boolean | null | undefined | ((...args: unknown[]) => unknown) | object;
13
13
 
14
- type TempoHostFramework = "vite" | "nextjs" | "astro";
14
+ type TempoHostFramework = "vite" | "nextjs" | "nuxt" | "astro";
15
+ /** Optional features a host's served identity vouches for. */
16
+ interface TempoHostIdentityCapabilities {
17
+ /** 1 when the server renders Astro components for the canvas. */
18
+ astroComponents?: number;
19
+ /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */
20
+ vueSourceAnnotation?: number;
21
+ }
15
22
  interface TempoHostIdentity<Framework extends TempoHostFramework = TempoHostFramework> {
16
23
  tempoHost: true;
17
24
  contractVersion: number;
@@ -20,6 +27,7 @@ interface TempoHostIdentity<Framework extends TempoHostFramework = TempoHostFram
20
27
  sdkChannel: string;
21
28
  pluginActive: boolean;
22
29
  framework: Framework;
30
+ capabilities?: TempoHostIdentityCapabilities;
23
31
  }
24
32
 
25
33
  /**
package/dist/nextjs.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  tempoHostIdentity,
6
6
  tempoNextjsPlugin,
7
7
  tempoProjectRoot
8
- } from "./chunk-6W6UKDSY.js";
8
+ } from "./chunk-2YX4WVFH.js";
9
9
  export {
10
10
  _internal,
11
11
  _resetTempoProjectRoot,
@@ -0,0 +1,24 @@
1
+ import * as h3 from 'h3';
2
+
3
+ type TempoHostFramework = "vite" | "nextjs" | "nuxt" | "astro";
4
+ /** Optional features a host's served identity vouches for. */
5
+ interface TempoHostIdentityCapabilities {
6
+ /** 1 when the server renders Astro components for the canvas. */
7
+ astroComponents?: number;
8
+ /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */
9
+ vueSourceAnnotation?: number;
10
+ }
11
+ interface TempoHostIdentity<Framework extends TempoHostFramework = TempoHostFramework> {
12
+ tempoHost: true;
13
+ contractVersion: number;
14
+ workspaceNonce: string;
15
+ sdkVersion: string;
16
+ sdkChannel: string;
17
+ pluginActive: boolean;
18
+ framework: Framework;
19
+ capabilities?: TempoHostIdentityCapabilities;
20
+ }
21
+
22
+ declare const _default: h3.EventHandler<h3.EventHandlerRequest, TempoHostIdentity<"nuxt">>;
23
+
24
+ export { _default as default };
@@ -0,0 +1,18 @@
1
+ import {
2
+ TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,
3
+ createTempoHostIdentity
4
+ } from "../../chunk-HZXQPM4W.js";
5
+
6
+ // nuxt/runtime/identity.ts
7
+ import { defineEventHandler, setResponseHeaders } from "h3";
8
+ var identity_default = defineEventHandler((event) => {
9
+ setResponseHeaders(event, {
10
+ "cache-control": "no-store",
11
+ [TEMPO_HOST_IDENTITY_CAPABILITY_HEADER]: "1"
12
+ });
13
+ return createTempoHostIdentity("nuxt");
14
+ });
15
+ export {
16
+ identity_default as default
17
+ };
18
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../nuxt/runtime/identity.ts"],"sourcesContent":["// The `/__tempo/identity` route of the Nuxt sidecar: the same contract the\n// Vite plugin and the Next sidecar's route serve, read at request time so\n// `pluginActive` and the workspace nonce reflect the running process.\nimport { defineEventHandler, setResponseHeaders } from \"h3\";\n\nimport {\n createTempoHostIdentity,\n TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,\n} from \"../../host-identity.ts\";\n\nexport default defineEventHandler((event) => {\n setResponseHeaders(event, {\n \"cache-control\": \"no-store\",\n [TEMPO_HOST_IDENTITY_CAPABILITY_HEADER]: \"1\",\n });\n return createTempoHostIdentity(\"nuxt\");\n});\n"],"mappings":";;;;;;AAGA,SAAS,oBAAoB,0BAA0B;AAOvD,IAAO,mBAAQ,mBAAmB,CAAC,UAAU;AAC3C,qBAAmB,OAAO;AAAA,IACxB,iBAAiB;AAAA,IACjB,CAAC,qCAAqC,GAAG;AAAA,EAC3C,CAAC;AACD,SAAO,wBAAwB,MAAM;AACvC,CAAC;","names":[]}
package/dist/nuxt.d.ts ADDED
@@ -0,0 +1,102 @@
1
+ import * as nuxt_schema from 'nuxt/schema';
2
+
3
+ /**
4
+ * The Tempo Nuxt module. The Tempo-owned Nuxt sidecar under `tempo/`
5
+ * (`extends: [".."]`, `ssr: false`, `modules: ["tempo-sdk/nuxt"]`) hosts a
6
+ * Nuxt project's component storyboards at `/tempo-host`, inside Nuxt's own
7
+ * Vite dev server, the way the Next sidecar hosts them in `next dev`. This
8
+ * module makes that server a Tempo canvas host: it annotates `.vue` sources,
9
+ * compiles the generated React host and the canvas files as React, serves
10
+ * the identity route the devserver probes and the registration barrier the
11
+ * render pool crosses, and keeps the user's layer from wrapping the host
12
+ * page.
13
+ *
14
+ * Every rule below (R1 to R9) removes a failure the research measured; the
15
+ * symptom each prevents is in tempo-sdk/CLAUDE.md. Like every Tempo plugin
16
+ * it is a no-op unless `TEMPO` is set (or `enabled` says otherwise).
17
+ */
18
+ /**
19
+ * The module's options, read from the merged `tempo` config key only, never
20
+ * from inline module options. The app is a layer of the sidecar, so both may
21
+ * list the module; kit installs it once per Nuxt (the first listing, with
22
+ * that listing's inline options), and which listing is first differs by
23
+ * major (Nuxt 4 the app's, Nuxt 3 the sidecar's, measured). The config key
24
+ * merges with the root config winning on both, so the sidecar's own config
25
+ * decides, never module order.
26
+ */
27
+ interface TempoNuxtModuleOptions {
28
+ /** Whether the module does anything. Defaults to `Boolean(process.env.TEMPO)`,
29
+ * the gate every Tempo plugin shares, so a sidecar started outside Tempo
30
+ * is an ordinary Nuxt app. */
31
+ enabled?: boolean;
32
+ /**
33
+ * `"app"` (default): the user's own `nuxt dev`, which serves route
34
+ * storyboards. Annotation only, the least a user who lists the module in
35
+ * their own nuxt.config can get. Tempo adds it there through its generated
36
+ * app layer on the command line (`nuxt dev --extends
37
+ * ./tempo/nuxt-app-layer`), never by editing that config.
38
+ * `"host"`: the Tempo sidecar, which hosts component storyboards. The
39
+ * generated sidecar config sets it as `tempo: { role: "host" }`.
40
+ */
41
+ role?: "host" | "app";
42
+ }
43
+ declare const _default: nuxt_schema.NuxtModule<TempoNuxtModuleOptions, TempoNuxtModuleOptions, false>;
44
+
45
+ /** The `<meta>` tags the Tempo Vite plugin's `transformIndexHtml` puts on
46
+ * a host page, with the same values: the host root (what `data-tempo-filepath`
47
+ * is relative to, and what the devserver's readiness probe checks), the
48
+ * source identity root (the user's app) and the workspace nonce when the
49
+ * devserver issued one. Real paths, as the Vite plugin publishes them. */
50
+ declare function tempoHostPageMetas(tempoRoot: string, projectRoot: string): Array<{
51
+ name: string;
52
+ content: string;
53
+ }>;
54
+ /** The parts of the client Vite config R6 and R17 rewrite. */
55
+ interface MutableViteConfig {
56
+ plugins?: unknown[];
57
+ esbuild?: Record<string, unknown> | false;
58
+ oxc?: Record<string, unknown> | false;
59
+ server?: {
60
+ watch?: {
61
+ ignored?: unknown;
62
+ } | null;
63
+ };
64
+ }
65
+ /** The build template `.tempo/nuxt-board-environment.ts` imports, as
66
+ * `#build/tempo-board-plugin-sources.mjs`, to name a board's plugins (R16). */
67
+ declare const BOARD_PLUGIN_SOURCES_TEMPLATE = "tempo-board-plugin-sources.mjs";
68
+ /**
69
+ * R16. Each client plugin's source file, keyed by the plugin itself. Every
70
+ * Vue board applies the app's client plugins, and `canvas/vue.tsx` turns a
71
+ * board setup that never settles into the board's own error, asking the
72
+ * board environment which plugin is still running. Nuxt strips a plugin's
73
+ * `name` at build time and `#build/plugins` is a list of bare functions, so
74
+ * only the build knows which file each came from. This module imports the
75
+ * same files `#build/plugins` does, so its keys are the very functions a
76
+ * board applies; server-only plugins are left out, as `#build/plugins` leaves
77
+ * them out of the client.
78
+ */
79
+ declare function boardPluginSourcesModule(plugins: ReadonlyArray<{
80
+ src: string;
81
+ mode?: string;
82
+ }>, projectRoot: string): string;
83
+ /**
84
+ * R6. Nuxt pushes plugin-vue and plugin-vue-jsx after `vite:extendConfig`;
85
+ * `vite:configResolved` is the last hook before createServer. The vue-jsx
86
+ * plugin's config hook narrows the TS transformer to `.ts`, so `.tsx`
87
+ * reached import analysis untransformed, and when it did run it emitted
88
+ * Vue vnodes. Nuxt's esbuild options (`jsxFactory: "h"`) also override
89
+ * plugin-react's own config hook, so the React runtime is pinned here, last.
90
+ * Vue JSX components are therefore unsupported in the sidecar.
91
+ *
92
+ * Dropping vue-jsx also drops the `include: /\.ts$/` its config hook adds.
93
+ * Vite concatenates every plugin's `include` into one allow-list, so a plugin
94
+ * that adds a narrow entry assuming vue-jsx's is there (@vue-macros/setup-sfc
95
+ * re-includes `vitest.setup.*`) left the transformer with only that entry:
96
+ * Elk's app `.ts` and the canvas `.tsx` reached unctx, import protection and
97
+ * import analysis as raw TypeScript (`Unexpected token`). Vite's default
98
+ * include goes back in vue-jsx's place.
99
+ */
100
+ declare function pinHostTransformOptions(config: MutableViteConfig): void;
101
+
102
+ export { BOARD_PLUGIN_SOURCES_TEMPLATE, type MutableViteConfig, type TempoNuxtModuleOptions, boardPluginSourcesModule, _default as default, pinHostTransformOptions, tempoHostPageMetas };