tempo-sdk 0.0.77 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.js +3 -3
- package/dist/astro/asset-preview-client.js +3 -3
- package/dist/astro.js +2 -2
- package/dist/canvas/astro.js +3 -3
- package/dist/canvas/index.js +14 -9
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +4 -4
- package/dist/canvas/svelte.js +3 -3
- package/dist/canvas/vue.js +3 -3
- package/dist/{chunk-3T7FO57P.js → chunk-4XKABOQR.js} +2 -2
- package/dist/{chunk-6AAE4LYV.js → chunk-5M45Z7K6.js} +20 -5
- package/dist/{chunk-6AAE4LYV.js.map → chunk-5M45Z7K6.js.map} +1 -1
- package/dist/{chunk-PEY472AQ.js → chunk-6SCRM7WZ.js} +2 -2
- package/dist/{chunk-QSOCNVDB.js → chunk-AFA3RUX4.js} +2 -2
- package/dist/{chunk-QSOCNVDB.js.map → chunk-AFA3RUX4.js.map} +1 -1
- package/dist/{chunk-GPRSFFH2.js → chunk-D6LZ7Z3W.js} +2 -2
- package/dist/{chunk-GPRSFFH2.js.map → chunk-D6LZ7Z3W.js.map} +1 -1
- package/dist/{chunk-CXIW4IKC.js → chunk-I5MJ342V.js} +3 -3
- package/dist/{chunk-LZWIVA5H.js → chunk-PRVU3F6M.js} +2 -2
- package/dist/{chunk-LZWIVA5H.js.map → chunk-PRVU3F6M.js.map} +1 -1
- package/dist/{chunk-TDXWSVCZ.js → chunk-VUCDEJ4Q.js} +13 -9
- package/dist/chunk-VUCDEJ4Q.js.map +1 -0
- package/dist/{chunk-S4YKLZEY.js → chunk-WNQ7HYZN.js} +880 -15
- package/dist/chunk-WNQ7HYZN.js.map +1 -0
- package/dist/{chunk-WBMO4ZYO.js → chunk-XN2K7GED.js} +288 -129
- package/dist/chunk-XN2K7GED.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/nextjs/plugin.cjs +1 -1
- package/dist/nextjs/plugin.cjs.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs-loader.cjs +1 -1
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +1 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/nuxt/runtime/identity.js +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/vue.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-S4YKLZEY.js.map +0 -1
- package/dist/chunk-TDXWSVCZ.js.map +0 -1
- package/dist/chunk-WBMO4ZYO.js.map +0 -1
- /package/dist/{chunk-3T7FO57P.js.map → chunk-4XKABOQR.js.map} +0 -0
- /package/dist/{chunk-PEY472AQ.js.map → chunk-6SCRM7WZ.js.map} +0 -0
- /package/dist/{chunk-CXIW4IKC.js.map → chunk-I5MJ342V.js.map} +0 -0
|
@@ -1,7 +1,154 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CSS_RUNTIME_MUTATION,
|
|
3
3
|
observeRuntimeMutations
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5M45Z7K6.js";
|
|
5
|
+
|
|
6
|
+
// ../../modules/iframe-projection/html/head-text.ts
|
|
7
|
+
function extractStyleSourceEvidence(text) {
|
|
8
|
+
const attributes = {};
|
|
9
|
+
const clone = {
|
|
10
|
+
setAttribute: (key, value) => {
|
|
11
|
+
attributes[key] = value;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const reference = [
|
|
15
|
+
...text.matchAll(/\/\*[#@]\s*sourceMappingURL\s*=\s*(\S+?)\s*\*\//g)
|
|
16
|
+
].slice(-1)[0]?.[1];
|
|
17
|
+
if (!reference || reference.length > 1024 * 1024) return attributes;
|
|
18
|
+
const inline = /^data:application\/json(?:;charset=[\w-]+)?(;base64)?,(.*)$/is.exec(
|
|
19
|
+
reference
|
|
20
|
+
);
|
|
21
|
+
if (!inline) {
|
|
22
|
+
try {
|
|
23
|
+
const url = new URL(reference);
|
|
24
|
+
if (/^https?:$/.test(url.protocol))
|
|
25
|
+
clone.setAttribute("data-projection-css-source-map-url", url.href);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
return attributes;
|
|
29
|
+
}
|
|
30
|
+
function compact(raw, depth) {
|
|
31
|
+
if (!raw || typeof raw !== "object" || depth > 16) return null;
|
|
32
|
+
const map = raw;
|
|
33
|
+
if (map.version !== 3) return null;
|
|
34
|
+
const sources = Array.isArray(map.sources) && map.sources.length <= 4096 && map.sources.every((source) => typeof source === "string") ? map.sources : void 0;
|
|
35
|
+
const sections = Array.isArray(map.sections) && map.sections.length <= 256 ? map.sections.flatMap((section) => {
|
|
36
|
+
const nested = section && typeof section === "object" ? compact(section.map, depth + 1) : null;
|
|
37
|
+
return nested ? [{ map: nested }] : [];
|
|
38
|
+
}) : void 0;
|
|
39
|
+
return {
|
|
40
|
+
version: 3,
|
|
41
|
+
...typeof map.file === "string" ? { file: map.file } : {},
|
|
42
|
+
...typeof map.sourceRoot === "string" ? { sourceRoot: map.sourceRoot } : {},
|
|
43
|
+
...sources ? { sources } : {},
|
|
44
|
+
...sections ? { sections } : {}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const json = inline[1] ? new TextDecoder().decode(
|
|
49
|
+
Uint8Array.from(
|
|
50
|
+
atob(inline[2]),
|
|
51
|
+
(character) => character.charCodeAt(0)
|
|
52
|
+
)
|
|
53
|
+
) : decodeURIComponent(inline[2]);
|
|
54
|
+
const metadata = compact(JSON.parse(json), 0);
|
|
55
|
+
if (!metadata) return attributes;
|
|
56
|
+
const serialized = JSON.stringify(metadata);
|
|
57
|
+
if (serialized.length <= 64 * 1024)
|
|
58
|
+
clone.setAttribute("data-projection-css-source-map", serialized);
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
return attributes;
|
|
62
|
+
}
|
|
63
|
+
function absolutifyCssReferences(cssText, baseHref) {
|
|
64
|
+
const resolve = (value) => {
|
|
65
|
+
const trimmed = value.trim();
|
|
66
|
+
if (!trimmed || trimmed.startsWith("#") || /^(?:data|blob|javascript):/i.test(trimmed)) {
|
|
67
|
+
return /^javascript:/i.test(trimmed) ? "" : trimmed;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
return new URL(trimmed, baseHref).href;
|
|
71
|
+
} catch {
|
|
72
|
+
return trimmed;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return cssText.replace(
|
|
76
|
+
/url\(\s*(["']?)([^"')]+)\1\s*\)/gi,
|
|
77
|
+
(_match, quote, value) => `url(${quote}${resolve(value)}${quote})`
|
|
78
|
+
).replace(
|
|
79
|
+
/@import\s+(["'])([^"']+)\1/gi,
|
|
80
|
+
(_match, quote, value) => `@import ${quote}${resolve(value)}${quote}`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ../../modules/iframe-projection/html/head-capture-diagnostics.ts
|
|
85
|
+
var observers = /* @__PURE__ */ new WeakMap();
|
|
86
|
+
function measureHead(timing, stage, work) {
|
|
87
|
+
if (!timing) return work();
|
|
88
|
+
const start = performance.now();
|
|
89
|
+
try {
|
|
90
|
+
return work();
|
|
91
|
+
} finally {
|
|
92
|
+
const elapsed = performance.now() - start;
|
|
93
|
+
timing.report.stages[stage] = (timing.report.stages[stage] ?? 0) + elapsed;
|
|
94
|
+
if (timing.sheet)
|
|
95
|
+
timing.sheet.stages[stage] = (timing.sheet.stages[stage] ?? 0) + elapsed;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function beginHeadCapture(doc) {
|
|
99
|
+
const observer = observers.get(doc);
|
|
100
|
+
if (!observer) return;
|
|
101
|
+
return {
|
|
102
|
+
observer,
|
|
103
|
+
report: {
|
|
104
|
+
startedAt: Date.now(),
|
|
105
|
+
clockStart: performance.now(),
|
|
106
|
+
totalMs: 0,
|
|
107
|
+
unaccountedMs: 0,
|
|
108
|
+
cacheHits: 0,
|
|
109
|
+
cacheMisses: 0,
|
|
110
|
+
readWallMs: 0,
|
|
111
|
+
workerWallMs: 0,
|
|
112
|
+
stages: {},
|
|
113
|
+
sheets: [],
|
|
114
|
+
omittedSheets: 0
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function finishHeadCapture(doc, timing) {
|
|
119
|
+
if (observers.get(doc) !== timing.observer) return;
|
|
120
|
+
const report = timing.report;
|
|
121
|
+
report.totalMs = performance.now() - report.clockStart;
|
|
122
|
+
report.unaccountedMs = Math.max(
|
|
123
|
+
0,
|
|
124
|
+
report.totalMs - Object.values(report.stages).reduce((a, b) => a + b, 0)
|
|
125
|
+
);
|
|
126
|
+
try {
|
|
127
|
+
observers.get(doc)?.(report);
|
|
128
|
+
} catch {
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function captureHeadTiming(doc, capture) {
|
|
132
|
+
const timing = beginHeadCapture(doc);
|
|
133
|
+
try {
|
|
134
|
+
return capture(timing);
|
|
135
|
+
} finally {
|
|
136
|
+
if (timing) finishHeadCapture(doc, timing);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function beginHeadSheet(timing, kind) {
|
|
140
|
+
if (!timing) return;
|
|
141
|
+
const sheet = {
|
|
142
|
+
index: timing.report.sheets.length + timing.report.omittedSheets,
|
|
143
|
+
kind,
|
|
144
|
+
rules: 0,
|
|
145
|
+
characters: 0,
|
|
146
|
+
stages: {}
|
|
147
|
+
};
|
|
148
|
+
if (timing.report.sheets.length < 64) timing.report.sheets.push(sheet);
|
|
149
|
+
else timing.report.omittedSheets++;
|
|
150
|
+
return { report: timing.report, observer: timing.observer, sheet };
|
|
151
|
+
}
|
|
5
152
|
|
|
6
153
|
// ../../modules/iframe-projection/html/watch-head.ts
|
|
7
154
|
var INCLUDE_TAGS = /* @__PURE__ */ new Set(["STYLE", "META", "BASE", "LINK"]);
|
|
@@ -65,10 +212,26 @@ var HeadTrackerImpl = class {
|
|
|
65
212
|
}
|
|
66
213
|
};
|
|
67
214
|
const stopHooks = observeRuntimeMutations(doc);
|
|
68
|
-
const cssChanged = () =>
|
|
215
|
+
const cssChanged = (event) => {
|
|
216
|
+
const detail = event.detail;
|
|
217
|
+
notify({
|
|
218
|
+
stylesheetPaths: [],
|
|
219
|
+
elements: detail?.ownerNode ? [detail.ownerNode] : [],
|
|
220
|
+
sheets: detail?.sheet ? [detail.sheet] : [],
|
|
221
|
+
allStyles: !detail?.sheet,
|
|
222
|
+
mutable: detail?.mutable === true
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
const loaded = (event) => {
|
|
226
|
+
const target = event.target;
|
|
227
|
+
if (target instanceof HTMLLinkElement && shouldIncludeLink(target))
|
|
228
|
+
notify({ stylesheetPaths: [], elements: [target] });
|
|
229
|
+
};
|
|
230
|
+
doc.addEventListener("load", loaded, true);
|
|
69
231
|
doc.addEventListener(CSS_RUNTIME_MUTATION, cssChanged);
|
|
70
232
|
const stopRuntime = () => {
|
|
71
233
|
doc.removeEventListener(CSS_RUNTIME_MUTATION, cssChanged);
|
|
234
|
+
doc.removeEventListener("load", loaded, true);
|
|
72
235
|
stopHooks();
|
|
73
236
|
};
|
|
74
237
|
const observeHead = (head) => {
|
|
@@ -124,9 +287,11 @@ var HeadTrackerImpl = class {
|
|
|
124
287
|
readRelevantMutations(mutations, head) {
|
|
125
288
|
let relevant = false;
|
|
126
289
|
const stylesheetPaths = /* @__PURE__ */ new Set();
|
|
290
|
+
const elements = /* @__PURE__ */ new Set();
|
|
127
291
|
const collectStylesheetPath = (node) => {
|
|
128
292
|
const element = node instanceof Element ? node : node?.parentElement ?? null;
|
|
129
293
|
if (!element) return;
|
|
294
|
+
elements.add(element);
|
|
130
295
|
const candidates = [
|
|
131
296
|
element,
|
|
132
297
|
...element.querySelectorAll(
|
|
@@ -163,7 +328,7 @@ var HeadTrackerImpl = class {
|
|
|
163
328
|
for (const node of mutation.removedNodes) collectStylesheetPath(node);
|
|
164
329
|
}
|
|
165
330
|
}
|
|
166
|
-
return relevant ? { stylesheetPaths: [...stylesheetPaths] } : null;
|
|
331
|
+
return relevant ? { stylesheetPaths: [...stylesheetPaths], elements: [...elements] } : null;
|
|
167
332
|
}
|
|
168
333
|
destroy() {
|
|
169
334
|
for (const docState of this.docObservers.values()) {
|
|
@@ -181,24 +346,38 @@ var HeadTrackerImpl = class {
|
|
|
181
346
|
};
|
|
182
347
|
}
|
|
183
348
|
};
|
|
184
|
-
function serializeHeadStyle(style, resource) {
|
|
349
|
+
function serializeHeadStyle(style, resource, timing) {
|
|
185
350
|
const type = style.getAttribute("type")?.trim().toLowerCase();
|
|
186
|
-
const href = !type || type === "text/css" ?
|
|
351
|
+
const href = !type || type === "text/css" ? measureHead(
|
|
352
|
+
timing,
|
|
353
|
+
"resourceHash",
|
|
354
|
+
() => resource?.(style.textContent ?? "")
|
|
355
|
+
) : null;
|
|
187
356
|
if (href) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
357
|
+
return measureHead(timing, "serializeMarkup", () => {
|
|
358
|
+
const link = style.ownerDocument.createElement("link");
|
|
359
|
+
for (const attribute of Array.from(style.attributes))
|
|
360
|
+
if (!["type", "href", "rel", "integrity", "crossorigin"].includes(
|
|
361
|
+
attribute.name
|
|
362
|
+
))
|
|
363
|
+
link.setAttribute(attribute.name, attribute.value);
|
|
364
|
+
link.rel = "stylesheet";
|
|
365
|
+
link.href = href;
|
|
366
|
+
return link.outerHTML;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
return measureHead(timing, "serializeMarkup", () => {
|
|
370
|
+
escapeStyleForHtmlSerialization(style);
|
|
371
|
+
return style.outerHTML;
|
|
372
|
+
});
|
|
200
373
|
}
|
|
201
374
|
function captureHead(doc, resource) {
|
|
375
|
+
return captureHeadTiming(
|
|
376
|
+
doc,
|
|
377
|
+
(timing) => captureHeadValue(doc, resource, timing)
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
function captureHeadValue(doc, resource, timing) {
|
|
202
381
|
const head = doc.head;
|
|
203
382
|
if (!head) return "";
|
|
204
383
|
const baseURI = doc.baseURI;
|
|
@@ -217,51 +396,70 @@ function captureHead(doc, resource) {
|
|
|
217
396
|
continue;
|
|
218
397
|
}
|
|
219
398
|
}
|
|
220
|
-
|
|
221
|
-
|
|
399
|
+
const sheetTiming = tagName === "STYLE" || tagName === "LINK" ? beginHeadSheet(timing, tagName) : timing;
|
|
400
|
+
if (sheetTiming?.sheet) {
|
|
401
|
+
sheetTiming.sheet.source = (child.getAttribute("data-vite-dev-id") ?? child.getAttribute("href") ?? child.id).split(/[?#]/)[0].slice(0, 512);
|
|
402
|
+
}
|
|
403
|
+
let clone = measureHead(
|
|
404
|
+
sheetTiming,
|
|
405
|
+
"cloneNodes",
|
|
406
|
+
() => child.cloneNode(true)
|
|
407
|
+
);
|
|
408
|
+
materializeStyleElementCssom(child, clone, sheetTiming);
|
|
222
409
|
if (tagName === "LINK") {
|
|
223
|
-
clone = materializeStylesheetLinkCssom(child, clone);
|
|
410
|
+
clone = materializeStylesheetLinkCssom(child, clone, sheetTiming);
|
|
224
411
|
}
|
|
225
|
-
resolveUrls(clone, baseURI);
|
|
412
|
+
measureHead(sheetTiming, "resolveUrls", () => resolveUrls(clone, baseURI));
|
|
226
413
|
if (clone.tagName === "LINK") {
|
|
227
414
|
clone.removeAttribute("crossorigin");
|
|
228
415
|
} else if (clone.tagName === "STYLE") {
|
|
229
|
-
|
|
230
|
-
clone.textContent
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
416
|
+
measureHead(sheetTiming, "resolveUrls", () => {
|
|
417
|
+
clone.textContent = absolutifyCssReferences(
|
|
418
|
+
clone.textContent ?? "",
|
|
419
|
+
baseURI
|
|
420
|
+
);
|
|
421
|
+
});
|
|
422
|
+
fragments.push(serializeHeadStyle(clone, resource, sheetTiming));
|
|
234
423
|
continue;
|
|
235
424
|
}
|
|
236
|
-
fragments.push(
|
|
425
|
+
fragments.push(
|
|
426
|
+
measureHead(sheetTiming, "serializeMarkup", () => clone.outerHTML)
|
|
427
|
+
);
|
|
237
428
|
}
|
|
238
|
-
fragments.push(...captureAdoptedStyleSheets(doc, resource));
|
|
239
|
-
return fragments.join("\n");
|
|
429
|
+
fragments.push(...captureAdoptedStyleSheets(doc, resource, timing));
|
|
430
|
+
return measureHead(timing, "joinMarkup", () => fragments.join("\n"));
|
|
240
431
|
}
|
|
241
|
-
function materializeStylesheetLinkCssom(source, clone) {
|
|
432
|
+
function materializeStylesheetLinkCssom(source, clone, timing) {
|
|
242
433
|
const link = source;
|
|
243
|
-
const cssText = serializeCssRules(link.sheet);
|
|
434
|
+
const cssText = serializeCssRules(link.sheet, timing);
|
|
244
435
|
if (cssText === null) {
|
|
245
436
|
return clone;
|
|
246
437
|
}
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
438
|
+
const resolvedCss = measureHead(
|
|
439
|
+
timing,
|
|
440
|
+
"resolveUrls",
|
|
441
|
+
() => absolutifyCssReferences(cssText, link.href)
|
|
442
|
+
);
|
|
443
|
+
return measureHead(timing, "materializeNodes", () => {
|
|
444
|
+
const style = source.ownerDocument.createElement("style");
|
|
445
|
+
for (const attribute of Array.from(source.attributes)) {
|
|
446
|
+
if ([
|
|
447
|
+
"as",
|
|
448
|
+
"crossorigin",
|
|
449
|
+
"fetchpriority",
|
|
450
|
+
"href",
|
|
451
|
+
"integrity",
|
|
452
|
+
"referrerpolicy",
|
|
453
|
+
"rel"
|
|
454
|
+
].includes(attribute.name.toLowerCase())) {
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
style.setAttribute(attribute.name, attribute.value);
|
|
259
458
|
}
|
|
260
|
-
style.setAttribute(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return style;
|
|
459
|
+
style.setAttribute("data-projection-stylesheet-href", link.href);
|
|
460
|
+
style.textContent = resolvedCss;
|
|
461
|
+
return style;
|
|
462
|
+
});
|
|
265
463
|
}
|
|
266
464
|
var styleSourceEvidence = /* @__PURE__ */ new WeakMap();
|
|
267
465
|
function retainStyleSourceEvidence(source, clone) {
|
|
@@ -288,116 +486,71 @@ function retainStyleSourceEvidence(source, clone) {
|
|
|
288
486
|
});
|
|
289
487
|
}
|
|
290
488
|
function captureStyleSourceEvidence(text, clone) {
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
].slice(-1)[0]?.[1];
|
|
294
|
-
if (!reference || reference.length > 1024 * 1024) return;
|
|
295
|
-
const inline = /^data:application\/json(?:;charset=[\w-]+)?(;base64)?,(.*)$/is.exec(
|
|
296
|
-
reference
|
|
297
|
-
);
|
|
298
|
-
if (!inline) {
|
|
299
|
-
try {
|
|
300
|
-
const url = new URL(reference);
|
|
301
|
-
if (/^https?:$/.test(url.protocol))
|
|
302
|
-
clone.setAttribute("data-projection-css-source-map-url", url.href);
|
|
303
|
-
} catch {
|
|
304
|
-
}
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
function compact(raw, depth) {
|
|
308
|
-
if (!raw || typeof raw !== "object" || depth > 16) return null;
|
|
309
|
-
const map = raw;
|
|
310
|
-
if (map.version !== 3) return null;
|
|
311
|
-
const sources = Array.isArray(map.sources) && map.sources.length <= 4096 && map.sources.every((source) => typeof source === "string") ? map.sources : void 0;
|
|
312
|
-
const sections = Array.isArray(map.sections) && map.sections.length <= 256 ? map.sections.flatMap((section) => {
|
|
313
|
-
const nested = section && typeof section === "object" ? compact(section.map, depth + 1) : null;
|
|
314
|
-
return nested ? [{ map: nested }] : [];
|
|
315
|
-
}) : void 0;
|
|
316
|
-
return {
|
|
317
|
-
version: 3,
|
|
318
|
-
...typeof map.file === "string" ? { file: map.file } : {},
|
|
319
|
-
...typeof map.sourceRoot === "string" ? { sourceRoot: map.sourceRoot } : {},
|
|
320
|
-
...sources ? { sources } : {},
|
|
321
|
-
...sections ? { sections } : {}
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
try {
|
|
325
|
-
const json = inline[1] ? new TextDecoder().decode(
|
|
326
|
-
Uint8Array.from(
|
|
327
|
-
atob(inline[2]),
|
|
328
|
-
(character) => character.charCodeAt(0)
|
|
329
|
-
)
|
|
330
|
-
) : decodeURIComponent(inline[2]);
|
|
331
|
-
const metadata = compact(JSON.parse(json), 0);
|
|
332
|
-
if (!metadata) return;
|
|
333
|
-
const serialized = JSON.stringify(metadata);
|
|
334
|
-
if (serialized.length <= 64 * 1024)
|
|
335
|
-
clone.setAttribute("data-projection-css-source-map", serialized);
|
|
336
|
-
} catch {
|
|
337
|
-
}
|
|
489
|
+
for (const [key, value] of Object.entries(extractStyleSourceEvidence(text)))
|
|
490
|
+
clone.setAttribute(key, value);
|
|
338
491
|
}
|
|
339
|
-
function materializeStyleElementCssom(source, clone) {
|
|
492
|
+
function materializeStyleElementCssom(source, clone, timing) {
|
|
340
493
|
if (source.tagName !== "STYLE" || clone.tagName !== "STYLE") {
|
|
341
494
|
return;
|
|
342
495
|
}
|
|
343
496
|
const style = source;
|
|
344
|
-
|
|
345
|
-
|
|
497
|
+
measureHead(
|
|
498
|
+
timing,
|
|
499
|
+
"sourceMetadata",
|
|
500
|
+
() => retainStyleSourceEvidence(style, clone)
|
|
501
|
+
);
|
|
502
|
+
const cssText = serializeCssRules(style.sheet, timing);
|
|
346
503
|
if (cssText !== null) {
|
|
347
|
-
|
|
504
|
+
measureHead(timing, "materializeNodes", () => {
|
|
505
|
+
clone.textContent = cssText;
|
|
506
|
+
});
|
|
348
507
|
}
|
|
349
508
|
}
|
|
350
|
-
function captureAdoptedStyleSheets(doc, resource) {
|
|
509
|
+
function captureAdoptedStyleSheets(doc, resource, timing) {
|
|
351
510
|
const sheets = Array.from(doc.adoptedStyleSheets ?? []);
|
|
352
511
|
if (sheets.length === 0) {
|
|
353
512
|
return [];
|
|
354
513
|
}
|
|
355
514
|
const fragments = [];
|
|
356
515
|
for (const sheet of sheets) {
|
|
357
|
-
const
|
|
516
|
+
const sheetTiming = beginHeadSheet(timing, "adopted");
|
|
517
|
+
const cssText = serializeCssRules(sheet, sheetTiming);
|
|
358
518
|
if (!cssText) {
|
|
359
519
|
continue;
|
|
360
520
|
}
|
|
361
|
-
const style =
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
521
|
+
const style = measureHead(sheetTiming, "materializeNodes", () => {
|
|
522
|
+
const node = doc.createElement("style");
|
|
523
|
+
node.setAttribute("data-projection-adopted-stylesheet", "true");
|
|
524
|
+
return node;
|
|
525
|
+
});
|
|
526
|
+
measureHead(sheetTiming, "resolveUrls", () => {
|
|
527
|
+
style.textContent = absolutifyCssReferences(cssText, doc.baseURI);
|
|
528
|
+
});
|
|
529
|
+
fragments.push(serializeHeadStyle(style, resource, sheetTiming));
|
|
365
530
|
}
|
|
366
531
|
return fragments;
|
|
367
532
|
}
|
|
368
533
|
function escapeStyleForHtmlSerialization(style) {
|
|
369
534
|
style.textContent = (style.textContent ?? "").replace(/<\//gi, "<\\/");
|
|
370
535
|
}
|
|
371
|
-
function serializeCssRules(sheet) {
|
|
536
|
+
function serializeCssRules(sheet, timing) {
|
|
372
537
|
if (!sheet) {
|
|
373
538
|
return null;
|
|
374
539
|
}
|
|
375
540
|
try {
|
|
376
|
-
return
|
|
541
|
+
return measureHead(timing, "readCssRules", () => {
|
|
542
|
+
const rules = Array.from(sheet.cssRules);
|
|
543
|
+
const text = rules.map((rule) => rule.cssText).join("\n");
|
|
544
|
+
if (timing?.sheet) {
|
|
545
|
+
timing.sheet.rules = rules.length;
|
|
546
|
+
timing.sheet.characters = text.length;
|
|
547
|
+
}
|
|
548
|
+
return text;
|
|
549
|
+
});
|
|
377
550
|
} catch {
|
|
378
551
|
return null;
|
|
379
552
|
}
|
|
380
553
|
}
|
|
381
|
-
function absolutifyCssReferences(cssText, baseHref) {
|
|
382
|
-
const resolve = (value) => {
|
|
383
|
-
const trimmed = value.trim();
|
|
384
|
-
if (!trimmed || trimmed.startsWith("#") || /^(?:data|blob|javascript):/i.test(trimmed)) {
|
|
385
|
-
return /^javascript:/i.test(trimmed) ? "" : trimmed;
|
|
386
|
-
}
|
|
387
|
-
try {
|
|
388
|
-
return new URL(trimmed, baseHref).href;
|
|
389
|
-
} catch {
|
|
390
|
-
return trimmed;
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
return cssText.replace(
|
|
394
|
-
/url\(\s*(["']?)([^"')]+)\1\s*\)/gi,
|
|
395
|
-
(_match, quote, value) => `url(${quote}${resolve(value)}${quote})`
|
|
396
|
-
).replace(
|
|
397
|
-
/@import\s+(["'])([^"']+)\1/gi,
|
|
398
|
-
(_match, quote, value) => `@import ${quote}${resolve(value)}${quote}`
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
554
|
function shouldIncludeLink(element) {
|
|
402
555
|
const rel = element.getAttribute("rel");
|
|
403
556
|
if (!rel) {
|
|
@@ -430,7 +583,13 @@ function isAbsoluteUrl(url) {
|
|
|
430
583
|
}
|
|
431
584
|
|
|
432
585
|
export {
|
|
586
|
+
beginHeadCapture,
|
|
587
|
+
finishHeadCapture,
|
|
588
|
+
beginHeadSheet,
|
|
433
589
|
getHeadTracker,
|
|
434
|
-
captureHead
|
|
590
|
+
captureHead,
|
|
591
|
+
shouldIncludeLink,
|
|
592
|
+
isDisabledStylesheet,
|
|
593
|
+
resolveUrls
|
|
435
594
|
};
|
|
436
|
-
//# sourceMappingURL=chunk-
|
|
595
|
+
//# sourceMappingURL=chunk-XN2K7GED.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../modules/iframe-projection/html/head-text.ts","../../../modules/iframe-projection/html/head-capture-diagnostics.ts","../../../modules/iframe-projection/html/watch-head.ts"],"sourcesContent":["/** Pure stylesheet text processing shared with the source worker. */\nexport function extractStyleSourceEvidence(\n text: string,\n): Record<string, string> {\n const attributes: Record<string, string> = {};\n const clone = {\n setAttribute: (key: string, value: string) => {\n attributes[key] = value;\n },\n };\n const reference = [\n ...text.matchAll(/\\/\\*[#@]\\s*sourceMappingURL\\s*=\\s*(\\S+?)\\s*\\*\\//g),\n ].slice(-1)[0]?.[1];\n if (!reference || reference.length > 1024 * 1024) return attributes;\n const inline =\n /^data:application\\/json(?:;charset=[\\w-]+)?(;base64)?,(.*)$/is.exec(\n reference,\n );\n if (!inline) {\n // A detached inline style has no proven relative map base. Absolute URLs\n // can be admitted later against the existing app/server source origin.\n try {\n const url = new URL(reference);\n if (/^https?:$/.test(url.protocol))\n clone.setAttribute(\"data-projection-css-source-map-url\", url.href);\n } catch {}\n return attributes;\n }\n function compact(raw: unknown, depth: number): object | null {\n if (!raw || typeof raw !== \"object\" || depth > 16) return null;\n const map = raw as Record<string, unknown>;\n if (map.version !== 3) return null;\n const sources =\n Array.isArray(map.sources) &&\n map.sources.length <= 4096 &&\n map.sources.every((source) => typeof source === \"string\")\n ? map.sources\n : undefined;\n const sections =\n Array.isArray(map.sections) && map.sections.length <= 256\n ? map.sections.flatMap((section) => {\n const nested =\n section && typeof section === \"object\"\n ? compact(section.map, depth + 1)\n : null;\n return nested ? [{ map: nested }] : [];\n })\n : undefined;\n return {\n version: 3,\n ...(typeof map.file === \"string\" ? { file: map.file } : {}),\n ...(typeof map.sourceRoot === \"string\"\n ? { sourceRoot: map.sourceRoot }\n : {}),\n ...(sources ? { sources } : {}),\n ...(sections ? { sections } : {}),\n };\n }\n try {\n const json = inline[1]\n ? new TextDecoder().decode(\n Uint8Array.from(atob(inline[2]!), (character) =>\n character.charCodeAt(0),\n ),\n )\n : decodeURIComponent(inline[2]!);\n const metadata = compact(JSON.parse(json), 0);\n if (!metadata) return attributes;\n const serialized = JSON.stringify(metadata);\n if (serialized.length <= 64 * 1024)\n clone.setAttribute(\"data-projection-css-source-map\", serialized);\n } catch {}\n return attributes;\n}\n\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,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AO;AAC/D;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
tempoAnnotate,
|
|
3
3
|
tempoVitePlugin
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4XKABOQR.js";
|
|
5
5
|
import "./chunk-PYAJHLXO.js";
|
|
6
6
|
import "./chunk-DI2ZFAWL.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-PRVU3F6M.js";
|
|
8
8
|
import "./chunk-UBTL6JUF.js";
|
|
9
9
|
import "./chunk-H6OZIX2U.js";
|
|
10
10
|
import "./chunk-H6BQZOAW.js";
|