tempo-sdk 0.0.89 → 0.0.93
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 +7 -7
- package/dist/canvas/astro.js +3 -3
- package/dist/canvas/editor.js +1 -1
- package/dist/canvas/index.js +157 -7
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +4 -4
- package/dist/canvas/parser.js +1 -1
- package/dist/canvas/svelte.js +12 -4
- package/dist/canvas/svelte.js.map +1 -1
- package/dist/canvas/vue.js +3 -3
- package/dist/{chunk-DNERBE7A.js → chunk-3L4RRKC3.js} +17 -11
- package/dist/chunk-3L4RRKC3.js.map +1 -0
- package/dist/{chunk-2ZQMVAFM.js → chunk-6SOP4XU6.js} +98 -33
- package/dist/chunk-6SOP4XU6.js.map +1 -0
- package/dist/{chunk-Y72PIE3I.js → chunk-AFXE462X.js} +5 -4
- package/dist/{chunk-Y72PIE3I.js.map → chunk-AFXE462X.js.map} +1 -1
- package/dist/{chunk-DMT5MRMS.js → chunk-BQPKOVI5.js} +4 -3
- package/dist/{chunk-DMT5MRMS.js.map → chunk-BQPKOVI5.js.map} +1 -1
- package/dist/{chunk-I5MJ342V.js → chunk-CVUNZBRV.js} +3 -3
- package/dist/{chunk-H6OZIX2U.js → chunk-FGWGY3G3.js} +27 -3
- package/dist/chunk-FGWGY3G3.js.map +1 -0
- package/dist/{chunk-NXPP3CSM.js → chunk-FZVJVL3T.js} +2 -2
- package/dist/{chunk-GZ6KY7ZF.js → chunk-GHNHPVEI.js} +2 -2
- package/dist/{chunk-GZ6KY7ZF.js.map → chunk-GHNHPVEI.js.map} +1 -1
- package/dist/{chunk-3XEEVCM3.js → chunk-HNNZM2XM.js} +127 -66
- package/dist/chunk-HNNZM2XM.js.map +1 -0
- package/dist/{chunk-5M45Z7K6.js → chunk-LEBVQBDH.js} +83 -51
- package/dist/chunk-LEBVQBDH.js.map +1 -0
- package/dist/{chunk-X5ORR3FI.js → chunk-M7OOVEAR.js} +7 -7
- package/dist/chunk-MU7S7NU7.js +183 -0
- package/dist/chunk-MU7S7NU7.js.map +1 -0
- package/dist/{chunk-3JR2JRSV.js → chunk-N5MWY4H6.js} +2 -2
- package/dist/{chunk-3JR2JRSV.js.map → chunk-N5MWY4H6.js.map} +1 -1
- package/dist/{chunk-5VIBKVFO.js → chunk-U66QI3EN.js} +28 -18
- package/dist/chunk-U66QI3EN.js.map +1 -0
- package/dist/{chunk-XN2K7GED.js → chunk-XB6GU4CE.js} +32 -8
- package/dist/{chunk-XN2K7GED.js.map → chunk-XB6GU4CE.js.map} +1 -1
- package/dist/{chunk-SLAZCXFE.js → chunk-Y7EHQREO.js} +2 -2
- package/dist/{chunk-SLAZCXFE.js.map → chunk-Y7EHQREO.js.map} +1 -1
- package/dist/{controls-reader-Z7OQWYWQ.js → controls-reader-5MFHYBZZ.js} +4 -4
- package/dist/expo/plugin.cjs +97 -32
- package/dist/expo/plugin.cjs.map +1 -1
- package/dist/expo/plugin.js +1 -1
- package/dist/expo-babel-plugin.cjs +97 -32
- package/dist/expo-babel-plugin.cjs.map +1 -1
- package/dist/expo-babel-plugin.d.cts +2 -0
- package/dist/expo-babel-plugin.d.ts +2 -0
- package/dist/expo-babel-plugin.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -6
- 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 +126 -37
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +1 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.d.cts +2 -0
- package/dist/nextjs.d.ts +2 -0
- package/dist/nextjs.js +1 -1
- package/dist/nuxt/runtime/identity.js +1 -1
- package/dist/nuxt.js +230 -53
- package/dist/nuxt.js.map +1 -1
- package/dist/svelte.js +99 -24
- package/dist/svelte.js.map +1 -1
- package/dist/vue.js +120 -22
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2ZQMVAFM.js.map +0 -1
- package/dist/chunk-3XEEVCM3.js.map +0 -1
- package/dist/chunk-5M45Z7K6.js.map +0 -1
- package/dist/chunk-5VIBKVFO.js.map +0 -1
- package/dist/chunk-DNERBE7A.js.map +0 -1
- package/dist/chunk-H6BQZOAW.js +0 -121
- package/dist/chunk-H6BQZOAW.js.map +0 -1
- package/dist/chunk-H6OZIX2U.js.map +0 -1
- /package/dist/{chunk-I5MJ342V.js.map → chunk-CVUNZBRV.js.map} +0 -0
- /package/dist/{chunk-NXPP3CSM.js.map → chunk-FZVJVL3T.js.map} +0 -0
- /package/dist/{chunk-X5ORR3FI.js.map → chunk-M7OOVEAR.js.map} +0 -0
- /package/dist/{controls-reader-Z7OQWYWQ.js.map → controls-reader-5MFHYBZZ.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CSS_RUNTIME_MUTATION,
|
|
3
3
|
observeRuntimeMutations
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LEBVQBDH.js";
|
|
5
5
|
|
|
6
6
|
// ../../modules/iframe-projection/html/head-text.ts
|
|
7
7
|
function extractStyleSourceEvidence(text) {
|
|
@@ -161,11 +161,15 @@ function getHeadTracker() {
|
|
|
161
161
|
return instance;
|
|
162
162
|
}
|
|
163
163
|
var HeadSubscriptionImpl = class {
|
|
164
|
-
constructor(doc, callback, onUnsubscribe) {
|
|
164
|
+
constructor(doc, callback, onUnsubscribe, getRevision) {
|
|
165
165
|
this.hasMutations = false;
|
|
166
166
|
this.doc = doc;
|
|
167
167
|
this.callback = callback;
|
|
168
168
|
this.onUnsubscribe = onUnsubscribe;
|
|
169
|
+
this.getRevision = getRevision;
|
|
170
|
+
}
|
|
171
|
+
get revision() {
|
|
172
|
+
return this.getRevision();
|
|
169
173
|
}
|
|
170
174
|
flush(isInitial) {
|
|
171
175
|
if (!isInitial && !this.hasMutations) {
|
|
@@ -197,16 +201,23 @@ var HeadTrackerImpl = class {
|
|
|
197
201
|
docState = this.createDocObserver(doc);
|
|
198
202
|
this.docObservers.set(doc, docState);
|
|
199
203
|
}
|
|
200
|
-
const subscription = new HeadSubscriptionImpl(
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
const subscription = new HeadSubscriptionImpl(
|
|
205
|
+
doc,
|
|
206
|
+
onMutation,
|
|
207
|
+
() => {
|
|
208
|
+
this.unsubscribe(doc, subscription);
|
|
209
|
+
},
|
|
210
|
+
() => docState.revision
|
|
211
|
+
);
|
|
203
212
|
docState.subscriptions.add(subscription);
|
|
204
213
|
this.activeSubscriptions += 1;
|
|
205
214
|
return subscription;
|
|
206
215
|
}
|
|
207
216
|
createDocObserver(doc) {
|
|
208
217
|
const subscriptions = /* @__PURE__ */ new Set();
|
|
218
|
+
let revision = {};
|
|
209
219
|
const notify = (details) => {
|
|
220
|
+
revision = {};
|
|
210
221
|
for (const sub of subscriptions) {
|
|
211
222
|
sub.notifyMutation(details);
|
|
212
223
|
}
|
|
@@ -250,7 +261,14 @@ var HeadTrackerImpl = class {
|
|
|
250
261
|
return { observer, flushPending: () => changed(observer.takeRecords()) };
|
|
251
262
|
};
|
|
252
263
|
if (doc.head) {
|
|
253
|
-
return {
|
|
264
|
+
return {
|
|
265
|
+
...observeHead(doc.head),
|
|
266
|
+
subscriptions,
|
|
267
|
+
stopRuntime,
|
|
268
|
+
get revision() {
|
|
269
|
+
return revision;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
254
272
|
}
|
|
255
273
|
const attachHead = () => {
|
|
256
274
|
const head = doc.head;
|
|
@@ -262,6 +280,9 @@ var HeadTrackerImpl = class {
|
|
|
262
280
|
const bootstrap = new MutationObserver(attachHead);
|
|
263
281
|
bootstrap.observe(doc, { childList: true, subtree: true });
|
|
264
282
|
const state = {
|
|
283
|
+
get revision() {
|
|
284
|
+
return revision;
|
|
285
|
+
},
|
|
265
286
|
observer: bootstrap,
|
|
266
287
|
flushPending: attachHead,
|
|
267
288
|
subscriptions,
|
|
@@ -315,7 +336,8 @@ var HeadTrackerImpl = class {
|
|
|
315
336
|
const tagName = element.tagName;
|
|
316
337
|
if (INCLUDE_TAGS.has(tagName)) {
|
|
317
338
|
if (tagName === "LINK") {
|
|
318
|
-
|
|
339
|
+
const relChanged = mutation.type === "attributes" && mutation.attributeName === "rel";
|
|
340
|
+
if (!relChanged && !shouldIncludeLink(element)) continue;
|
|
319
341
|
}
|
|
320
342
|
relevant = true;
|
|
321
343
|
collectStylesheetPath(element);
|
|
@@ -583,6 +605,8 @@ function isAbsoluteUrl(url) {
|
|
|
583
605
|
}
|
|
584
606
|
|
|
585
607
|
export {
|
|
608
|
+
extractStyleSourceEvidence,
|
|
609
|
+
absolutifyCssReferences,
|
|
586
610
|
beginHeadCapture,
|
|
587
611
|
finishHeadCapture,
|
|
588
612
|
beginHeadSheet,
|
|
@@ -592,4 +616,4 @@ export {
|
|
|
592
616
|
isDisabledStylesheet,
|
|
593
617
|
resolveUrls
|
|
594
618
|
};
|
|
595
|
-
//# sourceMappingURL=chunk-
|
|
619
|
+
//# sourceMappingURL=chunk-XB6GU4CE.js.map
|
|
@@ -1 +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\nexport function absolutifyCssReferences(\n cssText: string,\n baseHref: 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 new URL(trimmed, baseHref).href;\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} 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 {\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 /** 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\n constructor(\n doc: Document,\n callback: (details: HeadMutationDetails) => void,\n onUnsubscribe: () => void,\n ) {\n this.doc = doc;\n this.callback = callback;\n this.onUnsubscribe = onUnsubscribe;\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 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(doc, onMutation, () => {\n this.unsubscribe(doc, subscription);\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\n const notify = (details: HeadMutationDetails): void => {\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 { ...observeHead(doc.head), subscriptions, stopRuntime };\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 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 if (!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 function captureHead(doc: Document, resource?: StyleResource): string {\n return captureHeadTiming(doc, (timing) =>\n captureHeadValue(doc, resource, timing),\n );\n}\n\nfunction captureHeadValue(\n doc: Document,\n resource?: StyleResource,\n timing?: HeadTiming,\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\") {\n if (!shouldIncludeLink(child)) continue;\n if (isDisabledStylesheet(child)) continue;\n }\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);\n }\n measureHead(sheetTiming, \"resolveUrls\", () => resolveUrls(clone, baseURI));\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 );\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));\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): Element {\n const link = source as HTMLLinkElement;\n const cssText = serializeCssRules(link.sheet, timing);\n if (cssText === null) {\n return clone;\n }\n\n const resolvedCss = measureHead(timing, \"resolveUrls\", () =>\n absolutifyCssReferences(cssText, link.href),\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.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): 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 const sheetTiming = beginHeadSheet(timing, \"adopted\");\n const cssText = serializeCssRules(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);\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 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 text = rules.map((rule) => rule.cssText).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\nexport function isDisabledStylesheet(element: Element): boolean {\n const link = element as HTMLLinkElement;\n return link.disabled || link.sheet?.disabled === true;\n}\n\n/**\n * Resolves relative URLs in an element to absolute URLs.\n */\nexport function resolveUrls(element: Element, baseURI: string): 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 // Resolve href attribute (for <link>, <base>)\n const href = element.getAttribute(\"href\");\n if (href && !isAbsoluteUrl(href)) {\n try {\n element.setAttribute(\"href\", new URL(href, baseURI).href);\n } catch {\n // Keep original href if URL resolution fails\n }\n }\n\n // Resolve src attribute (for future-proofing)\n const src = element.getAttribute(\"src\");\n if (src && !isAbsoluteUrl(src)) {\n try {\n element.setAttribute(\"src\", new URL(src, baseURI).href);\n } catch {\n // Keep original src 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,QAAM,YAAY;AAAA,IAChB,GAAG,KAAK,SAAS,kDAAkD;AAAA,EACrE,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AAClB,MAAI,CAAC,aAAa,UAAU,SAAS,OAAO,KAAM,QAAO;AACzD,QAAM,SACJ,gEAAgE;AAAA,IAC9D;AAAA,EACF;AACF,MAAI,CAAC,QAAQ;AAGX,QAAI;AACF,YAAM,MAAM,IAAI,IAAI,SAAS;AAC7B,UAAI,YAAY,KAAK,IAAI,QAAQ;AAC/B,cAAM,aAAa,sCAAsC,IAAI,IAAI;AAAA,IACrE,QAAQ;AAAA,IAAC;AACT,WAAO;AAAA,EACT;AACA,WAAS,QAAQ,KAAc,OAA8B;AAC3D,QAAI,CAAC,OAAO,OAAO,QAAQ,YAAY,QAAQ,GAAI,QAAO;AAC1D,UAAM,MAAM;AACZ,QAAI,IAAI,YAAY,EAAG,QAAO;AAC9B,UAAM,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eAAO,MAAM,aAAa,KAAK;AAAA,MACjC;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,kBAAkB,SAA2B;AAC3D,QAAM,MAAM,QAAQ,aAAa,KAAK;AACtC,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AACA,SAAO,IACJ,YAAY,EACZ,MAAM,KAAK,EACX,KAAK,CAAC,UAAU,kBAAkB,IAAI,KAAK,CAAC;AACjD;AAEO,SAAS,qBAAqB,SAA2B;AAC9D,QAAM,OAAO;AACb,SAAO,KAAK,YAAY,KAAK,OAAO,aAAa;AACnD;AAKO,SAAS,YAAY,SAAkB,SAAuB;AAKnE,QAAM,OAAO,QAAQ,aAAa,MAAM;AACxC,MAAI,QAAQ,CAAC,cAAc,IAAI,GAAG;AAChC,QAAI;AACF,cAAQ,aAAa,QAAQ,IAAI,IAAI,MAAM,OAAO,EAAE,IAAI;AAAA,IAC1D,QAAQ;AAAA,IAER;AAAA,EACF;AAGA,QAAM,MAAM,QAAQ,aAAa,KAAK;AACtC,MAAI,OAAO,CAAC,cAAc,GAAG,GAAG;AAC9B,QAAI;AACF,cAAQ,aAAa,OAAO,IAAI,IAAI,KAAK,OAAO,EAAE,IAAI;AAAA,IACxD,QAAQ;AAAA,IAER;AAAA,EACF;AACF;AAKA,SAAS,cAAc,KAAsB;AAC3C,SAAO,mBAAmB,KAAK,GAAG,KAAK,IAAI,WAAW,OAAO;AAC/D;","names":[]}
|
|
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\nexport function absolutifyCssReferences(\n cssText: string,\n baseHref: 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 new URL(trimmed, baseHref).href;\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} 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 {\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 function captureHead(doc: Document, resource?: StyleResource): string {\n return captureHeadTiming(doc, (timing) =>\n captureHeadValue(doc, resource, timing),\n );\n}\n\nfunction captureHeadValue(\n doc: Document,\n resource?: StyleResource,\n timing?: HeadTiming,\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\") {\n if (!shouldIncludeLink(child)) continue;\n if (isDisabledStylesheet(child)) continue;\n }\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);\n }\n measureHead(sheetTiming, \"resolveUrls\", () => resolveUrls(clone, baseURI));\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 );\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));\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): Element {\n const link = source as HTMLLinkElement;\n const cssText = serializeCssRules(link.sheet, timing);\n if (cssText === null) {\n return clone;\n }\n\n const resolvedCss = measureHead(timing, \"resolveUrls\", () =>\n absolutifyCssReferences(cssText, link.href),\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.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): 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 const sheetTiming = beginHeadSheet(timing, \"adopted\");\n const cssText = serializeCssRules(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);\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 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 text = rules.map((rule) => rule.cssText).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\nexport function isDisabledStylesheet(element: Element): boolean {\n const link = element as HTMLLinkElement;\n return link.disabled || link.sheet?.disabled === true;\n}\n\n/**\n * Resolves relative URLs in an element to absolute URLs.\n */\nexport function resolveUrls(element: Element, baseURI: string): 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 // Resolve href attribute (for <link>, <base>)\n const href = element.getAttribute(\"href\");\n if (href && !isAbsoluteUrl(href)) {\n try {\n element.setAttribute(\"href\", new URL(href, baseURI).href);\n } catch {\n // Keep original href if URL resolution fails\n }\n }\n\n // Resolve src attribute (for future-proofing)\n const src = element.getAttribute(\"src\");\n if (src && !isAbsoluteUrl(src)) {\n try {\n element.setAttribute(\"src\", new URL(src, baseURI).href);\n } catch {\n // Keep original src 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,QAAM,YAAY;AAAA,IAChB,GAAG,KAAK,SAAS,kDAAkD;AAAA,EACrE,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AAClB,MAAI,CAAC,aAAa,UAAU,SAAS,OAAO,KAAM,QAAO;AACzD,QAAM,SACJ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ACxC,MAAI,QAAQ,CAAC,cAAc,IAAI,GAAG;AAChC,QAAI;AACF,cAAQ,aAAa,QAAQ,IAAI,IAAI,MAAM,OAAO,EAAE,IAAI;AAAA,IAC1D,QAAQ;AAAA,IAER;AAAA,EACF;AAGA,QAAM,MAAM,QAAQ,aAAa,KAAK;AACtC,MAAI,OAAO,CAAC,cAAc,GAAG,GAAG;AAC9B,QAAI;AACF,cAAQ,aAAa,OAAO,IAAI,IAAI,KAAK,OAAO,EAAE,IAAI;AAAA,IACxD,QAAQ;AAAA,IAER;AAAA,EACF;AACF;AAKA,SAAS,cAAc,KAAsB;AAC3C,SAAO,mBAAmB,KAAK,GAAG,KAAK,IAAI,WAAW,OAAO;AAC/D;","names":[]}
|
|
@@ -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.93",
|
|
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-Y7EHQREO.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.89\",\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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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.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"],"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;AAAA,I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nB,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"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseAstroSource,
|
|
3
3
|
readAstroControls
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-U66QI3EN.js";
|
|
5
5
|
import "./chunk-EGRHWZRV.js";
|
|
6
6
|
import "./chunk-JVVHU3A7.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-FGWGY3G3.js";
|
|
8
|
+
import "./chunk-MU7S7NU7.js";
|
|
9
9
|
|
|
10
10
|
// astro/controls-reader.ts
|
|
11
11
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -189,4 +189,4 @@ ${binding}(${source.slice(argument.start, argument.end)});
|
|
|
189
189
|
export {
|
|
190
190
|
readAstroControlsMetadata
|
|
191
191
|
};
|
|
192
|
-
//# sourceMappingURL=controls-reader-
|
|
192
|
+
//# sourceMappingURL=controls-reader-5MFHYBZZ.js.map
|