tempo-sdk 0.0.99 → 0.0.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/README.md +3 -403
  2. package/dist/assets/editor.d.ts +43 -65
  3. package/dist/assets/editor.js +1 -573
  4. package/dist/assets/index.d.ts +11 -61
  5. package/dist/assets/index.js +1 -338
  6. package/dist/assets/parser.d.ts +68 -78
  7. package/dist/assets/parser.js +1 -33
  8. package/dist/astro/asset-preview-client.d.ts +3 -2
  9. package/dist/astro/asset-preview-client.js +1 -93
  10. package/dist/astro/controls.d.ts +1 -3
  11. package/dist/astro/controls.js +1 -7
  12. package/dist/astro/document-client.d.ts +5 -6
  13. package/dist/astro/document-client.js +1 -78
  14. package/dist/astro/runtime.d.ts +23 -11
  15. package/dist/astro/runtime.js +1 -86
  16. package/dist/astro.d.ts +19 -13
  17. package/dist/astro.js +1 -818
  18. package/dist/canvas/astro-contract.d.ts +0 -3
  19. package/dist/canvas/astro-contract.js +1 -9
  20. package/dist/canvas/astro.d.ts +3 -4
  21. package/dist/canvas/astro.js +1 -42
  22. package/dist/canvas/editor.d.ts +187 -183
  23. package/dist/canvas/editor.js +1 -1094
  24. package/dist/canvas/flutter-preview.d.ts +0 -1
  25. package/dist/canvas/flutter-preview.js +1 -9
  26. package/dist/canvas/index.d.ts +46 -100
  27. package/dist/canvas/index.js +1 -3926
  28. package/dist/canvas/interact-projection.d.ts +7 -5
  29. package/dist/canvas/interact-projection.js +1 -12
  30. package/dist/canvas/parser.d.ts +10 -303
  31. package/dist/canvas/parser.js +1 -30
  32. package/dist/canvas/svelte.d.ts +6 -7
  33. package/dist/canvas/svelte.js +1 -91
  34. package/dist/canvas/vue.d.ts +9 -49
  35. package/dist/canvas/vue.js +1 -264
  36. package/dist/chunk-CXCUJCXD.js +1 -0
  37. package/dist/chunk-FH6TMWFA.js +1 -0
  38. package/dist/chunk-FL7FSJSL.js +1 -0
  39. package/dist/chunk-GQIOB5SV.js +1 -0
  40. package/dist/chunk-HBQ7FFH7.js +1 -0
  41. package/dist/chunk-JRJOWLCN.js +1 -0
  42. package/dist/chunk-LJCBFTMP.js +1 -0
  43. package/dist/chunk-M3GN2KUH.js +1 -0
  44. package/dist/chunk-MPIHFFML.js +1 -0
  45. package/dist/chunk-T5TY3U2H.js +1 -0
  46. package/dist/chunk-XO2BSHWM.js +1 -0
  47. package/dist/chunk-XUSV3KOD.js +1 -0
  48. package/dist/chunk-ZXBMP6RV.js +1 -0
  49. package/dist/{controls-uCaQ3CNX.d.ts → controls-DKslABtM.d.ts} +0 -3
  50. package/dist/expo/plugin.cjs +1 -1928
  51. package/dist/expo/plugin.js +1 -8
  52. package/dist/expo-babel-plugin.cjs +1 -1928
  53. package/dist/expo-babel-plugin.d.cts +46 -40
  54. package/dist/expo-babel-plugin.d.ts +46 -40
  55. package/dist/expo-babel-plugin.js +1 -8
  56. package/dist/flutter-preview-path.d.ts +23 -7
  57. package/dist/flutter-preview-path.js +1 -16
  58. package/dist/index.d.ts +33 -45
  59. package/dist/index.js +1 -20
  60. package/dist/nextjs/plugin.cjs +1 -413
  61. package/dist/nextjs/plugin.js +1 -7
  62. package/dist/nextjs-loader.cjs +1 -2277
  63. package/dist/nextjs.cjs +1 -484
  64. package/dist/nextjs.d.cts +2 -58
  65. package/dist/nextjs.d.ts +2 -58
  66. package/dist/nextjs.js +1 -17
  67. package/dist/nuxt/runtime/identity.d.ts +2 -4
  68. package/dist/nuxt/runtime/identity.js +1 -18
  69. package/dist/nuxt.d.ts +31 -92
  70. package/dist/nuxt.js +1 -5854
  71. package/dist/{page-DwLnOM5d.d.ts → page-Bc8PekIX.d.ts} +1 -5
  72. package/dist/parser.d-MO5ciJ5n.d.ts +236 -0
  73. package/dist/{storyboard-CMJVBSXn.d.ts → storyboard.contract.d-UQ4MUYN5.d.ts} +3 -25
  74. package/dist/svelte.d.ts +8 -18
  75. package/dist/svelte.js +1 -917
  76. package/dist/types-CfUgM2w4.d.ts +57 -0
  77. package/dist/v1-client-compat-n0E0XxuX.d.ts +5 -0
  78. package/dist/vue.d.ts +17 -58
  79. package/dist/vue.js +1 -1501
  80. package/package.json +12 -62
  81. package/dist/assets/editor.js.map +0 -1
  82. package/dist/assets/index.js.map +0 -1
  83. package/dist/assets/parser.js.map +0 -1
  84. package/dist/astro/asset-preview-client.js.map +0 -1
  85. package/dist/astro/controls.js.map +0 -1
  86. package/dist/astro/document-client.js.map +0 -1
  87. package/dist/astro/runtime.js.map +0 -1
  88. package/dist/astro.js.map +0 -1
  89. package/dist/canvas/astro-contract.js.map +0 -1
  90. package/dist/canvas/astro.js.map +0 -1
  91. package/dist/canvas/editor.js.map +0 -1
  92. package/dist/canvas/flutter-preview.js.map +0 -1
  93. package/dist/canvas/index.js.map +0 -1
  94. package/dist/canvas/interact-projection.js.map +0 -1
  95. package/dist/canvas/parser.js.map +0 -1
  96. package/dist/canvas/svelte.js.map +0 -1
  97. package/dist/canvas/vue.js.map +0 -1
  98. package/dist/chunk-27WT3XUG.js +0 -455
  99. package/dist/chunk-27WT3XUG.js.map +0 -1
  100. package/dist/chunk-5HIIF354.js +0 -67
  101. package/dist/chunk-5HIIF354.js.map +0 -1
  102. package/dist/chunk-65B52AR7.js +0 -11
  103. package/dist/chunk-65B52AR7.js.map +0 -1
  104. package/dist/chunk-6HYKKP5N.js +0 -2658
  105. package/dist/chunk-6HYKKP5N.js.map +0 -1
  106. package/dist/chunk-6SOP4XU6.js +0 -1891
  107. package/dist/chunk-6SOP4XU6.js.map +0 -1
  108. package/dist/chunk-AFXE462X.js +0 -1253
  109. package/dist/chunk-AFXE462X.js.map +0 -1
  110. package/dist/chunk-BQPKOVI5.js +0 -115
  111. package/dist/chunk-BQPKOVI5.js.map +0 -1
  112. package/dist/chunk-CYDF4LYJ.js +0 -342
  113. package/dist/chunk-CYDF4LYJ.js.map +0 -1
  114. package/dist/chunk-CYQE3TLC.js +0 -37
  115. package/dist/chunk-CYQE3TLC.js.map +0 -1
  116. package/dist/chunk-DI2ZFAWL.js +0 -14
  117. package/dist/chunk-DI2ZFAWL.js.map +0 -1
  118. package/dist/chunk-EGRHWZRV.js +0 -1
  119. package/dist/chunk-EGRHWZRV.js.map +0 -1
  120. package/dist/chunk-FGWGY3G3.js +0 -157
  121. package/dist/chunk-FGWGY3G3.js.map +0 -1
  122. package/dist/chunk-HOBTDB6G.js +0 -112
  123. package/dist/chunk-HOBTDB6G.js.map +0 -1
  124. package/dist/chunk-I7VF4ZOV.js +0 -630
  125. package/dist/chunk-I7VF4ZOV.js.map +0 -1
  126. package/dist/chunk-JVVHU3A7.js +0 -1077
  127. package/dist/chunk-JVVHU3A7.js.map +0 -1
  128. package/dist/chunk-MIXQVPDH.js +0 -8606
  129. package/dist/chunk-MIXQVPDH.js.map +0 -1
  130. package/dist/chunk-MU7S7NU7.js +0 -183
  131. package/dist/chunk-MU7S7NU7.js.map +0 -1
  132. package/dist/chunk-OX2YKYSL.js +0 -13
  133. package/dist/chunk-OX2YKYSL.js.map +0 -1
  134. package/dist/chunk-PYAJHLXO.js +0 -903
  135. package/dist/chunk-PYAJHLXO.js.map +0 -1
  136. package/dist/chunk-SGN7BDRE.js +0 -16
  137. package/dist/chunk-SGN7BDRE.js.map +0 -1
  138. package/dist/chunk-SGTGDLOX.js +0 -285
  139. package/dist/chunk-SGTGDLOX.js.map +0 -1
  140. package/dist/chunk-T364NBR3.js +0 -1440
  141. package/dist/chunk-T364NBR3.js.map +0 -1
  142. package/dist/chunk-U66QI3EN.js +0 -1524
  143. package/dist/chunk-U66QI3EN.js.map +0 -1
  144. package/dist/chunk-WTXOWQ7N.js +0 -47
  145. package/dist/chunk-WTXOWQ7N.js.map +0 -1
  146. package/dist/chunk-X5DJKVBT.js +0 -1308
  147. package/dist/chunk-X5DJKVBT.js.map +0 -1
  148. package/dist/chunk-ZT7HJ6YU.js +0 -38
  149. package/dist/chunk-ZT7HJ6YU.js.map +0 -1
  150. package/dist/chunk-ZW26VZHX.js +0 -3169
  151. package/dist/chunk-ZW26VZHX.js.map +0 -1
  152. package/dist/controls-reader-5MFHYBZZ.js +0 -192
  153. package/dist/controls-reader-5MFHYBZZ.js.map +0 -1
  154. package/dist/expo/plugin.cjs.map +0 -1
  155. package/dist/expo/plugin.js.map +0 -1
  156. package/dist/expo-babel-plugin.cjs.map +0 -1
  157. package/dist/expo-babel-plugin.js.map +0 -1
  158. package/dist/flutter-preview-path.js.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/nextjs/plugin.cjs.map +0 -1
  161. package/dist/nextjs/plugin.js.map +0 -1
  162. package/dist/nextjs-loader.cjs.map +0 -1
  163. package/dist/nextjs.cjs.map +0 -1
  164. package/dist/nextjs.js.map +0 -1
  165. package/dist/nuxt/runtime/identity.js.map +0 -1
  166. package/dist/nuxt.js.map +0 -1
  167. package/dist/svelte.js.map +0 -1
  168. package/dist/types-C8OIU-kc.d.ts +0 -106
  169. package/dist/v1-client-compat-qxaXEDm_.d.ts +0 -23
  170. package/dist/vue.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../canvas/svelte.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\";\n\nimport {\n StoryboardSlot,\n type StoryboardLayout,\n type StoryboardVrtConfig,\n} from \"./storyboard\";\n\n/** Public Svelte 5 component call shape. This Svelte-specific entrypoint keeps\n * React-only consumers of tempo-sdk/canvas from resolving the optional Svelte\n * peer dependency. */\nexport type SvelteComponent<\n Props extends Record<string, unknown> = Record<string, unknown>,\n> = import(\"svelte\").Component<Props>;\n\ntype SvelteRuntime = typeof import(\"svelte\");\ntype SvelteRuntimeState =\n | { kind: \"pending\"; promise: Promise<void> }\n | { kind: \"ready\"; runtime: SvelteRuntime }\n | { kind: \"error\"; error: unknown };\n\nlet svelteRuntimeState: SvelteRuntimeState | null = null;\n\n/** Suspense resource for the optional Svelte runtime. The storyboard must not\n * report its React shell as rendered before the authored Svelte DOM exists,\n * otherwise the component projection opens with a permanent DOM-only\n * baseline. */\nfunction readSvelteRuntime(): SvelteRuntime {\n if (svelteRuntimeState?.kind === \"ready\") return svelteRuntimeState.runtime;\n if (svelteRuntimeState?.kind === \"error\") throw svelteRuntimeState.error;\n if (!svelteRuntimeState) {\n const promise = import(\"svelte\").then(\n (runtime) => {\n svelteRuntimeState = { kind: \"ready\", runtime };\n },\n (error: unknown) => {\n svelteRuntimeState = { kind: \"error\", error };\n },\n );\n svelteRuntimeState = { kind: \"pending\", promise };\n }\n throw svelteRuntimeState.promise;\n}\n\nexport function SvelteStoryboard<\n Props extends Record<string, unknown> = Record<string, unknown>,\n>({\n id,\n name,\n component,\n layout,\n props,\n vrt,\n ...annotations\n}: {\n id: string;\n component: SvelteComponent<Props>;\n layout: StoryboardLayout;\n name?: string;\n props?: Props;\n vrt?: boolean | StoryboardVrtConfig;\n} & Record<`data-tempo-${string}`, unknown>) {\n return (\n <StoryboardSlot\n data-tempo-hide-fiber=\"true\"\n id={id}\n name={name}\n layout={layout}\n kind=\"component\"\n uiFramework=\"svelte\"\n vrt={!!vrt}\n >\n <SvelteComponentMount component={component} props={props} />\n </StoryboardSlot>\n );\n}\n\n/** Svelte's dev HMR exports a new function on every evaluation, but its\n * current signal names the existing live component family. Preserve that\n * mounted wrapper: remounting a later export disconnects the DOM from the\n * signal updated by subsequent hot updates. Production components and actual\n * component replacements retain their ordinary function identity.\n *\n * The optional Svelte 5 compiler HMR protocol uses a private symbol. Inspect\n * its full shape conservatively; unknown runtimes keep normal remounting.\n */\nfunction svelteComponentIdentity(component: object): object {\n const symbol = Object.getOwnPropertySymbols(component).find(\n (symbol) => symbol.description === \"hmr\",\n );\n const hmr = symbol ? Reflect.get(component, symbol) : null;\n return hmr &&\n typeof hmr === \"object\" &&\n typeof hmr.fn === \"function\" &&\n typeof hmr.update === \"function\" &&\n hmr.current !== null &&\n typeof hmr.current === \"object\"\n ? hmr.current\n : component;\n}\n\nfunction SvelteComponentMount<Props extends Record<string, unknown>>({\n component,\n props,\n}: {\n component: SvelteComponent<Props>;\n props?: Props;\n}) {\n const targetRef = useRef<HTMLDivElement | null>(null);\n const [mountError, setMountError] = useState<unknown>(null);\n const runtime = readSvelteRuntime();\n const componentIdentity = svelteComponentIdentity(component);\n\n useLayoutEffect(() => {\n const target = targetRef.current;\n if (!target) return;\n let mounted: Record<string, unknown> | null = null;\n try {\n mounted = runtime.mount(component as never, {\n target,\n props: props ?? ({} as Props),\n }) as Record<string, unknown>;\n runtime.flushSync();\n } catch (error) {\n setMountError(error);\n }\n\n return () => {\n const current = mounted;\n mounted = null;\n if (current) void runtime.unmount(current);\n target.replaceChildren();\n };\n // Svelte component props are explicit static storyboard inputs today.\n // Actual component-family replacement remounts; Svelte HMR updates its\n // existing family in place. Static storyboard props remain unchanged.\n }, [componentIdentity, runtime]);\n\n if (mountError) throw mountError;\n return <div ref={targetRef} data-tempo-hide-fiber=\"true\" />;\n}\n"],"mappings":";;;;;;;AAAA,SAAS,iBAAiB,QAAQ,gBAAgB;AAwE5C;AAnDN,IAAI,qBAAgD;AAMpD,SAAS,oBAAmC;AAC1C,MAAI,oBAAoB,SAAS,QAAS,QAAO,mBAAmB;AACpE,MAAI,oBAAoB,SAAS,QAAS,OAAM,mBAAmB;AACnE,MAAI,CAAC,oBAAoB;AACvB,UAAM,UAAU,OAAO,QAAQ,EAAE;AAAA,MAC/B,CAAC,YAAY;AACX,6BAAqB,EAAE,MAAM,SAAS,QAAQ;AAAA,MAChD;AAAA,MACA,CAAC,UAAmB;AAClB,6BAAqB,EAAE,MAAM,SAAS,MAAM;AAAA,MAC9C;AAAA,IACF;AACA,yBAAqB,EAAE,MAAM,WAAW,QAAQ;AAAA,EAClD;AACA,QAAM,mBAAmB;AAC3B;AAEO,SAAS,iBAEd;AAAA,EACA;AAAA,EACA;AAAA,EAC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AE/B,MAAI,WAAY,OAAM;AACtB,SAAO,oBAAC,SAAI,KAAK,WAAW,yBAAsB,QAAO;AAC3D;","names":["symbol"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../canvas/vue.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from \"react\";\n\nimport { useCanvasStoryboardRenderId } from \"./canvas\";\nimport {\n StoryboardSlot,\n type StoryboardLayout,\n type StoryboardVrtConfig,\n} from \"./storyboard\";\n\n/** Public Vue 3 component shape. This Vue-specific entrypoint keeps\n * React-only consumers of tempo-sdk/canvas from resolving the optional Vue\n * peer dependency. */\nexport type VueComponent<\n Props extends Record<string, unknown> = Record<string, unknown>,\n> = import(\"vue\").Component<Props>;\n\n/** The app a storyboard mounts, for `setup` to install plugins on. */\nexport type VueApp = import(\"vue\").App;\n\n/** Where a storyboard's app is being prepared. `renderId` is unique per\n * document (canvas path plus storyboard id); `storyboardId` is the authored\n * id alone, which two canvases may share. */\nexport interface VueStoryboardContext {\n storyboardId: string;\n renderId: string;\n}\n\n/** What every Vue storyboard's app goes through before it mounts. The host\n * entry of a meta-framework sidecar installs one: the Nuxt sidecar creates\n * the board's Nuxt app context and applies the app's plugins here. A\n * storyboard's own `setup` runs after it, on the same app. */\nexport interface VueStoryboardEnvironment {\n setup:\n | ((app: VueApp, context: VueStoryboardContext) => void)\n | ((app: VueApp, context: VueStoryboardContext) => Promise<void>);\n /** Releases what `setup` bound outside the board's Vue app: the Nuxt\n * sidecar unbinds the board's Nuxt app context, stops its effect scope and\n * removes the global listeners its plugins added. Called once for every\n * app `setup` ran on: after the app unmounts, or when it is discarded\n * without mounting (its setup failed or missed its deadline, or the board\n * went away first). Without it every board remount leaked a whole Nuxt\n * app. */\n teardown?: (app: VueApp, context: VueStoryboardContext) => void;\n /** Names what this board's `setup` is still waiting on (the Nuxt sidecar\n * names the plugins still running), for the board's error when setup\n * misses its deadline. */\n describePendingSetup?: (\n app: VueApp,\n context: VueStoryboardContext,\n ) => string | undefined;\n}\n\n/** Runs before a storyboard's app mounts: `app.use(...)` for pinia,\n * vue-router or vue-i18n. May be async; the board stays pending until it\n * settles. A union of two signatures rather than one returning\n * `void | Promise<void>`, so an inline `(app) => app.use(pinia)` (which\n * returns the app) stays assignable, as it was to `(app) => void`. */\nexport type VueStoryboardSetup =\n | ((app: VueApp) => void)\n | ((app: VueApp) => Promise<void>);\n\nlet environment: VueStoryboardEnvironment | null = null;\n\n/**\n * How long a board's setup (the environment's, then the storyboard's) may\n * take before the board shows an error instead. The canvas declares a board\n * stalled when no first batch has arrived 30 s after it began streaming, and\n * then reloads the whole shared host, sibling boards included, with a\n * generic convergence-stall problem. A setup that never settles (a Nuxt\n * plugin awaiting something the canvas never provides) must become this\n * board's own named error well before that; a setup that waits on the\n * network still has ample time.\n */\nexport const VUE_STORYBOARD_SETUP_TIMEOUT_MS = 15_000;\n\n/** Installs (or with `null` removes) the environment every Vue storyboard\n * in this document is prepared with. Call it before rendering the canvas\n * host; a board prepared earlier keeps the environment it was prepared\n * with. The Vite host configures nothing, so plain Vue projects mount\n * exactly as they did without one. */\nexport function configureVueStoryboards(\n next: VueStoryboardEnvironment | null,\n): void {\n environment = next;\n}\n\ntype VueRuntime = typeof import(\"vue\");\ntype VueRuntimeState =\n | { kind: \"pending\"; promise: Promise<void> }\n | { kind: \"ready\"; runtime: VueRuntime }\n | { kind: \"error\"; error: unknown };\n\nlet vueRuntimeState: VueRuntimeState | null = null;\n\n/** The phases, as Vue names them in an error handler's `info`\n * (`ErrorTypeStrings` in @vue/runtime-core), in which an error leaves the\n * component unable to render: setup, render, a component update and the\n * lifecycle hooks. Only those replace the board with its error UI. An error\n * in an event handler, a watcher, an async loader or a directive leaves the\n * mounted board standing, as a throw from a React storyboard's event handler\n * does. Production builds spell `info` as a docs link; the canvas host runs\n * Vue's development build. */\nconst RENDER_PHASES = new Set([\n \"setup function\",\n \"render function\",\n \"component update\",\n \"serverPrefetch hook\",\n \"beforeCreate hook\",\n \"created hook\",\n \"beforeMount hook\",\n \"mounted hook\",\n \"beforeUpdate hook\",\n \"updated\",\n \"beforeUnmount hook\",\n \"unmounted hook\",\n \"activated hook\",\n \"deactivated hook\",\n]);\n\n/** Reports an error the board survives the way an uncaught throw is\n * reported: the page's `error` event, which the canvas's runtime problem\n * tracker records. */\nfunction reportUncaught(error: unknown) {\n if (typeof globalThis.reportError === \"function\")\n globalThis.reportError(error);\n else console.error(error);\n}\n\n/** Suspense resource for the optional Vue runtime. The storyboard must not\n * report its React shell as rendered before the authored Vue DOM exists,\n * otherwise the component projection opens with a permanent DOM-only\n * baseline. */\nfunction readVueRuntime(): VueRuntime {\n if (vueRuntimeState?.kind === \"ready\") return vueRuntimeState.runtime;\n if (vueRuntimeState?.kind === \"error\") throw vueRuntimeState.error;\n if (!vueRuntimeState) {\n const promise = import(\"vue\").then(\n (runtime) => {\n vueRuntimeState = { kind: \"ready\", runtime };\n },\n (error: unknown) => {\n vueRuntimeState = { kind: \"error\", error };\n },\n );\n vueRuntimeState = { kind: \"pending\", promise };\n }\n throw vueRuntimeState.promise;\n}\n\nexport function VueStoryboard<\n Props extends Record<string, unknown> = Record<string, unknown>,\n>({\n id,\n name,\n component,\n layout,\n props,\n vrt,\n setup,\n}: {\n id: string;\n component: VueComponent<Props>;\n layout: StoryboardLayout;\n name?: string;\n props?: Props;\n vrt?: boolean | StoryboardVrtConfig;\n /** Runs on the storyboard's app before it mounts, after the document's\n * environment, for plugins such as pinia, vue-router or vue-i18n. */\n setup?: VueStoryboardSetup;\n} & Record<`data-tempo-${string}`, unknown>) {\n const renderId = useCanvasStoryboardRenderId(id);\n // The board's slot (with the Suspense boundary inside it) stays mounted\n // while the Vue mount below suspends on setup. A board removed in that\n // window never commits its mount, so no effect of the mount's own would\n // release the app it prepared; the board does, as it goes.\n useLayoutEffect(() => () => releaseUnmountedApp(renderId), [renderId]);\n return (\n <StoryboardSlot\n data-tempo-hide-fiber=\"true\"\n id={id}\n name={name}\n layout={layout}\n kind=\"component\"\n uiFramework=\"vue\"\n vrt={!!vrt}\n >\n <VueComponentMount\n storyboardId={id}\n component={component}\n props={props}\n setup={setup}\n />\n </StoryboardSlot>\n );\n}\n\n/** A storyboard's app between creation and unmount. It lives outside React\n * state: a component that suspends on its first render loses its hook\n * state, so an app held in `useState` would be created again on every\n * retry (measured: 15,820 Nuxt apps in a loop). Keyed by the slot's render\n * id, the same key the slot reports as `data-tempo-storyboard-render-id`. */\ninterface PreparedApp {\n app: VueApp;\n context: VueStoryboardContext;\n /** The environment the app was prepared with, which releases it. */\n environment: VueStoryboardEnvironment | null;\n component: VueComponent<Record<string, unknown>>;\n propsRef: import(\"vue\").ShallowRef<Record<string, unknown>>;\n /** Open while the environment's or the storyboard's setup is still\n * running, until the deadline at most; the mount suspends on it. `null`\n * once settled. */\n pending: Promise<void> | null;\n /** Which setup is running, for the deadline's error. */\n setupPhase: \"environment\" | \"storyboard\";\n /** What setup threw or rejected with. Once thrown to React, the entry is\n * released at the end of the task so the storyboard's retry prepares a\n * fresh app. */\n setupError: { error: unknown; released?: boolean } | null;\n /** Routes a render-phase error from Vue's error handler to the mounted\n * React component. Installed by the mount effect, cleared on cleanup. */\n onRenderError: ((error: unknown) => void) | null;\n /** Set once the mount effect takes the app: its cleanup then unmounts and\n * releases it. An app no mount effect took is released where it is\n * dropped. */\n ownedByMountEffect: boolean;\n released: boolean;\n /** Clears the setup deadline, if one is running. */\n stopSetupDeadline: (() => void) | null;\n}\n\nconst prepared = new Map<string, PreparedApp>();\n\n/** Whether two component objects are the same SFC. An HMR update of a\n * component makes Vite serve its importers again, so a canvas file that\n * React Fast Refresh re-evaluates next passes a new object for an SFC that\n * did not change. Vue's HMR runtime has already updated the mounted app in\n * place, keyed by `__hmrId`; a fresh app would only re-run the environment's\n * async setup and leave the board empty meanwhile (the Nuxt sidecar's\n * CardSlots board went empty for 300 ms after every write to AppCard.vue).\n * Production builds carry no `__hmrId`, so identity decides there. */\nfunction sameComponent(\n current: VueComponent<Record<string, unknown>>,\n next: VueComponent<Record<string, unknown>>,\n): boolean {\n if (current === next) return true;\n const hmrId = (component: unknown) =>\n (component as { __hmrId?: string }).__hmrId;\n return hmrId(current) !== undefined && hmrId(current) === hmrId(next);\n}\n\nfunction isThenable(value: unknown): value is PromiseLike<void> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\n/** Runs the environment's setup and then the storyboard's on the app.\n * Returns `null` when both finished synchronously, so a board without an\n * async step mounts in the same commit it always did, with no Suspense\n * round trip in between. A synchronous throw propagates. */\nfunction runSetups(\n entry: PreparedApp,\n setup: VueStoryboardSetup | undefined,\n): Promise<void> | null {\n const { app, context } = entry;\n const environmentResult = entry.environment?.setup(app, context);\n if (isThenable(environmentResult)) {\n return Promise.resolve(environmentResult).then(() => {\n // The board can disappear or replace its component while its\n // environment is pending. Its released app must acquire no new work.\n if (entry.released) return;\n entry.setupPhase = \"storyboard\";\n return setup?.(app);\n });\n }\n entry.setupPhase = \"storyboard\";\n const setupResult = setup?.(app);\n return isThenable(setupResult) ? Promise.resolve(setupResult) : null;\n}\n\n/** What the mount suspends on: it resolves when setup settles, or at the\n * deadline with an error naming what is still running. The verdict lands on\n * the entry; a setup that settles after the deadline changes nothing (its\n * app is released with the board's error). */\nfunction settleWithinDeadline(\n entry: PreparedApp,\n setup: Promise<void>,\n): Promise<void> {\n return new Promise<void>((resolve) => {\n let settled = false;\n const finish = (setupError: { error: unknown } | null) => {\n if (settled) return;\n settled = true;\n clearTimeout(deadline);\n entry.pending = null;\n if (setupError) entry.setupError = setupError;\n resolve();\n };\n const deadline = setTimeout(\n () => finish({ error: setupTimeoutError(entry) }),\n VUE_STORYBOARD_SETUP_TIMEOUT_MS,\n );\n entry.stopSetupDeadline = () => clearTimeout(deadline);\n setup.then(\n () => finish(null),\n (error: unknown) => finish({ error }),\n );\n });\n}\n\nfunction setupTimeoutError(entry: PreparedApp): Error {\n const seconds = VUE_STORYBOARD_SETUP_TIMEOUT_MS / 1000;\n const environmentPending =\n entry.environment?.describePendingSetup?.(entry.app, entry.context) ??\n \"the canvas host's setup for it is still running\";\n const pending =\n entry.setupPhase === \"storyboard\"\n ? \"its own setup is still running\"\n : environmentPending;\n return new Error(\n `Vue storyboard \"${entry.context.storyboardId}\" did not finish setting up within ${seconds}s: ${pending}.`,\n );\n}\n\n/** Lets the environment release what it bound outside the app, once. The\n * Vue app itself is unmounted by then, or never mounted. */\nfunction releasePreparedApp(entry: PreparedApp): void {\n if (entry.released) return;\n entry.released = true;\n entry.stopSetupDeadline?.();\n try {\n entry.environment?.teardown?.(entry.app, entry.context);\n } catch (error) {\n reportUncaught(error);\n }\n}\n\nfunction prepareApp(\n renderId: string,\n storyboardId: string,\n runtime: VueRuntime,\n component: VueComponent<Record<string, unknown>>,\n props: Record<string, unknown>,\n setup: VueStoryboardSetup | undefined,\n): PreparedApp {\n const existing = prepared.get(renderId);\n if (existing && sameComponent(existing.component, component)) return existing;\n // A replaced component's app is unmounted and released by the mount\n // effect's cleanup, which still holds the old entry; one that never\n // mounted (still suspended on its setup) is released here.\n if (existing && !existing.ownedByMountEffect) releasePreparedApp(existing);\n const propsRef = runtime.shallowRef(props);\n // The wrapper root gives the user's component a parent, so Vue's HMR\n // `reload` re-renders it through that parent; a parentless root would\n // fall back to reloading the whole canvas document. Its Suspense is what\n // lets an async component (`await useFetch(...)` in `<script setup>`)\n // render at all: Vue refuses one without a Suspense ancestor.\n const app = runtime.createApp({\n render: () =>\n runtime.h(runtime.Suspense, null, {\n default: () => runtime.h(component, propsRef.value),\n }),\n });\n const entry: PreparedApp = {\n app,\n context: { storyboardId, renderId },\n environment,\n component,\n propsRef,\n pending: null,\n setupPhase: \"environment\",\n setupError: null,\n onRenderError: null,\n ownedByMountEffect: false,\n released: false,\n stopSetupDeadline: null,\n };\n app.config.errorHandler = (error, _instance, info) => {\n if (!RENDER_PHASES.has(info)) {\n reportUncaught(error);\n return;\n }\n if (entry.onRenderError) entry.onRenderError(error);\n else entry.setupError = { error };\n };\n prepared.set(renderId, entry);\n try {\n const pending = runSetups(entry, setup);\n if (pending) entry.pending = settleWithinDeadline(entry, pending);\n } catch (error) {\n entry.setupError = { error };\n }\n return entry;\n}\n\n/** Releases the board's app if no mount effect took it: the board went away\n * while the app was still suspended on its setup. A mounted app is released\n * by its own mount effect's cleanup. */\nfunction releaseUnmountedApp(renderId: string): void {\n const entry = prepared.get(renderId);\n if (!entry || entry.ownedByMountEffect) return;\n prepared.delete(renderId);\n releasePreparedApp(entry);\n}\n\nfunction VueComponentMount<Props extends Record<string, unknown>>({\n storyboardId,\n component,\n props,\n setup,\n}: {\n storyboardId: string;\n component: VueComponent<Props>;\n props?: Props;\n setup?: VueStoryboardSetup;\n}) {\n const renderId = useCanvasStoryboardRenderId(storyboardId);\n const targetRef = useRef<HTMLDivElement | null>(null);\n const [mountError, setMountError] = useState<unknown>(null);\n if (mountError) throw mountError;\n const runtime = readVueRuntime();\n const entry = prepareApp(\n renderId,\n storyboardId,\n runtime,\n component as VueComponent<Record<string, unknown>>,\n props ?? {},\n setup,\n );\n // Suspend until setup settles: the React shell must not commit before the\n // Vue DOM can exist (see readVueRuntime). The prepared app outlives this\n // suspended render, so the retry picks it up instead of starting over.\n if (entry.pending) throw entry.pending;\n if (entry.setupError) {\n // The storyboard's error UI takes over. React re-renders synchronously\n // once after a thrown error, so the verdict is held for the rest of this\n // task (discarding the entry at once would start a fresh setup inside\n // that re-render and never reach the boundary). The storyboard's retry\n // comes a task later and must prepare a fresh app rather than rethrow.\n if (!entry.setupError.released) {\n entry.setupError.released = true;\n setTimeout(() => {\n if (prepared.get(renderId) === entry) prepared.delete(renderId);\n releasePreparedApp(entry);\n }, 0);\n }\n throw entry.setupError.error;\n }\n\n // Before the mount effect, so a (re)mount reads the latest props. One\n // reactive props holder for the app's lifetime: a props change re-renders\n // the mounted app in place instead of remounting it. `setup` ran when the\n // app was prepared; canvas files pass an inline function whose identity\n // changes on every render, never a reason to remount.\n useLayoutEffect(() => {\n const next = props ?? {};\n if (!shallowEqual(entry.propsRef.value, next)) entry.propsRef.value = next;\n }, [props, entry]);\n\n useLayoutEffect(() => {\n const target = targetRef.current;\n if (!target) return;\n entry.onRenderError = setMountError;\n entry.ownedByMountEffect = true;\n let mounted = false;\n try {\n entry.app.mount(target);\n mounted = true;\n } catch (error) {\n setMountError(error);\n }\n\n return () => {\n entry.onRenderError = null;\n if (mounted) entry.app.unmount();\n target.replaceChildren();\n if (prepared.get(renderId) === entry) prepared.delete(renderId);\n releasePreparedApp(entry);\n };\n }, [entry, renderId]);\n\n return <div ref={targetRef} data-tempo-hide-fiber=\"true\" />;\n}\n\nfunction shallowEqual(\n a: Record<string, unknown>,\n b: Record<string, unknown>,\n): boolean {\n const aKeys = Object.keys(a);\n const bKeys = new Set(Object.keys(b));\n if (aKeys.length !== bKeys.size) return false;\n return aKeys.every((key) => bKeys.has(key) && Object.is(a[key], b[key]));\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,iBAAiB,QAAQ,gBAAgB;AA0L5C;AA7HN,IAAI,cAA+C;AAY5C,IAAM,kCAAkC;AAOxC,SAAS,wBACd,MACM;AACN,gBAAc;AAChB;AAQA,IAAI,kBAA0C;AAU9C,IAAM,gBAAgB,oBAAI,IAAI;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAKD,SAAS,eAAe,OAAgB;AACtC,MAAI,OAAO,WAAW,gBAAgB;AACpC,eAAW,YAAY,KAAK;AAAA,MACzB,SAAQ,MAAM,KAAK;AAC1B;AAMA,SAAS,iBAA6B;AACpC,MAAI,iBAAiB,SAAS,QAAS,QAAO,gBAAgB;AAC9D,MAAI,iBAAiB,SAAS,QAAS,OAAM,gBAAgB;AAC7D,MAAI,CAAC,iBAAiB;AACpB,UAAM,UAAU,OAAO,KAAK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AC,SAAI,KAAK,WAAW,yBAAsB,QAAO;AAC3D;AAEA,SAAS,aACP,GACA,GACS;AACT,QAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,QAAM,QAAQ,IAAI,IAAI,OAAO,KAAK,CAAC,CAAC;AACpC,MAAI,MAAM,WAAW,MAAM,KAAM,QAAO;AACxC,SAAO,MAAM,MAAM,CAAC,QAAQ,MAAM,IAAI,GAAG,KAAK,OAAO,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;AACzE;","names":[]}
@@ -1,455 +0,0 @@
1
- // nextjs.ts
2
- import { existsSync, realpathSync } from "fs";
3
- import { createRequire } from "module";
4
- import { dirname, resolve as resolve2 } from "path";
5
-
6
- // host-identity.ts
7
- import { readFileSync } from "fs";
8
- import { resolve } from "path";
9
-
10
- // package.json
11
- var package_default = {
12
- name: "tempo-sdk",
13
- version: "0.0.99",
14
- publishConfig: {
15
- tag: "sdk-v2-latest"
16
- },
17
- type: "module",
18
- description: "Tempo SDK \u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types",
19
- repository: {
20
- type: "git",
21
- url: "git+https://github.com/TempoLabsAI/tempo-monorepo.git",
22
- directory: "tempo-modules/tempo-sdk"
23
- },
24
- exports: {
25
- "./astro/controls": {
26
- types: "./dist/astro/controls.d.ts",
27
- import: "./dist/astro/controls.js",
28
- default: "./dist/astro/controls.js"
29
- },
30
- "./astro": {
31
- types: "./dist/astro.d.ts",
32
- import: "./dist/astro.js"
33
- },
34
- "./astro/client": {
35
- types: "./astro/client.d.ts"
36
- },
37
- "./canvas/astro": {
38
- types: "./dist/canvas/astro.d.ts",
39
- import: "./dist/canvas/astro.js"
40
- },
41
- "./canvas/astro-contract": {
42
- types: "./dist/canvas/astro-contract.d.ts",
43
- import: "./dist/canvas/astro-contract.js"
44
- },
45
- ".": {
46
- types: "./dist/index.d.ts",
47
- import: "./dist/index.js"
48
- },
49
- "./canvas": {
50
- types: "./dist/canvas/index.d.ts",
51
- import: "./dist/canvas/index.js"
52
- },
53
- "./canvas/svelte": {
54
- types: "./dist/canvas/svelte.d.ts",
55
- import: "./dist/canvas/svelte.js"
56
- },
57
- "./canvas/vue": {
58
- types: "./dist/canvas/vue.d.ts",
59
- import: "./dist/canvas/vue.js"
60
- },
61
- "./canvas/interact-projection": {
62
- types: "./dist/canvas/interact-projection.d.ts",
63
- import: "./dist/canvas/interact-projection.js"
64
- },
65
- "./canvas/parser": {
66
- types: "./dist/canvas/parser.d.ts",
67
- import: "./dist/canvas/parser.js"
68
- },
69
- "./canvas/editor": {
70
- types: "./dist/canvas/editor.d.ts",
71
- import: "./dist/canvas/editor.js"
72
- },
73
- "./assets": {
74
- types: "./dist/assets/index.d.ts",
75
- import: "./dist/assets/index.js"
76
- },
77
- "./assets/parser": {
78
- types: "./dist/assets/parser.d.ts",
79
- import: "./dist/assets/parser.js"
80
- },
81
- "./assets/editor": {
82
- types: "./dist/assets/editor.d.ts",
83
- import: "./dist/assets/editor.js"
84
- },
85
- "./nextjs": {
86
- types: "./dist/nextjs.d.ts",
87
- import: "./dist/nextjs.js",
88
- require: "./dist/nextjs.cjs"
89
- },
90
- "./nextjs/plugin": {
91
- types: "./dist/nextjs/plugin.d.ts",
92
- import: "./dist/nextjs/plugin.js"
93
- },
94
- "./nuxt": {
95
- types: "./dist/nuxt.d.ts",
96
- import: "./dist/nuxt.js"
97
- },
98
- "./expo": {
99
- types: "./dist/expo-babel-plugin.d.ts",
100
- import: "./dist/expo-babel-plugin.js",
101
- require: "./dist/expo-babel-plugin.cjs"
102
- },
103
- "./expo/plugin": {
104
- types: "./dist/expo/plugin.d.ts",
105
- import: "./dist/expo/plugin.js",
106
- require: "./dist/expo/plugin.cjs"
107
- },
108
- "./svelte": {
109
- types: "./dist/svelte.d.ts",
110
- import: "./dist/svelte.js"
111
- },
112
- "./vue": {
113
- types: "./dist/vue.d.ts",
114
- import: "./dist/vue.js"
115
- },
116
- "./astro/asset-preview-client": {
117
- types: "./dist/astro/asset-preview-client.d.ts",
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"
127
- }
128
- },
129
- files: [
130
- "dist",
131
- "astro/client.d.ts"
132
- ],
133
- scripts: {
134
- clean: "rm -rf dist",
135
- build: "pnpm run clean && tsup",
136
- "build:if-missing": "test -f dist/index.js || pnpm run build",
137
- prepare: "pnpm run build",
138
- prepublishOnly: "pnpm build",
139
- demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
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",
142
- test: "vitest run",
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",
144
- "test:watch": "vitest",
145
- "test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
146
- "test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
147
- "test:nextjs:production": "vitest run nextjs-production.test.ts",
148
- "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"
149
- },
150
- dependencies: {
151
- "@rollup/pluginutils": "^5.1.0",
152
- "oxc-parser": "^0.110.0"
153
- },
154
- optionalDependencies: {
155
- "@astrojs/compiler-rs": "0.5.1"
156
- },
157
- peerDependencies: {
158
- astro: "^7.0.0",
159
- "@babel/core": "^7.0.0",
160
- h3: "^1.12.0",
161
- next: "^13 || ^14 || ^15 || ^16",
162
- nuxt: "^3.18.0 || ^4.0.0",
163
- react: "^18 || ^19",
164
- svelte: "^5.0.0",
165
- vite: "^5 || ^6 || ^7 || ^8",
166
- vue: "^3.3.0"
167
- },
168
- peerDependenciesMeta: {
169
- astro: {
170
- optional: true
171
- },
172
- react: {
173
- optional: true
174
- },
175
- "@babel/core": {
176
- optional: true
177
- },
178
- h3: {
179
- optional: true
180
- },
181
- next: {
182
- optional: true
183
- },
184
- nuxt: {
185
- optional: true
186
- },
187
- svelte: {
188
- optional: true
189
- },
190
- vite: {
191
- optional: true
192
- },
193
- vue: {
194
- optional: true
195
- }
196
- },
197
- devDependencies: {
198
- "@astrojs/react": "7.0.1",
199
- "@babel/core": "^7.29.0",
200
- "@babel/types": "^7.29.0",
201
- "@modules/annotation": "workspace:*",
202
- "@modules/astro-editor": "workspace:*",
203
- "@modules/file-parser": "workspace:*",
204
- "@modules/frame-pool": "workspace:*",
205
- "@modules/iframe-projection": "workspace:*",
206
- "@modules/svelte-editor": "workspace:*",
207
- "@modules/vue-editor": "workspace:*",
208
- "@nuxt/kit": "^4.6.2",
209
- "@types/babel__core": "^7.20.5",
210
- "@types/node": "^25.0.8",
211
- "@types/react": "catalog:",
212
- "@types/react-dom": "catalog:",
213
- "@vitejs/plugin-react": "catalog:",
214
- "@vitejs/plugin-vue": "6.0.10",
215
- astro: "7.3.8",
216
- h3: "^1.15.11",
217
- "magic-string": "^0.30.21",
218
- nuxt: "^4.6.2",
219
- playwright: "^1.58.2",
220
- "react-dom": "catalog:",
221
- "react-dom18": "npm:react-dom@18.3.1",
222
- react18: "npm:react@18.3.1",
223
- svelte: "5.56.9",
224
- tsup: "^8.5.1",
225
- typescript: "catalog:",
226
- vite: "catalog:",
227
- vitest: "catalog:",
228
- vue: "3.5.44"
229
- }
230
- };
231
-
232
- // release-channel.ts
233
- var TEMPO_SDK_CHANNEL = package_default.publishConfig.tag;
234
- function sdkChannelGeneration(channel) {
235
- if (typeof channel !== "string") return null;
236
- const match = /^sdk-v([1-9]\d*)-latest$/.exec(channel);
237
- return match ? Number(match[1]) : null;
238
- }
239
- if (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {
240
- throw new Error("tempo-sdk publishConfig.tag must be sdk-v<N>-latest");
241
- }
242
-
243
- // host-identity.ts
244
- var TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;
245
- var TEMPO_WORKSPACE_NONCE_ENV = "TEMPO_WORKSPACE_NONCE";
246
- var WORKSPACE_NONCE_RELATIVE_PATH = ".tempo/workspace-nonce";
247
- var MAX_WORKSPACE_NONCE_LENGTH = 128;
248
- function normalizeWorkspaceNonce(value) {
249
- const nonce = value?.trim() ?? "";
250
- return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH ? nonce : "";
251
- }
252
- function readTempoWorkspaceNonce(root = process.cwd()) {
253
- const fromEnvironment = normalizeWorkspaceNonce(
254
- process.env[TEMPO_WORKSPACE_NONCE_ENV]
255
- );
256
- if (fromEnvironment) return fromEnvironment;
257
- try {
258
- return normalizeWorkspaceNonce(
259
- readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), "utf-8")
260
- );
261
- } catch {
262
- return "";
263
- }
264
- }
265
- function createTempoHostIdentity(framework, options = {}) {
266
- return {
267
- tempoHost: true,
268
- contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,
269
- workspaceNonce: readTempoWorkspaceNonce(options.root),
270
- sdkVersion: package_default.version,
271
- sdkChannel: TEMPO_SDK_CHANNEL,
272
- pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),
273
- framework,
274
- ...options.capabilities ? { capabilities: options.capabilities } : {}
275
- };
276
- }
277
-
278
- // nextjs.ts
279
- var TURBOPACK_RULE_KEY = "*.{tsx,jsx}";
280
- var requireFromHere = createRequire(
281
- typeof import.meta.url === "string" && import.meta.url.length > 0 ? import.meta.url : __filename
282
- );
283
- function resolveLoaderPath() {
284
- for (const candidate of ["./nextjs-loader.cjs", "./dist/nextjs-loader.cjs"]) {
285
- try {
286
- return requireFromHere.resolve(candidate);
287
- } catch {
288
- }
289
- }
290
- throw new Error(
291
- "tempo-sdk/nextjs: could not resolve nextjs-loader.cjs. Run `pnpm build` in the tempo-sdk package to produce the dist/ output."
292
- );
293
- }
294
- function detectNextVersion() {
295
- try {
296
- const pkg = requireFromHere("next/package.json");
297
- const m = /^(\d+)\.(\d+)/.exec(pkg.version);
298
- if (!m) return null;
299
- return { major: Number(m[1]), minor: Number(m[2]) };
300
- } catch {
301
- return null;
302
- }
303
- }
304
- function useExperimentalTurbo(version) {
305
- if (!version) return false;
306
- if (version.major < 15) return true;
307
- if (version.major === 15 && version.minor < 3) return true;
308
- return false;
309
- }
310
- function shouldOmitTurbopack(version) {
311
- if (!version) return false;
312
- return version.major < 13;
313
- }
314
- function buildTurbopackRule(loaderPath, options) {
315
- const loaderOptions = {};
316
- if (options.computeAnnotatedPropsModule !== void 0) {
317
- loaderOptions.computeAnnotatedPropsModule = options.computeAnnotatedPropsModule;
318
- }
319
- if (options.autoInjectRootMeta !== void 0) {
320
- loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;
321
- }
322
- const condition = options.productionBuild ? { not: "foreign" } : { all: [{ not: "foreign" }, "development"] };
323
- return {
324
- condition,
325
- loaders: [{ loader: loaderPath, options: loaderOptions }]
326
- };
327
- }
328
- function mergeTurbopackRules(existing, newRule) {
329
- const existingRule = existing?.rules?.[TURBOPACK_RULE_KEY];
330
- let mergedRule;
331
- if (!existingRule) {
332
- mergedRule = newRule;
333
- } else if (Array.isArray(existingRule)) {
334
- mergedRule = [...existingRule, newRule];
335
- } else {
336
- mergedRule = [existingRule, newRule];
337
- }
338
- return {
339
- ...existing,
340
- rules: {
341
- ...existing?.rules,
342
- [TURBOPACK_RULE_KEY]: mergedRule
343
- }
344
- };
345
- }
346
- function buildWebpackHook(loaderPath, options, userWebpack) {
347
- const loaderOptions = {};
348
- if (options.computeAnnotatedPropsModule !== void 0) {
349
- loaderOptions.computeAnnotatedPropsModule = options.computeAnnotatedPropsModule;
350
- }
351
- if (options.autoInjectRootMeta !== void 0) {
352
- loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;
353
- }
354
- const allowProduction = options.productionBuild === true;
355
- return (configIn, context) => {
356
- var _a;
357
- const config = configIn;
358
- const ctx = context;
359
- if (ctx.dev || allowProduction) {
360
- config.module ?? (config.module = {});
361
- (_a = config.module).rules ?? (_a.rules = []);
362
- config.module.rules.push({
363
- test: /\.(tsx|jsx)$/,
364
- exclude: /node_modules/,
365
- enforce: "pre",
366
- use: [{ loader: loaderPath, options: loaderOptions }]
367
- });
368
- }
369
- if (typeof userWebpack === "function") {
370
- return userWebpack(config, context);
371
- }
372
- return config;
373
- };
374
- }
375
- var cachedTempoProjectRoot = null;
376
- function tempoProjectRoot() {
377
- if (cachedTempoProjectRoot !== null) return cachedTempoProjectRoot;
378
- let dir = process.cwd();
379
- while (true) {
380
- if (existsSync(resolve2(dir, "package.json"))) break;
381
- const parent = dirname(dir);
382
- if (parent === dir) break;
383
- dir = parent;
384
- }
385
- let canonical = dir;
386
- try {
387
- canonical = realpathSync.native(dir);
388
- } catch {
389
- }
390
- cachedTempoProjectRoot = canonical;
391
- return canonical;
392
- }
393
- function tempoHostIdentity() {
394
- return createTempoHostIdentity("nextjs");
395
- }
396
- function _resetTempoProjectRoot() {
397
- cachedTempoProjectRoot = null;
398
- }
399
- function tempoNextjsPlugin(pluginOptions = {}) {
400
- return (inputConfigArg) => {
401
- const inputConfig = inputConfigArg ?? {};
402
- if (!process.env.TEMPO) return inputConfig;
403
- const loaderPath = _internal.resolveLoaderPath();
404
- const version = _internal.detectNextVersion();
405
- const omitTurbopack = _internal.shouldOmitTurbopack(version);
406
- const useExperimental = _internal.useExperimentalTurbo(version);
407
- const newRule = buildTurbopackRule(loaderPath, pluginOptions);
408
- const existingTurbo = useExperimental ? inputConfig.experimental?.turbo : inputConfig.turbopack;
409
- const mergedTurbo = mergeTurbopackRules(existingTurbo, newRule);
410
- const webpackHook = buildWebpackHook(
411
- loaderPath,
412
- pluginOptions,
413
- inputConfig.webpack ?? null
414
- );
415
- const next = {
416
- ...inputConfig,
417
- webpack: webpackHook
418
- };
419
- const distDirOverride = process.env.TEMPO_NEXT_DIST_DIR;
420
- if (distDirOverride) {
421
- next.distDir = distDirOverride;
422
- }
423
- if (!omitTurbopack) {
424
- if (useExperimental) {
425
- next.experimental = {
426
- ...inputConfig.experimental,
427
- turbo: mergedTurbo
428
- };
429
- } else {
430
- next.turbopack = mergedTurbo;
431
- }
432
- }
433
- return next;
434
- };
435
- }
436
- var nextjs_default = tempoNextjsPlugin;
437
- var _internal = {
438
- buildTurbopackRule,
439
- mergeTurbopackRules,
440
- buildWebpackHook,
441
- detectNextVersion,
442
- useExperimentalTurbo,
443
- shouldOmitTurbopack,
444
- resolveLoaderPath
445
- };
446
-
447
- export {
448
- tempoProjectRoot,
449
- tempoHostIdentity,
450
- _resetTempoProjectRoot,
451
- tempoNextjsPlugin,
452
- nextjs_default,
453
- _internal
454
- };
455
- //# sourceMappingURL=chunk-27WT3XUG.js.map
@@ -1 +0,0 @@
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.99\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n"],"mappings":";AAiBA,SAAS,YAAY,oBAAoB;AACzC,SAAS,qBA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