tempo-sdk 0.0.93 → 0.0.99
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 +36 -7
- package/dist/canvas/index.js.map +1 -1
- 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-Y7EHQREO.js → chunk-27WT3XUG.js} +2 -2
- package/dist/{chunk-Y7EHQREO.js.map → chunk-27WT3XUG.js.map} +1 -1
- package/dist/{chunk-M7OOVEAR.js → chunk-6HYKKP5N.js} +3 -2
- package/dist/{chunk-M7OOVEAR.js.map → chunk-6HYKKP5N.js.map} +1 -1
- package/dist/{chunk-N5MWY4H6.js → chunk-CYDF4LYJ.js} +2 -2
- package/dist/{chunk-N5MWY4H6.js.map → chunk-CYDF4LYJ.js.map} +1 -1
- package/dist/{chunk-XB6GU4CE.js → chunk-I7VF4ZOV.js} +48 -37
- package/dist/chunk-I7VF4ZOV.js.map +1 -0
- package/dist/{chunk-HNNZM2XM.js → chunk-MIXQVPDH.js} +461 -185
- package/dist/chunk-MIXQVPDH.js.map +1 -0
- package/dist/{chunk-GHNHPVEI.js → chunk-SGTGDLOX.js} +2 -2
- package/dist/{chunk-GHNHPVEI.js.map → chunk-SGTGDLOX.js.map} +1 -1
- package/dist/chunk-T364NBR3.js +1440 -0
- package/dist/chunk-T364NBR3.js.map +1 -0
- package/dist/{chunk-FZVJVL3T.js → chunk-X5DJKVBT.js} +10 -17
- package/dist/chunk-X5DJKVBT.js.map +1 -0
- package/dist/{chunk-CVUNZBRV.js → chunk-ZT7HJ6YU.js} +3 -3
- package/dist/{chunk-3L4RRKC3.js → chunk-ZW26VZHX.js} +42 -3
- package/dist/chunk-ZW26VZHX.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-3L4RRKC3.js.map +0 -1
- package/dist/chunk-FZVJVL3T.js.map +0 -1
- package/dist/chunk-HNNZM2XM.js.map +0 -1
- package/dist/chunk-LEBVQBDH.js +0 -643
- package/dist/chunk-LEBVQBDH.js.map +0 -1
- package/dist/chunk-XB6GU4CE.js.map +0 -1
- /package/dist/{chunk-CVUNZBRV.js.map → chunk-ZT7HJ6YU.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import { resolve } from "path";
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "tempo-sdk",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.99",
|
|
9
9
|
publishConfig: {
|
|
10
10
|
tag: "sdk-v2-latest"
|
|
11
11
|
},
|
|
@@ -339,4 +339,4 @@ export {
|
|
|
339
339
|
createTempoHostIdentity,
|
|
340
340
|
createSdkFileMatcher
|
|
341
341
|
};
|
|
342
|
-
//# sourceMappingURL=chunk-
|
|
342
|
+
//# sourceMappingURL=chunk-CYDF4LYJ.js.map
|
|
@@ -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.93\",\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,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A2B,iBAAiB,gBAAgB;AAiB3D,SAAS,uBAAkD;AAEhE,QAAM,wBAAwB,oBAAI,IAAqB;AAEvD,QAAM,sBAAsB,CAAC,mBAAoC;AAC/D,UAAM,UAAoB,CAAC;AAC3B,QAAI,YAAY;AAChB,QAAI,QAAQ;AACZ,WAAO,MAAM;AACX,YAAM,SAAS,sBAAsB,IAAI,SAAS;AAClD,UAAI,WAAW,QAAW;AACxB,gBAAQ;AACR;AAAA,MACF;AACA,cAAQ,KAAK,SAAS;AACtB,YAAM,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"]}
|
|
1
|
+
{"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts","../sdk-package-files.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport { TEMPO_SDK_CHANNEL } from \"./release-channel\";\n\nimport sdkPackage from \"./package.json\" with { type: \"json\" };\n\nexport const TEMPO_HOST_IDENTITY_ENDPOINT = \"/__tempo/identity\";\nexport const TEMPO_HOST_IDENTITY_CAPABILITY_HEADER = \"x-tempo-host-identity\";\nexport const TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;\nexport const TEMPO_WORKSPACE_NONCE_ENV = \"TEMPO_WORKSPACE_NONCE\";\nexport const TEMPO_WORKSPACE_NONCE_META_NAME = \"tempo-workspace-nonce\";\n\nconst WORKSPACE_NONCE_RELATIVE_PATH = \".tempo/workspace-nonce\";\nconst MAX_WORKSPACE_NONCE_LENGTH = 128;\n\nexport type TempoHostFramework = \"vite\" | \"nextjs\" | \"nuxt\" | \"astro\";\n\n/**\n * The name of `tempoVuePlugin()`'s annotating plugin. A Vite server that runs\n * it reports the `vueSourceAnnotation` capability, which is what proves an\n * app's Vue templates are stamped: `pluginActive` only proves\n * `tempoVitePlugin()`, and a Vue app with that alone serves route documents\n * whose layers carry no `.vue` source.\n */\nexport const TEMPO_VUE_ANNOTATION_PLUGIN_NAME = \"tempo-vue-source-annotation\";\n\n/** Optional features a host's served identity vouches for. */\nexport interface TempoHostIdentityCapabilities {\n /** 1 when the server renders Astro components for the canvas. */\n astroComponents?: number;\n /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */\n vueSourceAnnotation?: number;\n}\n\nexport interface TempoHostIdentity<\n Framework extends TempoHostFramework = TempoHostFramework,\n> {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n sdkChannel: string;\n pluginActive: boolean;\n framework: Framework;\n capabilities?: TempoHostIdentityCapabilities;\n}\n\nfunction normalizeWorkspaceNonce(value: string | undefined): string {\n const nonce = value?.trim() ?? \"\";\n return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH\n ? nonce\n : \"\";\n}\n\nexport function readTempoWorkspaceNonce(root = process.cwd()): string {\n const fromEnvironment = normalizeWorkspaceNonce(\n process.env[TEMPO_WORKSPACE_NONCE_ENV],\n );\n if (fromEnvironment) return fromEnvironment;\n try {\n return normalizeWorkspaceNonce(\n readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), \"utf-8\"),\n );\n } catch {\n return \"\";\n }\n}\n\nexport function createTempoHostIdentity<Framework extends TempoHostFramework>(\n framework: Framework,\n options: {\n root?: string;\n pluginActive?: boolean;\n capabilities?: TempoHostIdentityCapabilities;\n } = {},\n): TempoHostIdentity<Framework> {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n sdkChannel: TEMPO_SDK_CHANNEL,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.99\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n },\n \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\n/** This package's published name, as declared in its package.json. */\nexport const SDK_PACKAGE_NAME = \"tempo-sdk\";\n\nconst SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;\n\n/**\n * A predicate for \"this file belongs to tempo-sdk itself\". The SDK's own\n * components (storyboard shells, error boundaries, admission gates) are\n * canvas plumbing, never authored UI, so no annotation entry point may stamp\n * source locations on them — the canvas treats every stamped element as user\n * code.\n *\n * A project can reach SDK files under many spellings: a published copy in\n * node_modules, a pnpm store path, a workspace link, a symlink, or a source\n * alias into a checkout. Ownership is therefore decided by where the file\n * really lives — the nearest package.json above its real path declares this\n * package — and not by the id's spelling or the caller's include/exclude\n * patterns. A package nested inside the SDK checkout (the demo apps) has its\n * own package.json and stays annotatable.\n */\nexport function createSdkFileMatcher(): (file: string) => boolean {\n // Directory → whether its nearest enclosing package.json is this package.\n const ownerIsSdkByDirectory = new Map<string, boolean>();\n\n const nearestPackageIsSdk = (startDirectory: string): boolean => {\n const visited: string[] = [];\n let directory = startDirectory;\n let isSdk = false;\n while (true) {\n const cached = ownerIsSdkByDirectory.get(directory);\n if (cached !== undefined) {\n isSdk = cached;\n break;\n }\n visited.push(directory);\n const manifest = readPackageManifest(directory);\n if (manifest !== undefined) {\n isSdk = manifest?.name === SDK_PACKAGE_NAME;\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const entry of visited) ownerIsSdkByDirectory.set(entry, isSdk);\n return isSdk;\n };\n\n return (file) => {\n if (file.replace(/\\\\/g, \"/\").includes(SDK_NODE_MODULES_SEGMENT)) {\n return true;\n }\n let realFile = file;\n try {\n realFile = realpathSync.native(file);\n } catch {\n // Virtual or not-yet-written ids keep their authored spelling.\n }\n return nearestPackageIsSdk(dirname(realFile));\n };\n}\n\n/** The package.json in `directory`: `undefined` when there is none, `null`\n * when one exists but cannot be read as a manifest (still a package\n * boundary, just not this package). */\nfunction readPackageManifest(\n directory: string,\n): { name?: unknown } | null | undefined {\n let text: string;\n try {\n text = readFileSync(join(directory, \"package.json\"), \"utf8\");\n } catch {\n return undefined;\n }\n try {\n const manifest: unknown = JSON.parse(text);\n return manifest && typeof manifest === \"object\" ? manifest : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EAEX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EAEf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,oBAAoB;AAAA,MAClB,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,WAAW;AAAA,MACT,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,IACX;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,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;AAAA,IACZ;AAAA,IACA,mBAAmB;AAAA,MACjB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,mBAAmB;AAAA,MACjB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,YAAY;AAAA,MACV,OAAS;AAAA,MACT,QAAU;AAAA,IACZ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;AACF;","names":["readFileSync"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CSS_RUNTIME_MUTATION,
|
|
3
|
+
cssSourcesFor,
|
|
3
4
|
observeRuntimeMutations
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-T364NBR3.js";
|
|
5
6
|
|
|
6
7
|
// ../../modules/iframe-projection/html/head-text.ts
|
|
7
8
|
function extractStyleSourceEvidence(text) {
|
|
@@ -60,14 +61,19 @@ function extractStyleSourceEvidence(text) {
|
|
|
60
61
|
}
|
|
61
62
|
return attributes;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function resolveReference(value, baseHref, rootRelativeOrigin) {
|
|
65
|
+
const url = new URL(value, baseHref);
|
|
66
|
+
const sameOrigin = rootRelativeOrigin !== void 0 && rootRelativeOrigin !== "null" && url.origin === rootRelativeOrigin;
|
|
67
|
+
return sameOrigin ? url.pathname + url.search + url.hash : url.href;
|
|
68
|
+
}
|
|
69
|
+
function absolutifyCssReferences(cssText, baseHref, rootRelativeOrigin) {
|
|
64
70
|
const resolve = (value) => {
|
|
65
71
|
const trimmed = value.trim();
|
|
66
72
|
if (!trimmed || trimmed.startsWith("#") || /^(?:data|blob|javascript):/i.test(trimmed)) {
|
|
67
73
|
return /^javascript:/i.test(trimmed) ? "" : trimmed;
|
|
68
74
|
}
|
|
69
75
|
try {
|
|
70
|
-
return
|
|
76
|
+
return resolveReference(trimmed, baseHref, rootRelativeOrigin);
|
|
71
77
|
} catch {
|
|
72
78
|
return trimmed;
|
|
73
79
|
}
|
|
@@ -393,13 +399,13 @@ function serializeHeadStyle(style, resource, timing) {
|
|
|
393
399
|
return style.outerHTML;
|
|
394
400
|
});
|
|
395
401
|
}
|
|
396
|
-
function captureHead(doc, resource) {
|
|
402
|
+
function captureHead(doc, resource, options = {}) {
|
|
397
403
|
return captureHeadTiming(
|
|
398
404
|
doc,
|
|
399
|
-
(timing) => captureHeadValue(doc, resource, timing)
|
|
405
|
+
(timing) => captureHeadValue(doc, resource, timing, options.rootRelativeOrigin)
|
|
400
406
|
);
|
|
401
407
|
}
|
|
402
|
-
function captureHeadValue(doc, resource, timing) {
|
|
408
|
+
function captureHeadValue(doc, resource, timing, origin) {
|
|
403
409
|
const head = doc.head;
|
|
404
410
|
if (!head) return "";
|
|
405
411
|
const baseURI = doc.baseURI;
|
|
@@ -407,10 +413,9 @@ function captureHeadValue(doc, resource, timing) {
|
|
|
407
413
|
for (const child of Array.from(head.children)) {
|
|
408
414
|
const tagName = child.tagName;
|
|
409
415
|
if (!INCLUDE_TAGS.has(tagName)) continue;
|
|
410
|
-
if (tagName === "LINK")
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
416
|
+
if (tagName === "LINK" && !shouldIncludeLink(child)) continue;
|
|
417
|
+
if (tagName !== "META" && tagName !== "BASE" && isDisabledStylesheet(child))
|
|
418
|
+
continue;
|
|
414
419
|
if (tagName === "META") {
|
|
415
420
|
const httpEquiv = child.getAttribute("http-equiv")?.toLowerCase();
|
|
416
421
|
const name = child.getAttribute("name")?.toLowerCase();
|
|
@@ -429,16 +434,21 @@ function captureHeadValue(doc, resource, timing) {
|
|
|
429
434
|
);
|
|
430
435
|
materializeStyleElementCssom(child, clone, sheetTiming);
|
|
431
436
|
if (tagName === "LINK") {
|
|
432
|
-
clone = materializeStylesheetLinkCssom(child, clone, sheetTiming);
|
|
437
|
+
clone = materializeStylesheetLinkCssom(child, clone, sheetTiming, origin);
|
|
433
438
|
}
|
|
434
|
-
measureHead(
|
|
439
|
+
measureHead(
|
|
440
|
+
sheetTiming,
|
|
441
|
+
"resolveUrls",
|
|
442
|
+
() => resolveUrls(clone, baseURI, origin)
|
|
443
|
+
);
|
|
435
444
|
if (clone.tagName === "LINK") {
|
|
436
445
|
clone.removeAttribute("crossorigin");
|
|
437
446
|
} else if (clone.tagName === "STYLE") {
|
|
438
447
|
measureHead(sheetTiming, "resolveUrls", () => {
|
|
439
448
|
clone.textContent = absolutifyCssReferences(
|
|
440
449
|
clone.textContent ?? "",
|
|
441
|
-
baseURI
|
|
450
|
+
baseURI,
|
|
451
|
+
origin
|
|
442
452
|
);
|
|
443
453
|
});
|
|
444
454
|
fragments.push(serializeHeadStyle(clone, resource, sheetTiming));
|
|
@@ -448,19 +458,19 @@ function captureHeadValue(doc, resource, timing) {
|
|
|
448
458
|
measureHead(sheetTiming, "serializeMarkup", () => clone.outerHTML)
|
|
449
459
|
);
|
|
450
460
|
}
|
|
451
|
-
fragments.push(...captureAdoptedStyleSheets(doc, resource, timing));
|
|
461
|
+
fragments.push(...captureAdoptedStyleSheets(doc, resource, timing, origin));
|
|
452
462
|
return measureHead(timing, "joinMarkup", () => fragments.join("\n"));
|
|
453
463
|
}
|
|
454
|
-
function materializeStylesheetLinkCssom(source, clone, timing) {
|
|
464
|
+
function materializeStylesheetLinkCssom(source, clone, timing, origin) {
|
|
455
465
|
const link = source;
|
|
456
|
-
const cssText = serializeCssRules(link.sheet, timing);
|
|
466
|
+
const cssText = serializeCssRules(link.ownerDocument, link.sheet, timing);
|
|
457
467
|
if (cssText === null) {
|
|
458
468
|
return clone;
|
|
459
469
|
}
|
|
460
470
|
const resolvedCss = measureHead(
|
|
461
471
|
timing,
|
|
462
472
|
"resolveUrls",
|
|
463
|
-
() => absolutifyCssReferences(cssText, link.href)
|
|
473
|
+
() => absolutifyCssReferences(cssText, link.href, origin)
|
|
464
474
|
);
|
|
465
475
|
return measureHead(timing, "materializeNodes", () => {
|
|
466
476
|
const style = source.ownerDocument.createElement("style");
|
|
@@ -521,22 +531,23 @@ function materializeStyleElementCssom(source, clone, timing) {
|
|
|
521
531
|
"sourceMetadata",
|
|
522
532
|
() => retainStyleSourceEvidence(style, clone)
|
|
523
533
|
);
|
|
524
|
-
const cssText = serializeCssRules(style.sheet, timing);
|
|
534
|
+
const cssText = serializeCssRules(style.ownerDocument, style.sheet, timing);
|
|
525
535
|
if (cssText !== null) {
|
|
526
536
|
measureHead(timing, "materializeNodes", () => {
|
|
527
537
|
clone.textContent = cssText;
|
|
528
538
|
});
|
|
529
539
|
}
|
|
530
540
|
}
|
|
531
|
-
function captureAdoptedStyleSheets(doc, resource, timing) {
|
|
541
|
+
function captureAdoptedStyleSheets(doc, resource, timing, origin) {
|
|
532
542
|
const sheets = Array.from(doc.adoptedStyleSheets ?? []);
|
|
533
543
|
if (sheets.length === 0) {
|
|
534
544
|
return [];
|
|
535
545
|
}
|
|
536
546
|
const fragments = [];
|
|
537
547
|
for (const sheet of sheets) {
|
|
548
|
+
if (sheet.disabled) continue;
|
|
538
549
|
const sheetTiming = beginHeadSheet(timing, "adopted");
|
|
539
|
-
const cssText = serializeCssRules(sheet, sheetTiming);
|
|
550
|
+
const cssText = serializeCssRules(doc, sheet, sheetTiming);
|
|
540
551
|
if (!cssText) {
|
|
541
552
|
continue;
|
|
542
553
|
}
|
|
@@ -546,7 +557,7 @@ function captureAdoptedStyleSheets(doc, resource, timing) {
|
|
|
546
557
|
return node;
|
|
547
558
|
});
|
|
548
559
|
measureHead(sheetTiming, "resolveUrls", () => {
|
|
549
|
-
style.textContent = absolutifyCssReferences(cssText, doc.baseURI);
|
|
560
|
+
style.textContent = absolutifyCssReferences(cssText, doc.baseURI, origin);
|
|
550
561
|
});
|
|
551
562
|
fragments.push(serializeHeadStyle(style, resource, sheetTiming));
|
|
552
563
|
}
|
|
@@ -555,14 +566,15 @@ function captureAdoptedStyleSheets(doc, resource, timing) {
|
|
|
555
566
|
function escapeStyleForHtmlSerialization(style) {
|
|
556
567
|
style.textContent = (style.textContent ?? "").replace(/<\//gi, "<\\/");
|
|
557
568
|
}
|
|
558
|
-
function serializeCssRules(sheet, timing) {
|
|
569
|
+
function serializeCssRules(doc, sheet, timing) {
|
|
559
570
|
if (!sheet) {
|
|
560
571
|
return null;
|
|
561
572
|
}
|
|
562
573
|
try {
|
|
563
574
|
return measureHead(timing, "readCssRules", () => {
|
|
564
575
|
const rules = Array.from(sheet.cssRules);
|
|
565
|
-
const
|
|
576
|
+
const sources = cssSourcesFor(doc);
|
|
577
|
+
const text = rules.map((rule) => sources.ruleText(rule)).join("\n");
|
|
566
578
|
if (timing?.sheet) {
|
|
567
579
|
timing.sheet.rules = rules.length;
|
|
568
580
|
timing.sheet.characters = text.length;
|
|
@@ -581,21 +593,19 @@ function shouldIncludeLink(element) {
|
|
|
581
593
|
return rel.toLowerCase().split(/\s+/).some((token) => INCLUDE_LINK_RELS.has(token));
|
|
582
594
|
}
|
|
583
595
|
function isDisabledStylesheet(element) {
|
|
584
|
-
const
|
|
585
|
-
return
|
|
596
|
+
const owner = element;
|
|
597
|
+
return owner.disabled === true || owner.sheet?.disabled === true;
|
|
586
598
|
}
|
|
587
|
-
function resolveUrls(element, baseURI) {
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
const src = element.getAttribute("src");
|
|
596
|
-
if (src && !isAbsoluteUrl(src)) {
|
|
599
|
+
function resolveUrls(element, baseURI, rootRelativeOrigin) {
|
|
600
|
+
for (const name of ["href", "src"]) {
|
|
601
|
+
const value = element.getAttribute(name);
|
|
602
|
+
if (!value) continue;
|
|
603
|
+
const onlyRelativizes = isAbsoluteUrl(value);
|
|
604
|
+
if (onlyRelativizes && rootRelativeOrigin === void 0) continue;
|
|
597
605
|
try {
|
|
598
|
-
|
|
606
|
+
const resolved = resolveReference(value, baseURI, rootRelativeOrigin);
|
|
607
|
+
if (onlyRelativizes && !resolved.startsWith("/")) continue;
|
|
608
|
+
element.setAttribute(name, resolved);
|
|
599
609
|
} catch {
|
|
600
610
|
}
|
|
601
611
|
}
|
|
@@ -606,6 +616,7 @@ function isAbsoluteUrl(url) {
|
|
|
606
616
|
|
|
607
617
|
export {
|
|
608
618
|
extractStyleSourceEvidence,
|
|
619
|
+
resolveReference,
|
|
609
620
|
absolutifyCssReferences,
|
|
610
621
|
beginHeadCapture,
|
|
611
622
|
finishHeadCapture,
|
|
@@ -616,4 +627,4 @@ export {
|
|
|
616
627
|
isDisabledStylesheet,
|
|
617
628
|
resolveUrls
|
|
618
629
|
};
|
|
619
|
-
//# sourceMappingURL=chunk-
|
|
630
|
+
//# sourceMappingURL=chunk-I7VF4ZOV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../modules/iframe-projection/html/head-text.ts","../../../modules/iframe-projection/html/head-capture-diagnostics.ts","../../../modules/iframe-projection/html/watch-head.ts"],"sourcesContent":["/** Pure stylesheet text processing shared with the source worker. */\nexport function extractStyleSourceEvidence(\n text: string,\n): Record<string, string> {\n const attributes: Record<string, string> = {};\n const clone = {\n setAttribute: (key: string, value: string) => {\n attributes[key] = value;\n },\n };\n const reference = [\n ...text.matchAll(/\\/\\*[#@]\\s*sourceMappingURL\\s*=\\s*(\\S+?)\\s*\\*\\//g),\n ].slice(-1)[0]?.[1];\n if (!reference || reference.length > 1024 * 1024) return attributes;\n const inline =\n /^data:application\\/json(?:;charset=[\\w-]+)?(;base64)?,(.*)$/is.exec(\n reference,\n );\n if (!inline) {\n // A detached inline style has no proven relative map base. Absolute URLs\n // can be admitted later against the existing app/server source origin.\n try {\n const url = new URL(reference);\n if (/^https?:$/.test(url.protocol))\n clone.setAttribute(\"data-projection-css-source-map-url\", url.href);\n } catch {}\n return attributes;\n }\n function compact(raw: unknown, depth: number): object | null {\n if (!raw || typeof raw !== \"object\" || depth > 16) return null;\n const map = raw as Record<string, unknown>;\n if (map.version !== 3) return null;\n const sources =\n Array.isArray(map.sources) &&\n map.sources.length <= 4096 &&\n map.sources.every((source) => typeof source === \"string\")\n ? map.sources\n : undefined;\n const sections =\n Array.isArray(map.sections) && map.sections.length <= 256\n ? map.sections.flatMap((section) => {\n const nested =\n section && typeof section === \"object\"\n ? compact(section.map, depth + 1)\n : null;\n return nested ? [{ map: nested }] : [];\n })\n : undefined;\n return {\n version: 3,\n ...(typeof map.file === \"string\" ? { file: map.file } : {}),\n ...(typeof map.sourceRoot === \"string\"\n ? { sourceRoot: map.sourceRoot }\n : {}),\n ...(sources ? { sources } : {}),\n ...(sections ? { sections } : {}),\n };\n }\n try {\n const json = inline[1]\n ? new TextDecoder().decode(\n Uint8Array.from(atob(inline[2]!), (character) =>\n character.charCodeAt(0),\n ),\n )\n : decodeURIComponent(inline[2]!);\n const metadata = compact(JSON.parse(json), 0);\n if (!metadata) return attributes;\n const serialized = JSON.stringify(metadata);\n if (serialized.length <= 64 * 1024)\n clone.setAttribute(\"data-projection-css-source-map\", serialized);\n } catch {}\n return attributes;\n}\n\n/**\n * `href` as an absolute URL, or as a root-relative path when it is on\n * `rootRelativeOrigin`. A destination that supplies its own base for that\n * origin then resolves the path against it, so no origin travels.\n */\nexport function resolveReference(\n value: string,\n baseHref: string,\n rootRelativeOrigin?: string,\n): string {\n const url = new URL(value, baseHref);\n // An opaque origin (\"null\": data:, blob:, custom schemes) is never \"same\".\n const sameOrigin =\n rootRelativeOrigin !== undefined &&\n rootRelativeOrigin !== \"null\" &&\n url.origin === rootRelativeOrigin;\n return sameOrigin ? url.pathname + url.search + url.hash : url.href;\n}\n\nexport function absolutifyCssReferences(\n cssText: string,\n baseHref: string,\n rootRelativeOrigin?: string,\n): string {\n const resolve = (value: string): string => {\n const trimmed = value.trim();\n if (\n !trimmed ||\n trimmed.startsWith(\"#\") ||\n /^(?:data|blob|javascript):/i.test(trimmed)\n ) {\n return /^javascript:/i.test(trimmed) ? \"\" : trimmed;\n }\n try {\n return resolveReference(trimmed, baseHref, rootRelativeOrigin);\n } catch {\n return trimmed;\n }\n };\n\n return cssText\n .replace(\n /url\\(\\s*([\"']?)([^\"')]+)\\1\\s*\\)/gi,\n (_match, quote: string, value: string) =>\n `url(${quote}${resolve(value)}${quote})`,\n )\n .replace(\n /@import\\s+([\"'])([^\"']+)\\1/gi,\n (_match, quote: string, value: string) =>\n `@import ${quote}${resolve(value)}${quote}`,\n );\n}\n","/** Optional source-side timing. The observer owns its lifetime; no clocks or\n * retained measurements exist when that document has no observer. */\nexport interface HeadCaptureTiming {\n startedAt: number;\n clockStart: number;\n reason?: string;\n revision?: number;\n cacheHits: number;\n cacheMisses: number;\n readWallMs: number;\n workerWallMs: number;\n /** High-water mark for this document scheduler, including earlier captures. */\n maxSliceSinceDocumentStartMs?: number;\n totalMs: number;\n unaccountedMs: number;\n stages: Record<string, number>;\n sheets: Array<{\n index: number;\n kind: string;\n source?: string;\n rules: number;\n characters: number;\n stages: Record<string, number>;\n }>;\n omittedSheets: number;\n}\nconst observers = new WeakMap<Document, (value: HeadCaptureTiming) => void>();\nexport function observeHeadCaptures(\n doc: Document,\n observer: (value: HeadCaptureTiming) => void,\n): () => void {\n observers.set(doc, observer);\n return () => {\n if (observers.get(doc) === observer) observers.delete(doc);\n };\n}\nexport type HeadTiming = {\n report: HeadCaptureTiming;\n observer: (value: HeadCaptureTiming) => void;\n sheet?: HeadCaptureTiming[\"sheets\"][number];\n};\nexport function measureHead<T>(\n timing: HeadTiming | undefined,\n stage: string,\n work: () => T,\n): T {\n if (!timing) return work();\n const start = performance.now();\n try {\n return work();\n } finally {\n const elapsed = performance.now() - start;\n timing.report.stages[stage] = (timing.report.stages[stage] ?? 0) + elapsed;\n if (timing.sheet)\n timing.sheet.stages[stage] = (timing.sheet.stages[stage] ?? 0) + elapsed;\n }\n}\nexport function beginHeadCapture(doc: Document): HeadTiming | undefined {\n const observer = observers.get(doc);\n if (!observer) return;\n return {\n observer,\n report: {\n startedAt: Date.now(),\n clockStart: performance.now(),\n totalMs: 0,\n unaccountedMs: 0,\n cacheHits: 0,\n cacheMisses: 0,\n readWallMs: 0,\n workerWallMs: 0,\n stages: {},\n sheets: [],\n omittedSheets: 0,\n },\n };\n}\nexport function finishHeadCapture(doc: Document, timing: HeadTiming): void {\n if (observers.get(doc) !== timing.observer) return;\n const report = timing.report;\n report.totalMs = performance.now() - report.clockStart;\n report.unaccountedMs = Math.max(\n 0,\n report.totalMs - Object.values(report.stages).reduce((a, b) => a + b, 0),\n );\n try {\n observers.get(doc)?.(report);\n } catch {\n /* Observation cannot break capture. */\n }\n}\nexport function captureHeadTiming(\n doc: Document,\n capture: (timing?: HeadTiming) => string,\n): string {\n const timing = beginHeadCapture(doc);\n try {\n return capture(timing);\n } finally {\n if (timing) finishHeadCapture(doc, timing);\n }\n}\nexport function beginHeadSheet(\n timing: HeadTiming | undefined,\n kind: string,\n): HeadTiming | undefined {\n if (!timing) return;\n const sheet = {\n index: timing.report.sheets.length + timing.report.omittedSheets,\n kind,\n rules: 0,\n characters: 0,\n stages: {},\n };\n if (timing.report.sheets.length < 64) timing.report.sheets.push(sheet);\n else timing.report.omittedSheets++;\n return { report: timing.report, observer: timing.observer, sheet };\n}\n","import {\n extractStyleSourceEvidence,\n absolutifyCssReferences,\n resolveReference,\n} from \"./head-text\";\nimport {\n beginHeadSheet,\n captureHeadTiming,\n measureHead,\n type HeadTiming,\n} from \"./head-capture-diagnostics\";\n/**\n * Head Capture Utility\n *\n * Captures relevant <head> content from a document, excluding scripts\n * and resolving relative URLs to absolute.\n *\n * ## Shared Observer Pattern\n *\n * Uses a singleton HeadTracker that maintains one MutationObserver per document,\n * shared across all subscriptions. This avoids creating 50+ observers when there\n * are many watchers on the same page.\n */\n\nimport { cssSourcesFor } from \"./faithful-css-text\";\nimport {\n CSS_RUNTIME_MUTATION,\n observeRuntimeMutations,\n} from \"./runtime-mutations\";\n\n/** Elements to include from <head> */\nconst INCLUDE_TAGS = new Set([\"STYLE\", \"META\", \"BASE\", \"LINK\"]);\n\n/** Link rel values to include (stylesheet-related) */\nconst INCLUDE_LINK_RELS = new Set([\"stylesheet\"]);\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Head Tracker (Shared Observer)\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * A subscription to head changes for a specific document.\n * Each subscription maintains its own hasMutations flag since they flush independently.\n */\nexport interface HeadSubscription {\n /** Shared identity of the currently observed document head. */\n readonly revision: object;\n /** Whether there have been mutations since last flush */\n hasMutations: boolean;\n /** Flush and get head content. Returns content if isInitial or if mutations occurred. */\n flush(isInitial: boolean): string | undefined;\n /** Unsubscribe from head changes */\n unsubscribe(): void;\n}\n\nexport interface HeadMutationDetails {\n /** Vite stylesheet module ids whose style/link nodes changed in this batch. */\n stylesheetPaths: string[];\n elements?: readonly Element[];\n sheets?: readonly CSSStyleSheet[];\n allStyles?: boolean;\n mutable?: boolean;\n}\n\n/**\n * Singleton tracker that manages shared MutationObservers for head watching.\n * One observer per document, shared across all subscriptions.\n */\nexport interface HeadTracker {\n /** Publish already queued mutations before synchronous root admission. */\n flushPending?(doc: Document): void;\n /** Subscribe to head changes for a document */\n subscribe(\n doc: Document,\n onMutation: (details: HeadMutationDetails) => void,\n ): HeadSubscription;\n /** Clean up all observers */\n destroy(): void;\n /** Cardinality only; reads maintained collection sizes and performs no DOM\n * work. Used by the performance trace attached to an emitted capture. */\n readPerfSnapshot(): { observers: number; subscriptions: number };\n}\n\n/** Module-level singleton */\nlet instance: HeadTrackerImpl | null = null;\n\n/**\n * Get the singleton HeadTracker instance.\n */\nexport function getHeadTracker(): HeadTracker {\n if (!instance) {\n instance = new HeadTrackerImpl();\n }\n return instance;\n}\n\n/**\n * Reset the singleton. For testing only.\n * @internal\n */\nexport function _resetHeadTrackerForTesting(): void {\n instance?.destroy();\n instance = null;\n}\n\n/** Internal subscription implementation */\nclass HeadSubscriptionImpl implements HeadSubscription {\n hasMutations = false;\n private doc: Document;\n private callback: (details: HeadMutationDetails) => void;\n private onUnsubscribe: () => void;\n private getRevision: () => object;\n\n constructor(\n doc: Document,\n callback: (details: HeadMutationDetails) => void,\n onUnsubscribe: () => void,\n getRevision: () => object,\n ) {\n this.doc = doc;\n this.callback = callback;\n this.onUnsubscribe = onUnsubscribe;\n this.getRevision = getRevision;\n }\n\n get revision(): object {\n return this.getRevision();\n }\n\n flush(isInitial: boolean): string | undefined {\n if (!isInitial && !this.hasMutations) {\n return undefined;\n }\n this.hasMutations = false;\n return captureHead(this.doc);\n }\n\n unsubscribe(): void {\n this.onUnsubscribe();\n }\n\n /** Called by tracker when relevant mutation detected */\n notifyMutation(details: HeadMutationDetails): void {\n this.hasMutations = true;\n this.callback(details);\n }\n}\n\n/** Per-document observer state */\ninterface DocObserverState {\n readonly revision: object;\n observer: MutationObserver;\n flushPending(): void;\n stopRuntime(): void;\n subscriptions: Set<HeadSubscriptionImpl>;\n}\n\nclass HeadTrackerImpl implements HeadTracker {\n private docObservers = new Map<Document, DocObserverState>();\n private activeSubscriptions = 0;\n\n flushPending(doc: Document): void {\n this.docObservers.get(doc)?.flushPending();\n }\n\n subscribe(\n doc: Document,\n onMutation: (details: HeadMutationDetails) => void,\n ): HeadSubscription {\n let docState = this.docObservers.get(doc);\n\n // Create observer for this document if first subscription\n if (!docState) {\n docState = this.createDocObserver(doc);\n this.docObservers.set(doc, docState);\n }\n\n const subscription = new HeadSubscriptionImpl(\n doc,\n onMutation,\n () => {\n this.unsubscribe(doc, subscription);\n },\n () => docState!.revision,\n );\n docState.subscriptions.add(subscription);\n this.activeSubscriptions += 1;\n\n return subscription;\n }\n\n private createDocObserver(doc: Document): DocObserverState {\n const subscriptions = new Set<HeadSubscriptionImpl>();\n let revision = {};\n\n const notify = (details: HeadMutationDetails): void => {\n revision = {};\n for (const sub of subscriptions) {\n sub.notifyMutation(details);\n }\n };\n const stopHooks = observeRuntimeMutations(doc);\n const cssChanged = (event: Event) => {\n const detail = (event as CustomEvent).detail;\n notify({\n stylesheetPaths: [],\n elements: detail?.ownerNode ? [detail.ownerNode] : [],\n sheets: detail?.sheet ? [detail.sheet] : [],\n allStyles: !detail?.sheet,\n mutable: detail?.mutable === true,\n });\n };\n const loaded = (event: Event) => {\n const target = event.target;\n if (target instanceof HTMLLinkElement && shouldIncludeLink(target))\n notify({ stylesheetPaths: [], elements: [target] });\n };\n doc.addEventListener(\"load\", loaded, true);\n doc.addEventListener(CSS_RUNTIME_MUTATION, cssChanged);\n const stopRuntime = () => {\n doc.removeEventListener(CSS_RUNTIME_MUTATION, cssChanged);\n doc.removeEventListener(\"load\", loaded, true);\n stopHooks();\n };\n\n const observeHead = (head: HTMLHeadElement) => {\n const changed = (mutations: MutationRecord[]) => {\n const details = this.readRelevantMutations(mutations, head);\n if (!details) return;\n notify(details);\n };\n const observer = new MutationObserver(changed);\n observer.observe(head, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n return { observer, flushPending: () => changed(observer.takeRecords()) };\n };\n\n if (doc.head) {\n return {\n ...observeHead(doc.head),\n subscriptions,\n stopRuntime,\n get revision() {\n return revision;\n },\n };\n }\n\n // The document has no <head> yet — subscribers can attach before parsing\n // (e.g. a producer created from a frame preload). Watch for the head to\n // appear, then swap in the real observer and report one synthetic\n // mutation so subscribers capture the head they never saw arrive.\n const attachHead = () => {\n const head = doc.head;\n if (!head) return;\n bootstrap.disconnect();\n Object.assign(state, observeHead(head));\n notify({ stylesheetPaths: [] });\n };\n const bootstrap = new MutationObserver(attachHead);\n bootstrap.observe(doc, { childList: true, subtree: true });\n const state: DocObserverState = {\n get revision() {\n return revision;\n },\n observer: bootstrap,\n flushPending: attachHead,\n subscriptions,\n stopRuntime,\n };\n return state;\n }\n\n private unsubscribe(doc: Document, sub: HeadSubscriptionImpl): void {\n const docState = this.docObservers.get(doc);\n if (!docState) return;\n\n if (!docState.subscriptions.delete(sub)) return;\n this.activeSubscriptions = Math.max(0, this.activeSubscriptions - 1);\n\n // Disconnect observer if no more subscriptions for this document\n if (docState.subscriptions.size === 0) {\n docState.observer.disconnect();\n docState.stopRuntime();\n this.docObservers.delete(doc);\n }\n }\n\n /**\n * Check if mutations contain changes to elements we care about.\n * This filtering runs once per mutation batch (not once per subscription).\n */\n private readRelevantMutations(\n mutations: MutationRecord[],\n head: HTMLHeadElement,\n ): HeadMutationDetails | null {\n let relevant = false;\n const stylesheetPaths = new Set<string>();\n const elements = new Set<Element>();\n const collectStylesheetPath = (node: Node | null): void => {\n const element =\n node instanceof Element ? node : (node?.parentElement ?? null);\n if (!element) return;\n elements.add(element);\n const candidates = [\n element,\n ...element.querySelectorAll(\n \"style[data-vite-dev-id], link[rel~='stylesheet']\",\n ),\n ];\n for (const candidate of candidates) {\n if (candidate instanceof HTMLStyleElement) {\n const id = candidate.getAttribute(\"data-vite-dev-id\")?.trim();\n if (id) stylesheetPaths.add(id);\n } else if (\n candidate instanceof HTMLLinkElement &&\n shouldIncludeLink(candidate)\n ) {\n const href = candidate.getAttribute(\"href\")?.trim() || candidate.href;\n if (href) stylesheetPaths.add(href);\n }\n }\n };\n\n for (const mutation of mutations) {\n const target = mutation.target;\n const element = target instanceof Element ? target : target.parentElement;\n\n if (!element || (!head.contains(element) && target !== head)) continue;\n\n // Check if this is a relevant element (one we would capture)\n const tagName = element.tagName;\n if (INCLUDE_TAGS.has(tagName)) {\n // For LINK, check if it's a stylesheet\n if (tagName === \"LINK\") {\n const relChanged =\n mutation.type === \"attributes\" && mutation.attributeName === \"rel\";\n if (!relChanged && !shouldIncludeLink(element)) continue;\n }\n relevant = true;\n collectStylesheetPath(element);\n }\n\n // Also trigger for childList mutations on head itself (added/removed elements)\n if (mutation.type === \"childList\" && target === head) {\n relevant = true;\n }\n if (mutation.type === \"childList\") {\n for (const node of mutation.addedNodes) collectStylesheetPath(node);\n for (const node of mutation.removedNodes) collectStylesheetPath(node);\n }\n }\n return relevant\n ? { stylesheetPaths: [...stylesheetPaths], elements: [...elements] }\n : null;\n }\n\n destroy(): void {\n for (const docState of this.docObservers.values()) {\n docState.observer.disconnect();\n docState.stopRuntime();\n docState.subscriptions.clear();\n }\n this.docObservers.clear();\n this.activeSubscriptions = 0;\n }\n\n readPerfSnapshot(): { observers: number; subscriptions: number } {\n return {\n observers: this.docObservers.size,\n subscriptions: this.activeSubscriptions,\n };\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Legacy API (Backward Compatibility)\n// These functions delegate to the shared tracker for backward compatibility\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * State for a head watcher instance.\n * @deprecated Use getHeadTracker().subscribe() instead for better performance\n */\nexport interface HeadWatcher {\n /** The document being watched */\n doc: Document;\n /** Whether there have been mutations since last flush */\n hasMutations: boolean;\n /** Stop watching */\n stop: () => void;\n}\n\n/**\n * Starts watching a document's <head> for mutations.\n * @deprecated Use getHeadTracker().subscribe() instead for better performance\n */\nexport function watchHead(doc: Document, onMutation: () => void): HeadWatcher {\n const subscription = getHeadTracker().subscribe(doc, onMutation);\n\n // Wrap subscription in legacy HeadWatcher interface\n return {\n doc,\n get hasMutations() {\n return subscription.hasMutations;\n },\n set hasMutations(value: boolean) {\n subscription.hasMutations = value;\n },\n stop: () => subscription.unsubscribe(),\n };\n}\n\n/**\n * Checks if watcher has any pending head mutations.\n * @deprecated Access subscription.hasMutations directly\n */\nexport function hasPendingHeadChanges(watcher: HeadWatcher): boolean {\n return watcher.hasMutations;\n}\n\n/**\n * Flushes the head watcher, returning captured head content if there were changes.\n * @deprecated Use subscription.flush() directly\n */\nexport function flushHeadWatcher(\n watcher: HeadWatcher,\n isInitial: boolean,\n): string | undefined {\n if (!isInitial && !watcher.hasMutations) {\n return undefined;\n }\n watcher.hasMutations = false;\n return captureHead(watcher.doc);\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Head Capture\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * Captures the <head> content from a document.\n *\n * - Includes: <style>, <link rel=\"stylesheet\">, <meta>, <base>\n * - Excludes: <script>, <title>, <link rel=\"icon/preload/etc\">\n * - Resolves relative URLs to absolute using document.baseURI\n *\n * @param doc - The document to capture head from\n * @returns Serialized head content (innerHTML for destination <head>)\n */\nexport type StyleResource = (css: string, hash?: string) => string | null;\n\nfunction serializeHeadStyle(\n style: Element,\n resource?: StyleResource,\n timing?: HeadTiming,\n): string {\n const type = style.getAttribute(\"type\")?.trim().toLowerCase();\n const href =\n !type || type === \"text/css\"\n ? measureHead(timing, \"resourceHash\", () =>\n resource?.(style.textContent ?? \"\"),\n )\n : null;\n if (href) {\n return measureHead(timing, \"serializeMarkup\", () => {\n const link = style.ownerDocument.createElement(\"link\");\n for (const attribute of Array.from(style.attributes))\n if (\n ![\"type\", \"href\", \"rel\", \"integrity\", \"crossorigin\"].includes(\n attribute.name,\n )\n )\n link.setAttribute(attribute.name, attribute.value);\n link.rel = \"stylesheet\";\n link.href = href;\n return link.outerHTML;\n });\n }\n return measureHead(timing, \"serializeMarkup\", () => {\n escapeStyleForHtmlSerialization(style);\n return style.outerHTML;\n });\n}\n\nexport interface CaptureHeadOptions {\n /** URLs on this origin are written root-relative; the destination gives\n * the document a base for it. Other URLs stay absolute. */\n readonly rootRelativeOrigin?: string;\n}\n\nexport function captureHead(\n doc: Document,\n resource?: StyleResource,\n options: CaptureHeadOptions = {},\n): string {\n return captureHeadTiming(doc, (timing) =>\n captureHeadValue(doc, resource, timing, options.rootRelativeOrigin),\n );\n}\n\nfunction captureHeadValue(\n doc: Document,\n resource?: StyleResource,\n timing?: HeadTiming,\n origin?: string,\n): string {\n const head = doc.head;\n if (!head) return \"\";\n\n const baseURI = doc.baseURI;\n const fragments: string[] = [];\n\n for (const child of Array.from(head.children)) {\n const tagName = child.tagName;\n\n // Skip non-included tags\n if (!INCLUDE_TAGS.has(tagName)) continue;\n\n // For <link>, only include stylesheets\n if (tagName === \"LINK\" && !shouldIncludeLink(child)) continue;\n // A disabled sheet keeps its rules but applies none of them.\n if (tagName !== \"META\" && tagName !== \"BASE\" && isDisabledStylesheet(child))\n continue;\n\n // Exclude Content-Security-Policy meta tags (they block srcdoc assets),\n // and theme-color, which tints only the browser's own UI, never the page.\n // Apps rewrite theme-color freely: a Flutter app's Title writes it on\n // every build of every view, into the one document all views share. Kept\n // in the head, views with different colors flipped the head back and\n // forth with no pixel changed, and every flip was a new head revision.\n if (tagName === \"META\") {\n const httpEquiv = child.getAttribute(\"http-equiv\")?.toLowerCase();\n const name = child.getAttribute(\"name\")?.toLowerCase();\n if (\n httpEquiv === \"content-security-policy\" ||\n name === \"content-security-policy\" ||\n name === \"theme-color\"\n ) {\n continue;\n }\n }\n\n const sheetTiming =\n tagName === \"STYLE\" || tagName === \"LINK\"\n ? beginHeadSheet(timing, tagName)\n : timing;\n if (sheetTiming?.sheet) {\n sheetTiming.sheet.source = (\n child.getAttribute(\"data-vite-dev-id\") ??\n child.getAttribute(\"href\") ??\n child.id\n )\n .split(/[?#]/)[0]\n .slice(0, 512);\n }\n // Clone and resolve URLs\n let clone = measureHead(\n sheetTiming,\n \"cloneNodes\",\n () => child.cloneNode(true) as Element,\n );\n materializeStyleElementCssom(child, clone, sheetTiming);\n if (tagName === \"LINK\") {\n clone = materializeStylesheetLinkCssom(child, clone, sheetTiming, origin);\n }\n measureHead(sheetTiming, \"resolveUrls\", () =>\n resolveUrls(clone, baseURI, origin),\n );\n\n // Strip crossorigin from stylesheet links so they load in no-cors mode\n // in srcdoc projection iframes (which have a null origin that won't\n // match any server's Access-Control-Allow-Origin header)\n if (clone.tagName === \"LINK\") {\n clone.removeAttribute(\"crossorigin\");\n } else if (clone.tagName === \"STYLE\") {\n // The destination stages this head before installing its incoming base.\n // Authored inline/CSSOM styles must not resolve assets against that old\n // document. Materialized links already carry their stylesheet's own base.\n measureHead(sheetTiming, \"resolveUrls\", () => {\n clone.textContent = absolutifyCssReferences(\n clone.textContent ?? \"\",\n baseURI,\n origin,\n );\n });\n fragments.push(serializeHeadStyle(clone, resource, sheetTiming));\n continue;\n }\n\n fragments.push(\n measureHead(sheetTiming, \"serializeMarkup\", () => clone.outerHTML),\n );\n }\n\n fragments.push(...captureAdoptedStyleSheets(doc, resource, timing, origin));\n\n return measureHead(timing, \"joinMarkup\", () => fragments.join(\"\\n\"));\n}\n\n/**\n * Same-origin stylesheets are already readable in the source page. Preserve\n * their authored rules as an inline style before the projection crosses into\n * its null-origin document. Opaque cross-origin sheets remain links and may be\n * handled by a consumer-specific, policy-checked fallback later.\n */\nfunction materializeStylesheetLinkCssom(\n source: Element,\n clone: Element,\n timing?: HeadTiming,\n origin?: string,\n): Element {\n const link = source as HTMLLinkElement;\n const cssText = serializeCssRules(link.ownerDocument, link.sheet, timing);\n if (cssText === null) {\n return clone;\n }\n\n const resolvedCss = measureHead(timing, \"resolveUrls\", () =>\n absolutifyCssReferences(cssText, link.href, origin),\n );\n return measureHead(timing, \"materializeNodes\", () => {\n const style = source.ownerDocument.createElement(\"style\");\n for (const attribute of Array.from(source.attributes)) {\n if (\n [\n \"as\",\n \"crossorigin\",\n \"fetchpriority\",\n \"href\",\n \"integrity\",\n \"referrerpolicy\",\n \"rel\",\n ].includes(attribute.name.toLowerCase())\n ) {\n continue;\n }\n style.setAttribute(attribute.name, attribute.value);\n }\n style.setAttribute(\"data-projection-stylesheet-href\", link.href);\n style.textContent = resolvedCss;\n return style;\n });\n}\n\nconst styleSourceEvidence = new WeakMap<\n HTMLStyleElement,\n {\n text: string;\n inline: string | null;\n url: string | null;\n }\n>();\n\n/** Original identity metadata survives CSSOM comment removal; visual CSS stays CSSOM.\n * Decode unchanged authored metadata once per live style. CSSOM serialization\n * still runs on every capture, and a same-task text edit invalidates immediately. */\nfunction retainStyleSourceEvidence(\n source: HTMLStyleElement,\n clone: Element,\n): void {\n clone.removeAttribute(\"data-projection-css-source-map\");\n clone.removeAttribute(\"data-projection-css-source-map-url\");\n const text = source.textContent ?? \"\";\n if (text.length > 5 * 1024 * 1024) {\n styleSourceEvidence.delete(source);\n return;\n }\n const cached = styleSourceEvidence.get(source);\n if (cached?.text === text) {\n if (cached.inline)\n clone.setAttribute(\"data-projection-css-source-map\", cached.inline);\n if (cached.url)\n clone.setAttribute(\"data-projection-css-source-map-url\", cached.url);\n return;\n }\n captureStyleSourceEvidence(text, clone);\n styleSourceEvidence.set(source, {\n text,\n inline: clone.getAttribute(\"data-projection-css-source-map\"),\n url: clone.getAttribute(\"data-projection-css-source-map-url\"),\n });\n}\n\nfunction captureStyleSourceEvidence(text: string, clone: Element): void {\n for (const [key, value] of Object.entries(extractStyleSourceEvidence(text)))\n clone.setAttribute(key, value);\n}\n\n/**\n * CSSOM is current visual truth even when authored style text is nonempty.\n * A deleted final rule must serialize empty, not revive the original DOM text.\n */\nfunction materializeStyleElementCssom(\n source: Element,\n clone: Element,\n timing?: HeadTiming,\n): void {\n if (source.tagName !== \"STYLE\" || clone.tagName !== \"STYLE\") {\n return;\n }\n\n const style = source as HTMLStyleElement;\n measureHead(timing, \"sourceMetadata\", () =>\n retainStyleSourceEvidence(style, clone),\n );\n const cssText = serializeCssRules(style.ownerDocument, style.sheet, timing);\n if (cssText !== null) {\n measureHead(timing, \"materializeNodes\", () => {\n clone.textContent = cssText;\n });\n }\n}\n\nfunction captureAdoptedStyleSheets(\n doc: Document,\n resource?: StyleResource,\n timing?: HeadTiming,\n origin?: string,\n): string[] {\n const sheets = Array.from(doc.adoptedStyleSheets ?? []);\n if (sheets.length === 0) {\n return [];\n }\n\n const fragments: string[] = [];\n for (const sheet of sheets) {\n if (sheet.disabled) continue;\n const sheetTiming = beginHeadSheet(timing, \"adopted\");\n const cssText = serializeCssRules(doc, sheet, sheetTiming);\n if (!cssText) {\n continue;\n }\n const style = measureHead(sheetTiming, \"materializeNodes\", () => {\n const node = doc.createElement(\"style\");\n node.setAttribute(\"data-projection-adopted-stylesheet\", \"true\");\n return node;\n });\n measureHead(sheetTiming, \"resolveUrls\", () => {\n style.textContent = absolutifyCssReferences(cssText, doc.baseURI, origin);\n });\n fragments.push(serializeHeadStyle(style, resource, sheetTiming));\n }\n return fragments;\n}\n\nfunction escapeStyleForHtmlSerialization(style: Element): void {\n style.textContent = (style.textContent ?? \"\").replace(/<\\//gi, \"<\\\\/\");\n}\n\nfunction serializeCssRules(\n doc: Document,\n sheet: CSSStyleSheet | null,\n timing?: HeadTiming,\n): string | null {\n if (!sheet) {\n return null;\n }\n\n try {\n return measureHead(timing, \"readCssRules\", () => {\n const rules = Array.from(sheet.cssRules);\n const sources = cssSourcesFor(doc);\n const text = rules.map((rule) => sources.ruleText(rule)).join(\"\\n\");\n if (timing?.sheet) {\n timing.sheet.rules = rules.length;\n timing.sheet.characters = text.length;\n }\n return text;\n });\n } catch {\n // Cross-origin or otherwise unreadable stylesheet.\n return null;\n }\n}\n\nexport function shouldIncludeLink(element: Element): boolean {\n const rel = element.getAttribute(\"rel\");\n if (!rel) {\n return false;\n }\n return rel\n .toLowerCase()\n .split(/\\s+/)\n .some((token) => INCLUDE_LINK_RELS.has(token));\n}\n\n/** True for a `<link>` or `<style>` whose sheet is switched off. */\nexport function isDisabledStylesheet(element: Element): boolean {\n const owner = element as HTMLLinkElement | HTMLStyleElement;\n return owner.disabled === true || owner.sheet?.disabled === true;\n}\n\n/**\n * Resolves relative URLs in an element to absolute URLs. With\n * `rootRelativeOrigin`, URLs on that origin become root-relative paths\n * instead (see `resolveReference`).\n */\nexport function resolveUrls(\n element: Element,\n baseURI: string,\n rootRelativeOrigin?: string,\n): void {\n // URL resolution supports retained custom-scheme documents as well as HTTP.\n // This only serializes the source's URLs; protocol authorization remains at\n // the serving boundary. Opaque bases (about:blank, data:) fall through catch.\n // `href` covers <link> and <base>; `src` is future-proofing.\n for (const name of [\"href\", \"src\"]) {\n const value = element.getAttribute(name);\n if (!value) continue;\n const onlyRelativizes = isAbsoluteUrl(value);\n if (onlyRelativizes && rootRelativeOrigin === undefined) continue;\n try {\n const resolved = resolveReference(value, baseURI, rootRelativeOrigin);\n // An absolute URL elsewhere stays exactly as authored.\n if (onlyRelativizes && !resolved.startsWith(\"/\")) continue;\n element.setAttribute(name, resolved);\n } catch {\n // Keep the original value if URL resolution fails\n }\n }\n}\n\n/**\n * Checks if a URL is absolute.\n */\nfunction isAbsoluteUrl(url: string): boolean {\n return /^(https?:)?\\/\\//i.test(url) || url.startsWith(\"data:\");\n}\n"],"mappings":";;;;;;;AACO,SAAS,2BACd,MACwB;AACxB,QAAM,aAAqC,CAAC;AAC5C,QAAM,QAAQ;AAAA,IACZ,cAAc,CAAC,KAAa,UAAkB;AAC5C,iBAAW,GAAG,IAAI;AAAA,IACpB;AAAA,EACF;AACA,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