tempo-sdk 0.0.76 → 0.0.79
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.
- package/dist/assets/index.js +3 -3
- package/dist/astro/asset-preview-client.js +3 -3
- package/dist/astro.js +2 -2
- package/dist/canvas/astro.js +3 -3
- package/dist/canvas/index.js +5 -5
- package/dist/canvas/interact-projection.js +4 -4
- package/dist/canvas/svelte.js +3 -3
- package/dist/canvas/vue.js +3 -3
- package/dist/{chunk-R3RYGAPB.js → chunk-4PGZTWKS.js} +2 -2
- package/dist/{chunk-GCGRJTTS.js → chunk-54P7S7VU.js} +2 -2
- package/dist/{chunk-GCGRJTTS.js.map → chunk-54P7S7VU.js.map} +1 -1
- package/dist/{chunk-6AAE4LYV.js → chunk-5M45Z7K6.js} +20 -5
- package/dist/{chunk-6AAE4LYV.js.map → chunk-5M45Z7K6.js.map} +1 -1
- package/dist/{chunk-5LUQSXSP.js → chunk-BHDCNLCO.js} +2 -2
- package/dist/{chunk-5LUQSXSP.js.map → chunk-BHDCNLCO.js.map} +1 -1
- package/dist/{chunk-YECMP34I.js → chunk-D3WLLHZU.js} +2 -2
- package/dist/{chunk-CXIW4IKC.js → chunk-I5MJ342V.js} +3 -3
- package/dist/{chunk-3W4CVWTK.js → chunk-JMG5IDS5.js} +2 -2
- package/dist/{chunk-3W4CVWTK.js.map → chunk-JMG5IDS5.js.map} +1 -1
- package/dist/{chunk-ZXC7SZIT.js → chunk-QJA366VX.js} +23 -10
- package/dist/chunk-QJA366VX.js.map +1 -0
- package/dist/{chunk-GKDDNDG3.js → chunk-TFPT6T3K.js} +881 -15
- package/dist/chunk-TFPT6T3K.js.map +1 -0
- package/dist/{chunk-WBMO4ZYO.js → chunk-XN2K7GED.js} +288 -129
- package/dist/chunk-XN2K7GED.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/nextjs/plugin.cjs +1 -1
- package/dist/nextjs/plugin.cjs.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs-loader.cjs +1 -1
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +1 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/nuxt/runtime/identity.js +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/vue.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GKDDNDG3.js.map +0 -1
- package/dist/chunk-WBMO4ZYO.js.map +0 -1
- package/dist/chunk-ZXC7SZIT.js.map +0 -1
- /package/dist/{chunk-R3RYGAPB.js.map → chunk-4PGZTWKS.js.map} +0 -0
- /package/dist/{chunk-YECMP34I.js.map → chunk-D3WLLHZU.js.map} +0 -0
- /package/dist/{chunk-CXIW4IKC.js.map → chunk-I5MJ342V.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts","../sdk-package-files.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport { TEMPO_SDK_CHANNEL } from \"./release-channel\";\n\nimport sdkPackage from \"./package.json\" with { type: \"json\" };\n\nexport const TEMPO_HOST_IDENTITY_ENDPOINT = \"/__tempo/identity\";\nexport const TEMPO_HOST_IDENTITY_CAPABILITY_HEADER = \"x-tempo-host-identity\";\nexport const TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;\nexport const TEMPO_WORKSPACE_NONCE_ENV = \"TEMPO_WORKSPACE_NONCE\";\nexport const TEMPO_WORKSPACE_NONCE_META_NAME = \"tempo-workspace-nonce\";\n\nconst WORKSPACE_NONCE_RELATIVE_PATH = \".tempo/workspace-nonce\";\nconst MAX_WORKSPACE_NONCE_LENGTH = 128;\n\nexport type TempoHostFramework = \"vite\" | \"nextjs\" | \"nuxt\" | \"astro\";\n\n/**\n * The name of `tempoVuePlugin()`'s annotating plugin. A Vite server that runs\n * it reports the `vueSourceAnnotation` capability, which is what proves an\n * app's Vue templates are stamped: `pluginActive` only proves\n * `tempoVitePlugin()`, and a Vue app with that alone serves route documents\n * whose layers carry no `.vue` source.\n */\nexport const TEMPO_VUE_ANNOTATION_PLUGIN_NAME = \"tempo-vue-source-annotation\";\n\n/** Optional features a host's served identity vouches for. */\nexport interface TempoHostIdentityCapabilities {\n /** 1 when the server renders Astro components for the canvas. */\n astroComponents?: number;\n /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */\n vueSourceAnnotation?: number;\n}\n\nexport interface TempoHostIdentity<\n Framework extends TempoHostFramework = TempoHostFramework,\n> {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n sdkChannel: string;\n pluginActive: boolean;\n framework: Framework;\n capabilities?: TempoHostIdentityCapabilities;\n}\n\nfunction normalizeWorkspaceNonce(value: string | undefined): string {\n const nonce = value?.trim() ?? \"\";\n return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH\n ? nonce\n : \"\";\n}\n\nexport function readTempoWorkspaceNonce(root = process.cwd()): string {\n const fromEnvironment = normalizeWorkspaceNonce(\n process.env[TEMPO_WORKSPACE_NONCE_ENV],\n );\n if (fromEnvironment) return fromEnvironment;\n try {\n return normalizeWorkspaceNonce(\n readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), \"utf-8\"),\n );\n } catch {\n return \"\";\n }\n}\n\nexport function createTempoHostIdentity<Framework extends TempoHostFramework>(\n framework: Framework,\n options: {\n root?: string;\n pluginActive?: boolean;\n capabilities?: TempoHostIdentityCapabilities;\n } = {},\n): TempoHostIdentity<Framework> {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n sdkChannel: TEMPO_SDK_CHANNEL,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.76\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\n/** This package's published name, as declared in its package.json. */\nexport const SDK_PACKAGE_NAME = \"tempo-sdk\";\n\nconst SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;\n\n/**\n * A predicate for \"this file belongs to tempo-sdk itself\". The SDK's own\n * components (storyboard shells, error boundaries, admission gates) are\n * canvas plumbing, never authored UI, so no annotation entry point may stamp\n * source locations on them — the canvas treats every stamped element as user\n * code.\n *\n * A project can reach SDK files under many spellings: a published copy in\n * node_modules, a pnpm store path, a workspace link, a symlink, or a source\n * alias into a checkout. Ownership is therefore decided by where the file\n * really lives — the nearest package.json above its real path declares this\n * package — and not by the id's spelling or the caller's include/exclude\n * patterns. A package nested inside the SDK checkout (the demo apps) has its\n * own package.json and stays annotatable.\n */\nexport function createSdkFileMatcher(): (file: string) => boolean {\n // Directory → whether its nearest enclosing package.json is this package.\n const ownerIsSdkByDirectory = new Map<string, boolean>();\n\n const nearestPackageIsSdk = (startDirectory: string): boolean => {\n const visited: string[] = [];\n let directory = startDirectory;\n let isSdk = false;\n while (true) {\n const cached = ownerIsSdkByDirectory.get(directory);\n if (cached !== undefined) {\n isSdk = cached;\n break;\n }\n visited.push(directory);\n const manifest = readPackageManifest(directory);\n if (manifest !== undefined) {\n isSdk = manifest?.name === SDK_PACKAGE_NAME;\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const entry of visited) ownerIsSdkByDirectory.set(entry, isSdk);\n return isSdk;\n };\n\n return (file) => {\n if (file.replace(/\\\\/g, \"/\").includes(SDK_NODE_MODULES_SEGMENT)) {\n return true;\n }\n let realFile = file;\n try {\n realFile = realpathSync.native(file);\n } catch {\n // Virtual or not-yet-written ids keep their authored spelling.\n }\n return nearestPackageIsSdk(dirname(realFile));\n };\n}\n\n/** The package.json in `directory`: `undefined` when there is none, `null`\n * when one exists but cannot be read as a manifest (still a package\n * boundary, just not this package). */\nfunction readPackageManifest(\n directory: string,\n): { name?: unknown } | null | undefined {\n let text: string;\n try {\n text = readFileSync(join(directory, \"package.json\"), \"utf8\");\n } catch {\n return undefined;\n }\n try {\n const manifest: unknown = JSON.parse(text);\n return manifest && typeof manifest === \"object\" ? manifest : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EAEX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EAEf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,oBAAoB;AAAA,MAClB,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,WAAW;AAAA,MACT,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,IACX;AAAA,IACA,kBAAk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AAW,UAAW;AAC1B,kBAAY;AAAA,IACd;AACA,eAAW,SAAS,QAAS,uBAAsB,IAAI,OAAO,KAAK;AACnE,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,SAAS;AACf,QAAI,KAAK,QAAQ,OAAO,GAAG,EAAE,SAAS,wBAAwB,GAAG;AAC/D,aAAO;AAAA,IACT;AACA,QAAI,WAAW;AACf,QAAI;AACF,iBAAW,aAAa,OAAO,IAAI;AAAA,IACrC,QAAQ;AAAA,IAER;AACA,WAAO,oBAAoB,QAAQ,QAAQ,CAAC;AAAA,EAC9C;AACF;AAKA,SAAS,oBACP,WACuC;AACvC,MAAI;AACJ,MAAI;AACF,WAAOA,cAAa,KAAK,WAAW,cAAc,GAAG,MAAM;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,WAAoB,KAAK,MAAM,IAAI;AACzC,WAAO,YAAY,OAAO,aAAa,WAAW,WAAW;AAAA,EAC/D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["readFileSync"]}
|
|
1
|
+
{"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts","../sdk-package-files.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport { TEMPO_SDK_CHANNEL } from \"./release-channel\";\n\nimport sdkPackage from \"./package.json\" with { type: \"json\" };\n\nexport const TEMPO_HOST_IDENTITY_ENDPOINT = \"/__tempo/identity\";\nexport const TEMPO_HOST_IDENTITY_CAPABILITY_HEADER = \"x-tempo-host-identity\";\nexport const TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;\nexport const TEMPO_WORKSPACE_NONCE_ENV = \"TEMPO_WORKSPACE_NONCE\";\nexport const TEMPO_WORKSPACE_NONCE_META_NAME = \"tempo-workspace-nonce\";\n\nconst WORKSPACE_NONCE_RELATIVE_PATH = \".tempo/workspace-nonce\";\nconst MAX_WORKSPACE_NONCE_LENGTH = 128;\n\nexport type TempoHostFramework = \"vite\" | \"nextjs\" | \"nuxt\" | \"astro\";\n\n/**\n * The name of `tempoVuePlugin()`'s annotating plugin. A Vite server that runs\n * it reports the `vueSourceAnnotation` capability, which is what proves an\n * app's Vue templates are stamped: `pluginActive` only proves\n * `tempoVitePlugin()`, and a Vue app with that alone serves route documents\n * whose layers carry no `.vue` source.\n */\nexport const TEMPO_VUE_ANNOTATION_PLUGIN_NAME = \"tempo-vue-source-annotation\";\n\n/** Optional features a host's served identity vouches for. */\nexport interface TempoHostIdentityCapabilities {\n /** 1 when the server renders Astro components for the canvas. */\n astroComponents?: number;\n /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */\n vueSourceAnnotation?: number;\n}\n\nexport interface TempoHostIdentity<\n Framework extends TempoHostFramework = TempoHostFramework,\n> {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n sdkChannel: string;\n pluginActive: boolean;\n framework: Framework;\n capabilities?: TempoHostIdentityCapabilities;\n}\n\nfunction normalizeWorkspaceNonce(value: string | undefined): string {\n const nonce = value?.trim() ?? \"\";\n return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH\n ? nonce\n : \"\";\n}\n\nexport function readTempoWorkspaceNonce(root = process.cwd()): string {\n const fromEnvironment = normalizeWorkspaceNonce(\n process.env[TEMPO_WORKSPACE_NONCE_ENV],\n );\n if (fromEnvironment) return fromEnvironment;\n try {\n return normalizeWorkspaceNonce(\n readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), \"utf-8\"),\n );\n } catch {\n return \"\";\n }\n}\n\nexport function createTempoHostIdentity<Framework extends TempoHostFramework>(\n framework: Framework,\n options: {\n root?: string;\n pluginActive?: boolean;\n capabilities?: TempoHostIdentityCapabilities;\n } = {},\n): TempoHostIdentity<Framework> {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n sdkChannel: TEMPO_SDK_CHANNEL,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.79\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\n/** This package's published name, as declared in its package.json. */\nexport const SDK_PACKAGE_NAME = \"tempo-sdk\";\n\nconst SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;\n\n/**\n * A predicate for \"this file belongs to tempo-sdk itself\". The SDK's own\n * components (storyboard shells, error boundaries, admission gates) are\n * canvas plumbing, never authored UI, so no annotation entry point may stamp\n * source locations on them — the canvas treats every stamped element as user\n * code.\n *\n * A project can reach SDK files under many spellings: a published copy in\n * node_modules, a pnpm store path, a workspace link, a symlink, or a source\n * alias into a checkout. Ownership is therefore decided by where the file\n * really lives — the nearest package.json above its real path declares this\n * package — and not by the id's spelling or the caller's include/exclude\n * patterns. A package nested inside the SDK checkout (the demo apps) has its\n * own package.json and stays annotatable.\n */\nexport function createSdkFileMatcher(): (file: string) => boolean {\n // Directory → whether its nearest enclosing package.json is this package.\n const ownerIsSdkByDirectory = new Map<string, boolean>();\n\n const nearestPackageIsSdk = (startDirectory: string): boolean => {\n const visited: string[] = [];\n let directory = startDirectory;\n let isSdk = false;\n while (true) {\n const cached = ownerIsSdkByDirectory.get(directory);\n if (cached !== undefined) {\n isSdk = cached;\n break;\n }\n visited.push(directory);\n const manifest = readPackageManifest(directory);\n if (manifest !== undefined) {\n isSdk = manifest?.name === SDK_PACKAGE_NAME;\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const entry of visited) ownerIsSdkByDirectory.set(entry, isSdk);\n return isSdk;\n };\n\n return (file) => {\n if (file.replace(/\\\\/g, \"/\").includes(SDK_NODE_MODULES_SEGMENT)) {\n return true;\n }\n let realFile = file;\n try {\n realFile = realpathSync.native(file);\n } catch {\n // Virtual or not-yet-written ids keep their authored spelling.\n }\n return nearestPackageIsSdk(dirname(realFile));\n };\n}\n\n/** The package.json in `directory`: `undefined` when there is none, `null`\n * when one exists but cannot be read as a manifest (still a package\n * boundary, just not this package). */\nfunction readPackageManifest(\n directory: string,\n): { name?: unknown } | null | undefined {\n let text: string;\n try {\n text = readFileSync(join(directory, \"package.json\"), \"utf8\");\n } catch {\n return undefined;\n }\n try {\n const manifest: unknown = JSON.parse(text);\n return manifest && typeof manifest === \"object\" ? manifest : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EAEX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EAEf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,oBAAoB;AAAA,MAClB,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;A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M,WAAW,oBAAoB,SAAS;AAC9C,UAAI,aAAa,QAAW;AAC1B,gBAAQ,UAAU,SAAS;AAC3B;AAAA,MACF;AACA,YAAM,SAAS,QAAQ,SAAS;AAChC,UAAI,WAAW,UAAW;AAC1B,kBAAY;AAAA,IACd;AACA,eAAW,SAAS,QAAS,uBAAsB,IAAI,OAAO,KAAK;AACnE,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,SAAS;AACf,QAAI,KAAK,QAAQ,OAAO,GAAG,EAAE,SAAS,wBAAwB,GAAG;AAC/D,aAAO;AAAA,IACT;AACA,QAAI,WAAW;AACf,QAAI;AACF,iBAAW,aAAa,OAAO,IAAI;AAAA,IACrC,QAAQ;AAAA,IAER;AACA,WAAO,oBAAoB,QAAQ,QAAQ,CAAC;AAAA,EAC9C;AACF;AAKA,SAAS,oBACP,WACuC;AACvC,MAAI;AACJ,MAAI;AACF,WAAOA,cAAa,KAAK,WAAW,cAAc,GAAG,MAAM;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,WAAoB,KAAK,MAAM,IAAI;AACzC,WAAO,YAAY,OAAO,aAAa,WAAW,WAAW;AAAA,EAC/D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["readFileSync"]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
PROJECTION_ROOT_ATTRIBUTE,
|
|
4
4
|
PROJECTION_SCOPE_ROLE,
|
|
5
5
|
PROJECTION_UNAVAILABLE_ATTRIBUTE
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QJA366VX.js";
|
|
7
7
|
|
|
8
8
|
// canvas/ids.ts
|
|
9
9
|
function normalizeId(value, label) {
|
|
@@ -1311,4 +1311,4 @@ export {
|
|
|
1311
1311
|
HtmlStoryboard,
|
|
1312
1312
|
StoryboardSlot
|
|
1313
1313
|
};
|
|
1314
|
-
//# sourceMappingURL=chunk-
|
|
1314
|
+
//# sourceMappingURL=chunk-D3WLLHZU.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
captureHead
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XN2K7GED.js";
|
|
4
4
|
import {
|
|
5
5
|
capture
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5M45Z7K6.js";
|
|
7
7
|
|
|
8
8
|
// assets/preview-snapshot.ts
|
|
9
9
|
function captureAssetPreview(root) {
|
|
@@ -35,4 +35,4 @@ function captureAssetPreview(root) {
|
|
|
35
35
|
export {
|
|
36
36
|
captureAssetPreview
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-I5MJ342V.js.map
|
|
@@ -10,7 +10,7 @@ import { resolve } from "path";
|
|
|
10
10
|
// package.json
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "tempo-sdk",
|
|
13
|
-
version: "0.0.
|
|
13
|
+
version: "0.0.79",
|
|
14
14
|
publishConfig: {
|
|
15
15
|
tag: "sdk-v2-latest"
|
|
16
16
|
},
|
|
@@ -452,4 +452,4 @@ export {
|
|
|
452
452
|
nextjs_default,
|
|
453
453
|
_internal
|
|
454
454
|
};
|
|
455
|
-
//# sourceMappingURL=chunk-
|
|
455
|
+
//# sourceMappingURL=chunk-JMG5IDS5.js.map
|
|
@@ -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\" | \"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.76\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n"],"mappings":";AAiBA,SAAS,YAAY,oBAAoB;AACzC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,WAAAA,gBAAe;;;ACnB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../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.79\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n"],"mappings":";AAiBA,SAAS,YAAY,oBAAoB;AACzC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,WAAAA,gBAAe;;;ACnBjC,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EAEX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EAEf,YAAc;AAAA,IACZ,MAAQ;AAAA,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;AAAA,IACZ;AAAA,IACA,gCAAgC;AAAA,MAC9B,OAAS;AAAA,MACT,QAAU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AAiB;AACnB,aAAK,eAAe;AAAA,UAClB,GAAG,YAAY;AAAA,UACf,OAAO;AAAA,QACT;AAAA,MACF,OAAO;AACL,aAAK,YAAY;AAAA,MACnB;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,iBAAQ;AAYR,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["resolve","resolve"]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
generateSelector,
|
|
5
5
|
observeRuntimeMutations,
|
|
6
6
|
removeScriptTags
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5M45Z7K6.js";
|
|
8
8
|
|
|
9
9
|
// ../../modules/iframe-projection/fiber/react-types.ts
|
|
10
10
|
var FiberTag = {
|
|
@@ -1590,11 +1590,15 @@ function captureProjectionMutationPatch(root, mutations, options = {}) {
|
|
|
1590
1590
|
if (id2) ids.set(element, id2);
|
|
1591
1591
|
}
|
|
1592
1592
|
const pointerEventsNone = /* @__PURE__ */ new Set();
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1593
|
+
const pointerRoots = [
|
|
1594
|
+
...survivingRegions,
|
|
1595
|
+
...addedElements.filter(
|
|
1596
|
+
(element) => !survivingRegions.some(
|
|
1597
|
+
(region) => region === element || region.contains(element)
|
|
1598
|
+
)
|
|
1599
|
+
)
|
|
1600
|
+
];
|
|
1601
|
+
for (const element of pointerRoots) {
|
|
1598
1602
|
for (const target of projectedElements(element)) {
|
|
1599
1603
|
const id2 = target.getAttribute(DOM_ID_ATTR);
|
|
1600
1604
|
if (id2 && target.ownerDocument.defaultView?.getComputedStyle(target).pointerEvents === "none") {
|
|
@@ -1700,15 +1704,23 @@ function captureProjectionPortalRegion(element, removed = false, coordinateRoot)
|
|
|
1700
1704
|
if (removed) {
|
|
1701
1705
|
return {
|
|
1702
1706
|
portal: { kind: "remove", portalId },
|
|
1703
|
-
observedFiles: {}
|
|
1707
|
+
observedFiles: {},
|
|
1708
|
+
state: []
|
|
1704
1709
|
};
|
|
1705
1710
|
}
|
|
1706
|
-
|
|
1711
|
+
const liveElements = projectedElements(element);
|
|
1712
|
+
for (const live of liveElements) ensureProjectionDomId(live);
|
|
1707
1713
|
const clone = cloneProjectionDom(element);
|
|
1708
1714
|
syncProjectionDomIdsToClone(element, clone);
|
|
1709
1715
|
for (const script of clone.querySelectorAll("script")) script.remove();
|
|
1710
1716
|
const observedFiles = new ProjectionObservedFileAccumulator();
|
|
1711
1717
|
stripSourceAnnotations(clone, observedFiles, true);
|
|
1718
|
+
const state = [];
|
|
1719
|
+
for (const live of liveElements) {
|
|
1720
|
+
if (live.scrollTop === 0 && live.scrollLeft === 0) continue;
|
|
1721
|
+
const scroll = captureProjectionStatePatch(element, live, "scroll");
|
|
1722
|
+
if (scroll) state.push(scroll);
|
|
1723
|
+
}
|
|
1712
1724
|
const coordinateSpace = coordinateRoot ? capturePortalCoordinateSpace(coordinateRoot, element) : void 0;
|
|
1713
1725
|
return {
|
|
1714
1726
|
portal: {
|
|
@@ -1717,7 +1729,8 @@ function captureProjectionPortalRegion(element, removed = false, coordinateRoot)
|
|
|
1717
1729
|
html: removeScriptTags(clone.outerHTML),
|
|
1718
1730
|
...coordinateSpace && { coordinateSpace }
|
|
1719
1731
|
},
|
|
1720
|
-
observedFiles: observedFiles.snapshot()
|
|
1732
|
+
observedFiles: observedFiles.snapshot(),
|
|
1733
|
+
state
|
|
1721
1734
|
};
|
|
1722
1735
|
}
|
|
1723
1736
|
function captureProjectionPortalCoordinates(root, element) {
|
|
@@ -3063,4 +3076,4 @@ export {
|
|
|
3063
3076
|
invocationSourceLayerProps,
|
|
3064
3077
|
parseInlineStyle
|
|
3065
3078
|
};
|
|
3066
|
-
//# sourceMappingURL=chunk-
|
|
3079
|
+
//# sourceMappingURL=chunk-QJA366VX.js.map
|