@hyperframes/producer 0.9.73 → 0.9.74
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/distributed.js +66 -21
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +70 -70
- package/dist/index.js +66 -21
- package/dist/public-server.js +66 -21
- package/dist/services/htmlCompiler.d.ts +5 -2
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -7198,6 +7198,7 @@ import { linksOutside as linksOutside2 } from "@hyperframes/studio-server/outsid
|
|
|
7198
7198
|
import {
|
|
7199
7199
|
assertCompositionFileSize,
|
|
7200
7200
|
CompositionExpansionBudget,
|
|
7201
|
+
ENTRY_PAGE,
|
|
7201
7202
|
REMOTE_SCRIPTS,
|
|
7202
7203
|
REMOTE_STYLESHEETS
|
|
7203
7204
|
} from "@hyperframes/core/compiler";
|
|
@@ -8453,13 +8454,18 @@ function detectShaderTransitionUsage(html) {
|
|
|
8453
8454
|
var MAX_REMOTE_ASSETS = 1e3;
|
|
8454
8455
|
var ASSET_DOWNLOADS_AT_ONCE = 8;
|
|
8455
8456
|
var AssetDownloads = class {
|
|
8456
|
-
constructor(signal) {
|
|
8457
|
-
this.signal = signal;
|
|
8458
|
-
}
|
|
8459
|
-
signal;
|
|
8460
8457
|
reserved = /* @__PURE__ */ new Set();
|
|
8461
8458
|
running = 0;
|
|
8462
8459
|
queued = [];
|
|
8460
|
+
ended = new AbortController();
|
|
8461
|
+
signal;
|
|
8462
|
+
constructor(cancel) {
|
|
8463
|
+
this.signal = cancel ? AbortSignal.any([cancel, this.ended.signal]) : this.ended.signal;
|
|
8464
|
+
}
|
|
8465
|
+
/** Stops every download still running or queued: the compile that owns them has returned. */
|
|
8466
|
+
end() {
|
|
8467
|
+
this.ended.abort(new Error("The compile that started this download has ended"));
|
|
8468
|
+
}
|
|
8463
8469
|
/** Throws before any of `urls` downloads when they would take the compile past the cap. */
|
|
8464
8470
|
reserve(urls) {
|
|
8465
8471
|
this.signal?.throwIfAborted();
|
|
@@ -8530,13 +8536,17 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
8530
8536
|
const probe = () => withMediaProbeSlot(async () => {
|
|
8531
8537
|
try {
|
|
8532
8538
|
await assertMediaPayload(filePath, elementIdentity);
|
|
8533
|
-
const
|
|
8539
|
+
const signal = run?.assets.signal;
|
|
8540
|
+
const profile = await probeMediaProfile2(filePath, { signal });
|
|
8534
8541
|
if (tagName === "video") {
|
|
8535
|
-
|
|
8542
|
+
const { durationSeconds } = await extractMediaMetadata(filePath, { signal });
|
|
8543
|
+
return { profile, fileDuration: durationSeconds };
|
|
8536
8544
|
}
|
|
8537
8545
|
try {
|
|
8538
|
-
|
|
8546
|
+
const { durationSeconds } = await extractAudioMetadata(filePath, { signal });
|
|
8547
|
+
return { profile, fileDuration: durationSeconds };
|
|
8539
8548
|
} catch {
|
|
8549
|
+
if (signal?.aborted) throw signal.reason;
|
|
8540
8550
|
return { profile, fileDuration: null };
|
|
8541
8551
|
}
|
|
8542
8552
|
} catch (error) {
|
|
@@ -8592,6 +8602,7 @@ async function compileHtmlFile(html, projectDir, baseDir, downloadDir, log, urlB
|
|
|
8592
8602
|
(el) => (el.tagName === "video" || el.tagName === "audio") && el.src
|
|
8593
8603
|
);
|
|
8594
8604
|
const unresolvedCompositions = unresolved.filter((el) => el.tagName === "div");
|
|
8605
|
+
run?.assets.reserve(mediaUnresolved.map((el) => el.src).filter(isHttpUrl));
|
|
8595
8606
|
const resolvedResults = await Promise.all(
|
|
8596
8607
|
mediaUnresolved.map(
|
|
8597
8608
|
(el) => resolveMediaDuration(
|
|
@@ -8617,8 +8628,10 @@ async function compileHtmlFile(html, projectDir, baseDir, downloadDir, log, urlB
|
|
|
8617
8628
|
let compiledHtml = resolutions.length > 0 ? injectDurations(markedStaticHtml, resolutions) : markedStaticHtml;
|
|
8618
8629
|
const preResolved = extractResolvedMedia(compiledHtml);
|
|
8619
8630
|
const hiddenVideoIds = collectHiddenVideoIds(compiledHtml);
|
|
8631
|
+
const clampable = preResolved.filter((el) => !!el.src && !el.loop && !hiddenVideoIds.has(el.id));
|
|
8632
|
+
run?.assets.reserve(clampable.map((el) => el.src).filter(isHttpUrl));
|
|
8620
8633
|
const clampResults = await Promise.all(
|
|
8621
|
-
|
|
8634
|
+
clampable.map(async (el) => {
|
|
8622
8635
|
const { duration: maxDuration } = await resolveMediaDuration(
|
|
8623
8636
|
el.src,
|
|
8624
8637
|
el.mediaStart,
|
|
@@ -8755,13 +8768,28 @@ function promoteCssImportsToLinkTags(html) {
|
|
|
8755
8768
|
return document2.toString();
|
|
8756
8769
|
}
|
|
8757
8770
|
var ProducerHostIdentityMap = class extends Map {
|
|
8758
|
-
#document;
|
|
8759
8771
|
#lateInstanceByCompositionId = /* @__PURE__ */ new Map();
|
|
8772
|
+
/** How many elements carry each composition id: the page once, then each mount's copy once. */
|
|
8773
|
+
#idCounts = /* @__PURE__ */ new Map();
|
|
8774
|
+
/** Hosts whose copied content has not been counted yet; the inliner fills a host after asking for it. */
|
|
8775
|
+
#uncounted;
|
|
8760
8776
|
constructor(document2, initialHosts) {
|
|
8761
8777
|
super(assignBundledRuntimeCompositionIds(initialHosts));
|
|
8762
|
-
this.#
|
|
8778
|
+
this.#uncounted = [document2];
|
|
8779
|
+
}
|
|
8780
|
+
#countUncopied() {
|
|
8781
|
+
for (const root of this.#uncounted.splice(0)) {
|
|
8782
|
+
for (const element of Array.from(root.querySelectorAll("[data-composition-id]"))) {
|
|
8783
|
+
this.#adjust(element.getAttribute("data-composition-id"), 1);
|
|
8784
|
+
}
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
#adjust(id, by) {
|
|
8788
|
+
if (id) this.#idCounts.set(id, (this.#idCounts.get(id) ?? 0) + by);
|
|
8763
8789
|
}
|
|
8764
8790
|
get(host) {
|
|
8791
|
+
this.#countUncopied();
|
|
8792
|
+
this.#uncounted.push(host);
|
|
8765
8793
|
const existing = super.get(host);
|
|
8766
8794
|
if (existing) return existing;
|
|
8767
8795
|
const authoredCompositionId = (host.getAttribute("data-hf-original-composition-id") || host.getAttribute("data-composition-id") || "").trim() || null;
|
|
@@ -8770,17 +8798,19 @@ var ProducerHostIdentityMap = class extends Map {
|
|
|
8770
8798
|
this.set(host, identity2);
|
|
8771
8799
|
return identity2;
|
|
8772
8800
|
}
|
|
8801
|
+
const ownId = host.getAttribute("data-composition-id");
|
|
8802
|
+
const heldByOthers = (id) => (this.#idCounts.get(id) ?? 0) - (id === ownId ? 1 : 0) > 0;
|
|
8773
8803
|
let instanceIndex = this.#lateInstanceByCompositionId.get(authoredCompositionId) || 0;
|
|
8774
8804
|
let runtimeCompositionId;
|
|
8775
8805
|
do {
|
|
8776
8806
|
instanceIndex += 1;
|
|
8777
8807
|
runtimeCompositionId = `${authoredCompositionId}__hf${instanceIndex}`;
|
|
8778
|
-
} while (
|
|
8779
|
-
(element) => element !== host && element.getAttribute("data-composition-id") === runtimeCompositionId
|
|
8780
|
-
));
|
|
8808
|
+
} while (heldByOthers(runtimeCompositionId));
|
|
8781
8809
|
this.#lateInstanceByCompositionId.set(authoredCompositionId, instanceIndex);
|
|
8782
8810
|
host.setAttribute("data-hf-original-composition-id", authoredCompositionId);
|
|
8783
8811
|
host.setAttribute("data-composition-id", runtimeCompositionId);
|
|
8812
|
+
this.#adjust(ownId, -1);
|
|
8813
|
+
this.#adjust(runtimeCompositionId, 1);
|
|
8784
8814
|
const identity = { authoredCompositionId, runtimeCompositionId };
|
|
8785
8815
|
this.set(host, identity);
|
|
8786
8816
|
return identity;
|
|
@@ -8838,6 +8868,7 @@ function coalesceHeadStylesAndBodyScripts(html) {
|
|
|
8838
8868
|
}
|
|
8839
8869
|
function inlineSubCompositions(html, subCompositions, projectDir, variableOverrides, assetRoot, outsideFiles, budget) {
|
|
8840
8870
|
const { document: document2 } = parseHTML5(html);
|
|
8871
|
+
budget.chargeElements(ENTRY_PAGE, document2.querySelectorAll("*").length);
|
|
8841
8872
|
const head = document2.querySelector("head");
|
|
8842
8873
|
const body = document2.querySelector("body");
|
|
8843
8874
|
const hosts = Array.from(document2.querySelectorAll("[data-composition-src]"));
|
|
@@ -9682,6 +9713,14 @@ function bindVariableMediaSources(html, variables, budget, log) {
|
|
|
9682
9713
|
}
|
|
9683
9714
|
var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ? relative3(projectDir, htmlPath).split(sep4).join("/") : basename6(htmlPath);
|
|
9684
9715
|
async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
|
|
9716
|
+
const assets = new AssetDownloads(options.abortSignal);
|
|
9717
|
+
try {
|
|
9718
|
+
return await compileWithAssets(projectDir, htmlPath, downloadDir, options, assets);
|
|
9719
|
+
} finally {
|
|
9720
|
+
assets.end();
|
|
9721
|
+
}
|
|
9722
|
+
}
|
|
9723
|
+
async function compileWithAssets(projectDir, htmlPath, downloadDir, options, assets) {
|
|
9685
9724
|
const assetRoot = options.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
9686
9725
|
const outsideFiles = { includeScripts: options.includeOutsideScripts };
|
|
9687
9726
|
if (isPathInside(htmlPath, projectDir) && escapesAssetRoot(htmlPath, assetRoot)) {
|
|
@@ -9708,7 +9747,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9708
9747
|
options.log
|
|
9709
9748
|
);
|
|
9710
9749
|
assertSubCompositionsUsable(rawHtml, projectDir, assetRoot, outsideFiles);
|
|
9711
|
-
const run = { probes: /* @__PURE__ */ new Map(), assets
|
|
9750
|
+
const run = { probes: /* @__PURE__ */ new Map(), assets };
|
|
9712
9751
|
const { html: compiledHtml, unresolvedCompositions } = await compileHtmlFile(
|
|
9713
9752
|
rawHtml,
|
|
9714
9753
|
projectDir,
|
|
@@ -11596,13 +11635,19 @@ async function runExtractVideosStage(input) {
|
|
|
11596
11635
|
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
11597
11636
|
if (!opensLocally(videoPath, assetRoots)) return null;
|
|
11598
11637
|
try {
|
|
11599
|
-
const attempted = extractionPolicy.maxTransientRetries === 0 ? {
|
|
11600
|
-
signal: abortSignal,
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11638
|
+
const attempted = extractionPolicy.maxTransientRetries === 0 ? {
|
|
11639
|
+
result: await extractMediaMetadata4(videoPath, { signal: abortSignal }),
|
|
11640
|
+
retries: 0
|
|
11641
|
+
} : await runVideoExtractionWithRetry2(
|
|
11642
|
+
() => extractMediaMetadata4(videoPath, { signal: abortSignal }),
|
|
11643
|
+
{
|
|
11644
|
+
signal: abortSignal,
|
|
11645
|
+
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
11646
|
+
onRetry: () => {
|
|
11647
|
+
hdrProbeTransientRetries += 1;
|
|
11648
|
+
}
|
|
11604
11649
|
}
|
|
11605
|
-
|
|
11650
|
+
);
|
|
11606
11651
|
const meta = attempted.result;
|
|
11607
11652
|
if (isHdrColorSpace2(meta.colorSpace)) {
|
|
11608
11653
|
nativeHdrVideoIds.add(v.id);
|
|
@@ -11797,7 +11842,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
11797
11842
|
videos.map(async (video) => {
|
|
11798
11843
|
const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
|
|
11799
11844
|
if (readFrom === null) return null;
|
|
11800
|
-
const metadata = await extractMediaMetadata4(readFrom);
|
|
11845
|
+
const metadata = await extractMediaMetadata4(readFrom, { signal: input.signal });
|
|
11801
11846
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
11802
11847
|
readFrom,
|
|
11803
11848
|
video,
|
package/dist/public-server.js
CHANGED
|
@@ -7213,6 +7213,7 @@ import { linksOutside as linksOutside2 } from "@hyperframes/studio-server/outsid
|
|
|
7213
7213
|
import {
|
|
7214
7214
|
assertCompositionFileSize,
|
|
7215
7215
|
CompositionExpansionBudget,
|
|
7216
|
+
ENTRY_PAGE,
|
|
7216
7217
|
REMOTE_SCRIPTS,
|
|
7217
7218
|
REMOTE_STYLESHEETS
|
|
7218
7219
|
} from "@hyperframes/core/compiler";
|
|
@@ -8468,13 +8469,18 @@ function detectShaderTransitionUsage(html) {
|
|
|
8468
8469
|
var MAX_REMOTE_ASSETS = 1e3;
|
|
8469
8470
|
var ASSET_DOWNLOADS_AT_ONCE = 8;
|
|
8470
8471
|
var AssetDownloads = class {
|
|
8471
|
-
constructor(signal) {
|
|
8472
|
-
this.signal = signal;
|
|
8473
|
-
}
|
|
8474
|
-
signal;
|
|
8475
8472
|
reserved = /* @__PURE__ */ new Set();
|
|
8476
8473
|
running = 0;
|
|
8477
8474
|
queued = [];
|
|
8475
|
+
ended = new AbortController();
|
|
8476
|
+
signal;
|
|
8477
|
+
constructor(cancel) {
|
|
8478
|
+
this.signal = cancel ? AbortSignal.any([cancel, this.ended.signal]) : this.ended.signal;
|
|
8479
|
+
}
|
|
8480
|
+
/** Stops every download still running or queued: the compile that owns them has returned. */
|
|
8481
|
+
end() {
|
|
8482
|
+
this.ended.abort(new Error("The compile that started this download has ended"));
|
|
8483
|
+
}
|
|
8478
8484
|
/** Throws before any of `urls` downloads when they would take the compile past the cap. */
|
|
8479
8485
|
reserve(urls) {
|
|
8480
8486
|
this.signal?.throwIfAborted();
|
|
@@ -8545,13 +8551,17 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
8545
8551
|
const probe = () => withMediaProbeSlot(async () => {
|
|
8546
8552
|
try {
|
|
8547
8553
|
await assertMediaPayload(filePath, elementIdentity);
|
|
8548
|
-
const
|
|
8554
|
+
const signal = run?.assets.signal;
|
|
8555
|
+
const profile = await probeMediaProfile2(filePath, { signal });
|
|
8549
8556
|
if (tagName === "video") {
|
|
8550
|
-
|
|
8557
|
+
const { durationSeconds } = await extractMediaMetadata(filePath, { signal });
|
|
8558
|
+
return { profile, fileDuration: durationSeconds };
|
|
8551
8559
|
}
|
|
8552
8560
|
try {
|
|
8553
|
-
|
|
8561
|
+
const { durationSeconds } = await extractAudioMetadata(filePath, { signal });
|
|
8562
|
+
return { profile, fileDuration: durationSeconds };
|
|
8554
8563
|
} catch {
|
|
8564
|
+
if (signal?.aborted) throw signal.reason;
|
|
8555
8565
|
return { profile, fileDuration: null };
|
|
8556
8566
|
}
|
|
8557
8567
|
} catch (error) {
|
|
@@ -8607,6 +8617,7 @@ async function compileHtmlFile(html, projectDir, baseDir, downloadDir, log, urlB
|
|
|
8607
8617
|
(el) => (el.tagName === "video" || el.tagName === "audio") && el.src
|
|
8608
8618
|
);
|
|
8609
8619
|
const unresolvedCompositions = unresolved.filter((el) => el.tagName === "div");
|
|
8620
|
+
run?.assets.reserve(mediaUnresolved.map((el) => el.src).filter(isHttpUrl));
|
|
8610
8621
|
const resolvedResults = await Promise.all(
|
|
8611
8622
|
mediaUnresolved.map(
|
|
8612
8623
|
(el) => resolveMediaDuration(
|
|
@@ -8632,8 +8643,10 @@ async function compileHtmlFile(html, projectDir, baseDir, downloadDir, log, urlB
|
|
|
8632
8643
|
let compiledHtml = resolutions.length > 0 ? injectDurations(markedStaticHtml, resolutions) : markedStaticHtml;
|
|
8633
8644
|
const preResolved = extractResolvedMedia(compiledHtml);
|
|
8634
8645
|
const hiddenVideoIds = collectHiddenVideoIds(compiledHtml);
|
|
8646
|
+
const clampable = preResolved.filter((el) => !!el.src && !el.loop && !hiddenVideoIds.has(el.id));
|
|
8647
|
+
run?.assets.reserve(clampable.map((el) => el.src).filter(isHttpUrl));
|
|
8635
8648
|
const clampResults = await Promise.all(
|
|
8636
|
-
|
|
8649
|
+
clampable.map(async (el) => {
|
|
8637
8650
|
const { duration: maxDuration } = await resolveMediaDuration(
|
|
8638
8651
|
el.src,
|
|
8639
8652
|
el.mediaStart,
|
|
@@ -8770,13 +8783,28 @@ function promoteCssImportsToLinkTags(html) {
|
|
|
8770
8783
|
return document2.toString();
|
|
8771
8784
|
}
|
|
8772
8785
|
var ProducerHostIdentityMap = class extends Map {
|
|
8773
|
-
#document;
|
|
8774
8786
|
#lateInstanceByCompositionId = /* @__PURE__ */ new Map();
|
|
8787
|
+
/** How many elements carry each composition id: the page once, then each mount's copy once. */
|
|
8788
|
+
#idCounts = /* @__PURE__ */ new Map();
|
|
8789
|
+
/** Hosts whose copied content has not been counted yet; the inliner fills a host after asking for it. */
|
|
8790
|
+
#uncounted;
|
|
8775
8791
|
constructor(document2, initialHosts) {
|
|
8776
8792
|
super(assignBundledRuntimeCompositionIds(initialHosts));
|
|
8777
|
-
this.#
|
|
8793
|
+
this.#uncounted = [document2];
|
|
8794
|
+
}
|
|
8795
|
+
#countUncopied() {
|
|
8796
|
+
for (const root of this.#uncounted.splice(0)) {
|
|
8797
|
+
for (const element of Array.from(root.querySelectorAll("[data-composition-id]"))) {
|
|
8798
|
+
this.#adjust(element.getAttribute("data-composition-id"), 1);
|
|
8799
|
+
}
|
|
8800
|
+
}
|
|
8801
|
+
}
|
|
8802
|
+
#adjust(id, by) {
|
|
8803
|
+
if (id) this.#idCounts.set(id, (this.#idCounts.get(id) ?? 0) + by);
|
|
8778
8804
|
}
|
|
8779
8805
|
get(host) {
|
|
8806
|
+
this.#countUncopied();
|
|
8807
|
+
this.#uncounted.push(host);
|
|
8780
8808
|
const existing = super.get(host);
|
|
8781
8809
|
if (existing) return existing;
|
|
8782
8810
|
const authoredCompositionId = (host.getAttribute("data-hf-original-composition-id") || host.getAttribute("data-composition-id") || "").trim() || null;
|
|
@@ -8785,17 +8813,19 @@ var ProducerHostIdentityMap = class extends Map {
|
|
|
8785
8813
|
this.set(host, identity2);
|
|
8786
8814
|
return identity2;
|
|
8787
8815
|
}
|
|
8816
|
+
const ownId = host.getAttribute("data-composition-id");
|
|
8817
|
+
const heldByOthers = (id) => (this.#idCounts.get(id) ?? 0) - (id === ownId ? 1 : 0) > 0;
|
|
8788
8818
|
let instanceIndex = this.#lateInstanceByCompositionId.get(authoredCompositionId) || 0;
|
|
8789
8819
|
let runtimeCompositionId;
|
|
8790
8820
|
do {
|
|
8791
8821
|
instanceIndex += 1;
|
|
8792
8822
|
runtimeCompositionId = `${authoredCompositionId}__hf${instanceIndex}`;
|
|
8793
|
-
} while (
|
|
8794
|
-
(element) => element !== host && element.getAttribute("data-composition-id") === runtimeCompositionId
|
|
8795
|
-
));
|
|
8823
|
+
} while (heldByOthers(runtimeCompositionId));
|
|
8796
8824
|
this.#lateInstanceByCompositionId.set(authoredCompositionId, instanceIndex);
|
|
8797
8825
|
host.setAttribute("data-hf-original-composition-id", authoredCompositionId);
|
|
8798
8826
|
host.setAttribute("data-composition-id", runtimeCompositionId);
|
|
8827
|
+
this.#adjust(ownId, -1);
|
|
8828
|
+
this.#adjust(runtimeCompositionId, 1);
|
|
8799
8829
|
const identity = { authoredCompositionId, runtimeCompositionId };
|
|
8800
8830
|
this.set(host, identity);
|
|
8801
8831
|
return identity;
|
|
@@ -8853,6 +8883,7 @@ function coalesceHeadStylesAndBodyScripts(html) {
|
|
|
8853
8883
|
}
|
|
8854
8884
|
function inlineSubCompositions(html, subCompositions, projectDir, variableOverrides, assetRoot, outsideFiles, budget) {
|
|
8855
8885
|
const { document: document2 } = parseHTML5(html);
|
|
8886
|
+
budget.chargeElements(ENTRY_PAGE, document2.querySelectorAll("*").length);
|
|
8856
8887
|
const head = document2.querySelector("head");
|
|
8857
8888
|
const body = document2.querySelector("body");
|
|
8858
8889
|
const hosts = Array.from(document2.querySelectorAll("[data-composition-src]"));
|
|
@@ -9694,6 +9725,14 @@ function bindVariableMediaSources(html, variables, budget, log) {
|
|
|
9694
9725
|
}
|
|
9695
9726
|
var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ? relative3(projectDir, htmlPath).split(sep4).join("/") : basename6(htmlPath);
|
|
9696
9727
|
async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
|
|
9728
|
+
const assets = new AssetDownloads(options.abortSignal);
|
|
9729
|
+
try {
|
|
9730
|
+
return await compileWithAssets(projectDir, htmlPath, downloadDir, options, assets);
|
|
9731
|
+
} finally {
|
|
9732
|
+
assets.end();
|
|
9733
|
+
}
|
|
9734
|
+
}
|
|
9735
|
+
async function compileWithAssets(projectDir, htmlPath, downloadDir, options, assets) {
|
|
9697
9736
|
const assetRoot = options.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
9698
9737
|
const outsideFiles = { includeScripts: options.includeOutsideScripts };
|
|
9699
9738
|
if (isPathInside(htmlPath, projectDir) && escapesAssetRoot(htmlPath, assetRoot)) {
|
|
@@ -9720,7 +9759,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9720
9759
|
options.log
|
|
9721
9760
|
);
|
|
9722
9761
|
assertSubCompositionsUsable(rawHtml, projectDir, assetRoot, outsideFiles);
|
|
9723
|
-
const run = { probes: /* @__PURE__ */ new Map(), assets
|
|
9762
|
+
const run = { probes: /* @__PURE__ */ new Map(), assets };
|
|
9724
9763
|
const { html: compiledHtml, unresolvedCompositions } = await compileHtmlFile(
|
|
9725
9764
|
rawHtml,
|
|
9726
9765
|
projectDir,
|
|
@@ -11571,13 +11610,19 @@ async function runExtractVideosStage(input) {
|
|
|
11571
11610
|
const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
|
|
11572
11611
|
if (!opensLocally(videoPath, assetRoots)) return null;
|
|
11573
11612
|
try {
|
|
11574
|
-
const attempted = extractionPolicy.maxTransientRetries === 0 ? {
|
|
11575
|
-
signal: abortSignal,
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11613
|
+
const attempted = extractionPolicy.maxTransientRetries === 0 ? {
|
|
11614
|
+
result: await extractMediaMetadata4(videoPath, { signal: abortSignal }),
|
|
11615
|
+
retries: 0
|
|
11616
|
+
} : await runVideoExtractionWithRetry2(
|
|
11617
|
+
() => extractMediaMetadata4(videoPath, { signal: abortSignal }),
|
|
11618
|
+
{
|
|
11619
|
+
signal: abortSignal,
|
|
11620
|
+
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
11621
|
+
onRetry: () => {
|
|
11622
|
+
hdrProbeTransientRetries += 1;
|
|
11623
|
+
}
|
|
11579
11624
|
}
|
|
11580
|
-
|
|
11625
|
+
);
|
|
11581
11626
|
const meta = attempted.result;
|
|
11582
11627
|
if (isHdrColorSpace2(meta.colorSpace)) {
|
|
11583
11628
|
nativeHdrVideoIds.add(v.id);
|
|
@@ -11772,7 +11817,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
11772
11817
|
videos.map(async (video) => {
|
|
11773
11818
|
const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
|
|
11774
11819
|
if (readFrom === null) return null;
|
|
11775
|
-
const metadata = await extractMediaMetadata4(readFrom);
|
|
11820
|
+
const metadata = await extractMediaMetadata4(readFrom, { signal: input.signal });
|
|
11776
11821
|
const window2 = await resolveFinalFrameExtractionWindow2(
|
|
11777
11822
|
readFrom,
|
|
11778
11823
|
video,
|
|
@@ -59,11 +59,14 @@ export declare function detectShaderTransitionUsage(html: string): boolean;
|
|
|
59
59
|
export declare const MAX_REMOTE_ASSETS = 1000;
|
|
60
60
|
/** One compile's media, image and font downloads: its cancel, a cap on distinct files, a few at a time. */
|
|
61
61
|
declare class AssetDownloads {
|
|
62
|
-
readonly signal?: AbortSignal | undefined;
|
|
63
62
|
private readonly reserved;
|
|
64
63
|
private running;
|
|
65
64
|
private readonly queued;
|
|
66
|
-
|
|
65
|
+
private readonly ended;
|
|
66
|
+
readonly signal: AbortSignal;
|
|
67
|
+
constructor(cancel?: AbortSignal);
|
|
68
|
+
/** Stops every download still running or queued: the compile that owns them has returned. */
|
|
69
|
+
end(): void;
|
|
67
70
|
/** Throws before any of `urls` downloads when they would take the compile past the cap. */
|
|
68
71
|
reserve(urls: Iterable<string>): void;
|
|
69
72
|
download(url: string, destDir: string): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.74",
|
|
4
4
|
"description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,11 +35,11 @@
|
|
|
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/parsers": "0.9.
|
|
42
|
-
"@hyperframes/studio-server": "0.9.
|
|
38
|
+
"@hyperframes/engine": "0.9.74",
|
|
39
|
+
"@hyperframes/core": "0.9.74",
|
|
40
|
+
"@hyperframes/lint": "0.9.74",
|
|
41
|
+
"@hyperframes/parsers": "0.9.74",
|
|
42
|
+
"@hyperframes/studio-server": "0.9.74"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.10",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsx": "^4.21.0",
|
|
49
49
|
"typescript": "^5.7.2",
|
|
50
50
|
"vitest": "^4.1.12",
|
|
51
|
-
"@hyperframes/aws-lambda": "0.9.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.74"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|