@hyperframes/producer 0.10.7 → 0.10.8
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/compileWorker.js +74 -18
- package/dist/distributed.js +79 -20
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +70 -70
- package/dist/index.js +85 -23
- package/dist/public-server.js +85 -23
- package/dist/services/htmlCompiler.d.ts +2 -0
- package/dist/services/render/observability.d.ts +1 -0
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -3448,7 +3448,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
3448
3448
|
const domPng = await timeHdrPhaseAsync(
|
|
3449
3449
|
hdrPerf,
|
|
3450
3450
|
"domScreenshotMs",
|
|
3451
|
-
() => captureAlphaPng(domSession.page, width, height)
|
|
3451
|
+
() => captureAlphaPng(domSession.page, width, height, domSession.options?.onScreenshotRetry)
|
|
3452
3452
|
);
|
|
3453
3453
|
await timeHdrPhaseAsync(
|
|
3454
3454
|
hdrPerf,
|
|
@@ -4173,7 +4173,7 @@ async function captureSceneIntoBuffer(a) {
|
|
|
4173
4173
|
const domPng = await timeHdrPhaseAsync(
|
|
4174
4174
|
hdrPerf,
|
|
4175
4175
|
"domScreenshotMs",
|
|
4176
|
-
() => captureAlphaPng2(session.page, width, height)
|
|
4176
|
+
() => captureAlphaPng2(session.page, width, height, session.options?.onScreenshotRetry)
|
|
4177
4177
|
);
|
|
4178
4178
|
await timeHdrPhaseAsync(
|
|
4179
4179
|
hdrPerf,
|
|
@@ -4526,6 +4526,7 @@ async function validateCompletedSegments(manifest, check) {
|
|
|
4526
4526
|
}
|
|
4527
4527
|
|
|
4528
4528
|
// src/services/render/segmentRecycle.ts
|
|
4529
|
+
import { isTransientScreenshotRefusal } from "@hyperframes/engine";
|
|
4529
4530
|
var DEFAULT_SEGMENT_BROWSER_RECYCLE = 3;
|
|
4530
4531
|
function resolveSegmentBrowserRecycle(env) {
|
|
4531
4532
|
const raw = env.HF_SEGMENT_BROWSER_RECYCLE;
|
|
@@ -4536,7 +4537,7 @@ function resolveSegmentBrowserRecycle(env) {
|
|
|
4536
4537
|
var TARGET_LOSS_PATTERNS = [/target closed/i, /detached frame/i, /session closed/i];
|
|
4537
4538
|
function isTargetLossError(error) {
|
|
4538
4539
|
if (!(error instanceof Error)) return false;
|
|
4539
|
-
return TARGET_LOSS_PATTERNS.some((re) => re.test(error.message));
|
|
4540
|
+
return TARGET_LOSS_PATTERNS.some((re) => re.test(error.message)) || isTransientScreenshotRefusal(error);
|
|
4540
4541
|
}
|
|
4541
4542
|
|
|
4542
4543
|
// src/services/render/stages/captureStreamingStage.ts
|
|
@@ -7618,7 +7619,8 @@ import {
|
|
|
7618
7619
|
isPrivateUnderAssetRoots as isPrivateUnderAssetRoots3,
|
|
7619
7620
|
NotMediaPayloadError as NotMediaPayloadError2,
|
|
7620
7621
|
parseMasterFxChain,
|
|
7621
|
-
probeMediaProfile as probeMediaProfile2
|
|
7622
|
+
probeMediaProfile as probeMediaProfile2,
|
|
7623
|
+
resolveRestrictPageNetwork
|
|
7622
7624
|
} from "@hyperframes/engine";
|
|
7623
7625
|
|
|
7624
7626
|
// src/utils/urlDownloader.ts
|
|
@@ -9458,16 +9460,61 @@ function operatorGsapMirror() {
|
|
|
9458
9460
|
return void 0;
|
|
9459
9461
|
}
|
|
9460
9462
|
}
|
|
9463
|
+
var MIRROR_GSAP_FILE = /^gsap@\d+(?:\.\d+)*\/dist\/[A-Za-z0-9][\w-]*(?:\.[\w-]+)*\.js$/;
|
|
9464
|
+
function isOperatorMirrorGsapUrl(src, mirror) {
|
|
9465
|
+
if (!mirror || /[?#%\\]/.test(src) || !URL.canParse(src)) return false;
|
|
9466
|
+
const url = new URL(src);
|
|
9467
|
+
if (url.search || url.hash || !url.href.startsWith(mirror)) return false;
|
|
9468
|
+
return MIRROR_GSAP_FILE.test(url.href.slice(mirror.length));
|
|
9469
|
+
}
|
|
9470
|
+
var warnedRestrictedMirror = false;
|
|
9471
|
+
function mirrorExemptionAllowed() {
|
|
9472
|
+
if (!resolveRestrictPageNetwork()) return true;
|
|
9473
|
+
if (!warnedRestrictedMirror) {
|
|
9474
|
+
warnedRestrictedMirror = true;
|
|
9475
|
+
defaultLogger.warn(
|
|
9476
|
+
"[Compiler] PRODUCER_RESTRICT_PAGE_NETWORK is on, so HYPERFRAMES_GSAP_BASE_URL is fetched only from a public HTTPS address."
|
|
9477
|
+
);
|
|
9478
|
+
}
|
|
9479
|
+
return false;
|
|
9480
|
+
}
|
|
9481
|
+
async function readCappedBody(response, src) {
|
|
9482
|
+
const tooLarge = () => new Error(`Script over 16 MiB: ${src}`);
|
|
9483
|
+
const declared = Number(response.headers.get("content-length"));
|
|
9484
|
+
if (Number.isFinite(declared) && declared > MAX_SCRIPT_BYTES) {
|
|
9485
|
+
await response.body?.cancel().catch(() => {
|
|
9486
|
+
});
|
|
9487
|
+
throw tooLarge();
|
|
9488
|
+
}
|
|
9489
|
+
if (!response.body) return new Uint8Array();
|
|
9490
|
+
const reader = response.body.getReader();
|
|
9491
|
+
const chunks = [];
|
|
9492
|
+
let received = 0;
|
|
9493
|
+
for (; ; ) {
|
|
9494
|
+
const { done, value } = await reader.read();
|
|
9495
|
+
if (done) break;
|
|
9496
|
+
received += value.byteLength;
|
|
9497
|
+
if (received > MAX_SCRIPT_BYTES) {
|
|
9498
|
+
await reader.cancel().catch(() => {
|
|
9499
|
+
});
|
|
9500
|
+
throw tooLarge();
|
|
9501
|
+
}
|
|
9502
|
+
chunks.push(value);
|
|
9503
|
+
}
|
|
9504
|
+
return Buffer.concat(chunks);
|
|
9505
|
+
}
|
|
9461
9506
|
async function downloadScript(src, mirror, signal) {
|
|
9462
|
-
if (mirror &&
|
|
9463
|
-
const response = await fetch(src, {
|
|
9507
|
+
if (isOperatorMirrorGsapUrl(src, mirror) && mirrorExemptionAllowed()) {
|
|
9508
|
+
const response = await fetch(new URL(src).href, {
|
|
9464
9509
|
redirect: "error",
|
|
9465
9510
|
signal: AbortSignal.any([AbortSignal.timeout(15e3), signal])
|
|
9466
9511
|
});
|
|
9467
|
-
if (!response.ok)
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9512
|
+
if (!response.ok) {
|
|
9513
|
+
await response.body?.cancel().catch(() => {
|
|
9514
|
+
});
|
|
9515
|
+
throw new Error(`HTTP ${response.status} for ${src}`);
|
|
9516
|
+
}
|
|
9517
|
+
return readCappedBody(response, src);
|
|
9471
9518
|
}
|
|
9472
9519
|
return fetchPublicHttpsBytes(src, { maxBytes: MAX_SCRIPT_BYTES, timeoutMs: 15e3, signal });
|
|
9473
9520
|
}
|
|
@@ -9791,15 +9838,22 @@ function matchingBraces(css) {
|
|
|
9791
9838
|
}
|
|
9792
9839
|
return closes;
|
|
9793
9840
|
}
|
|
9794
|
-
|
|
9795
|
-
|
|
9841
|
+
var attributeInAnyCase = (el, name) => [...el.attributes].find((attribute) => attribute.name.toLowerCase() === name)?.value;
|
|
9842
|
+
var WHERE_A_BROWSER_LOADS_NO_LINK = "noscript, iframe, noembed, noframes, plaintext, svg, math";
|
|
9843
|
+
function remoteFontStylesheetHref(link) {
|
|
9844
|
+
if (attributeInAnyCase(link, "rel")?.toLowerCase() !== "stylesheet") return void 0;
|
|
9845
|
+
if (link.closest(WHERE_A_BROWSER_LOADS_NO_LINK)) return void 0;
|
|
9846
|
+
const href = attributeInAnyCase(link, "href");
|
|
9796
9847
|
if (!href || !/^https?:\/\//i.test(href) || isGoogleFontsUrl(href)) return void 0;
|
|
9797
9848
|
return href;
|
|
9798
9849
|
}
|
|
9799
9850
|
async function inlineExternalFontStylesheets(html, budget = new CompositionExpansionBudget(), signal) {
|
|
9851
|
+
if (!/<link\b/i.test(html)) return html;
|
|
9852
|
+
const { document: document2 } = parseHTML5(html);
|
|
9853
|
+
const linkElements = [...document2.querySelectorAll("link")];
|
|
9800
9854
|
const hrefs = /* @__PURE__ */ new Set();
|
|
9801
|
-
for (const
|
|
9802
|
-
const href = remoteFontStylesheetHref(
|
|
9855
|
+
for (const link of linkElements) {
|
|
9856
|
+
const href = remoteFontStylesheetHref(link);
|
|
9803
9857
|
if (href) hrefs.add(href);
|
|
9804
9858
|
}
|
|
9805
9859
|
if (hrefs.size === 0) return html;
|
|
@@ -9814,9 +9868,9 @@ async function inlineExternalFontStylesheets(html, budget = new CompositionExpan
|
|
|
9814
9868
|
const fontFaceBlocks = css ? extractFontFaceBlocks(css) : [];
|
|
9815
9869
|
if (fontFaceBlocks.length === 0) return;
|
|
9816
9870
|
const fontCssWithLtAsCssEscape = fontFaceBlocks.join("\n").replace(/</g, "\\3c ");
|
|
9817
|
-
const inlineStyle =
|
|
9871
|
+
const inlineStyle = `/* Inlined external font stylesheet */
|
|
9818
9872
|
${fontCssWithLtAsCssEscape}
|
|
9819
|
-
|
|
9873
|
+
`;
|
|
9820
9874
|
try {
|
|
9821
9875
|
budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
|
|
9822
9876
|
} catch (error) {
|
|
@@ -9834,14 +9888,17 @@ ${fontCssWithLtAsCssEscape}
|
|
|
9834
9888
|
await Promise.allSettled([...hrefs].map((href) => limit(() => inlineSheet(href), fetchSignal)));
|
|
9835
9889
|
if (stop.signal.aborted) throw stop.signal.reason;
|
|
9836
9890
|
const placed = /* @__PURE__ */ new Set();
|
|
9837
|
-
|
|
9838
|
-
const href = remoteFontStylesheetHref(
|
|
9891
|
+
for (const link of linkElements) {
|
|
9892
|
+
const href = remoteFontStylesheetHref(link);
|
|
9839
9893
|
const inlineStyle = href ? inlineByHref.get(href) : void 0;
|
|
9840
|
-
if (!href || !inlineStyle)
|
|
9894
|
+
if (!href || !inlineStyle) continue;
|
|
9841
9895
|
if (placed.has(href)) budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
|
|
9842
9896
|
placed.add(href);
|
|
9843
|
-
|
|
9844
|
-
|
|
9897
|
+
const style = document2.createElement("style");
|
|
9898
|
+
style.textContent = inlineStyle;
|
|
9899
|
+
link.replaceWith(style);
|
|
9900
|
+
}
|
|
9901
|
+
return placed.size === 0 ? html : document2.toString();
|
|
9845
9902
|
}
|
|
9846
9903
|
function projectStylesheetFontFamilies(html, projectDir) {
|
|
9847
9904
|
const families = [];
|
|
@@ -12226,7 +12283,7 @@ import {
|
|
|
12226
12283
|
assetRootsRefusal,
|
|
12227
12284
|
assertPublicHttpsUrl,
|
|
12228
12285
|
downloadToTemp as downloadToTemp2,
|
|
12229
|
-
resolveRestrictPageNetwork,
|
|
12286
|
+
resolveRestrictPageNetwork as resolveRestrictPageNetwork2,
|
|
12230
12287
|
isUrlNotPermittedError,
|
|
12231
12288
|
writeUrlDownloadTelemetry as writeUrlDownloadTelemetry2,
|
|
12232
12289
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc5,
|
|
@@ -12679,7 +12736,7 @@ function localProbeSource(src, input) {
|
|
|
12679
12736
|
}
|
|
12680
12737
|
async function remoteProbeSource(video, input) {
|
|
12681
12738
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
12682
|
-
if (!
|
|
12739
|
+
if (!resolveRestrictPageNetwork2()) return video.src;
|
|
12683
12740
|
if (!video.hasAudio || video.hidden) return null;
|
|
12684
12741
|
const downloadDir = input.downloadDir ?? join26(input.compiledDir, REMOTE_MEDIA_SUBDIR);
|
|
12685
12742
|
try {
|
|
@@ -17194,6 +17251,7 @@ async function executeRenderPipeline(input) {
|
|
|
17194
17251
|
updateCaptureObservability({ captureBeyondViewport: resolvedCaptureBeyondViewport });
|
|
17195
17252
|
}
|
|
17196
17253
|
let routePageMotionBlur;
|
|
17254
|
+
let screenshotRetries = 0;
|
|
17197
17255
|
const buildCaptureOptions = () => ({
|
|
17198
17256
|
...captureOptions,
|
|
17199
17257
|
recordReferenceBackground,
|
|
@@ -17233,6 +17291,10 @@ async function executeRenderPipeline(input) {
|
|
|
17233
17291
|
chromeGpuProcessSeenLastSample: stats.gpuProcessSeenLastSample,
|
|
17234
17292
|
chromeMemorySamples: stats.samples
|
|
17235
17293
|
});
|
|
17294
|
+
},
|
|
17295
|
+
onScreenshotRetry: () => {
|
|
17296
|
+
screenshotRetries += 1;
|
|
17297
|
+
updateCaptureObservability({ screenshotRetries });
|
|
17236
17298
|
}
|
|
17237
17299
|
});
|
|
17238
17300
|
const buildPrepCaptureOptions = () => stopPrepSessionOnScriptFailure(buildCaptureOptions());
|
package/dist/public-server.js
CHANGED
|
@@ -3486,7 +3486,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
3486
3486
|
const domPng = await timeHdrPhaseAsync(
|
|
3487
3487
|
hdrPerf,
|
|
3488
3488
|
"domScreenshotMs",
|
|
3489
|
-
() => captureAlphaPng(domSession.page, width, height)
|
|
3489
|
+
() => captureAlphaPng(domSession.page, width, height, domSession.options?.onScreenshotRetry)
|
|
3490
3490
|
);
|
|
3491
3491
|
await timeHdrPhaseAsync(
|
|
3492
3492
|
hdrPerf,
|
|
@@ -4211,7 +4211,7 @@ async function captureSceneIntoBuffer(a) {
|
|
|
4211
4211
|
const domPng = await timeHdrPhaseAsync(
|
|
4212
4212
|
hdrPerf,
|
|
4213
4213
|
"domScreenshotMs",
|
|
4214
|
-
() => captureAlphaPng2(session.page, width, height)
|
|
4214
|
+
() => captureAlphaPng2(session.page, width, height, session.options?.onScreenshotRetry)
|
|
4215
4215
|
);
|
|
4216
4216
|
await timeHdrPhaseAsync(
|
|
4217
4217
|
hdrPerf,
|
|
@@ -4564,6 +4564,7 @@ async function validateCompletedSegments(manifest, check) {
|
|
|
4564
4564
|
}
|
|
4565
4565
|
|
|
4566
4566
|
// src/services/render/segmentRecycle.ts
|
|
4567
|
+
import { isTransientScreenshotRefusal } from "@hyperframes/engine";
|
|
4567
4568
|
var DEFAULT_SEGMENT_BROWSER_RECYCLE = 3;
|
|
4568
4569
|
function resolveSegmentBrowserRecycle(env) {
|
|
4569
4570
|
const raw = env.HF_SEGMENT_BROWSER_RECYCLE;
|
|
@@ -4574,7 +4575,7 @@ function resolveSegmentBrowserRecycle(env) {
|
|
|
4574
4575
|
var TARGET_LOSS_PATTERNS = [/target closed/i, /detached frame/i, /session closed/i];
|
|
4575
4576
|
function isTargetLossError(error) {
|
|
4576
4577
|
if (!(error instanceof Error)) return false;
|
|
4577
|
-
return TARGET_LOSS_PATTERNS.some((re) => re.test(error.message));
|
|
4578
|
+
return TARGET_LOSS_PATTERNS.some((re) => re.test(error.message)) || isTransientScreenshotRefusal(error);
|
|
4578
4579
|
}
|
|
4579
4580
|
|
|
4580
4581
|
// src/services/render/stages/captureStreamingStage.ts
|
|
@@ -7640,7 +7641,8 @@ import {
|
|
|
7640
7641
|
isPrivateUnderAssetRoots as isPrivateUnderAssetRoots3,
|
|
7641
7642
|
NotMediaPayloadError as NotMediaPayloadError2,
|
|
7642
7643
|
parseMasterFxChain,
|
|
7643
|
-
probeMediaProfile as probeMediaProfile2
|
|
7644
|
+
probeMediaProfile as probeMediaProfile2,
|
|
7645
|
+
resolveRestrictPageNetwork
|
|
7644
7646
|
} from "@hyperframes/engine";
|
|
7645
7647
|
|
|
7646
7648
|
// src/utils/urlDownloader.ts
|
|
@@ -9480,16 +9482,61 @@ function operatorGsapMirror() {
|
|
|
9480
9482
|
return void 0;
|
|
9481
9483
|
}
|
|
9482
9484
|
}
|
|
9485
|
+
var MIRROR_GSAP_FILE = /^gsap@\d+(?:\.\d+)*\/dist\/[A-Za-z0-9][\w-]*(?:\.[\w-]+)*\.js$/;
|
|
9486
|
+
function isOperatorMirrorGsapUrl(src, mirror) {
|
|
9487
|
+
if (!mirror || /[?#%\\]/.test(src) || !URL.canParse(src)) return false;
|
|
9488
|
+
const url = new URL(src);
|
|
9489
|
+
if (url.search || url.hash || !url.href.startsWith(mirror)) return false;
|
|
9490
|
+
return MIRROR_GSAP_FILE.test(url.href.slice(mirror.length));
|
|
9491
|
+
}
|
|
9492
|
+
var warnedRestrictedMirror = false;
|
|
9493
|
+
function mirrorExemptionAllowed() {
|
|
9494
|
+
if (!resolveRestrictPageNetwork()) return true;
|
|
9495
|
+
if (!warnedRestrictedMirror) {
|
|
9496
|
+
warnedRestrictedMirror = true;
|
|
9497
|
+
defaultLogger.warn(
|
|
9498
|
+
"[Compiler] PRODUCER_RESTRICT_PAGE_NETWORK is on, so HYPERFRAMES_GSAP_BASE_URL is fetched only from a public HTTPS address."
|
|
9499
|
+
);
|
|
9500
|
+
}
|
|
9501
|
+
return false;
|
|
9502
|
+
}
|
|
9503
|
+
async function readCappedBody(response, src) {
|
|
9504
|
+
const tooLarge = () => new Error(`Script over 16 MiB: ${src}`);
|
|
9505
|
+
const declared = Number(response.headers.get("content-length"));
|
|
9506
|
+
if (Number.isFinite(declared) && declared > MAX_SCRIPT_BYTES) {
|
|
9507
|
+
await response.body?.cancel().catch(() => {
|
|
9508
|
+
});
|
|
9509
|
+
throw tooLarge();
|
|
9510
|
+
}
|
|
9511
|
+
if (!response.body) return new Uint8Array();
|
|
9512
|
+
const reader = response.body.getReader();
|
|
9513
|
+
const chunks = [];
|
|
9514
|
+
let received = 0;
|
|
9515
|
+
for (; ; ) {
|
|
9516
|
+
const { done, value } = await reader.read();
|
|
9517
|
+
if (done) break;
|
|
9518
|
+
received += value.byteLength;
|
|
9519
|
+
if (received > MAX_SCRIPT_BYTES) {
|
|
9520
|
+
await reader.cancel().catch(() => {
|
|
9521
|
+
});
|
|
9522
|
+
throw tooLarge();
|
|
9523
|
+
}
|
|
9524
|
+
chunks.push(value);
|
|
9525
|
+
}
|
|
9526
|
+
return Buffer.concat(chunks);
|
|
9527
|
+
}
|
|
9483
9528
|
async function downloadScript(src, mirror, signal) {
|
|
9484
|
-
if (mirror &&
|
|
9485
|
-
const response = await fetch(src, {
|
|
9529
|
+
if (isOperatorMirrorGsapUrl(src, mirror) && mirrorExemptionAllowed()) {
|
|
9530
|
+
const response = await fetch(new URL(src).href, {
|
|
9486
9531
|
redirect: "error",
|
|
9487
9532
|
signal: AbortSignal.any([AbortSignal.timeout(15e3), signal])
|
|
9488
9533
|
});
|
|
9489
|
-
if (!response.ok)
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9534
|
+
if (!response.ok) {
|
|
9535
|
+
await response.body?.cancel().catch(() => {
|
|
9536
|
+
});
|
|
9537
|
+
throw new Error(`HTTP ${response.status} for ${src}`);
|
|
9538
|
+
}
|
|
9539
|
+
return readCappedBody(response, src);
|
|
9493
9540
|
}
|
|
9494
9541
|
return fetchPublicHttpsBytes(src, { maxBytes: MAX_SCRIPT_BYTES, timeoutMs: 15e3, signal });
|
|
9495
9542
|
}
|
|
@@ -9813,15 +9860,22 @@ function matchingBraces(css) {
|
|
|
9813
9860
|
}
|
|
9814
9861
|
return closes;
|
|
9815
9862
|
}
|
|
9816
|
-
|
|
9817
|
-
|
|
9863
|
+
var attributeInAnyCase = (el, name) => [...el.attributes].find((attribute) => attribute.name.toLowerCase() === name)?.value;
|
|
9864
|
+
var WHERE_A_BROWSER_LOADS_NO_LINK = "noscript, iframe, noembed, noframes, plaintext, svg, math";
|
|
9865
|
+
function remoteFontStylesheetHref(link) {
|
|
9866
|
+
if (attributeInAnyCase(link, "rel")?.toLowerCase() !== "stylesheet") return void 0;
|
|
9867
|
+
if (link.closest(WHERE_A_BROWSER_LOADS_NO_LINK)) return void 0;
|
|
9868
|
+
const href = attributeInAnyCase(link, "href");
|
|
9818
9869
|
if (!href || !/^https?:\/\//i.test(href) || isGoogleFontsUrl(href)) return void 0;
|
|
9819
9870
|
return href;
|
|
9820
9871
|
}
|
|
9821
9872
|
async function inlineExternalFontStylesheets(html, budget = new CompositionExpansionBudget(), signal) {
|
|
9873
|
+
if (!/<link\b/i.test(html)) return html;
|
|
9874
|
+
const { document: document2 } = parseHTML5(html);
|
|
9875
|
+
const linkElements = [...document2.querySelectorAll("link")];
|
|
9822
9876
|
const hrefs = /* @__PURE__ */ new Set();
|
|
9823
|
-
for (const
|
|
9824
|
-
const href = remoteFontStylesheetHref(
|
|
9877
|
+
for (const link of linkElements) {
|
|
9878
|
+
const href = remoteFontStylesheetHref(link);
|
|
9825
9879
|
if (href) hrefs.add(href);
|
|
9826
9880
|
}
|
|
9827
9881
|
if (hrefs.size === 0) return html;
|
|
@@ -9836,9 +9890,9 @@ async function inlineExternalFontStylesheets(html, budget = new CompositionExpan
|
|
|
9836
9890
|
const fontFaceBlocks = css ? extractFontFaceBlocks(css) : [];
|
|
9837
9891
|
if (fontFaceBlocks.length === 0) return;
|
|
9838
9892
|
const fontCssWithLtAsCssEscape = fontFaceBlocks.join("\n").replace(/</g, "\\3c ");
|
|
9839
|
-
const inlineStyle =
|
|
9893
|
+
const inlineStyle = `/* Inlined external font stylesheet */
|
|
9840
9894
|
${fontCssWithLtAsCssEscape}
|
|
9841
|
-
|
|
9895
|
+
`;
|
|
9842
9896
|
try {
|
|
9843
9897
|
budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
|
|
9844
9898
|
} catch (error) {
|
|
@@ -9856,14 +9910,17 @@ ${fontCssWithLtAsCssEscape}
|
|
|
9856
9910
|
await Promise.allSettled([...hrefs].map((href) => limit(() => inlineSheet(href), fetchSignal)));
|
|
9857
9911
|
if (stop.signal.aborted) throw stop.signal.reason;
|
|
9858
9912
|
const placed = /* @__PURE__ */ new Set();
|
|
9859
|
-
|
|
9860
|
-
const href = remoteFontStylesheetHref(
|
|
9913
|
+
for (const link of linkElements) {
|
|
9914
|
+
const href = remoteFontStylesheetHref(link);
|
|
9861
9915
|
const inlineStyle = href ? inlineByHref.get(href) : void 0;
|
|
9862
|
-
if (!href || !inlineStyle)
|
|
9916
|
+
if (!href || !inlineStyle) continue;
|
|
9863
9917
|
if (placed.has(href)) budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
|
|
9864
9918
|
placed.add(href);
|
|
9865
|
-
|
|
9866
|
-
|
|
9919
|
+
const style = document2.createElement("style");
|
|
9920
|
+
style.textContent = inlineStyle;
|
|
9921
|
+
link.replaceWith(style);
|
|
9922
|
+
}
|
|
9923
|
+
return placed.size === 0 ? html : document2.toString();
|
|
9867
9924
|
}
|
|
9868
9925
|
function projectStylesheetFontFamilies(html, projectDir) {
|
|
9869
9926
|
const families = [];
|
|
@@ -12213,7 +12270,7 @@ import {
|
|
|
12213
12270
|
assetRootsRefusal,
|
|
12214
12271
|
assertPublicHttpsUrl,
|
|
12215
12272
|
downloadToTemp as downloadToTemp2,
|
|
12216
|
-
resolveRestrictPageNetwork,
|
|
12273
|
+
resolveRestrictPageNetwork as resolveRestrictPageNetwork2,
|
|
12217
12274
|
isUrlNotPermittedError,
|
|
12218
12275
|
writeUrlDownloadTelemetry as writeUrlDownloadTelemetry2,
|
|
12219
12276
|
resolveProjectRelativeSrc as resolveProjectRelativeSrc5,
|
|
@@ -12661,7 +12718,7 @@ function localProbeSource(src, input) {
|
|
|
12661
12718
|
}
|
|
12662
12719
|
async function remoteProbeSource(video, input) {
|
|
12663
12720
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
12664
|
-
if (!
|
|
12721
|
+
if (!resolveRestrictPageNetwork2()) return video.src;
|
|
12665
12722
|
if (!video.hasAudio || video.hidden) return null;
|
|
12666
12723
|
const downloadDir = input.downloadDir ?? join26(input.compiledDir, REMOTE_MEDIA_SUBDIR);
|
|
12667
12724
|
try {
|
|
@@ -17176,6 +17233,7 @@ async function executeRenderPipeline(input) {
|
|
|
17176
17233
|
updateCaptureObservability({ captureBeyondViewport: resolvedCaptureBeyondViewport });
|
|
17177
17234
|
}
|
|
17178
17235
|
let routePageMotionBlur;
|
|
17236
|
+
let screenshotRetries = 0;
|
|
17179
17237
|
const buildCaptureOptions = () => ({
|
|
17180
17238
|
...captureOptions,
|
|
17181
17239
|
recordReferenceBackground,
|
|
@@ -17215,6 +17273,10 @@ async function executeRenderPipeline(input) {
|
|
|
17215
17273
|
chromeGpuProcessSeenLastSample: stats.gpuProcessSeenLastSample,
|
|
17216
17274
|
chromeMemorySamples: stats.samples
|
|
17217
17275
|
});
|
|
17276
|
+
},
|
|
17277
|
+
onScreenshotRetry: () => {
|
|
17278
|
+
screenshotRetries += 1;
|
|
17279
|
+
updateCaptureObservability({ screenshotRetries });
|
|
17218
17280
|
}
|
|
17219
17281
|
});
|
|
17220
17282
|
const buildPrepCaptureOptions = () => stopPrepSessionOnScriptFailure(buildCaptureOptions());
|
|
@@ -71,6 +71,8 @@ declare class AssetDownloads {
|
|
|
71
71
|
reserve(urls: Iterable<string>): void;
|
|
72
72
|
download(url: string, destDir: string): Promise<string>;
|
|
73
73
|
}
|
|
74
|
+
/** Only a GSAP distribution file the compiler would itself name under the operator's mirror skips the address checks. */
|
|
75
|
+
export declare function isOperatorMirrorGsapUrl(src: string, mirror: string | undefined): boolean;
|
|
74
76
|
/**
|
|
75
77
|
* Distinct remote addresses one compile downloads, per kind: scripts, and non-Google stylesheets (counted before
|
|
76
78
|
* their contents are read, so a stylesheet with no font rules counts too).
|
|
@@ -182,6 +182,7 @@ export interface RenderCaptureObservability {
|
|
|
182
182
|
* out-of-memory exhaustion (`Set maximum size exceeded` and friends).
|
|
183
183
|
*/
|
|
184
184
|
transientRetries?: number;
|
|
185
|
+
screenshotRetries?: number;
|
|
185
186
|
memoryExhaustionDetected?: boolean;
|
|
186
187
|
/**
|
|
187
188
|
* Chrome process memory from the engine's per-session sampler (Phase −1 of
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.8",
|
|
4
4
|
"description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"postcss": "^8.4.0",
|
|
36
36
|
"puppeteer": "~25.13.0",
|
|
37
37
|
"puppeteer-core": "^25.13.0",
|
|
38
|
-
"@hyperframes/
|
|
39
|
-
"@hyperframes/
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
43
|
-
"@hyperframes/studio-server": "0.10.
|
|
38
|
+
"@hyperframes/engine": "0.10.8",
|
|
39
|
+
"@hyperframes/lint": "0.10.8",
|
|
40
|
+
"@hyperframes/parsers": "0.10.8",
|
|
41
|
+
"@hyperframes/share": "0.10.8",
|
|
42
|
+
"@hyperframes/core": "0.10.8",
|
|
43
|
+
"@hyperframes/studio-server": "0.10.8"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.0.10",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"tsx": "^4.21.0",
|
|
50
50
|
"typescript": "^5.7.2",
|
|
51
51
|
"vitest": "^4.1.12",
|
|
52
|
-
"@hyperframes/aws-lambda": "0.10.
|
|
52
|
+
"@hyperframes/aws-lambda": "0.10.8"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=22.19.0"
|