hyperframes 0.7.51 → 0.7.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +757 -447
- package/dist/studio/assets/{index-3b1A9DtP.js → index-B27HFK8R.js} +1 -1
- package/dist/studio/assets/{index-ZwnuKogK.js → index-DKcziwpY.js} +1 -1
- package/dist/studio/assets/{index-BiJK2Lfo.js → index-v3DXednk.js} +130 -130
- package/dist/studio/index.html +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ var VERSION;
|
|
|
50
50
|
var init_version = __esm({
|
|
51
51
|
"src/version.ts"() {
|
|
52
52
|
"use strict";
|
|
53
|
-
VERSION = true ? "0.7.
|
|
53
|
+
VERSION = true ? "0.7.52" : "0.0.0-dev";
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -4944,7 +4944,7 @@ var require_util = __commonJS({
|
|
|
4944
4944
|
exports.isAbsolute = function(aPath) {
|
|
4945
4945
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
4946
4946
|
};
|
|
4947
|
-
function
|
|
4947
|
+
function relative21(aRoot, aPath) {
|
|
4948
4948
|
if (aRoot === "") {
|
|
4949
4949
|
aRoot = ".";
|
|
4950
4950
|
}
|
|
@@ -4963,7 +4963,7 @@ var require_util = __commonJS({
|
|
|
4963
4963
|
}
|
|
4964
4964
|
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
4965
4965
|
}
|
|
4966
|
-
exports.relative =
|
|
4966
|
+
exports.relative = relative21;
|
|
4967
4967
|
var supportsNullProto = (function() {
|
|
4968
4968
|
var obj = /* @__PURE__ */ Object.create(null);
|
|
4969
4969
|
return !("__proto__" in obj);
|
|
@@ -15839,9 +15839,9 @@ var require_printer = __commonJS({
|
|
|
15839
15839
|
}
|
|
15840
15840
|
case "ForStatement": {
|
|
15841
15841
|
var init = path2.call(print2, "init");
|
|
15842
|
-
var
|
|
15842
|
+
var sep10 = init.length > 1 ? ";\n" : "; ";
|
|
15843
15843
|
var forParen = "for (";
|
|
15844
|
-
var indented = (0, lines_1.fromString)(
|
|
15844
|
+
var indented = (0, lines_1.fromString)(sep10).join([init, path2.call(print2, "test"), path2.call(print2, "update")]).indentTail(forParen.length);
|
|
15845
15845
|
var head = (0, lines_1.concat)([forParen, indented, ")"]);
|
|
15846
15846
|
var clause = adjustClause(path2.call(print2, "body"), options);
|
|
15847
15847
|
parts.push(head);
|
|
@@ -41411,10 +41411,10 @@ function compareDocumentPosition(nodeA, nodeB) {
|
|
|
41411
41411
|
function uniqueSort(nodes) {
|
|
41412
41412
|
nodes = nodes.filter((node, i2, arr) => !arr.includes(node, i2 + 1));
|
|
41413
41413
|
nodes.sort((a, b2) => {
|
|
41414
|
-
const
|
|
41415
|
-
if (
|
|
41414
|
+
const relative21 = compareDocumentPosition(a, b2);
|
|
41415
|
+
if (relative21 & DocumentPosition.PRECEDING) {
|
|
41416
41416
|
return -1;
|
|
41417
|
-
} else if (
|
|
41417
|
+
} else if (relative21 & DocumentPosition.FOLLOWING) {
|
|
41418
41418
|
return 1;
|
|
41419
41419
|
}
|
|
41420
41420
|
return 0;
|
|
@@ -47629,12 +47629,12 @@ var require_CSSValueExpression = __commonJS({
|
|
|
47629
47629
|
return false;
|
|
47630
47630
|
}
|
|
47631
47631
|
};
|
|
47632
|
-
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx,
|
|
47633
|
-
var endIdx = this._findMatchedIdx(token, idx,
|
|
47632
|
+
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep10) {
|
|
47633
|
+
var endIdx = this._findMatchedIdx(token, idx, sep10), text2;
|
|
47634
47634
|
if (endIdx === -1) {
|
|
47635
47635
|
return false;
|
|
47636
47636
|
} else {
|
|
47637
|
-
text2 = token.substring(idx, endIdx +
|
|
47637
|
+
text2 = token.substring(idx, endIdx + sep10.length);
|
|
47638
47638
|
return {
|
|
47639
47639
|
idx: endIdx,
|
|
47640
47640
|
text: text2
|
|
@@ -47674,15 +47674,15 @@ var require_CSSValueExpression = __commonJS({
|
|
|
47674
47674
|
if (!isLegal) {
|
|
47675
47675
|
return false;
|
|
47676
47676
|
} else {
|
|
47677
|
-
var
|
|
47678
|
-
return this._parseJSString(token, idx,
|
|
47677
|
+
var sep10 = "/";
|
|
47678
|
+
return this._parseJSString(token, idx, sep10);
|
|
47679
47679
|
}
|
|
47680
47680
|
};
|
|
47681
|
-
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx,
|
|
47681
|
+
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep10) {
|
|
47682
47682
|
var startIdx = idx, endIdx;
|
|
47683
47683
|
var NOT_FOUND = -1;
|
|
47684
47684
|
while (true) {
|
|
47685
|
-
endIdx = token.indexOf(
|
|
47685
|
+
endIdx = token.indexOf(sep10, startIdx + 1);
|
|
47686
47686
|
if (endIdx === -1) {
|
|
47687
47687
|
endIdx = NOT_FOUND;
|
|
47688
47688
|
break;
|
|
@@ -50624,8 +50624,8 @@ var init_esm10 = __esm({
|
|
|
50624
50624
|
});
|
|
50625
50625
|
|
|
50626
50626
|
// ../../node_modules/.bun/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
50627
|
-
function encodeInteger(builder, num2,
|
|
50628
|
-
let delta = num2 -
|
|
50627
|
+
function encodeInteger(builder, num2, relative21) {
|
|
50628
|
+
let delta = num2 - relative21;
|
|
50629
50629
|
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
50630
50630
|
do {
|
|
50631
50631
|
let clamped = delta & 31;
|
|
@@ -53463,21 +53463,36 @@ function mintHfId(el, assigned) {
|
|
|
53463
53463
|
assigned.add(id);
|
|
53464
53464
|
return id;
|
|
53465
53465
|
}
|
|
53466
|
+
function getChildElements(parent) {
|
|
53467
|
+
const directChildren = Array.from(parent.children);
|
|
53468
|
+
if (directChildren.length || parent.tagName.toLowerCase() !== "template") return directChildren;
|
|
53469
|
+
const content = parent.content;
|
|
53470
|
+
if (content?.children.length) return Array.from(content.children);
|
|
53471
|
+
return directChildren;
|
|
53472
|
+
}
|
|
53466
53473
|
function isCompositionTemplate(el) {
|
|
53467
53474
|
if (el.tagName.toLowerCase() !== "template") return false;
|
|
53468
53475
|
if (el.getAttribute("data-composition-id") !== null) return true;
|
|
53469
|
-
for (const child of
|
|
53476
|
+
for (const child of getChildElements(el)) {
|
|
53470
53477
|
if (child.getAttribute("data-composition-id") !== null) return true;
|
|
53471
53478
|
}
|
|
53472
53479
|
return false;
|
|
53473
53480
|
}
|
|
53481
|
+
function walkCompositionDescendants(root, visit) {
|
|
53482
|
+
const rootElement = root.nodeType === 9 ? root.documentElement : root;
|
|
53483
|
+
if (!rootElement) return;
|
|
53484
|
+
const walk = (parent) => {
|
|
53485
|
+
for (const child of getChildElements(parent)) {
|
|
53486
|
+
const isTemplate = child.tagName.toLowerCase() === "template";
|
|
53487
|
+
if (isTemplate && !isCompositionTemplate(child)) continue;
|
|
53488
|
+
visit(child);
|
|
53489
|
+
walk(child);
|
|
53490
|
+
}
|
|
53491
|
+
};
|
|
53492
|
+
walk(rootElement);
|
|
53493
|
+
}
|
|
53474
53494
|
function walkElements(root, visit) {
|
|
53475
|
-
|
|
53476
|
-
const isTemplate = child.tagName.toLowerCase() === "template";
|
|
53477
|
-
if (isTemplate && !isCompositionTemplate(child)) continue;
|
|
53478
|
-
visit(child);
|
|
53479
|
-
walkElements(child, visit);
|
|
53480
|
-
}
|
|
53495
|
+
walkCompositionDescendants(root, visit);
|
|
53481
53496
|
}
|
|
53482
53497
|
function ensureHfIds(html) {
|
|
53483
53498
|
const hasDocumentShell = /<!doctype|<html[\s>]/i.test(html);
|
|
@@ -53797,7 +53812,7 @@ function parseHtml(html) {
|
|
|
53797
53812
|
elements.push(mediaElement);
|
|
53798
53813
|
}
|
|
53799
53814
|
});
|
|
53800
|
-
const scriptTags = doc
|
|
53815
|
+
const scriptTags = findScriptElementsDeep(doc);
|
|
53801
53816
|
let gsapScript = null;
|
|
53802
53817
|
for (const script of scriptTags) {
|
|
53803
53818
|
const src = script.getAttribute("src");
|
|
@@ -54042,7 +54057,7 @@ function stripGsapForId(script, elementId) {
|
|
|
54042
54057
|
}
|
|
54043
54058
|
}
|
|
54044
54059
|
function cascadeRemoveGsapById(doc, elementId) {
|
|
54045
|
-
for (const script of
|
|
54060
|
+
for (const script of findScriptElementsDeep(doc)) {
|
|
54046
54061
|
const text2 = script.textContent ?? "";
|
|
54047
54062
|
if (!text2.includes("gsap") && !text2.includes("ScrollTrigger")) continue;
|
|
54048
54063
|
const updated = stripGsapForId(text2, elementId);
|
|
@@ -54116,12 +54131,11 @@ function validateCompositionHtml(html) {
|
|
|
54116
54131
|
if (/javascript\s*:/i.test(html)) {
|
|
54117
54132
|
errors.push("javascript: URLs not allowed");
|
|
54118
54133
|
}
|
|
54119
|
-
const scripts = doc
|
|
54134
|
+
const scripts = findScriptElementsDeep(doc);
|
|
54120
54135
|
if (scripts.length > 2) {
|
|
54121
54136
|
warnings.push("Multiple script tags detected - only GSAP CDN and main script expected");
|
|
54122
54137
|
}
|
|
54123
|
-
const gsapScript
|
|
54124
|
-
if (gsapScript) {
|
|
54138
|
+
for (const gsapScript of extractGsapScripts(doc)) {
|
|
54125
54139
|
const gsapValidation = validateCompositionGsap(gsapScript);
|
|
54126
54140
|
errors.push(...gsapValidation.errors);
|
|
54127
54141
|
warnings.push(...gsapValidation.warnings);
|
|
@@ -54132,15 +54146,23 @@ function validateCompositionHtml(html) {
|
|
|
54132
54146
|
warnings
|
|
54133
54147
|
};
|
|
54134
54148
|
}
|
|
54135
|
-
function
|
|
54136
|
-
const scripts =
|
|
54149
|
+
function findScriptElementsDeep(doc) {
|
|
54150
|
+
const scripts = [];
|
|
54151
|
+
walkCompositionDescendants(doc, (el) => {
|
|
54152
|
+
if (el.tagName.toLowerCase() === "script") scripts.push(el);
|
|
54153
|
+
});
|
|
54154
|
+
return scripts;
|
|
54155
|
+
}
|
|
54156
|
+
function extractGsapScripts(doc) {
|
|
54157
|
+
const scripts = findScriptElementsDeep(doc);
|
|
54158
|
+
const gsapScripts = [];
|
|
54137
54159
|
for (const script of scripts) {
|
|
54138
54160
|
const content = script.textContent || "";
|
|
54139
54161
|
if (content.includes("gsap.timeline") || content.includes(".set(") || content.includes(".to(")) {
|
|
54140
|
-
|
|
54162
|
+
gsapScripts.push(content);
|
|
54141
54163
|
}
|
|
54142
54164
|
}
|
|
54143
|
-
return
|
|
54165
|
+
return gsapScripts;
|
|
54144
54166
|
}
|
|
54145
54167
|
function suggestMatchingPreset(compositionWidth, compositionHeight, chosen) {
|
|
54146
54168
|
const aspectMatches = VALID_CANVAS_RESOLUTIONS.filter((preset2) => {
|
|
@@ -60146,7 +60168,7 @@ var init_dist3 = __esm({
|
|
|
60146
60168
|
});
|
|
60147
60169
|
|
|
60148
60170
|
// src/telemetry/config.ts
|
|
60149
|
-
import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
60171
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
60150
60172
|
import { join as join3 } from "path";
|
|
60151
60173
|
import { homedir } from "os";
|
|
60152
60174
|
import { randomUUID } from "crypto";
|
|
@@ -60175,7 +60197,14 @@ function readConfig() {
|
|
|
60175
60197
|
skillsUpdateAvailable: parsed.skillsUpdateAvailable,
|
|
60176
60198
|
skillsOutdatedCount: parsed.skillsOutdatedCount,
|
|
60177
60199
|
skillsMissingCount: parsed.skillsMissingCount,
|
|
60178
|
-
skillsRemovedCount: parsed.skillsRemovedCount
|
|
60200
|
+
skillsRemovedCount: parsed.skillsRemovedCount,
|
|
60201
|
+
// Explicit `=== true`/typeof-number checks rather than a truthy/nullish
|
|
60202
|
+
// read — a hand-edited or corrupted config could plausibly carry a
|
|
60203
|
+
// non-boolean/non-number JSON value (e.g. the STRING "false", which is
|
|
60204
|
+
// truthy in JS) for these two fields specifically, since they're read
|
|
60205
|
+
// with a bare truthy check at the call site (review finding).
|
|
60206
|
+
deParallelRouterTrialFired: parsed.deParallelRouterTrialFired === true ? true : void 0,
|
|
60207
|
+
deParallelRouterTrialRenderCount: typeof parsed.deParallelRouterTrialRenderCount === "number" ? parsed.deParallelRouterTrialRenderCount : void 0
|
|
60179
60208
|
};
|
|
60180
60209
|
cachedConfig = config;
|
|
60181
60210
|
return { ...config };
|
|
@@ -60185,12 +60214,20 @@ function readConfig() {
|
|
|
60185
60214
|
return config;
|
|
60186
60215
|
}
|
|
60187
60216
|
}
|
|
60217
|
+
function readConfigFresh() {
|
|
60218
|
+
cachedConfig = null;
|
|
60219
|
+
return readConfig();
|
|
60220
|
+
}
|
|
60188
60221
|
function writeConfig(config) {
|
|
60189
60222
|
try {
|
|
60190
60223
|
mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
|
|
60191
|
-
|
|
60224
|
+
const tmpFile = `${CONFIG_FILE}.${process.pid}.tmp`;
|
|
60225
|
+
writeFileSync(tmpFile, JSON.stringify(config, null, 2) + "\n", { mode: 384 });
|
|
60226
|
+
renameSync(tmpFile, CONFIG_FILE);
|
|
60192
60227
|
cachedConfig = { ...config };
|
|
60228
|
+
return true;
|
|
60193
60229
|
} catch {
|
|
60230
|
+
return false;
|
|
60194
60231
|
}
|
|
60195
60232
|
}
|
|
60196
60233
|
function incrementCommandCount() {
|
|
@@ -64650,9 +64687,11 @@ function isTransientBrowserError(error) {
|
|
|
64650
64687
|
}
|
|
64651
64688
|
function isMemoryExhaustionError(error) {
|
|
64652
64689
|
const message = error instanceof Error ? error.message : String(error);
|
|
64690
|
+
if (BUN_MEMORY_EXHAUSTION_EXACT_MESSAGE.test(message.trim())) return true;
|
|
64691
|
+
if (BUN_MEMORY_EXHAUSTION_WRAPPED_WORKER_MESSAGE.test(message)) return true;
|
|
64653
64692
|
return MEMORY_EXHAUSTION_ERROR_PATTERNS.some((pattern) => pattern.test(message));
|
|
64654
64693
|
}
|
|
64655
|
-
var DrawElementVerificationError, BROWSER_CONSOLE_BUFFER_SIZE, CAPTURE_SESSION_CLOSE_TIMEOUT_MS, LOCKED_WARMUP_TICKS, realSleep, HF_READY_DIAGNOSTIC_EXPR, STATIC_VERIFY_REFERENCE_STRIDE, TRANSIENT_BROWSER_ERROR_PATTERNS, MEMORY_EXHAUSTION_ERROR_PATTERNS;
|
|
64694
|
+
var DrawElementVerificationError, BROWSER_CONSOLE_BUFFER_SIZE, CAPTURE_SESSION_CLOSE_TIMEOUT_MS, LOCKED_WARMUP_TICKS, realSleep, HF_READY_DIAGNOSTIC_EXPR, STATIC_VERIFY_REFERENCE_STRIDE, TRANSIENT_BROWSER_ERROR_PATTERNS, MEMORY_EXHAUSTION_ERROR_PATTERNS, BUN_MEMORY_EXHAUSTION_EXACT_MESSAGE, BUN_MEMORY_EXHAUSTION_WRAPPED_WORKER_MESSAGE;
|
|
64656
64695
|
var init_frameCapture = __esm({
|
|
64657
64696
|
"../engine/src/services/frameCapture.ts"() {
|
|
64658
64697
|
"use strict";
|
|
@@ -64722,6 +64761,8 @@ var init_frameCapture = __esm({
|
|
|
64722
64761
|
/Reached heap limit/i,
|
|
64723
64762
|
/JavaScript heap out of memory/i
|
|
64724
64763
|
];
|
|
64764
|
+
BUN_MEMORY_EXHAUSTION_EXACT_MESSAGE = /^out of memory\.?$/i;
|
|
64765
|
+
BUN_MEMORY_EXHAUSTION_WRAPPED_WORKER_MESSAGE = /\bworker \d+: out of memory\.?(?:;|$)/i;
|
|
64725
64766
|
}
|
|
64726
64767
|
});
|
|
64727
64768
|
|
|
@@ -70401,7 +70442,9 @@ async function lintProject(projectDir) {
|
|
|
70401
70442
|
for (const entry of readdirSync3(dir, { withFileTypes: true })) {
|
|
70402
70443
|
const relPath = rel ? `${rel}/${entry.name}` : entry.name;
|
|
70403
70444
|
if (entry.isDirectory()) out.push(...collectHtmlFiles(join10(dir, entry.name), relPath));
|
|
70404
|
-
else if (entry.isFile() && entry.name.endsWith(".html")
|
|
70445
|
+
else if (entry.isFile() && entry.name.endsWith(".html") && !entry.name.startsWith("._")) {
|
|
70446
|
+
out.push(relPath);
|
|
70447
|
+
}
|
|
70405
70448
|
}
|
|
70406
70449
|
return out;
|
|
70407
70450
|
};
|
|
@@ -70582,7 +70625,9 @@ function lintTextureMaskAssetNotFound(projectDir, htmlSources) {
|
|
|
70582
70625
|
function lintMultipleRootCompositions(projectDir) {
|
|
70583
70626
|
const findings = [];
|
|
70584
70627
|
try {
|
|
70585
|
-
const rootHtmlFiles = readdirSync3(projectDir).filter(
|
|
70628
|
+
const rootHtmlFiles = readdirSync3(projectDir).filter(
|
|
70629
|
+
(file) => file.endsWith(".html") && !file.startsWith("._")
|
|
70630
|
+
);
|
|
70586
70631
|
const rootCompositions = [];
|
|
70587
70632
|
for (const file of rootHtmlFiles) {
|
|
70588
70633
|
if (file === "caption-skin.html") continue;
|
|
@@ -73305,7 +73350,7 @@ var init_inlineSubCompositions = __esm({
|
|
|
73305
73350
|
|
|
73306
73351
|
// ../core/dist/compiler/htmlBundler.js
|
|
73307
73352
|
import { readFileSync as readFileSync5, existsSync as existsSync10 } from "fs";
|
|
73308
|
-
import {
|
|
73353
|
+
import { resolve as resolve8, relative as relative3, dirname as dirname7, isAbsolute as isAbsolute3, sep as sep2 } from "path";
|
|
73309
73354
|
import { transformSync } from "esbuild";
|
|
73310
73355
|
function getRuntimeScriptUrl() {
|
|
73311
73356
|
const configured = (process.env.HYPERFRAME_RUNTIME_URL || "").trim();
|
|
@@ -73389,6 +73434,87 @@ function rebaseCssUrls(css, cssFileDir, projectDir) {
|
|
|
73389
73434
|
return `url(${quote || ""}${rebased}${suffix}${quote || ""})`;
|
|
73390
73435
|
});
|
|
73391
73436
|
}
|
|
73437
|
+
function rebaseRelativePath(urlValue, fromDir, toDir) {
|
|
73438
|
+
const { basePath, suffix } = splitUrlSuffix(urlValue.trim());
|
|
73439
|
+
if (!basePath)
|
|
73440
|
+
return urlValue;
|
|
73441
|
+
const absolutePath = resolve8(fromDir, basePath);
|
|
73442
|
+
const rebased = relative3(resolve8(toDir), absolutePath).split(sep2).join("/");
|
|
73443
|
+
return appendSuffixToUrl(rebased, suffix);
|
|
73444
|
+
}
|
|
73445
|
+
function rebaseSrcsetPaths(srcsetValue, fromDir, toDir) {
|
|
73446
|
+
if (!srcsetValue)
|
|
73447
|
+
return srcsetValue;
|
|
73448
|
+
return srcsetValue.split(",").map((rawCandidate) => {
|
|
73449
|
+
const candidate = rawCandidate.trim();
|
|
73450
|
+
if (!candidate)
|
|
73451
|
+
return candidate;
|
|
73452
|
+
const parts = candidate.split(/\s+/);
|
|
73453
|
+
const first = parts[0] ?? "";
|
|
73454
|
+
if (parts.length === 0 || !isRelativeUrl(first))
|
|
73455
|
+
return candidate;
|
|
73456
|
+
parts[0] = rebaseRelativePath(first, fromDir, toDir);
|
|
73457
|
+
return parts.join(" ");
|
|
73458
|
+
}).join(", ");
|
|
73459
|
+
}
|
|
73460
|
+
function rebaseColorGradingLutPath(value, fromDir, toDir) {
|
|
73461
|
+
if (!value.trim().startsWith("{"))
|
|
73462
|
+
return value;
|
|
73463
|
+
let parsed;
|
|
73464
|
+
try {
|
|
73465
|
+
parsed = JSON.parse(value);
|
|
73466
|
+
} catch {
|
|
73467
|
+
return value;
|
|
73468
|
+
}
|
|
73469
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
73470
|
+
return value;
|
|
73471
|
+
const lut = Reflect.get(parsed, "lut");
|
|
73472
|
+
if (typeof lut === "string") {
|
|
73473
|
+
if (!isRelativeUrl(lut))
|
|
73474
|
+
return value;
|
|
73475
|
+
Reflect.set(parsed, "lut", rebaseRelativePath(lut, fromDir, toDir));
|
|
73476
|
+
return JSON.stringify(parsed);
|
|
73477
|
+
}
|
|
73478
|
+
if (typeof lut !== "object" || lut === null || Array.isArray(lut))
|
|
73479
|
+
return value;
|
|
73480
|
+
const lutSrc = Reflect.get(lut, "src");
|
|
73481
|
+
if (typeof lutSrc !== "string" || !isRelativeUrl(lutSrc))
|
|
73482
|
+
return value;
|
|
73483
|
+
Reflect.set(lut, "src", rebaseRelativePath(lutSrc, fromDir, toDir));
|
|
73484
|
+
return JSON.stringify(parsed);
|
|
73485
|
+
}
|
|
73486
|
+
function rebaseEntryAuthoredAssetPaths(document2, sourceDir, projectDir) {
|
|
73487
|
+
for (const styleEl of [...document2.querySelectorAll("style")]) {
|
|
73488
|
+
styleEl.textContent = rebaseCssUrls(styleEl.textContent || "", sourceDir, projectDir);
|
|
73489
|
+
}
|
|
73490
|
+
for (const el of [...document2.querySelectorAll("[style]")]) {
|
|
73491
|
+
const styleAttr = el.getAttribute("style");
|
|
73492
|
+
if (styleAttr)
|
|
73493
|
+
el.setAttribute("style", rebaseCssUrls(styleAttr, sourceDir, projectDir));
|
|
73494
|
+
}
|
|
73495
|
+
for (const el of [...document2.querySelectorAll("[src], [href], [poster], [xlink\\:href]")]) {
|
|
73496
|
+
if (el.tagName === "LINK" && (el.getAttribute("rel") || "").toLowerCase() === "stylesheet")
|
|
73497
|
+
continue;
|
|
73498
|
+
if (el.tagName === "SCRIPT" && el.hasAttribute("src"))
|
|
73499
|
+
continue;
|
|
73500
|
+
for (const attr2 of ["src", "href", "poster", "xlink:href"]) {
|
|
73501
|
+
const value = el.getAttribute(attr2);
|
|
73502
|
+
if (!value || !isRelativeUrl(value))
|
|
73503
|
+
continue;
|
|
73504
|
+
el.setAttribute(attr2, rebaseRelativePath(value, sourceDir, projectDir));
|
|
73505
|
+
}
|
|
73506
|
+
}
|
|
73507
|
+
for (const el of [...document2.querySelectorAll("[srcset]")]) {
|
|
73508
|
+
const srcset = el.getAttribute("srcset");
|
|
73509
|
+
if (srcset)
|
|
73510
|
+
el.setAttribute("srcset", rebaseSrcsetPaths(srcset, sourceDir, projectDir));
|
|
73511
|
+
}
|
|
73512
|
+
for (const el of [...document2.querySelectorAll(`[${HF_COLOR_GRADING_ATTR}]`)]) {
|
|
73513
|
+
const value = el.getAttribute(HF_COLOR_GRADING_ATTR);
|
|
73514
|
+
if (value)
|
|
73515
|
+
el.setAttribute(HF_COLOR_GRADING_ATTR, rebaseColorGradingLutPath(value, sourceDir, projectDir));
|
|
73516
|
+
}
|
|
73517
|
+
}
|
|
73392
73518
|
function inlineCssFile(css, cssFileDir, projectDir, visited = /* @__PURE__ */ new Set()) {
|
|
73393
73519
|
const { result: strippedCss, restore: restoreComments } = withCommentsStripped(css, (s2) => s2);
|
|
73394
73520
|
const importPlaceholders = [];
|
|
@@ -73807,24 +73933,34 @@ function hoistCompositionScripts(container, opts) {
|
|
|
73807
73933
|
}
|
|
73808
73934
|
}
|
|
73809
73935
|
async function bundleToSingleHtml(projectDir, options) {
|
|
73810
|
-
const
|
|
73811
|
-
|
|
73812
|
-
|
|
73936
|
+
const entryFile = options?.entryFile ?? "index.html";
|
|
73937
|
+
const indexPath2 = resolveWithinProject(projectDir, entryFile);
|
|
73938
|
+
if (!indexPath2 || !existsSync10(indexPath2)) {
|
|
73939
|
+
throw new Error(`${entryFile} not found in project directory`);
|
|
73940
|
+
}
|
|
73941
|
+
const sourceDir = dirname7(indexPath2);
|
|
73942
|
+
const resolveEntryPath = (relativePath) => {
|
|
73943
|
+
const resolved2 = resolve8(sourceDir, relativePath);
|
|
73944
|
+
return isSafePath(projectDir, resolved2) ? resolved2 : null;
|
|
73945
|
+
};
|
|
73813
73946
|
const rawHtml = readFileSync5(indexPath2, "utf-8");
|
|
73814
|
-
const compiled = await compileHtml(rawHtml,
|
|
73947
|
+
const compiled = await compileHtml(rawHtml, sourceDir, options?.probeMediaDuration);
|
|
73815
73948
|
const staticGuard = await validateHyperframeHtmlContract(compiled);
|
|
73816
73949
|
if (!staticGuard.isValid) {
|
|
73817
73950
|
console.warn(`[StaticGuard] Invalid HyperFrame contract: ${staticGuard.missingKeys.join("; ")}`);
|
|
73818
73951
|
}
|
|
73819
73952
|
const withInterceptor = injectInterceptor(compiled, options?.runtime ?? "inline");
|
|
73820
73953
|
const document2 = parseHTMLContent(withInterceptor);
|
|
73954
|
+
if (resolve8(sourceDir) !== resolve8(projectDir)) {
|
|
73955
|
+
rebaseEntryAuthoredAssetPaths(document2, sourceDir, projectDir);
|
|
73956
|
+
}
|
|
73821
73957
|
const localCssChunks = [];
|
|
73822
73958
|
let cssAnchorPlaced = false;
|
|
73823
73959
|
for (const el of [...document2.querySelectorAll('link[rel="stylesheet"]')]) {
|
|
73824
73960
|
const href = el.getAttribute("href");
|
|
73825
73961
|
if (!href || !isRelativeUrl(href))
|
|
73826
73962
|
continue;
|
|
73827
|
-
const cssPath =
|
|
73963
|
+
const cssPath = resolveEntryPath(href);
|
|
73828
73964
|
if (!cssPath)
|
|
73829
73965
|
continue;
|
|
73830
73966
|
const css = safeReadFile(cssPath);
|
|
@@ -73857,7 +73993,7 @@ async function bundleToSingleHtml(projectDir, options) {
|
|
|
73857
73993
|
const src = el.getAttribute("src");
|
|
73858
73994
|
if (!src || !isRelativeUrl(src))
|
|
73859
73995
|
continue;
|
|
73860
|
-
const jsPath =
|
|
73996
|
+
const jsPath = resolveEntryPath(src);
|
|
73861
73997
|
const js = jsPath ? safeReadFile(jsPath) : null;
|
|
73862
73998
|
if (js == null)
|
|
73863
73999
|
continue;
|
|
@@ -73890,7 +74026,7 @@ async function bundleToSingleHtml(projectDir, options) {
|
|
|
73890
74026
|
resolveHtml: (srcPath) => {
|
|
73891
74027
|
if (!isRelativeUrl(srcPath))
|
|
73892
74028
|
return null;
|
|
73893
|
-
const compPath =
|
|
74029
|
+
const compPath = resolveEntryPath(srcPath);
|
|
73894
74030
|
return compPath ? safeReadFile(compPath) : null;
|
|
73895
74031
|
},
|
|
73896
74032
|
parseHtml: parseHTMLContent,
|
|
@@ -73922,7 +74058,7 @@ async function bundleToSingleHtml(projectDir, options) {
|
|
|
73922
74058
|
continue;
|
|
73923
74059
|
seenCompScriptSrcs.add(extSrc);
|
|
73924
74060
|
if (isRelativeUrl(extSrc)) {
|
|
73925
|
-
const jsPath =
|
|
74061
|
+
const jsPath = resolveEntryPath(extSrc);
|
|
73926
74062
|
const js = jsPath ? safeReadFile(jsPath) : null;
|
|
73927
74063
|
if (js != null) {
|
|
73928
74064
|
compScriptChunks.push(js);
|
|
@@ -74292,13 +74428,13 @@ import {
|
|
|
74292
74428
|
lstatSync,
|
|
74293
74429
|
mkdirSync as mkdirSync6,
|
|
74294
74430
|
readdirSync as readdirSync4,
|
|
74295
|
-
renameSync,
|
|
74431
|
+
renameSync as renameSync2,
|
|
74296
74432
|
rmSync,
|
|
74297
74433
|
statSync as statSync3,
|
|
74298
74434
|
utimesSync,
|
|
74299
74435
|
writeFileSync as writeFileSync4
|
|
74300
74436
|
} from "fs";
|
|
74301
|
-
import { join as
|
|
74437
|
+
import { join as join11 } from "path";
|
|
74302
74438
|
function readKeyStat(videoPath) {
|
|
74303
74439
|
try {
|
|
74304
74440
|
const stat3 = statSync3(videoPath);
|
|
@@ -74329,8 +74465,8 @@ function cacheEntryDirName(keyHash) {
|
|
|
74329
74465
|
}
|
|
74330
74466
|
function lookupCacheEntry(rootDir, input2) {
|
|
74331
74467
|
const keyHash = computeCacheKey(input2);
|
|
74332
|
-
const dir =
|
|
74333
|
-
const complete = existsSync11(
|
|
74468
|
+
const dir = join11(rootDir, cacheEntryDirName(keyHash));
|
|
74469
|
+
const complete = existsSync11(join11(dir, COMPLETE_SENTINEL));
|
|
74334
74470
|
return { entry: { dir, keyHash }, hit: complete };
|
|
74335
74471
|
}
|
|
74336
74472
|
function partialCacheEntryDir(entry) {
|
|
@@ -74341,18 +74477,18 @@ function isTargetExistsRenameError(err) {
|
|
|
74341
74477
|
return code === "EEXIST" || code === "ENOTEMPTY" || code === "EPERM";
|
|
74342
74478
|
}
|
|
74343
74479
|
function adoptPublishedWinner(entry, partialDir) {
|
|
74344
|
-
if (!existsSync11(
|
|
74480
|
+
if (!existsSync11(join11(entry.dir, COMPLETE_SENTINEL))) return null;
|
|
74345
74481
|
removeDir(partialDir);
|
|
74346
74482
|
return { dir: entry.dir, published: true };
|
|
74347
74483
|
}
|
|
74348
74484
|
function publishCacheEntry(entry, partialDir) {
|
|
74349
74485
|
try {
|
|
74350
|
-
writeFileSync4(
|
|
74486
|
+
writeFileSync4(join11(partialDir, COMPLETE_SENTINEL), "", "utf-8");
|
|
74351
74487
|
} catch {
|
|
74352
74488
|
return { dir: partialDir, published: false };
|
|
74353
74489
|
}
|
|
74354
74490
|
try {
|
|
74355
|
-
|
|
74491
|
+
renameSync2(partialDir, entry.dir);
|
|
74356
74492
|
return { dir: entry.dir, published: true };
|
|
74357
74493
|
} catch (err) {
|
|
74358
74494
|
if (!isTargetExistsRenameError(err)) return { dir: partialDir, published: false };
|
|
@@ -74365,7 +74501,7 @@ function publishCacheEntry(entry, partialDir) {
|
|
|
74365
74501
|
return { dir: partialDir, published: false };
|
|
74366
74502
|
}
|
|
74367
74503
|
try {
|
|
74368
|
-
|
|
74504
|
+
renameSync2(partialDir, entry.dir);
|
|
74369
74505
|
return { dir: entry.dir, published: true };
|
|
74370
74506
|
} catch {
|
|
74371
74507
|
return adoptPublishedWinner(entry, partialDir) ?? { dir: partialDir, published: false };
|
|
@@ -74374,7 +74510,7 @@ function publishCacheEntry(entry, partialDir) {
|
|
|
74374
74510
|
function touchCacheEntry(entry) {
|
|
74375
74511
|
try {
|
|
74376
74512
|
const now = /* @__PURE__ */ new Date();
|
|
74377
|
-
utimesSync(
|
|
74513
|
+
utimesSync(join11(entry.dir, COMPLETE_SENTINEL), now, now);
|
|
74378
74514
|
} catch {
|
|
74379
74515
|
}
|
|
74380
74516
|
}
|
|
@@ -74399,7 +74535,7 @@ function directorySizeBytes(path2) {
|
|
|
74399
74535
|
return 0;
|
|
74400
74536
|
}
|
|
74401
74537
|
for (const child of children) {
|
|
74402
|
-
const childPath =
|
|
74538
|
+
const childPath = join11(path2, child);
|
|
74403
74539
|
try {
|
|
74404
74540
|
const stat3 = lstatSync(childPath);
|
|
74405
74541
|
if (stat3.isDirectory()) {
|
|
@@ -74428,7 +74564,7 @@ function collectGcEntry(dir, name, now, minAgeMs, stats) {
|
|
|
74428
74564
|
}
|
|
74429
74565
|
let lastUseMs = dirStat.mtimeMs;
|
|
74430
74566
|
try {
|
|
74431
|
-
lastUseMs = statSync3(
|
|
74567
|
+
lastUseMs = statSync3(join11(dir, COMPLETE_SENTINEL)).mtimeMs;
|
|
74432
74568
|
} catch {
|
|
74433
74569
|
}
|
|
74434
74570
|
return { dir, size: directorySizeBytes(dir), lastUseMs, ageMs: now - lastUseMs };
|
|
@@ -74438,7 +74574,7 @@ function collectGcEntry(dir, name, now, minAgeMs, stats) {
|
|
|
74438
74574
|
}
|
|
74439
74575
|
function gcSweepDue(rootDir, maxAgeMs) {
|
|
74440
74576
|
try {
|
|
74441
|
-
return Date.now() - statSync3(
|
|
74577
|
+
return Date.now() - statSync3(join11(rootDir, GC_MARKER)).mtimeMs > maxAgeMs;
|
|
74442
74578
|
} catch {
|
|
74443
74579
|
return true;
|
|
74444
74580
|
}
|
|
@@ -74446,7 +74582,7 @@ function gcSweepDue(rootDir, maxAgeMs) {
|
|
|
74446
74582
|
function gcExtractionCache(rootDir, opts) {
|
|
74447
74583
|
const stats = { evictedEntries: 0, evictedBytes: 0, agedPartialsRemoved: 0 };
|
|
74448
74584
|
try {
|
|
74449
|
-
writeFileSync4(
|
|
74585
|
+
writeFileSync4(join11(rootDir, GC_MARKER), "", "utf-8");
|
|
74450
74586
|
} catch {
|
|
74451
74587
|
}
|
|
74452
74588
|
try {
|
|
@@ -74455,7 +74591,7 @@ function gcExtractionCache(rootDir, opts) {
|
|
|
74455
74591
|
for (const child of readdirSync4(rootDir, { withFileTypes: true })) {
|
|
74456
74592
|
if (!child.isDirectory() || !isCacheLikeChild(child.name)) continue;
|
|
74457
74593
|
const entry = collectGcEntry(
|
|
74458
|
-
|
|
74594
|
+
join11(rootDir, child.name),
|
|
74459
74595
|
child.name,
|
|
74460
74596
|
now,
|
|
74461
74597
|
opts.minAgeMs,
|
|
@@ -74484,7 +74620,7 @@ function rehydrateCacheEntry(entry, options) {
|
|
|
74484
74620
|
const suffix = `.${options.format}`;
|
|
74485
74621
|
const files = readdirSync4(entry.dir).filter((f3) => f3.startsWith(FRAME_FILENAME_PREFIX) && f3.endsWith(suffix)).sort();
|
|
74486
74622
|
files.forEach((file, idx) => {
|
|
74487
|
-
framePaths.set(idx,
|
|
74623
|
+
framePaths.set(idx, join11(entry.dir, file));
|
|
74488
74624
|
});
|
|
74489
74625
|
return {
|
|
74490
74626
|
videoId: options.videoId,
|
|
@@ -74513,7 +74649,7 @@ var init_extractionCache = __esm({
|
|
|
74513
74649
|
// ../engine/src/services/videoFrameExtractor.ts
|
|
74514
74650
|
import { spawn as spawn6 } from "child_process";
|
|
74515
74651
|
import { copyFileSync as copyFileSync2, existsSync as existsSync12, linkSync, mkdirSync as mkdirSync7, readdirSync as readdirSync5, rmSync as rmSync2 } from "fs";
|
|
74516
|
-
import { isAbsolute as isAbsolute4, join as
|
|
74652
|
+
import { isAbsolute as isAbsolute4, join as join12, posix as posix3, resolve as resolve9, sep as sep3 } from "path";
|
|
74517
74653
|
function isVideoFrameFormat(value) {
|
|
74518
74654
|
return typeof value === "string" && VIDEO_FRAME_FORMATS.includes(value);
|
|
74519
74655
|
}
|
|
@@ -74593,12 +74729,12 @@ function parseImageElements(html) {
|
|
|
74593
74729
|
async function extractVideoFramesRange(videoPath, videoId, startTime, duration, options, signal, config, outputDirOverride) {
|
|
74594
74730
|
const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
74595
74731
|
const { fps, outputDir, quality = 95 } = options;
|
|
74596
|
-
const videoOutputDir = outputDirOverride ??
|
|
74732
|
+
const videoOutputDir = outputDirOverride ?? join12(outputDir, videoId);
|
|
74597
74733
|
if (!existsSync12(videoOutputDir)) mkdirSync7(videoOutputDir, { recursive: true });
|
|
74598
74734
|
const metadata = await extractMediaMetadata(videoPath);
|
|
74599
74735
|
const format = resolveFrameFormat(metadata, options.format);
|
|
74600
74736
|
const framePattern = `${FRAME_FILENAME_PREFIX}%05d.${format}`;
|
|
74601
|
-
const outputPattern =
|
|
74737
|
+
const outputPattern = join12(videoOutputDir, framePattern);
|
|
74602
74738
|
const isHdr = isHdrColorSpace(metadata.colorSpace);
|
|
74603
74739
|
const isMacOS = process.platform === "darwin";
|
|
74604
74740
|
const args = [];
|
|
@@ -74659,7 +74795,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
|
|
|
74659
74795
|
const framePaths = /* @__PURE__ */ new Map();
|
|
74660
74796
|
const files = readdirSync5(videoOutputDir).filter((f3) => f3.startsWith(FRAME_FILENAME_PREFIX) && f3.endsWith(`.${format}`)).sort();
|
|
74661
74797
|
files.forEach((file, index) => {
|
|
74662
|
-
framePaths.set(index,
|
|
74798
|
+
framePaths.set(index, join12(videoOutputDir, file));
|
|
74663
74799
|
});
|
|
74664
74800
|
resolve64({
|
|
74665
74801
|
videoId,
|
|
@@ -74710,7 +74846,7 @@ function extractedFramesFromDirectory(work, outputDir, srcPath, fps) {
|
|
|
74710
74846
|
const framePattern = `${FRAME_FILENAME_PREFIX}%05d.${work.format}`;
|
|
74711
74847
|
const framePaths = /* @__PURE__ */ new Map();
|
|
74712
74848
|
extractedFrameFileNames(outputDir, work.format).forEach((file, index) => {
|
|
74713
|
-
framePaths.set(index,
|
|
74849
|
+
framePaths.set(index, join12(outputDir, file));
|
|
74714
74850
|
});
|
|
74715
74851
|
return {
|
|
74716
74852
|
videoId: work.video.id,
|
|
@@ -74819,7 +74955,7 @@ function sliceSupersetMember(member, superset, outputDir, fps) {
|
|
|
74819
74955
|
for (let i2 = 0; i2 < frameCount; i2 += 1) {
|
|
74820
74956
|
const sourceFrame = superset.framePaths.get(member.offsetFrames + i2);
|
|
74821
74957
|
if (!sourceFrame) throw new Error(`superset frame ${member.offsetFrames + i2} missing`);
|
|
74822
|
-
linkOrCopyFrame(sourceFrame,
|
|
74958
|
+
linkOrCopyFrame(sourceFrame, join12(outputDir, frameFileName(i2 + 1, work.format)));
|
|
74823
74959
|
}
|
|
74824
74960
|
return extractedFramesFromDirectory(work, outputDir, work.videoPath, fps);
|
|
74825
74961
|
}
|
|
@@ -74831,22 +74967,22 @@ function resolveProjectRelativeSrc(src, baseDir, compiledDir) {
|
|
|
74831
74967
|
if (!candidates.includes(candidate)) candidates.push(candidate);
|
|
74832
74968
|
};
|
|
74833
74969
|
for (const variant of decodeUrlPathVariants(cleanSrc)) {
|
|
74834
|
-
const fromCompiled = compiledDir ?
|
|
74835
|
-
const fromBase =
|
|
74970
|
+
const fromCompiled = compiledDir ? join12(compiledDir, variant) : null;
|
|
74971
|
+
const fromBase = join12(baseDir, variant);
|
|
74836
74972
|
const baseAbs = resolve9(baseDir);
|
|
74837
74973
|
const fromBaseAbs = resolve9(fromBase);
|
|
74838
74974
|
if (!fromBaseAbs.startsWith(baseAbs + sep3) && fromBaseAbs !== baseAbs) {
|
|
74839
74975
|
const normalized = posix3.normalize(variant.replace(/\\/g, "/"));
|
|
74840
74976
|
const stripped = normalized.replace(/^(\.\.\/)+/, "");
|
|
74841
74977
|
if (stripped && stripped !== variant && !stripped.startsWith("..")) {
|
|
74842
|
-
if (compiledDir) addCandidate2(
|
|
74843
|
-
addCandidate2(
|
|
74978
|
+
if (compiledDir) addCandidate2(join12(compiledDir, stripped));
|
|
74979
|
+
addCandidate2(join12(baseDir, stripped));
|
|
74844
74980
|
}
|
|
74845
74981
|
}
|
|
74846
74982
|
if (fromCompiled) addCandidate2(fromCompiled);
|
|
74847
74983
|
addCandidate2(fromBase);
|
|
74848
74984
|
}
|
|
74849
|
-
return candidates.find(existsSync12) ??
|
|
74985
|
+
return candidates.find(existsSync12) ?? join12(baseDir, cleanSrc);
|
|
74850
74986
|
}
|
|
74851
74987
|
async function extractAllVideoFrames(videos, baseDir, options, signal, config, compiledDir) {
|
|
74852
74988
|
const startTime = Date.now();
|
|
@@ -74880,7 +75016,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
74880
75016
|
videoPath = resolveProjectRelativeSrc(video.src, baseDir, compiledDir);
|
|
74881
75017
|
}
|
|
74882
75018
|
if (isHttpUrl(videoPath)) {
|
|
74883
|
-
const downloadDir =
|
|
75019
|
+
const downloadDir = join12(options.outputDir, "_downloads");
|
|
74884
75020
|
mkdirSync7(downloadDir, { recursive: true });
|
|
74885
75021
|
videoPath = await downloadToTemp(videoPath, downloadDir);
|
|
74886
75022
|
}
|
|
@@ -75074,7 +75210,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
75074
75210
|
return sliceSupersetMember(
|
|
75075
75211
|
member,
|
|
75076
75212
|
superset,
|
|
75077
|
-
|
|
75213
|
+
join12(options.outputDir, work.video.id),
|
|
75078
75214
|
options.fps
|
|
75079
75215
|
);
|
|
75080
75216
|
}
|
|
@@ -75090,7 +75226,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
75090
75226
|
async function executeSupersetGroup(group) {
|
|
75091
75227
|
const first = group.members[0]?.miss.work;
|
|
75092
75228
|
if (!first) return [];
|
|
75093
|
-
const tempDir = cacheRootDir ?
|
|
75229
|
+
const tempDir = cacheRootDir ? join12(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join12(options.outputDir, group.groupId);
|
|
75094
75230
|
try {
|
|
75095
75231
|
rmSync2(tempDir, { recursive: true, force: true });
|
|
75096
75232
|
const superset = await extractVideoFramesRange(
|
|
@@ -75860,7 +75996,7 @@ var init_mediaVolumeEnvelope = __esm({
|
|
|
75860
75996
|
});
|
|
75861
75997
|
|
|
75862
75998
|
// ../engine/src/services/audioVolumeEnvelope.ts
|
|
75863
|
-
import { readFileSync as readFileSync6, renameSync as
|
|
75999
|
+
import { readFileSync as readFileSync6, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
75864
76000
|
import { randomBytes } from "crypto";
|
|
75865
76001
|
function parseWavLayout(buffer) {
|
|
75866
76002
|
if (buffer.length < 12 || buffer.toString("ascii", 0, 4) !== "RIFF") return null;
|
|
@@ -75922,7 +76058,7 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
|
|
|
75922
76058
|
}
|
|
75923
76059
|
const tempPath = `${wavPath}.${randomBytes(6).toString("hex")}.tmp`;
|
|
75924
76060
|
writeFileSync5(tempPath, buffer);
|
|
75925
|
-
|
|
76061
|
+
renameSync3(tempPath, wavPath);
|
|
75926
76062
|
return true;
|
|
75927
76063
|
} catch {
|
|
75928
76064
|
return false;
|
|
@@ -75940,7 +76076,7 @@ var init_audioVolumeEnvelope = __esm({
|
|
|
75940
76076
|
|
|
75941
76077
|
// ../engine/src/services/audioMixer.ts
|
|
75942
76078
|
import { closeSync, existsSync as existsSync13, mkdirSync as mkdirSync8, mkdtempSync, openSync, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
75943
|
-
import { isAbsolute as isAbsolute5, join as
|
|
76079
|
+
import { isAbsolute as isAbsolute5, join as join13, dirname as dirname8 } from "path";
|
|
75944
76080
|
function clampVolume(volume) {
|
|
75945
76081
|
if (!Number.isFinite(volume)) return 1;
|
|
75946
76082
|
return Math.max(0, Math.min(1, volume));
|
|
@@ -76192,8 +76328,8 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
|
|
|
76192
76328
|
const runMix = (ignoreAutomation) => {
|
|
76193
76329
|
const inputs = [];
|
|
76194
76330
|
tracks.forEach((track) => inputs.push("-i", track.srcPath));
|
|
76195
|
-
const scriptDir = mkdtempSync(
|
|
76196
|
-
const scriptPath =
|
|
76331
|
+
const scriptDir = mkdtempSync(join13(outputDir, ".filter-complex-"));
|
|
76332
|
+
const scriptPath = join13(scriptDir, "graph.txt");
|
|
76197
76333
|
const fd = openSync(scriptPath, "wx", 384);
|
|
76198
76334
|
try {
|
|
76199
76335
|
writeFileSync6(fd, buildFilterComplex(ignoreAutomation));
|
|
@@ -76292,7 +76428,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
76292
76428
|
}
|
|
76293
76429
|
let audioSrcPath = srcPath;
|
|
76294
76430
|
if (element.type === "video") {
|
|
76295
|
-
const extractedPath =
|
|
76431
|
+
const extractedPath = join13(workDir, `${element.id}-extracted.wav`);
|
|
76296
76432
|
const extractResult = await extractAudioFromVideo(
|
|
76297
76433
|
srcPath,
|
|
76298
76434
|
extractedPath,
|
|
@@ -76309,7 +76445,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
76309
76445
|
}
|
|
76310
76446
|
audioSrcPath = extractedPath;
|
|
76311
76447
|
} else {
|
|
76312
|
-
const trimmedPath =
|
|
76448
|
+
const trimmedPath = join13(workDir, `${element.id}-trimmed.wav`);
|
|
76313
76449
|
const prepResult = await prepareAudioTrack(
|
|
76314
76450
|
srcPath,
|
|
76315
76451
|
trimmedPath,
|
|
@@ -76463,7 +76599,7 @@ var init_readWebGlVendorInfoFromCanvas = __esm({
|
|
|
76463
76599
|
import { cpus, freemem } from "os";
|
|
76464
76600
|
import { existsSync as existsSync14, mkdirSync as mkdirSync9, readdirSync as readdirSync6 } from "fs";
|
|
76465
76601
|
import { copyFile, rename } from "fs/promises";
|
|
76466
|
-
import { join as
|
|
76602
|
+
import { join as join14 } from "path";
|
|
76467
76603
|
function defaultSafeMaxWorkers() {
|
|
76468
76604
|
return Math.max(6, Math.min(16, Math.floor(cpus().length / 8)));
|
|
76469
76605
|
}
|
|
@@ -76542,7 +76678,7 @@ function distributeFrames(totalFrames, workerCount, workDir, rangeStart = 0) {
|
|
|
76542
76678
|
workerId: i2,
|
|
76543
76679
|
startFrame,
|
|
76544
76680
|
endFrame,
|
|
76545
|
-
outputDir:
|
|
76681
|
+
outputDir: join14(workDir, `worker-${i2}`),
|
|
76546
76682
|
outputFrameOffset: rangeStart
|
|
76547
76683
|
});
|
|
76548
76684
|
}
|
|
@@ -76556,7 +76692,7 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
|
|
|
76556
76692
|
startFrame: rangeStart + i2,
|
|
76557
76693
|
endFrame: rangeStart + totalFrames,
|
|
76558
76694
|
frameStride: workerCount,
|
|
76559
|
-
outputDir:
|
|
76695
|
+
outputDir: join14(workDir, `worker-${i2}`),
|
|
76560
76696
|
outputFrameOffset: rangeStart
|
|
76561
76697
|
});
|
|
76562
76698
|
}
|
|
@@ -76751,8 +76887,8 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
|
|
|
76751
76887
|
}
|
|
76752
76888
|
const files = readdirSync6(task.outputDir).filter((f3) => f3.startsWith("frame_") && (f3.endsWith(".jpg") || f3.endsWith(".png"))).sort();
|
|
76753
76889
|
const copyTasks = files.map(async (file) => {
|
|
76754
|
-
const sourcePath =
|
|
76755
|
-
const targetPath =
|
|
76890
|
+
const sourcePath = join14(task.outputDir, file);
|
|
76891
|
+
const targetPath = join14(outputDir, file);
|
|
76756
76892
|
try {
|
|
76757
76893
|
await rename(sourcePath, targetPath);
|
|
76758
76894
|
} catch {
|
|
@@ -76794,7 +76930,7 @@ var init_parallelCoordinator = __esm({
|
|
|
76794
76930
|
import { Hono } from "hono";
|
|
76795
76931
|
import { serve } from "@hono/node-server";
|
|
76796
76932
|
import { readFileSync as readFileSync7, existsSync as existsSync15, statSync as statSync4 } from "fs";
|
|
76797
|
-
import { join as
|
|
76933
|
+
import { join as join15, extname as extname5 } from "path";
|
|
76798
76934
|
function createFileServer(options) {
|
|
76799
76935
|
const { projectDir, compiledDir, port = 0, stripEmbeddedRuntime = true } = options;
|
|
76800
76936
|
const headScripts = options.headScripts ?? [];
|
|
@@ -76804,11 +76940,11 @@ function createFileServer(options) {
|
|
|
76804
76940
|
let requestPath = c3.req.path;
|
|
76805
76941
|
if (requestPath === "/") requestPath = "/index.html";
|
|
76806
76942
|
const relativePath = requestPath.replace(/^\//, "");
|
|
76807
|
-
const compiledPath = compiledDir ?
|
|
76943
|
+
const compiledPath = compiledDir ? join15(compiledDir, relativePath) : null;
|
|
76808
76944
|
const hasCompiledFile = Boolean(
|
|
76809
76945
|
compiledPath && existsSync15(compiledPath) && statSync4(compiledPath).isFile()
|
|
76810
76946
|
);
|
|
76811
|
-
const filePath = hasCompiledFile ? compiledPath :
|
|
76947
|
+
const filePath = hasCompiledFile ? compiledPath : join15(projectDir, relativePath);
|
|
76812
76948
|
if (!existsSync15(filePath) || !statSync4(filePath).isFile()) {
|
|
76813
76949
|
return c3.text("Not found", 404);
|
|
76814
76950
|
}
|
|
@@ -78123,7 +78259,7 @@ var init_shaderTransitions = __esm({
|
|
|
78123
78259
|
|
|
78124
78260
|
// ../engine/src/services/hdrCapture.ts
|
|
78125
78261
|
import { existsSync as existsSync16, readdirSync as readdirSync7 } from "fs";
|
|
78126
|
-
import { join as
|
|
78262
|
+
import { join as join16 } from "path";
|
|
78127
78263
|
import { homedir as homedir3 } from "os";
|
|
78128
78264
|
function linearToPQ(L2) {
|
|
78129
78265
|
const Lp = Math.max(0, L2 * SDR_NITS / PQ_MAX_NITS);
|
|
@@ -78239,12 +78375,12 @@ function float16ToPqRgb(rawBuffer, bytesPerRow, width, height) {
|
|
|
78239
78375
|
return output;
|
|
78240
78376
|
}
|
|
78241
78377
|
function resolveHeadedChromePath() {
|
|
78242
|
-
const baseDir =
|
|
78378
|
+
const baseDir = join16(homedir3(), ".cache", "puppeteer", "chrome");
|
|
78243
78379
|
if (!existsSync16(baseDir)) return void 0;
|
|
78244
78380
|
const versions = readdirSync7(baseDir).sort().reverse();
|
|
78245
78381
|
for (const version2 of versions) {
|
|
78246
78382
|
const candidates = [
|
|
78247
|
-
|
|
78383
|
+
join16(
|
|
78248
78384
|
baseDir,
|
|
78249
78385
|
version2,
|
|
78250
78386
|
"chrome-mac-arm64",
|
|
@@ -78253,7 +78389,7 @@ function resolveHeadedChromePath() {
|
|
|
78253
78389
|
"MacOS",
|
|
78254
78390
|
"Google Chrome for Testing"
|
|
78255
78391
|
),
|
|
78256
|
-
|
|
78392
|
+
join16(
|
|
78257
78393
|
baseDir,
|
|
78258
78394
|
version2,
|
|
78259
78395
|
"chrome-mac-x64",
|
|
@@ -78262,8 +78398,8 @@ function resolveHeadedChromePath() {
|
|
|
78262
78398
|
"MacOS",
|
|
78263
78399
|
"Google Chrome for Testing"
|
|
78264
78400
|
),
|
|
78265
|
-
|
|
78266
|
-
|
|
78401
|
+
join16(baseDir, version2, "chrome-linux64", "chrome"),
|
|
78402
|
+
join16(baseDir, version2, "chrome-win64", "chrome.exe")
|
|
78267
78403
|
];
|
|
78268
78404
|
for (const binary of candidates) {
|
|
78269
78405
|
if (existsSync16(binary)) return binary;
|
|
@@ -79103,6 +79239,12 @@ function renderObservabilityEventProperties(props) {
|
|
|
79103
79239
|
capture_player_ready_timeout_ms: props.capturePlayerReadyTimeoutMs,
|
|
79104
79240
|
capture_transient_retries: props.captureTransientRetries,
|
|
79105
79241
|
capture_memory_exhaustion_detected: props.captureMemoryExhaustionDetected,
|
|
79242
|
+
de_worker_inversion: props.captureDeWorkerInversion,
|
|
79243
|
+
de_pre_inversion_workers: props.captureDePreInversionWorkers,
|
|
79244
|
+
de_parallel_router: props.captureDeParallelRouter,
|
|
79245
|
+
de_pre_router_workers: props.captureDePreRouterWorkers,
|
|
79246
|
+
de_self_verify_fallback: props.captureDeSelfVerifyFallback,
|
|
79247
|
+
de_fallback_reason: props.captureDeFallbackReason,
|
|
79106
79248
|
observability_extract_video_count: props.observabilityExtractVideoCount,
|
|
79107
79249
|
observability_extracted_video_count: props.observabilityExtractedVideoCount,
|
|
79108
79250
|
observability_extract_total_frames: props.observabilityExtractTotalFrames,
|
|
@@ -79130,6 +79272,11 @@ function trackRenderComplete(props) {
|
|
|
79130
79272
|
trackEvent(
|
|
79131
79273
|
"render_complete",
|
|
79132
79274
|
{
|
|
79275
|
+
// Spread first: explicit de_* keys below (sourced from the more
|
|
79276
|
+
// authoritative perfSummary.drawElement, always present on this
|
|
79277
|
+
// success path) must win over the observability-capture fallback
|
|
79278
|
+
// this shares with trackRenderError's failure path.
|
|
79279
|
+
...renderObservabilityEventProperties(props),
|
|
79133
79280
|
duration_ms: props.durationMs,
|
|
79134
79281
|
fps: props.fps,
|
|
79135
79282
|
quality: props.quality,
|
|
@@ -79192,8 +79339,7 @@ function trackRenderComplete(props) {
|
|
|
79192
79339
|
extract_vfr_preflight_count: props.extractVfrPreflightCount,
|
|
79193
79340
|
extract_phase3_ms: props.extractPhase3Ms,
|
|
79194
79341
|
extract_cache_hits: props.extractCacheHits,
|
|
79195
|
-
extract_cache_misses: props.extractCacheMisses
|
|
79196
|
-
...renderObservabilityEventProperties(props)
|
|
79342
|
+
extract_cache_misses: props.extractCacheMisses
|
|
79197
79343
|
},
|
|
79198
79344
|
props.distinctId
|
|
79199
79345
|
);
|
|
@@ -81523,11 +81669,11 @@ var init_banner = __esm({
|
|
|
81523
81669
|
|
|
81524
81670
|
// src/registry/remote.ts
|
|
81525
81671
|
import { mkdirSync as mkdirSync10, readFileSync as readFileSync11, writeFileSync as writeFileSync7 } from "fs";
|
|
81526
|
-
import { join as
|
|
81672
|
+
import { join as join17, dirname as dirname9 } from "path";
|
|
81527
81673
|
import { homedir as homedir4 } from "os";
|
|
81528
81674
|
function cachePath(baseUrl, key2) {
|
|
81529
81675
|
const slug = baseUrl.replace(/[^a-zA-Z0-9]/g, "_");
|
|
81530
|
-
return
|
|
81676
|
+
return join17(CACHE_DIR, `${slug}__${key2}.json`);
|
|
81531
81677
|
}
|
|
81532
81678
|
function readCache(path2) {
|
|
81533
81679
|
try {
|
|
@@ -81598,7 +81744,7 @@ var init_remote = __esm({
|
|
|
81598
81744
|
init_dist3();
|
|
81599
81745
|
DEFAULT_REGISTRY_URL = "https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry";
|
|
81600
81746
|
FETCH_TIMEOUT_MS = 1e4;
|
|
81601
|
-
CACHE_DIR =
|
|
81747
|
+
CACHE_DIR = join17(homedir4(), ".hyperframes", "cache");
|
|
81602
81748
|
CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
81603
81749
|
}
|
|
81604
81750
|
});
|
|
@@ -81876,7 +82022,7 @@ var init_compatibility = __esm({
|
|
|
81876
82022
|
|
|
81877
82023
|
// src/templates/remote.ts
|
|
81878
82024
|
import { existsSync as existsSync19 } from "fs";
|
|
81879
|
-
import { join as
|
|
82025
|
+
import { join as join18 } from "path";
|
|
81880
82026
|
async function fetchRemoteTemplate(templateId, destDir) {
|
|
81881
82027
|
const items = await resolveItemWithDependencies(templateId);
|
|
81882
82028
|
const warnings = gateRegistryItemsCompatibility(items);
|
|
@@ -81887,7 +82033,7 @@ async function fetchRemoteTemplate(templateId, destDir) {
|
|
|
81887
82033
|
for (const item of items) {
|
|
81888
82034
|
await installItem(item, { destDir });
|
|
81889
82035
|
}
|
|
81890
|
-
if (!existsSync19(
|
|
82036
|
+
if (!existsSync19(join18(destDir, "index.html"))) {
|
|
81891
82037
|
throw new Error(
|
|
81892
82038
|
`Example "${templateId}" installed but missing index.html. The registry item may be malformed.`
|
|
81893
82039
|
);
|
|
@@ -82199,7 +82345,7 @@ var init_ffmpeg = __esm({
|
|
|
82199
82345
|
});
|
|
82200
82346
|
|
|
82201
82347
|
// src/utils/download.ts
|
|
82202
|
-
import { createWriteStream as createWriteStream2, renameSync as
|
|
82348
|
+
import { createWriteStream as createWriteStream2, renameSync as renameSync4, unlinkSync } from "fs";
|
|
82203
82349
|
import { get as httpsGet } from "https";
|
|
82204
82350
|
import { pipeline } from "stream/promises";
|
|
82205
82351
|
function downloadFile(url, dest) {
|
|
@@ -82220,7 +82366,7 @@ function downloadFile(url, dest) {
|
|
|
82220
82366
|
}
|
|
82221
82367
|
const file = createWriteStream2(tmp);
|
|
82222
82368
|
pipeline(res, file).then(() => {
|
|
82223
|
-
|
|
82369
|
+
renameSync4(tmp, dest);
|
|
82224
82370
|
resolve64();
|
|
82225
82371
|
}).catch((err) => {
|
|
82226
82372
|
try {
|
|
@@ -82262,7 +82408,7 @@ __export(manager_exports, {
|
|
|
82262
82408
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
82263
82409
|
import { existsSync as existsSync22, mkdirSync as mkdirSync11, rmSync as rmSync4 } from "fs";
|
|
82264
82410
|
import { homedir as homedir5, platform as platform4 } from "os";
|
|
82265
|
-
import { join as
|
|
82411
|
+
import { join as join19 } from "path";
|
|
82266
82412
|
function isWhisperUnavailable(err) {
|
|
82267
82413
|
if (err instanceof WhisperUnavailableError) return true;
|
|
82268
82414
|
return err instanceof Error && "code" in err && err.code === "WHISPER_UNAVAILABLE";
|
|
@@ -82305,8 +82451,8 @@ function findFromSystem() {
|
|
|
82305
82451
|
}
|
|
82306
82452
|
function findBuiltBinary() {
|
|
82307
82453
|
for (const p2 of [
|
|
82308
|
-
|
|
82309
|
-
|
|
82454
|
+
join19(BUILD_DIR, "build", "bin", "whisper-cli"),
|
|
82455
|
+
join19(BUILD_DIR, "build", "whisper-cli")
|
|
82310
82456
|
]) {
|
|
82311
82457
|
if (existsSync22(p2)) return { executablePath: p2, source: "build" };
|
|
82312
82458
|
}
|
|
@@ -82318,7 +82464,7 @@ function buildFromSource(onProgress) {
|
|
|
82318
82464
|
}
|
|
82319
82465
|
if (!existsSync22(BUILD_DIR)) {
|
|
82320
82466
|
onProgress?.("Downloading whisper.cpp...");
|
|
82321
|
-
mkdirSync11(
|
|
82467
|
+
mkdirSync11(join19(homedir5(), ".cache", "hyperframes", "whisper"), {
|
|
82322
82468
|
recursive: true
|
|
82323
82469
|
});
|
|
82324
82470
|
execFileSync3("git", ["clone", "--depth", "1", WHISPER_REPO, BUILD_DIR], {
|
|
@@ -82403,7 +82549,7 @@ async function ensureWhisper(options) {
|
|
|
82403
82549
|
throw new WhisperUnavailableError(`whisper-cpp not found. Install: ${getInstallInstructions()}`);
|
|
82404
82550
|
}
|
|
82405
82551
|
async function ensureModel(model = DEFAULT_MODEL, options) {
|
|
82406
|
-
const modelPath2 =
|
|
82552
|
+
const modelPath2 = join19(MODELS_DIR, `ggml-${model}.bin`);
|
|
82407
82553
|
if (existsSync22(modelPath2)) return modelPath2;
|
|
82408
82554
|
mkdirSync11(MODELS_DIR, { recursive: true });
|
|
82409
82555
|
options?.onProgress?.(`Downloading model ${model}...`);
|
|
@@ -82422,7 +82568,7 @@ var init_manager = __esm({
|
|
|
82422
82568
|
"use strict";
|
|
82423
82569
|
init_ffmpeg();
|
|
82424
82570
|
init_download();
|
|
82425
|
-
MODELS_DIR =
|
|
82571
|
+
MODELS_DIR = join19(homedir5(), ".cache", "hyperframes", "whisper", "models");
|
|
82426
82572
|
DEFAULT_MODEL = "small.en";
|
|
82427
82573
|
WhisperUnavailableError = class extends Error {
|
|
82428
82574
|
code = "WHISPER_UNAVAILABLE";
|
|
@@ -82431,7 +82577,7 @@ var init_manager = __esm({
|
|
|
82431
82577
|
this.name = "WhisperUnavailableError";
|
|
82432
82578
|
}
|
|
82433
82579
|
};
|
|
82434
|
-
BUILD_DIR =
|
|
82580
|
+
BUILD_DIR = join19(homedir5(), ".cache", "hyperframes", "whisper", "whisper.cpp");
|
|
82435
82581
|
WHISPER_REPO = "https://github.com/ggml-org/whisper.cpp.git";
|
|
82436
82582
|
}
|
|
82437
82583
|
});
|
|
@@ -82448,7 +82594,7 @@ __export(normalize_exports, {
|
|
|
82448
82594
|
wordsToCues: () => wordsToCues
|
|
82449
82595
|
});
|
|
82450
82596
|
import { readFileSync as readFileSync14, readdirSync as readdirSync8, writeFileSync as writeFileSync9 } from "fs";
|
|
82451
|
-
import { extname as extname6, join as
|
|
82597
|
+
import { extname as extname6, join as join20 } from "path";
|
|
82452
82598
|
function detectFormat(filePath) {
|
|
82453
82599
|
const ext = extname6(filePath).toLowerCase();
|
|
82454
82600
|
if (ext === ".srt") return "srt";
|
|
@@ -82650,8 +82796,8 @@ function entriesToCues(words) {
|
|
|
82650
82796
|
function joinTokens(left, right) {
|
|
82651
82797
|
const a = left.at(-1) ?? "";
|
|
82652
82798
|
const b2 = right[0] ?? "";
|
|
82653
|
-
const
|
|
82654
|
-
return `${left}${
|
|
82799
|
+
const sep10 = CJK_CHAR.test(a) || CJK_CHAR.test(b2) ? "" : " ";
|
|
82800
|
+
return `${left}${sep10}${right}`;
|
|
82655
82801
|
}
|
|
82656
82802
|
function wordsToCues(words, opts = {}) {
|
|
82657
82803
|
const preGrouped = opts.preGrouped ?? words.some((w3) => /\s/.test(w3.text.trim()));
|
|
@@ -82725,7 +82871,7 @@ function patchCaptionHtml(dir, words) {
|
|
|
82725
82871
|
const wordsJson = JSON.stringify(words, null, 2).replace(/\n/g, "\n ");
|
|
82726
82872
|
let htmlFiles;
|
|
82727
82873
|
try {
|
|
82728
|
-
htmlFiles = readdirSync8(dir, { withFileTypes: true, recursive: true }).filter((e3) => e3.isFile() && e3.name.endsWith(".html")).map((e3) =>
|
|
82874
|
+
htmlFiles = readdirSync8(dir, { withFileTypes: true, recursive: true }).filter((e3) => e3.isFile() && e3.name.endsWith(".html")).map((e3) => join20(e3.parentPath, e3.name));
|
|
82729
82875
|
} catch {
|
|
82730
82876
|
return;
|
|
82731
82877
|
}
|
|
@@ -82766,9 +82912,9 @@ __export(projectConfig_exports, {
|
|
|
82766
82912
|
writeProjectConfig: () => writeProjectConfig
|
|
82767
82913
|
});
|
|
82768
82914
|
import { readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
|
|
82769
|
-
import { join as
|
|
82915
|
+
import { join as join21, resolve as resolve12 } from "path";
|
|
82770
82916
|
function projectConfigPath(projectDir) {
|
|
82771
|
-
return
|
|
82917
|
+
return join21(resolve12(projectDir), PROJECT_CONFIG_FILENAME);
|
|
82772
82918
|
}
|
|
82773
82919
|
function readProjectConfig(projectDir) {
|
|
82774
82920
|
const path2 = projectConfigPath(projectDir);
|
|
@@ -83063,12 +83209,12 @@ import {
|
|
|
83063
83209
|
existsSync as existsSync23,
|
|
83064
83210
|
readdirSync as readdirSync9,
|
|
83065
83211
|
readFileSync as readFileSync16,
|
|
83066
|
-
renameSync as
|
|
83212
|
+
renameSync as renameSync5,
|
|
83067
83213
|
statSync as statSync6,
|
|
83068
83214
|
writeFileSync as writeFileSync11
|
|
83069
83215
|
} from "fs";
|
|
83070
83216
|
import { homedir as homedir6 } from "os";
|
|
83071
|
-
import { isAbsolute as isAbsolute7, join as
|
|
83217
|
+
import { isAbsolute as isAbsolute7, join as join22, relative as relative5, resolve as resolve13, sep as sep4 } from "path";
|
|
83072
83218
|
import { promisify } from "util";
|
|
83073
83219
|
function isCoreSkill(name) {
|
|
83074
83220
|
return name === ENTRY_SKILL || name.startsWith("hyperframes-") || name === "media-use";
|
|
@@ -83078,7 +83224,7 @@ function listFilesSorted(dir) {
|
|
|
83078
83224
|
const walk = (d2) => {
|
|
83079
83225
|
for (const name of readdirSync9(d2)) {
|
|
83080
83226
|
if (name === ".DS_Store") continue;
|
|
83081
|
-
const p2 =
|
|
83227
|
+
const p2 = join22(d2, name);
|
|
83082
83228
|
if (statSync6(p2).isDirectory()) walk(p2);
|
|
83083
83229
|
else out.push(p2);
|
|
83084
83230
|
}
|
|
@@ -83102,9 +83248,9 @@ function hashSkillBundle(skillDir) {
|
|
|
83102
83248
|
return { hash: h3.digest("hex").slice(0, 16), files: files.length };
|
|
83103
83249
|
}
|
|
83104
83250
|
function buildManifest(skillsRoot, meta) {
|
|
83105
|
-
const names = readdirSync9(skillsRoot).filter((n2) => existsSync23(
|
|
83251
|
+
const names = readdirSync9(skillsRoot).filter((n2) => existsSync23(join22(skillsRoot, n2, "SKILL.md"))).sort();
|
|
83106
83252
|
const skills = {};
|
|
83107
|
-
for (const name of names) skills[name] = hashSkillBundle(
|
|
83253
|
+
for (const name of names) skills[name] = hashSkillBundle(join22(skillsRoot, name));
|
|
83108
83254
|
return { source: meta.source, skills };
|
|
83109
83255
|
}
|
|
83110
83256
|
function agentLabel(hostDir) {
|
|
@@ -83126,12 +83272,12 @@ function listSubdirs(dir) {
|
|
|
83126
83272
|
function discoverSkillRoots(base2, scope) {
|
|
83127
83273
|
const candidates = [];
|
|
83128
83274
|
const add2 = (hostBase, host) => {
|
|
83129
|
-
const dir =
|
|
83275
|
+
const dir = join22(hostBase, host, "skills");
|
|
83130
83276
|
if (existsSync23(dir) && statSync6(dir).isDirectory())
|
|
83131
83277
|
candidates.push({ dir, agent: agentLabel(host), scope });
|
|
83132
83278
|
};
|
|
83133
83279
|
for (const host of listSubdirs(base2)) add2(base2, host);
|
|
83134
|
-
const xdg =
|
|
83280
|
+
const xdg = join22(base2, ".config");
|
|
83135
83281
|
for (const host of listSubdirs(xdg)) add2(xdg, host);
|
|
83136
83282
|
return candidates.sort((a, b2) => {
|
|
83137
83283
|
if (a.agent !== b2.agent) {
|
|
@@ -83165,20 +83311,20 @@ function locateInstall(skillNames, opts = {}) {
|
|
|
83165
83311
|
...discoverSkillRoots(opts.cwd ?? process.cwd(), "project")
|
|
83166
83312
|
];
|
|
83167
83313
|
for (const root of roots) {
|
|
83168
|
-
if (skillNames.some((n2) => existsSync23(
|
|
83314
|
+
if (skillNames.some((n2) => existsSync23(join22(root.dir, n2, "SKILL.md")))) return root;
|
|
83169
83315
|
}
|
|
83170
83316
|
return null;
|
|
83171
83317
|
}
|
|
83172
83318
|
function presentSkills(skillNames, opts = {}) {
|
|
83173
83319
|
const root = locateInstall([...skillNames], opts);
|
|
83174
83320
|
if (!root) return [];
|
|
83175
|
-
return skillNames.filter((name) => existsSync23(
|
|
83321
|
+
return skillNames.filter((name) => existsSync23(join22(root.dir, name, "SKILL.md")));
|
|
83176
83322
|
}
|
|
83177
83323
|
function hashInstalled(root, skillNames) {
|
|
83178
83324
|
const out = {};
|
|
83179
83325
|
for (const name of skillNames) {
|
|
83180
|
-
const skillDir =
|
|
83181
|
-
if (existsSync23(
|
|
83326
|
+
const skillDir = join22(root.dir, name);
|
|
83327
|
+
if (existsSync23(join22(skillDir, "SKILL.md"))) out[name] = hashSkillBundle(skillDir);
|
|
83182
83328
|
}
|
|
83183
83329
|
return out;
|
|
83184
83330
|
}
|
|
@@ -83227,10 +83373,10 @@ function skillsAttributedToSource(lock, source) {
|
|
|
83227
83373
|
return Object.entries(lock.skills).filter(([, e3]) => repoSlug(e3.source) === want || repoSlug(e3.sourceUrl) === want).map(([name]) => name);
|
|
83228
83374
|
}
|
|
83229
83375
|
function lockPathForScope(scope, opts) {
|
|
83230
|
-
if (scope === "project") return
|
|
83376
|
+
if (scope === "project") return join22(opts.cwd ?? process.cwd(), "skills-lock.json");
|
|
83231
83377
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
83232
|
-
if (xdgStateHome) return
|
|
83233
|
-
return
|
|
83378
|
+
if (xdgStateHome) return join22(xdgStateHome, "skills", ".skill-lock.json");
|
|
83379
|
+
return join22(opts.home ?? homedir6(), ".agents", ".skill-lock.json");
|
|
83234
83380
|
}
|
|
83235
83381
|
function readSkillLock(path2) {
|
|
83236
83382
|
try {
|
|
@@ -83258,15 +83404,15 @@ function pruneOrphanedLockEntries(names, scope, opts = {}) {
|
|
|
83258
83404
|
const mode = statSync6(path2).mode & 511;
|
|
83259
83405
|
const tmp = `${path2}.tmp`;
|
|
83260
83406
|
writeFileSync11(tmp, JSON.stringify(lock, null, 2), { mode });
|
|
83261
|
-
|
|
83407
|
+
renameSync5(tmp, path2);
|
|
83262
83408
|
return pruned;
|
|
83263
83409
|
}
|
|
83264
83410
|
function findRepoManifest(cwd = process.cwd()) {
|
|
83265
83411
|
let dir = cwd;
|
|
83266
83412
|
for (let i2 = 0; i2 < 16; i2++) {
|
|
83267
|
-
const p2 =
|
|
83413
|
+
const p2 = join22(dir, MANIFEST_FILE);
|
|
83268
83414
|
if (existsSync23(p2)) return p2;
|
|
83269
|
-
const parent =
|
|
83415
|
+
const parent = join22(dir, "..");
|
|
83270
83416
|
if (parent === dir) break;
|
|
83271
83417
|
dir = parent;
|
|
83272
83418
|
}
|
|
@@ -83304,9 +83450,9 @@ async function remoteHeadSha(repoSlug2) {
|
|
|
83304
83450
|
}
|
|
83305
83451
|
}
|
|
83306
83452
|
function resolveLocalManifest(source) {
|
|
83307
|
-
const direct = source.endsWith(".json") ? source :
|
|
83453
|
+
const direct = source.endsWith(".json") ? source : join22(source, MANIFEST_FILE);
|
|
83308
83454
|
if (existsSync23(direct)) return JSON.parse(readFileSync16(direct, "utf8"));
|
|
83309
|
-
const skillsRoot = source.endsWith("skills") ? source :
|
|
83455
|
+
const skillsRoot = source.endsWith("skills") ? source : join22(source, "skills");
|
|
83310
83456
|
if (existsSync23(skillsRoot)) return buildManifest(skillsRoot, { source: skillsRoot });
|
|
83311
83457
|
throw new Error(`No skills manifest found at: ${source}`);
|
|
83312
83458
|
}
|
|
@@ -83476,22 +83622,22 @@ var init_agentDirs_generated = __esm({
|
|
|
83476
83622
|
// src/utils/skillsMirror.ts
|
|
83477
83623
|
import { cpSync, existsSync as existsSync24, mkdirSync as mkdirSync12, readdirSync as readdirSync10, rmSync as rmSync5, symlinkSync } from "fs";
|
|
83478
83624
|
import { homedir as homedir7 } from "os";
|
|
83479
|
-
import { dirname as dirname10, isAbsolute as isAbsolute8, join as
|
|
83625
|
+
import { dirname as dirname10, isAbsolute as isAbsolute8, join as join23, relative as relative6 } from "path";
|
|
83480
83626
|
function resolveBases(home, env) {
|
|
83481
83627
|
const xdg = env["XDG_CONFIG_HOME"]?.trim();
|
|
83482
83628
|
return {
|
|
83483
83629
|
home,
|
|
83484
|
-
configHome: xdg && isAbsolute8(xdg) ? xdg :
|
|
83485
|
-
codexHome: env["CODEX_HOME"]?.trim() ||
|
|
83486
|
-
claudeHome: env["CLAUDE_CONFIG_DIR"]?.trim() ||
|
|
83487
|
-
vibeHome: env["VIBE_HOME"]?.trim() ||
|
|
83488
|
-
hermesHome: env["HERMES_HOME"]?.trim() ||
|
|
83489
|
-
autohandHome: env["AUTOHAND_HOME"]?.trim() ||
|
|
83630
|
+
configHome: xdg && isAbsolute8(xdg) ? xdg : join23(home, ".config"),
|
|
83631
|
+
codexHome: env["CODEX_HOME"]?.trim() || join23(home, ".codex"),
|
|
83632
|
+
claudeHome: env["CLAUDE_CONFIG_DIR"]?.trim() || join23(home, ".claude"),
|
|
83633
|
+
vibeHome: env["VIBE_HOME"]?.trim() || join23(home, ".vibe"),
|
|
83634
|
+
hermesHome: env["HERMES_HOME"]?.trim() || join23(home, ".hermes"),
|
|
83635
|
+
autohandHome: env["AUTOHAND_HOME"]?.trim() || join23(home, ".autohand")
|
|
83490
83636
|
};
|
|
83491
83637
|
}
|
|
83492
83638
|
function listSkillDirs(store) {
|
|
83493
83639
|
return readdirSync10(store, { withFileTypes: true }).filter(
|
|
83494
|
-
(e3) => (e3.isDirectory() || e3.isSymbolicLink()) && existsSync24(
|
|
83640
|
+
(e3) => (e3.isDirectory() || e3.isSymbolicLink()) && existsSync24(join23(store, e3.name, "SKILL.md"))
|
|
83495
83641
|
).map((e3) => e3.name);
|
|
83496
83642
|
}
|
|
83497
83643
|
function linkOrCopy(sourceSkill, targetSkill, platform10) {
|
|
@@ -83510,7 +83656,7 @@ function mirrorInto(targetDir, source, skills, platform10) {
|
|
|
83510
83656
|
}
|
|
83511
83657
|
for (const skill of skills) {
|
|
83512
83658
|
try {
|
|
83513
|
-
linkOrCopy(
|
|
83659
|
+
linkOrCopy(join23(source, skill), join23(targetDir, skill), platform10);
|
|
83514
83660
|
} catch {
|
|
83515
83661
|
}
|
|
83516
83662
|
}
|
|
@@ -83520,15 +83666,15 @@ function mirrorGlobalSkills(opts) {
|
|
|
83520
83666
|
const home = opts.home ?? homedir7();
|
|
83521
83667
|
const platform10 = opts.platform ?? process.platform;
|
|
83522
83668
|
const bases = resolveBases(home, opts.env ?? process.env);
|
|
83523
|
-
const source =
|
|
83524
|
-
const universalStore =
|
|
83669
|
+
const source = join23(bases.claudeHome, "skills");
|
|
83670
|
+
const universalStore = join23(home, ".agents", "skills");
|
|
83525
83671
|
if (!existsSync24(source)) return { source: null, mirrored: [] };
|
|
83526
83672
|
const allowed = new Set(opts.skills);
|
|
83527
83673
|
const skills = listSkillDirs(source).filter((name) => allowed.has(name));
|
|
83528
83674
|
if (skills.length === 0) return { source, mirrored: [] };
|
|
83529
83675
|
const mirrored = [];
|
|
83530
83676
|
for (const { agent, base: base2, sub } of AGENT_GLOBAL_DIRS) {
|
|
83531
|
-
const targetDir =
|
|
83677
|
+
const targetDir = join23(bases[base2], ...sub.split("/").filter(Boolean));
|
|
83532
83678
|
if (targetDir === source || targetDir === universalStore) continue;
|
|
83533
83679
|
if (!existsSync24(dirname10(targetDir))) continue;
|
|
83534
83680
|
if (mirrorInto(targetDir, source, skills, platform10)) mirrored.push({ agent, dir: targetDir });
|
|
@@ -83998,7 +84144,7 @@ __export(transcribe_exports, {
|
|
|
83998
84144
|
});
|
|
83999
84145
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
84000
84146
|
import { existsSync as existsSync25, readFileSync as readFileSync17, mkdirSync as mkdirSync13, unlinkSync as unlinkSync2 } from "fs";
|
|
84001
|
-
import { join as
|
|
84147
|
+
import { join as join24, extname as extname7 } from "path";
|
|
84002
84148
|
import { tmpdir as tmpdir2 } from "os";
|
|
84003
84149
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
84004
84150
|
function detectLanguage(whisperPath, modelPath2, wavPath) {
|
|
@@ -84078,7 +84224,7 @@ function isVideoFile(filePath) {
|
|
|
84078
84224
|
return VIDEO_EXTENSIONS.has(extname7(filePath).toLowerCase());
|
|
84079
84225
|
}
|
|
84080
84226
|
function tempWavPath() {
|
|
84081
|
-
return
|
|
84227
|
+
return join24(tmpdir2(), `hyperframes-audio-${process.pid}-${randomUUID3()}.wav`);
|
|
84082
84228
|
}
|
|
84083
84229
|
function extractAudio(videoPath) {
|
|
84084
84230
|
const ffmpegPath = findFFmpeg();
|
|
@@ -84172,7 +84318,7 @@ async function transcribe(inputPath, outputDir, options) {
|
|
|
84172
84318
|
effectiveModel = multilingualModel;
|
|
84173
84319
|
}
|
|
84174
84320
|
options?.onProgress?.("Transcribing...");
|
|
84175
|
-
const outputBase =
|
|
84321
|
+
const outputBase = join24(outputDir, "transcript");
|
|
84176
84322
|
mkdirSync13(outputDir, { recursive: true });
|
|
84177
84323
|
const whisperArgs = [
|
|
84178
84324
|
"--model",
|
|
@@ -85139,6 +85285,12 @@ function renderObservabilityTelemetryPayload(observability) {
|
|
|
85139
85285
|
capturePlayerReadyTimeoutMs: capture2.playerReadyTimeoutMs,
|
|
85140
85286
|
captureTransientRetries: capture2.transientRetries,
|
|
85141
85287
|
captureMemoryExhaustionDetected: capture2.memoryExhaustionDetected,
|
|
85288
|
+
captureDeWorkerInversion: capture2.deWorkerInversion,
|
|
85289
|
+
captureDePreInversionWorkers: capture2.dePreInversionWorkers,
|
|
85290
|
+
captureDeParallelRouter: capture2.deParallelRouter,
|
|
85291
|
+
captureDePreRouterWorkers: capture2.dePreRouterWorkers,
|
|
85292
|
+
captureDeSelfVerifyFallback: capture2.deSelfVerifyFallback,
|
|
85293
|
+
captureDeFallbackReason: capture2.deFallbackReason,
|
|
85142
85294
|
observabilityExtractVideoCount: extraction?.videoCount,
|
|
85143
85295
|
observabilityExtractedVideoCount: extraction?.extractedVideoCount,
|
|
85144
85296
|
observabilityExtractTotalFrames: extraction?.totalFramesExtracted,
|
|
@@ -86664,8 +86816,8 @@ function upsertProp(ms, objNode, key2, value) {
|
|
|
86664
86816
|
if (existing) {
|
|
86665
86817
|
ms.overwrite(existing.value.start, existing.value.end, valueToCode(value));
|
|
86666
86818
|
} else {
|
|
86667
|
-
const
|
|
86668
|
-
ms.appendLeft(objNode.end - 1, `${
|
|
86819
|
+
const sep10 = objNode.properties.length > 0 ? ", " : "";
|
|
86820
|
+
ms.appendLeft(objNode.end - 1, `${sep10}${safeKey(key2)}: ${valueToCode(value)}`);
|
|
86669
86821
|
}
|
|
86670
86822
|
}
|
|
86671
86823
|
function isEditableVarKey(key2) {
|
|
@@ -87178,8 +87330,8 @@ function insertNewKeyframe(ms, kfNode, percentage, pctKey, valueCode) {
|
|
|
87178
87330
|
if (insertBeforeProp) {
|
|
87179
87331
|
ms.appendLeft(insertBeforeProp.start, `${JSON.stringify(pctKey)}: ${valueCode}, `);
|
|
87180
87332
|
} else {
|
|
87181
|
-
const
|
|
87182
|
-
ms.appendLeft(kfNode.end - 1, `${
|
|
87333
|
+
const sep10 = allProps.length > 0 ? ", " : "";
|
|
87334
|
+
ms.appendLeft(kfNode.end - 1, `${sep10}${JSON.stringify(pctKey)}: ${valueCode}`);
|
|
87183
87335
|
}
|
|
87184
87336
|
}
|
|
87185
87337
|
function collapseKeyframesToFlat(ms, varsNode, source, remainingRecord) {
|
|
@@ -87632,8 +87784,8 @@ function enableArcPath(ms, call, animation, config) {
|
|
|
87632
87784
|
const k2 = propKeyName22(p2);
|
|
87633
87785
|
return k2 !== "x" && k2 !== "y";
|
|
87634
87786
|
});
|
|
87635
|
-
const
|
|
87636
|
-
ms.appendRight(vars.start + 1, ` motionPath: ${motionPathCode}${
|
|
87787
|
+
const sep10 = survivesRemoval ? ", " : "";
|
|
87788
|
+
ms.appendRight(vars.start + 1, ` motionPath: ${motionPathCode}${sep10}`);
|
|
87637
87789
|
stripXYFromKeyframes(ms, findPropertyNode22(call.varsArg, "keyframes"));
|
|
87638
87790
|
removePropsByKey(ms, call.varsArg, /* @__PURE__ */ new Set(["x", "y"]));
|
|
87639
87791
|
return true;
|
|
@@ -91867,21 +92019,36 @@ function mintHfId2(el, assigned) {
|
|
|
91867
92019
|
assigned.add(id);
|
|
91868
92020
|
return id;
|
|
91869
92021
|
}
|
|
92022
|
+
function getChildElements2(parent) {
|
|
92023
|
+
const directChildren = Array.from(parent.children);
|
|
92024
|
+
if (directChildren.length || parent.tagName.toLowerCase() !== "template") return directChildren;
|
|
92025
|
+
const content = parent.content;
|
|
92026
|
+
if (content?.children.length) return Array.from(content.children);
|
|
92027
|
+
return directChildren;
|
|
92028
|
+
}
|
|
91870
92029
|
function isCompositionTemplate2(el) {
|
|
91871
92030
|
if (el.tagName.toLowerCase() !== "template") return false;
|
|
91872
92031
|
if (el.getAttribute("data-composition-id") !== null) return true;
|
|
91873
|
-
for (const child of
|
|
92032
|
+
for (const child of getChildElements2(el)) {
|
|
91874
92033
|
if (child.getAttribute("data-composition-id") !== null) return true;
|
|
91875
92034
|
}
|
|
91876
92035
|
return false;
|
|
91877
92036
|
}
|
|
92037
|
+
function walkCompositionDescendants2(root, visit) {
|
|
92038
|
+
const rootElement = root.nodeType === 9 ? root.documentElement : root;
|
|
92039
|
+
if (!rootElement) return;
|
|
92040
|
+
const walk = (parent) => {
|
|
92041
|
+
for (const child of getChildElements2(parent)) {
|
|
92042
|
+
const isTemplate = child.tagName.toLowerCase() === "template";
|
|
92043
|
+
if (isTemplate && !isCompositionTemplate2(child)) continue;
|
|
92044
|
+
visit(child);
|
|
92045
|
+
walk(child);
|
|
92046
|
+
}
|
|
92047
|
+
};
|
|
92048
|
+
walk(rootElement);
|
|
92049
|
+
}
|
|
91878
92050
|
function walkElements2(root, visit) {
|
|
91879
|
-
|
|
91880
|
-
const isTemplate = child.tagName.toLowerCase() === "template";
|
|
91881
|
-
if (isTemplate && !isCompositionTemplate2(child)) continue;
|
|
91882
|
-
visit(child);
|
|
91883
|
-
walkElements2(child, visit);
|
|
91884
|
-
}
|
|
92051
|
+
walkCompositionDescendants2(root, visit);
|
|
91885
92052
|
}
|
|
91886
92053
|
function ensureHfIds2(html) {
|
|
91887
92054
|
const hasDocumentShell = /<!doctype|<html[\s>]/i.test(html);
|
|
@@ -91922,7 +92089,7 @@ var init_hfIds = __esm({
|
|
|
91922
92089
|
import { execFileSync as execFileSync6 } from "child_process";
|
|
91923
92090
|
import { existsSync as existsSync29, lstatSync as lstatSync2, readdirSync as readdirSync11, realpathSync as realpathSync4 } from "fs";
|
|
91924
92091
|
import { homedir as homedir8, platform as platform5 } from "os";
|
|
91925
|
-
import { join as
|
|
92092
|
+
import { join as join25, resolve as resolve18 } from "path";
|
|
91926
92093
|
function getAllowedFontDirs() {
|
|
91927
92094
|
if (allowedDirsCache)
|
|
91928
92095
|
return allowedDirsCache;
|
|
@@ -91991,7 +92158,7 @@ function fontDirectories() {
|
|
|
91991
92158
|
const home = homedir8();
|
|
91992
92159
|
if (platform5() === "darwin") {
|
|
91993
92160
|
return [
|
|
91994
|
-
|
|
92161
|
+
join25(home, "Library", "Fonts"),
|
|
91995
92162
|
"/Library/Fonts",
|
|
91996
92163
|
"/System/Library/Fonts",
|
|
91997
92164
|
"/System/Library/Fonts/Supplemental"
|
|
@@ -91999,13 +92166,13 @@ function fontDirectories() {
|
|
|
91999
92166
|
}
|
|
92000
92167
|
if (platform5() === "win32") {
|
|
92001
92168
|
return [
|
|
92002
|
-
|
|
92003
|
-
|
|
92169
|
+
join25(process.env.WINDIR || "C:\\Windows", "Fonts"),
|
|
92170
|
+
join25(process.env.LOCALAPPDATA || join25(homedir8(), "AppData", "Local"), "Microsoft", "Windows", "Fonts")
|
|
92004
92171
|
];
|
|
92005
92172
|
}
|
|
92006
92173
|
return [
|
|
92007
|
-
|
|
92008
|
-
|
|
92174
|
+
join25(home, ".fonts"),
|
|
92175
|
+
join25(home, ".local", "share", "fonts"),
|
|
92009
92176
|
"/usr/local/share/fonts",
|
|
92010
92177
|
"/usr/share/fonts"
|
|
92011
92178
|
];
|
|
@@ -92016,7 +92183,7 @@ function collectFontFileEntries(dir, depth = 0) {
|
|
|
92016
92183
|
const entries2 = [];
|
|
92017
92184
|
try {
|
|
92018
92185
|
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
92019
|
-
const fullPath =
|
|
92186
|
+
const fullPath = join25(dir, entry.name);
|
|
92020
92187
|
if (entry.isDirectory()) {
|
|
92021
92188
|
entries2.push(...collectFontFileEntries(fullPath, depth + 1));
|
|
92022
92189
|
continue;
|
|
@@ -94827,8 +94994,8 @@ var init_gsapParser = __esm({
|
|
|
94827
94994
|
// ../studio-server/dist/index.js
|
|
94828
94995
|
import { Hono as Hono2 } from "hono";
|
|
94829
94996
|
import { readFile } from "fs/promises";
|
|
94997
|
+
import { join as join26 } from "path";
|
|
94830
94998
|
import { join as join27 } from "path";
|
|
94831
|
-
import { join as join28 } from "path";
|
|
94832
94999
|
import { readdirSync as readdirSync12 } from "fs";
|
|
94833
95000
|
import { existsSync as existsSync30, readFileSync as readFileSync19 } from "fs";
|
|
94834
95001
|
import { bodyLimit } from "hono/body-limit";
|
|
@@ -94840,7 +95007,7 @@ import {
|
|
|
94840
95007
|
unlinkSync as unlinkSync22,
|
|
94841
95008
|
rmSync as rmSync22,
|
|
94842
95009
|
statSync as statSync8,
|
|
94843
|
-
renameSync as
|
|
95010
|
+
renameSync as renameSync6,
|
|
94844
95011
|
readdirSync as readdirSync32
|
|
94845
95012
|
} from "fs";
|
|
94846
95013
|
import { resolve as resolve22, dirname as dirname12, join as join62 } from "path";
|
|
@@ -94905,7 +95072,7 @@ function walkDir(dir, prefix = "") {
|
|
|
94905
95072
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
94906
95073
|
if (IGNORE_DIRS.has(entry.name) || shouldIgnoreDir(rel)) continue;
|
|
94907
95074
|
if (entry.isDirectory()) {
|
|
94908
|
-
files.push(...walkDir(
|
|
95075
|
+
files.push(...walkDir(join27(dir, entry.name), rel));
|
|
94909
95076
|
} else {
|
|
94910
95077
|
files.push(rel);
|
|
94911
95078
|
}
|
|
@@ -94917,7 +95084,7 @@ async function filterCompositionFiles(projectDir, files) {
|
|
|
94917
95084
|
const checks = await Promise.all(
|
|
94918
95085
|
htmlFiles.map(async (f3) => {
|
|
94919
95086
|
try {
|
|
94920
|
-
const content = await readFile(
|
|
95087
|
+
const content = await readFile(join26(projectDir, f3), "utf-8");
|
|
94921
95088
|
return COMPOSITION_ID_RE.test(content);
|
|
94922
95089
|
} catch {
|
|
94923
95090
|
return false;
|
|
@@ -96827,7 +96994,7 @@ function registerFileRoutes(api, adapter2) {
|
|
|
96827
96994
|
return c3.json({ error: "already exists" }, 409);
|
|
96828
96995
|
}
|
|
96829
96996
|
ensureDir(newAbs);
|
|
96830
|
-
|
|
96997
|
+
renameSync6(res.absPath, newAbs);
|
|
96831
96998
|
const updatedFiles = updateReferences(res.project.dir, res.filePath, body.newPath);
|
|
96832
96999
|
return c3.json({ ok: true, path: body.newPath, updatedReferences: updatedFiles });
|
|
96833
97000
|
});
|
|
@@ -99719,7 +99886,7 @@ import { serve as serve2 } from "@hono/node-server";
|
|
|
99719
99886
|
import { existsSync as existsSync33, realpathSync as realpathSync5, statSync as statSync9, createReadStream } from "fs";
|
|
99720
99887
|
import { readFile as readFile2 } from "fs/promises";
|
|
99721
99888
|
import { Readable as Readable2 } from "stream";
|
|
99722
|
-
import { join as
|
|
99889
|
+
import { join as join28, extname as extname9, resolve as resolve21, sep as sep5 } from "path";
|
|
99723
99890
|
function isPathInside2(child, parent, options = {}) {
|
|
99724
99891
|
const { resolveSymlinks = false, pathModule } = options;
|
|
99725
99892
|
const resolveFn = pathModule?.resolve ?? resolve21;
|
|
@@ -100063,13 +100230,13 @@ function createFileServer2(options) {
|
|
|
100063
100230
|
}).join("/");
|
|
100064
100231
|
let filePath = null;
|
|
100065
100232
|
if (compiledDir) {
|
|
100066
|
-
const candidate =
|
|
100233
|
+
const candidate = join28(compiledDir, relativePath);
|
|
100067
100234
|
if (existsSync33(candidate) && isPathInside2(candidate, compiledDir) && statSync9(candidate).isFile()) {
|
|
100068
100235
|
filePath = candidate;
|
|
100069
100236
|
}
|
|
100070
100237
|
}
|
|
100071
100238
|
if (!filePath) {
|
|
100072
|
-
const candidate =
|
|
100239
|
+
const candidate = join28(projectDir, relativePath);
|
|
100073
100240
|
if (existsSync33(candidate) && isPathInside2(candidate, projectDir) && statSync9(candidate).isFile()) {
|
|
100074
100241
|
filePath = candidate;
|
|
100075
100242
|
}
|
|
@@ -100294,7 +100461,7 @@ var init_fileServer2 = __esm({
|
|
|
100294
100461
|
// ../producer/src/utils/paths.ts
|
|
100295
100462
|
import {
|
|
100296
100463
|
basename as basename4,
|
|
100297
|
-
join as
|
|
100464
|
+
join as join29,
|
|
100298
100465
|
resolve as nodeResolve,
|
|
100299
100466
|
relative as nodeRelative,
|
|
100300
100467
|
isAbsolute as nodeIsAbsolute
|
|
@@ -100329,7 +100496,7 @@ function formatExportFrameName(index, ext) {
|
|
|
100329
100496
|
function resolveRenderPaths(projectDir, outputPath, rendersDir = DEFAULT_RENDERS_DIR) {
|
|
100330
100497
|
const absoluteProjectDir = nodeResolve(projectDir);
|
|
100331
100498
|
const projectName = basename4(absoluteProjectDir);
|
|
100332
|
-
const resolvedOutputPath = outputPath ??
|
|
100499
|
+
const resolvedOutputPath = outputPath ?? join29(rendersDir, `${projectName}.mp4`);
|
|
100333
100500
|
const absoluteOutputPath = nodeResolve(resolvedOutputPath);
|
|
100334
100501
|
return { absoluteProjectDir, absoluteOutputPath };
|
|
100335
100502
|
}
|
|
@@ -100353,7 +100520,7 @@ import {
|
|
|
100353
100520
|
symlinkSync as symlinkSync2,
|
|
100354
100521
|
writeFileSync as writeFileSync13
|
|
100355
100522
|
} from "fs";
|
|
100356
|
-
import { basename as basename5, dirname as dirname14, isAbsolute as isAbsolute10, join as
|
|
100523
|
+
import { basename as basename5, dirname as dirname14, isAbsolute as isAbsolute10, join as join30, relative as relative8, resolve as resolve23 } from "path";
|
|
100357
100524
|
function writeFileExclusiveSync(path2, data2) {
|
|
100358
100525
|
try {
|
|
100359
100526
|
writeFileSync13(path2, data2, { flag: "wx", mode: 384 });
|
|
@@ -100381,16 +100548,16 @@ function resolveDeviceScaleFactor(input2) {
|
|
|
100381
100548
|
return target.width / input2.compositionWidth;
|
|
100382
100549
|
}
|
|
100383
100550
|
function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
100384
|
-
const compileDir =
|
|
100551
|
+
const compileDir = join30(workDir, "compiled");
|
|
100385
100552
|
mkdirSync15(compileDir, { recursive: true });
|
|
100386
|
-
writeFileSync13(
|
|
100553
|
+
writeFileSync13(join30(compileDir, "index.html"), compiled.html, "utf-8");
|
|
100387
100554
|
for (const [srcPath, html] of compiled.subCompositions) {
|
|
100388
|
-
const outPath =
|
|
100555
|
+
const outPath = join30(compileDir, srcPath);
|
|
100389
100556
|
mkdirSync15(dirname14(outPath), { recursive: true });
|
|
100390
100557
|
writeFileSync13(outPath, html, "utf-8");
|
|
100391
100558
|
}
|
|
100392
100559
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
100393
|
-
const outPath = resolve23(
|
|
100560
|
+
const outPath = resolve23(join30(compileDir, relativePath));
|
|
100394
100561
|
if (!isPathInside3(outPath, compileDir)) {
|
|
100395
100562
|
console.warn(`[Render] Skipping external asset with unsafe path: ${relativePath}`);
|
|
100396
100563
|
continue;
|
|
@@ -100421,7 +100588,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
100421
100588
|
renderModeHints: compiled.renderModeHints,
|
|
100422
100589
|
hasShaderTransitions: compiled.hasShaderTransitions
|
|
100423
100590
|
};
|
|
100424
|
-
writeFileSync13(
|
|
100591
|
+
writeFileSync13(join30(compileDir, "summary.json"), JSON.stringify(summary, null, 2), "utf-8");
|
|
100425
100592
|
}
|
|
100426
100593
|
}
|
|
100427
100594
|
function applyRenderModeHints(alreadyForced, compiled, log2 = defaultLogger) {
|
|
@@ -100544,7 +100711,7 @@ var init_shared = __esm({
|
|
|
100544
100711
|
BROWSER_MEDIA_EPSILON = 1e-4;
|
|
100545
100712
|
materializePathModule = {
|
|
100546
100713
|
resolve: resolve23,
|
|
100547
|
-
join:
|
|
100714
|
+
join: join30,
|
|
100548
100715
|
dirname: dirname14,
|
|
100549
100716
|
basename: basename5,
|
|
100550
100717
|
relative: relative8,
|
|
@@ -100968,7 +101135,7 @@ var init_captureBeyondViewport = __esm({
|
|
|
100968
101135
|
});
|
|
100969
101136
|
|
|
100970
101137
|
// ../producer/src/services/render/captureCost.ts
|
|
100971
|
-
import { join as
|
|
101138
|
+
import { join as join31 } from "path";
|
|
100972
101139
|
function estimateCaptureCostMultiplier(compiled) {
|
|
100973
101140
|
let multiplier = 1;
|
|
100974
101141
|
const reasons = [];
|
|
@@ -101195,7 +101362,7 @@ async function runCaptureCalibration(input2) {
|
|
|
101195
101362
|
});
|
|
101196
101363
|
let calibration;
|
|
101197
101364
|
try {
|
|
101198
|
-
calibration = await runOneCalibration(
|
|
101365
|
+
calibration = await runOneCalibration(join31(workDir, "capture-calibration"), calibrationCfg);
|
|
101199
101366
|
} catch (error) {
|
|
101200
101367
|
const shouldFallback = !forceScreenshot && shouldFallbackToScreenshotAfterCalibrationError(error);
|
|
101201
101368
|
if (!shouldFallback) {
|
|
@@ -101228,7 +101395,7 @@ async function runCaptureCalibration(input2) {
|
|
|
101228
101395
|
const screenshotCfg = createCaptureCalibrationConfig({ ...cfg, forceScreenshot: true });
|
|
101229
101396
|
try {
|
|
101230
101397
|
calibration = await runOneCalibration(
|
|
101231
|
-
|
|
101398
|
+
join31(workDir, "capture-calibration-screenshot"),
|
|
101232
101399
|
screenshotCfg
|
|
101233
101400
|
);
|
|
101234
101401
|
} catch (fallbackError) {
|
|
@@ -104744,7 +104911,7 @@ __export(deterministicFonts_exports, {
|
|
|
104744
104911
|
import { createHash as createHash8 } from "crypto";
|
|
104745
104912
|
import { existsSync as existsSync35, mkdirSync as mkdirSync16, readFileSync as readFileSync21, writeFileSync as writeFileSync14 } from "fs";
|
|
104746
104913
|
import { homedir as homedir10, tmpdir as tmpdir4 } from "os";
|
|
104747
|
-
import { join as
|
|
104914
|
+
import { join as join33 } from "path";
|
|
104748
104915
|
import postcss4 from "postcss";
|
|
104749
104916
|
function parseFontFamilyValue(value) {
|
|
104750
104917
|
return value.split(",").map((piece) => piece.trim().replace(/^['"]/, "").replace(/['"]$/, "").trim()).filter((piece) => piece.length > 0);
|
|
@@ -105061,13 +105228,13 @@ function warnUnresolvedFonts(unresolved) {
|
|
|
105061
105228
|
);
|
|
105062
105229
|
}
|
|
105063
105230
|
function resolveFontCacheRoot() {
|
|
105064
|
-
return process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ?
|
|
105231
|
+
return process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ? join33(tmpdir4(), "hyperframes", "fonts") : join33(homedir10(), ".cache", "hyperframes", "fonts"));
|
|
105065
105232
|
}
|
|
105066
105233
|
function fontSlug(familyName) {
|
|
105067
105234
|
return familyName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
105068
105235
|
}
|
|
105069
105236
|
function fontCacheDir(slug) {
|
|
105070
|
-
const dir =
|
|
105237
|
+
const dir = join33(GOOGLE_FONTS_CACHE_DIR, slug);
|
|
105071
105238
|
if (!existsSync35(dir)) {
|
|
105072
105239
|
mkdirSync16(dir, { recursive: true });
|
|
105073
105240
|
}
|
|
@@ -105077,7 +105244,7 @@ function subsetToken(woff2Url) {
|
|
|
105077
105244
|
return createHash8("sha1").update(woff2Url).digest("hex").slice(0, 12);
|
|
105078
105245
|
}
|
|
105079
105246
|
function cachedWoff2Path(slug, weight, style, subset) {
|
|
105080
|
-
return
|
|
105247
|
+
return join33(fontCacheDir(slug), `${weight}-${style}-${subset}.woff2`);
|
|
105081
105248
|
}
|
|
105082
105249
|
function fontFetchError(familyName, url, what, cause) {
|
|
105083
105250
|
const reason = "status" in cause ? `returned HTTP ${cause.status}` : `failed: ${cause.error.message}`;
|
|
@@ -105344,11 +105511,11 @@ import {
|
|
|
105344
105511
|
existsSync as existsSync36,
|
|
105345
105512
|
mkdirSync as mkdirSync17,
|
|
105346
105513
|
readFileSync as readFileSync23,
|
|
105347
|
-
renameSync as
|
|
105514
|
+
renameSync as renameSync7,
|
|
105348
105515
|
rmSync as rmSync9,
|
|
105349
105516
|
statSync as statSync10
|
|
105350
105517
|
} from "fs";
|
|
105351
|
-
import { dirname as dirname15, isAbsolute as isAbsolute11, join as
|
|
105518
|
+
import { dirname as dirname15, isAbsolute as isAbsolute11, join as join34, resolve as resolve24 } from "path";
|
|
105352
105519
|
function splitUrlSuffix2(src) {
|
|
105353
105520
|
const queryIdx = src.indexOf("?");
|
|
105354
105521
|
const hashIdx = src.indexOf("#");
|
|
@@ -105534,7 +105701,7 @@ async function ensurePreparedWebm(input2) {
|
|
|
105534
105701
|
throw new Error("Animated GIF transcode produced an empty output");
|
|
105535
105702
|
}
|
|
105536
105703
|
if (!isUsableFile(input2.cachePath)) {
|
|
105537
|
-
|
|
105704
|
+
renameSync7(tmpPath, input2.cachePath);
|
|
105538
105705
|
} else {
|
|
105539
105706
|
rmSync9(tmpPath, { force: true });
|
|
105540
105707
|
}
|
|
@@ -105595,7 +105762,7 @@ function replaceImageWithVideo(input2) {
|
|
|
105595
105762
|
return video;
|
|
105596
105763
|
}
|
|
105597
105764
|
async function prepareAnimatedGifInputs(html, options) {
|
|
105598
|
-
const outputDir = options.outputDir ??
|
|
105765
|
+
const outputDir = options.outputDir ?? join34(options.downloadDir, PREPARED_GIF_SUBDIR);
|
|
105599
105766
|
const outputSrcPrefix = normalizeRelPath(options.outputSrcPrefix ?? PREPARED_GIF_SUBDIR);
|
|
105600
105767
|
const cacheDir = options.cacheDir ?? outputDir;
|
|
105601
105768
|
const { document: document2 } = parseHTML(html);
|
|
@@ -105617,8 +105784,8 @@ async function prepareAnimatedGifInputs(html, options) {
|
|
|
105617
105784
|
const { loopIterations, padSeconds } = resolvePreparedPlayback(metadata, loop, windowSeconds);
|
|
105618
105785
|
const hash2 = computePreparedGifHash(bytes, loopIterations, padSeconds);
|
|
105619
105786
|
const filename = `${CACHE_SCHEMA}-${hash2.slice(0, 24)}.webm`;
|
|
105620
|
-
const cachePath2 =
|
|
105621
|
-
const outputPath =
|
|
105787
|
+
const cachePath2 = join34(cacheDir, filename);
|
|
105788
|
+
const outputPath = join34(outputDir, filename);
|
|
105622
105789
|
const outputSrc = `${outputSrcPrefix}/${filename}`;
|
|
105623
105790
|
await ensurePreparedWebm({
|
|
105624
105791
|
sourcePath,
|
|
@@ -105974,7 +106141,7 @@ var init_position_edits_render_inline = __esm({
|
|
|
105974
106141
|
|
|
105975
106142
|
// ../producer/src/services/htmlCompiler.ts
|
|
105976
106143
|
import { readFileSync as readFileSync24, existsSync as existsSync37, mkdirSync as mkdirSync18 } from "fs";
|
|
105977
|
-
import { join as
|
|
106144
|
+
import { join as join35, dirname as dirname16, resolve as resolve25, basename as basename6 } from "path";
|
|
105978
106145
|
function parseSubCompHtmlForValidity(html) {
|
|
105979
106146
|
return parseHTML(html).document;
|
|
105980
106147
|
}
|
|
@@ -106106,7 +106273,7 @@ async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagNa
|
|
|
106106
106273
|
return { duration: 0, resolvedPath: src };
|
|
106107
106274
|
}
|
|
106108
106275
|
} else if (!filePath.startsWith("/")) {
|
|
106109
|
-
filePath =
|
|
106276
|
+
filePath = join35(baseDir, filePath);
|
|
106110
106277
|
}
|
|
106111
106278
|
if (!existsSync37(filePath)) {
|
|
106112
106279
|
return { duration: 0, resolvedPath: filePath };
|
|
@@ -106648,7 +106815,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
|
|
|
106648
106815
|
return downloadAndRewriteUrls(
|
|
106649
106816
|
urlSet,
|
|
106650
106817
|
html,
|
|
106651
|
-
|
|
106818
|
+
join35(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
106652
106819
|
"Remote media download failed for",
|
|
106653
106820
|
"Localized remote media source(s)"
|
|
106654
106821
|
);
|
|
@@ -106663,7 +106830,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
|
|
|
106663
106830
|
return downloadAndRewriteUrls(
|
|
106664
106831
|
urlSet,
|
|
106665
106832
|
html,
|
|
106666
|
-
|
|
106833
|
+
join35(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
106667
106834
|
"Remote image download failed for",
|
|
106668
106835
|
"Localized remote image source(s)"
|
|
106669
106836
|
);
|
|
@@ -106678,7 +106845,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
|
|
|
106678
106845
|
return downloadAndRewriteUrls(
|
|
106679
106846
|
urlSet,
|
|
106680
106847
|
html,
|
|
106681
|
-
|
|
106848
|
+
join35(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
106682
106849
|
"Remote background-image download failed for",
|
|
106683
106850
|
"Localized remote background-image(s)",
|
|
106684
106851
|
// Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
|
|
@@ -106830,7 +106997,7 @@ async function localizeRemoteFontFaces(html, downloadDir) {
|
|
|
106830
106997
|
return downloadAndRewriteUrls(
|
|
106831
106998
|
urlSet,
|
|
106832
106999
|
processed,
|
|
106833
|
-
|
|
107000
|
+
join35(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
106834
107001
|
"Remote font download failed for",
|
|
106835
107002
|
"Localized remote font face(s)",
|
|
106836
107003
|
(h3, url, relPath) => h3.replaceAll(`url(${url})`, `url("${relPath}")`)
|
|
@@ -107312,7 +107479,7 @@ Check that each file referenced by data-composition-src contains valid HTML with
|
|
|
107312
107479
|
});
|
|
107313
107480
|
|
|
107314
107481
|
// ../producer/src/services/render/stages/compileStage.ts
|
|
107315
|
-
import { join as
|
|
107482
|
+
import { join as join36 } from "path";
|
|
107316
107483
|
async function runCompileStage(input2) {
|
|
107317
107484
|
const {
|
|
107318
107485
|
projectDir,
|
|
@@ -107328,12 +107495,12 @@ async function runCompileStage(input2) {
|
|
|
107328
107495
|
allowSystemFontCapture
|
|
107329
107496
|
} = input2;
|
|
107330
107497
|
const compileStart = Date.now();
|
|
107331
|
-
const compiled = await compileForRender(projectDir, htmlPath,
|
|
107498
|
+
const compiled = await compileForRender(projectDir, htmlPath, join36(workDir, "downloads"), {
|
|
107332
107499
|
log: log2,
|
|
107333
107500
|
failClosedFontFetch: failClosedFontFetch === true,
|
|
107334
107501
|
allowSystemFontCapture,
|
|
107335
107502
|
variables: input2.variables,
|
|
107336
|
-
animatedGifCacheDir: cfg.extractCacheDir ?
|
|
107503
|
+
animatedGifCacheDir: cfg.extractCacheDir ? join36(cfg.extractCacheDir, "animated-gif") : void 0,
|
|
107337
107504
|
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout
|
|
107338
107505
|
});
|
|
107339
107506
|
assertNotAborted();
|
|
@@ -107426,7 +107593,7 @@ var init_compileStage = __esm({
|
|
|
107426
107593
|
});
|
|
107427
107594
|
|
|
107428
107595
|
// ../producer/src/services/render/stages/probeStage.ts
|
|
107429
|
-
import { join as
|
|
107596
|
+
import { join as join37 } from "path";
|
|
107430
107597
|
function hasScriptedAudioVolumeAutomation(html, audioCount) {
|
|
107431
107598
|
if (audioCount <= 0) return false;
|
|
107432
107599
|
const { document: document2 } = parseHTML(html);
|
|
@@ -107480,7 +107647,7 @@ async function runProbeStage(input2) {
|
|
|
107480
107647
|
});
|
|
107481
107648
|
fileServer = await createFileServer2({
|
|
107482
107649
|
projectDir,
|
|
107483
|
-
compiledDir:
|
|
107650
|
+
compiledDir: join37(workDir, "compiled"),
|
|
107484
107651
|
port: 0,
|
|
107485
107652
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
107486
107653
|
fps: job.config.fps
|
|
@@ -107501,7 +107668,7 @@ async function runProbeStage(input2) {
|
|
|
107501
107668
|
log2.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
|
|
107502
107669
|
probeSession = await createCaptureSession(
|
|
107503
107670
|
fileServer.url,
|
|
107504
|
-
|
|
107671
|
+
join37(workDir, "probe"),
|
|
107505
107672
|
captureOpts,
|
|
107506
107673
|
null,
|
|
107507
107674
|
probeCfg
|
|
@@ -107585,7 +107752,7 @@ async function runProbeStage(input2) {
|
|
|
107585
107752
|
});
|
|
107586
107753
|
probeSession = await createCaptureSession(
|
|
107587
107754
|
fileServer.url,
|
|
107588
|
-
|
|
107755
|
+
join37(workDir, "probe-screenshot"),
|
|
107589
107756
|
captureOpts,
|
|
107590
107757
|
null,
|
|
107591
107758
|
{ ...probeCfg, forceScreenshot: true }
|
|
@@ -107620,7 +107787,7 @@ async function runProbeStage(input2) {
|
|
|
107620
107787
|
compiled,
|
|
107621
107788
|
resolutions,
|
|
107622
107789
|
projectDir,
|
|
107623
|
-
|
|
107790
|
+
join37(workDir, "downloads")
|
|
107624
107791
|
);
|
|
107625
107792
|
assertNotAborted();
|
|
107626
107793
|
composition.videos = compiled.videos;
|
|
@@ -107854,7 +108021,7 @@ var init_probeStage = __esm({
|
|
|
107854
108021
|
|
|
107855
108022
|
// ../producer/src/services/render/stages/extractVideosStage.ts
|
|
107856
108023
|
import { existsSync as existsSync38 } from "fs";
|
|
107857
|
-
import { isAbsolute as isAbsolute12, join as
|
|
108024
|
+
import { isAbsolute as isAbsolute12, join as join38 } from "path";
|
|
107858
108025
|
function shouldCopyExtractedFrames(platform10) {
|
|
107859
108026
|
return platform10 === "win32";
|
|
107860
108027
|
}
|
|
@@ -107900,7 +108067,7 @@ async function runExtractVideosStage(input2) {
|
|
|
107900
108067
|
composition.images.map(async (img) => {
|
|
107901
108068
|
let imgPath = img.src;
|
|
107902
108069
|
if (!imgPath.startsWith("/")) {
|
|
107903
|
-
const fromCompiled = existsSync38(
|
|
108070
|
+
const fromCompiled = existsSync38(join38(compiledDir, imgPath)) ? join38(compiledDir, imgPath) : join38(projectDir, imgPath);
|
|
107904
108071
|
imgPath = fromCompiled;
|
|
107905
108072
|
}
|
|
107906
108073
|
if (!existsSync38(imgPath)) return null;
|
|
@@ -107930,7 +108097,7 @@ async function runExtractVideosStage(input2) {
|
|
|
107930
108097
|
// output framerate exact.
|
|
107931
108098
|
{
|
|
107932
108099
|
fps: fpsToNumber(job.config.fps),
|
|
107933
|
-
outputDir:
|
|
108100
|
+
outputDir: join38(compiledDir, "__hyperframes_video_frames"),
|
|
107934
108101
|
format: job.config.videoFrameFormat ?? "auto"
|
|
107935
108102
|
},
|
|
107936
108103
|
abortSignal,
|
|
@@ -107996,18 +108163,18 @@ var init_extractVideosStage = __esm({
|
|
|
107996
108163
|
});
|
|
107997
108164
|
|
|
107998
108165
|
// ../producer/src/services/render/stages/audioStage.ts
|
|
107999
|
-
import { join as
|
|
108166
|
+
import { join as join39 } from "path";
|
|
108000
108167
|
async function runAudioStage(input2) {
|
|
108001
108168
|
const { projectDir, workDir, compiledDir, duration, audios, abortSignal, assertNotAborted } = input2;
|
|
108002
108169
|
const stage3Start = Date.now();
|
|
108003
|
-
const audioOutputPath =
|
|
108170
|
+
const audioOutputPath = join39(workDir, "audio.aac");
|
|
108004
108171
|
let hasAudio = false;
|
|
108005
108172
|
let audioError;
|
|
108006
108173
|
if (audios.length > 0) {
|
|
108007
108174
|
const audioResult = await processCompositionAudio(
|
|
108008
108175
|
audios,
|
|
108009
108176
|
projectDir,
|
|
108010
|
-
|
|
108177
|
+
join39(workDir, "audio-work"),
|
|
108011
108178
|
audioOutputPath,
|
|
108012
108179
|
duration,
|
|
108013
108180
|
abortSignal,
|
|
@@ -108193,7 +108360,7 @@ var init_captureStage = __esm({
|
|
|
108193
108360
|
|
|
108194
108361
|
// ../producer/src/services/hdrCompositor.ts
|
|
108195
108362
|
import { readSync as readSync2, closeSync as closeSync3 } from "fs";
|
|
108196
|
-
import { join as
|
|
108363
|
+
import { join as join40 } from "path";
|
|
108197
108364
|
function countNonZeroAlpha(rgba) {
|
|
108198
108365
|
let n2 = 0;
|
|
108199
108366
|
for (let p2 = 3; p2 < rgba.length; p2 += 4) {
|
|
@@ -108587,7 +108754,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
108587
108754
|
if (shouldLog && debugDumpDir) {
|
|
108588
108755
|
const after2 = countNonZeroRgb48(canvas);
|
|
108589
108756
|
const dumpName = `frame_${String(debugFrameIndex).padStart(4, "0")}_layer_${String(layerIdx).padStart(2, "0")}_dom.png`;
|
|
108590
|
-
const dumpPath =
|
|
108757
|
+
const dumpPath = join40(debugDumpDir, dumpName);
|
|
108591
108758
|
writeFileExclusiveSync(dumpPath, domPng);
|
|
108592
108759
|
log2.info("[diag] dom layer blit", {
|
|
108593
108760
|
frame: debugFrameIndex,
|
|
@@ -108889,13 +109056,13 @@ var init_captureHdrFrameShared = __esm({
|
|
|
108889
109056
|
import { execFile as execFile3 } from "child_process";
|
|
108890
109057
|
import { mkdtemp, rm, writeFile } from "fs/promises";
|
|
108891
109058
|
import { tmpdir as tmpdir5 } from "os";
|
|
108892
|
-
import { join as
|
|
109059
|
+
import { join as join41 } from "path";
|
|
108893
109060
|
import { promisify as promisify3 } from "util";
|
|
108894
109061
|
async function psnrDb(a, b2) {
|
|
108895
|
-
const dir = await mkdtemp(
|
|
109062
|
+
const dir = await mkdtemp(join41(tmpdir5(), "hf-de-verify-"));
|
|
108896
109063
|
try {
|
|
108897
|
-
const pa =
|
|
108898
|
-
const pb =
|
|
109064
|
+
const pa = join41(dir, "a.jpg");
|
|
109065
|
+
const pb = join41(dir, "b.jpg");
|
|
108899
109066
|
await Promise.all([writeFile(pa, a), writeFile(pb, b2)]);
|
|
108900
109067
|
const { stderr } = await execFileP(
|
|
108901
109068
|
getFfmpegBinary(),
|
|
@@ -108982,11 +109149,11 @@ function createDrainFrameGuard(args) {
|
|
|
108982
109149
|
return buf;
|
|
108983
109150
|
}
|
|
108984
109151
|
if (db < verifyMinDb) {
|
|
108985
|
-
const dumpDir = await mkdtemp(
|
|
109152
|
+
const dumpDir = await mkdtemp(join41(tmpdir5(), "hf-de-verify-fail-")).catch(() => null);
|
|
108986
109153
|
if (dumpDir) {
|
|
108987
109154
|
await Promise.all([
|
|
108988
|
-
writeFile(
|
|
108989
|
-
writeFile(
|
|
109155
|
+
writeFile(join41(dumpDir, `frame-${idx}-de.jpg`), buf),
|
|
109156
|
+
writeFile(join41(dumpDir, `frame-${idx}-truth.jpg`), truth)
|
|
108990
109157
|
]).catch(() => {
|
|
108991
109158
|
});
|
|
108992
109159
|
}
|
|
@@ -109401,7 +109568,7 @@ import {
|
|
|
109401
109568
|
openSync as openSync3,
|
|
109402
109569
|
readFileSync as readFileSync25
|
|
109403
109570
|
} from "fs";
|
|
109404
|
-
import { join as
|
|
109571
|
+
import { join as join43 } from "path";
|
|
109405
109572
|
function tempDirSafePrefix(id) {
|
|
109406
109573
|
const safe = id.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 80);
|
|
109407
109574
|
return safe || "video";
|
|
@@ -109414,8 +109581,8 @@ function planHdrResources(args) {
|
|
|
109414
109581
|
if (!hdrVideoIds.includes(v2.id)) continue;
|
|
109415
109582
|
let srcPath = v2.src;
|
|
109416
109583
|
if (!srcPath.startsWith("/")) {
|
|
109417
|
-
const fromCompiled =
|
|
109418
|
-
srcPath = args.existsSync(fromCompiled) ? fromCompiled :
|
|
109584
|
+
const fromCompiled = join43(compiledDir, srcPath);
|
|
109585
|
+
srcPath = args.existsSync(fromCompiled) ? fromCompiled : join43(projectDir, srcPath);
|
|
109419
109586
|
}
|
|
109420
109587
|
hdrVideoSrcPaths.set(v2.id, srcPath);
|
|
109421
109588
|
}
|
|
@@ -109489,10 +109656,10 @@ async function extractHdrVideoFrames(args) {
|
|
|
109489
109656
|
const video = composition.videos.find((v2) => v2.id === videoId);
|
|
109490
109657
|
if (!video) continue;
|
|
109491
109658
|
mkdirSync19(framesDir, { recursive: true });
|
|
109492
|
-
const frameDir = mkdtempSync3(
|
|
109659
|
+
const frameDir = mkdtempSync3(join43(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
|
|
109493
109660
|
const duration = video.end - video.start;
|
|
109494
109661
|
const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
|
|
109495
|
-
const rawPath =
|
|
109662
|
+
const rawPath = join43(frameDir, "frames.rgb48le");
|
|
109496
109663
|
const ffmpegArgs = [
|
|
109497
109664
|
"-ss",
|
|
109498
109665
|
String(video.mediaStart),
|
|
@@ -109603,7 +109770,7 @@ var init_captureHdrResources = __esm({
|
|
|
109603
109770
|
});
|
|
109604
109771
|
|
|
109605
109772
|
// ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
|
|
109606
|
-
import { join as
|
|
109773
|
+
import { join as join44 } from "path";
|
|
109607
109774
|
async function runSequentialLayeredFrameLoop(input2) {
|
|
109608
109775
|
const {
|
|
109609
109776
|
job,
|
|
@@ -109724,7 +109891,7 @@ async function runSequentialLayeredFrameLoop(input2) {
|
|
|
109724
109891
|
);
|
|
109725
109892
|
if (debugDumpEnabled && debugDumpDir && i2 % 30 === 0) {
|
|
109726
109893
|
writeFileExclusiveSync(
|
|
109727
|
-
|
|
109894
|
+
join44(debugDumpDir, `frame_${String(i2).padStart(4, "0")}_final_rgb48le.bin`),
|
|
109728
109895
|
normalCanvas
|
|
109729
109896
|
);
|
|
109730
109897
|
}
|
|
@@ -109771,7 +109938,7 @@ var init_captureHdrSequentialLoop = __esm({
|
|
|
109771
109938
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
109772
109939
|
import { Worker as Worker2 } from "worker_threads";
|
|
109773
109940
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
|
|
109774
|
-
import { dirname as dirname17, join as
|
|
109941
|
+
import { dirname as dirname17, join as join45 } from "path";
|
|
109775
109942
|
import { createRequire } from "module";
|
|
109776
109943
|
import { existsSync as existsSync39 } from "fs";
|
|
109777
109944
|
import { cpus as cpus3 } from "os";
|
|
@@ -109785,9 +109952,9 @@ function resolveWorkerEntry(explicit) {
|
|
|
109785
109952
|
return { path: override, isTs };
|
|
109786
109953
|
}
|
|
109787
109954
|
const moduleDir = dirname17(fileURLToPath4(import.meta.url));
|
|
109788
|
-
const jsPath =
|
|
109955
|
+
const jsPath = join45(moduleDir, "shaderTransitionWorker.js");
|
|
109789
109956
|
if (existsSync39(jsPath)) return { path: jsPath, isTs: false };
|
|
109790
|
-
const tsPath =
|
|
109957
|
+
const tsPath = join45(moduleDir, "shaderTransitionWorker.ts");
|
|
109791
109958
|
return { path: tsPath, isTs: true };
|
|
109792
109959
|
}
|
|
109793
109960
|
function buildExecArgv(entryIsTs) {
|
|
@@ -109970,7 +110137,7 @@ var init_shaderTransitionWorkerPool = __esm({
|
|
|
109970
110137
|
});
|
|
109971
110138
|
|
|
109972
110139
|
// ../producer/src/services/render/stages/captureHdrHybridLoop.ts
|
|
109973
|
-
import { join as
|
|
110140
|
+
import { join as join46 } from "path";
|
|
109974
110141
|
async function runHybridLayeredFrameLoop(input2) {
|
|
109975
110142
|
const {
|
|
109976
110143
|
job,
|
|
@@ -110163,7 +110330,7 @@ async function runHybridLayeredFrameLoop(input2) {
|
|
|
110163
110330
|
);
|
|
110164
110331
|
if (debugDumpEnabled && debugDumpDir && i2 % 30 === 0) {
|
|
110165
110332
|
writeFileExclusiveSync(
|
|
110166
|
-
|
|
110333
|
+
join46(debugDumpDir, `frame_${String(i2).padStart(4, "0")}_final_rgb48le.bin`),
|
|
110167
110334
|
canvas
|
|
110168
110335
|
);
|
|
110169
110336
|
}
|
|
@@ -110208,7 +110375,7 @@ var init_captureHdrHybridLoop = __esm({
|
|
|
110208
110375
|
|
|
110209
110376
|
// ../producer/src/services/render/stages/captureHdrStage.ts
|
|
110210
110377
|
import { existsSync as existsSync40, mkdirSync as mkdirSync20 } from "fs";
|
|
110211
|
-
import { join as
|
|
110378
|
+
import { join as join47 } from "path";
|
|
110212
110379
|
async function runCaptureHdrStage(input2) {
|
|
110213
110380
|
const {
|
|
110214
110381
|
job,
|
|
@@ -110367,7 +110534,7 @@ async function runCaptureHdrStage(input2) {
|
|
|
110367
110534
|
if (hdrVideoFrameSources.has(v2.id)) hdrVideoEndTimes.set(v2.id, v2.end);
|
|
110368
110535
|
}
|
|
110369
110536
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
110370
|
-
const debugDumpDir = debugDumpEnabled ?
|
|
110537
|
+
const debugDumpDir = debugDumpEnabled ? join47(framesDir, "debug-composite") : null;
|
|
110371
110538
|
if (debugDumpDir && !existsSync40(debugDumpDir)) {
|
|
110372
110539
|
mkdirSync20(debugDumpDir, { recursive: true });
|
|
110373
110540
|
}
|
|
@@ -110529,7 +110696,7 @@ var init_captureHdrStage = __esm({
|
|
|
110529
110696
|
});
|
|
110530
110697
|
|
|
110531
110698
|
// ../producer/src/services/render/stages/gifEncodeArgs.ts
|
|
110532
|
-
import { join as
|
|
110699
|
+
import { join as join48 } from "path";
|
|
110533
110700
|
function fpsToFfmpegArg2(fps) {
|
|
110534
110701
|
return fps.den === 1 ? String(fps.num) : `${fps.num}/${fps.den}`;
|
|
110535
110702
|
}
|
|
@@ -110540,7 +110707,7 @@ function buildGifPalettegenArgs(input2) {
|
|
|
110540
110707
|
"-framerate",
|
|
110541
110708
|
fpsArg,
|
|
110542
110709
|
"-i",
|
|
110543
|
-
|
|
110710
|
+
join48(input2.framesDir, input2.framePattern),
|
|
110544
110711
|
"-vf",
|
|
110545
110712
|
`fps=${fpsArg},palettegen=stats_mode=diff`,
|
|
110546
110713
|
input2.palettePath
|
|
@@ -110553,7 +110720,7 @@ function buildGifPaletteuseArgs(input2) {
|
|
|
110553
110720
|
"-framerate",
|
|
110554
110721
|
fpsArg,
|
|
110555
110722
|
"-i",
|
|
110556
|
-
|
|
110723
|
+
join48(input2.framesDir, input2.framePattern),
|
|
110557
110724
|
"-i",
|
|
110558
110725
|
input2.palettePath,
|
|
110559
110726
|
"-lavfi",
|
|
@@ -110571,7 +110738,7 @@ var init_gifEncodeArgs = __esm({
|
|
|
110571
110738
|
|
|
110572
110739
|
// ../producer/src/services/render/stages/encodeStage.ts
|
|
110573
110740
|
import { copyFileSync as copyFileSync5, existsSync as existsSync41, mkdirSync as mkdirSync21, readdirSync as readdirSync13, rmSync as rmSync11, statSync as statSync11 } from "fs";
|
|
110574
|
-
import { dirname as dirname18, join as
|
|
110741
|
+
import { dirname as dirname18, join as join49 } from "path";
|
|
110575
110742
|
function resolveGifLoop(loop) {
|
|
110576
110743
|
const resolved2 = loop ?? 0;
|
|
110577
110744
|
if (!Number.isInteger(resolved2) || resolved2 < 0 || resolved2 > 65535) {
|
|
@@ -110676,11 +110843,11 @@ async function runEncodeStage(input2) {
|
|
|
110676
110843
|
);
|
|
110677
110844
|
}
|
|
110678
110845
|
captured.forEach((name, i2) => {
|
|
110679
|
-
const dst =
|
|
110680
|
-
copyFileSync5(
|
|
110846
|
+
const dst = join49(outputPath, formatExportFrameName(i2, "png"));
|
|
110847
|
+
copyFileSync5(join49(framesDir, name), dst);
|
|
110681
110848
|
});
|
|
110682
110849
|
if (hasAudio && audioOutputPath && existsSync41(audioOutputPath)) {
|
|
110683
|
-
copyFileSync5(audioOutputPath,
|
|
110850
|
+
copyFileSync5(audioOutputPath, join49(outputPath, "audio.aac"));
|
|
110684
110851
|
log2.info(`[Render] png-sequence: audio.aac sidecar written to ${outputPath}/audio.aac`);
|
|
110685
110852
|
}
|
|
110686
110853
|
return { encodeMs: Date.now() - stage5Start };
|
|
@@ -110696,7 +110863,7 @@ async function runEncodeStage(input2) {
|
|
|
110696
110863
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
110697
110864
|
fps: job.config.fps,
|
|
110698
110865
|
loop,
|
|
110699
|
-
palettePath:
|
|
110866
|
+
palettePath: join49(dirname18(videoOnlyPath), "gif-palette.png"),
|
|
110700
110867
|
signal: abortSignal,
|
|
110701
110868
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
110702
110869
|
});
|
|
@@ -110822,7 +110989,7 @@ import {
|
|
|
110822
110989
|
copyFileSync as copyFileSync6,
|
|
110823
110990
|
appendFileSync
|
|
110824
110991
|
} from "fs";
|
|
110825
|
-
import { join as
|
|
110992
|
+
import { join as join50, dirname as dirname19, resolve as resolve26 } from "path";
|
|
110826
110993
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
110827
110994
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
110828
110995
|
function sampleDirectoryBytes(dir) {
|
|
@@ -110838,7 +111005,7 @@ function sampleDirectoryBytes(dir) {
|
|
|
110838
111005
|
continue;
|
|
110839
111006
|
}
|
|
110840
111007
|
for (const name of entries2) {
|
|
110841
|
-
const full2 =
|
|
111008
|
+
const full2 = join50(current2, name);
|
|
110842
111009
|
try {
|
|
110843
111010
|
const st3 = statSync12(full2);
|
|
110844
111011
|
if (st3.isDirectory()) {
|
|
@@ -110927,7 +111094,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
110927
111094
|
const ranges = [];
|
|
110928
111095
|
let rangeStart = null;
|
|
110929
111096
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
110930
|
-
const framePath =
|
|
111097
|
+
const framePath = join50(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
110931
111098
|
const missing = !existsSync43(framePath);
|
|
110932
111099
|
if (missing && rangeStart === null) {
|
|
110933
111100
|
rangeStart = frameIndex;
|
|
@@ -110950,7 +111117,7 @@ function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, ran
|
|
|
110950
111117
|
workerId,
|
|
110951
111118
|
startFrame: rangeStart + range.startFrame,
|
|
110952
111119
|
endFrame: rangeStart + range.endFrame,
|
|
110953
|
-
outputDir:
|
|
111120
|
+
outputDir: join50(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`),
|
|
110954
111121
|
outputFrameOffset: rangeStart
|
|
110955
111122
|
}));
|
|
110956
111123
|
batches.push(batch);
|
|
@@ -110983,7 +111150,7 @@ The composition is too large for the available memory. To reduce memory pressure
|
|
|
110983
111150
|
function countCapturedFrames(totalFrames, framesDir, frameExt) {
|
|
110984
111151
|
let captured = 0;
|
|
110985
111152
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
110986
|
-
const framePath =
|
|
111153
|
+
const framePath = join50(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
110987
111154
|
if (existsSync43(framePath)) captured++;
|
|
110988
111155
|
}
|
|
110989
111156
|
return captured;
|
|
@@ -111008,7 +111175,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
111008
111175
|
reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
|
|
111009
111176
|
});
|
|
111010
111177
|
pendingTransientRetry = false;
|
|
111011
|
-
const attemptWorkDir =
|
|
111178
|
+
const attemptWorkDir = join50(options.workDir, `capture-attempt-${attempt}`);
|
|
111012
111179
|
const batches = missingRanges ? buildMissingFrameRetryBatches(
|
|
111013
111180
|
missingRanges,
|
|
111014
111181
|
currentWorkers,
|
|
@@ -111172,12 +111339,13 @@ function shouldPreferSingleWorkerDrawElement(args) {
|
|
|
111172
111339
|
}
|
|
111173
111340
|
function resolveInversionRetryPlan(args) {
|
|
111174
111341
|
if (args.deWorkerInversion !== "inverted") return null;
|
|
111342
|
+
const workerCount = args.isMemoryExhaustion ? 1 : args.preInversionWorkerCount;
|
|
111175
111343
|
return {
|
|
111176
|
-
workerCount
|
|
111344
|
+
workerCount,
|
|
111177
111345
|
useStreamingEncode: shouldUseStreamingEncode(
|
|
111178
111346
|
args.cfg,
|
|
111179
111347
|
args.outputFormat,
|
|
111180
|
-
|
|
111348
|
+
workerCount,
|
|
111181
111349
|
args.durationSeconds
|
|
111182
111350
|
),
|
|
111183
111351
|
deWorkerInversion: "reverted"
|
|
@@ -111188,17 +111356,23 @@ function shouldPreferParallelDrawElement(args) {
|
|
|
111188
111356
|
}
|
|
111189
111357
|
function resolveParallelRouterRetryPlan(args) {
|
|
111190
111358
|
if (args.deParallelRouter !== "routed") return null;
|
|
111359
|
+
const workerCount = args.isMemoryExhaustion ? 1 : args.preRouterWorkerCount;
|
|
111191
111360
|
return {
|
|
111192
|
-
workerCount
|
|
111361
|
+
workerCount,
|
|
111193
111362
|
useStreamingEncode: shouldUseStreamingEncode(
|
|
111194
111363
|
args.cfg,
|
|
111195
111364
|
args.outputFormat,
|
|
111196
|
-
|
|
111365
|
+
workerCount,
|
|
111197
111366
|
args.durationSeconds
|
|
111198
111367
|
),
|
|
111199
111368
|
deParallelRouter: "reverted"
|
|
111200
111369
|
};
|
|
111201
111370
|
}
|
|
111371
|
+
function shouldRetryViaPinnedFallback(args) {
|
|
111372
|
+
if (args.isCancellation) return false;
|
|
111373
|
+
if (args.isVerifyError) return true;
|
|
111374
|
+
return args.deWorkerInversion === "inverted" || args.deParallelRouter === "routed";
|
|
111375
|
+
}
|
|
111202
111376
|
function resolveCaptureForceScreenshotForPageSideCompositing(args) {
|
|
111203
111377
|
return args.usePageSideCompositing ? true : args.forceScreenshot;
|
|
111204
111378
|
}
|
|
@@ -111226,10 +111400,10 @@ function extractStandaloneEntryFromIndex(indexHtml, entryFile) {
|
|
|
111226
111400
|
async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSignal) {
|
|
111227
111401
|
const moduleDir = dirname19(fileURLToPath5(import.meta.url));
|
|
111228
111402
|
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve26(process.env.PRODUCER_RENDERS_DIR, "..") : resolve26(moduleDir, "../..");
|
|
111229
|
-
const debugDir =
|
|
111403
|
+
const debugDir = join50(producerRoot, ".debug");
|
|
111230
111404
|
const outputDir = dirname19(outputPath);
|
|
111231
111405
|
if (!existsSync43(outputDir)) mkdirSync23(outputDir, { recursive: true });
|
|
111232
|
-
const workDir = job.config.debug ?
|
|
111406
|
+
const workDir = job.config.debug ? join50(debugDir, job.id) : mkdtempSync4(join50(outputDir, `work-${job.id}-`));
|
|
111233
111407
|
const pipelineStart = Date.now();
|
|
111234
111408
|
const log2 = job.config.logger ?? defaultLogger;
|
|
111235
111409
|
let fileServer = null;
|
|
@@ -111245,7 +111419,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111245
111419
|
imageDecodeFailures: 0
|
|
111246
111420
|
};
|
|
111247
111421
|
let hdrPerf;
|
|
111248
|
-
const perfOutputPath =
|
|
111422
|
+
const perfOutputPath = join50(workDir, "perf-summary.json");
|
|
111249
111423
|
const cfg = { ...job.config.producerConfig ?? resolveConfig() };
|
|
111250
111424
|
const observability = new RenderObservabilityRecorder({
|
|
111251
111425
|
pipelineStartMs: pipelineStart,
|
|
@@ -111294,7 +111468,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111294
111468
|
assertConfiguredFfmpegBinariesExist();
|
|
111295
111469
|
if (!existsSync43(workDir)) mkdirSync23(workDir, { recursive: true });
|
|
111296
111470
|
if (job.config.debug) {
|
|
111297
|
-
const logPath =
|
|
111471
|
+
const logPath = join50(workDir, "render.log");
|
|
111298
111472
|
restoreLogger = installDebugLogger(logPath, log2);
|
|
111299
111473
|
log2.info("[Render] Debug artifacts enabled", { workDir, logPath });
|
|
111300
111474
|
}
|
|
@@ -111323,15 +111497,15 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111323
111497
|
requestedWorkers: job.config.workers ?? "auto"
|
|
111324
111498
|
});
|
|
111325
111499
|
const entryFile = job.config.entryFile || "index.html";
|
|
111326
|
-
let htmlPath =
|
|
111500
|
+
let htmlPath = join50(projectDir, entryFile);
|
|
111327
111501
|
if (!existsSync43(htmlPath)) {
|
|
111328
111502
|
throw new Error(`Entry file not found: ${htmlPath}`);
|
|
111329
111503
|
}
|
|
111330
111504
|
assertNotAborted();
|
|
111331
111505
|
const rawEntry = readFileSync26(htmlPath, "utf-8");
|
|
111332
111506
|
if (entryFile !== "index.html" && rawEntry.trimStart().startsWith("<template")) {
|
|
111333
|
-
const wrapperPath =
|
|
111334
|
-
const projectIndexPath =
|
|
111507
|
+
const wrapperPath = join50(workDir, "standalone-entry.html");
|
|
111508
|
+
const projectIndexPath = join50(projectDir, "index.html");
|
|
111335
111509
|
if (!existsSync43(projectIndexPath)) {
|
|
111336
111510
|
throw new Error(
|
|
111337
111511
|
`Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
|
|
@@ -111467,7 +111641,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111467
111641
|
beginFrameStalled: probeResult.beginFrameStalled
|
|
111468
111642
|
});
|
|
111469
111643
|
updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress);
|
|
111470
|
-
const compiledDir =
|
|
111644
|
+
const compiledDir = join50(workDir, "compiled");
|
|
111471
111645
|
const extractResult = await observeRenderStage(
|
|
111472
111646
|
observability,
|
|
111473
111647
|
"video_extract",
|
|
@@ -111554,7 +111728,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111554
111728
|
try {
|
|
111555
111729
|
fileServer = await createFileServer2({
|
|
111556
111730
|
projectDir,
|
|
111557
|
-
compiledDir:
|
|
111731
|
+
compiledDir: join50(workDir, "compiled"),
|
|
111558
111732
|
port: 0,
|
|
111559
111733
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
111560
111734
|
fps: job.config.fps
|
|
@@ -111572,7 +111746,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111572
111746
|
if (!activeFileServer) {
|
|
111573
111747
|
throw new Error("File server failed to initialize before frame capture");
|
|
111574
111748
|
}
|
|
111575
|
-
const framesDir =
|
|
111749
|
+
const framesDir = join50(workDir, "captured-frames");
|
|
111576
111750
|
if (!existsSync43(framesDir)) mkdirSync23(framesDir, { recursive: true });
|
|
111577
111751
|
const resolvedBrowserGpuMode = await resolveBrowserGpuMode(cfg.browserGpuMode, {
|
|
111578
111752
|
chromePath: resolveHeadlessShellPath(cfg),
|
|
@@ -111719,7 +111893,18 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111719
111893
|
);
|
|
111720
111894
|
workerCount = 1;
|
|
111721
111895
|
}
|
|
111722
|
-
updateCaptureObservability({
|
|
111896
|
+
updateCaptureObservability({
|
|
111897
|
+
workerCount,
|
|
111898
|
+
deWorkerInversion,
|
|
111899
|
+
deParallelRouter,
|
|
111900
|
+
// Recorded here (not just in the success-path perfSummary) so a hard
|
|
111901
|
+
// failure while routed/inverted still tells us what worker count the
|
|
111902
|
+
// resolver would have used absent the experiment — the DE-router pin
|
|
111903
|
+
// to 3 workers regardless of calibration is the leading suspect for
|
|
111904
|
+
// any resource-pressure failure unique to this cohort.
|
|
111905
|
+
dePreInversionWorkers: deWorkerInversion ? preRoutingWorkerCount : void 0,
|
|
111906
|
+
dePreRouterWorkers: deParallelRouter ? preRoutingWorkerCount : void 0
|
|
111907
|
+
});
|
|
111723
111908
|
observability.checkpoint("worker_resolution", "resolved", {
|
|
111724
111909
|
workerCount,
|
|
111725
111910
|
deWorkerInversion: deWorkerInversion ?? "none",
|
|
@@ -111765,7 +111950,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111765
111950
|
gif: ".gif"
|
|
111766
111951
|
};
|
|
111767
111952
|
const videoExt = FORMAT_EXT3[outputFormat] ?? ".mp4";
|
|
111768
|
-
const videoOnlyPath =
|
|
111953
|
+
const videoOnlyPath = join50(workDir, `video-only${videoExt}`);
|
|
111769
111954
|
const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && !isPngSequence && !needsAlpha;
|
|
111770
111955
|
if (usePageSideCompositingForTransitions) {
|
|
111771
111956
|
activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
|
|
@@ -111917,20 +112102,31 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111917
112102
|
try {
|
|
111918
112103
|
streamingRes = await invokeStreaming();
|
|
111919
112104
|
} catch (err) {
|
|
111920
|
-
|
|
111921
|
-
|
|
111922
|
-
|
|
111923
|
-
|
|
111924
|
-
|
|
111925
|
-
|
|
112105
|
+
const isVerifyError = isDrawElementVerificationError(err);
|
|
112106
|
+
const isCancellation = err instanceof RenderCancelledError || abortSignal?.aborted === true;
|
|
112107
|
+
if (!shouldRetryViaPinnedFallback({
|
|
112108
|
+
isVerifyError,
|
|
112109
|
+
isCancellation,
|
|
112110
|
+
deWorkerInversion,
|
|
112111
|
+
deParallelRouter
|
|
112112
|
+
}))
|
|
112113
|
+
throw err;
|
|
112114
|
+
const isMemoryExhaustion = !isVerifyError && isMemoryExhaustionError(err);
|
|
112115
|
+
deSelfVerifyFallback = isVerifyError;
|
|
112116
|
+
deFallbackReason = isVerifyError ? /blank/i.test(err instanceof Error ? err.message : "") ? "blank" : "psnr" : isMemoryExhaustion ? "oom" : "capture_error";
|
|
112117
|
+
log2.warn(
|
|
112118
|
+
isVerifyError ? "[Render] drawElement self-verification failed; re-rendering via screenshot" : "[Render] capture failed on the pinned worker count; re-rendering via screenshot",
|
|
112119
|
+
{ error: err instanceof Error ? err.message : String(err) }
|
|
112120
|
+
);
|
|
111926
112121
|
observability.checkpoint(
|
|
111927
112122
|
"capture_streaming",
|
|
111928
|
-
"drawElement self-verify failed; retrying with forceScreenshot"
|
|
112123
|
+
isVerifyError ? "drawElement self-verify failed; retrying with forceScreenshot" : "capture failed on pinned worker count; retrying with forceScreenshot"
|
|
111929
112124
|
);
|
|
111930
112125
|
captureForceScreenshot = true;
|
|
111931
112126
|
updateCaptureObservability({
|
|
111932
112127
|
forceScreenshot: true,
|
|
111933
|
-
deSelfVerifyFallback
|
|
112128
|
+
deSelfVerifyFallback,
|
|
112129
|
+
deFallbackReason
|
|
111934
112130
|
});
|
|
111935
112131
|
probeSession = null;
|
|
111936
112132
|
if (deParallelRouter === "routed") deParallelStreamForced = false;
|
|
@@ -111939,14 +112135,16 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
111939
112135
|
preInversionWorkerCount: preRoutingWorkerCount,
|
|
111940
112136
|
cfg,
|
|
111941
112137
|
outputFormat,
|
|
111942
|
-
durationSeconds: job.duration
|
|
112138
|
+
durationSeconds: job.duration,
|
|
112139
|
+
isMemoryExhaustion
|
|
111943
112140
|
});
|
|
111944
112141
|
const parallelRouterRetryPlan = resolveParallelRouterRetryPlan({
|
|
111945
112142
|
deParallelRouter,
|
|
111946
112143
|
preRouterWorkerCount: preRoutingWorkerCount,
|
|
111947
112144
|
cfg,
|
|
111948
112145
|
outputFormat,
|
|
111949
|
-
durationSeconds: job.duration
|
|
112146
|
+
durationSeconds: job.duration,
|
|
112147
|
+
isMemoryExhaustion
|
|
111950
112148
|
});
|
|
111951
112149
|
if (inversionRetryPlan) {
|
|
111952
112150
|
deWorkerInversion = inversionRetryPlan.deWorkerInversion;
|
|
@@ -112175,7 +112373,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
112175
112373
|
}
|
|
112176
112374
|
if (job.config.debug) {
|
|
112177
112375
|
if (!isPngSequence && existsSync43(outputPath)) {
|
|
112178
|
-
const debugOutput =
|
|
112376
|
+
const debugOutput = join50(workDir, `output${videoExt}`);
|
|
112179
112377
|
copyFileSync6(outputPath, debugOutput);
|
|
112180
112378
|
}
|
|
112181
112379
|
} else if (process.env.KEEP_TEMP === "1") {
|
|
@@ -112338,7 +112536,7 @@ var init_config3 = __esm({
|
|
|
112338
112536
|
|
|
112339
112537
|
// ../producer/src/services/hyperframeLint.ts
|
|
112340
112538
|
import { existsSync as existsSync44, readFileSync as readFileSync27, statSync as statSync13 } from "fs";
|
|
112341
|
-
import { resolve as resolve27, join as
|
|
112539
|
+
import { resolve as resolve27, join as join51 } from "path";
|
|
112342
112540
|
function isStringRecord2(value) {
|
|
112343
112541
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
112344
112542
|
return false;
|
|
@@ -112386,7 +112584,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
|
112386
112584
|
}
|
|
112387
112585
|
}
|
|
112388
112586
|
return {
|
|
112389
|
-
error: `No HTML entry file found in project directory: ${
|
|
112587
|
+
error: `No HTML entry file found in project directory: ${join51(absProjectDir, preferredEntryFile || "index.html")}`
|
|
112390
112588
|
};
|
|
112391
112589
|
}
|
|
112392
112590
|
function prepareHyperframeLintBody(body) {
|
|
@@ -112435,7 +112633,7 @@ var init_hyperframeLint = __esm({
|
|
|
112435
112633
|
// ../producer/src/services/healthWorker.ts
|
|
112436
112634
|
import { Worker as Worker3 } from "worker_threads";
|
|
112437
112635
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
112438
|
-
import { dirname as dirname20, join as
|
|
112636
|
+
import { dirname as dirname20, join as join53 } from "path";
|
|
112439
112637
|
import { existsSync as existsSync45 } from "fs";
|
|
112440
112638
|
async function startHealthWorker(options = {}) {
|
|
112441
112639
|
const log2 = options.logger ?? defaultLogger2();
|
|
@@ -112510,7 +112708,7 @@ function defaultLogger2() {
|
|
|
112510
112708
|
}
|
|
112511
112709
|
function resolveWorkerEntry2() {
|
|
112512
112710
|
const here = dirname20(fileURLToPath6(import.meta.url));
|
|
112513
|
-
const candidates = [
|
|
112711
|
+
const candidates = [join53(here, "healthWorkerThread.js"), join53(here, "healthWorkerThread.ts")];
|
|
112514
112712
|
for (const candidate of candidates) {
|
|
112515
112713
|
if (existsSync45(candidate)) return candidate;
|
|
112516
112714
|
}
|
|
@@ -112575,7 +112773,7 @@ import {
|
|
|
112575
112773
|
rmSync as rmSync13,
|
|
112576
112774
|
createReadStream as createReadStream2
|
|
112577
112775
|
} from "fs";
|
|
112578
|
-
import { resolve as resolve28, dirname as dirname21, join as
|
|
112776
|
+
import { resolve as resolve28, dirname as dirname21, join as join54 } from "path";
|
|
112579
112777
|
import { tmpdir as tmpdir6 } from "os";
|
|
112580
112778
|
import { parseArgs as parseArgs2 } from "util";
|
|
112581
112779
|
import crypto2 from "crypto";
|
|
@@ -112695,8 +112893,8 @@ async function prepareRenderBody(body) {
|
|
|
112695
112893
|
}
|
|
112696
112894
|
}
|
|
112697
112895
|
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir6();
|
|
112698
|
-
const tempProjectDir = mkdtempSync5(
|
|
112699
|
-
writeFileSync16(
|
|
112896
|
+
const tempProjectDir = mkdtempSync5(join54(tempRoot, "producer-project-"));
|
|
112897
|
+
writeFileSync16(join54(tempProjectDir, "index.html"), htmlContent, "utf-8");
|
|
112700
112898
|
return {
|
|
112701
112899
|
prepared: {
|
|
112702
112900
|
input: {
|
|
@@ -113177,7 +113375,7 @@ var init_planHash = __esm({
|
|
|
113177
113375
|
|
|
113178
113376
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
113179
113377
|
import { existsSync as existsSync47, mkdirSync as mkdirSync25, readFileSync as readFileSync28, readdirSync as readdirSync15, writeFileSync as writeFileSync17 } from "fs";
|
|
113180
|
-
import { join as
|
|
113378
|
+
import { join as join55, relative as relative9, resolve as resolve29 } from "path";
|
|
113181
113379
|
function stripUndefined(value) {
|
|
113182
113380
|
if (Array.isArray(value)) return value.map(stripUndefined);
|
|
113183
113381
|
if (value !== null && typeof value === "object") {
|
|
@@ -113198,7 +113396,7 @@ function listPlanFiles(planDir) {
|
|
|
113198
113396
|
function walk(dir) {
|
|
113199
113397
|
const entries2 = readdirSync15(dir, { withFileTypes: true });
|
|
113200
113398
|
for (const entry of entries2) {
|
|
113201
|
-
const full2 =
|
|
113399
|
+
const full2 = join55(dir, entry.name);
|
|
113202
113400
|
if (entry.isDirectory()) {
|
|
113203
113401
|
walk(full2);
|
|
113204
113402
|
} else if (entry.isFile()) {
|
|
@@ -113234,8 +113432,8 @@ function collectPlanAssetShas(planDir) {
|
|
|
113234
113432
|
return { compositionHtml, assets };
|
|
113235
113433
|
}
|
|
113236
113434
|
function recomputePlanHashFromPlanDir(planDir) {
|
|
113237
|
-
const planJsonPath =
|
|
113238
|
-
const encoderJsonPath =
|
|
113435
|
+
const planJsonPath = join55(planDir, "plan.json");
|
|
113436
|
+
const encoderJsonPath = join55(planDir, "meta", "encoder.json");
|
|
113239
113437
|
if (!existsSync47(planJsonPath)) {
|
|
113240
113438
|
throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
|
|
113241
113439
|
}
|
|
@@ -113271,18 +113469,18 @@ async function freezePlan(input2) {
|
|
|
113271
113469
|
if (!existsSync47(planDir)) {
|
|
113272
113470
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
113273
113471
|
}
|
|
113274
|
-
const metaDir =
|
|
113472
|
+
const metaDir = join55(planDir, "meta");
|
|
113275
113473
|
if (!existsSync47(metaDir)) mkdirSync25(metaDir, { recursive: true });
|
|
113276
113474
|
writeFileSync17(
|
|
113277
|
-
|
|
113475
|
+
join55(metaDir, "composition.json"),
|
|
113278
113476
|
`${JSON.stringify(composition, null, 2)}
|
|
113279
113477
|
`,
|
|
113280
113478
|
"utf-8"
|
|
113281
113479
|
);
|
|
113282
113480
|
const encoderForCanonical = stripUndefined(encoder);
|
|
113283
113481
|
const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
|
|
113284
|
-
writeFileSync17(
|
|
113285
|
-
writeFileSync17(
|
|
113482
|
+
writeFileSync17(join55(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
|
|
113483
|
+
writeFileSync17(join55(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
|
|
113286
113484
|
`, "utf-8");
|
|
113287
113485
|
const { compositionHtml, assets } = collectPlanAssetShas(planDir);
|
|
113288
113486
|
const planHash = computePlanHash({
|
|
@@ -113305,7 +113503,7 @@ async function freezePlan(input2) {
|
|
|
113305
113503
|
duration: durationSeconds,
|
|
113306
113504
|
hasAudio
|
|
113307
113505
|
};
|
|
113308
|
-
const planJsonPath =
|
|
113506
|
+
const planJsonPath = join55(planDir, "plan.json");
|
|
113309
113507
|
writeFileSync17(planJsonPath, `${JSON.stringify(planJson, null, 2)}
|
|
113310
113508
|
`, "utf-8");
|
|
113311
113509
|
return { planJsonPath, planHash };
|
|
@@ -113428,7 +113626,7 @@ var init_runtimeEnvSnapshot = __esm({
|
|
|
113428
113626
|
|
|
113429
113627
|
// ../producer/src/services/distributed/shared.ts
|
|
113430
113628
|
import { execFile as execFileCallback } from "child_process";
|
|
113431
|
-
import { dirname as dirname23, join as
|
|
113629
|
+
import { dirname as dirname23, join as join56 } from "path";
|
|
113432
113630
|
import { existsSync as existsSync48, readFileSync as readFileSync29 } from "fs";
|
|
113433
113631
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
113434
113632
|
import { promisify as promisify4 } from "util";
|
|
@@ -113467,7 +113665,7 @@ function readProducerVersion() {
|
|
|
113467
113665
|
const startDir = dirname23(fileURLToPath7(import.meta.url));
|
|
113468
113666
|
let current2 = startDir;
|
|
113469
113667
|
for (let i2 = 0; i2 < 10; i2++) {
|
|
113470
|
-
const candidate =
|
|
113668
|
+
const candidate = join56(current2, "package.json");
|
|
113471
113669
|
if (existsSync48(candidate)) {
|
|
113472
113670
|
try {
|
|
113473
113671
|
const pkg = JSON.parse(readFileSync29(candidate, "utf-8"));
|
|
@@ -113504,12 +113702,12 @@ import {
|
|
|
113504
113702
|
existsSync as existsSync49,
|
|
113505
113703
|
mkdirSync as mkdirSync26,
|
|
113506
113704
|
readdirSync as readdirSync16,
|
|
113507
|
-
renameSync as
|
|
113705
|
+
renameSync as renameSync8,
|
|
113508
113706
|
rmSync as rmSync14,
|
|
113509
113707
|
statSync as statSync15,
|
|
113510
113708
|
writeFileSync as writeFileSync18
|
|
113511
113709
|
} from "fs";
|
|
113512
|
-
import { join as
|
|
113710
|
+
import { join as join57, relative as relative10, sep as sep6 } from "path";
|
|
113513
113711
|
function formatBytes2(bytes) {
|
|
113514
113712
|
if (bytes < 1024) return `${bytes} B`;
|
|
113515
113713
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KiB`;
|
|
@@ -113534,7 +113732,7 @@ function measurePlanDirBytes(planDir) {
|
|
|
113534
113732
|
return;
|
|
113535
113733
|
}
|
|
113536
113734
|
for (const entry of entries2) {
|
|
113537
|
-
const full2 =
|
|
113735
|
+
const full2 = join57(dir, entry.name);
|
|
113538
113736
|
if (entry.isDirectory()) {
|
|
113539
113737
|
walk(full2);
|
|
113540
113738
|
} else if (entry.isFile()) {
|
|
@@ -113702,13 +113900,13 @@ async function plan(projectDir, config, planDir) {
|
|
|
113702
113900
|
producerConfig: config.producerConfig
|
|
113703
113901
|
});
|
|
113704
113902
|
const entryFile = config.entryFile ?? "index.html";
|
|
113705
|
-
const htmlPath =
|
|
113903
|
+
const htmlPath = join57(projectDir, entryFile);
|
|
113706
113904
|
if (!existsSync49(htmlPath)) {
|
|
113707
113905
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
113708
113906
|
}
|
|
113709
|
-
const workDir =
|
|
113907
|
+
const workDir = join57(planDir, ".plan-work");
|
|
113710
113908
|
if (!existsSync49(workDir)) mkdirSync26(workDir, { recursive: true });
|
|
113711
|
-
const compiledDir =
|
|
113909
|
+
const compiledDir = join57(workDir, "compiled");
|
|
113712
113910
|
mkdirSync26(compiledDir, { recursive: true });
|
|
113713
113911
|
cpSync3(projectDir, compiledDir, {
|
|
113714
113912
|
recursive: true,
|
|
@@ -113720,7 +113918,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
113720
113918
|
return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
|
|
113721
113919
|
}
|
|
113722
113920
|
});
|
|
113723
|
-
const finalCompiledDir =
|
|
113921
|
+
const finalCompiledDir = join57(planDir, "compiled");
|
|
113724
113922
|
const needsAlpha = config.format === "png-sequence" || config.format === "mov" || config.format === "webm";
|
|
113725
113923
|
const compileResult = await runCompileStage({
|
|
113726
113924
|
projectDir,
|
|
@@ -113806,16 +114004,16 @@ async function plan(projectDir, config, planDir) {
|
|
|
113806
114004
|
if (audioResult.audioError) {
|
|
113807
114005
|
log2.warn(`[Render] Audio mix failed \u2014 output will be video-only: ${audioResult.audioError}`);
|
|
113808
114006
|
}
|
|
113809
|
-
const stagedVideoFrames =
|
|
113810
|
-
const videoFramesDst =
|
|
114007
|
+
const stagedVideoFrames = join57(compiledDir, "__hyperframes_video_frames");
|
|
114008
|
+
const videoFramesDst = join57(planDir, "video-frames");
|
|
113811
114009
|
if (existsSync49(videoFramesDst)) rmSync14(videoFramesDst, { recursive: true, force: true });
|
|
113812
114010
|
if (existsSync49(stagedVideoFrames)) {
|
|
113813
|
-
|
|
114011
|
+
renameSync8(stagedVideoFrames, videoFramesDst);
|
|
113814
114012
|
} else {
|
|
113815
114013
|
mkdirSync26(videoFramesDst, { recursive: true });
|
|
113816
114014
|
}
|
|
113817
114015
|
if (existsSync49(finalCompiledDir)) rmSync14(finalCompiledDir, { recursive: true, force: true });
|
|
113818
|
-
|
|
114016
|
+
renameSync8(compiledDir, finalCompiledDir);
|
|
113819
114017
|
const planVideosJson = {
|
|
113820
114018
|
videos: composition.videos,
|
|
113821
114019
|
extracted: (extractResult.extractionResult?.extracted ?? []).map((ext) => ({
|
|
@@ -113827,15 +114025,15 @@ async function plan(projectDir, config, planDir) {
|
|
|
113827
114025
|
metadata: ext.metadata
|
|
113828
114026
|
}))
|
|
113829
114027
|
};
|
|
113830
|
-
mkdirSync26(
|
|
114028
|
+
mkdirSync26(join57(planDir, "meta"), { recursive: true });
|
|
113831
114029
|
writeFileSync18(
|
|
113832
|
-
|
|
114030
|
+
join57(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
|
|
113833
114031
|
JSON.stringify(planVideosJson, null, 2),
|
|
113834
114032
|
"utf-8"
|
|
113835
114033
|
);
|
|
113836
|
-
const planAudioPath =
|
|
114034
|
+
const planAudioPath = join57(planDir, "audio.aac");
|
|
113837
114035
|
if (audioResult.hasAudio && existsSync49(audioResult.audioOutputPath)) {
|
|
113838
|
-
|
|
114036
|
+
renameSync8(audioResult.audioOutputPath, planAudioPath);
|
|
113839
114037
|
}
|
|
113840
114038
|
const maxParallel = config.maxParallelChunks ?? DEFAULT_MAX_PARALLEL_CHUNKS;
|
|
113841
114039
|
const { chunkCount, effectiveChunkSize } = resolveChunkPlan(
|
|
@@ -113979,11 +114177,11 @@ var init_plan = __esm({
|
|
|
113979
114177
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
113980
114178
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
113981
114179
|
import { existsSync as existsSync50, mkdirSync as mkdirSync27, readFileSync as readFileSync30, readdirSync as readdirSync17, rmSync as rmSync15, writeFileSync as writeFileSync19 } from "fs";
|
|
113982
|
-
import { extname as extname10, join as
|
|
114180
|
+
import { extname as extname10, join as join58 } from "path";
|
|
113983
114181
|
function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
113984
114182
|
const result = [];
|
|
113985
114183
|
for (const v2 of videos) {
|
|
113986
|
-
const outputDir =
|
|
114184
|
+
const outputDir = join58(planDir, "video-frames", v2.videoId);
|
|
113987
114185
|
if (!existsSync50(outputDir)) {
|
|
113988
114186
|
throw new Error(
|
|
113989
114187
|
`[renderChunk] planDir missing extracted video frames for ${JSON.stringify(v2.videoId)}: ${outputDir} not present. plan() should have written frames here; the planDir is malformed.`
|
|
@@ -113995,7 +114193,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
|
113995
114193
|
for (let i2 = 0; i2 < frames.length; i2++) {
|
|
113996
114194
|
const frameName = frames[i2];
|
|
113997
114195
|
if (!frameName) continue;
|
|
113998
|
-
framePaths.set(i2,
|
|
114196
|
+
framePaths.set(i2, join58(outputDir, frameName));
|
|
113999
114197
|
}
|
|
114000
114198
|
result.push({
|
|
114001
114199
|
videoId: v2.videoId,
|
|
@@ -114020,7 +114218,7 @@ function hashChunkOutput(outputPath, kind) {
|
|
|
114020
114218
|
if (kind === "file") return sha256Hex(readFileSync30(outputPath));
|
|
114021
114219
|
const entries2 = readdirSync17(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
114022
114220
|
const lines = entries2.map(
|
|
114023
|
-
(name) => `${name}\0${sha256Hex(readFileSync30(
|
|
114221
|
+
(name) => `${name}\0${sha256Hex(readFileSync30(join58(outputPath, name)))}`
|
|
114024
114222
|
);
|
|
114025
114223
|
return sha256Hex(lines.join("\0"));
|
|
114026
114224
|
}
|
|
@@ -114037,9 +114235,9 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
|
|
|
114037
114235
|
async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
114038
114236
|
const start = Date.now();
|
|
114039
114237
|
const log2 = defaultLogger;
|
|
114040
|
-
const planJsonPath =
|
|
114041
|
-
const encoderJsonPath =
|
|
114042
|
-
const chunksJsonPath =
|
|
114238
|
+
const planJsonPath = join58(planDir, "plan.json");
|
|
114239
|
+
const encoderJsonPath = join58(planDir, "meta", "encoder.json");
|
|
114240
|
+
const chunksJsonPath = join58(planDir, "meta", "chunks.json");
|
|
114043
114241
|
for (const required of [planJsonPath, encoderJsonPath, chunksJsonPath]) {
|
|
114044
114242
|
if (!existsSync50(required)) {
|
|
114045
114243
|
throw new RenderChunkValidationError(
|
|
@@ -114051,7 +114249,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
114051
114249
|
const plan2 = JSON.parse(readFileSync30(planJsonPath, "utf-8"));
|
|
114052
114250
|
const encoder = JSON.parse(readFileSync30(encoderJsonPath, "utf-8"));
|
|
114053
114251
|
const chunks = JSON.parse(readFileSync30(chunksJsonPath, "utf-8"));
|
|
114054
|
-
const videosJsonPath =
|
|
114252
|
+
const videosJsonPath = join58(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
114055
114253
|
let planVideos = null;
|
|
114056
114254
|
if (existsSync50(videosJsonPath)) {
|
|
114057
114255
|
try {
|
|
@@ -114080,7 +114278,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
114080
114278
|
`[renderChunk] chunk ${chunkIndex} has non-positive frame count: ${framesInChunk}`
|
|
114081
114279
|
);
|
|
114082
114280
|
}
|
|
114083
|
-
const compiledDir =
|
|
114281
|
+
const compiledDir = join58(planDir, "compiled");
|
|
114084
114282
|
if (!existsSync50(compiledDir)) {
|
|
114085
114283
|
throw new RenderChunkValidationError(
|
|
114086
114284
|
MISSING_PLAN_ARTIFACT,
|
|
@@ -114145,7 +114343,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
114145
114343
|
);
|
|
114146
114344
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes2(4).toString("hex")}`;
|
|
114147
114345
|
mkdirSync27(workDir, { recursive: true });
|
|
114148
|
-
const framesDir =
|
|
114346
|
+
const framesDir = join58(workDir, "captured-frames");
|
|
114149
114347
|
mkdirSync27(framesDir, { recursive: true });
|
|
114150
114348
|
const fileServer = await createFileServer2({
|
|
114151
114349
|
projectDir: compiledDir,
|
|
@@ -114227,7 +114425,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
114227
114425
|
if (isPngSequence) {
|
|
114228
114426
|
if (!existsSync50(outputChunkPath)) mkdirSync27(outputChunkPath, { recursive: true });
|
|
114229
114427
|
} else {
|
|
114230
|
-
const outDir =
|
|
114428
|
+
const outDir = join58(outputChunkPath, "..");
|
|
114231
114429
|
if (!existsSync50(outDir)) mkdirSync27(outDir, { recursive: true });
|
|
114232
114430
|
}
|
|
114233
114431
|
const encodeStarted = Date.now();
|
|
@@ -114674,14 +114872,14 @@ import {
|
|
|
114674
114872
|
statSync as statSync16,
|
|
114675
114873
|
writeFileSync as writeFileSync20
|
|
114676
114874
|
} from "fs";
|
|
114677
|
-
import { dirname as dirname24, join as
|
|
114875
|
+
import { dirname as dirname24, join as join59 } from "path";
|
|
114678
114876
|
async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
114679
114877
|
const start = Date.now();
|
|
114680
114878
|
const log2 = options?.logger ?? defaultLogger;
|
|
114681
114879
|
const abortSignal = options?.abortSignal;
|
|
114682
114880
|
const cfr = options?.cfr === true;
|
|
114683
|
-
const planJsonPath =
|
|
114684
|
-
const chunksJsonPath =
|
|
114881
|
+
const planJsonPath = join59(planDir, "plan.json");
|
|
114882
|
+
const chunksJsonPath = join59(planDir, "meta", "chunks.json");
|
|
114685
114883
|
if (!existsSync51(planJsonPath)) {
|
|
114686
114884
|
throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
|
|
114687
114885
|
}
|
|
@@ -114710,7 +114908,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
114710
114908
|
if (existsSync51(workDir)) rmSync17(workDir, { recursive: true, force: true });
|
|
114711
114909
|
mkdirSync28(workDir, { recursive: true });
|
|
114712
114910
|
try {
|
|
114713
|
-
const concatOutputPath =
|
|
114911
|
+
const concatOutputPath = join59(workDir, `concat.${plan2.dimensions.format}`);
|
|
114714
114912
|
const fpsArg = fpsToFfmpegArg({
|
|
114715
114913
|
num: plan2.dimensions.fpsNum,
|
|
114716
114914
|
den: plan2.dimensions.fpsDen
|
|
@@ -114724,7 +114922,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
114724
114922
|
);
|
|
114725
114923
|
}
|
|
114726
114924
|
} else {
|
|
114727
|
-
const concatListPath =
|
|
114925
|
+
const concatListPath = join59(workDir, "concat-list.txt");
|
|
114728
114926
|
const concatBody = chunkPaths.map((path2) => `file '${path2.replace(/'/g, "'\\''")}'`).join("\n");
|
|
114729
114927
|
writeFileSync20(concatListPath, `${concatBody}
|
|
114730
114928
|
`, "utf-8");
|
|
@@ -114756,7 +114954,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
114756
114954
|
`[assemble] cfr=true is only supported for format="mp4" (got "${plan2.dimensions.format}"). Stream-copy paths for webm and mov already produce exact avg_frame_rate; cfr re-encode is not needed.`
|
|
114757
114955
|
);
|
|
114758
114956
|
}
|
|
114759
|
-
const encoderJsonPath =
|
|
114957
|
+
const encoderJsonPath = join59(planDir, "meta", "encoder.json");
|
|
114760
114958
|
if (!existsSync51(encoderJsonPath)) {
|
|
114761
114959
|
throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
|
|
114762
114960
|
}
|
|
@@ -114766,7 +114964,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
114766
114964
|
`[assemble] cfr=true is not yet supported with codec: "h265". The cfr re-encode pass uses libx264 and would silently transcode the h265 chunks. Either disable cfr or render with codec: "h264".`
|
|
114767
114965
|
);
|
|
114768
114966
|
}
|
|
114769
|
-
const cfrOutputPath =
|
|
114967
|
+
const cfrOutputPath = join59(workDir, `cfr.${plan2.dimensions.format}`);
|
|
114770
114968
|
const cfrArgs = [
|
|
114771
114969
|
"-i",
|
|
114772
114970
|
concatOutputPath,
|
|
@@ -114800,7 +114998,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
114800
114998
|
}
|
|
114801
114999
|
let audioForMux = null;
|
|
114802
115000
|
if (audioPath !== null && existsSync51(audioPath)) {
|
|
114803
|
-
const paddedAudioPath =
|
|
115001
|
+
const paddedAudioPath = join59(workDir, "audio-padded.aac");
|
|
114804
115002
|
const padTrimResult = await padOrTrimAudioToVideoFrameCount({
|
|
114805
115003
|
videoPath: postConcatPath,
|
|
114806
115004
|
audioPath,
|
|
@@ -114816,7 +115014,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
114816
115014
|
sourceDurationSeconds: padTrimResult.sourceDurationSeconds
|
|
114817
115015
|
});
|
|
114818
115016
|
}
|
|
114819
|
-
const muxOutputPath = audioForMux !== null ?
|
|
115017
|
+
const muxOutputPath = audioForMux !== null ? join59(workDir, `mux.${plan2.dimensions.format}`) : postConcatPath;
|
|
114820
115018
|
if (audioForMux !== null) {
|
|
114821
115019
|
const muxResult = await muxVideoWithAudio(
|
|
114822
115020
|
postConcatPath,
|
|
@@ -114876,8 +115074,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
114876
115074
|
throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
|
|
114877
115075
|
}
|
|
114878
115076
|
for (const frame of frames) {
|
|
114879
|
-
const dst =
|
|
114880
|
-
cpSync4(
|
|
115077
|
+
const dst = join59(outputPath, formatExportFrameName(globalIdx, "png"));
|
|
115078
|
+
cpSync4(join59(chunkDir, frame), dst);
|
|
114881
115079
|
globalIdx += 1;
|
|
114882
115080
|
}
|
|
114883
115081
|
}
|
|
@@ -114887,13 +115085,13 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
114887
115085
|
);
|
|
114888
115086
|
}
|
|
114889
115087
|
if (audioPath !== null && existsSync51(audioPath)) {
|
|
114890
|
-
const sidecar =
|
|
115088
|
+
const sidecar = join59(outputPath, "audio.aac");
|
|
114891
115089
|
cpSync4(audioPath, sidecar);
|
|
114892
115090
|
}
|
|
114893
115091
|
let fileSize = 0;
|
|
114894
115092
|
for (const name of readdirSync18(outputPath)) {
|
|
114895
115093
|
try {
|
|
114896
|
-
fileSize += statSync16(
|
|
115094
|
+
fileSize += statSync16(join59(outputPath, name)).size;
|
|
114897
115095
|
} catch {
|
|
114898
115096
|
}
|
|
114899
115097
|
}
|
|
@@ -114926,7 +115124,7 @@ var init_renderConfigValidation = __esm({
|
|
|
114926
115124
|
// ../producer/src/services/distributed/projectHash.ts
|
|
114927
115125
|
import { readdirSync as readdirSync19, readFileSync as readFileSync33 } from "fs";
|
|
114928
115126
|
import { createHash as createHash11 } from "crypto";
|
|
114929
|
-
import { join as
|
|
115127
|
+
import { join as join60, relative as relative11 } from "path";
|
|
114930
115128
|
var init_projectHash = __esm({
|
|
114931
115129
|
"../producer/src/services/distributed/projectHash.ts"() {
|
|
114932
115130
|
"use strict";
|
|
@@ -115019,7 +115217,7 @@ import { execSync as execSync5, spawnSync as spawnSync3 } from "child_process";
|
|
|
115019
115217
|
import { existsSync as existsSync53, mkdirSync as mkdirSync29, readdirSync as readdirSync20, rmSync as rmSync18, statSync as statSync17, utimesSync as utimesSync2 } from "fs";
|
|
115020
115218
|
import { basename as basename7 } from "path";
|
|
115021
115219
|
import { homedir as homedir11 } from "os";
|
|
115022
|
-
import { join as
|
|
115220
|
+
import { join as join61 } from "path";
|
|
115023
115221
|
async function loadPuppeteerBrowsers() {
|
|
115024
115222
|
try {
|
|
115025
115223
|
return await import("@puppeteer/browsers");
|
|
@@ -115197,15 +115395,15 @@ function findFromPuppeteerCache() {
|
|
|
115197
115395
|
}
|
|
115198
115396
|
for (const version2 of versions) {
|
|
115199
115397
|
const candidates = [
|
|
115200
|
-
|
|
115201
|
-
|
|
115398
|
+
join61(PUPPETEER_CACHE_DIR, version2, "chrome-headless-shell-linux64", "chrome-headless-shell"),
|
|
115399
|
+
join61(
|
|
115202
115400
|
PUPPETEER_CACHE_DIR,
|
|
115203
115401
|
version2,
|
|
115204
115402
|
"chrome-headless-shell-mac-arm64",
|
|
115205
115403
|
"chrome-headless-shell"
|
|
115206
115404
|
),
|
|
115207
|
-
|
|
115208
|
-
|
|
115405
|
+
join61(PUPPETEER_CACHE_DIR, version2, "chrome-headless-shell-mac-x64", "chrome-headless-shell"),
|
|
115406
|
+
join61(
|
|
115209
115407
|
PUPPETEER_CACHE_DIR,
|
|
115210
115408
|
version2,
|
|
115211
115409
|
"chrome-headless-shell-win64",
|
|
@@ -115410,11 +115608,11 @@ var init_manager2 = __esm({
|
|
|
115410
115608
|
"use strict";
|
|
115411
115609
|
init_errorMessage();
|
|
115412
115610
|
CHROME_VERSION = "152.0.7928.2";
|
|
115413
|
-
CACHE_ROOT_DIR =
|
|
115414
|
-
CACHE_DIR2 =
|
|
115415
|
-
PUPPETEER_CACHE_DIR =
|
|
115416
|
-
INSTALL_LOCK_DIR =
|
|
115417
|
-
INSTALL_RECLAIM_LOCK_DIR =
|
|
115611
|
+
CACHE_ROOT_DIR = join61(homedir11(), ".cache", "hyperframes");
|
|
115612
|
+
CACHE_DIR2 = join61(homedir11(), ".cache", "hyperframes", "chrome");
|
|
115613
|
+
PUPPETEER_CACHE_DIR = join61(homedir11(), ".cache", "puppeteer", "chrome-headless-shell");
|
|
115614
|
+
INSTALL_LOCK_DIR = join61(CACHE_ROOT_DIR, ".chrome.install.lock");
|
|
115615
|
+
INSTALL_RECLAIM_LOCK_DIR = join61(CACHE_ROOT_DIR, ".chrome.install.reclaim.lock");
|
|
115418
115616
|
INSTALL_LOCK_TIMINGS = {
|
|
115419
115617
|
staleMs: 12e4,
|
|
115420
115618
|
pollMs: 200,
|
|
@@ -115446,7 +115644,7 @@ __export(manager_exports3, {
|
|
|
115446
115644
|
});
|
|
115447
115645
|
import { existsSync as existsSync54, mkdirSync as mkdirSync30 } from "fs";
|
|
115448
115646
|
import { homedir as homedir12, platform as platform6, arch } from "os";
|
|
115449
|
-
import { join as
|
|
115647
|
+
import { join as join63 } from "path";
|
|
115450
115648
|
function isDevice(value) {
|
|
115451
115649
|
return typeof value === "string" && DEVICES2.includes(value);
|
|
115452
115650
|
}
|
|
@@ -115486,7 +115684,7 @@ function listAvailableProviders() {
|
|
|
115486
115684
|
return out;
|
|
115487
115685
|
}
|
|
115488
115686
|
function modelPath(model = DEFAULT_MODEL2) {
|
|
115489
|
-
return
|
|
115687
|
+
return join63(MODELS_DIR2, `${model}.onnx`);
|
|
115490
115688
|
}
|
|
115491
115689
|
async function ensureModel2(model = DEFAULT_MODEL2, options) {
|
|
115492
115690
|
const dest = modelPath(model);
|
|
@@ -115504,7 +115702,7 @@ var init_manager3 = __esm({
|
|
|
115504
115702
|
"src/background-removal/manager.ts"() {
|
|
115505
115703
|
"use strict";
|
|
115506
115704
|
init_download();
|
|
115507
|
-
MODELS_DIR2 =
|
|
115705
|
+
MODELS_DIR2 = join63(homedir12(), ".cache", "hyperframes", "background-removal", "models");
|
|
115508
115706
|
DEFAULT_MODEL2 = "u2net_human_seg";
|
|
115509
115707
|
MODEL_URLS = {
|
|
115510
115708
|
u2net_human_seg: "https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx"
|
|
@@ -116004,7 +116202,7 @@ __export(studioServer_exports, {
|
|
|
116004
116202
|
import { Hono as Hono5 } from "hono";
|
|
116005
116203
|
import { streamSSE as streamSSE4 } from "hono/streaming";
|
|
116006
116204
|
import { existsSync as existsSync55, readFileSync as readFileSync34, writeFileSync as writeFileSync21, statSync as statSync18, unlinkSync as unlinkSync4 } from "fs";
|
|
116007
|
-
import { resolve as resolve30, join as
|
|
116205
|
+
import { resolve as resolve30, join as join64, basename as basename8 } from "path";
|
|
116008
116206
|
async function loadStudioProducer() {
|
|
116009
116207
|
return isDevMode() ? await Promise.resolve().then(() => (init_src2(), src_exports2)) : await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
116010
116208
|
}
|
|
@@ -116052,7 +116250,7 @@ function resolveRuntimePath() {
|
|
|
116052
116250
|
return builtPath;
|
|
116053
116251
|
}
|
|
116054
116252
|
function readStudioManualEditManifestContent(projectDir) {
|
|
116055
|
-
const manifestPath2 =
|
|
116253
|
+
const manifestPath2 = join64(projectDir, STUDIO_MANUAL_EDITS_PATH2);
|
|
116056
116254
|
if (!existsSync55(manifestPath2)) return "";
|
|
116057
116255
|
try {
|
|
116058
116256
|
return readFileSync34(manifestPath2, "utf-8");
|
|
@@ -116158,7 +116356,7 @@ async function loadPreviewServerBuildSignature() {
|
|
|
116158
116356
|
]);
|
|
116159
116357
|
}
|
|
116160
116358
|
function rewriteWrittenToHostViewport(projectDir, written) {
|
|
116161
|
-
const indexPath2 =
|
|
116359
|
+
const indexPath2 = join64(projectDir, "index.html");
|
|
116162
116360
|
if (!existsSync55(indexPath2)) return;
|
|
116163
116361
|
const indexHtml = readFileSync34(indexPath2, "utf-8");
|
|
116164
116362
|
const hostW = indexHtml.match(/data-width="(\d+)"/)?.[1];
|
|
@@ -116218,8 +116416,8 @@ function createStudioServer(options) {
|
|
|
116218
116416
|
const { injectDeterministicFontFaces: injectDeterministicFontFaces2 } = await Promise.resolve().then(() => (init_deterministicFonts(), deterministicFonts_exports));
|
|
116219
116417
|
const { prepareAnimatedGifInputs: prepareAnimatedGifInputs2 } = await Promise.resolve().then(() => (init_animatedGifPrep(), animatedGifPrep_exports));
|
|
116220
116418
|
const { downloadToTemp: downloadToTemp2 } = await Promise.resolve().then(() => (init_urlDownloader2(), urlDownloader_exports));
|
|
116221
|
-
const gifOutputDir =
|
|
116222
|
-
const gifDownloadDir =
|
|
116419
|
+
const gifOutputDir = join64(project2.dir, ".hyperframes", "prepared-assets", "gif");
|
|
116420
|
+
const gifDownloadDir = join64(project2.dir, ".hyperframes", "prepared-assets", "downloads");
|
|
116223
116421
|
const prepared = await prepareAnimatedGifInputs2(html, {
|
|
116224
116422
|
projectDir: project2.dir,
|
|
116225
116423
|
downloadDir: gifDownloadDir,
|
|
@@ -116240,7 +116438,7 @@ function createStudioServer(options) {
|
|
|
116240
116438
|
return await lintHyperframeHtml2(html, opts);
|
|
116241
116439
|
},
|
|
116242
116440
|
runtimeUrl: "/api/runtime.js",
|
|
116243
|
-
rendersDir: () =>
|
|
116441
|
+
rendersDir: () => join64(projectDir, "renders"),
|
|
116244
116442
|
startRender(opts) {
|
|
116245
116443
|
const abortController = new AbortController();
|
|
116246
116444
|
const state = {
|
|
@@ -116614,7 +116812,7 @@ __export(preview_exports, {
|
|
|
116614
116812
|
});
|
|
116615
116813
|
import { spawn as spawn13 } from "child_process";
|
|
116616
116814
|
import { existsSync as existsSync56, lstatSync as lstatSync4, symlinkSync as symlinkSync3, unlinkSync as unlinkSync5, readlinkSync, mkdirSync as mkdirSync31 } from "fs";
|
|
116617
|
-
import { resolve as resolve31, dirname as dirname25, basename as basename9, join as
|
|
116815
|
+
import { resolve as resolve31, dirname as dirname25, basename as basename9, join as join65 } from "path";
|
|
116618
116816
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
116619
116817
|
import { createRequire as createRequire2 } from "module";
|
|
116620
116818
|
function previewBaseUrl(port, host = "127.0.0.1") {
|
|
@@ -116920,7 +117118,7 @@ function printStudioSummary(projectName, url, opts = {}) {
|
|
|
116920
117118
|
console.log();
|
|
116921
117119
|
}
|
|
116922
117120
|
function linkProjectIntoStudioData(dir, projectsDir, projectName) {
|
|
116923
|
-
const symlinkPath =
|
|
117121
|
+
const symlinkPath = join65(projectsDir, projectName);
|
|
116924
117122
|
mkdirSync31(projectsDir, { recursive: true });
|
|
116925
117123
|
let createdSymlink = false;
|
|
116926
117124
|
if (dir !== symlinkPath) {
|
|
@@ -116983,13 +117181,13 @@ function attachStudioReadyHandler(child, spinner, projectName, options) {
|
|
|
116983
117181
|
async function runDevMode(dir, options) {
|
|
116984
117182
|
const thisFile = fileURLToPath8(import.meta.url);
|
|
116985
117183
|
const repoRoot2 = resolve31(dirname25(thisFile), "..", "..", "..", "..");
|
|
116986
|
-
const projectsDir =
|
|
117184
|
+
const projectsDir = join65(repoRoot2, "packages", "studio", "data", "projects");
|
|
116987
117185
|
const pName = options?.projectName ?? basename9(dir);
|
|
116988
117186
|
const { symlinkPath, createdSymlink } = linkProjectIntoStudioData(dir, projectsDir, pName);
|
|
116989
117187
|
ge(c.bold("hyperframes preview"));
|
|
116990
117188
|
const s2 = ft();
|
|
116991
117189
|
s2.start("Starting studio...");
|
|
116992
|
-
const studioPkgDir =
|
|
117190
|
+
const studioPkgDir = join65(repoRoot2, "packages", "studio");
|
|
116993
117191
|
const child = spawn13("bun", ["run", "dev"], {
|
|
116994
117192
|
cwd: studioPkgDir,
|
|
116995
117193
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -117001,7 +117199,7 @@ async function runDevMode(dir, options) {
|
|
|
117001
117199
|
}
|
|
117002
117200
|
function hasLocalStudio(dir) {
|
|
117003
117201
|
try {
|
|
117004
|
-
const req = createRequire2(
|
|
117202
|
+
const req = createRequire2(join65(dir, "package.json"));
|
|
117005
117203
|
req.resolve("@hyperframes/studio/package.json");
|
|
117006
117204
|
return true;
|
|
117007
117205
|
} catch {
|
|
@@ -117009,10 +117207,10 @@ function hasLocalStudio(dir) {
|
|
|
117009
117207
|
}
|
|
117010
117208
|
}
|
|
117011
117209
|
async function runLocalStudioMode(dir, options) {
|
|
117012
|
-
const req = createRequire2(
|
|
117210
|
+
const req = createRequire2(join65(dir, "package.json"));
|
|
117013
117211
|
const studioPkgPath = dirname25(req.resolve("@hyperframes/studio/package.json"));
|
|
117014
117212
|
const pName = options?.projectName ?? basename9(dir);
|
|
117015
|
-
const projectsDir =
|
|
117213
|
+
const projectsDir = join65(studioPkgPath, "data", "projects");
|
|
117016
117214
|
const { symlinkPath, createdSymlink } = linkProjectIntoStudioData(dir, projectsDir, pName);
|
|
117017
117215
|
ge(c.bold("hyperframes preview") + c.dim(" (local studio)"));
|
|
117018
117216
|
const s2 = ft();
|
|
@@ -117375,7 +117573,7 @@ import {
|
|
|
117375
117573
|
readFileSync as readFileSync35,
|
|
117376
117574
|
readdirSync as readdirSync21
|
|
117377
117575
|
} from "fs";
|
|
117378
|
-
import { resolve as resolve33, basename as basename10, join as
|
|
117576
|
+
import { resolve as resolve33, basename as basename10, join as join66, dirname as dirname26 } from "path";
|
|
117379
117577
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
117380
117578
|
import { execFileSync as execFileSync7, spawn as spawn14 } from "child_process";
|
|
117381
117579
|
function probeVideo(filePath) {
|
|
@@ -117509,7 +117707,7 @@ function listHtmlFiles(dir) {
|
|
|
117509
117707
|
const ignoredDirs = /* @__PURE__ */ new Set([".git", "dist", "node_modules"]);
|
|
117510
117708
|
function walk(currentDir) {
|
|
117511
117709
|
for (const entry of readdirSync21(currentDir, { withFileTypes: true })) {
|
|
117512
|
-
const entryPath =
|
|
117710
|
+
const entryPath = join66(currentDir, entry.name);
|
|
117513
117711
|
if (entry.isDirectory()) {
|
|
117514
117712
|
if (!ignoredDirs.has(entry.name)) walk(entryPath);
|
|
117515
117713
|
continue;
|
|
@@ -117554,7 +117752,7 @@ function writeTailwindSupport(destDir) {
|
|
|
117554
117752
|
}
|
|
117555
117753
|
}
|
|
117556
117754
|
function patchVideoSrc(dir, videoFilename, durationSeconds) {
|
|
117557
|
-
const htmlFiles = readdirSync21(dir, { withFileTypes: true, recursive: true }).filter((e3) => e3.isFile() && e3.name.endsWith(".html")).map((e3) =>
|
|
117755
|
+
const htmlFiles = readdirSync21(dir, { withFileTypes: true, recursive: true }).filter((e3) => e3.isFile() && e3.name.endsWith(".html")).map((e3) => join66(e3.parentPath, e3.name));
|
|
117558
117756
|
for (const file of htmlFiles) {
|
|
117559
117757
|
let content = readFileSync35(file, "utf-8");
|
|
117560
117758
|
if (videoFilename) {
|
|
@@ -117709,7 +117907,7 @@ function applyResolutionPreset(destDir, resolution) {
|
|
|
117709
117907
|
async function scaffoldProject(destDir, name, templateId, localVideoName, durationSeconds, tailwind = false, resolution) {
|
|
117710
117908
|
mkdirSync33(destDir, { recursive: true });
|
|
117711
117909
|
const templateDir = getStaticTemplateDir(templateId);
|
|
117712
|
-
if (existsSync57(
|
|
117910
|
+
if (existsSync57(join66(templateDir, "index.html"))) {
|
|
117713
117911
|
cpSync5(templateDir, destDir, { recursive: true });
|
|
117714
117912
|
} else {
|
|
117715
117913
|
await fetchRemoteTemplate(templateId, destDir);
|
|
@@ -117738,7 +117936,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
|
|
|
117738
117936
|
const sharedDir = getSharedTemplateDir();
|
|
117739
117937
|
if (existsSync57(sharedDir)) {
|
|
117740
117938
|
for (const entry of readdirSync21(sharedDir, { withFileTypes: true })) {
|
|
117741
|
-
const src =
|
|
117939
|
+
const src = join66(sharedDir, entry.name);
|
|
117742
117940
|
const dest = resolve33(destDir, entry.name);
|
|
117743
117941
|
if (entry.isFile() || entry.isSymbolicLink()) {
|
|
117744
117942
|
copyFileSync7(src, dest);
|
|
@@ -119249,7 +119447,7 @@ var init_present = __esm({
|
|
|
119249
119447
|
});
|
|
119250
119448
|
|
|
119251
119449
|
// src/utils/publishProject.ts
|
|
119252
|
-
import { basename as basename11, dirname as dirname28, join as
|
|
119450
|
+
import { basename as basename11, dirname as dirname28, join as join67, posix as posix5, relative as relative13, resolve as resolve39 } from "path";
|
|
119253
119451
|
import { existsSync as existsSync63, readdirSync as readdirSync23, readFileSync as readFileSync38, statSync as statSync19 } from "fs";
|
|
119254
119452
|
import AdmZip from "adm-zip";
|
|
119255
119453
|
function isRecord4(value) {
|
|
@@ -119350,7 +119548,7 @@ function shouldIgnoreSegment(segment) {
|
|
|
119350
119548
|
function collectProjectFiles(rootDir, currentDir, paths) {
|
|
119351
119549
|
for (const entry of readdirSync23(currentDir, { withFileTypes: true })) {
|
|
119352
119550
|
if (shouldIgnoreSegment(entry.name)) continue;
|
|
119353
|
-
const absolutePath =
|
|
119551
|
+
const absolutePath = join67(currentDir, entry.name);
|
|
119354
119552
|
const relativePath = relative13(rootDir, absolutePath).replaceAll("\\", "/");
|
|
119355
119553
|
if (!relativePath) continue;
|
|
119356
119554
|
if (entry.isDirectory()) {
|
|
@@ -119480,7 +119678,7 @@ function createPublishArchive(projectDir) {
|
|
|
119480
119678
|
}
|
|
119481
119679
|
const fileContents = /* @__PURE__ */ new Map();
|
|
119482
119680
|
for (const filePath of filePaths) {
|
|
119483
|
-
fileContents.set(filePath, readFileSync38(
|
|
119681
|
+
fileContents.set(filePath, readFileSync38(join67(absProjectDir, filePath)));
|
|
119484
119682
|
}
|
|
119485
119683
|
localizeExternalAssets(absProjectDir, fileContents);
|
|
119486
119684
|
const archive = new AdmZip();
|
|
@@ -119613,7 +119811,7 @@ __export(publish_exports, {
|
|
|
119613
119811
|
});
|
|
119614
119812
|
import { resolve as resolve40 } from "path";
|
|
119615
119813
|
import { existsSync as existsSync64 } from "fs";
|
|
119616
|
-
import { join as
|
|
119814
|
+
import { join as join68 } from "path";
|
|
119617
119815
|
var examples8, publish_default;
|
|
119618
119816
|
var init_publish = __esm({
|
|
119619
119817
|
"src/commands/publish.ts"() {
|
|
@@ -119652,7 +119850,7 @@ var init_publish = __esm({
|
|
|
119652
119850
|
async run({ args }) {
|
|
119653
119851
|
const rawArg = args.dir;
|
|
119654
119852
|
const dir = resolve40(rawArg ?? ".");
|
|
119655
|
-
const indexPath2 =
|
|
119853
|
+
const indexPath2 = join68(dir, "index.html");
|
|
119656
119854
|
if (existsSync64(indexPath2)) {
|
|
119657
119855
|
const lintResult = await lintProject(dir);
|
|
119658
119856
|
if (lintResult.totalErrors > 0 || lintResult.totalWarnings > 0) {
|
|
@@ -119858,7 +120056,7 @@ var init_variables = __esm({
|
|
|
119858
120056
|
|
|
119859
120057
|
// src/utils/compositionFps.ts
|
|
119860
120058
|
import { readFileSync as readFileSync40 } from "fs";
|
|
119861
|
-
import { join as
|
|
120059
|
+
import { join as join69 } from "path";
|
|
119862
120060
|
function readCompositionFps(html) {
|
|
119863
120061
|
let doc;
|
|
119864
120062
|
try {
|
|
@@ -119876,7 +120074,7 @@ function readCompositionFps(html) {
|
|
|
119876
120074
|
function readAllowedCompositionFpsFromDir(projectDir, allowed) {
|
|
119877
120075
|
let html;
|
|
119878
120076
|
try {
|
|
119879
|
-
html = readFileSync40(
|
|
120077
|
+
html = readFileSync40(join69(projectDir, "index.html"), "utf8");
|
|
119880
120078
|
} catch {
|
|
119881
120079
|
return null;
|
|
119882
120080
|
}
|
|
@@ -120527,7 +120725,7 @@ __export(batchRender_exports, {
|
|
|
120527
120725
|
runBatchRender: () => runBatchRender
|
|
120528
120726
|
});
|
|
120529
120727
|
import { mkdirSync as mkdirSync34, readFileSync as readFileSync43, writeFileSync as writeFileSync24 } from "fs";
|
|
120530
|
-
import { dirname as dirname29, join as
|
|
120728
|
+
import { dirname as dirname29, join as join70, resolve as resolve43, sep as sep8 } from "path";
|
|
120531
120729
|
function isRecord5(value) {
|
|
120532
120730
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
120533
120731
|
}
|
|
@@ -120663,7 +120861,7 @@ function prepareBatchRender(options) {
|
|
|
120663
120861
|
variables,
|
|
120664
120862
|
outputPath: resolve43(resolveOutputTemplate(options.outputTemplate, variables, index))
|
|
120665
120863
|
}));
|
|
120666
|
-
const manifestPath2 =
|
|
120864
|
+
const manifestPath2 = join70(
|
|
120667
120865
|
commonOutputDirectory(rows.map((row) => row.outputPath)),
|
|
120668
120866
|
"manifest.json"
|
|
120669
120867
|
);
|
|
@@ -120868,6 +121066,7 @@ var init_batchRender = __esm({
|
|
|
120868
121066
|
// src/commands/render.ts
|
|
120869
121067
|
var render_exports = {};
|
|
120870
121068
|
__export(render_exports, {
|
|
121069
|
+
__resetDeParallelRouterTrialStateForTests: () => __resetDeParallelRouterTrialStateForTests,
|
|
120871
121070
|
checkRenderResolutionPreflight: () => checkRenderResolutionPreflight,
|
|
120872
121071
|
default: () => render_default,
|
|
120873
121072
|
examples: () => examples9,
|
|
@@ -120876,7 +121075,7 @@ __export(render_exports, {
|
|
|
120876
121075
|
});
|
|
120877
121076
|
import { mkdirSync as mkdirSync35, readdirSync as readdirSync24, readFileSync as readFileSync44, statSync as statSync20, writeFileSync as writeFileSync25, rmSync as rmSync19 } from "fs";
|
|
120878
121077
|
import { cpus as cpus4, freemem as freemem5, tmpdir as tmpdir7 } from "os";
|
|
120879
|
-
import { resolve as resolve44, dirname as dirname30, join as
|
|
121078
|
+
import { resolve as resolve44, dirname as dirname30, join as join71, basename as basename12 } from "path";
|
|
120880
121079
|
import { execFileSync as execFileSync10, spawn as spawn15 } from "child_process";
|
|
120881
121080
|
function formatFpsParseError(input2, reason) {
|
|
120882
121081
|
switch (reason) {
|
|
@@ -120968,9 +121167,9 @@ function ensureDockerImage(version2, platform10, quiet) {
|
|
|
120968
121167
|
}
|
|
120969
121168
|
if (!quiet) console.log(c.dim(` Building Docker image: ${tag} (${platform10})...`));
|
|
120970
121169
|
const dockerfilePath = resolveDockerfilePath();
|
|
120971
|
-
const tmpDir =
|
|
121170
|
+
const tmpDir = join71(tmpdir7(), `hyperframes-docker-${Date.now()}`);
|
|
120972
121171
|
mkdirSync35(tmpDir, { recursive: true });
|
|
120973
|
-
writeFileSync25(
|
|
121172
|
+
writeFileSync25(join71(tmpDir, "Dockerfile"), readFileSync44(dockerfilePath));
|
|
120974
121173
|
const targetArch = platform10 === "linux/arm64" ? "arm64" : "amd64";
|
|
120975
121174
|
try {
|
|
120976
121175
|
execFileSync10(
|
|
@@ -121132,6 +121331,10 @@ async function renderLocal(projectDir, outputPath, options) {
|
|
|
121132
121331
|
process.env.PRODUCER_HEADLESS_SHELL_PATH = preflight.browser.executablePath;
|
|
121133
121332
|
}
|
|
121134
121333
|
const producer = await loadProducer();
|
|
121334
|
+
const deParallelRouterTrialArmed = maybeEnableDeParallelRouterTrial(
|
|
121335
|
+
options.quiet,
|
|
121336
|
+
options.enableDeParallelRouterTrial === true
|
|
121337
|
+
);
|
|
121135
121338
|
const startTime = Date.now();
|
|
121136
121339
|
const logger = createRenderTelemetryLogger(
|
|
121137
121340
|
producer.createConsoleLogger?.(options.debug ? "debug" : "info") ?? createNoopProducerLogger()
|
|
@@ -121166,6 +121369,7 @@ async function renderLocal(projectDir, outputPath, options) {
|
|
|
121166
121369
|
try {
|
|
121167
121370
|
await producer.executeRenderJob(job, projectDir, outputPath, onProgress);
|
|
121168
121371
|
} catch (error) {
|
|
121372
|
+
maybeConsumeDeParallelRouterTrial(deParallelRouterTrialArmed, job, options.quiet);
|
|
121169
121373
|
handleRenderError(
|
|
121170
121374
|
error,
|
|
121171
121375
|
options,
|
|
@@ -121176,6 +121380,7 @@ async function renderLocal(projectDir, outputPath, options) {
|
|
|
121176
121380
|
job
|
|
121177
121381
|
);
|
|
121178
121382
|
}
|
|
121383
|
+
maybeConsumeDeParallelRouterTrial(deParallelRouterTrialArmed, job, options.quiet);
|
|
121179
121384
|
const elapsed = Date.now() - startTime;
|
|
121180
121385
|
trackRenderMetrics(job, elapsed, options, false);
|
|
121181
121386
|
printRenderComplete(
|
|
@@ -121290,6 +121495,86 @@ function createNoopProducerLogger() {
|
|
|
121290
121495
|
}
|
|
121291
121496
|
};
|
|
121292
121497
|
}
|
|
121498
|
+
function __resetDeParallelRouterTrialStateForTests() {
|
|
121499
|
+
deParallelRouterTrialManagedByUs = false;
|
|
121500
|
+
deParallelRouterTrialFiredThisProcess = false;
|
|
121501
|
+
}
|
|
121502
|
+
function isDeParallelRouterTrialBlocked(config) {
|
|
121503
|
+
const overRenderCap = (config.deParallelRouterTrialRenderCount ?? 0) >= DE_PARALLEL_ROUTER_TRIAL_MAX_RENDERS;
|
|
121504
|
+
return deParallelRouterTrialFiredThisProcess || Boolean(config.deParallelRouterTrialFired) || overRenderCap || !config.telemetryEnabled || !shouldTrack() || // cli.ts shows the first-run telemetry disclosure via a fire-and-forget,
|
|
121505
|
+
// unawaited dynamic import — there's no guarantee it has printed before
|
|
121506
|
+
// this render command reaches this point. Requiring telemetryNoticeShown
|
|
121507
|
+
// means the trial simply never offers itself on a fresh install's very
|
|
121508
|
+
// first invocation (before the disclosure is guaranteed to have run at
|
|
121509
|
+
// least once), rather than racing an experimental opt-in message against
|
|
121510
|
+
// the disclosure it depends on (review finding).
|
|
121511
|
+
!config.telemetryNoticeShown;
|
|
121512
|
+
}
|
|
121513
|
+
function stopManagingDeParallelRouterTrial() {
|
|
121514
|
+
if (!deParallelRouterTrialManagedByUs) return;
|
|
121515
|
+
delete process.env.HF_DE_PARALLEL_ROUTER;
|
|
121516
|
+
deParallelRouterTrialManagedByUs = false;
|
|
121517
|
+
}
|
|
121518
|
+
function maybeEnableDeParallelRouterTrial(quiet, enabled) {
|
|
121519
|
+
if (!enabled) return false;
|
|
121520
|
+
if (deParallelRouterTrialFiredThisProcess) {
|
|
121521
|
+
stopManagingDeParallelRouterTrial();
|
|
121522
|
+
return false;
|
|
121523
|
+
}
|
|
121524
|
+
const userSetIt = process.env.HF_DE_PARALLEL_ROUTER !== void 0 && !deParallelRouterTrialManagedByUs;
|
|
121525
|
+
if (userSetIt) return false;
|
|
121526
|
+
if (isDeParallelRouterTrialBlocked(readConfigFresh())) {
|
|
121527
|
+
stopManagingDeParallelRouterTrial();
|
|
121528
|
+
return false;
|
|
121529
|
+
}
|
|
121530
|
+
if (deParallelRouterTrialManagedByUs) return true;
|
|
121531
|
+
deParallelRouterTrialManagedByUs = true;
|
|
121532
|
+
process.env.HF_DE_PARALLEL_ROUTER = "true";
|
|
121533
|
+
if (!quiet) {
|
|
121534
|
+
console.log(
|
|
121535
|
+
c.dim(
|
|
121536
|
+
" Trying the experimental parallel drawElement capture path for this install (disabled automatically if it ever needs to fall back; opt out anytime: HF_DE_PARALLEL_ROUTER=false)"
|
|
121537
|
+
)
|
|
121538
|
+
);
|
|
121539
|
+
}
|
|
121540
|
+
return true;
|
|
121541
|
+
}
|
|
121542
|
+
function resolveDeParallelRouterOutcome(job) {
|
|
121543
|
+
const outcome = job.perfSummary?.drawElement?.parallelRouter ?? job.errorDetails?.observability?.capture.deParallelRouter;
|
|
121544
|
+
return outcome === "none" ? void 0 : outcome;
|
|
121545
|
+
}
|
|
121546
|
+
function persistDeParallelRouterTrialFired() {
|
|
121547
|
+
const MAX_ATTEMPTS = 3;
|
|
121548
|
+
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
121549
|
+
const config = readConfigFresh();
|
|
121550
|
+
if (config.deParallelRouterTrialFired) return true;
|
|
121551
|
+
config.deParallelRouterTrialFired = true;
|
|
121552
|
+
if (!writeConfig(config)) return false;
|
|
121553
|
+
}
|
|
121554
|
+
return Boolean(readConfigFresh().deParallelRouterTrialFired);
|
|
121555
|
+
}
|
|
121556
|
+
function maybeConsumeDeParallelRouterTrial(trialArmed, job, quiet) {
|
|
121557
|
+
if (!trialArmed) return;
|
|
121558
|
+
const outcome = resolveDeParallelRouterOutcome(job);
|
|
121559
|
+
if (outcome === void 0) return;
|
|
121560
|
+
const config = readConfigFresh();
|
|
121561
|
+
const renderCount = (config.deParallelRouterTrialRenderCount ?? 0) + 1;
|
|
121562
|
+
config.deParallelRouterTrialRenderCount = renderCount;
|
|
121563
|
+
const fired = outcome === "reverted" || renderCount >= DE_PARALLEL_ROUTER_TRIAL_MAX_RENDERS;
|
|
121564
|
+
if (fired) {
|
|
121565
|
+
config.deParallelRouterTrialFired = true;
|
|
121566
|
+
deParallelRouterTrialFiredThisProcess = true;
|
|
121567
|
+
stopManagingDeParallelRouterTrial();
|
|
121568
|
+
}
|
|
121569
|
+
writeConfig(config);
|
|
121570
|
+
if (fired && !persistDeParallelRouterTrialFired() && !quiet) {
|
|
121571
|
+
console.warn(
|
|
121572
|
+
c.warn(
|
|
121573
|
+
" Could not persist the parallel drawElement trial's off-switch to ~/.hyperframes/config.json (unwritable?). The experiment stays off for this process; future runs may retry it. Set HF_DE_PARALLEL_ROUTER=false to opt out."
|
|
121574
|
+
)
|
|
121575
|
+
);
|
|
121576
|
+
}
|
|
121577
|
+
}
|
|
121293
121578
|
function handleRenderError(error, options, startTime, docker, hint2, failedStage, job) {
|
|
121294
121579
|
const message = normalizeErrorMessage(error);
|
|
121295
121580
|
trackRenderError({
|
|
@@ -121400,7 +121685,7 @@ function printRenderComplete(outputPath, elapsedMs, quiet, outputDurationSeconds
|
|
|
121400
121685
|
for (const entry of readdirSync24(outputPath, { withFileTypes: true })) {
|
|
121401
121686
|
if (!entry.isFile()) continue;
|
|
121402
121687
|
try {
|
|
121403
|
-
total += statSync20(
|
|
121688
|
+
total += statSync20(join71(outputPath, entry.name)).size;
|
|
121404
121689
|
} catch {
|
|
121405
121690
|
}
|
|
121406
121691
|
}
|
|
@@ -121420,7 +121705,7 @@ function printRenderComplete(outputPath, elapsedMs, quiet, outputDurationSeconds
|
|
|
121420
121705
|
console.log(c.success("\u25C7") + " " + c.accent(outputPath));
|
|
121421
121706
|
console.log(" " + c.bold(fileSize) + c.dim(" \xB7 " + detail));
|
|
121422
121707
|
}
|
|
121423
|
-
var examples9, VALID_QUALITY, RENDER_FORMATS, VALID_FORMAT, RENDER_FORMAT_LABEL, FORMAT_EXT, CPU_CORE_COUNT, render_default, DOCKER_IMAGE_PREFIX;
|
|
121708
|
+
var examples9, VALID_QUALITY, RENDER_FORMATS, VALID_FORMAT, RENDER_FORMAT_LABEL, FORMAT_EXT, CPU_CORE_COUNT, render_default, DOCKER_IMAGE_PREFIX, DE_PARALLEL_ROUTER_TRIAL_MAX_RENDERS, deParallelRouterTrialManagedByUs, deParallelRouterTrialFiredThisProcess;
|
|
121424
121709
|
var init_render = __esm({
|
|
121425
121710
|
"src/commands/render.ts"() {
|
|
121426
121711
|
"use strict";
|
|
@@ -121437,6 +121722,8 @@ var init_render = __esm({
|
|
|
121437
121722
|
init_progress();
|
|
121438
121723
|
init_events();
|
|
121439
121724
|
init_feedback();
|
|
121725
|
+
init_config();
|
|
121726
|
+
init_client();
|
|
121440
121727
|
init_renderObservability();
|
|
121441
121728
|
init_skill();
|
|
121442
121729
|
init_system();
|
|
@@ -121834,8 +122121,8 @@ var init_render = __esm({
|
|
|
121834
122121
|
const now = /* @__PURE__ */ new Date();
|
|
121835
122122
|
const datePart = now.toISOString().slice(0, 10);
|
|
121836
122123
|
const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
|
|
121837
|
-
const batchOutputTemplate = args.output ? args.output :
|
|
121838
|
-
const outputPath = args.output ? resolve44(args.output) :
|
|
122124
|
+
const batchOutputTemplate = args.output ? args.output : join71(rendersDir, `${project.name}_${datePart}_${timePart}_{index}${ext}`);
|
|
122125
|
+
const outputPath = args.output ? resolve44(args.output) : join71(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
|
|
121839
122126
|
if (!batchPath) mkdirSync35(dirname30(outputPath), { recursive: true });
|
|
121840
122127
|
const useDocker = args.docker ?? false;
|
|
121841
122128
|
const useGpu = args.gpu ?? false;
|
|
@@ -122051,7 +122338,11 @@ var init_render = __esm({
|
|
|
122051
122338
|
debug,
|
|
122052
122339
|
exitAfterComplete: false,
|
|
122053
122340
|
throwOnError: true,
|
|
122054
|
-
skipFeedback: true
|
|
122341
|
+
skipFeedback: true,
|
|
122342
|
+
// Sequential batch rows may trial; real concurrent workers
|
|
122343
|
+
// (batchConcurrency > 1) can't safely share the trial's process-wide
|
|
122344
|
+
// env var/flags — see enableDeParallelRouterTrial's own doc comment.
|
|
122345
|
+
enableDeParallelRouterTrial: batchConcurrency <= 1
|
|
122055
122346
|
};
|
|
122056
122347
|
const manifest = await batchModule.runBatchRender({
|
|
122057
122348
|
prepared: preparedBatch,
|
|
@@ -122128,12 +122419,18 @@ var init_render = __esm({
|
|
|
122128
122419
|
pageNavigationTimeoutMs,
|
|
122129
122420
|
protocolTimeout,
|
|
122130
122421
|
playerReadyTimeout,
|
|
122131
|
-
exitAfterComplete: true
|
|
122422
|
+
exitAfterComplete: true,
|
|
122423
|
+
// The single top-level CLI render is sequential by construction — the
|
|
122424
|
+
// one place the trial's process-wide state is unconditionally safe.
|
|
122425
|
+
enableDeParallelRouterTrial: true
|
|
122132
122426
|
});
|
|
122133
122427
|
}
|
|
122134
122428
|
}
|
|
122135
122429
|
});
|
|
122136
122430
|
DOCKER_IMAGE_PREFIX = "hyperframes-renderer";
|
|
122431
|
+
DE_PARALLEL_ROUTER_TRIAL_MAX_RENDERS = 25;
|
|
122432
|
+
deParallelRouterTrialManagedByUs = false;
|
|
122433
|
+
deParallelRouterTrialFiredThisProcess = false;
|
|
122137
122434
|
}
|
|
122138
122435
|
});
|
|
122139
122436
|
|
|
@@ -122732,7 +123029,7 @@ var init_motionAudit = __esm({
|
|
|
122732
123029
|
|
|
122733
123030
|
// src/utils/motionSpec.ts
|
|
122734
123031
|
import { existsSync as existsSync67, readFileSync as readFileSync45, readdirSync as readdirSync25 } from "fs";
|
|
122735
|
-
import { basename as basename13, join as
|
|
123032
|
+
import { basename as basename13, join as join73 } from "path";
|
|
122736
123033
|
function isObject2(value) {
|
|
122737
123034
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
122738
123035
|
}
|
|
@@ -122778,7 +123075,7 @@ function findMotionSpec(projectDir) {
|
|
|
122778
123075
|
const entries2 = readdirSync25(projectDir);
|
|
122779
123076
|
const sidecars = entries2.filter((name) => name.endsWith(".motion.json")).sort();
|
|
122780
123077
|
if (!sidecars[0]) return null;
|
|
122781
|
-
if (sidecars.length === 1) return
|
|
123078
|
+
if (sidecars.length === 1) return join73(projectDir, sidecars[0]);
|
|
122782
123079
|
const htmlBases = new Set(
|
|
122783
123080
|
entries2.filter((name) => name.endsWith(".html")).map((name) => basename13(name, ".html"))
|
|
122784
123081
|
);
|
|
@@ -122788,7 +123085,7 @@ function findMotionSpec(projectDir) {
|
|
|
122788
123085
|
`ambiguous motion sidecars in ${projectDir}: ${matched.join(", ")} each match a composition \u2014 remove the sidecars you do not need, or use one composition per project`
|
|
122789
123086
|
);
|
|
122790
123087
|
}
|
|
122791
|
-
return
|
|
123088
|
+
return join73(projectDir, matched[0] ?? sidecars[0]);
|
|
122792
123089
|
}
|
|
122793
123090
|
function readMotionSpec(path2) {
|
|
122794
123091
|
let raw;
|
|
@@ -123147,7 +123444,7 @@ __export(layout_exports, {
|
|
|
123147
123444
|
parseAt: () => parseAt
|
|
123148
123445
|
});
|
|
123149
123446
|
import { existsSync as existsSync68, readFileSync as readFileSync46 } from "fs";
|
|
123150
|
-
import { dirname as dirname31, join as
|
|
123447
|
+
import { dirname as dirname31, join as join74 } from "path";
|
|
123151
123448
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
123152
123449
|
function buildMotionSampleTimes(duration) {
|
|
123153
123450
|
if (!Number.isFinite(duration) || duration <= 0) return [];
|
|
@@ -123289,7 +123586,7 @@ async function runLayoutAudit(projectDir, opts) {
|
|
|
123289
123586
|
}
|
|
123290
123587
|
}
|
|
123291
123588
|
function loadBrowserScript(name) {
|
|
123292
|
-
const candidates = [
|
|
123589
|
+
const candidates = [join74(__dirname2, name), join74(__dirname2, "commands", name)];
|
|
123293
123590
|
for (const candidate of candidates) {
|
|
123294
123591
|
if (existsSync68(candidate)) return readFileSync46(candidate, "utf-8");
|
|
123295
123592
|
}
|
|
@@ -123686,7 +123983,7 @@ __export(validate_exports, {
|
|
|
123686
123983
|
});
|
|
123687
123984
|
import { existsSync as existsSync69, mkdtempSync as mkdtempSync6, readFileSync as readFileSync47, rmSync as rmSync20 } from "fs";
|
|
123688
123985
|
import { tmpdir as tmpdir8 } from "os";
|
|
123689
|
-
import { join as
|
|
123986
|
+
import { join as join75, dirname as dirname32 } from "path";
|
|
123690
123987
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
123691
123988
|
function resolveNavigationTimeoutMs(optTimeout) {
|
|
123692
123989
|
return Math.max(NAV_TIMEOUT_FLOOR_MS, optTimeout ?? 0);
|
|
@@ -123831,8 +124128,8 @@ async function runContrastAudit(page) {
|
|
|
123831
124128
|
}
|
|
123832
124129
|
function loadContrastAuditScript() {
|
|
123833
124130
|
const candidates = [
|
|
123834
|
-
|
|
123835
|
-
|
|
124131
|
+
join75(__dirname3, "contrast-audit.browser.js"),
|
|
124132
|
+
join75(__dirname3, "commands", "contrast-audit.browser.js")
|
|
123836
124133
|
];
|
|
123837
124134
|
for (const candidate of candidates) {
|
|
123838
124135
|
if (existsSync69(candidate)) return readFileSync47(candidate, "utf-8");
|
|
@@ -123847,7 +124144,7 @@ async function localizeRemoteAssets(html) {
|
|
|
123847
124144
|
try {
|
|
123848
124145
|
const { loadProducer: loadProducer2 } = await Promise.resolve().then(() => (init_producer(), producer_exports));
|
|
123849
124146
|
const { localizeRemoteMediaSources: localizeRemoteMediaSources2, localizeRemoteImageSources: localizeRemoteImageSources2, localizeRemoteFontFaces: localizeRemoteFontFaces2 } = await loadProducer2();
|
|
123850
|
-
dir = mkdtempSync6(
|
|
124147
|
+
dir = mkdtempSync6(join75(tmpdir8(), "hf-validate-assets-"));
|
|
123851
124148
|
const assetDir = dir;
|
|
123852
124149
|
const media = await localizeRemoteMediaSources2(html, assetDir);
|
|
123853
124150
|
const images = await localizeRemoteImageSources2(media.html, assetDir);
|
|
@@ -124108,7 +124405,7 @@ __export(checkBrowser_exports, {
|
|
|
124108
124405
|
runBrowserCheck: () => runBrowserCheck
|
|
124109
124406
|
});
|
|
124110
124407
|
import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync26 } from "fs";
|
|
124111
|
-
import { join as
|
|
124408
|
+
import { join as join76 } from "path";
|
|
124112
124409
|
async function runBrowserCheck(project, options, motion, runGrid) {
|
|
124113
124410
|
const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
|
|
124114
124411
|
const html = await bundleToSingleHtml2(project.dir);
|
|
@@ -124163,7 +124460,7 @@ async function captureFindingCrops(project, options, requests) {
|
|
|
124163
124460
|
chromeBrowser = session.browser;
|
|
124164
124461
|
const page = session.page;
|
|
124165
124462
|
await waitForPreferredSeekTarget(page);
|
|
124166
|
-
const snapshotDir =
|
|
124463
|
+
const snapshotDir = join76(project.dir, "snapshots");
|
|
124167
124464
|
mkdirSync36(snapshotDir, { recursive: true });
|
|
124168
124465
|
for (const request of requests) {
|
|
124169
124466
|
await seekCompositionTimeline(page, request.time, AUDIT_SEEK_OPTIONS);
|
|
@@ -124173,8 +124470,8 @@ async function captureFindingCrops(project, options, requests) {
|
|
|
124173
124470
|
}));
|
|
124174
124471
|
const region = padCropRegion(request.bbox, canvas, DEFAULT_ZOOM_PADDING_PX);
|
|
124175
124472
|
const buffer = await captureRegionCrop(page, region, DEFAULT_ZOOM_SCALE);
|
|
124176
|
-
writeFileSync26(
|
|
124177
|
-
written.push(
|
|
124473
|
+
writeFileSync26(join76(snapshotDir, request.filename), buffer);
|
|
124474
|
+
written.push(join76("snapshots", request.filename));
|
|
124178
124475
|
}
|
|
124179
124476
|
return written;
|
|
124180
124477
|
} finally {
|
|
@@ -124847,7 +125144,7 @@ var init_checkBrowser = __esm({
|
|
|
124847
125144
|
|
|
124848
125145
|
// src/utils/checkPipeline.ts
|
|
124849
125146
|
import { mkdirSync as mkdirSync37, writeFileSync as writeFileSync27 } from "fs";
|
|
124850
|
-
import { join as
|
|
125147
|
+
import { join as join77, relative as relative15 } from "path";
|
|
124851
125148
|
function selectContrastTimes(grid) {
|
|
124852
125149
|
if (grid.length <= 5) return [...grid];
|
|
124853
125150
|
return Array.from({ length: 5 }, (_, index) => {
|
|
@@ -125443,12 +125740,12 @@ async function runBrowserCheck2(project, options, motion) {
|
|
|
125443
125740
|
return module.runBrowserCheck(project, options, motion, runAuditGrid);
|
|
125444
125741
|
}
|
|
125445
125742
|
async function writeSnapshot(projectDir, index, time, pngBase64) {
|
|
125446
|
-
const snapshotDir =
|
|
125743
|
+
const snapshotDir = join77(projectDir, "snapshots");
|
|
125447
125744
|
mkdirSync37(snapshotDir, { recursive: true });
|
|
125448
125745
|
const filename = `frame-${String(index).padStart(2, "0")}-at-${time.toFixed(1)}s.png`;
|
|
125449
|
-
const path2 =
|
|
125746
|
+
const path2 = join77(snapshotDir, filename);
|
|
125450
125747
|
writeFileSync27(path2, Buffer.from(pngBase64, "base64"));
|
|
125451
|
-
return
|
|
125748
|
+
return join77("snapshots", filename);
|
|
125452
125749
|
}
|
|
125453
125750
|
async function captureFindingCrops2(project, options, requests) {
|
|
125454
125751
|
const module = await Promise.resolve().then(() => (init_checkBrowser(), checkBrowser_exports));
|
|
@@ -125952,16 +126249,16 @@ var init_beats = __esm({
|
|
|
125952
126249
|
// src/beats/headlessAnalyzer.ts
|
|
125953
126250
|
import { existsSync as existsSync70, readFileSync as readFileSync48 } from "fs";
|
|
125954
126251
|
import { createRequire as createRequire3 } from "module";
|
|
125955
|
-
import { dirname as dirname33, join as
|
|
126252
|
+
import { dirname as dirname33, join as join78 } from "path";
|
|
125956
126253
|
import { fileURLToPath as fileURLToPath13 } from "url";
|
|
125957
126254
|
function findPrebuiltBundle() {
|
|
125958
126255
|
const here = dirname33(fileURLToPath13(import.meta.url));
|
|
125959
126256
|
const candidates = [
|
|
125960
|
-
|
|
126257
|
+
join78(here, "beat-analyzer.global.js"),
|
|
125961
126258
|
// dist root (tsup-bundled cli)
|
|
125962
|
-
|
|
126259
|
+
join78(here, "../beat-analyzer.global.js"),
|
|
125963
126260
|
// dist/beats → dist
|
|
125964
|
-
|
|
126261
|
+
join78(here, "../dist/beat-analyzer.global.js")
|
|
125965
126262
|
];
|
|
125966
126263
|
for (const p2 of candidates) {
|
|
125967
126264
|
if (existsSync70(p2)) return p2;
|
|
@@ -125971,7 +126268,7 @@ function findPrebuiltBundle() {
|
|
|
125971
126268
|
async function buildFromCoreSource() {
|
|
125972
126269
|
const esbuild = await import("esbuild");
|
|
125973
126270
|
const coreRoot = dirname33(require2.resolve("@hyperframes/core/package.json"));
|
|
125974
|
-
const entry =
|
|
126271
|
+
const entry = join78(coreRoot, "src/beats/beatDetection.ts");
|
|
125975
126272
|
const result = await esbuild.build({
|
|
125976
126273
|
stdin: {
|
|
125977
126274
|
contents: `import { analyzeMusicFromBuffer } from ${JSON.stringify(entry)};
|
|
@@ -126072,7 +126369,7 @@ __export(beats_exports, {
|
|
|
126072
126369
|
examples: () => examples13
|
|
126073
126370
|
});
|
|
126074
126371
|
import { existsSync as existsSync71, readFileSync as readFileSync49, mkdirSync as mkdirSync38, writeFileSync as writeFileSync28 } from "fs";
|
|
126075
|
-
import { resolve as resolve46, join as
|
|
126372
|
+
import { resolve as resolve46, join as join79, dirname as dirname34 } from "path";
|
|
126076
126373
|
function fail(message) {
|
|
126077
126374
|
console.error(c.error(message));
|
|
126078
126375
|
process.exit(1);
|
|
@@ -126142,7 +126439,7 @@ var init_beats2 = __esm({
|
|
|
126142
126439
|
if (result.beatTimes.length === 0) {
|
|
126143
126440
|
fail(`No beats detected in ${rel} \u2014 nothing written. (Track may be silent/ambient.)`);
|
|
126144
126441
|
}
|
|
126145
|
-
const outPath =
|
|
126442
|
+
const outPath = join79(project.dir, "beats", `${rel}.json`);
|
|
126146
126443
|
mkdirSync38(dirname34(outPath), { recursive: true });
|
|
126147
126444
|
writeFileSync28(outPath, serializeBeats(result.beatTimes, result.beatStrengths, rel));
|
|
126148
126445
|
report(`beats/${rel}.json`, result, Boolean(args.json));
|
|
@@ -128242,7 +128539,7 @@ async function captureMotionPathShot(projectDir, requestsIn, outPath, opts = {})
|
|
|
128242
128539
|
const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
|
|
128243
128540
|
const { serveStaticProjectHtml: serveStaticProjectHtml2 } = await Promise.resolve().then(() => (init_staticProjectServer(), staticProjectServer_exports));
|
|
128244
128541
|
const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
|
|
128245
|
-
const html = await bundleToSingleHtml2(projectDir);
|
|
128542
|
+
const html = await bundleToSingleHtml2(projectDir, { entryFile: opts.entryFile });
|
|
128246
128543
|
const server = await serveStaticProjectHtml2(
|
|
128247
128544
|
projectDir,
|
|
128248
128545
|
html,
|
|
@@ -128295,10 +128592,11 @@ __export(keyframes_exports, {
|
|
|
128295
128592
|
collectShotSelectors: () => collectShotSelectors,
|
|
128296
128593
|
default: () => keyframes_default,
|
|
128297
128594
|
examples: () => examples15,
|
|
128595
|
+
resolveScope: () => resolveScope,
|
|
128298
128596
|
surfaceComposition: () => surfaceComposition
|
|
128299
128597
|
});
|
|
128300
128598
|
import { existsSync as existsSync73, readFileSync as readFileSync50, statSync as statSync23 } from "fs";
|
|
128301
|
-
import { resolve as resolve47, dirname as dirname35, basename as basename14 } from "path";
|
|
128599
|
+
import { resolve as resolve47, dirname as dirname35, basename as basename14, join as join80, relative as relative16, sep as sep9 } from "path";
|
|
128302
128600
|
function inlineScriptText(html) {
|
|
128303
128601
|
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
128304
128602
|
return Array.from(doc.querySelectorAll("script")).filter((s2) => !s2.getAttribute("src")).map((s2) => s2.textContent ?? "").join("\n");
|
|
@@ -128757,7 +129055,7 @@ function printOnionShotSaved(saved, elementCount) {
|
|
|
128757
129055
|
);
|
|
128758
129056
|
console.log();
|
|
128759
129057
|
}
|
|
128760
|
-
async function runOnionShot(comps, allComps, projectDir, args) {
|
|
129058
|
+
async function runOnionShot(comps, allComps, projectDir, entryFile, args) {
|
|
128761
129059
|
const { captureMotionPathShot: captureMotionPathShot2 } = await Promise.resolve().then(() => (init_motionShot(), motionShot_exports));
|
|
128762
129060
|
const requests = collectShotSelectors(args.selector ? allComps : comps);
|
|
128763
129061
|
const guardError = onionShotGuardError(projectDir, requests, args.ghost ?? false);
|
|
@@ -128765,12 +129063,10 @@ async function runOnionShot(comps, allComps, projectDir, args) {
|
|
|
128765
129063
|
console.log(c.dim(guardError));
|
|
128766
129064
|
return true;
|
|
128767
129065
|
}
|
|
128768
|
-
const saved = await captureMotionPathShot2(
|
|
128769
|
-
|
|
128770
|
-
|
|
128771
|
-
|
|
128772
|
-
onionShotOptions(args)
|
|
128773
|
-
);
|
|
129066
|
+
const saved = await captureMotionPathShot2(projectDir, requests, resolve47(args.shot), {
|
|
129067
|
+
...onionShotOptions(args),
|
|
129068
|
+
entryFile
|
|
129069
|
+
});
|
|
128774
129070
|
printOnionShotSaved(saved, requests.length);
|
|
128775
129071
|
return false;
|
|
128776
129072
|
}
|
|
@@ -128779,10 +129075,13 @@ function resolveScope(args) {
|
|
|
128779
129075
|
let comps;
|
|
128780
129076
|
let projectName;
|
|
128781
129077
|
let projectDir;
|
|
129078
|
+
let entryFile;
|
|
128782
129079
|
if (raw && raw.endsWith(".html") && existsSync73(raw) && statSync23(raw).isFile()) {
|
|
128783
|
-
|
|
128784
|
-
|
|
128785
|
-
|
|
129080
|
+
const entryPath = resolve47(raw);
|
|
129081
|
+
comps = [surfaceComposition(readFileSync50(entryPath, "utf-8"), basename14(entryPath), entryPath)];
|
|
129082
|
+
projectName = basename14(entryPath);
|
|
129083
|
+
projectDir = findProjectRoot(entryPath);
|
|
129084
|
+
entryFile = relative16(projectDir, entryPath).split(sep9).join("/");
|
|
128786
129085
|
} else {
|
|
128787
129086
|
const project = resolveProject(raw);
|
|
128788
129087
|
comps = collectCompositions(project.indexPath);
|
|
@@ -128803,7 +129102,18 @@ function resolveScope(args) {
|
|
|
128803
129102
|
(cmp) => cmp.tweens.length > 0 || cmp.traces.length > 0 || cmp.cssKeyframes.length > 0 || cmp.anime.length > 0
|
|
128804
129103
|
);
|
|
128805
129104
|
}
|
|
128806
|
-
return { comps, allComps, projectName, projectDir };
|
|
129105
|
+
return { comps, allComps, projectName, projectDir, entryFile };
|
|
129106
|
+
}
|
|
129107
|
+
function findProjectRoot(entryPath) {
|
|
129108
|
+
const entryDir = dirname35(entryPath);
|
|
129109
|
+
let candidate = entryDir;
|
|
129110
|
+
for (; ; ) {
|
|
129111
|
+
if (existsSync73(join80(candidate, "index.html"))) return candidate;
|
|
129112
|
+
if (existsSync73(join80(candidate, ".git"))) return entryDir;
|
|
129113
|
+
const parent = dirname35(candidate);
|
|
129114
|
+
if (parent === candidate) return entryDir;
|
|
129115
|
+
candidate = parent;
|
|
129116
|
+
}
|
|
128807
129117
|
}
|
|
128808
129118
|
function isEmptyComposition(cmp) {
|
|
128809
129119
|
return cmp.tweens.length === 0 && cmp.traces.length === 0 && cmp.cssKeyframes.length === 0 && cmp.anime.length === 0;
|
|
@@ -128903,9 +129213,9 @@ function createKeyframesCommand(options = {}) {
|
|
|
128903
129213
|
);
|
|
128904
129214
|
console.log();
|
|
128905
129215
|
}
|
|
128906
|
-
const { comps: rawComps, allComps, projectName, projectDir } = resolveScope(args);
|
|
129216
|
+
const { comps: rawComps, allComps, projectName, projectDir, entryFile } = resolveScope(args);
|
|
128907
129217
|
const comps = filterCompositionsByRuntime(rawComps, runtime);
|
|
128908
|
-
if (args.shot && await runOnionShot(comps, allComps, projectDir, args)) return;
|
|
129218
|
+
if (args.shot && await runOnionShot(comps, allComps, projectDir, entryFile, args)) return;
|
|
128909
129219
|
if (args.json) {
|
|
128910
129220
|
console.log(
|
|
128911
129221
|
JSON.stringify(withMeta({ project: projectName, runtime, compositions: comps }), null, 2)
|
|
@@ -171631,7 +171941,7 @@ __export(snapshot_exports, {
|
|
|
171631
171941
|
});
|
|
171632
171942
|
import { existsSync as existsSync85, mkdtempSync as mkdtempSync8, readFileSync as readFileSync58, mkdirSync as mkdirSync41, rmSync as rmSync23, writeFileSync as writeFileSync35 } from "fs";
|
|
171633
171943
|
import { tmpdir as tmpdir10 } from "os";
|
|
171634
|
-
import { resolve as resolve55, join as join90, relative as
|
|
171944
|
+
import { resolve as resolve55, join as join90, relative as relative17, isAbsolute as isAbsolute14, basename as basename20 } from "path";
|
|
171635
171945
|
function orbitStageSource() {
|
|
171636
171946
|
return `function(cam) {
|
|
171637
171947
|
var root = document.querySelector("[data-composition-id]")
|
|
@@ -171838,7 +172148,7 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
171838
172148
|
const url = new URL(v2.src);
|
|
171839
172149
|
const decodedPath = decodeURIComponent(url.pathname).replace(/^\//, "");
|
|
171840
172150
|
const candidate = resolve55(projectDir, decodedPath);
|
|
171841
|
-
const rel2 =
|
|
172151
|
+
const rel2 = relative17(projectDir, candidate);
|
|
171842
172152
|
if (!rel2.startsWith("..") && !isAbsolute14(rel2) && existsSync85(candidate)) {
|
|
171843
172153
|
ffmpegInput = candidate;
|
|
171844
172154
|
inputIsLocal = true;
|
|
@@ -171895,7 +172205,7 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
171895
172205
|
} else {
|
|
171896
172206
|
await page.screenshot({ path: framePath, type: "png" });
|
|
171897
172207
|
}
|
|
171898
|
-
const rel =
|
|
172208
|
+
const rel = relative17(projectDir, framePath);
|
|
171899
172209
|
savedPaths.push(rel.startsWith("..") || isAbsolute14(rel) ? framePath : rel);
|
|
171900
172210
|
}
|
|
171901
172211
|
} finally {
|
|
@@ -172119,7 +172429,7 @@ ${c.error("\u2717")} Snapshot failed: ${msg}`);
|
|
|
172119
172429
|
});
|
|
172120
172430
|
|
|
172121
172431
|
// src/utils/pathArgs.ts
|
|
172122
|
-
import { isAbsolute as isAbsolute15, relative as
|
|
172432
|
+
import { isAbsolute as isAbsolute15, relative as relative18, resolve as resolve56 } from "path";
|
|
172123
172433
|
function readOptionalString(value) {
|
|
172124
172434
|
if (typeof value !== "string") return void 0;
|
|
172125
172435
|
const trimmed = value.trim();
|
|
@@ -172129,7 +172439,7 @@ function resolveFromBase(baseDir, input2) {
|
|
|
172129
172439
|
return isAbsolute15(input2) ? input2 : resolve56(baseDir, input2);
|
|
172130
172440
|
}
|
|
172131
172441
|
function displayPathFromBase(baseDir, filePath) {
|
|
172132
|
-
const rel =
|
|
172442
|
+
const rel = relative18(baseDir, filePath);
|
|
172133
172443
|
if (rel && !rel.startsWith("..") && !isAbsolute15(rel)) return rel;
|
|
172134
172444
|
return filePath;
|
|
172135
172445
|
}
|
|
@@ -172711,7 +173021,7 @@ __export(compare_exports, {
|
|
|
172711
173021
|
parseCompareArgs: () => parseCompareArgs,
|
|
172712
173022
|
prepareCompareVariantProjects: () => prepareCompareVariantProjects
|
|
172713
173023
|
});
|
|
172714
|
-
import { cpSync as cpSync6, existsSync as existsSync87, mkdirSync as mkdirSync44, mkdtempSync as mkdtempSync10, renameSync as
|
|
173024
|
+
import { cpSync as cpSync6, existsSync as existsSync87, mkdirSync as mkdirSync44, mkdtempSync as mkdtempSync10, renameSync as renameSync9, rmSync as rmSync25, statSync as statSync27 } from "fs";
|
|
172715
173025
|
import { tmpdir as tmpdir12 } from "os";
|
|
172716
173026
|
import { basename as basename23, dirname as dirname42, extname as extname17, join as join93 } from "path";
|
|
172717
173027
|
function defaultLabelForPath(input2) {
|
|
@@ -172823,7 +173133,7 @@ function stageHtmlVariant(variant) {
|
|
|
172823
173133
|
});
|
|
172824
173134
|
const sourceName = basename23(variant.inputPath);
|
|
172825
173135
|
if (sourceName !== "index.html") {
|
|
172826
|
-
|
|
173136
|
+
renameSync9(join93(stagedDir, sourceName), join93(stagedDir, "index.html"));
|
|
172827
173137
|
}
|
|
172828
173138
|
return {
|
|
172829
173139
|
...variant,
|
|
@@ -173753,7 +174063,7 @@ async function extractHtml(page, opts = {}) {
|
|
|
173753
174063
|
(_match, pre, urls, post) => {
|
|
173754
174064
|
const fixed = urls.replace(/&/g, "&").replace(
|
|
173755
174065
|
/(^|,\s*)(\/[^\s,]+)/g,
|
|
173756
|
-
(_m,
|
|
174066
|
+
(_m, sep10, path2) => sep10 + pageOrigin + path2
|
|
173757
174067
|
);
|
|
173758
174068
|
return pre + fixed + post;
|
|
173759
174069
|
}
|
|
@@ -183935,7 +184245,7 @@ __export(asset_exports, {
|
|
|
183935
184245
|
runAssetImportMany: () => runAssetImportMany
|
|
183936
184246
|
});
|
|
183937
184247
|
import { existsSync as existsSync106 } from "fs";
|
|
183938
|
-
import { join as join116, relative as
|
|
184248
|
+
import { join as join116, relative as relative19 } from "path";
|
|
183939
184249
|
function gatherAssetRefs(positionals) {
|
|
183940
184250
|
return positionals.flatMap((r2) => /^https?:/i.test(r2.trim()) ? [r2] : r2.split(",")).map((r2) => r2.trim()).filter((r2) => r2.length > 0);
|
|
183941
184251
|
}
|
|
@@ -183977,7 +184287,7 @@ async function freezeAndRecord(fileKey, nodeId, url, ext, opts, version2, deps,
|
|
|
183977
184287
|
const record = {
|
|
183978
184288
|
id,
|
|
183979
184289
|
type: "image",
|
|
183980
|
-
path:
|
|
184290
|
+
path: relative19(deps.projectDir, destAbs),
|
|
183981
184291
|
source: `figma:${fileKey}/${nodeId}`,
|
|
183982
184292
|
...description !== void 0 && { description },
|
|
183983
184293
|
...entity !== void 0 && { entity },
|
|
@@ -184219,7 +184529,7 @@ __export(component_exports, {
|
|
|
184219
184529
|
runComponentImport: () => runComponentImport
|
|
184220
184530
|
});
|
|
184221
184531
|
import { existsSync as existsSync107, mkdirSync as mkdirSync58, writeFileSync as writeFileSync53 } from "fs";
|
|
184222
|
-
import { join as join118, relative as
|
|
184532
|
+
import { join as join118, relative as relative20 } from "path";
|
|
184223
184533
|
function escapeAttr2(value) {
|
|
184224
184534
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
184225
184535
|
}
|
|
@@ -184269,7 +184579,7 @@ async function runComponentImport(refInput, deps) {
|
|
|
184269
184579
|
);
|
|
184270
184580
|
return {
|
|
184271
184581
|
name,
|
|
184272
|
-
htmlPath:
|
|
184582
|
+
htmlPath: relative20(deps.projectDir, htmlFile),
|
|
184273
184583
|
unresolved: bindings.unresolved,
|
|
184274
184584
|
rasterized: mapped.rasterize,
|
|
184275
184585
|
failedRasterize
|
|
@@ -184289,7 +184599,7 @@ async function rasterizeFallback(mapped, fileKey, componentDir, deps) {
|
|
|
184289
184599
|
continue;
|
|
184290
184600
|
}
|
|
184291
184601
|
frozenAssets.push(asset.record.path);
|
|
184292
|
-
const srcRel =
|
|
184602
|
+
const srcRel = relative20(componentDir, join118(deps.projectDir, asset.record.path)).replaceAll(
|
|
184293
184603
|
"\\",
|
|
184294
184604
|
"/"
|
|
184295
184605
|
);
|