hyperframes 0.8.29 → 0.8.31
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/README.md +7 -5
- package/dist/cli.js +2609 -1789
- package/dist/commands/layout-audit.browser.js +13 -6
- package/dist/fontLocalizeCli.js +910 -481
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/skills/hyperframes/references/capability-menu.md +1 -1
- package/dist/skills/hyperframes-cli/references/preview-render.md +3 -2
- package/dist/studio/assets/{hyperframes-player-DMIVO02i.js → hyperframes-player-0QzsrRGz.js} +1 -1
- package/dist/studio/assets/{index-CAyl2GL2.js → index-CfQexXc6.js} +5 -5
- package/dist/studio/assets/{index-ok1knGut.js → index-DdTv4TqQ.js} +1 -1
- package/dist/studio/assets/{index-Cerhq2OW.js → index-Dyhj0geW.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/studio/index.js +9 -9
- package/dist/studio/index.js.map +1 -1
- package/package.json +1 -1
package/dist/fontLocalizeCli.js
CHANGED
|
@@ -3433,10 +3433,10 @@ function compareDocumentPosition(nodeA, nodeB) {
|
|
|
3433
3433
|
function uniqueSort(nodes) {
|
|
3434
3434
|
nodes = nodes.filter((node, i, arr) => !arr.includes(node, i + 1));
|
|
3435
3435
|
nodes.sort((a, b) => {
|
|
3436
|
-
const
|
|
3437
|
-
if (
|
|
3436
|
+
const relative9 = compareDocumentPosition(a, b);
|
|
3437
|
+
if (relative9 & DocumentPosition.PRECEDING) {
|
|
3438
3438
|
return -1;
|
|
3439
|
-
} else if (
|
|
3439
|
+
} else if (relative9 & DocumentPosition.FOLLOWING) {
|
|
3440
3440
|
return 1;
|
|
3441
3441
|
}
|
|
3442
3442
|
return 0;
|
|
@@ -9651,12 +9651,12 @@ var require_CSSValueExpression = __commonJS({
|
|
|
9651
9651
|
return false;
|
|
9652
9652
|
}
|
|
9653
9653
|
};
|
|
9654
|
-
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx,
|
|
9655
|
-
var endIdx = this._findMatchedIdx(token, idx,
|
|
9654
|
+
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep7) {
|
|
9655
|
+
var endIdx = this._findMatchedIdx(token, idx, sep7), text;
|
|
9656
9656
|
if (endIdx === -1) {
|
|
9657
9657
|
return false;
|
|
9658
9658
|
} else {
|
|
9659
|
-
text = token.substring(idx, endIdx +
|
|
9659
|
+
text = token.substring(idx, endIdx + sep7.length);
|
|
9660
9660
|
return {
|
|
9661
9661
|
idx: endIdx,
|
|
9662
9662
|
text
|
|
@@ -9696,15 +9696,15 @@ var require_CSSValueExpression = __commonJS({
|
|
|
9696
9696
|
if (!isLegal) {
|
|
9697
9697
|
return false;
|
|
9698
9698
|
} else {
|
|
9699
|
-
var
|
|
9700
|
-
return this._parseJSString(token, idx,
|
|
9699
|
+
var sep7 = "/";
|
|
9700
|
+
return this._parseJSString(token, idx, sep7);
|
|
9701
9701
|
}
|
|
9702
9702
|
};
|
|
9703
|
-
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx,
|
|
9703
|
+
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep7) {
|
|
9704
9704
|
var startIdx = idx, endIdx;
|
|
9705
9705
|
var NOT_FOUND = -1;
|
|
9706
9706
|
while (true) {
|
|
9707
|
-
endIdx = token.indexOf(
|
|
9707
|
+
endIdx = token.indexOf(sep7, startIdx + 1);
|
|
9708
9708
|
if (endIdx === -1) {
|
|
9709
9709
|
endIdx = NOT_FOUND;
|
|
9710
9710
|
break;
|
|
@@ -16993,7 +16993,7 @@ var require_util = __commonJS({
|
|
|
16993
16993
|
}
|
|
16994
16994
|
path = url.path;
|
|
16995
16995
|
}
|
|
16996
|
-
var
|
|
16996
|
+
var isAbsolute6 = exports.isAbsolute(path);
|
|
16997
16997
|
var parts = path.split(/\/+/);
|
|
16998
16998
|
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
|
16999
16999
|
part = parts[i];
|
|
@@ -17013,7 +17013,7 @@ var require_util = __commonJS({
|
|
|
17013
17013
|
}
|
|
17014
17014
|
path = parts.join("/");
|
|
17015
17015
|
if (path === "") {
|
|
17016
|
-
path =
|
|
17016
|
+
path = isAbsolute6 ? "/" : ".";
|
|
17017
17017
|
}
|
|
17018
17018
|
if (url) {
|
|
17019
17019
|
url.path = path;
|
|
@@ -17022,7 +17022,7 @@ var require_util = __commonJS({
|
|
|
17022
17022
|
return path;
|
|
17023
17023
|
}
|
|
17024
17024
|
exports.normalize = normalize;
|
|
17025
|
-
function
|
|
17025
|
+
function join58(aRoot, aPath) {
|
|
17026
17026
|
if (aRoot === "") {
|
|
17027
17027
|
aRoot = ".";
|
|
17028
17028
|
}
|
|
@@ -17054,11 +17054,11 @@ var require_util = __commonJS({
|
|
|
17054
17054
|
}
|
|
17055
17055
|
return joined;
|
|
17056
17056
|
}
|
|
17057
|
-
exports.join =
|
|
17057
|
+
exports.join = join58;
|
|
17058
17058
|
exports.isAbsolute = function(aPath) {
|
|
17059
17059
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
17060
17060
|
};
|
|
17061
|
-
function
|
|
17061
|
+
function relative9(aRoot, aPath) {
|
|
17062
17062
|
if (aRoot === "") {
|
|
17063
17063
|
aRoot = ".";
|
|
17064
17064
|
}
|
|
@@ -17077,7 +17077,7 @@ var require_util = __commonJS({
|
|
|
17077
17077
|
}
|
|
17078
17078
|
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
17079
17079
|
}
|
|
17080
|
-
exports.relative =
|
|
17080
|
+
exports.relative = relative9;
|
|
17081
17081
|
var supportsNullProto = (function() {
|
|
17082
17082
|
var obj = /* @__PURE__ */ Object.create(null);
|
|
17083
17083
|
return !("__proto__" in obj);
|
|
@@ -17227,7 +17227,7 @@ var require_util = __commonJS({
|
|
|
17227
17227
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
17228
17228
|
}
|
|
17229
17229
|
}
|
|
17230
|
-
sourceURL =
|
|
17230
|
+
sourceURL = join58(urlGenerate(parsed), sourceURL);
|
|
17231
17231
|
}
|
|
17232
17232
|
return normalize(sourceURL);
|
|
17233
17233
|
}
|
|
@@ -27953,9 +27953,9 @@ var require_printer = __commonJS({
|
|
|
27953
27953
|
}
|
|
27954
27954
|
case "ForStatement": {
|
|
27955
27955
|
var init = path.call(print, "init");
|
|
27956
|
-
var
|
|
27956
|
+
var sep7 = init.length > 1 ? ";\n" : "; ";
|
|
27957
27957
|
var forParen = "for (";
|
|
27958
|
-
var indented = (0, lines_1.fromString)(
|
|
27958
|
+
var indented = (0, lines_1.fromString)(sep7).join([init, path.call(print, "test"), path.call(print, "update")]).indentTail(forParen.length);
|
|
27959
27959
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
27960
27960
|
var clause = adjustClause(path.call(print, "body"), options);
|
|
27961
27961
|
parts.push(head);
|
|
@@ -50766,17 +50766,87 @@ function setAttr(tag, attr, value) {
|
|
|
50766
50766
|
}
|
|
50767
50767
|
function maskInertRegions(html) {
|
|
50768
50768
|
const stash = [];
|
|
50769
|
-
const
|
|
50769
|
+
const parts = [];
|
|
50770
|
+
const opening = /<!--|<script\b|<style\b/gi;
|
|
50771
|
+
const closings = /* @__PURE__ */ new Map([
|
|
50772
|
+
["<!--", /--!?>/g],
|
|
50773
|
+
["<script", /<\/script\s*>/gi],
|
|
50774
|
+
["<style", /<\/style\s*>/gi]
|
|
50775
|
+
]);
|
|
50776
|
+
let cursor = 0;
|
|
50777
|
+
let match;
|
|
50778
|
+
while ((match = opening.exec(html)) !== null) {
|
|
50779
|
+
const kind = match[0].toLowerCase();
|
|
50780
|
+
const closing = closings.get(kind);
|
|
50781
|
+
if (!closing)
|
|
50782
|
+
continue;
|
|
50783
|
+
closing.lastIndex = opening.lastIndex;
|
|
50784
|
+
const end = closing.exec(html) ? closing.lastIndex : -1;
|
|
50785
|
+
if (end < 0) {
|
|
50786
|
+
closings.delete(kind);
|
|
50787
|
+
continue;
|
|
50788
|
+
}
|
|
50770
50789
|
const token = `\0HFMASK${stash.length}\0`;
|
|
50771
|
-
|
|
50772
|
-
|
|
50773
|
-
|
|
50790
|
+
parts.push(html.slice(cursor, match.index), token);
|
|
50791
|
+
stash.push(html.slice(match.index, end));
|
|
50792
|
+
cursor = end;
|
|
50793
|
+
opening.lastIndex = cursor;
|
|
50794
|
+
}
|
|
50795
|
+
parts.push(html.slice(cursor));
|
|
50796
|
+
const masked = parts.join("");
|
|
50774
50797
|
const restore = (s) => (
|
|
50775
50798
|
// oxlint-disable-next-line no-control-regex -- NUL cannot appear in HTML, which is what makes it a safe mask delimiter
|
|
50776
50799
|
s.replace(/\u0000HFMASK(\d+)\u0000/g, (_, i) => stash[Number(i)] ?? "")
|
|
50777
50800
|
);
|
|
50778
50801
|
return { masked, restore };
|
|
50779
50802
|
}
|
|
50803
|
+
function* iterateOpeningTags(html, prefix) {
|
|
50804
|
+
let match;
|
|
50805
|
+
while ((match = prefix.exec(html)) !== null) {
|
|
50806
|
+
const closing = html.indexOf(">", prefix.lastIndex);
|
|
50807
|
+
if (closing < 0)
|
|
50808
|
+
break;
|
|
50809
|
+
const end = closing + 1;
|
|
50810
|
+
yield { tag: html.slice(match.index, end), index: match.index, end };
|
|
50811
|
+
prefix.lastIndex = end;
|
|
50812
|
+
}
|
|
50813
|
+
}
|
|
50814
|
+
function replaceOpeningTags(html, prefix, replace3) {
|
|
50815
|
+
const parts = [];
|
|
50816
|
+
let cursor = 0;
|
|
50817
|
+
for (const { tag, index, end } of iterateOpeningTags(html, prefix)) {
|
|
50818
|
+
parts.push(html.slice(cursor, index), replace3(tag));
|
|
50819
|
+
cursor = end;
|
|
50820
|
+
}
|
|
50821
|
+
parts.push(html.slice(cursor));
|
|
50822
|
+
return parts.join("");
|
|
50823
|
+
}
|
|
50824
|
+
function replaceIdTags(html, id, replace3) {
|
|
50825
|
+
const idPattern = new RegExp(`id=["']${escapeRegex2(id)}["']`, "gi");
|
|
50826
|
+
const lastClosing = html.lastIndexOf(">");
|
|
50827
|
+
const parts = [];
|
|
50828
|
+
let cursor = 0;
|
|
50829
|
+
let candidate = idPattern.exec(html);
|
|
50830
|
+
for (const { index, end } of iterateOpeningTags(html, /</g)) {
|
|
50831
|
+
if (index < cursor)
|
|
50832
|
+
continue;
|
|
50833
|
+
let targetEnd = -1;
|
|
50834
|
+
while (candidate && candidate.index < end) {
|
|
50835
|
+
const candidateEnd = candidate.index + candidate[0].length;
|
|
50836
|
+
if (candidate.index > index && candidateEnd <= lastClosing)
|
|
50837
|
+
targetEnd = candidateEnd;
|
|
50838
|
+
idPattern.lastIndex = candidate.index + 1;
|
|
50839
|
+
candidate = idPattern.exec(html);
|
|
50840
|
+
}
|
|
50841
|
+
if (targetEnd < 0)
|
|
50842
|
+
continue;
|
|
50843
|
+
const closing = html.indexOf(">", targetEnd) + 1;
|
|
50844
|
+
parts.push(html.slice(cursor, index), replace3(html.slice(index, closing)));
|
|
50845
|
+
cursor = closing;
|
|
50846
|
+
}
|
|
50847
|
+
parts.push(html.slice(cursor));
|
|
50848
|
+
return parts.join("");
|
|
50849
|
+
}
|
|
50780
50850
|
function compileTag(tag, isVideo, generateId) {
|
|
50781
50851
|
let result = tag;
|
|
50782
50852
|
let unresolved = null;
|
|
@@ -50824,23 +50894,23 @@ function compileTimingAttrs(html) {
|
|
|
50824
50894
|
let nextAudioId = 0;
|
|
50825
50895
|
const { masked, restore } = maskInertRegions(html);
|
|
50826
50896
|
html = masked;
|
|
50827
|
-
html = html
|
|
50897
|
+
html = replaceOpeningTags(html, /<video/gi, (match) => {
|
|
50828
50898
|
const { tag, unresolved: u } = compileTag(match, true, () => nextVideoId++);
|
|
50829
50899
|
if (u)
|
|
50830
50900
|
unresolved.push(u);
|
|
50831
50901
|
return tag;
|
|
50832
50902
|
});
|
|
50833
|
-
html = html
|
|
50903
|
+
html = replaceOpeningTags(html, /<audio/gi, (match) => {
|
|
50834
50904
|
const { tag, unresolved: u } = compileTag(match, false, () => nextAudioId++);
|
|
50835
50905
|
if (u)
|
|
50836
50906
|
unresolved.push(u);
|
|
50837
50907
|
return tag;
|
|
50838
50908
|
});
|
|
50839
|
-
html
|
|
50909
|
+
for (const { tag: match } of iterateOpeningTags(html, /<(?:div|section)/gi)) {
|
|
50840
50910
|
if (!hasAttr(match, "data-start"))
|
|
50841
|
-
|
|
50911
|
+
continue;
|
|
50842
50912
|
if (hasAttr(match, "data-end") || hasAttr(match, "data-duration"))
|
|
50843
|
-
|
|
50913
|
+
continue;
|
|
50844
50914
|
const id = getAttr(match, "id");
|
|
50845
50915
|
const compositionSrc = getAttr(match, "data-composition-src");
|
|
50846
50916
|
if (id) {
|
|
@@ -50854,14 +50924,12 @@ function compileTimingAttrs(html) {
|
|
|
50854
50924
|
compositionSrc: compositionSrc ?? void 0
|
|
50855
50925
|
});
|
|
50856
50926
|
}
|
|
50857
|
-
|
|
50858
|
-
});
|
|
50927
|
+
}
|
|
50859
50928
|
return { html: restore(html), unresolved };
|
|
50860
50929
|
}
|
|
50861
50930
|
function injectDurations(html, resolutions) {
|
|
50862
50931
|
for (const { id, duration } of resolutions) {
|
|
50863
|
-
|
|
50864
|
-
html = html.replace(idPattern, (tag) => {
|
|
50932
|
+
html = replaceIdTags(html, id, (tag) => {
|
|
50865
50933
|
let result = tag;
|
|
50866
50934
|
if (parseStrictFiniteTimingNumber(getAttr(result, "data-duration")) == null) {
|
|
50867
50935
|
result = setAttr(result, "data-duration", String(duration));
|
|
@@ -50883,10 +50951,7 @@ function escapeRegex2(str) {
|
|
|
50883
50951
|
function extractResolvedMedia(html) {
|
|
50884
50952
|
const resolved = [];
|
|
50885
50953
|
html = maskInertRegions(html).masked;
|
|
50886
|
-
const
|
|
50887
|
-
let match;
|
|
50888
|
-
while ((match = mediaRegex.exec(html)) !== null) {
|
|
50889
|
-
const tag = match[0];
|
|
50954
|
+
for (const { tag } of iterateOpeningTags(html, /<(?:video|audio)/gi)) {
|
|
50890
50955
|
const id = getAttr(tag, "id");
|
|
50891
50956
|
const durationStr = getAttr(tag, "data-duration");
|
|
50892
50957
|
if (!id || durationStr === null)
|
|
@@ -50912,8 +50977,7 @@ function extractResolvedMedia(html) {
|
|
|
50912
50977
|
}
|
|
50913
50978
|
function clampDurations(html, clamps) {
|
|
50914
50979
|
for (const { id, duration } of clamps) {
|
|
50915
|
-
|
|
50916
|
-
html = html.replace(idPattern, (tag) => {
|
|
50980
|
+
html = replaceIdTags(html, id, (tag) => {
|
|
50917
50981
|
tag = tag.replace(/data-duration=["'][^"']*["']/, `data-duration="${duration}"`);
|
|
50918
50982
|
const start = parseNumeric(getAttr(tag, "data-start"));
|
|
50919
50983
|
if (start != null) {
|
|
@@ -50924,14 +50988,13 @@ function clampDurations(html, clamps) {
|
|
|
50924
50988
|
}
|
|
50925
50989
|
return html;
|
|
50926
50990
|
}
|
|
50927
|
-
var MEDIA_DURATION_CLAMP_EPSILON_SECONDS
|
|
50991
|
+
var MEDIA_DURATION_CLAMP_EPSILON_SECONDS;
|
|
50928
50992
|
var init_timingCompiler = __esm({
|
|
50929
50993
|
"../core/dist/compiler/timingCompiler.js"() {
|
|
50930
50994
|
"use strict";
|
|
50931
50995
|
init_compositionContract();
|
|
50932
50996
|
init_playbackRate();
|
|
50933
50997
|
MEDIA_DURATION_CLAMP_EPSILON_SECONDS = 0.05;
|
|
50934
|
-
INERT_REGION_RE = /<!--[\s\S]*?-->|<script\b[\s\S]*?<\/script\s*>|<style\b[\s\S]*?<\/style\s*>/gi;
|
|
50935
50998
|
}
|
|
50936
50999
|
});
|
|
50937
51000
|
|
|
@@ -61171,7 +61234,15 @@ var init_renderProvenance = __esm({
|
|
|
61171
61234
|
});
|
|
61172
61235
|
|
|
61173
61236
|
// ../engine/src/services/chunkEncoder.ts
|
|
61174
|
-
import {
|
|
61237
|
+
import {
|
|
61238
|
+
copyFileSync,
|
|
61239
|
+
existsSync as existsSync6,
|
|
61240
|
+
mkdirSync as mkdirSync2,
|
|
61241
|
+
mkdtempSync,
|
|
61242
|
+
readdirSync as readdirSync2,
|
|
61243
|
+
statSync as statSync2,
|
|
61244
|
+
writeFileSync as writeFileSync2
|
|
61245
|
+
} from "fs";
|
|
61175
61246
|
import { join as join7, dirname as dirname4, extname } from "path";
|
|
61176
61247
|
function appendEncodeTimeoutMessage(error, timedOut, timeoutMs) {
|
|
61177
61248
|
if (!timedOut) return error;
|
|
@@ -61483,8 +61554,8 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
61483
61554
|
}
|
|
61484
61555
|
const chunkSize = Math.max(30, Math.floor(chunkSizeFrames));
|
|
61485
61556
|
const chunkCount = Math.ceil(files.length / chunkSize);
|
|
61486
|
-
|
|
61487
|
-
|
|
61557
|
+
mkdirSync2(dirname4(outputPath), { recursive: true });
|
|
61558
|
+
const chunkDir = mkdtempSync(join7(dirname4(outputPath), "chunk-encode-"));
|
|
61488
61559
|
const chunkPaths = [];
|
|
61489
61560
|
for (let i = 0; i < chunkCount; i++) {
|
|
61490
61561
|
if (signal?.aborted) {
|
|
@@ -62144,7 +62215,7 @@ import {
|
|
|
62144
62215
|
existsSync as existsSync8,
|
|
62145
62216
|
fsyncSync,
|
|
62146
62217
|
linkSync,
|
|
62147
|
-
mkdtempSync,
|
|
62218
|
+
mkdtempSync as mkdtempSync2,
|
|
62148
62219
|
mkdirSync as mkdirSync4,
|
|
62149
62220
|
lstatSync as lstatSync2,
|
|
62150
62221
|
openSync,
|
|
@@ -62793,7 +62864,7 @@ function emitDownloadTelemetry(options, event) {
|
|
|
62793
62864
|
}
|
|
62794
62865
|
}
|
|
62795
62866
|
async function runDownloadAttempt(url, localPath, timeoutMs, attempt, options, signal) {
|
|
62796
|
-
const attemptDir =
|
|
62867
|
+
const attemptDir = mkdtempSync2(join8(dirname6(localPath), ".hf-download-"));
|
|
62797
62868
|
const partialPath = join8(attemptDir, "payload");
|
|
62798
62869
|
const controller = new AbortController();
|
|
62799
62870
|
let timedOut = false;
|
|
@@ -69602,57 +69673,264 @@ function stripStringLiterals(source) {
|
|
|
69602
69673
|
(literal2) => literal2[0] + " ".repeat(Math.max(0, literal2.length - 1))
|
|
69603
69674
|
);
|
|
69604
69675
|
}
|
|
69605
|
-
function
|
|
69676
|
+
function scanJsComments(source) {
|
|
69606
69677
|
let out = "";
|
|
69607
69678
|
let i = 0;
|
|
69608
69679
|
let quote = null;
|
|
69609
69680
|
let escaped = false;
|
|
69681
|
+
let inRegex = false;
|
|
69682
|
+
let inRegexClass = false;
|
|
69683
|
+
let regexMisread = false;
|
|
69684
|
+
const ctx = new CodeContext();
|
|
69685
|
+
const emitCode = (ch) => {
|
|
69686
|
+
out += ch;
|
|
69687
|
+
ctx.push(ch);
|
|
69688
|
+
};
|
|
69689
|
+
const emitOpaque = (ch) => {
|
|
69690
|
+
out += ch;
|
|
69691
|
+
ctx.push(" ");
|
|
69692
|
+
};
|
|
69610
69693
|
while (i < source.length) {
|
|
69611
69694
|
const ch = source[i] ?? "";
|
|
69612
69695
|
const next = source[i + 1] ?? "";
|
|
69613
|
-
if (
|
|
69696
|
+
if (inRegex) {
|
|
69614
69697
|
out += ch;
|
|
69615
69698
|
if (escaped) {
|
|
69616
69699
|
escaped = false;
|
|
69700
|
+
if (ch === "\n" || ch === "\r") {
|
|
69701
|
+
inRegex = false;
|
|
69702
|
+
inRegexClass = false;
|
|
69703
|
+
regexMisread = true;
|
|
69704
|
+
}
|
|
69705
|
+
} else if (ch === "\\") {
|
|
69706
|
+
escaped = true;
|
|
69707
|
+
} else if (ch === "[") {
|
|
69708
|
+
inRegexClass = true;
|
|
69709
|
+
} else if (ch === "]") {
|
|
69710
|
+
inRegexClass = false;
|
|
69711
|
+
} else if (ch === "/" && !inRegexClass) {
|
|
69712
|
+
inRegex = false;
|
|
69713
|
+
ctx.push(ch);
|
|
69714
|
+
} else if (ch === "\n" || ch === "\r") {
|
|
69715
|
+
inRegex = false;
|
|
69716
|
+
inRegexClass = false;
|
|
69717
|
+
regexMisread = true;
|
|
69718
|
+
}
|
|
69719
|
+
i += 1;
|
|
69720
|
+
continue;
|
|
69721
|
+
}
|
|
69722
|
+
if (quote) {
|
|
69723
|
+
if (escaped) {
|
|
69724
|
+
escaped = false;
|
|
69725
|
+
emitOpaque(ch);
|
|
69617
69726
|
} else if (ch === "\\") {
|
|
69618
69727
|
escaped = true;
|
|
69728
|
+
emitOpaque(ch);
|
|
69619
69729
|
} else if (ch === quote) {
|
|
69620
69730
|
quote = null;
|
|
69731
|
+
emitCode(ch);
|
|
69732
|
+
} else {
|
|
69733
|
+
emitOpaque(ch);
|
|
69621
69734
|
}
|
|
69622
69735
|
i += 1;
|
|
69623
69736
|
continue;
|
|
69624
69737
|
}
|
|
69625
69738
|
if (ch === "'" || ch === '"' || ch === "`") {
|
|
69626
69739
|
quote = ch;
|
|
69627
|
-
|
|
69740
|
+
emitCode(ch);
|
|
69628
69741
|
i += 1;
|
|
69629
69742
|
continue;
|
|
69630
69743
|
}
|
|
69631
69744
|
if (ch === "/" && next === "/") {
|
|
69632
69745
|
out += " ";
|
|
69746
|
+
ctx.push(" ");
|
|
69747
|
+
ctx.push(" ");
|
|
69633
69748
|
i += 2;
|
|
69634
69749
|
while (i < source.length && source[i] !== "\n" && source[i] !== "\r") {
|
|
69635
69750
|
out += " ";
|
|
69751
|
+
ctx.push(" ");
|
|
69636
69752
|
i += 1;
|
|
69637
69753
|
}
|
|
69638
69754
|
continue;
|
|
69639
69755
|
}
|
|
69640
69756
|
if (ch === "/" && next === "*") {
|
|
69641
69757
|
out += " ";
|
|
69758
|
+
ctx.push(" ");
|
|
69759
|
+
ctx.push(" ");
|
|
69642
69760
|
i += 2;
|
|
69643
69761
|
while (i < source.length) {
|
|
69644
69762
|
const blockCh = source[i] ?? "";
|
|
69645
69763
|
const blockNext = source[i + 1] ?? "";
|
|
69646
69764
|
if (blockCh === "*" && blockNext === "/") {
|
|
69647
69765
|
out += " ";
|
|
69766
|
+
ctx.push(" ");
|
|
69767
|
+
ctx.push(" ");
|
|
69648
69768
|
i += 2;
|
|
69649
69769
|
break;
|
|
69650
69770
|
}
|
|
69651
|
-
|
|
69771
|
+
const kept = blockCh === "\n" || blockCh === "\r" ? blockCh : " ";
|
|
69772
|
+
out += kept;
|
|
69773
|
+
ctx.push(kept);
|
|
69652
69774
|
i += 1;
|
|
69653
69775
|
}
|
|
69654
69776
|
continue;
|
|
69655
69777
|
}
|
|
69778
|
+
if (ch === "/" && ctx.startsRegexLiteral()) {
|
|
69779
|
+
inRegex = true;
|
|
69780
|
+
emitCode(ch);
|
|
69781
|
+
i += 1;
|
|
69782
|
+
continue;
|
|
69783
|
+
}
|
|
69784
|
+
emitCode(ch);
|
|
69785
|
+
i += 1;
|
|
69786
|
+
}
|
|
69787
|
+
return { out, balanced: quote === null && !inRegex && !regexMisread };
|
|
69788
|
+
}
|
|
69789
|
+
function stripJsComments(source) {
|
|
69790
|
+
return scanJsComments(source).out;
|
|
69791
|
+
}
|
|
69792
|
+
function stripJsCode(source) {
|
|
69793
|
+
const { out, balanced } = scanJsComments(source);
|
|
69794
|
+
return balanced ? stripJsStringLiterals(out) : source;
|
|
69795
|
+
}
|
|
69796
|
+
function stripJsStringLiterals(source) {
|
|
69797
|
+
let out = "";
|
|
69798
|
+
let i = 0;
|
|
69799
|
+
const templateBraces = [];
|
|
69800
|
+
const ctx = new CodeContext();
|
|
69801
|
+
let quote = null;
|
|
69802
|
+
let escaped = false;
|
|
69803
|
+
let inRegex = false;
|
|
69804
|
+
let inRegexClass = false;
|
|
69805
|
+
let regexMisread = false;
|
|
69806
|
+
const blank = (ch) => ch === "\n" || ch === "\r" ? ch : " ";
|
|
69807
|
+
const emit = (text) => {
|
|
69808
|
+
out += text;
|
|
69809
|
+
for (const ch of text) ctx.push(ch);
|
|
69810
|
+
};
|
|
69811
|
+
while (i < source.length) {
|
|
69812
|
+
const ch = source[i] ?? "";
|
|
69813
|
+
const next = source[i + 1] ?? "";
|
|
69814
|
+
if (inRegex) {
|
|
69815
|
+
if (escaped) {
|
|
69816
|
+
escaped = false;
|
|
69817
|
+
if (ch === "\n" || ch === "\r") {
|
|
69818
|
+
inRegex = false;
|
|
69819
|
+
inRegexClass = false;
|
|
69820
|
+
regexMisread = true;
|
|
69821
|
+
}
|
|
69822
|
+
emit(blank(ch));
|
|
69823
|
+
} else if (ch === "\\") {
|
|
69824
|
+
escaped = true;
|
|
69825
|
+
emit(" ");
|
|
69826
|
+
} else if (ch === "[") {
|
|
69827
|
+
inRegexClass = true;
|
|
69828
|
+
emit(" ");
|
|
69829
|
+
} else if (ch === "]") {
|
|
69830
|
+
inRegexClass = false;
|
|
69831
|
+
emit(" ");
|
|
69832
|
+
} else if (ch === "/" && !inRegexClass) {
|
|
69833
|
+
inRegex = false;
|
|
69834
|
+
emit(ch);
|
|
69835
|
+
} else if (ch === "\n" || ch === "\r") {
|
|
69836
|
+
inRegex = false;
|
|
69837
|
+
inRegexClass = false;
|
|
69838
|
+
escaped = false;
|
|
69839
|
+
regexMisread = true;
|
|
69840
|
+
emit(ch);
|
|
69841
|
+
} else {
|
|
69842
|
+
emit(" ");
|
|
69843
|
+
}
|
|
69844
|
+
i += 1;
|
|
69845
|
+
continue;
|
|
69846
|
+
}
|
|
69847
|
+
if (quote) {
|
|
69848
|
+
if (escaped) {
|
|
69849
|
+
escaped = false;
|
|
69850
|
+
emit(blank(ch));
|
|
69851
|
+
} else if (ch === "\\") {
|
|
69852
|
+
escaped = true;
|
|
69853
|
+
emit(" ");
|
|
69854
|
+
} else if (ch === quote) {
|
|
69855
|
+
quote = null;
|
|
69856
|
+
emit(ch);
|
|
69857
|
+
} else if (ch === "`" || quote !== "`" || ch !== "$" || next !== "{") {
|
|
69858
|
+
emit(blank(ch));
|
|
69859
|
+
} else {
|
|
69860
|
+
templateBraces.push(0);
|
|
69861
|
+
quote = null;
|
|
69862
|
+
emit("${");
|
|
69863
|
+
i += 2;
|
|
69864
|
+
continue;
|
|
69865
|
+
}
|
|
69866
|
+
i += 1;
|
|
69867
|
+
continue;
|
|
69868
|
+
}
|
|
69869
|
+
if (ch === "'" || ch === '"' || ch === "`") {
|
|
69870
|
+
quote = ch;
|
|
69871
|
+
emit(ch);
|
|
69872
|
+
i += 1;
|
|
69873
|
+
continue;
|
|
69874
|
+
}
|
|
69875
|
+
if (ch === "/" && next !== "/" && next !== "*" && ctx.startsRegexLiteral()) {
|
|
69876
|
+
inRegex = true;
|
|
69877
|
+
emit(ch);
|
|
69878
|
+
i += 1;
|
|
69879
|
+
continue;
|
|
69880
|
+
}
|
|
69881
|
+
if (templateBraces.length > 0) {
|
|
69882
|
+
const depth = templateBraces[templateBraces.length - 1] ?? 0;
|
|
69883
|
+
if (ch === "{") templateBraces[templateBraces.length - 1] = depth + 1;
|
|
69884
|
+
else if (ch === "}") {
|
|
69885
|
+
if (depth === 0) {
|
|
69886
|
+
templateBraces.pop();
|
|
69887
|
+
quote = "`";
|
|
69888
|
+
emit(ch);
|
|
69889
|
+
i += 1;
|
|
69890
|
+
continue;
|
|
69891
|
+
}
|
|
69892
|
+
templateBraces[templateBraces.length - 1] = depth - 1;
|
|
69893
|
+
}
|
|
69894
|
+
}
|
|
69895
|
+
emit(ch);
|
|
69896
|
+
i += 1;
|
|
69897
|
+
}
|
|
69898
|
+
if (quote !== null || templateBraces.length > 0 || inRegex || regexMisread) return source;
|
|
69899
|
+
return out;
|
|
69900
|
+
}
|
|
69901
|
+
function stripCssComments(source) {
|
|
69902
|
+
let out = "";
|
|
69903
|
+
let i = 0;
|
|
69904
|
+
let quote = null;
|
|
69905
|
+
while (i < source.length) {
|
|
69906
|
+
const ch = source[i] ?? "";
|
|
69907
|
+
if (quote) {
|
|
69908
|
+
out += ch;
|
|
69909
|
+
if (ch === "\\") {
|
|
69910
|
+
out += source[i + 1] ?? "";
|
|
69911
|
+
i += 2;
|
|
69912
|
+
continue;
|
|
69913
|
+
}
|
|
69914
|
+
if (ch === quote) quote = null;
|
|
69915
|
+
i += 1;
|
|
69916
|
+
continue;
|
|
69917
|
+
}
|
|
69918
|
+
if (ch === '"' || ch === "'") {
|
|
69919
|
+
quote = ch;
|
|
69920
|
+
out += ch;
|
|
69921
|
+
i += 1;
|
|
69922
|
+
continue;
|
|
69923
|
+
}
|
|
69924
|
+
if (ch === "/" && source[i + 1] === "*") {
|
|
69925
|
+
const end = source.indexOf("*/", i + 2);
|
|
69926
|
+
const stop = end === -1 ? source.length : end + 2;
|
|
69927
|
+
for (let j = i; j < stop; j += 1) {
|
|
69928
|
+
const c = source[j] ?? "";
|
|
69929
|
+
out += c === "\n" || c === "\r" ? c : " ";
|
|
69930
|
+
}
|
|
69931
|
+
i = stop;
|
|
69932
|
+
continue;
|
|
69933
|
+
}
|
|
69656
69934
|
out += ch;
|
|
69657
69935
|
i += 1;
|
|
69658
69936
|
}
|
|
@@ -69904,6 +70182,7 @@ function srcKind(src) {
|
|
|
69904
70182
|
if (!mime) return null;
|
|
69905
70183
|
if (mime.startsWith("image/")) return "image";
|
|
69906
70184
|
if (mime.startsWith("video/")) return "video";
|
|
70185
|
+
if (mime.startsWith("audio/")) return "audio";
|
|
69907
70186
|
return null;
|
|
69908
70187
|
}
|
|
69909
70188
|
if (lower.startsWith("blob:")) return null;
|
|
@@ -69923,6 +70202,7 @@ function srcKind(src) {
|
|
|
69923
70202
|
const ext = base2.slice(dot + 1).toLowerCase();
|
|
69924
70203
|
if (IMAGE_SRC_EXT.has(ext)) return "image";
|
|
69925
70204
|
if (VIDEO_SRC_EXT.has(ext)) return "video";
|
|
70205
|
+
if (AUDIO_SRC_EXT.has(ext)) return "audio";
|
|
69926
70206
|
return null;
|
|
69927
70207
|
}
|
|
69928
70208
|
function findMediaSrcKindMismatchFindings(ctx) {
|
|
@@ -69933,16 +70213,15 @@ function findMediaSrcKindMismatchFindings(ctx) {
|
|
|
69933
70213
|
if (!src) continue;
|
|
69934
70214
|
const kind = srcKind(src);
|
|
69935
70215
|
if (kind === null) continue;
|
|
69936
|
-
if (tag.name === "video" && kind !== "image") continue;
|
|
69937
|
-
if (tag.name === "img" && kind !== "video") continue;
|
|
69938
|
-
const elementId = readAttr(tag.raw, "id") || void 0;
|
|
69939
70216
|
const expected = tag.name === "video" ? "video" : "image";
|
|
70217
|
+
if (kind === expected) continue;
|
|
70218
|
+
const elementId = readAttr(tag.raw, "id") || void 0;
|
|
69940
70219
|
findings.push({
|
|
69941
70220
|
code: "media_src_kind_mismatch",
|
|
69942
70221
|
severity: "error",
|
|
69943
|
-
message: `<${tag.name}${elementId ? ` id="${elementId}"` : ""}> src is
|
|
70222
|
+
message: `<${tag.name}${elementId ? ` id="${elementId}"` : ""}> src is ${SRC_KIND_NOUN[kind]}, not ${SRC_KIND_NOUN[expected]}. The producer fail-closes when the tag and file kind disagree.`,
|
|
69944
70223
|
elementId,
|
|
69945
|
-
fixHint: tag.name === "video" ? "Use <img> for a still, or point <video> at a video URL (mp4/webm/mov/\u2026)." : "Use <video> for a video URL, or point <img> at a still (png/jpg/webp/\u2026).",
|
|
70224
|
+
fixHint: tag.name === "video" ? "Use <img> for a still, <audio> for sound, or point <video> at a video URL (mp4/webm/mov/\u2026)." : "Use <video> for a video URL, <audio> for sound, or point <img> at a still (png/jpg/webp/\u2026).",
|
|
69946
70225
|
snippet: truncateSnippet(tag.raw)
|
|
69947
70226
|
});
|
|
69948
70227
|
}
|
|
@@ -70338,6 +70617,14 @@ function isHiddenGsapState(values) {
|
|
|
70338
70617
|
const display = stringValue(values.display)?.toLowerCase();
|
|
70339
70618
|
return zeroValue(values.opacity) || zeroValue(values.autoAlpha) || visibility === "hidden" || display === "none";
|
|
70340
70619
|
}
|
|
70620
|
+
function hiddenSetTargetSelectors(target, aliases2) {
|
|
70621
|
+
const parts = target.startsWith("[") && target.endsWith("]") ? target.slice(1, -1).split(",") : [target];
|
|
70622
|
+
return parts.flatMap((part) => {
|
|
70623
|
+
const trimmed = part.trim();
|
|
70624
|
+
const resolved = /^(["'`])([^"'`]+)\1$/.exec(trimmed)?.[2] ?? aliases2.get(trimmed);
|
|
70625
|
+
return resolved === void 0 ? [] : resolved.split(",");
|
|
70626
|
+
}).map((selector) => selector.trim()).filter((selector) => selector.length > 0);
|
|
70627
|
+
}
|
|
70341
70628
|
function extractStandaloneHiddenSelectors(script) {
|
|
70342
70629
|
const selectors = /* @__PURE__ */ new Set();
|
|
70343
70630
|
const source = stripJsComments(script);
|
|
@@ -70348,16 +70635,15 @@ function extractStandaloneHiddenSelectors(script) {
|
|
|
70348
70635
|
)) {
|
|
70349
70636
|
aliases2.set(match2[1] ?? "", match2[3] ?? "");
|
|
70350
70637
|
}
|
|
70351
|
-
const pattern = /gsap\.set\s*\(\s*([^,]+?)\s*,\s*\{([\s\S]*?)\}\s*\)/g;
|
|
70638
|
+
const pattern = /gsap\.set\s*\(\s*(\[[^[\]]*\]|"[^"]*"|'[^']*'|`[^`]*`|[^,()[\]]+?)\s*,\s*\{([\s\S]*?)\}\s*\)/g;
|
|
70352
70639
|
let match;
|
|
70353
70640
|
while ((match = pattern.exec(source)) !== null) {
|
|
70354
70641
|
if (indexInsideNonIifeRange(match.index, source, functionRanges)) continue;
|
|
70355
|
-
const
|
|
70356
|
-
|
|
70357
|
-
if (!selector) continue;
|
|
70642
|
+
const targets = hiddenSetTargetSelectors((match[1] ?? "").trim(), aliases2);
|
|
70643
|
+
if (targets.length === 0) continue;
|
|
70358
70644
|
const body = match[2] ?? "";
|
|
70359
70645
|
if (/(?:opacity|autoAlpha)\s*:\s*0(?:\.0+)?\s*(?:,|$)/.test(body)) {
|
|
70360
|
-
selectors.add(selector);
|
|
70646
|
+
for (const selector of targets) selectors.add(selector);
|
|
70361
70647
|
}
|
|
70362
70648
|
}
|
|
70363
70649
|
return selectors;
|
|
@@ -71145,7 +71431,7 @@ function collectTextureCss(styles) {
|
|
|
71145
71431
|
}
|
|
71146
71432
|
return { definedTextureClasses, dropShadowRules };
|
|
71147
71433
|
}
|
|
71148
|
-
function
|
|
71434
|
+
function stripCssComments2(css) {
|
|
71149
71435
|
return css.replace(/\/\*[\s\S]*?\*\//g, " ");
|
|
71150
71436
|
}
|
|
71151
71437
|
function extractFontFaceFamilies(styles) {
|
|
@@ -71153,7 +71439,7 @@ function extractFontFaceFamilies(styles) {
|
|
|
71153
71439
|
const fontFaceRe = /@font-face\s*\{[^}]*\}/gi;
|
|
71154
71440
|
const familyRe = /font-family\s*:\s*(['"]?)([^;'"]+)\1/i;
|
|
71155
71441
|
for (const style of styles) {
|
|
71156
|
-
const content =
|
|
71442
|
+
const content = stripCssComments2(style.content);
|
|
71157
71443
|
let match;
|
|
71158
71444
|
while ((match = fontFaceRe.exec(content)) !== null) {
|
|
71159
71445
|
const familyMatch = match[0].match(familyRe);
|
|
@@ -71174,7 +71460,7 @@ function extractUsedFontFamilies(styles) {
|
|
|
71174
71460
|
const seen = /* @__PURE__ */ new Set();
|
|
71175
71461
|
const propRe = /font-family\s*:\s*([^;}{]+)/gi;
|
|
71176
71462
|
for (const style of styles) {
|
|
71177
|
-
const withoutFontFace =
|
|
71463
|
+
const withoutFontFace = stripCssComments2(style.content).replace(/@font-face\s*\{[^}]*\}/gi, "");
|
|
71178
71464
|
let match;
|
|
71179
71465
|
while ((match = propRe.exec(withoutFontFace)) !== null) {
|
|
71180
71466
|
for (const part of match[1].split(",")) {
|
|
@@ -71332,7 +71618,7 @@ async function lintHyperframeHtml(html, options = {}) {
|
|
|
71332
71618
|
timings: { totalMs: performance.now() - startedAt, ...timings }
|
|
71333
71619
|
};
|
|
71334
71620
|
}
|
|
71335
|
-
var import_postcss_selector_parser, COMPOSITION_ID_IN_CSS_PATTERN, TIMELINE_REGISTRY_INIT_PATTERN, TIMELINE_REGISTRY_OBJECT_LITERAL_PATTERN, TIMELINE_REGISTRY_ASSIGN_PATTERN, WINDOW_TIMELINE_ASSIGN_PATTERN, INVALID_SCRIPT_CLOSE_PATTERN, TIMELINE_REGISTRY_KEY_PATTERN, TIMELINE_REGISTRY_OBJECT_OPEN_PATTERN, TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN, VISIBLE_MARKUP_COMMENT_PATTERN, VISIBLE_MARKUP_COMMENT_PROTECTED_BLOCK_PATTERN, coreRules, IMAGE_SRC_EXT, VIDEO_SRC_EXT, mediaRules, AUDIO_GROUP_TIMING_ATTRS, SCENE_BOUNDARY_EPSILON_SECONDS, UNRESOLVED_TARGET, gsapWindowsCache, CONFLICTING_TRANSLATE_PROPS, CONFLICTING_SCALE_PROPS, RELATIVE_TWEEN_VALUE, TRANSFORM_SENSITIVE_READ, TRANSFORM_INVARIANT_READ, CALLBACK_MEASUREMENT_PATTERN, NUMBER_METHODS, gsapRules, captionRules, MAX_COMPOSITION_LINES, MAX_TIMED_ELEMENTS_PER_TRACK, TRACK_DENSITY_EXEMPT_TAGS, CAPTION_CUE_TOKEN, HEAVY_OVERLAY_ELEMENT_COUNT_WARN, HEAVY_OVERLAY_EXEMPT_TAGS, HEAVY_OVERLAY_CSS_PATTERN, INLINE_STYLE_DISPLAY_NONE_PATTERN, compositionRules, adapterRules, TEXTURE_BASE_CLASS, TEXTURE_CLASS_PREFIX, textureRules, GENERIC_FAMILIES, fontRules, slideshowRules, RULE_GROUPS, LINT_RULE_COUNT, LINT_RULE_GROUP_COUNTS;
|
|
71621
|
+
var import_postcss_selector_parser, COMPOSITION_ID_IN_CSS_PATTERN, TIMELINE_REGISTRY_INIT_PATTERN, TIMELINE_REGISTRY_OBJECT_LITERAL_PATTERN, TIMELINE_REGISTRY_ASSIGN_PATTERN, WINDOW_TIMELINE_ASSIGN_PATTERN, INVALID_SCRIPT_CLOSE_PATTERN, TIMELINE_REGISTRY_KEY_PATTERN, TIMELINE_REGISTRY_OBJECT_OPEN_PATTERN, TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN, REGEX_ALLOWED_BEFORE, REGEX_ALLOWED_KEYWORDS, WORD_CHAR, CodeContext, VISIBLE_MARKUP_COMMENT_PATTERN, VISIBLE_MARKUP_COMMENT_PROTECTED_BLOCK_PATTERN, coreRules, IMAGE_SRC_EXT, VIDEO_SRC_EXT, AUDIO_SRC_EXT, SRC_KIND_NOUN, mediaRules, AUDIO_GROUP_TIMING_ATTRS, SCENE_BOUNDARY_EPSILON_SECONDS, UNRESOLVED_TARGET, gsapWindowsCache, CONFLICTING_TRANSLATE_PROPS, CONFLICTING_SCALE_PROPS, RELATIVE_TWEEN_VALUE, TRANSFORM_SENSITIVE_READ, TRANSFORM_INVARIANT_READ, CALLBACK_MEASUREMENT_PATTERN, NUMBER_METHODS, gsapRules, captionRules, MAX_COMPOSITION_LINES, MAX_TIMED_ELEMENTS_PER_TRACK, TRACK_DENSITY_EXEMPT_TAGS, CAPTION_CUE_TOKEN, HEAVY_OVERLAY_ELEMENT_COUNT_WARN, HEAVY_OVERLAY_EXEMPT_TAGS, HEAVY_OVERLAY_CSS_PATTERN, INLINE_STYLE_DISPLAY_NONE_PATTERN, compositionRules, adapterRules, TEXTURE_BASE_CLASS, TEXTURE_CLASS_PREFIX, textureRules, GENERIC_FAMILIES, fontRules, slideshowRules, RULE_GROUPS, LINT_RULE_COUNT, LINT_RULE_GROUP_COUNTS;
|
|
71336
71622
|
var init_dist3 = __esm({
|
|
71337
71623
|
"../lint/dist/index.js"() {
|
|
71338
71624
|
"use strict";
|
|
@@ -71353,6 +71639,53 @@ var init_dist3 = __esm({
|
|
|
71353
71639
|
TIMELINE_REGISTRY_KEY_PATTERN = /window\.__timelines(?:\[\s*["']([^"']+)["']\s*\]|\.\s*([A-Za-z_$][\w$]*))\s*=/g;
|
|
71354
71640
|
TIMELINE_REGISTRY_OBJECT_OPEN_PATTERN = /window\.__timelines\s*=\s*\{/i;
|
|
71355
71641
|
TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN = /(?:["']([^"']+)["']|([A-Za-z_$][\w$]*))\s*:\s*[A-Za-z_$][\w$]*/g;
|
|
71642
|
+
REGEX_ALLOWED_BEFORE = new Set("=(,:[!&|?{};+-*%^~<>");
|
|
71643
|
+
REGEX_ALLOWED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
71644
|
+
"return",
|
|
71645
|
+
"typeof",
|
|
71646
|
+
"instanceof",
|
|
71647
|
+
"in",
|
|
71648
|
+
"of",
|
|
71649
|
+
"new",
|
|
71650
|
+
"delete",
|
|
71651
|
+
"void",
|
|
71652
|
+
"case",
|
|
71653
|
+
"do",
|
|
71654
|
+
"else",
|
|
71655
|
+
"yield",
|
|
71656
|
+
"await"
|
|
71657
|
+
]);
|
|
71658
|
+
WORD_CHAR = /[A-Za-z0-9_$]/;
|
|
71659
|
+
CodeContext = class {
|
|
71660
|
+
last = "";
|
|
71661
|
+
prev = "";
|
|
71662
|
+
word = "";
|
|
71663
|
+
wordEnded = false;
|
|
71664
|
+
wordAfterDot = false;
|
|
71665
|
+
push(ch) {
|
|
71666
|
+
if (ch === " " || ch === " " || ch === "\n" || ch === "\r") {
|
|
71667
|
+
this.wordEnded = true;
|
|
71668
|
+
return;
|
|
71669
|
+
}
|
|
71670
|
+
if (WORD_CHAR.test(ch)) {
|
|
71671
|
+
if (this.wordEnded || this.word === "") this.wordAfterDot = this.last === ".";
|
|
71672
|
+
this.word = this.wordEnded ? ch : this.word + ch;
|
|
71673
|
+
} else {
|
|
71674
|
+
this.word = "";
|
|
71675
|
+
this.wordAfterDot = false;
|
|
71676
|
+
}
|
|
71677
|
+
this.wordEnded = false;
|
|
71678
|
+
this.prev = this.last;
|
|
71679
|
+
this.last = ch;
|
|
71680
|
+
}
|
|
71681
|
+
startsRegexLiteral() {
|
|
71682
|
+
if (this.last === "") return true;
|
|
71683
|
+
if (WORD_CHAR.test(this.last))
|
|
71684
|
+
return !this.wordAfterDot && REGEX_ALLOWED_KEYWORDS.has(this.word);
|
|
71685
|
+
if ((this.last === "+" || this.last === "-") && this.prev === this.last) return false;
|
|
71686
|
+
return REGEX_ALLOWED_BEFORE.has(this.last);
|
|
71687
|
+
}
|
|
71688
|
+
};
|
|
71356
71689
|
VISIBLE_MARKUP_COMMENT_PATTERN = /\/\*[\s\S]*?\*\//g;
|
|
71357
71690
|
VISIBLE_MARKUP_COMMENT_PROTECTED_BLOCK_PATTERN = /<(style|script|template|title|noscript|pre|code|textarea|text)\b[^>]*>[\s\S]*?<\/\1(?:\s[^>]*)?>/gi;
|
|
71358
71691
|
coreRules = [
|
|
@@ -71666,6 +71999,12 @@ var init_dist3 = __esm({
|
|
|
71666
71999
|
"mpg",
|
|
71667
72000
|
"mpeg"
|
|
71668
72001
|
]);
|
|
72002
|
+
AUDIO_SRC_EXT = /* @__PURE__ */ new Set(["mp3", "wav", "aac", "flac", "opus", "aiff", "wma"]);
|
|
72003
|
+
SRC_KIND_NOUN = {
|
|
72004
|
+
image: "an image",
|
|
72005
|
+
video: "a video",
|
|
72006
|
+
audio: "an audio file"
|
|
72007
|
+
};
|
|
71669
72008
|
mediaRules = [
|
|
71670
72009
|
// duplicate_media_id + duplicate_media_discovery_risk
|
|
71671
72010
|
({ tags }) => {
|
|
@@ -72072,6 +72411,9 @@ var init_dist3 = __esm({
|
|
|
72072
72411
|
// fallow-ignore-next-line complexity
|
|
72073
72412
|
async ({ source, tags, scripts, styles, rootCompositionId }) => {
|
|
72074
72413
|
const findings = [];
|
|
72414
|
+
const authoredHiddenSelectors = new Set(
|
|
72415
|
+
scripts.flatMap((script) => [...extractStandaloneHiddenSelectors(script.content)])
|
|
72416
|
+
);
|
|
72075
72417
|
const clipIds = /* @__PURE__ */ new Map();
|
|
72076
72418
|
const clipClasses = /* @__PURE__ */ new Map();
|
|
72077
72419
|
for (const tag of tags) {
|
|
@@ -72164,9 +72506,10 @@ ${right.raw}`)
|
|
|
72164
72506
|
);
|
|
72165
72507
|
}).sort((a, b) => a.position - b.position);
|
|
72166
72508
|
const startsHiddenAtZero = visibilityWindows.some(
|
|
72167
|
-
(win) => win.position <= SCENE_BOUNDARY_EPSILON_SECONDS && isHiddenGsapState(win.propertyValues)
|
|
72509
|
+
(win) => win.position <= SCENE_BOUNDARY_EPSILON_SECONDS && (isHiddenGsapState(win.propertyValues) || win.fromPropertyValues !== void 0 && isHiddenGsapState(win.fromPropertyValues))
|
|
72168
72510
|
);
|
|
72169
72511
|
if (startsHiddenAtZero) continue;
|
|
72512
|
+
if (selectors.some((selector2) => authoredHiddenSelectors.has(selector2))) continue;
|
|
72170
72513
|
const firstVisible = visibilityWindows.find((win) => makesOverlayVisible(win));
|
|
72171
72514
|
if (!firstVisible) continue;
|
|
72172
72515
|
const selector = selectors.find(
|
|
@@ -73493,8 +73836,8 @@ ${other.raw}`)
|
|
|
73493
73836
|
});
|
|
73494
73837
|
}
|
|
73495
73838
|
};
|
|
73496
|
-
for (const style of styles) scan(style.content);
|
|
73497
|
-
for (const script of scripts) scan(script.content);
|
|
73839
|
+
for (const style of styles) scan(stripCssComments(style.content));
|
|
73840
|
+
for (const script of scripts) scan(stripJsComments(script.content));
|
|
73498
73841
|
return findings;
|
|
73499
73842
|
},
|
|
73500
73843
|
// template_literal_selector
|
|
@@ -73502,14 +73845,17 @@ ${other.raw}`)
|
|
|
73502
73845
|
const findings = [];
|
|
73503
73846
|
for (const script of scripts) {
|
|
73504
73847
|
const templateLiteralSelectorPattern = /(?:querySelector|querySelectorAll)\s*\(\s*`[^`]*\$\{[^}]+\}[^`]*`\s*\)/g;
|
|
73848
|
+
const scanned = stripJsCode(script.content);
|
|
73505
73849
|
let tlMatch;
|
|
73506
|
-
while ((tlMatch = templateLiteralSelectorPattern.exec(
|
|
73850
|
+
while ((tlMatch = templateLiteralSelectorPattern.exec(scanned)) !== null) {
|
|
73507
73851
|
findings.push({
|
|
73508
73852
|
code: "template_literal_selector",
|
|
73509
73853
|
severity: "error",
|
|
73510
73854
|
message: "querySelector uses a template literal variable (e.g. `${compId}`). The HTML bundler's CSS parser crashes on these. Use a hardcoded string instead.",
|
|
73511
73855
|
fixHint: "Replace the template literal variable with a hardcoded string. The bundler's CSS parser cannot handle interpolated variables in script content.",
|
|
73512
|
-
snippet: truncateSnippet(
|
|
73856
|
+
snippet: truncateSnippet(
|
|
73857
|
+
script.content.slice(tlMatch.index, tlMatch.index + tlMatch[0].length)
|
|
73858
|
+
)
|
|
73513
73859
|
});
|
|
73514
73860
|
}
|
|
73515
73861
|
}
|
|
@@ -73611,7 +73957,7 @@ ${other.raw}`)
|
|
|
73611
73957
|
if (isRegistrySourceFile(options.filePath) || isRegistryInstalledFile(rawSource)) return [];
|
|
73612
73958
|
const findings = [];
|
|
73613
73959
|
for (const script of scripts) {
|
|
73614
|
-
const stripped =
|
|
73960
|
+
const stripped = stripJsCode(script.content);
|
|
73615
73961
|
if (/requestAnimationFrame\s*\(/.test(stripped)) {
|
|
73616
73962
|
findings.push({
|
|
73617
73963
|
code: "requestanimationframe_in_composition",
|
|
@@ -77068,8 +77414,8 @@ var init_wavChunks = __esm({
|
|
|
77068
77414
|
});
|
|
77069
77415
|
|
|
77070
77416
|
// ../engine/src/services/audioVolumeEnvelope.ts
|
|
77071
|
-
import { readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
77072
|
-
import {
|
|
77417
|
+
import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync3, renameSync as renameSync2, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
77418
|
+
import { dirname as dirname7, join as join12 } from "path";
|
|
77073
77419
|
function readFmtChunk(buffer, body) {
|
|
77074
77420
|
const format = buffer.readUInt16LE(body);
|
|
77075
77421
|
const bits = buffer.readUInt16LE(body + 14);
|
|
@@ -77135,17 +77481,26 @@ function scaleSamples(buffer, layout2, gainAt) {
|
|
|
77135
77481
|
function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
77136
77482
|
const gainAt = createEnvelopeWalker(keyframes, trackStart, baseVolume);
|
|
77137
77483
|
if (!gainAt) return false;
|
|
77484
|
+
let stagingDir;
|
|
77138
77485
|
try {
|
|
77139
77486
|
const buffer = readFileSync3(wavPath);
|
|
77140
77487
|
const layout2 = parseWavLayout(buffer);
|
|
77141
77488
|
if (!layout2) return false;
|
|
77142
77489
|
scaleSamples(buffer, layout2, gainAt);
|
|
77143
|
-
|
|
77144
|
-
|
|
77490
|
+
stagingDir = mkdtempSync3(join12(dirname7(wavPath), ".hf-volume-"));
|
|
77491
|
+
const tempPath = join12(stagingDir, "audio.wav");
|
|
77492
|
+
writeFileSync4(tempPath, buffer, { flag: "wx" });
|
|
77145
77493
|
renameSync2(tempPath, wavPath);
|
|
77146
77494
|
return true;
|
|
77147
77495
|
} catch {
|
|
77148
77496
|
return false;
|
|
77497
|
+
} finally {
|
|
77498
|
+
if (stagingDir) {
|
|
77499
|
+
try {
|
|
77500
|
+
rmSync4(stagingDir, { recursive: true, force: true });
|
|
77501
|
+
} catch {
|
|
77502
|
+
}
|
|
77503
|
+
}
|
|
77149
77504
|
}
|
|
77150
77505
|
}
|
|
77151
77506
|
var PCM_FORMAT, FLOAT_FORMAT;
|
|
@@ -77234,9 +77589,9 @@ var init_audio_fx_runtime_inline = __esm({
|
|
|
77234
77589
|
});
|
|
77235
77590
|
|
|
77236
77591
|
// ../engine/src/services/audioFxRender.ts
|
|
77237
|
-
import { existsSync as existsSync11, mkdtempSync as
|
|
77592
|
+
import { existsSync as existsSync11, mkdtempSync as mkdtempSync4, readFileSync as readFileSync4, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
77238
77593
|
import { tmpdir as tmpdir2 } from "os";
|
|
77239
|
-
import { join as
|
|
77594
|
+
import { join as join13 } from "path";
|
|
77240
77595
|
import { pathToFileURL } from "url";
|
|
77241
77596
|
function readWavChunks(buf) {
|
|
77242
77597
|
const head = { format: 1, channels: 1, sampleRate: 48e3, bits: 16 };
|
|
@@ -77349,7 +77704,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
77349
77704
|
const { samples, sampleRate, channels, float } = readWav(inputWav);
|
|
77350
77705
|
const planes = deinterleave(samples, channels);
|
|
77351
77706
|
if ((planes[0]?.length ?? 0) === 0) return { path: inputWav, envelopeBaked: false };
|
|
77352
|
-
const hostDir =
|
|
77707
|
+
const hostDir = mkdtempSync4(join13(tmpdir2(), "hf-fx-host-"));
|
|
77353
77708
|
let lease = null;
|
|
77354
77709
|
try {
|
|
77355
77710
|
if (options.signal?.aborted) {
|
|
@@ -77358,7 +77713,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
77358
77713
|
lease = await acquireBrowser(["--no-sandbox", "--autoplay-policy=no-user-gesture-required"]);
|
|
77359
77714
|
const page = await lease.browser.newPage();
|
|
77360
77715
|
try {
|
|
77361
|
-
const hostPage =
|
|
77716
|
+
const hostPage = join13(hostDir, "audio-fx.html");
|
|
77362
77717
|
writeFileSync5(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
|
|
77363
77718
|
await page.goto(pathToFileURL(hostPage).href, { waitUntil: "domcontentloaded" });
|
|
77364
77719
|
await page.addScriptTag({ content: getAudioFxRuntimeScript() });
|
|
@@ -77386,7 +77741,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
|
|
|
77386
77741
|
`Audio FX failed for track ${options.trackId}: ${err.message}`
|
|
77387
77742
|
);
|
|
77388
77743
|
} finally {
|
|
77389
|
-
|
|
77744
|
+
rmSync5(hostDir, { recursive: true, force: true });
|
|
77390
77745
|
await lease?.release().catch(() => void 0);
|
|
77391
77746
|
}
|
|
77392
77747
|
}
|
|
@@ -77494,8 +77849,8 @@ var init_audioFxRender = __esm({
|
|
|
77494
77849
|
});
|
|
77495
77850
|
|
|
77496
77851
|
// ../engine/src/services/audioMixer.ts
|
|
77497
|
-
import { closeSync as closeSync2, existsSync as existsSync12, mkdirSync as mkdirSync7, mkdtempSync as
|
|
77498
|
-
import { join as
|
|
77852
|
+
import { closeSync as closeSync2, existsSync as existsSync12, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync5, openSync as openSync2, rmSync as rmSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
77853
|
+
import { join as join14, dirname as dirname8 } from "path";
|
|
77499
77854
|
function memberGroupKey(el) {
|
|
77500
77855
|
return el.getAttribute(AUDIO_GROUP_RENDER_ID_ATTR) ?? el.getAttribute(HF_AUDIO_GROUP_ATTR);
|
|
77501
77856
|
}
|
|
@@ -77798,7 +78153,7 @@ function parseAudioElements(html) {
|
|
|
77798
78153
|
}
|
|
77799
78154
|
async function extractAudioFromVideo(videoPath, outputPath, options, signal, config) {
|
|
77800
78155
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
77801
|
-
const outputDir =
|
|
78156
|
+
const outputDir = dirname8(outputPath);
|
|
77802
78157
|
if (!existsSync12(outputDir)) mkdirSync7(outputDir, { recursive: true });
|
|
77803
78158
|
const playbackRate = normalizePlaybackRate(options?.playbackRate ?? 1);
|
|
77804
78159
|
const args = [];
|
|
@@ -77842,7 +78197,7 @@ async function extractAudioFromVideo(videoPath, outputPath, options, signal, con
|
|
|
77842
78197
|
}
|
|
77843
78198
|
async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, playbackRate = 1, signal, config) {
|
|
77844
78199
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
77845
|
-
const outputDir =
|
|
78200
|
+
const outputDir = dirname8(outputPath);
|
|
77846
78201
|
if (!existsSync12(outputDir)) mkdirSync7(outputDir, { recursive: true });
|
|
77847
78202
|
const normalizedPlaybackRate = normalizePlaybackRate(playbackRate);
|
|
77848
78203
|
const outputArgs = await preparedAudioOutputArgs(srcPath, normalizedPlaybackRate);
|
|
@@ -77889,7 +78244,7 @@ async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, play
|
|
|
77889
78244
|
}
|
|
77890
78245
|
async function generateSilence(outputPath, duration, signal, config) {
|
|
77891
78246
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
77892
|
-
const outputDir =
|
|
78247
|
+
const outputDir = dirname8(outputPath);
|
|
77893
78248
|
if (!existsSync12(outputDir)) mkdirSync7(outputDir, { recursive: true });
|
|
77894
78249
|
const args = [
|
|
77895
78250
|
"-f",
|
|
@@ -77943,7 +78298,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
77943
78298
|
failures: result2.failure ? [result2.failure] : void 0
|
|
77944
78299
|
};
|
|
77945
78300
|
}
|
|
77946
|
-
const outputDir =
|
|
78301
|
+
const outputDir = dirname8(outputPath);
|
|
77947
78302
|
if (!existsSync12(outputDir)) mkdirSync7(outputDir, { recursive: true });
|
|
77948
78303
|
const buildFilterComplex = (ignoreAutomation) => {
|
|
77949
78304
|
const filterParts = [];
|
|
@@ -77964,8 +78319,8 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
77964
78319
|
const runMix = async (ignoreAutomation) => {
|
|
77965
78320
|
const inputs = [];
|
|
77966
78321
|
tracks.forEach((track) => inputs.push("-i", track.srcPath));
|
|
77967
|
-
const scriptDir =
|
|
77968
|
-
const scriptPath =
|
|
78322
|
+
const scriptDir = mkdtempSync5(join14(outputDir, ".filter-complex-"));
|
|
78323
|
+
const scriptPath = join14(scriptDir, "graph.txt");
|
|
77969
78324
|
const fd = openSync2(scriptPath, "wx", 384);
|
|
77970
78325
|
try {
|
|
77971
78326
|
writeFileSync6(fd, buildFilterComplex(ignoreAutomation));
|
|
@@ -77996,7 +78351,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
77996
78351
|
currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
|
|
77997
78352
|
return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
|
|
77998
78353
|
} finally {
|
|
77999
|
-
|
|
78354
|
+
rmSync6(scriptDir, { recursive: true, force: true });
|
|
78000
78355
|
}
|
|
78001
78356
|
};
|
|
78002
78357
|
let result = await runMix(false);
|
|
@@ -78051,7 +78406,7 @@ function groupNormalizeOptionUnsupported(stderr) {
|
|
|
78051
78406
|
}
|
|
78052
78407
|
async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal, config) {
|
|
78053
78408
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
|
|
78054
|
-
const outputDir =
|
|
78409
|
+
const outputDir = dirname8(outputPath);
|
|
78055
78410
|
if (!existsSync12(outputDir)) mkdirSync7(outputDir, { recursive: true });
|
|
78056
78411
|
const buildInputFilters = (ignoreKeyframes) => memberTracks.map((track, i) => {
|
|
78057
78412
|
const delayMs = Math.round(track.start * 1e3);
|
|
@@ -78071,8 +78426,8 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
|
|
|
78071
78426
|
`${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0[mixed];[mixed]volume=${formatFilterNumber(memberTracks.length)}[out]`
|
|
78072
78427
|
);
|
|
78073
78428
|
const filterComplex = [...inputFilters, mixFilter].join(";");
|
|
78074
|
-
const scriptDir =
|
|
78075
|
-
const scriptPath =
|
|
78429
|
+
const scriptDir = mkdtempSync5(join14(outputDir, ".group-filter-complex-"));
|
|
78430
|
+
const scriptPath = join14(scriptDir, "graph.txt");
|
|
78076
78431
|
const fd = openSync2(scriptPath, "wx", 384);
|
|
78077
78432
|
try {
|
|
78078
78433
|
writeFileSync6(fd, filterComplex);
|
|
@@ -78112,7 +78467,7 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
|
|
|
78112
78467
|
currentArgs[currentArgs.indexOf("-filter_complex_script")] = "-/filter_complex";
|
|
78113
78468
|
return await runFfmpeg(currentArgs, { signal, timeout: ffmpegProcessTimeout });
|
|
78114
78469
|
} finally {
|
|
78115
|
-
|
|
78470
|
+
rmSync6(scriptDir, { recursive: true, force: true });
|
|
78116
78471
|
}
|
|
78117
78472
|
};
|
|
78118
78473
|
let useNormalize = true;
|
|
@@ -78222,7 +78577,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
78222
78577
|
}
|
|
78223
78578
|
let audioSrcPath = srcPath;
|
|
78224
78579
|
if (element.type === "video") {
|
|
78225
|
-
const extractedPath =
|
|
78580
|
+
const extractedPath = join14(workDir, `${element.id}-extracted.wav`);
|
|
78226
78581
|
const extractResult = await extractAudioFromVideo(
|
|
78227
78582
|
srcPath,
|
|
78228
78583
|
extractedPath,
|
|
@@ -78249,7 +78604,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
78249
78604
|
}
|
|
78250
78605
|
audioSrcPath = extractedPath;
|
|
78251
78606
|
} else {
|
|
78252
|
-
const trimmedPath =
|
|
78607
|
+
const trimmedPath = join14(workDir, `${element.id}-trimmed.wav`);
|
|
78253
78608
|
const prepResult = await prepareAudioTrack(
|
|
78254
78609
|
srcPath,
|
|
78255
78610
|
trimmedPath,
|
|
@@ -78293,7 +78648,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
78293
78648
|
const fxResult = await applyAudioFxChain(
|
|
78294
78649
|
audioSrcPath,
|
|
78295
78650
|
chain,
|
|
78296
|
-
|
|
78651
|
+
join14(workDir, `${element.id}-fx.wav`),
|
|
78297
78652
|
{
|
|
78298
78653
|
trackId: element.id,
|
|
78299
78654
|
signal: effectiveSignal,
|
|
@@ -78355,14 +78710,14 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
78355
78710
|
).catch((err) => {
|
|
78356
78711
|
internalController.abort();
|
|
78357
78712
|
try {
|
|
78358
|
-
|
|
78713
|
+
rmSync6(workDir, { recursive: true, force: true });
|
|
78359
78714
|
} catch {
|
|
78360
78715
|
}
|
|
78361
78716
|
throw err;
|
|
78362
78717
|
});
|
|
78363
78718
|
const bail = () => {
|
|
78364
78719
|
try {
|
|
78365
|
-
|
|
78720
|
+
rmSync6(workDir, { recursive: true, force: true });
|
|
78366
78721
|
} catch {
|
|
78367
78722
|
}
|
|
78368
78723
|
return {
|
|
@@ -78384,7 +78739,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
78384
78739
|
const meta = groupMeta.get(groupId);
|
|
78385
78740
|
if (!meta) continue;
|
|
78386
78741
|
const pathId = safePathSegment(groupId, groupIndex);
|
|
78387
|
-
const groupWavPath =
|
|
78742
|
+
const groupWavPath = join14(workDir, `group-${pathId}.wav`);
|
|
78388
78743
|
try {
|
|
78389
78744
|
const subMix = await mixGroupMembers(
|
|
78390
78745
|
memberTracks,
|
|
@@ -78420,7 +78775,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
78420
78775
|
const fxResult = await applyAudioFxChain(
|
|
78421
78776
|
groupSrcPath,
|
|
78422
78777
|
chain,
|
|
78423
|
-
|
|
78778
|
+
join14(workDir, `group-${pathId}-fx.wav`),
|
|
78424
78779
|
{
|
|
78425
78780
|
trackId: groupId,
|
|
78426
78781
|
signal: effectiveSignal,
|
|
@@ -78469,7 +78824,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
78469
78824
|
if (failures.length > 0) return bail();
|
|
78470
78825
|
const mixResult = await mixAudioTracks(tracks, outputPath, totalDuration, signal, config);
|
|
78471
78826
|
try {
|
|
78472
|
-
|
|
78827
|
+
rmSync6(workDir, { recursive: true, force: true });
|
|
78473
78828
|
} catch {
|
|
78474
78829
|
}
|
|
78475
78830
|
const degradedNote = groupsDegradedAutomation.length > 0 ? `Volume automation exceeded this ffmpeg build's expression limits in group(s) ${groupsDegradedAutomation.join(", ")}; rendered at base volume` : void 0;
|
|
@@ -78518,14 +78873,14 @@ var init_audioMixer = __esm({
|
|
|
78518
78873
|
import { execFile as execFile2 } from "child_process";
|
|
78519
78874
|
import { mkdtemp, rm, writeFile } from "fs/promises";
|
|
78520
78875
|
import { tmpdir as tmpdir3 } from "os";
|
|
78521
|
-
import { join as
|
|
78876
|
+
import { join as join15 } from "path";
|
|
78522
78877
|
import { promisify as promisify2 } from "util";
|
|
78523
78878
|
async function psnrDb(a, b) {
|
|
78524
78879
|
const execFileP = promisify2(execFile2);
|
|
78525
|
-
const dir = await mkdtemp(
|
|
78880
|
+
const dir = await mkdtemp(join15(tmpdir3(), "hf-de-verify-"));
|
|
78526
78881
|
try {
|
|
78527
|
-
const pa =
|
|
78528
|
-
const pb =
|
|
78882
|
+
const pa = join15(dir, "a.jpg");
|
|
78883
|
+
const pb = join15(dir, "b.jpg");
|
|
78529
78884
|
await Promise.all([writeFile(pa, a), writeFile(pb, b)]);
|
|
78530
78885
|
const { stderr } = await execFileP(
|
|
78531
78886
|
getFfmpegBinary(),
|
|
@@ -78636,7 +78991,7 @@ var init_readWebGlVendorInfoFromCanvas = __esm({
|
|
|
78636
78991
|
import { cpus, freemem } from "os";
|
|
78637
78992
|
import { existsSync as existsSync13, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
|
|
78638
78993
|
import { copyFile, readFile, rename } from "fs/promises";
|
|
78639
|
-
import { join as
|
|
78994
|
+
import { join as join16 } from "path";
|
|
78640
78995
|
import { getHeapStatistics } from "v8";
|
|
78641
78996
|
function defaultSafeMaxWorkers() {
|
|
78642
78997
|
return Math.max(6, Math.min(16, Math.floor(cpus().length / 8)));
|
|
@@ -78765,7 +79120,7 @@ function distributeFrames(totalFrames, workerCount, workDir, rangeStart = 0) {
|
|
|
78765
79120
|
workerId: i,
|
|
78766
79121
|
startFrame,
|
|
78767
79122
|
endFrame,
|
|
78768
|
-
outputDir:
|
|
79123
|
+
outputDir: join16(workDir, `worker-${i}`),
|
|
78769
79124
|
outputFrameOffset: rangeStart
|
|
78770
79125
|
});
|
|
78771
79126
|
}
|
|
@@ -78779,7 +79134,7 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
|
|
|
78779
79134
|
startFrame: rangeStart + i,
|
|
78780
79135
|
endFrame: rangeStart + totalFrames,
|
|
78781
79136
|
frameStride: workerCount,
|
|
78782
|
-
outputDir:
|
|
79137
|
+
outputDir: join16(workDir, `worker-${i}`),
|
|
78783
79138
|
outputFrameOffset: rangeStart
|
|
78784
79139
|
});
|
|
78785
79140
|
}
|
|
@@ -78937,7 +79292,7 @@ async function verifyDiskDrawElementSamples(session, task, streaming) {
|
|
|
78937
79292
|
for (const idx of selectVerifySampleIndicesForTask(truths.keys(), task)) {
|
|
78938
79293
|
const truth = truths.get(idx);
|
|
78939
79294
|
if (!truth) continue;
|
|
78940
|
-
const framePath =
|
|
79295
|
+
const framePath = join16(task.outputDir, `frame_${String(idx - offset2).padStart(6, "0")}.${ext}`);
|
|
78941
79296
|
const db = await psnrForDiskSample(framePath, truth, task.workerId, idx);
|
|
78942
79297
|
if (db === null) continue;
|
|
78943
79298
|
assertDiskSampleAboveFloor(db, verifyMinDb, idx, task.workerId);
|
|
@@ -79103,8 +79458,8 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
|
|
|
79103
79458
|
}
|
|
79104
79459
|
const files = readdirSync6(task.outputDir).filter((f) => f.startsWith("frame_") && (f.endsWith(".jpg") || f.endsWith(".png"))).sort();
|
|
79105
79460
|
const copyTasks = files.map(async (file) => {
|
|
79106
|
-
const sourcePath =
|
|
79107
|
-
const targetPath =
|
|
79461
|
+
const sourcePath = join16(task.outputDir, file);
|
|
79462
|
+
const targetPath = join16(outputDir, file);
|
|
79108
79463
|
try {
|
|
79109
79464
|
await rename(sourcePath, targetPath);
|
|
79110
79465
|
} catch {
|
|
@@ -79149,8 +79504,25 @@ var init_parallelCoordinator = __esm({
|
|
|
79149
79504
|
// ../engine/src/services/fileServer.ts
|
|
79150
79505
|
import { Hono } from "hono";
|
|
79151
79506
|
import { serve } from "@hono/node-server";
|
|
79152
|
-
import { readFileSync as readFileSync5,
|
|
79153
|
-
import { join as
|
|
79507
|
+
import { readFileSync as readFileSync5, openSync as openSync3, fstatSync, closeSync as closeSync3, statSync as statSync6, constants as constants2 } from "fs";
|
|
79508
|
+
import { join as join17, extname as extname3 } from "path";
|
|
79509
|
+
function readRegularFile(filePath) {
|
|
79510
|
+
let fd;
|
|
79511
|
+
try {
|
|
79512
|
+
fd = openSync3(filePath, constants2.O_RDONLY | constants2.O_NONBLOCK);
|
|
79513
|
+
} catch (error) {
|
|
79514
|
+
if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
|
|
79515
|
+
return null;
|
|
79516
|
+
if (!statSync6(filePath, { throwIfNoEntry: false })?.isFile()) return null;
|
|
79517
|
+
throw error;
|
|
79518
|
+
}
|
|
79519
|
+
try {
|
|
79520
|
+
if (!fstatSync(fd).isFile()) return null;
|
|
79521
|
+
return readFileSync5(fd);
|
|
79522
|
+
} finally {
|
|
79523
|
+
closeSync3(fd);
|
|
79524
|
+
}
|
|
79525
|
+
}
|
|
79154
79526
|
function createFileServer(options) {
|
|
79155
79527
|
const { projectDir, compiledDir, port = 0, stripEmbeddedRuntime = true } = options;
|
|
79156
79528
|
const headScripts = options.headScripts ?? [];
|
|
@@ -79160,22 +79532,16 @@ function createFileServer(options) {
|
|
|
79160
79532
|
let requestPath = c.req.path;
|
|
79161
79533
|
if (requestPath === "/") requestPath = "/index.html";
|
|
79162
79534
|
const relativePath = requestPath.replace(/^\//, "");
|
|
79163
|
-
const compiledPath = compiledDir ?
|
|
79164
|
-
const
|
|
79165
|
-
|
|
79166
|
-
);
|
|
79167
|
-
const filePath = hasCompiledFile ? compiledPath : join16(projectDir, relativePath);
|
|
79168
|
-
if (!existsSync14(filePath) || !statSync6(filePath).isFile()) {
|
|
79169
|
-
return c.text("Not found", 404);
|
|
79170
|
-
}
|
|
79171
|
-
const ext = extname3(filePath).toLowerCase();
|
|
79535
|
+
const compiledPath = compiledDir ? join17(compiledDir, relativePath) : null;
|
|
79536
|
+
const content = (compiledPath ? readRegularFile(compiledPath) : null) ?? readRegularFile(join17(projectDir, relativePath));
|
|
79537
|
+
if (content === null) return c.text("Not found", 404);
|
|
79538
|
+
const ext = extname3(relativePath).toLowerCase();
|
|
79172
79539
|
const contentType = MIME_TYPES[ext] || "application/octet-stream";
|
|
79173
79540
|
if (ext === ".html") {
|
|
79174
|
-
const rawHtml =
|
|
79541
|
+
const rawHtml = content.toString("utf-8");
|
|
79175
79542
|
const html = relativePath === "index.html" ? injectScriptsIntoHtml(rawHtml, headScripts, bodyScripts, stripEmbeddedRuntime) : rawHtml;
|
|
79176
79543
|
return c.text(html, 200, { "Content-Type": contentType });
|
|
79177
79544
|
}
|
|
79178
|
-
const content = readFileSync5(filePath);
|
|
79179
79545
|
return new Response(content, {
|
|
79180
79546
|
status: 200,
|
|
79181
79547
|
headers: { "Content-Type": contentType }
|
|
@@ -79730,15 +80096,13 @@ function normalizeObjectFit(value) {
|
|
|
79730
80096
|
}
|
|
79731
80097
|
function parseTransformMatrix(css) {
|
|
79732
80098
|
if (!css || css === "none") return null;
|
|
79733
|
-
const match2d = css.match(
|
|
79734
|
-
/^matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,)]+)\s*\)$/
|
|
79735
|
-
);
|
|
80099
|
+
const match2d = css.match(/^matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,)]+)\)$/);
|
|
79736
80100
|
if (match2d) {
|
|
79737
80101
|
const values = match2d.slice(1, 7).map(Number);
|
|
79738
80102
|
if (!values.every(Number.isFinite)) return null;
|
|
79739
80103
|
return values;
|
|
79740
80104
|
}
|
|
79741
|
-
const match3d = css.match(/^matrix3d\(
|
|
80105
|
+
const match3d = css.match(/^matrix3d\(([^)]+)\)$/);
|
|
79742
80106
|
if (match3d) {
|
|
79743
80107
|
const raw = match3d[1];
|
|
79744
80108
|
if (!raw) return null;
|
|
@@ -80621,8 +80985,8 @@ var init_shaderTransitions = __esm({
|
|
|
80621
80985
|
});
|
|
80622
80986
|
|
|
80623
80987
|
// ../engine/src/services/hdrCapture.ts
|
|
80624
|
-
import { existsSync as
|
|
80625
|
-
import { join as
|
|
80988
|
+
import { existsSync as existsSync14, readdirSync as readdirSync7 } from "fs";
|
|
80989
|
+
import { join as join18 } from "path";
|
|
80626
80990
|
import { homedir as homedir2 } from "os";
|
|
80627
80991
|
function linearToPQ(L) {
|
|
80628
80992
|
const Lp = Math.max(0, L * SDR_NITS / PQ_MAX_NITS);
|
|
@@ -80738,12 +81102,12 @@ function float16ToPqRgb(rawBuffer, bytesPerRow, width, height) {
|
|
|
80738
81102
|
return output;
|
|
80739
81103
|
}
|
|
80740
81104
|
function resolveHeadedChromePath() {
|
|
80741
|
-
const baseDir =
|
|
80742
|
-
if (!
|
|
81105
|
+
const baseDir = join18(homedir2(), ".cache", "puppeteer", "chrome");
|
|
81106
|
+
if (!existsSync14(baseDir)) return void 0;
|
|
80743
81107
|
const versions = readdirSync7(baseDir).sort().reverse();
|
|
80744
81108
|
for (const version2 of versions) {
|
|
80745
81109
|
const candidates = [
|
|
80746
|
-
|
|
81110
|
+
join18(
|
|
80747
81111
|
baseDir,
|
|
80748
81112
|
version2,
|
|
80749
81113
|
"chrome-mac-arm64",
|
|
@@ -80752,7 +81116,7 @@ function resolveHeadedChromePath() {
|
|
|
80752
81116
|
"MacOS",
|
|
80753
81117
|
"Google Chrome for Testing"
|
|
80754
81118
|
),
|
|
80755
|
-
|
|
81119
|
+
join18(
|
|
80756
81120
|
baseDir,
|
|
80757
81121
|
version2,
|
|
80758
81122
|
"chrome-mac-x64",
|
|
@@ -80761,11 +81125,11 @@ function resolveHeadedChromePath() {
|
|
|
80761
81125
|
"MacOS",
|
|
80762
81126
|
"Google Chrome for Testing"
|
|
80763
81127
|
),
|
|
80764
|
-
|
|
80765
|
-
|
|
81128
|
+
join18(baseDir, version2, "chrome-linux64", "chrome"),
|
|
81129
|
+
join18(baseDir, version2, "chrome-win64", "chrome.exe")
|
|
80766
81130
|
];
|
|
80767
81131
|
for (const binary of candidates) {
|
|
80768
|
-
if (
|
|
81132
|
+
if (existsSync14(binary)) return binary;
|
|
80769
81133
|
}
|
|
80770
81134
|
}
|
|
80771
81135
|
return void 0;
|
|
@@ -84240,16 +84604,16 @@ __export(fontCompression_exports, {
|
|
|
84240
84604
|
});
|
|
84241
84605
|
import { createHash as createHash6 } from "crypto";
|
|
84242
84606
|
import {
|
|
84243
|
-
existsSync as
|
|
84607
|
+
existsSync as existsSync20,
|
|
84244
84608
|
mkdirSync as mkdirSync10,
|
|
84245
|
-
mkdtempSync as
|
|
84609
|
+
mkdtempSync as mkdtempSync7,
|
|
84246
84610
|
readFileSync as readFileSync7,
|
|
84247
84611
|
renameSync as renameSync4,
|
|
84248
|
-
rmSync as
|
|
84612
|
+
rmSync as rmSync9,
|
|
84249
84613
|
writeFileSync as writeFileSync8
|
|
84250
84614
|
} from "fs";
|
|
84251
84615
|
import { homedir as homedir4, tmpdir as tmpdir4 } from "os";
|
|
84252
|
-
import { dirname as
|
|
84616
|
+
import { dirname as dirname12, join as join25 } from "path";
|
|
84253
84617
|
async function compressToWoff2(input) {
|
|
84254
84618
|
return Buffer.from(await compress(input));
|
|
84255
84619
|
}
|
|
@@ -84257,16 +84621,16 @@ function rawMimeType(format) {
|
|
|
84257
84621
|
return RAW_MIME_TYPES[format] ?? "font/ttf";
|
|
84258
84622
|
}
|
|
84259
84623
|
function defaultCacheDir() {
|
|
84260
|
-
const root = process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ?
|
|
84261
|
-
return
|
|
84624
|
+
const root = process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ? join25(tmpdir4(), "hyperframes", "fonts") : join25(homedir4(), ".cache", "hyperframes", "fonts"));
|
|
84625
|
+
return join25(root, "local-compression-v1");
|
|
84262
84626
|
}
|
|
84263
84627
|
function cachedCompressionPath(input, originalFormat, cacheDir) {
|
|
84264
84628
|
const digest = createHash6("sha256").update("hyperframes-local-font-compression-v1\0").update(originalFormat).update("\0").update(input).digest("hex");
|
|
84265
|
-
return
|
|
84629
|
+
return join25(cacheDir, `${digest}.woff2`);
|
|
84266
84630
|
}
|
|
84267
84631
|
function readCachedCompression(path) {
|
|
84268
84632
|
try {
|
|
84269
|
-
if (!
|
|
84633
|
+
if (!existsSync20(path)) return null;
|
|
84270
84634
|
const cached2 = readFileSync7(path);
|
|
84271
84635
|
return cached2.length > 0 ? cached2 : null;
|
|
84272
84636
|
} catch {
|
|
@@ -84276,15 +84640,15 @@ function readCachedCompression(path) {
|
|
|
84276
84640
|
function cacheCompression(path, compressed) {
|
|
84277
84641
|
let tempDir;
|
|
84278
84642
|
try {
|
|
84279
|
-
mkdirSync10(
|
|
84280
|
-
tempDir =
|
|
84281
|
-
const tmpPath =
|
|
84643
|
+
mkdirSync10(dirname12(path), { recursive: true });
|
|
84644
|
+
tempDir = mkdtempSync7(join25(dirname12(path), ".compression-"));
|
|
84645
|
+
const tmpPath = join25(tempDir, "font.woff2");
|
|
84282
84646
|
writeFileSync8(tmpPath, compressed, { flag: "wx", mode: 420 });
|
|
84283
84647
|
renameSync4(tmpPath, path);
|
|
84284
84648
|
} catch {
|
|
84285
84649
|
} finally {
|
|
84286
84650
|
try {
|
|
84287
|
-
if (tempDir)
|
|
84651
|
+
if (tempDir) rmSync9(tempDir, { recursive: true, force: true });
|
|
84288
84652
|
} catch {
|
|
84289
84653
|
}
|
|
84290
84654
|
}
|
|
@@ -84332,19 +84696,19 @@ init_esm10();
|
|
|
84332
84696
|
init_dist2();
|
|
84333
84697
|
init_src();
|
|
84334
84698
|
import {
|
|
84335
|
-
existsSync as
|
|
84699
|
+
existsSync as existsSync29,
|
|
84336
84700
|
mkdirSync as mkdirSync17,
|
|
84337
|
-
mkdtempSync as
|
|
84701
|
+
mkdtempSync as mkdtempSync11,
|
|
84338
84702
|
readFileSync as readFileSync12,
|
|
84339
84703
|
readdirSync as readdirSync11,
|
|
84340
|
-
rmSync as
|
|
84704
|
+
rmSync as rmSync14,
|
|
84341
84705
|
statSync as statSync10,
|
|
84342
84706
|
writeFileSync as writeFileSync10,
|
|
84343
84707
|
copyFileSync as copyFileSync6,
|
|
84344
84708
|
appendFileSync
|
|
84345
84709
|
} from "fs";
|
|
84346
84710
|
import { tmpdir as tmpdir7 } from "os";
|
|
84347
|
-
import { join as
|
|
84711
|
+
import { join as join43, dirname as dirname18, resolve as resolve13 } from "path";
|
|
84348
84712
|
import { totalmem as totalmem3 } from "os";
|
|
84349
84713
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
84350
84714
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -84354,17 +84718,27 @@ init_compiler();
|
|
|
84354
84718
|
init_dist2();
|
|
84355
84719
|
import { Hono as Hono2 } from "hono";
|
|
84356
84720
|
import { serve as serve2 } from "@hono/node-server";
|
|
84357
|
-
import {
|
|
84358
|
-
|
|
84721
|
+
import {
|
|
84722
|
+
existsSync as existsSync16,
|
|
84723
|
+
realpathSync as realpathSync2,
|
|
84724
|
+
statSync as statSync7,
|
|
84725
|
+
createReadStream as createReadStream3,
|
|
84726
|
+
openSync as openSync4,
|
|
84727
|
+
fstatSync as fstatSync2,
|
|
84728
|
+
closeSync as closeSync4,
|
|
84729
|
+
constants as constants3,
|
|
84730
|
+
readFile as readFile2
|
|
84731
|
+
} from "fs";
|
|
84732
|
+
import { promisify as promisify3 } from "util";
|
|
84359
84733
|
import { Readable as Readable2 } from "stream";
|
|
84360
|
-
import { join as
|
|
84734
|
+
import { join as join19, extname as extname4, resolve as resolve7, sep as sep3 } from "path";
|
|
84361
84735
|
|
|
84362
84736
|
// ../producer/src/services/hyperframeRuntimeLoader.ts
|
|
84363
84737
|
import { createHash as createHash4 } from "crypto";
|
|
84364
|
-
import { existsSync as
|
|
84365
|
-
import { dirname as
|
|
84738
|
+
import { existsSync as existsSync15, readFileSync as readFileSync6 } from "fs";
|
|
84739
|
+
import { dirname as dirname9, resolve as resolve6 } from "path";
|
|
84366
84740
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
84367
|
-
var PRODUCER_DIR =
|
|
84741
|
+
var PRODUCER_DIR = dirname9(fileURLToPath2(import.meta.url));
|
|
84368
84742
|
var SIBLING_MANIFEST_PATH = resolve6(PRODUCER_DIR, "hyperframe.manifest.json");
|
|
84369
84743
|
var MODULE_RELATIVE_MANIFEST_PATH = resolve6(
|
|
84370
84744
|
PRODUCER_DIR,
|
|
@@ -84382,7 +84756,7 @@ function resolveHyperframeManifestPath() {
|
|
|
84382
84756
|
if (envOverride) {
|
|
84383
84757
|
return envOverride;
|
|
84384
84758
|
}
|
|
84385
|
-
const found = MANIFEST_CANDIDATES.find((candidate) =>
|
|
84759
|
+
const found = MANIFEST_CANDIDATES.find((candidate) => existsSync15(candidate));
|
|
84386
84760
|
return found ?? MODULE_RELATIVE_MANIFEST_PATH;
|
|
84387
84761
|
}
|
|
84388
84762
|
function triedManifestPaths() {
|
|
@@ -84393,7 +84767,7 @@ function getVerifiedHyperframeRuntimeSource() {
|
|
|
84393
84767
|
}
|
|
84394
84768
|
function resolveVerifiedHyperframeRuntime() {
|
|
84395
84769
|
const manifestPath = resolveHyperframeManifestPath();
|
|
84396
|
-
if (!
|
|
84770
|
+
if (!existsSync15(manifestPath)) {
|
|
84397
84771
|
const tried = triedManifestPaths().join(", ");
|
|
84398
84772
|
throw new Error(
|
|
84399
84773
|
`[HyperframeRuntimeLoader] Missing manifest. Tried: ${tried}. Searched from cwd=${process.cwd()}. Build core runtime artifacts before rendering.`
|
|
@@ -84407,8 +84781,8 @@ function resolveVerifiedHyperframeRuntime() {
|
|
|
84407
84781
|
`[HyperframeRuntimeLoader] Invalid manifest at ${manifestPath}; missing iife artifact or sha256.`
|
|
84408
84782
|
);
|
|
84409
84783
|
}
|
|
84410
|
-
const runtimePath = resolve6(
|
|
84411
|
-
if (!
|
|
84784
|
+
const runtimePath = resolve6(dirname9(manifestPath), runtimeFileName);
|
|
84785
|
+
if (!existsSync15(runtimePath)) {
|
|
84412
84786
|
throw new Error(`[HyperframeRuntimeLoader] Missing runtime artifact at ${runtimePath}.`);
|
|
84413
84787
|
}
|
|
84414
84788
|
const runtimeSource = readFileSync6(runtimePath, "utf8");
|
|
@@ -84473,14 +84847,15 @@ function createConsoleLogger(level = "info") {
|
|
|
84473
84847
|
var defaultLogger = createConsoleLogger("info");
|
|
84474
84848
|
|
|
84475
84849
|
// ../producer/src/services/fileServer.ts
|
|
84850
|
+
var readFileAsync = promisify3(readFile2);
|
|
84476
84851
|
function isPathInside2(child, parent, options = {}) {
|
|
84477
84852
|
const { resolveSymlinks = false, pathModule } = options;
|
|
84478
84853
|
const resolveFn = pathModule?.resolve ?? resolve7;
|
|
84479
84854
|
const separator = pathModule?.sep ?? sep3;
|
|
84480
84855
|
const resolvedChild = resolveFn(child);
|
|
84481
84856
|
const resolvedParent = resolveFn(parent);
|
|
84482
|
-
const normalizedChild = resolveSymlinks &&
|
|
84483
|
-
const normalizedParent = resolveSymlinks &&
|
|
84857
|
+
const normalizedChild = resolveSymlinks && existsSync16(resolvedChild) ? realpathSync2.native(resolvedChild) : resolvedChild;
|
|
84858
|
+
const normalizedParent = resolveSymlinks && existsSync16(resolvedParent) ? realpathSync2.native(resolvedParent) : resolvedParent;
|
|
84484
84859
|
if (normalizedChild === normalizedParent) return true;
|
|
84485
84860
|
const parentWithSep = normalizedParent.endsWith(separator) ? normalizedParent : normalizedParent + separator;
|
|
84486
84861
|
return normalizedChild.startsWith(parentWithSep);
|
|
@@ -84930,6 +85305,26 @@ function closeFileServerSafely(fileServer, label, log = defaultLogger) {
|
|
|
84930
85305
|
});
|
|
84931
85306
|
}
|
|
84932
85307
|
}
|
|
85308
|
+
function openRegularFile(filePath) {
|
|
85309
|
+
let fd;
|
|
85310
|
+
try {
|
|
85311
|
+
fd = openSync4(filePath, constants3.O_RDONLY | constants3.O_NONBLOCK);
|
|
85312
|
+
} catch (error) {
|
|
85313
|
+
if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
|
|
85314
|
+
return null;
|
|
85315
|
+
if (!statSync7(filePath, { throwIfNoEntry: false })?.isFile()) return null;
|
|
85316
|
+
throw error;
|
|
85317
|
+
}
|
|
85318
|
+
let accepted = false;
|
|
85319
|
+
try {
|
|
85320
|
+
const stat = fstatSync2(fd);
|
|
85321
|
+
if (!stat.isFile()) return null;
|
|
85322
|
+
accepted = true;
|
|
85323
|
+
return { fd, stat, filePath };
|
|
85324
|
+
} finally {
|
|
85325
|
+
if (!accepted) closeSync4(fd);
|
|
85326
|
+
}
|
|
85327
|
+
}
|
|
84933
85328
|
function createFileServer2(options) {
|
|
84934
85329
|
const { projectDir, compiledDir, port = 0, stripEmbeddedRuntime = true } = options;
|
|
84935
85330
|
const preHeadScripts = [
|
|
@@ -84950,76 +85345,73 @@ function createFileServer2(options) {
|
|
|
84950
85345
|
return seg;
|
|
84951
85346
|
}
|
|
84952
85347
|
}).join("/");
|
|
84953
|
-
let
|
|
84954
|
-
|
|
84955
|
-
const candidate =
|
|
84956
|
-
if (
|
|
84957
|
-
|
|
84958
|
-
}
|
|
85348
|
+
let file = null;
|
|
85349
|
+
for (const root of compiledDir ? [compiledDir, projectDir] : [projectDir]) {
|
|
85350
|
+
const candidate = join19(root, relativePath);
|
|
85351
|
+
if (isPathInside2(candidate, root)) file = openRegularFile(candidate);
|
|
85352
|
+
if (file) break;
|
|
84959
85353
|
}
|
|
84960
|
-
if (!
|
|
84961
|
-
const candidate = join18(projectDir, relativePath);
|
|
84962
|
-
if (existsSync17(candidate) && isPathInside2(candidate, projectDir) && statSync7(candidate).isFile()) {
|
|
84963
|
-
filePath = candidate;
|
|
84964
|
-
}
|
|
84965
|
-
}
|
|
84966
|
-
if (!filePath) {
|
|
85354
|
+
if (!file) {
|
|
84967
85355
|
if (!/favicon\.ico$/i.test(requestPath)) {
|
|
84968
85356
|
console.warn(`[FileServer] 404 Not Found: ${requestPath}`);
|
|
84969
85357
|
}
|
|
84970
85358
|
return c.text("Not found", 404);
|
|
84971
85359
|
}
|
|
84972
|
-
const
|
|
84973
|
-
|
|
84974
|
-
|
|
84975
|
-
const
|
|
84976
|
-
const
|
|
84977
|
-
|
|
84978
|
-
|
|
84979
|
-
|
|
85360
|
+
const { fd, stat, filePath } = file;
|
|
85361
|
+
let streamOwnsFd = false;
|
|
85362
|
+
try {
|
|
85363
|
+
const ext = extname4(filePath).toLowerCase();
|
|
85364
|
+
const contentType = MIME_TYPES2[ext] || "application/octet-stream";
|
|
85365
|
+
if (ext === ".html") {
|
|
85366
|
+
const rawHtml = await readFileAsync(fd, "utf-8");
|
|
85367
|
+
const isIndex = relativePath === "index.html";
|
|
85368
|
+
let html = rawHtml;
|
|
85369
|
+
if (preHeadScripts.length > 0) {
|
|
85370
|
+
html = injectScriptsAtHeadStart(html, preHeadScripts);
|
|
85371
|
+
}
|
|
85372
|
+
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
85373
|
+
return c.text(html, 200, { "Content-Type": contentType });
|
|
85374
|
+
}
|
|
85375
|
+
const totalSize = stat.size;
|
|
85376
|
+
const rangeHeader = c.req.header("range");
|
|
85377
|
+
const rangeRequest = parseRangeHeader(rangeHeader, totalSize);
|
|
85378
|
+
if (rangeRequest.kind === "unsatisfiable") {
|
|
85379
|
+
return new Response(null, {
|
|
85380
|
+
status: 416,
|
|
85381
|
+
headers: {
|
|
85382
|
+
"Content-Type": contentType,
|
|
85383
|
+
"Content-Range": `bytes */${totalSize}`,
|
|
85384
|
+
"Accept-Ranges": "bytes"
|
|
85385
|
+
}
|
|
85386
|
+
});
|
|
84980
85387
|
}
|
|
84981
|
-
|
|
84982
|
-
|
|
84983
|
-
|
|
84984
|
-
const stat = statSync7(filePath);
|
|
84985
|
-
const totalSize = stat.size;
|
|
84986
|
-
const rangeHeader = c.req.header("range");
|
|
84987
|
-
const rangeRequest = parseRangeHeader(rangeHeader, totalSize);
|
|
84988
|
-
if (rangeRequest.kind === "unsatisfiable") {
|
|
84989
|
-
return new Response(null, {
|
|
84990
|
-
status: 416,
|
|
84991
|
-
headers: {
|
|
84992
|
-
"Content-Type": contentType,
|
|
84993
|
-
"Content-Range": `bytes */${totalSize}`,
|
|
84994
|
-
"Accept-Ranges": "bytes"
|
|
84995
|
-
}
|
|
84996
|
-
});
|
|
84997
|
-
}
|
|
84998
|
-
if (rangeRequest.kind === "satisfiable") {
|
|
84999
|
-
const { start, end } = rangeRequest;
|
|
85000
|
-
const length = end - start + 1;
|
|
85001
|
-
const stream2 = createReadStream3(filePath, { start, end });
|
|
85002
|
-
const webStream2 = Readable2.toWeb(stream2);
|
|
85003
|
-
return new Response(webStream2, {
|
|
85004
|
-
status: 206,
|
|
85388
|
+
const range = rangeRequest.kind === "satisfiable" ? rangeRequest : null;
|
|
85389
|
+
const responseOptions = {
|
|
85390
|
+
status: range ? 206 : 200,
|
|
85005
85391
|
headers: {
|
|
85006
85392
|
"Content-Type": contentType,
|
|
85007
|
-
"Content-Length": String(
|
|
85008
|
-
"
|
|
85009
|
-
"
|
|
85393
|
+
"Content-Length": String(range ? range.end - range.start + 1 : totalSize),
|
|
85394
|
+
"Accept-Ranges": "bytes",
|
|
85395
|
+
...range ? { "Content-Range": `bytes ${range.start}-${range.end}/${totalSize}` } : {}
|
|
85010
85396
|
}
|
|
85397
|
+
};
|
|
85398
|
+
if (c.req.method === "HEAD") return new Response(null, responseOptions);
|
|
85399
|
+
const stream = createReadStream3(filePath, {
|
|
85400
|
+
fd,
|
|
85401
|
+
autoClose: true,
|
|
85402
|
+
...range ? { start: range.start, end: range.end } : {}
|
|
85011
85403
|
});
|
|
85012
|
-
|
|
85013
|
-
|
|
85014
|
-
|
|
85015
|
-
|
|
85016
|
-
|
|
85017
|
-
|
|
85018
|
-
|
|
85019
|
-
"Content-Length": String(totalSize),
|
|
85020
|
-
"Accept-Ranges": "bytes"
|
|
85404
|
+
streamOwnsFd = true;
|
|
85405
|
+
try {
|
|
85406
|
+
const webStream = Readable2.toWeb(stream);
|
|
85407
|
+
return new Response(webStream, responseOptions);
|
|
85408
|
+
} catch (error) {
|
|
85409
|
+
stream.destroy();
|
|
85410
|
+
throw error;
|
|
85021
85411
|
}
|
|
85022
|
-
}
|
|
85412
|
+
} finally {
|
|
85413
|
+
if (!streamOwnsFd) closeSync4(fd);
|
|
85414
|
+
}
|
|
85023
85415
|
});
|
|
85024
85416
|
return new Promise((resolve18) => {
|
|
85025
85417
|
const connections = /* @__PURE__ */ new Set();
|
|
@@ -85057,18 +85449,18 @@ init_dist2();
|
|
|
85057
85449
|
import {
|
|
85058
85450
|
copyFileSync as copyFileSync3,
|
|
85059
85451
|
cpSync,
|
|
85060
|
-
existsSync as
|
|
85452
|
+
existsSync as existsSync17,
|
|
85061
85453
|
mkdirSync as mkdirSync9,
|
|
85062
|
-
rmSync as
|
|
85454
|
+
rmSync as rmSync7,
|
|
85063
85455
|
symlinkSync,
|
|
85064
85456
|
writeFileSync as writeFileSync7
|
|
85065
85457
|
} from "fs";
|
|
85066
|
-
import { basename as basename4, dirname as
|
|
85458
|
+
import { basename as basename4, dirname as dirname10, isAbsolute as isAbsolute2, join as join21, relative, resolve as resolve8 } from "path";
|
|
85067
85459
|
|
|
85068
85460
|
// ../producer/src/utils/paths.ts
|
|
85069
85461
|
import {
|
|
85070
85462
|
basename as basename3,
|
|
85071
|
-
join as
|
|
85463
|
+
join as join20,
|
|
85072
85464
|
resolve as nodeResolve,
|
|
85073
85465
|
relative as nodeRelative,
|
|
85074
85466
|
isAbsolute as nodeIsAbsolute
|
|
@@ -85106,7 +85498,7 @@ function formatExportFrameName(index, ext) {
|
|
|
85106
85498
|
function resolveRenderPaths(projectDir, outputPath, rendersDir = DEFAULT_RENDERS_DIR) {
|
|
85107
85499
|
const absoluteProjectDir = nodeResolve(projectDir);
|
|
85108
85500
|
const projectName = basename3(absoluteProjectDir);
|
|
85109
|
-
const resolvedOutputPath = outputPath ??
|
|
85501
|
+
const resolvedOutputPath = outputPath ?? join20(rendersDir, `${projectName}.mp4`);
|
|
85110
85502
|
const absoluteOutputPath = nodeResolve(resolvedOutputPath);
|
|
85111
85503
|
return { absoluteProjectDir, absoluteOutputPath };
|
|
85112
85504
|
}
|
|
@@ -85143,21 +85535,21 @@ function resolveDeviceScaleFactor(input) {
|
|
|
85143
85535
|
return target.width / input.compositionWidth;
|
|
85144
85536
|
}
|
|
85145
85537
|
function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
85146
|
-
const compileDir =
|
|
85538
|
+
const compileDir = join21(workDir, "compiled");
|
|
85147
85539
|
mkdirSync9(compileDir, { recursive: true });
|
|
85148
|
-
writeFileSync7(
|
|
85540
|
+
writeFileSync7(join21(compileDir, "index.html"), compiled.html, "utf-8");
|
|
85149
85541
|
for (const [srcPath, html] of compiled.subCompositions) {
|
|
85150
|
-
const outPath =
|
|
85151
|
-
mkdirSync9(
|
|
85542
|
+
const outPath = join21(compileDir, srcPath);
|
|
85543
|
+
mkdirSync9(dirname10(outPath), { recursive: true });
|
|
85152
85544
|
writeFileSync7(outPath, html, "utf-8");
|
|
85153
85545
|
}
|
|
85154
85546
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
85155
|
-
const outPath = resolve8(
|
|
85547
|
+
const outPath = resolve8(join21(compileDir, relativePath));
|
|
85156
85548
|
if (!isPathInside3(outPath, compileDir)) {
|
|
85157
85549
|
console.warn(`[Render] Skipping external asset with unsafe path: ${relativePath}`);
|
|
85158
85550
|
continue;
|
|
85159
85551
|
}
|
|
85160
|
-
mkdirSync9(
|
|
85552
|
+
mkdirSync9(dirname10(outPath), { recursive: true });
|
|
85161
85553
|
copyFileSync3(absolutePath, outPath);
|
|
85162
85554
|
}
|
|
85163
85555
|
if (includeSummary) {
|
|
@@ -85183,7 +85575,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
85183
85575
|
renderModeHints: compiled.renderModeHints,
|
|
85184
85576
|
hasShaderTransitions: compiled.hasShaderTransitions
|
|
85185
85577
|
};
|
|
85186
|
-
writeFileSync7(
|
|
85578
|
+
writeFileSync7(join21(compileDir, "summary.json"), JSON.stringify(summary, null, 2), "utf-8");
|
|
85187
85579
|
}
|
|
85188
85580
|
}
|
|
85189
85581
|
function applyRenderModeHints(alreadyForced, compiled, log = defaultLogger) {
|
|
@@ -85210,18 +85602,18 @@ function updateJobStatus(job, status, stage, progress, onProgress) {
|
|
|
85210
85602
|
}
|
|
85211
85603
|
var materializePathModule = {
|
|
85212
85604
|
resolve: resolve8,
|
|
85213
|
-
join:
|
|
85214
|
-
dirname:
|
|
85605
|
+
join: join21,
|
|
85606
|
+
dirname: dirname10,
|
|
85215
85607
|
basename: basename4,
|
|
85216
85608
|
relative,
|
|
85217
85609
|
isAbsolute: isAbsolute2
|
|
85218
85610
|
};
|
|
85219
85611
|
var materializeFileSystem = {
|
|
85220
|
-
existsSync:
|
|
85612
|
+
existsSync: existsSync17,
|
|
85221
85613
|
mkdirSync: mkdirSync9,
|
|
85222
85614
|
symlinkSync,
|
|
85223
85615
|
cpSync,
|
|
85224
|
-
rmSync:
|
|
85616
|
+
rmSync: rmSync7
|
|
85225
85617
|
};
|
|
85226
85618
|
function createMemorySampler(intervalMs = 250) {
|
|
85227
85619
|
let peakRss = 0;
|
|
@@ -85487,26 +85879,26 @@ var RenderExecutionContext = class {
|
|
|
85487
85879
|
|
|
85488
85880
|
// ../producer/src/services/render/artifactTransaction.ts
|
|
85489
85881
|
import {
|
|
85490
|
-
closeSync as
|
|
85491
|
-
existsSync as
|
|
85492
|
-
fstatSync,
|
|
85493
|
-
mkdtempSync as
|
|
85494
|
-
openSync as
|
|
85882
|
+
closeSync as closeSync5,
|
|
85883
|
+
existsSync as existsSync18,
|
|
85884
|
+
fstatSync as fstatSync3,
|
|
85885
|
+
mkdtempSync as mkdtempSync6,
|
|
85886
|
+
openSync as openSync5,
|
|
85495
85887
|
readSync,
|
|
85496
85888
|
readdirSync as readdirSync8,
|
|
85497
85889
|
renameSync as renameSync3,
|
|
85498
|
-
rmSync as
|
|
85890
|
+
rmSync as rmSync8
|
|
85499
85891
|
} from "fs";
|
|
85500
|
-
import { basename as basename5, dirname as
|
|
85892
|
+
import { basename as basename5, dirname as dirname11, extname as extname5, join as join22, resolve as resolve9 } from "path";
|
|
85501
85893
|
|
|
85502
85894
|
// ../producer/src/utils/ffprobe.ts
|
|
85503
85895
|
init_src();
|
|
85504
85896
|
|
|
85505
85897
|
// ../producer/src/services/render/artifactTransaction.ts
|
|
85506
85898
|
var defaultFileSystem = {
|
|
85507
|
-
existsSync:
|
|
85899
|
+
existsSync: existsSync18,
|
|
85508
85900
|
renameSync: renameSync3,
|
|
85509
|
-
rmSync:
|
|
85901
|
+
rmSync: rmSync8
|
|
85510
85902
|
};
|
|
85511
85903
|
async function defaultArtifactDurationProbe(path) {
|
|
85512
85904
|
const meta = await extractMediaMetadata(path);
|
|
@@ -85516,28 +85908,28 @@ async function defaultArtifactDurationProbe(path) {
|
|
|
85516
85908
|
};
|
|
85517
85909
|
}
|
|
85518
85910
|
function createSiblingTransactionDirectory(destination) {
|
|
85519
|
-
const parent =
|
|
85911
|
+
const parent = dirname11(destination);
|
|
85520
85912
|
const extension = extname5(destination);
|
|
85521
85913
|
const stem = extension ? basename5(destination, extension) : basename5(destination);
|
|
85522
|
-
return
|
|
85914
|
+
return mkdtempSync6(join22(parent, `.${stem}.hf-transaction-`));
|
|
85523
85915
|
}
|
|
85524
85916
|
function assertReadableNonEmptyFile(path) {
|
|
85525
|
-
const fd =
|
|
85917
|
+
const fd = openSync5(path, "r");
|
|
85526
85918
|
try {
|
|
85527
|
-
const stat =
|
|
85919
|
+
const stat = fstatSync3(fd);
|
|
85528
85920
|
if (!stat.isFile() || stat.size <= 0) {
|
|
85529
85921
|
throw new Error(`Render artifact is not a non-empty file: ${path}`);
|
|
85530
85922
|
}
|
|
85531
85923
|
readSync(fd, Buffer.allocUnsafe(1), 0, 1, 0);
|
|
85532
85924
|
} finally {
|
|
85533
|
-
|
|
85925
|
+
closeSync5(fd);
|
|
85534
85926
|
}
|
|
85535
85927
|
}
|
|
85536
85928
|
function collectDirectoryFiles(root) {
|
|
85537
85929
|
const files = [];
|
|
85538
85930
|
const visit = (directory) => {
|
|
85539
85931
|
for (const entry of readdirSync8(directory, { withFileTypes: true })) {
|
|
85540
|
-
const path =
|
|
85932
|
+
const path = join22(directory, entry.name);
|
|
85541
85933
|
if (entry.isDirectory()) visit(path);
|
|
85542
85934
|
else if (entry.isFile()) files.push(path);
|
|
85543
85935
|
}
|
|
@@ -85580,8 +85972,8 @@ var ArtifactTransaction = class {
|
|
|
85580
85972
|
this.fileSystem = fileSystem;
|
|
85581
85973
|
this.destinationPath = resolve9(destinationPath);
|
|
85582
85974
|
this.transactionDirectory = createSiblingTransactionDirectory(this.destinationPath);
|
|
85583
|
-
this.stagingPath =
|
|
85584
|
-
this.backupPath =
|
|
85975
|
+
this.stagingPath = join22(this.transactionDirectory, basename5(this.destinationPath));
|
|
85976
|
+
this.backupPath = join22(this.transactionDirectory, "backup");
|
|
85585
85977
|
this.durationProbe = durationProbe;
|
|
85586
85978
|
}
|
|
85587
85979
|
kind;
|
|
@@ -86146,7 +86538,7 @@ function resolveVideoCaptureBeyondViewport(videoCount) {
|
|
|
86146
86538
|
// ../producer/src/services/render/captureCost.ts
|
|
86147
86539
|
init_dist2();
|
|
86148
86540
|
init_src();
|
|
86149
|
-
import { join as
|
|
86541
|
+
import { join as join23 } from "path";
|
|
86150
86542
|
var CAPTURE_CALIBRATION_TARGET_MS = 600;
|
|
86151
86543
|
var MAX_MEASURED_CAPTURE_COST_MULTIPLIER = 8;
|
|
86152
86544
|
var CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS = 3e4;
|
|
@@ -86382,7 +86774,7 @@ async function runCaptureCalibration(input) {
|
|
|
86382
86774
|
});
|
|
86383
86775
|
let calibration;
|
|
86384
86776
|
try {
|
|
86385
|
-
calibration = await runOneCalibration(
|
|
86777
|
+
calibration = await runOneCalibration(join23(workDir, "capture-calibration"), calibrationCfg);
|
|
86386
86778
|
} catch (error) {
|
|
86387
86779
|
const shouldFallback = !forceScreenshot && shouldFallbackToScreenshotAfterCalibrationError(error);
|
|
86388
86780
|
if (!shouldFallback) {
|
|
@@ -86415,7 +86807,7 @@ async function runCaptureCalibration(input) {
|
|
|
86415
86807
|
const screenshotCfg = createCaptureCalibrationConfig({ ...cfg, forceScreenshot: true });
|
|
86416
86808
|
try {
|
|
86417
86809
|
calibration = await runOneCalibration(
|
|
86418
|
-
|
|
86810
|
+
join23(workDir, "capture-calibration-screenshot"),
|
|
86419
86811
|
screenshotCfg
|
|
86420
86812
|
);
|
|
86421
86813
|
} catch (fallbackError) {
|
|
@@ -86838,7 +87230,7 @@ function countAuthoredTimedClips(html) {
|
|
|
86838
87230
|
|
|
86839
87231
|
// ../producer/src/services/render/stages/compileStage.ts
|
|
86840
87232
|
init_dist2();
|
|
86841
|
-
import { join as
|
|
87233
|
+
import { join as join29 } from "path";
|
|
86842
87234
|
|
|
86843
87235
|
// ../producer/src/services/htmlCompiler.ts
|
|
86844
87236
|
init_esm10();
|
|
@@ -86847,8 +87239,8 @@ init_audioGain();
|
|
|
86847
87239
|
init_compiler();
|
|
86848
87240
|
init_subCompositionValidity();
|
|
86849
87241
|
init_assetResolution();
|
|
86850
|
-
import { createReadStream as createReadStream4, existsSync as
|
|
86851
|
-
import { join as
|
|
87242
|
+
import { createReadStream as createReadStream4, existsSync as existsSync24, mkdirSync as mkdirSync13, readFileSync as readFileSync10 } from "fs";
|
|
87243
|
+
import { join as join28, dirname as dirname14, resolve as resolve12, basename as basename6, relative as relative2 } from "path";
|
|
86852
87244
|
|
|
86853
87245
|
// ../producer/src/services/renderMediaCollector.ts
|
|
86854
87246
|
init_esm10();
|
|
@@ -86934,18 +87326,18 @@ init_src();
|
|
|
86934
87326
|
|
|
86935
87327
|
// ../producer/src/services/deterministicFonts.ts
|
|
86936
87328
|
import { createHash as createHash7 } from "crypto";
|
|
86937
|
-
import { existsSync as
|
|
87329
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync11, mkdtempSync as mkdtempSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync9 } from "fs";
|
|
86938
87330
|
import { homedir as homedir5, tmpdir as tmpdir5 } from "os";
|
|
86939
|
-
import { join as
|
|
87331
|
+
import { join as join26 } from "path";
|
|
86940
87332
|
|
|
86941
87333
|
// ../core/dist/fonts/aliases.js
|
|
86942
87334
|
init_dist();
|
|
86943
87335
|
|
|
86944
87336
|
// ../core/dist/fonts/systemFontLocator.js
|
|
86945
87337
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
86946
|
-
import { existsSync as
|
|
87338
|
+
import { existsSync as existsSync19, lstatSync as lstatSync4, readdirSync as readdirSync9, realpathSync as realpathSync3 } from "fs";
|
|
86947
87339
|
import { homedir as homedir3, platform as platform2 } from "os";
|
|
86948
|
-
import { join as
|
|
87340
|
+
import { join as join24, resolve as resolve10 } from "path";
|
|
86949
87341
|
var SYSTEM_FONT_SIZE_LIMIT = 5 * 1024 * 1024;
|
|
86950
87342
|
var PROFILER_TIMEOUT_MS = 5e3;
|
|
86951
87343
|
var FONT_EXT_RE = /\.(otf|ttf|ttc|woff2?)$/i;
|
|
@@ -86977,7 +87369,7 @@ var allowedDirsCache = null;
|
|
|
86977
87369
|
function getAllowedFontDirs() {
|
|
86978
87370
|
if (allowedDirsCache)
|
|
86979
87371
|
return allowedDirsCache;
|
|
86980
|
-
allowedDirsCache = fontDirectories().filter((d) =>
|
|
87372
|
+
allowedDirsCache = fontDirectories().filter((d) => existsSync19(d)).map((d) => {
|
|
86981
87373
|
try {
|
|
86982
87374
|
return realpathSync3(d);
|
|
86983
87375
|
} catch {
|
|
@@ -87042,7 +87434,7 @@ function fontDirectories() {
|
|
|
87042
87434
|
const home = homedir3();
|
|
87043
87435
|
if (platform2() === "darwin") {
|
|
87044
87436
|
return [
|
|
87045
|
-
|
|
87437
|
+
join24(home, "Library", "Fonts"),
|
|
87046
87438
|
"/Library/Fonts",
|
|
87047
87439
|
"/System/Library/Fonts",
|
|
87048
87440
|
"/System/Library/Fonts/Supplemental"
|
|
@@ -87050,24 +87442,24 @@ function fontDirectories() {
|
|
|
87050
87442
|
}
|
|
87051
87443
|
if (platform2() === "win32") {
|
|
87052
87444
|
return [
|
|
87053
|
-
|
|
87054
|
-
|
|
87445
|
+
join24(process.env.WINDIR || "C:\\Windows", "Fonts"),
|
|
87446
|
+
join24(process.env.LOCALAPPDATA || join24(homedir3(), "AppData", "Local"), "Microsoft", "Windows", "Fonts")
|
|
87055
87447
|
];
|
|
87056
87448
|
}
|
|
87057
87449
|
return [
|
|
87058
|
-
|
|
87059
|
-
|
|
87450
|
+
join24(home, ".fonts"),
|
|
87451
|
+
join24(home, ".local", "share", "fonts"),
|
|
87060
87452
|
"/usr/local/share/fonts",
|
|
87061
87453
|
"/usr/share/fonts"
|
|
87062
87454
|
];
|
|
87063
87455
|
}
|
|
87064
87456
|
function collectFontFileEntries(dir, depth = 0) {
|
|
87065
|
-
if (!
|
|
87457
|
+
if (!existsSync19(dir) || depth > 2)
|
|
87066
87458
|
return [];
|
|
87067
87459
|
const entries2 = [];
|
|
87068
87460
|
try {
|
|
87069
87461
|
for (const entry of readdirSync9(dir, { withFileTypes: true })) {
|
|
87070
|
-
const fullPath =
|
|
87462
|
+
const fullPath = join24(dir, entry.name);
|
|
87071
87463
|
if (entry.isDirectory()) {
|
|
87072
87464
|
entries2.push(...collectFontFileEntries(fullPath, depth + 1));
|
|
87073
87465
|
continue;
|
|
@@ -87517,13 +87909,23 @@ function fontDataUri(packageName, weight, style = "normal") {
|
|
|
87517
87909
|
}
|
|
87518
87910
|
function extractExistingFontFaces(html) {
|
|
87519
87911
|
const families = /* @__PURE__ */ new Set();
|
|
87520
|
-
const
|
|
87521
|
-
|
|
87522
|
-
|
|
87523
|
-
|
|
87524
|
-
|
|
87525
|
-
|
|
87526
|
-
|
|
87912
|
+
const opening = /@font-face\s*\{/gi;
|
|
87913
|
+
const family = /font-family\s*:/gi;
|
|
87914
|
+
while (opening.exec(html)) {
|
|
87915
|
+
family.lastIndex = opening.lastIndex;
|
|
87916
|
+
let declaration = family.exec(html);
|
|
87917
|
+
while (declaration && html[family.lastIndex] === ";") {
|
|
87918
|
+
declaration = family.exec(html);
|
|
87919
|
+
}
|
|
87920
|
+
if (!declaration) break;
|
|
87921
|
+
const valueStart = family.lastIndex;
|
|
87922
|
+
const semicolon = html.indexOf(";", valueStart);
|
|
87923
|
+
if (semicolon < 0) break;
|
|
87924
|
+
const end = html.indexOf("}", semicolon + 1);
|
|
87925
|
+
if (end < 0) break;
|
|
87926
|
+
const normalized = normalizeFamilyName(html.slice(valueStart, semicolon));
|
|
87927
|
+
if (normalized) families.add(normalized);
|
|
87928
|
+
opening.lastIndex = end + 1;
|
|
87527
87929
|
}
|
|
87528
87930
|
return families;
|
|
87529
87931
|
}
|
|
@@ -87730,10 +88132,10 @@ function resolveFontCacheRoot() {
|
|
|
87730
88132
|
return process.env.HYPERFRAMES_FONT_CACHE_DIR;
|
|
87731
88133
|
}
|
|
87732
88134
|
if (process.env.AWS_LAMBDA_FUNCTION_NAME) {
|
|
87733
|
-
lambdaFontCacheRoot ??=
|
|
88135
|
+
lambdaFontCacheRoot ??= mkdtempSync8(join26(tmpdir5(), "hyperframes-fonts-"));
|
|
87734
88136
|
return lambdaFontCacheRoot;
|
|
87735
88137
|
}
|
|
87736
|
-
return
|
|
88138
|
+
return join26(homedir5(), ".cache", "hyperframes", "fonts");
|
|
87737
88139
|
}
|
|
87738
88140
|
var WOFF2_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
|
|
87739
88141
|
function fontSlug(familyName) {
|
|
@@ -87741,14 +88143,14 @@ function fontSlug(familyName) {
|
|
|
87741
88143
|
}
|
|
87742
88144
|
var ephemeralFontCacheRoot;
|
|
87743
88145
|
function fontCacheDir(slug) {
|
|
87744
|
-
const dir =
|
|
87745
|
-
if (!
|
|
88146
|
+
const dir = join26(resolveFontCacheRoot(), slug);
|
|
88147
|
+
if (!existsSync21(dir)) {
|
|
87746
88148
|
try {
|
|
87747
88149
|
mkdirSync11(dir, { recursive: true });
|
|
87748
88150
|
} catch {
|
|
87749
88151
|
const firstFallback = ephemeralFontCacheRoot === void 0;
|
|
87750
|
-
ephemeralFontCacheRoot ??=
|
|
87751
|
-
const fallback =
|
|
88152
|
+
ephemeralFontCacheRoot ??= mkdtempSync8(join26(tmpdir5(), "hyperframes-fonts-"));
|
|
88153
|
+
const fallback = join26(ephemeralFontCacheRoot, slug);
|
|
87752
88154
|
mkdirSync11(fallback, { recursive: true });
|
|
87753
88155
|
if (firstFallback) {
|
|
87754
88156
|
defaultLogger.warn(
|
|
@@ -87764,7 +88166,7 @@ function subsetToken(woff2Url) {
|
|
|
87764
88166
|
return createHash7("sha1").update(woff2Url).digest("hex").slice(0, 12);
|
|
87765
88167
|
}
|
|
87766
88168
|
function cachedWoff2Path(slug, weight, style, subset) {
|
|
87767
|
-
return
|
|
88169
|
+
return join26(fontCacheDir(slug), `${weight}-${style}-${subset}.woff2`);
|
|
87768
88170
|
}
|
|
87769
88171
|
var FONT_FETCH_FAILED = "FONT_FETCH_FAILED";
|
|
87770
88172
|
var FONT_FETCH_UNAVAILABLE = "FONT_FETCH_UNAVAILABLE";
|
|
@@ -88165,14 +88567,14 @@ init_src();
|
|
|
88165
88567
|
import { createHash as createHash8 } from "crypto";
|
|
88166
88568
|
import {
|
|
88167
88569
|
copyFileSync as copyFileSync4,
|
|
88168
|
-
existsSync as
|
|
88570
|
+
existsSync as existsSync22,
|
|
88169
88571
|
mkdirSync as mkdirSync12,
|
|
88170
88572
|
readFileSync as readFileSync9,
|
|
88171
88573
|
renameSync as renameSync5,
|
|
88172
|
-
rmSync as
|
|
88574
|
+
rmSync as rmSync10,
|
|
88173
88575
|
statSync as statSync8
|
|
88174
88576
|
} from "fs";
|
|
88175
|
-
import { dirname as
|
|
88577
|
+
import { dirname as dirname13, isAbsolute as isAbsolute3, join as join27, resolve as resolve11 } from "path";
|
|
88176
88578
|
var PREPARED_GIF_SUBDIR = "_animated_gif";
|
|
88177
88579
|
var CACHE_SCHEMA = "hfgif-v1";
|
|
88178
88580
|
function splitUrlSuffix(src) {
|
|
@@ -88207,14 +88609,14 @@ function resolveGifSourcePath(src, options) {
|
|
|
88207
88609
|
const { basePath } = splitUrlSuffix(trimmed);
|
|
88208
88610
|
const normalizedBase = normalizeRelPath(basePath);
|
|
88209
88611
|
const mapped = options.sourceAssets?.get(trimmed) ?? options.sourceAssets?.get(basePath) ?? options.sourceAssets?.get(normalizedBase);
|
|
88210
|
-
if (mapped &&
|
|
88612
|
+
if (mapped && existsSync22(mapped)) return mapped;
|
|
88211
88613
|
if (isHttpUrl(trimmed)) return null;
|
|
88212
88614
|
const projectRelative = basePath.startsWith("/") ? basePath.slice(1) : basePath;
|
|
88213
88615
|
const candidates = [
|
|
88214
88616
|
isAbsolute3(basePath) ? basePath : resolve11(options.projectDir, projectRelative),
|
|
88215
88617
|
resolve11(options.downloadDir, normalizedBase)
|
|
88216
88618
|
];
|
|
88217
|
-
return candidates.find((candidate) =>
|
|
88619
|
+
return candidates.find((candidate) => existsSync22(candidate)) ?? null;
|
|
88218
88620
|
}
|
|
88219
88621
|
function isUsableFile(path) {
|
|
88220
88622
|
try {
|
|
@@ -88325,11 +88727,11 @@ async function runAnimatedGifTranscode(request) {
|
|
|
88325
88727
|
throw result.error ?? new Error(`Animated GIF transcode failed (${result.exitCode}): ${result.stderr.slice(-500)}`);
|
|
88326
88728
|
}
|
|
88327
88729
|
async function ensurePreparedWebm(input) {
|
|
88328
|
-
if (!
|
|
88329
|
-
mkdirSync12(
|
|
88730
|
+
if (!existsSync22(dirname13(input.cachePath))) {
|
|
88731
|
+
mkdirSync12(dirname13(input.cachePath), { recursive: true });
|
|
88330
88732
|
}
|
|
88331
|
-
if (!
|
|
88332
|
-
mkdirSync12(
|
|
88733
|
+
if (!existsSync22(dirname13(input.outputPath))) {
|
|
88734
|
+
mkdirSync12(dirname13(input.outputPath), { recursive: true });
|
|
88333
88735
|
}
|
|
88334
88736
|
if (!isUsableFile(input.cachePath)) {
|
|
88335
88737
|
const tmpPath = `${input.cachePath}.tmp-${process.pid}-${Date.now()}`;
|
|
@@ -88353,10 +88755,10 @@ async function ensurePreparedWebm(input) {
|
|
|
88353
88755
|
if (!isUsableFile(input.cachePath)) {
|
|
88354
88756
|
renameSync5(tmpPath, input.cachePath);
|
|
88355
88757
|
} else {
|
|
88356
|
-
|
|
88758
|
+
rmSync10(tmpPath, { force: true });
|
|
88357
88759
|
}
|
|
88358
88760
|
} catch (error) {
|
|
88359
|
-
|
|
88761
|
+
rmSync10(tmpPath, { force: true });
|
|
88360
88762
|
throw error;
|
|
88361
88763
|
}
|
|
88362
88764
|
}
|
|
@@ -88412,7 +88814,7 @@ function replaceImageWithVideo(input) {
|
|
|
88412
88814
|
return video;
|
|
88413
88815
|
}
|
|
88414
88816
|
async function prepareAnimatedGifInputs(html, options) {
|
|
88415
|
-
const outputDir = options.outputDir ??
|
|
88817
|
+
const outputDir = options.outputDir ?? join27(options.downloadDir, PREPARED_GIF_SUBDIR);
|
|
88416
88818
|
const outputSrcPrefix = normalizeRelPath(options.outputSrcPrefix ?? PREPARED_GIF_SUBDIR);
|
|
88417
88819
|
const cacheDir = options.cacheDir ?? outputDir;
|
|
88418
88820
|
const { document: document2 } = parseHTML(html);
|
|
@@ -88434,8 +88836,8 @@ async function prepareAnimatedGifInputs(html, options) {
|
|
|
88434
88836
|
const { loopIterations, padSeconds } = resolvePreparedPlayback(metadata, loop, windowSeconds);
|
|
88435
88837
|
const hash2 = computePreparedGifHash(bytes, loopIterations, padSeconds);
|
|
88436
88838
|
const filename = `${CACHE_SCHEMA}-${hash2.slice(0, 24)}.webm`;
|
|
88437
|
-
const cachePath =
|
|
88438
|
-
const outputPath =
|
|
88839
|
+
const cachePath = join27(cacheDir, filename);
|
|
88840
|
+
const outputPath = join27(outputDir, filename);
|
|
88439
88841
|
const outputSrc = `${outputSrcPrefix}/${filename}`;
|
|
88440
88842
|
await ensurePreparedWebm({
|
|
88441
88843
|
sourcePath,
|
|
@@ -88766,7 +89168,7 @@ function getPositionEditsRenderScript() {
|
|
|
88766
89168
|
|
|
88767
89169
|
// ../producer/src/services/assetMediaType.ts
|
|
88768
89170
|
init_src();
|
|
88769
|
-
import { existsSync as
|
|
89171
|
+
import { existsSync as existsSync23 } from "fs";
|
|
88770
89172
|
|
|
88771
89173
|
// ../producer/src/utils/semaphore.ts
|
|
88772
89174
|
var Semaphore = class {
|
|
@@ -88881,7 +89283,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
88881
89283
|
input.projectDir,
|
|
88882
89284
|
input.compiledDir
|
|
88883
89285
|
);
|
|
88884
|
-
if (!
|
|
89286
|
+
if (!existsSync23(resolvedPath)) continue;
|
|
88885
89287
|
byPath.set(resolvedPath, [...byPath.get(resolvedPath) ?? [], reference]);
|
|
88886
89288
|
}
|
|
88887
89289
|
const mismatches = [];
|
|
@@ -88962,7 +89364,7 @@ function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */
|
|
|
88962
89364
|
if (isUnresolvedAssetPlaceholder(srcPath)) continue;
|
|
88963
89365
|
const filePath = resolve12(projectDir, srcPath);
|
|
88964
89366
|
if (visited.has(filePath)) continue;
|
|
88965
|
-
if (!
|
|
89367
|
+
if (!existsSync24(filePath)) {
|
|
88966
89368
|
problems.push({ srcPath, detail: "the file does not exist" });
|
|
88967
89369
|
continue;
|
|
88968
89370
|
}
|
|
@@ -89096,7 +89498,7 @@ function detectShaderTransitionUsage(html) {
|
|
|
89096
89498
|
async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, downloadDir, tagName19, elementIdentity, log) {
|
|
89097
89499
|
let filePath = src;
|
|
89098
89500
|
if (isHttpUrl(src)) {
|
|
89099
|
-
if (!
|
|
89501
|
+
if (!existsSync24(downloadDir)) mkdirSync13(downloadDir, { recursive: true });
|
|
89100
89502
|
try {
|
|
89101
89503
|
filePath = await downloadToTemp(src, downloadDir, void 0, void 0, void 0, {
|
|
89102
89504
|
onTelemetry: logRemoteDownloadTelemetry
|
|
@@ -89105,9 +89507,9 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, baseDir, down
|
|
|
89105
89507
|
return { duration: null, resolvedPath: src };
|
|
89106
89508
|
}
|
|
89107
89509
|
} else if (!filePath.startsWith("/")) {
|
|
89108
|
-
filePath =
|
|
89510
|
+
filePath = join28(baseDir, filePath);
|
|
89109
89511
|
}
|
|
89110
|
-
if (!
|
|
89512
|
+
if (!existsSync24(filePath)) {
|
|
89111
89513
|
return { duration: null, resolvedPath: filePath };
|
|
89112
89514
|
}
|
|
89113
89515
|
const withSrcContext = (error) => {
|
|
@@ -89240,7 +89642,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
89240
89642
|
if (visited.has(filePath)) {
|
|
89241
89643
|
continue;
|
|
89242
89644
|
}
|
|
89243
|
-
if (!
|
|
89645
|
+
if (!existsSync24(filePath)) {
|
|
89244
89646
|
continue;
|
|
89245
89647
|
}
|
|
89246
89648
|
const rawSubHtml = readFileSync10(filePath, "utf-8");
|
|
@@ -89252,7 +89654,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
|
|
|
89252
89654
|
workItems.map(async (item) => {
|
|
89253
89655
|
const { html: compiledSub } = await compileHtmlFile(
|
|
89254
89656
|
item.rawSubHtml,
|
|
89255
|
-
|
|
89657
|
+
dirname14(item.filePath),
|
|
89256
89658
|
downloadDir
|
|
89257
89659
|
);
|
|
89258
89660
|
const nested = await parseSubCompositions(
|
|
@@ -89432,7 +89834,7 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
|
|
|
89432
89834
|
let compHtml = subCompositions.get(srcPath) || null;
|
|
89433
89835
|
if (!compHtml) {
|
|
89434
89836
|
const filePath = resolve12(projectDir, srcPath);
|
|
89435
|
-
if (
|
|
89837
|
+
if (existsSync24(filePath)) {
|
|
89436
89838
|
compHtml = readFileSync10(filePath, "utf-8");
|
|
89437
89839
|
}
|
|
89438
89840
|
}
|
|
@@ -89441,7 +89843,7 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
|
|
|
89441
89843
|
parseHtml: (htmlStr) => parseHTML(htmlStr).document,
|
|
89442
89844
|
// Mirrors the preview bundler: a sub-composition's SIBLING assets resolve
|
|
89443
89845
|
// against its own directory, project-root refs stay as authored.
|
|
89444
|
-
assetExists: (path) =>
|
|
89846
|
+
assetExists: (path) => existsSync24(resolve12(projectDir, path)),
|
|
89445
89847
|
scriptErrorLabel: "[Compiler] Composition script failed",
|
|
89446
89848
|
// Preserve the authored root wrapper as a child of the host, matching
|
|
89447
89849
|
// the preview bundler's shape (htmlBundler.ts's prepareFlattenedInnerRoot,
|
|
@@ -89604,7 +90006,7 @@ function collectExternalAssets(html, projectDir) {
|
|
|
89604
90006
|
if (isPathInside3(absPath, absProjectDir)) {
|
|
89605
90007
|
return null;
|
|
89606
90008
|
}
|
|
89607
|
-
if (!
|
|
90009
|
+
if (!existsSync24(absPath)) return null;
|
|
89608
90010
|
const safeKey = toExternalAssetKey(absPath);
|
|
89609
90011
|
externalAssets.set(safeKey, absPath);
|
|
89610
90012
|
return safeKey;
|
|
@@ -89654,7 +90056,7 @@ var REMOTE_SOURCE_TAG_RE = /<source\b[^>]*?\bsrc\s*=\s*["'](https?:\/\/[^"']+)["
|
|
|
89654
90056
|
var REMOTE_IMG_TAG_RE = /<img\b[^>]*?(?<![\w-])src\s*=\s*["'](https?:\/\/[^"']+)["'][^>]*>/gi;
|
|
89655
90057
|
async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
|
|
89656
90058
|
if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
|
|
89657
|
-
if (!
|
|
90059
|
+
if (!existsSync24(remoteDir)) mkdirSync13(remoteDir, { recursive: true });
|
|
89658
90060
|
const urlToLocal = /* @__PURE__ */ new Map();
|
|
89659
90061
|
await Promise.all(
|
|
89660
90062
|
[...urlSet].map(async (url) => {
|
|
@@ -89701,7 +90103,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
|
|
|
89701
90103
|
return downloadAndRewriteUrls(
|
|
89702
90104
|
urlSet,
|
|
89703
90105
|
html,
|
|
89704
|
-
|
|
90106
|
+
join28(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
89705
90107
|
"Remote media download failed",
|
|
89706
90108
|
"Localized remote media source(s)"
|
|
89707
90109
|
);
|
|
@@ -89716,7 +90118,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
|
|
|
89716
90118
|
return downloadAndRewriteUrls(
|
|
89717
90119
|
urlSet,
|
|
89718
90120
|
html,
|
|
89719
|
-
|
|
90121
|
+
join28(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
89720
90122
|
"Remote image download failed",
|
|
89721
90123
|
"Localized remote image source(s)"
|
|
89722
90124
|
);
|
|
@@ -89732,7 +90134,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
|
|
|
89732
90134
|
return downloadAndRewriteUrls(
|
|
89733
90135
|
urlSet,
|
|
89734
90136
|
html,
|
|
89735
|
-
|
|
90137
|
+
join28(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
89736
90138
|
"Remote background-image download failed",
|
|
89737
90139
|
"Localized remote background-image(s)",
|
|
89738
90140
|
// Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
|
|
@@ -89867,7 +90269,7 @@ async function localizeRemoteFontFaces(html, downloadDir) {
|
|
|
89867
90269
|
return downloadAndRewriteUrls(
|
|
89868
90270
|
urlSet,
|
|
89869
90271
|
processed,
|
|
89870
|
-
|
|
90272
|
+
join28(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
89871
90273
|
"Remote font download failed",
|
|
89872
90274
|
"Localized remote font face(s)",
|
|
89873
90275
|
(h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
|
|
@@ -89956,7 +90358,7 @@ function rewriteUnresolvableGsapToCdn(html, projectDir) {
|
|
|
89956
90358
|
(full, prefix, src, file, suffix) => {
|
|
89957
90359
|
if (/^https?:\/\//i.test(src)) return full;
|
|
89958
90360
|
const absPath = resolve12(projectDir, src);
|
|
89959
|
-
if (
|
|
90361
|
+
if (existsSync24(absPath)) return full;
|
|
89960
90362
|
defaultLogger.info(
|
|
89961
90363
|
`[Compiler] Rewriting missing gsap script to CDN: ${src} \u2192 ${GSAP_CDN_BASE}${file}`
|
|
89962
90364
|
);
|
|
@@ -89969,7 +90371,7 @@ function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath) {
|
|
|
89969
90371
|
const entryPath = relative2(projectDir, htmlPath).replace(/\\/g, "/");
|
|
89970
90372
|
if (!entryPath.includes("/")) return html;
|
|
89971
90373
|
const { document: document2 } = parseHTML(html);
|
|
89972
|
-
const assetExists = (path) =>
|
|
90374
|
+
const assetExists = (path) => existsSync24(resolve12(projectDir, path));
|
|
89973
90375
|
rewriteAssetPaths(
|
|
89974
90376
|
document2.querySelectorAll("[src], [href]"),
|
|
89975
90377
|
entryPath,
|
|
@@ -90481,13 +90883,13 @@ async function runCompileStage(input) {
|
|
|
90481
90883
|
abortSignal
|
|
90482
90884
|
} = input;
|
|
90483
90885
|
const compileStart = Date.now();
|
|
90484
|
-
const compiled = await compileForRender(projectDir, htmlPath,
|
|
90886
|
+
const compiled = await compileForRender(projectDir, htmlPath, join29(workDir, "downloads"), {
|
|
90485
90887
|
log,
|
|
90486
90888
|
failClosedFontFetch: failClosedFontFetch === true,
|
|
90487
90889
|
allowSystemFontCapture,
|
|
90488
90890
|
abortSignal,
|
|
90489
90891
|
variables: input.variables,
|
|
90490
|
-
animatedGifCacheDir: cfg.extractCacheDir ?
|
|
90892
|
+
animatedGifCacheDir: cfg.extractCacheDir ? join29(cfg.extractCacheDir, "animated-gif") : void 0,
|
|
90491
90893
|
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout
|
|
90492
90894
|
});
|
|
90493
90895
|
assertNotAborted();
|
|
@@ -90549,7 +90951,7 @@ async function runCompileStage(input) {
|
|
|
90549
90951
|
};
|
|
90550
90952
|
await preflightCompositionAssetMediaTypes({
|
|
90551
90953
|
projectDir,
|
|
90552
|
-
compiledDir:
|
|
90954
|
+
compiledDir: join29(workDir, "compiled"),
|
|
90553
90955
|
composition,
|
|
90554
90956
|
signal: abortSignal
|
|
90555
90957
|
});
|
|
@@ -90597,7 +90999,7 @@ async function runCompileStage(input) {
|
|
|
90597
90999
|
init_esm10();
|
|
90598
91000
|
init_src();
|
|
90599
91001
|
init_dist2();
|
|
90600
|
-
import { join as
|
|
91002
|
+
import { join as join30 } from "path";
|
|
90601
91003
|
|
|
90602
91004
|
// ../producer/src/services/render/stages/probeFailures.ts
|
|
90603
91005
|
var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
|
|
@@ -90703,7 +91105,7 @@ async function runProbeStage(input) {
|
|
|
90703
91105
|
});
|
|
90704
91106
|
fileServer = await createFileServer2({
|
|
90705
91107
|
projectDir,
|
|
90706
|
-
compiledDir:
|
|
91108
|
+
compiledDir: join30(workDir, "compiled"),
|
|
90707
91109
|
port: 0,
|
|
90708
91110
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
90709
91111
|
fps: job.config.fps
|
|
@@ -90725,7 +91127,7 @@ async function runProbeStage(input) {
|
|
|
90725
91127
|
log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
|
|
90726
91128
|
probeSession = await createCaptureSession(
|
|
90727
91129
|
fileServer.url,
|
|
90728
|
-
|
|
91130
|
+
join30(workDir, "probe"),
|
|
90729
91131
|
captureOpts,
|
|
90730
91132
|
null,
|
|
90731
91133
|
probeCfg
|
|
@@ -90810,7 +91212,7 @@ async function runProbeStage(input) {
|
|
|
90810
91212
|
});
|
|
90811
91213
|
probeSession = await createCaptureSession(
|
|
90812
91214
|
fileServer.url,
|
|
90813
|
-
|
|
91215
|
+
join30(workDir, "probe-screenshot"),
|
|
90814
91216
|
captureOpts,
|
|
90815
91217
|
null,
|
|
90816
91218
|
{ ...probeCfg, forceScreenshot: true }
|
|
@@ -90846,7 +91248,7 @@ async function runProbeStage(input) {
|
|
|
90846
91248
|
compiled,
|
|
90847
91249
|
resolutions,
|
|
90848
91250
|
projectDir,
|
|
90849
|
-
|
|
91251
|
+
join30(workDir, "downloads")
|
|
90850
91252
|
);
|
|
90851
91253
|
assertNotAborted();
|
|
90852
91254
|
composition.videos = compiled.videos;
|
|
@@ -91025,7 +91427,7 @@ async function runProbeStage(input) {
|
|
|
91025
91427
|
try {
|
|
91026
91428
|
await preflightCompositionAssetMediaTypes({
|
|
91027
91429
|
projectDir,
|
|
91028
|
-
compiledDir:
|
|
91430
|
+
compiledDir: join30(workDir, "compiled"),
|
|
91029
91431
|
composition,
|
|
91030
91432
|
signal: abortSignal
|
|
91031
91433
|
});
|
|
@@ -91152,8 +91554,8 @@ function validateRenderDuration(input) {
|
|
|
91152
91554
|
|
|
91153
91555
|
// ../producer/src/services/render/stages/extractVideosStage.ts
|
|
91154
91556
|
init_src();
|
|
91155
|
-
import { existsSync as
|
|
91156
|
-
import { join as
|
|
91557
|
+
import { existsSync as existsSync25 } from "fs";
|
|
91558
|
+
import { join as join31 } from "path";
|
|
91157
91559
|
|
|
91158
91560
|
// ../producer/src/services/render/extractionFailureMetadata.ts
|
|
91159
91561
|
function stringOrEmpty(value) {
|
|
@@ -91382,7 +91784,7 @@ async function runExtractVideosStage(input) {
|
|
|
91382
91784
|
const probeFailures = await Promise.all(
|
|
91383
91785
|
composition.videos.map(async (v) => {
|
|
91384
91786
|
const videoPath = resolveProjectRelativeSrc(v.src, projectDir, compiledDir);
|
|
91385
|
-
if (!
|
|
91787
|
+
if (!existsSync25(videoPath)) return null;
|
|
91386
91788
|
try {
|
|
91387
91789
|
const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata(videoPath), retries: 0 } : await runVideoExtractionWithRetry(() => extractMediaMetadata(videoPath), {
|
|
91388
91790
|
signal: abortSignal,
|
|
@@ -91420,7 +91822,7 @@ async function runExtractVideosStage(input) {
|
|
|
91420
91822
|
const probed = await Promise.all(
|
|
91421
91823
|
composition.images.map(async (img) => {
|
|
91422
91824
|
const imgPath = resolveProjectRelativeSrc(img.src, projectDir, compiledDir);
|
|
91423
|
-
if (!
|
|
91825
|
+
if (!existsSync25(imgPath)) return null;
|
|
91424
91826
|
const colorSpace = await probeColorSpaceSafely(imgPath, log);
|
|
91425
91827
|
if (isHdrColorSpace(colorSpace)) {
|
|
91426
91828
|
nativeHdrImageIds.add(img.id);
|
|
@@ -91449,7 +91851,7 @@ async function runExtractVideosStage(input) {
|
|
|
91449
91851
|
// because short boundary counts can differ by one frame.
|
|
91450
91852
|
{
|
|
91451
91853
|
fps: job.config.fps,
|
|
91452
|
-
outputDir:
|
|
91854
|
+
outputDir: join31(compiledDir, "__hyperframes_video_frames"),
|
|
91453
91855
|
format: job.config.videoFrameFormat ?? "auto",
|
|
91454
91856
|
timelineEnd: composition.duration,
|
|
91455
91857
|
maxTransientRetries: extractionPolicy.maxTransientRetries,
|
|
@@ -91514,7 +91916,7 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
|
|
|
91514
91916
|
|
|
91515
91917
|
// ../producer/src/services/render/stages/audioStage.ts
|
|
91516
91918
|
init_src();
|
|
91517
|
-
import { join as
|
|
91919
|
+
import { join as join32 } from "path";
|
|
91518
91920
|
async function runAudioStage(input) {
|
|
91519
91921
|
const {
|
|
91520
91922
|
projectDir,
|
|
@@ -91529,7 +91931,7 @@ async function runAudioStage(input) {
|
|
|
91529
91931
|
log
|
|
91530
91932
|
} = input;
|
|
91531
91933
|
const stage3Start = Date.now();
|
|
91532
|
-
const audioOutputPath =
|
|
91934
|
+
const audioOutputPath = join32(workDir, MIXED_AUDIO_FILENAME);
|
|
91533
91935
|
let hasAudio = false;
|
|
91534
91936
|
let audioError;
|
|
91535
91937
|
let audioFailures;
|
|
@@ -91539,7 +91941,7 @@ async function runAudioStage(input) {
|
|
|
91539
91941
|
audioResult = await processCompositionAudio(
|
|
91540
91942
|
audios,
|
|
91541
91943
|
projectDir,
|
|
91542
|
-
|
|
91944
|
+
join32(workDir, "audio-work"),
|
|
91543
91945
|
audioOutputPath,
|
|
91544
91946
|
duration,
|
|
91545
91947
|
abortSignal,
|
|
@@ -91807,15 +92209,15 @@ async function runCaptureStage(input) {
|
|
|
91807
92209
|
init_src();
|
|
91808
92210
|
import { mkdtemp as mkdtemp2, writeFile as writeFile2 } from "fs/promises";
|
|
91809
92211
|
import { tmpdir as tmpdir6 } from "os";
|
|
91810
|
-
import { join as
|
|
92212
|
+
import { join as join35 } from "path";
|
|
91811
92213
|
|
|
91812
92214
|
// ../producer/src/services/render/stages/captureHdrFrameShared.ts
|
|
91813
92215
|
init_src();
|
|
91814
92216
|
|
|
91815
92217
|
// ../producer/src/services/hdrCompositor.ts
|
|
91816
92218
|
init_src();
|
|
91817
|
-
import { readSync as readSync2, closeSync as
|
|
91818
|
-
import { join as
|
|
92219
|
+
import { readSync as readSync2, closeSync as closeSync6 } from "fs";
|
|
92220
|
+
import { join as join33 } from "path";
|
|
91819
92221
|
function countNonZeroAlpha(rgba) {
|
|
91820
92222
|
let n = 0;
|
|
91821
92223
|
for (let p = 3; p < rgba.length; p += 4) {
|
|
@@ -91854,7 +92256,7 @@ function cropRgb48le(src, srcW, srcH, cropX, cropY, cropW, cropH) {
|
|
|
91854
92256
|
}
|
|
91855
92257
|
function closeHdrVideoFrameSource(source, log) {
|
|
91856
92258
|
try {
|
|
91857
|
-
|
|
92259
|
+
closeSync6(source.fd);
|
|
91858
92260
|
} catch (err) {
|
|
91859
92261
|
log?.warn("Failed to close HDR raw frame file", {
|
|
91860
92262
|
rawPath: source.rawPath,
|
|
@@ -92221,7 +92623,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
92221
92623
|
if (shouldLog && debugDumpDir) {
|
|
92222
92624
|
const after2 = countNonZeroRgb48(canvas);
|
|
92223
92625
|
const dumpName = `frame_${String(debugFrameIndex).padStart(4, "0")}_layer_${String(layerIdx).padStart(2, "0")}_dom.png`;
|
|
92224
|
-
const dumpPath =
|
|
92626
|
+
const dumpPath = join33(debugDumpDir, dumpName);
|
|
92225
92627
|
writeFileExclusiveSync(dumpPath, domPng);
|
|
92226
92628
|
log.info("[diag] dom layer blit", {
|
|
92227
92629
|
frame: debugFrameIndex,
|
|
@@ -92259,18 +92661,18 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
92259
92661
|
init_src();
|
|
92260
92662
|
init_dist2();
|
|
92261
92663
|
import {
|
|
92262
|
-
closeSync as
|
|
92263
|
-
constants as
|
|
92264
|
-
fstatSync as
|
|
92664
|
+
closeSync as closeSync7,
|
|
92665
|
+
constants as constants4,
|
|
92666
|
+
fstatSync as fstatSync4,
|
|
92265
92667
|
mkdirSync as mkdirSync14,
|
|
92266
|
-
mkdtempSync as
|
|
92267
|
-
openSync as
|
|
92668
|
+
mkdtempSync as mkdtempSync9,
|
|
92669
|
+
openSync as openSync6,
|
|
92268
92670
|
readFileSync as readFileSync11,
|
|
92269
|
-
rmSync as
|
|
92671
|
+
rmSync as rmSync11,
|
|
92270
92672
|
statfsSync as statfsSync2
|
|
92271
92673
|
} from "fs";
|
|
92272
|
-
import { join as
|
|
92273
|
-
var NO_FOLLOW_FLAG =
|
|
92674
|
+
import { join as join34 } from "path";
|
|
92675
|
+
var NO_FOLLOW_FLAG = constants4.O_NOFOLLOW ?? 0;
|
|
92274
92676
|
function tempDirSafePrefix(id) {
|
|
92275
92677
|
const safe = id.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 80);
|
|
92276
92678
|
return safe || "video";
|
|
@@ -92420,7 +92822,7 @@ function resolveHdrExtractionWindow(video, compositionDuration, metadata) {
|
|
|
92420
92822
|
function cleanupHdrFrameDirectory(frameDir, rawPath, log) {
|
|
92421
92823
|
if (process.env.KEEP_TEMP === "1") return;
|
|
92422
92824
|
try {
|
|
92423
|
-
|
|
92825
|
+
rmSync11(frameDir, { recursive: true, force: true });
|
|
92424
92826
|
} catch (err) {
|
|
92425
92827
|
log?.warn("Failed to clean up HDR raw frame directory", {
|
|
92426
92828
|
frameDir,
|
|
@@ -92513,10 +92915,10 @@ async function extractHdrVideoFrames(args) {
|
|
|
92513
92915
|
const window3 = extractionWindows.get(videoId);
|
|
92514
92916
|
if (!video || !window3) continue;
|
|
92515
92917
|
mkdirSync14(framesDir, { recursive: true });
|
|
92516
|
-
const frameDir =
|
|
92918
|
+
const frameDir = mkdtempSync9(join34(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
|
|
92517
92919
|
createdFrameDirs.add(frameDir);
|
|
92518
92920
|
const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
|
|
92519
|
-
const rawPath =
|
|
92921
|
+
const rawPath = join34(frameDir, "frames.rgb48le");
|
|
92520
92922
|
const extractionStart = String(window3.extractionMediaStart ?? window3.mediaStart);
|
|
92521
92923
|
const ffmpegArgs = [];
|
|
92522
92924
|
if (window3.finalFrameOnly) {
|
|
@@ -92558,10 +92960,10 @@ async function extractHdrVideoFrames(args) {
|
|
|
92558
92960
|
});
|
|
92559
92961
|
}
|
|
92560
92962
|
const frameSize = dims.width * dims.height * 6;
|
|
92561
|
-
const fd =
|
|
92963
|
+
const fd = openSync6(rawPath, constants4.O_RDONLY | NO_FOLLOW_FLAG);
|
|
92562
92964
|
let handedOff = false;
|
|
92563
92965
|
try {
|
|
92564
|
-
const frameCount = Math.floor(
|
|
92966
|
+
const frameCount = Math.floor(fstatSync4(fd).size / frameSize);
|
|
92565
92967
|
if (frameCount < 1) {
|
|
92566
92968
|
hdrDiagnostics.videoExtractionFailures += 1;
|
|
92567
92969
|
throw new Error(
|
|
@@ -92581,7 +92983,7 @@ async function extractHdrVideoFrames(args) {
|
|
|
92581
92983
|
});
|
|
92582
92984
|
handedOff = true;
|
|
92583
92985
|
} finally {
|
|
92584
|
-
if (!handedOff)
|
|
92986
|
+
if (!handedOff) closeSync7(fd);
|
|
92585
92987
|
}
|
|
92586
92988
|
}
|
|
92587
92989
|
return { sources: out, estimatedBytes, releaseReservation };
|
|
@@ -92981,11 +93383,11 @@ function createDrainFrameGuard(args) {
|
|
|
92981
93383
|
return buf;
|
|
92982
93384
|
}
|
|
92983
93385
|
if (db < verifyMinDb) {
|
|
92984
|
-
const dumpDir = await mkdtemp2(
|
|
93386
|
+
const dumpDir = await mkdtemp2(join35(tmpdir6(), "hf-de-verify-fail-")).catch(() => null);
|
|
92985
93387
|
if (dumpDir) {
|
|
92986
93388
|
await Promise.all([
|
|
92987
|
-
writeFile2(
|
|
92988
|
-
writeFile2(
|
|
93389
|
+
writeFile2(join35(dumpDir, `frame-${idx}-de.jpg`), buf),
|
|
93390
|
+
writeFile2(join35(dumpDir, `frame-${idx}-truth.jpg`), truth)
|
|
92989
93391
|
]).catch(() => {
|
|
92990
93392
|
});
|
|
92991
93393
|
}
|
|
@@ -93379,8 +93781,8 @@ async function runCaptureStreamingStage(input) {
|
|
|
93379
93781
|
// ../producer/src/services/render/stages/captureHdrStage.ts
|
|
93380
93782
|
init_src();
|
|
93381
93783
|
init_dist2();
|
|
93382
|
-
import { existsSync as
|
|
93383
|
-
import { join as
|
|
93784
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync15 } from "fs";
|
|
93785
|
+
import { join as join39 } from "path";
|
|
93384
93786
|
|
|
93385
93787
|
// ../producer/src/services/hdrImageTransferCache.ts
|
|
93386
93788
|
init_src();
|
|
@@ -93444,7 +93846,7 @@ function createHdrImageTransferCache(options = {}) {
|
|
|
93444
93846
|
|
|
93445
93847
|
// ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
|
|
93446
93848
|
init_src();
|
|
93447
|
-
import { join as
|
|
93849
|
+
import { join as join36 } from "path";
|
|
93448
93850
|
async function runSequentialLayeredFrameLoop(input) {
|
|
93449
93851
|
const {
|
|
93450
93852
|
job,
|
|
@@ -93565,7 +93967,7 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
93565
93967
|
);
|
|
93566
93968
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
93567
93969
|
writeFileExclusiveSync(
|
|
93568
|
-
|
|
93970
|
+
join36(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
93569
93971
|
normalCanvas
|
|
93570
93972
|
);
|
|
93571
93973
|
}
|
|
@@ -93600,14 +94002,14 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
93600
94002
|
|
|
93601
94003
|
// ../producer/src/services/render/stages/captureHdrHybridLoop.ts
|
|
93602
94004
|
init_src();
|
|
93603
|
-
import { join as
|
|
94005
|
+
import { join as join38 } from "path";
|
|
93604
94006
|
|
|
93605
94007
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
93606
94008
|
import { Worker as Worker2 } from "worker_threads";
|
|
93607
94009
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "url";
|
|
93608
|
-
import { dirname as
|
|
94010
|
+
import { dirname as dirname15, join as join37 } from "path";
|
|
93609
94011
|
import { createRequire as createRequire2 } from "module";
|
|
93610
|
-
import { existsSync as
|
|
94012
|
+
import { existsSync as existsSync26 } from "fs";
|
|
93611
94013
|
import { cpus as cpus3 } from "os";
|
|
93612
94014
|
function resolveWorkerEntry(explicit) {
|
|
93613
94015
|
if (explicit && explicit.length > 0) {
|
|
@@ -93618,10 +94020,10 @@ function resolveWorkerEntry(explicit) {
|
|
|
93618
94020
|
const isTs = override.endsWith(".ts");
|
|
93619
94021
|
return { path: override, isTs };
|
|
93620
94022
|
}
|
|
93621
|
-
const moduleDir =
|
|
93622
|
-
const jsPath =
|
|
93623
|
-
if (
|
|
93624
|
-
const tsPath =
|
|
94023
|
+
const moduleDir = dirname15(fileURLToPath4(import.meta.url));
|
|
94024
|
+
const jsPath = join37(moduleDir, "shaderTransitionWorker.js");
|
|
94025
|
+
if (existsSync26(jsPath)) return { path: jsPath, isTs: false };
|
|
94026
|
+
const tsPath = join37(moduleDir, "shaderTransitionWorker.ts");
|
|
93625
94027
|
return { path: tsPath, isTs: true };
|
|
93626
94028
|
}
|
|
93627
94029
|
function buildExecArgv(entryIsTs) {
|
|
@@ -93991,7 +94393,7 @@ async function runHybridLayeredFrameLoop(input) {
|
|
|
93991
94393
|
);
|
|
93992
94394
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
93993
94395
|
writeFileExclusiveSync(
|
|
93994
|
-
|
|
94396
|
+
join38(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
93995
94397
|
canvas
|
|
93996
94398
|
);
|
|
93997
94399
|
}
|
|
@@ -94177,8 +94579,8 @@ async function runCaptureHdrStage(input) {
|
|
|
94177
94579
|
if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
|
|
94178
94580
|
}
|
|
94179
94581
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
94180
|
-
const debugDumpDir = debugDumpEnabled ?
|
|
94181
|
-
if (debugDumpDir && !
|
|
94582
|
+
const debugDumpDir = debugDumpEnabled ? join39(framesDir, "debug-composite") : null;
|
|
94583
|
+
if (debugDumpDir && !existsSync27(debugDumpDir)) {
|
|
94182
94584
|
mkdirSync15(debugDumpDir, { recursive: true });
|
|
94183
94585
|
}
|
|
94184
94586
|
const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
|
|
@@ -94328,11 +94730,11 @@ async function runCaptureHdrStage(input) {
|
|
|
94328
94730
|
|
|
94329
94731
|
// ../producer/src/services/render/stages/encodeStage.ts
|
|
94330
94732
|
init_src();
|
|
94331
|
-
import { copyFileSync as copyFileSync5, existsSync as
|
|
94332
|
-
import { dirname as
|
|
94733
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync28, mkdirSync as mkdirSync16, readdirSync as readdirSync10, rmSync as rmSync12, statSync as statSync9 } from "fs";
|
|
94734
|
+
import { dirname as dirname16, join as join41 } from "path";
|
|
94333
94735
|
|
|
94334
94736
|
// ../producer/src/services/render/stages/gifEncodeArgs.ts
|
|
94335
|
-
import { join as
|
|
94737
|
+
import { join as join40 } from "path";
|
|
94336
94738
|
function fpsToFfmpegArg2(fps) {
|
|
94337
94739
|
return fps.den === 1 ? String(fps.num) : `${fps.num}/${fps.den}`;
|
|
94338
94740
|
}
|
|
@@ -94344,7 +94746,7 @@ function buildGifPalettegenArgs(input) {
|
|
|
94344
94746
|
"-framerate",
|
|
94345
94747
|
fpsArg,
|
|
94346
94748
|
"-i",
|
|
94347
|
-
|
|
94749
|
+
join40(input.framesDir, input.framePattern),
|
|
94348
94750
|
"-vf",
|
|
94349
94751
|
`fps=${fpsArg},palettegen=stats_mode=diff${transparency}`,
|
|
94350
94752
|
input.palettePath
|
|
@@ -94358,7 +94760,7 @@ function buildGifPaletteuseArgs(input) {
|
|
|
94358
94760
|
"-framerate",
|
|
94359
94761
|
fpsArg,
|
|
94360
94762
|
"-i",
|
|
94361
|
-
|
|
94763
|
+
join40(input.framesDir, input.framePattern),
|
|
94362
94764
|
"-i",
|
|
94363
94765
|
input.palettePath,
|
|
94364
94766
|
"-lavfi",
|
|
@@ -94431,7 +94833,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
94431
94833
|
failureReason: gifResult.failureReason
|
|
94432
94834
|
};
|
|
94433
94835
|
}
|
|
94434
|
-
const fileSize =
|
|
94836
|
+
const fileSize = existsSync28(outputPath) ? statSync9(outputPath).size : 0;
|
|
94435
94837
|
return {
|
|
94436
94838
|
success: true,
|
|
94437
94839
|
outputPath,
|
|
@@ -94440,7 +94842,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
94440
94842
|
fileSize
|
|
94441
94843
|
};
|
|
94442
94844
|
} finally {
|
|
94443
|
-
|
|
94845
|
+
rmSync12(input.palettePath, { force: true });
|
|
94444
94846
|
}
|
|
94445
94847
|
}
|
|
94446
94848
|
async function runEncodeStage(input) {
|
|
@@ -94469,7 +94871,7 @@ async function runEncodeStage(input) {
|
|
|
94469
94871
|
const stage5Start = Date.now();
|
|
94470
94872
|
if (isPngSequence) {
|
|
94471
94873
|
updateJobStatus(job, "encoding", "Writing PNG sequence", 75, onProgress);
|
|
94472
|
-
if (!
|
|
94874
|
+
if (!existsSync28(outputPath)) mkdirSync16(outputPath, { recursive: true });
|
|
94473
94875
|
const captured = readdirSync10(framesDir).filter((name) => name.endsWith(".png")).sort();
|
|
94474
94876
|
if (captured.length === 0) {
|
|
94475
94877
|
throw new Error(
|
|
@@ -94477,11 +94879,11 @@ async function runEncodeStage(input) {
|
|
|
94477
94879
|
);
|
|
94478
94880
|
}
|
|
94479
94881
|
captured.forEach((name, i) => {
|
|
94480
|
-
const dst =
|
|
94481
|
-
copyFileSync5(
|
|
94882
|
+
const dst = join41(outputPath, formatExportFrameName(i, "png"));
|
|
94883
|
+
copyFileSync5(join41(framesDir, name), dst);
|
|
94482
94884
|
});
|
|
94483
|
-
if (hasAudio && audioOutputPath &&
|
|
94484
|
-
copyFileSync5(audioOutputPath,
|
|
94885
|
+
if (hasAudio && audioOutputPath && existsSync28(audioOutputPath)) {
|
|
94886
|
+
copyFileSync5(audioOutputPath, join41(outputPath, MIXED_AUDIO_FILENAME));
|
|
94485
94887
|
log.info(
|
|
94486
94888
|
`[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
|
|
94487
94889
|
);
|
|
@@ -94500,7 +94902,7 @@ async function runEncodeStage(input) {
|
|
|
94500
94902
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
94501
94903
|
fps: job.config.fps,
|
|
94502
94904
|
loop,
|
|
94503
|
-
palettePath:
|
|
94905
|
+
palettePath: join41(dirname16(videoOnlyPath), "gif-palette.png"),
|
|
94504
94906
|
preserveAlpha: needsAlpha,
|
|
94505
94907
|
signal: abortSignal,
|
|
94506
94908
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -94566,8 +94968,8 @@ import { extname as extname6 } from "path";
|
|
|
94566
94968
|
init_src();
|
|
94567
94969
|
init_dist2();
|
|
94568
94970
|
import { spawn as spawn5 } from "child_process";
|
|
94569
|
-
import { mkdtempSync as
|
|
94570
|
-
import { dirname as
|
|
94971
|
+
import { mkdtempSync as mkdtempSync10, renameSync as renameSync6, rmSync as rmSync13 } from "fs";
|
|
94972
|
+
import { dirname as dirname17, join as join42 } from "path";
|
|
94571
94973
|
var AUDIO_DURATION_TOLERANCE_SECONDS = 1e-3;
|
|
94572
94974
|
var AAC_DELIVERY_TRUE_PEAK_DBFS = -1;
|
|
94573
94975
|
var MAX_TRUE_PEAK_CORRECTION_PASSES = 3;
|
|
@@ -94734,7 +95136,7 @@ async function padOrTrimAudioToVideoFrameCount(input) {
|
|
|
94734
95136
|
error: `audioPadTrim: failed to materialize ${plan2.operation}: ${err instanceof Error ? err.message : String(err)}`
|
|
94735
95137
|
};
|
|
94736
95138
|
} finally {
|
|
94737
|
-
for (const path of plan2.cleanupPaths)
|
|
95139
|
+
for (const path of plan2.cleanupPaths) rmSync13(path, { force: true });
|
|
94738
95140
|
}
|
|
94739
95141
|
if (probeTruePeak) {
|
|
94740
95142
|
const correction = await enforceAacTruePeak({
|
|
@@ -94767,8 +95169,8 @@ async function padOrTrimAudioToVideoFrameCount(input) {
|
|
|
94767
95169
|
async function enforceAacTruePeak(input) {
|
|
94768
95170
|
let scratchDir;
|
|
94769
95171
|
try {
|
|
94770
|
-
scratchDir =
|
|
94771
|
-
const correctedPath =
|
|
95172
|
+
scratchDir = mkdtempSync10(join42(dirname17(input.audioPath), ".true-peak-"));
|
|
95173
|
+
const correctedPath = join42(scratchDir, "audio.m4a");
|
|
94772
95174
|
let attenuationDb = 0;
|
|
94773
95175
|
let measuredPath = input.audioPath;
|
|
94774
95176
|
for (let pass = 0; pass <= MAX_TRUE_PEAK_CORRECTION_PASSES; pass += 1) {
|
|
@@ -94815,7 +95217,7 @@ async function enforceAacTruePeak(input) {
|
|
|
94815
95217
|
)}`
|
|
94816
95218
|
};
|
|
94817
95219
|
} finally {
|
|
94818
|
-
if (scratchDir)
|
|
95220
|
+
if (scratchDir) rmSync13(scratchDir, { recursive: true, force: true });
|
|
94819
95221
|
}
|
|
94820
95222
|
}
|
|
94821
95223
|
function failResult(outputPath, target, source, error) {
|
|
@@ -95021,7 +95423,7 @@ function sampleDirectoryBytes(dir) {
|
|
|
95021
95423
|
continue;
|
|
95022
95424
|
}
|
|
95023
95425
|
for (const name of entries2) {
|
|
95024
|
-
const full =
|
|
95426
|
+
const full = join43(current2, name);
|
|
95025
95427
|
try {
|
|
95026
95428
|
const st = statSync10(full);
|
|
95027
95429
|
if (st.isDirectory()) {
|
|
@@ -95170,8 +95572,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
95170
95572
|
const ranges = [];
|
|
95171
95573
|
let rangeStart = null;
|
|
95172
95574
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
95173
|
-
const framePath =
|
|
95174
|
-
const missing = !
|
|
95575
|
+
const framePath = join43(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
95576
|
+
const missing = !existsSync29(framePath) || statSync10(framePath).size <= 8;
|
|
95175
95577
|
if (missing && rangeStart === null) {
|
|
95176
95578
|
rangeStart = frameIndex;
|
|
95177
95579
|
} else if (!missing && rangeStart !== null) {
|
|
@@ -95193,7 +95595,7 @@ function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, ran
|
|
|
95193
95595
|
workerId,
|
|
95194
95596
|
startFrame: rangeStart + range.startFrame,
|
|
95195
95597
|
endFrame: rangeStart + range.endFrame,
|
|
95196
|
-
outputDir:
|
|
95598
|
+
outputDir: join43(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`),
|
|
95197
95599
|
outputFrameOffset: rangeStart
|
|
95198
95600
|
}));
|
|
95199
95601
|
batches.push(batch);
|
|
@@ -95216,8 +95618,8 @@ function getNextRetryWorkerCount(currentWorkers) {
|
|
|
95216
95618
|
return Math.max(1, Math.floor(currentWorkers / 2));
|
|
95217
95619
|
}
|
|
95218
95620
|
function resolveRenderWorkDirPrefix(outputPath, jobId, platform3 = process.platform, systemTempDir = tmpdir7()) {
|
|
95219
|
-
if (platform3 === "win32") return
|
|
95220
|
-
return
|
|
95621
|
+
if (platform3 === "win32") return join43(systemTempDir, "hf-render-");
|
|
95622
|
+
return join43(dirname18(outputPath), `work-${jobId}-`);
|
|
95221
95623
|
}
|
|
95222
95624
|
var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
|
|
95223
95625
|
function captureAttemptMadeProgress(attemptTargetFrameCount, remainingFrameCount) {
|
|
@@ -95246,8 +95648,8 @@ The composition is too large for the available memory. To reduce memory pressure
|
|
|
95246
95648
|
function countCapturedFrames(totalFrames, framesDir, frameExt) {
|
|
95247
95649
|
let captured = 0;
|
|
95248
95650
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
95249
|
-
const framePath =
|
|
95250
|
-
if (
|
|
95651
|
+
const framePath = join43(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
95652
|
+
if (existsSync29(framePath)) captured++;
|
|
95251
95653
|
}
|
|
95252
95654
|
return captured;
|
|
95253
95655
|
}
|
|
@@ -95271,7 +95673,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
95271
95673
|
reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
|
|
95272
95674
|
});
|
|
95273
95675
|
pendingTransientRetry = false;
|
|
95274
|
-
const attemptWorkDir =
|
|
95676
|
+
const attemptWorkDir = join43(options.workDir, `capture-attempt-${attempt}`);
|
|
95275
95677
|
const batches = missingRanges ? buildMissingFrameRetryBatches(
|
|
95276
95678
|
missingRanges,
|
|
95277
95679
|
currentWorkers,
|
|
@@ -95608,15 +96010,15 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
95608
96010
|
};
|
|
95609
96011
|
}
|
|
95610
96012
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal) {
|
|
95611
|
-
const moduleDir =
|
|
96013
|
+
const moduleDir = dirname18(fileURLToPath5(import.meta.url));
|
|
95612
96014
|
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve13(process.env.PRODUCER_RENDERS_DIR, "..") : resolve13(moduleDir, "../..");
|
|
95613
|
-
const debugDir =
|
|
95614
|
-
const outputDir =
|
|
95615
|
-
if (!
|
|
95616
|
-
const workDir = job.config.debug ?
|
|
96015
|
+
const debugDir = join43(producerRoot, ".debug");
|
|
96016
|
+
const outputDir = dirname18(outputPath);
|
|
96017
|
+
if (!existsSync29(outputDir)) mkdirSync17(outputDir, { recursive: true });
|
|
96018
|
+
const workDir = job.config.debug ? join43(debugDir, job.id) : mkdtempSync11(resolveRenderWorkDirPrefix(outputPath, job.id));
|
|
95617
96019
|
const pipelineStart = Date.now();
|
|
95618
96020
|
const baseLog = job.config.logger ?? defaultLogger;
|
|
95619
|
-
const logPath = job.config.debug ?
|
|
96021
|
+
const logPath = job.config.debug ? join43(workDir, "render.log") : null;
|
|
95620
96022
|
const execution = new RenderExecutionContext({
|
|
95621
96023
|
request: { renderJobId: job.id, projectDir, outputPath },
|
|
95622
96024
|
logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
|
|
@@ -95630,7 +96032,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
95630
96032
|
log.info("KEEP_TEMP=1 \u2014 leaving workDir on disk for inspection", { workDir });
|
|
95631
96033
|
return;
|
|
95632
96034
|
}
|
|
95633
|
-
|
|
96035
|
+
rmSync14(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
95634
96036
|
});
|
|
95635
96037
|
try {
|
|
95636
96038
|
await executeRenderPipeline({
|
|
@@ -95664,7 +96066,7 @@ async function executeRenderPipeline(input) {
|
|
|
95664
96066
|
imageDecodeFailures: 0
|
|
95665
96067
|
};
|
|
95666
96068
|
let hdrPerf;
|
|
95667
|
-
const perfOutputPath =
|
|
96069
|
+
const perfOutputPath = join43(workDir, "perf-summary.json");
|
|
95668
96070
|
const cfg = { ...job.config.producerConfig ?? resolveConfig() };
|
|
95669
96071
|
const observability = new RenderObservabilityRecorder({
|
|
95670
96072
|
pipelineStartMs: pipelineStart,
|
|
@@ -95727,7 +96129,7 @@ async function executeRenderPipeline(input) {
|
|
|
95727
96129
|
job.startedAt = /* @__PURE__ */ new Date();
|
|
95728
96130
|
assertNotAborted();
|
|
95729
96131
|
assertConfiguredFfmpegBinariesExist();
|
|
95730
|
-
if (!
|
|
96132
|
+
if (!existsSync29(workDir)) mkdirSync17(workDir, { recursive: true });
|
|
95731
96133
|
if (job.config.debug) {
|
|
95732
96134
|
log.info("[Render] Debug artifacts enabled", { workDir, logPath });
|
|
95733
96135
|
}
|
|
@@ -95756,16 +96158,16 @@ async function executeRenderPipeline(input) {
|
|
|
95756
96158
|
requestedWorkers: job.config.workers ?? "auto"
|
|
95757
96159
|
});
|
|
95758
96160
|
const entryFile = job.config.entryFile || "index.html";
|
|
95759
|
-
let htmlPath =
|
|
95760
|
-
if (!
|
|
96161
|
+
let htmlPath = join43(projectDir, entryFile);
|
|
96162
|
+
if (!existsSync29(htmlPath)) {
|
|
95761
96163
|
throw new Error(`Entry file not found: ${htmlPath}`);
|
|
95762
96164
|
}
|
|
95763
96165
|
assertNotAborted();
|
|
95764
96166
|
const rawEntry = readFileSync12(htmlPath, "utf-8");
|
|
95765
96167
|
if (entryFile !== "index.html" && rawEntry.trimStart().startsWith("<template")) {
|
|
95766
|
-
const wrapperPath =
|
|
95767
|
-
const projectIndexPath =
|
|
95768
|
-
if (!
|
|
96168
|
+
const wrapperPath = join43(workDir, "standalone-entry.html");
|
|
96169
|
+
const projectIndexPath = join43(projectDir, "index.html");
|
|
96170
|
+
if (!existsSync29(projectIndexPath)) {
|
|
95769
96171
|
throw new Error(
|
|
95770
96172
|
`Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
|
|
95771
96173
|
);
|
|
@@ -95919,7 +96321,7 @@ async function executeRenderPipeline(input) {
|
|
|
95919
96321
|
beginFrameStalled: probeResult.beginFrameStalled
|
|
95920
96322
|
});
|
|
95921
96323
|
updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress);
|
|
95922
|
-
const compiledDir =
|
|
96324
|
+
const compiledDir = join43(workDir, "compiled");
|
|
95923
96325
|
const extractResult = await observeRenderStage(
|
|
95924
96326
|
observability,
|
|
95925
96327
|
"video_extract",
|
|
@@ -96039,7 +96441,7 @@ async function executeRenderPipeline(input) {
|
|
|
96039
96441
|
try {
|
|
96040
96442
|
fileServer = await createFileServer2({
|
|
96041
96443
|
projectDir,
|
|
96042
|
-
compiledDir:
|
|
96444
|
+
compiledDir: join43(workDir, "compiled"),
|
|
96043
96445
|
port: 0,
|
|
96044
96446
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
96045
96447
|
fps: job.config.fps
|
|
@@ -96057,8 +96459,8 @@ async function executeRenderPipeline(input) {
|
|
|
96057
96459
|
if (!activeFileServer) {
|
|
96058
96460
|
throw new Error("File server failed to initialize before frame capture");
|
|
96059
96461
|
}
|
|
96060
|
-
const framesDir =
|
|
96061
|
-
if (!
|
|
96462
|
+
const framesDir = join43(workDir, "captured-frames");
|
|
96463
|
+
if (!existsSync29(framesDir)) mkdirSync17(framesDir, { recursive: true });
|
|
96062
96464
|
const resolvedBrowserGpuMode = await resolveBrowserGpuMode(cfg.browserGpuMode, {
|
|
96063
96465
|
chromePath: resolveHeadlessShellPath(cfg),
|
|
96064
96466
|
browserTimeout: cfg.browserTimeout
|
|
@@ -96382,7 +96784,7 @@ async function executeRenderPipeline(input) {
|
|
|
96382
96784
|
gif: ".gif"
|
|
96383
96785
|
};
|
|
96384
96786
|
const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
|
|
96385
|
-
const videoOnlyPath =
|
|
96787
|
+
const videoOnlyPath = join43(workDir, `video-only${videoExt}`);
|
|
96386
96788
|
const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
|
|
96387
96789
|
if (usePageSideCompositingForTransitions) {
|
|
96388
96790
|
activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
|
|
@@ -96790,7 +97192,7 @@ async function executeRenderPipeline(input) {
|
|
|
96790
97192
|
"capture_disk",
|
|
96791
97193
|
"drawElement self-verify failed; retrying with forceScreenshot"
|
|
96792
97194
|
);
|
|
96793
|
-
|
|
97195
|
+
rmSync14(framesDir, { recursive: true, force: true });
|
|
96794
97196
|
mkdirSync17(framesDir, { recursive: true });
|
|
96795
97197
|
resetCaptureAttemptProgress(job);
|
|
96796
97198
|
dedupPerfs.length = 0;
|
|
@@ -96909,7 +97311,7 @@ async function executeRenderPipeline(input) {
|
|
|
96909
97311
|
} : void 0
|
|
96910
97312
|
);
|
|
96911
97313
|
const totalElapsed = Date.now() - pipelineStart;
|
|
96912
|
-
const tmpPeakBytes =
|
|
97314
|
+
const tmpPeakBytes = existsSync29(workDir) ? sampleDirectoryBytes(workDir) : 0;
|
|
96913
97315
|
recordTransientRetryObservability();
|
|
96914
97316
|
observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
|
|
96915
97317
|
const observabilitySummary = observability.summary({
|
|
@@ -96974,8 +97376,8 @@ async function executeRenderPipeline(input) {
|
|
|
96974
97376
|
}
|
|
96975
97377
|
}
|
|
96976
97378
|
if (job.config.debug) {
|
|
96977
|
-
if (!isPngSequence &&
|
|
96978
|
-
const debugOutput =
|
|
97379
|
+
if (!isPngSequence && existsSync29(stagedOutputPath)) {
|
|
97380
|
+
const debugOutput = join43(workDir, `output${videoExt}`);
|
|
96979
97381
|
copyFileSync6(stagedOutputPath, debugOutput);
|
|
96980
97382
|
}
|
|
96981
97383
|
}
|
|
@@ -97310,15 +97712,15 @@ init_src();
|
|
|
97310
97712
|
|
|
97311
97713
|
// ../producer/src/server.ts
|
|
97312
97714
|
import {
|
|
97313
|
-
existsSync as
|
|
97715
|
+
existsSync as existsSync32,
|
|
97314
97716
|
mkdirSync as mkdirSync18,
|
|
97315
97717
|
statSync as statSync12,
|
|
97316
|
-
mkdtempSync as
|
|
97718
|
+
mkdtempSync as mkdtempSync12,
|
|
97317
97719
|
writeFileSync as writeFileSync11,
|
|
97318
|
-
rmSync as
|
|
97720
|
+
rmSync as rmSync15,
|
|
97319
97721
|
createReadStream as createReadStream5
|
|
97320
97722
|
} from "fs";
|
|
97321
|
-
import { resolve as resolve15, dirname as
|
|
97723
|
+
import { resolve as resolve15, dirname as dirname20, join as join46 } from "path";
|
|
97322
97724
|
import { tmpdir as tmpdir8 } from "os";
|
|
97323
97725
|
import { parseArgs } from "util";
|
|
97324
97726
|
import crypto from "crypto";
|
|
@@ -97328,8 +97730,16 @@ import { serve as serve3 } from "@hono/node-server";
|
|
|
97328
97730
|
|
|
97329
97731
|
// ../producer/src/services/hyperframeLint.ts
|
|
97330
97732
|
init_dist3();
|
|
97331
|
-
import {
|
|
97332
|
-
|
|
97733
|
+
import {
|
|
97734
|
+
existsSync as existsSync30,
|
|
97735
|
+
readFileSync as readFileSync13,
|
|
97736
|
+
statSync as statSync11,
|
|
97737
|
+
openSync as openSync7,
|
|
97738
|
+
fstatSync as fstatSync5,
|
|
97739
|
+
closeSync as closeSync8,
|
|
97740
|
+
constants as constants5
|
|
97741
|
+
} from "fs";
|
|
97742
|
+
import { resolve as resolve14, join as join44, relative as relative3, isAbsolute as isAbsolute4, sep as sep4 } from "path";
|
|
97333
97743
|
function isStringRecord(value) {
|
|
97334
97744
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
97335
97745
|
return false;
|
|
@@ -97355,9 +97765,26 @@ function pickEntryFile(files, preferredEntryFile) {
|
|
|
97355
97765
|
}
|
|
97356
97766
|
return null;
|
|
97357
97767
|
}
|
|
97768
|
+
function readEntryHtml(filePath) {
|
|
97769
|
+
let fd;
|
|
97770
|
+
try {
|
|
97771
|
+
fd = openSync7(filePath, constants5.O_RDONLY | constants5.O_NONBLOCK);
|
|
97772
|
+
} catch (error) {
|
|
97773
|
+
if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
|
|
97774
|
+
return null;
|
|
97775
|
+
if (!statSync11(filePath, { throwIfNoEntry: false })?.isFile()) return null;
|
|
97776
|
+
throw error;
|
|
97777
|
+
}
|
|
97778
|
+
try {
|
|
97779
|
+
if (!fstatSync5(fd).isFile()) return null;
|
|
97780
|
+
return readFileSync13(fd, "utf-8");
|
|
97781
|
+
} finally {
|
|
97782
|
+
closeSync8(fd);
|
|
97783
|
+
}
|
|
97784
|
+
}
|
|
97358
97785
|
function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
97359
97786
|
const absProjectDir = resolve14(projectDir);
|
|
97360
|
-
if (!
|
|
97787
|
+
if (!existsSync30(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
|
|
97361
97788
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
97362
97789
|
}
|
|
97363
97790
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
@@ -97365,19 +97792,21 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
|
97365
97792
|
);
|
|
97366
97793
|
for (const entryFile of entryCandidates) {
|
|
97367
97794
|
const absoluteEntryPath = resolve14(absProjectDir, entryFile);
|
|
97368
|
-
|
|
97795
|
+
const entryRelativePath = relative3(absProjectDir, absoluteEntryPath);
|
|
97796
|
+
if (entryRelativePath === ".." || entryRelativePath.startsWith(`..${sep4}`) || isAbsolute4(entryRelativePath)) {
|
|
97369
97797
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
97370
97798
|
}
|
|
97371
|
-
|
|
97799
|
+
const html = readEntryHtml(absoluteEntryPath);
|
|
97800
|
+
if (html !== null) {
|
|
97372
97801
|
return {
|
|
97373
97802
|
entryFile,
|
|
97374
|
-
html
|
|
97803
|
+
html,
|
|
97375
97804
|
source: "projectDir"
|
|
97376
97805
|
};
|
|
97377
97806
|
}
|
|
97378
97807
|
}
|
|
97379
97808
|
return {
|
|
97380
|
-
error: `No HTML entry file found in project directory: ${
|
|
97809
|
+
error: `No HTML entry file found in project directory: ${join44(absProjectDir, preferredEntryFile || "index.html")}`
|
|
97381
97810
|
};
|
|
97382
97811
|
}
|
|
97383
97812
|
function prepareHyperframeLintBody(body) {
|
|
@@ -97420,8 +97849,8 @@ async function runHyperframeLint(prepared) {
|
|
|
97420
97849
|
// ../producer/src/services/healthWorker.ts
|
|
97421
97850
|
import { Worker as Worker3 } from "worker_threads";
|
|
97422
97851
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
97423
|
-
import { dirname as
|
|
97424
|
-
import { existsSync as
|
|
97852
|
+
import { dirname as dirname19, join as join45 } from "path";
|
|
97853
|
+
import { existsSync as existsSync31 } from "fs";
|
|
97425
97854
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
97426
97855
|
async function startHealthWorker(options = {}) {
|
|
97427
97856
|
const log = options.logger ?? defaultLogger2();
|
|
@@ -97495,10 +97924,10 @@ function defaultLogger2() {
|
|
|
97495
97924
|
};
|
|
97496
97925
|
}
|
|
97497
97926
|
function resolveWorkerEntry2() {
|
|
97498
|
-
const here =
|
|
97499
|
-
const candidates = [
|
|
97927
|
+
const here = dirname19(fileURLToPath6(import.meta.url));
|
|
97928
|
+
const candidates = [join45(here, "healthWorkerThread.js"), join45(here, "healthWorkerThread.ts")];
|
|
97500
97929
|
for (const candidate of candidates) {
|
|
97501
|
-
if (
|
|
97930
|
+
if (existsSync31(candidate)) return candidate;
|
|
97502
97931
|
}
|
|
97503
97932
|
return void 0;
|
|
97504
97933
|
}
|
|
@@ -97633,8 +98062,8 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
97633
98062
|
function resolvePreparedRenderOutput(prepared, rendersDir, log) {
|
|
97634
98063
|
const { input, cleanupProjectDir } = prepared;
|
|
97635
98064
|
const absoluteOutputPath = resolveOutputPath(input.projectDir, input.outputPath, rendersDir, log);
|
|
97636
|
-
const outputDir =
|
|
97637
|
-
if (!
|
|
98065
|
+
const outputDir = dirname20(absoluteOutputPath);
|
|
98066
|
+
if (!existsSync32(outputDir)) mkdirSync18(outputDir, { recursive: true });
|
|
97638
98067
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
97639
98068
|
}
|
|
97640
98069
|
function validateRenderOverrides(body) {
|
|
@@ -97672,11 +98101,11 @@ function prepareProjectDirectory(projectDir, options) {
|
|
|
97672
98101
|
const candidate = nonEmptyString2(projectDir);
|
|
97673
98102
|
if (!candidate) return null;
|
|
97674
98103
|
const absProjectDir = resolve15(candidate);
|
|
97675
|
-
if (!
|
|
98104
|
+
if (!existsSync32(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
|
|
97676
98105
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
97677
98106
|
}
|
|
97678
98107
|
const entry = options.entryFile || "index.html";
|
|
97679
|
-
if (!
|
|
98108
|
+
if (!existsSync32(resolve15(absProjectDir, entry))) {
|
|
97680
98109
|
return { error: `Entry file "${entry}" not found in project directory: ${absProjectDir}` };
|
|
97681
98110
|
}
|
|
97682
98111
|
return { prepared: { input: { projectDir: absProjectDir, ...options } } };
|
|
@@ -97701,8 +98130,8 @@ async function resolveInlineRenderHtml(body) {
|
|
|
97701
98130
|
}
|
|
97702
98131
|
function materializeInlineProject(html, options) {
|
|
97703
98132
|
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir8();
|
|
97704
|
-
const tempProjectDir =
|
|
97705
|
-
writeFileSync11(
|
|
98133
|
+
const tempProjectDir = mkdtempSync12(join46(tempRoot, "producer-project-"));
|
|
98134
|
+
writeFileSync11(join46(tempProjectDir, "index.html"), html, "utf-8");
|
|
97706
98135
|
return {
|
|
97707
98136
|
prepared: {
|
|
97708
98137
|
input: { projectDir: tempProjectDir, ...options },
|
|
@@ -97759,7 +98188,7 @@ function createArtifactStore(ttlMs) {
|
|
|
97759
98188
|
function cleanupTempDir(dir, log) {
|
|
97760
98189
|
if (!dir) return;
|
|
97761
98190
|
try {
|
|
97762
|
-
|
|
98191
|
+
rmSync15(dir, { recursive: true, force: true });
|
|
97763
98192
|
} catch (error) {
|
|
97764
98193
|
log.warn("Failed to cleanup temp project dir", {
|
|
97765
98194
|
cleanupProjectDir: dir,
|
|
@@ -97768,7 +98197,7 @@ function cleanupTempDir(dir, log) {
|
|
|
97768
98197
|
}
|
|
97769
98198
|
}
|
|
97770
98199
|
function outputFileSize(path) {
|
|
97771
|
-
return
|
|
98200
|
+
return existsSync32(path) ? statSync12(path).size : 0;
|
|
97772
98201
|
}
|
|
97773
98202
|
function createBlockingProgressReporter(log, requestId) {
|
|
97774
98203
|
let lastLoggedPct = -10;
|
|
@@ -98064,7 +98493,7 @@ function createRenderHandlers(options = {}) {
|
|
|
98064
98493
|
if (!artifact) {
|
|
98065
98494
|
return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
|
|
98066
98495
|
}
|
|
98067
|
-
if (!
|
|
98496
|
+
if (!existsSync32(artifact.path)) {
|
|
98068
98497
|
store.delete(token);
|
|
98069
98498
|
return c.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
98070
98499
|
}
|
|
@@ -98152,12 +98581,12 @@ init_src();
|
|
|
98152
98581
|
// ../producer/src/services/distributed/plan.ts
|
|
98153
98582
|
init_dist2();
|
|
98154
98583
|
init_src();
|
|
98155
|
-
import { cpSync as cpSync2, existsSync as
|
|
98156
|
-
import { join as
|
|
98584
|
+
import { cpSync as cpSync2, existsSync as existsSync35, mkdirSync as mkdirSync20, renameSync as renameSync7, rmSync as rmSync16, writeFileSync as writeFileSync13 } from "fs";
|
|
98585
|
+
import { join as join50, relative as relative6, sep as sep5 } from "path";
|
|
98157
98586
|
|
|
98158
98587
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
98159
|
-
import { existsSync as
|
|
98160
|
-
import { join as
|
|
98588
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync19, readFileSync as readFileSync14, readdirSync as readdirSync12, writeFileSync as writeFileSync12 } from "fs";
|
|
98589
|
+
import { join as join47, relative as relative4, resolve as resolve16 } from "path";
|
|
98161
98590
|
|
|
98162
98591
|
// ../producer/src/services/distributed/planProtocol.ts
|
|
98163
98592
|
var PLAN_SCHEMA_VERSION = 1;
|
|
@@ -98199,17 +98628,17 @@ var FIELD_DELIMITER = Buffer.from([0]);
|
|
|
98199
98628
|
// ../producer/src/services/distributed/shared.ts
|
|
98200
98629
|
init_src();
|
|
98201
98630
|
import { execFile as execFileCallback } from "child_process";
|
|
98202
|
-
import { dirname as
|
|
98203
|
-
import { existsSync as
|
|
98631
|
+
import { dirname as dirname21, join as join48 } from "path";
|
|
98632
|
+
import { existsSync as existsSync34, readFileSync as readFileSync15 } from "fs";
|
|
98204
98633
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
98205
|
-
import { promisify as
|
|
98634
|
+
import { promisify as promisify4 } from "util";
|
|
98206
98635
|
var PLAN_AUDIO_RELATIVE_PATH = MIXED_AUDIO_FILENAME;
|
|
98207
|
-
var execFile3 =
|
|
98636
|
+
var execFile3 = promisify4(execFileCallback);
|
|
98208
98637
|
|
|
98209
98638
|
// ../producer/src/services/distributed/planSize.ts
|
|
98210
98639
|
import { createHash as createHash10 } from "crypto";
|
|
98211
98640
|
import { lstatSync as lstatSync5, readdirSync as readdirSync13 } from "fs";
|
|
98212
|
-
import { extname as extname7, join as
|
|
98641
|
+
import { extname as extname7, join as join49, relative as relative5 } from "path";
|
|
98213
98642
|
var PLAN_ROOT_CATEGORY = {
|
|
98214
98643
|
compiled: "compiled",
|
|
98215
98644
|
[PLAN_AUDIO_RELATIVE_PATH]: "audio",
|
|
@@ -98221,81 +98650,81 @@ var PLAN_ROOT_CATEGORY = {
|
|
|
98221
98650
|
var PLAN_DIR_SIZE_LIMIT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
98222
98651
|
var FREEZE_OWNED_PLAN_FILES = [
|
|
98223
98652
|
"plan.json",
|
|
98224
|
-
|
|
98225
|
-
|
|
98226
|
-
|
|
98653
|
+
join50("meta", "composition.json"),
|
|
98654
|
+
join50("meta", "encoder.json"),
|
|
98655
|
+
join50("meta", "chunks.json")
|
|
98227
98656
|
];
|
|
98228
98657
|
|
|
98229
98658
|
// ../producer/src/services/distributed/planV2.ts
|
|
98230
98659
|
init_src();
|
|
98231
98660
|
import {
|
|
98232
|
-
closeSync as
|
|
98661
|
+
closeSync as closeSync9,
|
|
98233
98662
|
copyFileSync as copyFileSync8,
|
|
98234
|
-
existsSync as
|
|
98663
|
+
existsSync as existsSync37,
|
|
98235
98664
|
lstatSync as lstatSync6,
|
|
98236
98665
|
mkdirSync as mkdirSync22,
|
|
98237
|
-
mkdtempSync as
|
|
98238
|
-
openSync as
|
|
98666
|
+
mkdtempSync as mkdtempSync14,
|
|
98667
|
+
openSync as openSync8,
|
|
98239
98668
|
readFileSync as readFileSync16,
|
|
98240
98669
|
readSync as readSync3,
|
|
98241
98670
|
readdirSync as readdirSync14,
|
|
98242
98671
|
renameSync as renameSync9,
|
|
98243
|
-
rmSync as
|
|
98672
|
+
rmSync as rmSync18,
|
|
98244
98673
|
statSync as statSync14,
|
|
98245
98674
|
writeFileSync as writeFileSync15
|
|
98246
98675
|
} from "fs";
|
|
98247
98676
|
import { createHash as createHash11 } from "crypto";
|
|
98248
98677
|
import { tmpdir as tmpdir9 } from "os";
|
|
98249
|
-
import { dirname as
|
|
98678
|
+
import { dirname as dirname23, isAbsolute as isAbsolute5, join as join53, relative as relative7, resolve as resolve17, sep as sep6 } from "path";
|
|
98250
98679
|
|
|
98251
98680
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
98252
98681
|
import {
|
|
98253
98682
|
copyFileSync as copyFileSync7,
|
|
98254
|
-
existsSync as
|
|
98683
|
+
existsSync as existsSync36,
|
|
98255
98684
|
linkSync as linkSync3,
|
|
98256
98685
|
mkdirSync as mkdirSync21,
|
|
98257
|
-
mkdtempSync as
|
|
98686
|
+
mkdtempSync as mkdtempSync13,
|
|
98258
98687
|
renameSync as renameSync8,
|
|
98259
|
-
rmSync as
|
|
98688
|
+
rmSync as rmSync17,
|
|
98260
98689
|
statSync as statSync13,
|
|
98261
98690
|
writeFileSync as writeFileSync14
|
|
98262
98691
|
} from "fs";
|
|
98263
|
-
import { dirname as
|
|
98692
|
+
import { dirname as dirname22, join as join52 } from "path";
|
|
98264
98693
|
|
|
98265
98694
|
// ../producer/src/services/distributed/planV2Layout.ts
|
|
98266
|
-
import { join as
|
|
98695
|
+
import { join as join51 } from "path";
|
|
98267
98696
|
|
|
98268
98697
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
98269
|
-
import { mkdtempSync as
|
|
98698
|
+
import { mkdtempSync as mkdtempSync15, rmSync as rmSync21 } from "fs";
|
|
98270
98699
|
import { tmpdir as tmpdir10 } from "os";
|
|
98271
|
-
import { join as
|
|
98700
|
+
import { join as join56 } from "path";
|
|
98272
98701
|
|
|
98273
98702
|
// ../producer/src/services/distributed/assemble.ts
|
|
98274
98703
|
init_src();
|
|
98275
98704
|
init_dist2();
|
|
98276
98705
|
import {
|
|
98277
98706
|
cpSync as cpSync3,
|
|
98278
|
-
existsSync as
|
|
98707
|
+
existsSync as existsSync38,
|
|
98279
98708
|
mkdirSync as mkdirSync23,
|
|
98280
98709
|
readFileSync as readFileSync17,
|
|
98281
98710
|
readdirSync as readdirSync15,
|
|
98282
|
-
rmSync as
|
|
98711
|
+
rmSync as rmSync19,
|
|
98283
98712
|
statSync as statSync15,
|
|
98284
98713
|
writeFileSync as writeFileSync16
|
|
98285
98714
|
} from "fs";
|
|
98286
|
-
import { dirname as
|
|
98715
|
+
import { dirname as dirname24, join as join54 } from "path";
|
|
98287
98716
|
|
|
98288
98717
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
98289
98718
|
init_src();
|
|
98290
|
-
import { randomBytes
|
|
98291
|
-
import { existsSync as
|
|
98292
|
-
import { extname as extname8, join as
|
|
98719
|
+
import { randomBytes } from "crypto";
|
|
98720
|
+
import { existsSync as existsSync39, mkdirSync as mkdirSync24, readFileSync as readFileSync18, readdirSync as readdirSync16, rmSync as rmSync20, writeFileSync as writeFileSync17 } from "fs";
|
|
98721
|
+
import { extname as extname8, join as join55 } from "path";
|
|
98293
98722
|
init_src();
|
|
98294
98723
|
|
|
98295
98724
|
// ../producer/src/services/distributed/projectHash.ts
|
|
98296
98725
|
import { readdirSync as readdirSync17, readFileSync as readFileSync19 } from "fs";
|
|
98297
98726
|
import { createHash as createHash12 } from "crypto";
|
|
98298
|
-
import { join as
|
|
98727
|
+
import { join as join57, relative as relative8 } from "path";
|
|
98299
98728
|
|
|
98300
98729
|
// src/fontLocalize.ts
|
|
98301
98730
|
function safeVersion(version2) {
|
|
@@ -98336,8 +98765,8 @@ async function runFontLocalize(io, localize) {
|
|
|
98336
98765
|
}
|
|
98337
98766
|
|
|
98338
98767
|
// src/version.ts
|
|
98339
|
-
var VERSION = true ? "0.8.
|
|
98340
|
-
var PRODUCER_VERSION = true ? "0.8.
|
|
98768
|
+
var VERSION = true ? "0.8.31" : "0.0.0-dev";
|
|
98769
|
+
var PRODUCER_VERSION = true ? "0.8.31" : "0.0.0-dev";
|
|
98341
98770
|
|
|
98342
98771
|
// src/fontLocalizeCli.ts
|
|
98343
98772
|
async function readStdin() {
|