@hyperframes/producer 0.9.101 → 0.9.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/distributed.js +3 -2
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +74 -74
- package/dist/index.js +101 -83
- package/dist/public-server.js +68 -50
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { audioFailureDiagnostics as audioFailureDiagnostics2, cpuBudget } from "@hyperframes/engine";
|
|
11
11
|
import {
|
|
12
12
|
existsSync as existsSync22,
|
|
13
|
-
mkdirSync as
|
|
13
|
+
mkdirSync as mkdirSync15,
|
|
14
14
|
readdirSync as readdirSync6,
|
|
15
15
|
rmSync as rmSync13,
|
|
16
16
|
statSync as statSync10,
|
|
@@ -481,7 +481,7 @@ function servedPath(urlPath) {
|
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
// src/generated/hf-early-stub-inline.ts
|
|
484
|
-
var HF_EARLY_STUB_IIFE = '"use strict";(()=>{var
|
|
484
|
+
var HF_EARLY_STUB_IIFE = '"use strict";(()=>{var b=100,A=[],s=[],c=!1,l=!1,k=new Set;function h(n){let e=window.__HF_VIRTUAL_TIME__?.originalRequestAnimationFrame;return typeof e=="function"?e(n):requestAnimationFrame(n)}function P(n){let e=window.__HF_VIRTUAL_TIME__?.originalSetTimeout;if(typeof e=="function"){e(n,0);return}setTimeout(n,0)}function v(n){return n!==null&&typeof n=="object"&&"__hfIsProxy"in n?n.__hfReal:n}function d(n,e){n!=="add"&&x(e)}function T(n){if(n===null||typeof n!="object"||Array.isArray(n))return!1;let e=n;return"rotationX"in e||"rotationY"in e||"transformPerspective"in e}var w=new Set;function x(n){let e=n[0];if(e==null)return;let o=window;w.has(e)||(w.add(e),o.__hfAllTweenTargets=Array.from(w)),(T(n[1])||T(n[2]))&&(k.add(e),o.__hf3dTweenTargets=Array.from(k))}function _(n){let e=n.proxy.__hfReal,o=e[n.method];if(typeof o=="function"){let i=n.method==="add"?n.args.map(v):n.args;o.call(e,...i)}}function S(n,e,o){d(e,o);let i={proxy:n,method:e,args:o};return n.__hfQueue.push(i),s.push(i),E(),n}function y(n){let e=n.proxy.__hfQueue.indexOf(n);e>=0&&n.proxy.__hfQueue.splice(e,1)}function a(){for(;s.length>0;){let n=s.shift();n&&(y(n),_(n))}R()}function m(){l=!1,window.__hfTimelinesBuilding=!1;try{window.dispatchEvent(new CustomEvent("hf-timelines-built"))}catch{}}function R(){l||(l=!0,P(()=>{s.length===0?m():l=!1}))}function g(){c=!1;let n=s.splice(0,b);for(let e of n)y(e),_(e);s.length>0?(c=!0,h(g)):m()}function E(){c||(c=!0,window.__hfTimelinesBuilding=!0,h(g))}var O=["to","from","fromTo","set","add"],I=new Set(O),C=["pause","play","seek"],G=["totalTime","time","duration","paused","timeScale"];function B(n,e){let o=e;for(;o!==null&&o!==Object.prototype;){for(let i of Object.getOwnPropertyNames(o)){if(i==="constructor"||i==="then"||i in n||I.has(i)||i.charAt(0)==="_")continue;let u=Object.getOwnPropertyDescriptor(o,i);if(!u||typeof u.value!="function")continue;let r=u.value;n[i]=function(...t){a();let f=r.call(e,...t);return f===e?n:f}}o=Object.getPrototypeOf(o)}}function M(n){let e={__hfReal:n,__hfQueue:[],__hfIsProxy:!0};for(let o of O)typeof n[o]=="function"&&(e[o]=(...i)=>S(e,o,i));for(let o of C)typeof n[o]=="function"&&(e[o]=(...i)=>(a(),n[o].apply(n,i),e));for(let o of G)typeof n[o]=="function"&&(e[o]=(...i)=>{a();let u=n[o];return i.length>0?(u.apply(n,i),e):u.call(n)});return typeof n.getChildren=="function"&&(e.getChildren=(...o)=>{a();let i=n.getChildren(...o);return Array.isArray(i)?i:[]}),typeof n.kill=="function"&&(e.kill=()=>{a(),n.kill()}),B(e,n),A.push(e),e}if(typeof window<"u"){window.__hf||(window.__hf={}),window.__hfTimelinesBuilding=!1,window.__hfFlushSync=()=>{a(),s.length===0&&window.__hfTimelinesBuilding&&m()};let n=null,e=new WeakSet;try{Object.defineProperty(window,"gsap",{configurable:!0,enumerable:!0,get(){return n},set(o){if(n=o,!o||typeof o.timeline!="function"||e.has(o))return;e.add(o);let i=o.timeline.bind(o);o.timeline=r=>{let t=i(r);return t&&(typeof t=="object"||typeof t=="function")?M(t):t};for(let r of["to","from","set"]){let t=o[r];if(typeof t!="function")continue;let f=t.bind(o);o[r]=(...p)=>(d(r,p),f(...p))}let u=o.fromTo;if(typeof u=="function"){let r=u.bind(o);o.fromTo=(...t)=>(d("fromTo",t),r(...t))}}})}catch{}}})();\n';
|
|
485
485
|
function getHfEarlyStub() {
|
|
486
486
|
return HF_EARLY_STUB_IIFE;
|
|
487
487
|
}
|
|
@@ -2084,6 +2084,7 @@ var RenderExecutionContext = class {
|
|
|
2084
2084
|
// src/services/render/artifactTransaction.ts
|
|
2085
2085
|
import { closeSync as closeSync2, existsSync as existsSync6, fstatSync as fstatSync2, openSync as openSync2, readSync, readdirSync as readdirSync2, rmSync as rmSync3 } from "node:fs";
|
|
2086
2086
|
import { basename as basename5, dirname as dirname4, extname as extname2, join as join6, resolve as resolve5 } from "node:path";
|
|
2087
|
+
import { toWin32LongPath as toWin32LongPath2 } from "@hyperframes/core/atomic-file";
|
|
2087
2088
|
import { HLS_MASTER_PLAYLIST, HLS_VIDEO_PLAYLIST, renameWithRetry } from "@hyperframes/engine";
|
|
2088
2089
|
|
|
2089
2090
|
// src/utils/ffprobe.ts
|
|
@@ -2097,6 +2098,7 @@ import {
|
|
|
2097
2098
|
import {
|
|
2098
2099
|
existsSync as existsSync5,
|
|
2099
2100
|
lstatSync as lstatSync2,
|
|
2101
|
+
mkdirSync as mkdirSync2,
|
|
2100
2102
|
readFileSync as readFileSync2,
|
|
2101
2103
|
readdirSync,
|
|
2102
2104
|
readlinkSync as readlinkSync2,
|
|
@@ -2107,7 +2109,7 @@ import { execFileSync } from "node:child_process";
|
|
|
2107
2109
|
import { hostname, uptime } from "node:os";
|
|
2108
2110
|
import { basename as basename4, dirname as dirname3, join as join5, win32 } from "node:path";
|
|
2109
2111
|
import { RENDER_TEMP_DIR } from "@hyperframes/core/project-folders";
|
|
2110
|
-
import { createStagingDir } from "@hyperframes/core/atomic-file";
|
|
2112
|
+
import { createStagingDir, toWin32LongPath } from "@hyperframes/core/atomic-file";
|
|
2111
2113
|
var OWNER_FILE = "owner.json";
|
|
2112
2114
|
var TRANSACTION_BACKUP = "backup";
|
|
2113
2115
|
var RENDER_JOB_DIR = /^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
|
|
@@ -2161,7 +2163,7 @@ function pidScope() {
|
|
|
2161
2163
|
function createOwnedRenderDir(prefix) {
|
|
2162
2164
|
const dir = createStagingDir(dirname3(prefix), basename4(prefix));
|
|
2163
2165
|
const owner = { pid: process.pid, ...pidScope() };
|
|
2164
|
-
writeFileSync2(join5(dir, OWNER_FILE), JSON.stringify(owner));
|
|
2166
|
+
writeFileSync2(toWin32LongPath(join5(dir, OWNER_FILE)), JSON.stringify(owner));
|
|
2165
2167
|
return dir;
|
|
2166
2168
|
}
|
|
2167
2169
|
function alive(pid) {
|
|
@@ -2229,7 +2231,9 @@ function listAbandonedRenderDirs(parent, options = {}) {
|
|
|
2229
2231
|
return names.filter((name) => (options.names ?? RENDER_TEMP_DIR).test(name)).map((name) => join5(parent, name)).filter((dir) => isAbandoned(dir, options.ownerlessIdleMs, now));
|
|
2230
2232
|
}
|
|
2231
2233
|
function createRenderWorkDir(prefix, outputDir) {
|
|
2232
|
-
|
|
2234
|
+
const workParent = dirname3(prefix);
|
|
2235
|
+
mkdirSync2(toWin32LongPath(workParent), { recursive: true });
|
|
2236
|
+
for (const parent of /* @__PURE__ */ new Set([outputDir, workParent])) {
|
|
2233
2237
|
for (const dir of listAbandonedRenderDirs(parent)) {
|
|
2234
2238
|
try {
|
|
2235
2239
|
rmSync2(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
@@ -2242,9 +2246,9 @@ function createRenderWorkDir(prefix, outputDir) {
|
|
|
2242
2246
|
|
|
2243
2247
|
// src/services/render/artifactTransaction.ts
|
|
2244
2248
|
var defaultFileSystem = {
|
|
2245
|
-
existsSync: existsSync6,
|
|
2246
|
-
renameSync: (source, destination) => renameWithRetry(source, destination),
|
|
2247
|
-
rmSync: rmSync3
|
|
2249
|
+
existsSync: (path) => existsSync6(toWin32LongPath2(path)),
|
|
2250
|
+
renameSync: (source, destination) => renameWithRetry(toWin32LongPath2(source), toWin32LongPath2(destination)),
|
|
2251
|
+
rmSync: (path, options) => rmSync3(toWin32LongPath2(path), options)
|
|
2248
2252
|
};
|
|
2249
2253
|
async function defaultArtifactDurationProbe(path) {
|
|
2250
2254
|
const meta = await extractMediaMetadata(path);
|
|
@@ -2272,14 +2276,28 @@ function buildArtifactExpectation(input) {
|
|
|
2272
2276
|
requiredFiles: [HLS_MASTER_PLAYLIST]
|
|
2273
2277
|
};
|
|
2274
2278
|
}
|
|
2279
|
+
var WINDOWS_PATH_LIMIT = 259;
|
|
2280
|
+
var TRANSACTION_SUFFIX = ".hf-transaction-";
|
|
2281
|
+
var TRANSACTION_RANDOM_LEN = 6;
|
|
2282
|
+
var SHORT_TRANSACTION_STEM = "hf";
|
|
2283
|
+
function transactionStem(parent, name, rawStem) {
|
|
2284
|
+
const overhead = parent.length + 1 + 1 + TRANSACTION_SUFFIX.length + TRANSACTION_RANDOM_LEN + 1 + name.length;
|
|
2285
|
+
const maxStem = WINDOWS_PATH_LIMIT - overhead;
|
|
2286
|
+
if (rawStem.length <= maxStem) return rawStem;
|
|
2287
|
+
if (maxStem < SHORT_TRANSACTION_STEM.length) return SHORT_TRANSACTION_STEM;
|
|
2288
|
+
const trimmed = rawStem.slice(0, maxStem).replace(/[\uD800-\uDBFF]$/, "").replace(/[. ]+$/, "");
|
|
2289
|
+
return trimmed || SHORT_TRANSACTION_STEM;
|
|
2290
|
+
}
|
|
2275
2291
|
function createSiblingTransactionDirectory(destination) {
|
|
2276
2292
|
const parent = dirname4(destination);
|
|
2293
|
+
const name = basename5(destination);
|
|
2277
2294
|
const extension = extname2(destination);
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2295
|
+
const rawStem = extension ? basename5(destination, extension) : name;
|
|
2296
|
+
const stem = transactionStem(parent, name, rawStem);
|
|
2297
|
+
return createOwnedRenderDir(join6(parent, `.${stem}${TRANSACTION_SUFFIX}`));
|
|
2280
2298
|
}
|
|
2281
2299
|
function assertReadableNonEmptyFile(path) {
|
|
2282
|
-
const fd = openSync2(path, "r");
|
|
2300
|
+
const fd = openSync2(toWin32LongPath2(path), "r");
|
|
2283
2301
|
try {
|
|
2284
2302
|
const stat = fstatSync2(fd);
|
|
2285
2303
|
if (!stat.isFile() || stat.size <= 0) {
|
|
@@ -2293,7 +2311,7 @@ function assertReadableNonEmptyFile(path) {
|
|
|
2293
2311
|
function collectDirectoryFiles(root) {
|
|
2294
2312
|
const files = [];
|
|
2295
2313
|
const visit = (directory) => {
|
|
2296
|
-
for (const entry of readdirSync2(directory, { withFileTypes: true })) {
|
|
2314
|
+
for (const entry of readdirSync2(toWin32LongPath2(directory), { withFileTypes: true })) {
|
|
2297
2315
|
const path = join6(directory, entry.name);
|
|
2298
2316
|
if (entry.isDirectory()) visit(path);
|
|
2299
2317
|
else if (entry.isFile()) files.push(path);
|
|
@@ -2396,7 +2414,7 @@ var ArtifactTransaction = class {
|
|
|
2396
2414
|
async assertDirectoryExpectation(expected, files) {
|
|
2397
2415
|
for (const required of expected.requiredFiles ?? []) {
|
|
2398
2416
|
const path = join6(this.stagingPath, required);
|
|
2399
|
-
if (!existsSync6(path)) {
|
|
2417
|
+
if (!existsSync6(toWin32LongPath2(path))) {
|
|
2400
2418
|
throw new Error(`Render artifact directory is missing ${required}: ${this.stagingPath}`);
|
|
2401
2419
|
}
|
|
2402
2420
|
assertReadableNonEmptyFile(path);
|
|
@@ -2645,7 +2663,7 @@ function replanAfterFailure(plan2, failure) {
|
|
|
2645
2663
|
}
|
|
2646
2664
|
|
|
2647
2665
|
// src/services/render/stages/captureSegmentedStage.ts
|
|
2648
|
-
import { existsSync as existsSync7, mkdirSync as
|
|
2666
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync6, statSync as statSync4 } from "node:fs";
|
|
2649
2667
|
import { join as join12 } from "node:path";
|
|
2650
2668
|
import {
|
|
2651
2669
|
captureFrameToBuffer as captureFrameToBuffer2,
|
|
@@ -3569,7 +3587,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
3569
3587
|
}
|
|
3570
3588
|
|
|
3571
3589
|
// src/services/render/stages/captureHdrResources.ts
|
|
3572
|
-
import { mkdirSync as
|
|
3590
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync3, statfsSync } from "node:fs";
|
|
3573
3591
|
import {
|
|
3574
3592
|
decodePngToRgb48le,
|
|
3575
3593
|
extractMediaMetadata as extractMediaMetadata2,
|
|
@@ -3899,7 +3917,7 @@ async function extractHdrVideoFrames(args) {
|
|
|
3899
3917
|
const resolveFinalFrameExtractionWindowImpl = args.resolveFinalFrameExtractionWindowImpl ?? resolveFinalFrameExtractionWindow;
|
|
3900
3918
|
const fps = fpsToNumber3(job.config.fps);
|
|
3901
3919
|
const out = /* @__PURE__ */ new Map();
|
|
3902
|
-
|
|
3920
|
+
mkdirSync3(framesDir, { recursive: true });
|
|
3903
3921
|
let scratchBytes = 0;
|
|
3904
3922
|
const extractionWindows = /* @__PURE__ */ new Map();
|
|
3905
3923
|
for (const [videoId, srcPath] of prep.hdrVideoSrcPaths) {
|
|
@@ -3935,7 +3953,7 @@ async function extractHdrVideoFrames(args) {
|
|
|
3935
3953
|
const planned = extractionWindows.get(videoId);
|
|
3936
3954
|
if (!video || !planned) continue;
|
|
3937
3955
|
const { window: window2, metadata } = planned;
|
|
3938
|
-
|
|
3956
|
+
mkdirSync3(framesDir, { recursive: true });
|
|
3939
3957
|
const frameDir = createStagingDir2(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`);
|
|
3940
3958
|
createdFrameDirs.add(frameDir);
|
|
3941
3959
|
const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
|
|
@@ -4421,7 +4439,7 @@ import {
|
|
|
4421
4439
|
createReadStream as createReadStream2,
|
|
4422
4440
|
fstatSync as fstatSync3,
|
|
4423
4441
|
lstatSync as lstatSync3,
|
|
4424
|
-
mkdirSync as
|
|
4442
|
+
mkdirSync as mkdirSync4,
|
|
4425
4443
|
openSync as openSync4,
|
|
4426
4444
|
readFileSync as readFileSync4
|
|
4427
4445
|
} from "node:fs";
|
|
@@ -4539,7 +4557,7 @@ async function hashSegmentFile(path) {
|
|
|
4539
4557
|
return hash.digest("hex");
|
|
4540
4558
|
}
|
|
4541
4559
|
function writeSegmentManifest(segmentDir, manifest, key) {
|
|
4542
|
-
|
|
4560
|
+
mkdirSync4(segmentDir, { recursive: true });
|
|
4543
4561
|
replaceFileAtomically(
|
|
4544
4562
|
join10(segmentDir, MANIFEST_FILENAME),
|
|
4545
4563
|
JSON.stringify(signSegmentManifest(manifest, key), null, 2),
|
|
@@ -5779,7 +5797,7 @@ async function runCaptureSegmentedStage(input) {
|
|
|
5779
5797
|
const deps = { ...DEFAULT_DEPS, ...input.deps };
|
|
5780
5798
|
const segments = planSegments(input.totalFrames, input.segmentFrames);
|
|
5781
5799
|
const segmentDir = input.segmentDir ?? join12(input.workDir, "segments");
|
|
5782
|
-
|
|
5800
|
+
mkdirSync5(segmentDir, { recursive: true });
|
|
5783
5801
|
const skip = input.completedSegments ?? /* @__PURE__ */ new Set();
|
|
5784
5802
|
const pending = segments.filter((s) => !skip.has(s.index));
|
|
5785
5803
|
for (const index of skip) log.info("[Render] segment skipped (resume)", { index });
|
|
@@ -6304,7 +6322,7 @@ function checkPageNeverReady(input) {
|
|
|
6304
6322
|
}
|
|
6305
6323
|
|
|
6306
6324
|
// src/services/render/deferredVideoFrames.ts
|
|
6307
|
-
import { mkdirSync as
|
|
6325
|
+
import { mkdirSync as mkdirSync6, rmSync as rmSync7 } from "node:fs";
|
|
6308
6326
|
import { dirname as dirname5, join as join14 } from "node:path";
|
|
6309
6327
|
import {
|
|
6310
6328
|
createFrameLookupTable,
|
|
@@ -6407,7 +6425,7 @@ async function extractAllDeferredFrames(extracted, input) {
|
|
|
6407
6425
|
maxTransientRetries: input.maxTransientRetries,
|
|
6408
6426
|
onRetry: () => {
|
|
6409
6427
|
rmSync7(video.outputDir, { recursive: true, force: true });
|
|
6410
|
-
|
|
6428
|
+
mkdirSync6(video.outputDir, { recursive: true });
|
|
6411
6429
|
}
|
|
6412
6430
|
}
|
|
6413
6431
|
);
|
|
@@ -6498,7 +6516,7 @@ async function measureLocalShownBoxes(page, videos, fps, duration, log) {
|
|
|
6498
6516
|
}
|
|
6499
6517
|
|
|
6500
6518
|
// src/services/render/segmentVideoFrames.ts
|
|
6501
|
-
import { mkdirSync as
|
|
6519
|
+
import { mkdirSync as mkdirSync7, rmSync as rmSync8 } from "node:fs";
|
|
6502
6520
|
import { join as join15 } from "node:path";
|
|
6503
6521
|
import {
|
|
6504
6522
|
createFrameLookupTable as createFrameLookupTable2,
|
|
@@ -6557,7 +6575,7 @@ function createSegmentVideoFrames(input) {
|
|
|
6557
6575
|
const release = () => rmSync8(dir, { recursive: true, force: true });
|
|
6558
6576
|
try {
|
|
6559
6577
|
release();
|
|
6560
|
-
|
|
6578
|
+
mkdirSync7(dir, { recursive: true });
|
|
6561
6579
|
const table = await tableFor([...frames], dir);
|
|
6562
6580
|
return { injector: () => createVideoFrameInjector(table, input.injectorOptions), release };
|
|
6563
6581
|
} catch (error) {
|
|
@@ -6586,7 +6604,7 @@ function createSegmentVideoFrames(input) {
|
|
|
6586
6604
|
folder = dir;
|
|
6587
6605
|
try {
|
|
6588
6606
|
rmSync8(dir, { recursive: true, force: true });
|
|
6589
|
-
|
|
6607
|
+
mkdirSync7(dir, { recursive: true });
|
|
6590
6608
|
injector = await injectorFor(
|
|
6591
6609
|
Array.from(
|
|
6592
6610
|
{ length: segment.endFrame - segment.startFrame },
|
|
@@ -6755,7 +6773,7 @@ function resolveVideoCaptureBeyondViewport(videoCount) {
|
|
|
6755
6773
|
}
|
|
6756
6774
|
|
|
6757
6775
|
// src/services/render/gpuChoice.ts
|
|
6758
|
-
import { mkdirSync as
|
|
6776
|
+
import { mkdirSync as mkdirSync8, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
6759
6777
|
import { dirname as dirname6 } from "node:path";
|
|
6760
6778
|
function gpuChoiceStore(cfg, gpu) {
|
|
6761
6779
|
if (!cfg.gpuChoiceFile || !cfg.hyperframesVersion || !gpu) return void 0;
|
|
@@ -6772,7 +6790,7 @@ function readGpuChoice(store) {
|
|
|
6772
6790
|
return record.mode === "software" || record.mode === "hardware" ? record.mode : void 0;
|
|
6773
6791
|
}
|
|
6774
6792
|
function writeGpuChoice(store, mode, measured) {
|
|
6775
|
-
|
|
6793
|
+
mkdirSync8(dirname6(store.file), { recursive: true });
|
|
6776
6794
|
const temp = `${store.file}.${process.pid}.tmp`;
|
|
6777
6795
|
const record = { key: store.key, mode, ...measured, measuredAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
6778
6796
|
writeFileSync3(temp, `${JSON.stringify(record, null, 2)}
|
|
@@ -7347,7 +7365,7 @@ import {
|
|
|
7347
7365
|
stylesheetLinkMatches
|
|
7348
7366
|
} from "@hyperframes/parsers/css-url-scans";
|
|
7349
7367
|
import { createHash as createHash6 } from "node:crypto";
|
|
7350
|
-
import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as
|
|
7368
|
+
import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync9, statSync as statSync8 } from "fs";
|
|
7351
7369
|
import { join as join21, dirname as dirname10, resolve as resolve8, basename as basename6, relative as relative3, sep as sep4 } from "path";
|
|
7352
7370
|
import { parseHTML as parseHTML5 } from "@hyperframes/parsers/linkedom";
|
|
7353
7371
|
|
|
@@ -7635,7 +7653,7 @@ import {
|
|
|
7635
7653
|
|
|
7636
7654
|
// src/services/animatedGifPrep.ts
|
|
7637
7655
|
import { createHash as createHash4, randomUUID } from "node:crypto";
|
|
7638
|
-
import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as
|
|
7656
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, readFileSync as readFileSync7, rmSync as rmSync9, statSync as statSync6 } from "node:fs";
|
|
7639
7657
|
import { dirname as dirname7, isAbsolute as isAbsolute3, join as join18, resolve as resolve6 } from "node:path";
|
|
7640
7658
|
import { parseHTML as parseHTML3 } from "@hyperframes/parsers/linkedom";
|
|
7641
7659
|
import { parseAnimatedGifMetadata } from "@hyperframes/core";
|
|
@@ -7823,10 +7841,10 @@ async function runAnimatedGifTranscode(request) {
|
|
|
7823
7841
|
}
|
|
7824
7842
|
async function ensurePreparedWebm(input) {
|
|
7825
7843
|
if (!existsSync9(dirname7(input.cachePath))) {
|
|
7826
|
-
|
|
7844
|
+
mkdirSync9(dirname7(input.cachePath), { recursive: true });
|
|
7827
7845
|
}
|
|
7828
7846
|
if (!existsSync9(dirname7(input.outputPath))) {
|
|
7829
|
-
|
|
7847
|
+
mkdirSync9(dirname7(input.outputPath), { recursive: true });
|
|
7830
7848
|
}
|
|
7831
7849
|
if (!isUsableFile(input.cachePath)) {
|
|
7832
7850
|
const tmpPath = `${input.cachePath}.tmp-${process.pid}-${randomUUID()}`;
|
|
@@ -7979,7 +7997,7 @@ import { createHash as createHash5, randomUUID as randomUUID2 } from "node:crypt
|
|
|
7979
7997
|
import {
|
|
7980
7998
|
closeSync as closeSync5,
|
|
7981
7999
|
copyFileSync as copyFileSync3,
|
|
7982
|
-
mkdirSync as
|
|
8000
|
+
mkdirSync as mkdirSync10,
|
|
7983
8001
|
openSync as openSync5,
|
|
7984
8002
|
readFileSync as readFileSync8,
|
|
7985
8003
|
readSync as readSync3,
|
|
@@ -8246,8 +8264,8 @@ function isUsableFile2(path) {
|
|
|
8246
8264
|
}
|
|
8247
8265
|
}
|
|
8248
8266
|
async function ensurePreparedJpeg(source, cachePath, outputPath, options) {
|
|
8249
|
-
|
|
8250
|
-
|
|
8267
|
+
mkdirSync10(dirname8(cachePath), { recursive: true });
|
|
8268
|
+
mkdirSync10(dirname8(outputPath), { recursive: true });
|
|
8251
8269
|
if (!isUsableFile2(cachePath)) {
|
|
8252
8270
|
const tmpPath = `${cachePath}.tmp-${process.pid}-${randomUUID2()}`;
|
|
8253
8271
|
const inlinePath = `${tmpPath}.heic`;
|
|
@@ -8885,7 +8903,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
8885
8903
|
let filePath = src;
|
|
8886
8904
|
if (isHttpUrl(src)) {
|
|
8887
8905
|
const remoteDir = join21(downloadDir, REMOTE_MEDIA_SUBDIR);
|
|
8888
|
-
if (!existsSync11(remoteDir))
|
|
8906
|
+
if (!existsSync11(remoteDir)) mkdirSync11(remoteDir, { recursive: true });
|
|
8889
8907
|
run?.assets.reserve([src]);
|
|
8890
8908
|
try {
|
|
8891
8909
|
filePath = await downloadAsset(src, remoteDir, run?.assets);
|
|
@@ -9653,7 +9671,7 @@ var REMOTE_MEDIA_SUBDIR = "_remote_media";
|
|
|
9653
9671
|
async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, assets, extraRewrite) {
|
|
9654
9672
|
assets?.reserve(urlSet);
|
|
9655
9673
|
if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
|
|
9656
|
-
if (!existsSync11(remoteDir))
|
|
9674
|
+
if (!existsSync11(remoteDir)) mkdirSync11(remoteDir, { recursive: true });
|
|
9657
9675
|
const urlToLocal = /* @__PURE__ */ new Map();
|
|
9658
9676
|
await Promise.all(
|
|
9659
9677
|
[...urlSet].map(async (url) => {
|
|
@@ -11136,7 +11154,7 @@ function resolveCaptureSurface(input, quality) {
|
|
|
11136
11154
|
|
|
11137
11155
|
// src/services/render/stages/runtimeAudio.ts
|
|
11138
11156
|
import { createHash as createHash7 } from "node:crypto";
|
|
11139
|
-
import { mkdirSync as
|
|
11157
|
+
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync6 } from "node:fs";
|
|
11140
11158
|
import { join as join24 } from "node:path";
|
|
11141
11159
|
var RUNTIME_AUDIO_SUBDIR = "__hf_runtime_audio";
|
|
11142
11160
|
var MAX_INLINE_AUDIO_BYTES = 64 * 1024 * 1024;
|
|
@@ -11205,7 +11223,7 @@ function writeRuntimeAudio(compiledDir, bytes, mimeType) {
|
|
|
11205
11223
|
const digest = createHash7("sha256").update(bytes).digest("hex").slice(0, 16);
|
|
11206
11224
|
const filename = `${digest}${extensionForMime(mimeType)}`;
|
|
11207
11225
|
const dir = join24(compiledDir, RUNTIME_AUDIO_SUBDIR);
|
|
11208
|
-
|
|
11226
|
+
mkdirSync12(dir, { recursive: true });
|
|
11209
11227
|
const target = join24(dir, filename);
|
|
11210
11228
|
try {
|
|
11211
11229
|
writeFileSync6(target, bytes, { flag: "wx" });
|
|
@@ -13967,7 +13985,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
13967
13985
|
}
|
|
13968
13986
|
|
|
13969
13987
|
// src/services/render/stages/captureHdrStage.ts
|
|
13970
|
-
import { existsSync as existsSync20, mkdirSync as
|
|
13988
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync13 } from "node:fs";
|
|
13971
13989
|
import { join as join34 } from "node:path";
|
|
13972
13990
|
import {
|
|
13973
13991
|
closeCaptureSession as closeCaptureSession7,
|
|
@@ -14827,7 +14845,7 @@ async function runCaptureHdrStage(input) {
|
|
|
14827
14845
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
14828
14846
|
const debugDumpDir = debugDumpEnabled ? join34(framesDir, "debug-composite") : null;
|
|
14829
14847
|
if (debugDumpDir && !existsSync20(debugDumpDir)) {
|
|
14830
|
-
|
|
14848
|
+
mkdirSync13(debugDumpDir, { recursive: true });
|
|
14831
14849
|
}
|
|
14832
14850
|
const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
|
|
14833
14851
|
const hdrTargetTransfer = compositeTransfer === "srgb" ? void 0 : compositeTransfer;
|
|
@@ -14990,7 +15008,7 @@ async function runCaptureHdrStage(input) {
|
|
|
14990
15008
|
import {
|
|
14991
15009
|
copyFileSync as copyFileSync4,
|
|
14992
15010
|
existsSync as existsSync21,
|
|
14993
|
-
mkdirSync as
|
|
15011
|
+
mkdirSync as mkdirSync14,
|
|
14994
15012
|
readdirSync as readdirSync5,
|
|
14995
15013
|
readFileSync as readFileSync10,
|
|
14996
15014
|
rmSync as rmSync12,
|
|
@@ -15292,7 +15310,7 @@ async function runEncodeStage(input) {
|
|
|
15292
15310
|
const stage5Start = Date.now();
|
|
15293
15311
|
if (isPngSequence) {
|
|
15294
15312
|
const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
|
|
15295
|
-
if (!existsSync21(outputPath))
|
|
15313
|
+
if (!existsSync21(outputPath)) mkdirSync14(outputPath, { recursive: true });
|
|
15296
15314
|
const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
|
|
15297
15315
|
if (captured.length === 0) {
|
|
15298
15316
|
throw new Error(
|
|
@@ -16527,7 +16545,7 @@ async function renderJob(job, projectDir, outputPath, progressSink, abortSignal,
|
|
|
16527
16545
|
validateChromaSubsamplingConfig(job.config);
|
|
16528
16546
|
const debugDir = resolveRenderDebugDir();
|
|
16529
16547
|
const outputDir = dirname16(outputPath);
|
|
16530
|
-
if (!existsSync22(outputDir))
|
|
16548
|
+
if (!existsSync22(outputDir)) mkdirSync15(outputDir, { recursive: true });
|
|
16531
16549
|
const workDir = job.config.debug ? join36(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
|
|
16532
16550
|
const pipelineStart = Date.now();
|
|
16533
16551
|
const baseLog = job.config.logger ?? defaultLogger;
|
|
@@ -16687,7 +16705,7 @@ async function executeRenderPipeline(input) {
|
|
|
16687
16705
|
job.startedAt = /* @__PURE__ */ new Date();
|
|
16688
16706
|
assertNotAborted();
|
|
16689
16707
|
assertConfiguredFfmpegBinariesExist();
|
|
16690
|
-
if (!existsSync22(workDir))
|
|
16708
|
+
if (!existsSync22(workDir)) mkdirSync15(workDir, { recursive: true });
|
|
16691
16709
|
if (job.config.debug) {
|
|
16692
16710
|
log.info("[Render] Debug artifacts enabled", { workDir, logPath });
|
|
16693
16711
|
}
|
|
@@ -17095,7 +17113,7 @@ async function executeRenderPipeline(input) {
|
|
|
17095
17113
|
throw new Error("File server failed to initialize before frame capture");
|
|
17096
17114
|
}
|
|
17097
17115
|
const framesDir = join36(workDir, "captured-frames");
|
|
17098
|
-
if (!existsSync22(framesDir))
|
|
17116
|
+
if (!existsSync22(framesDir)) mkdirSync15(framesDir, { recursive: true });
|
|
17099
17117
|
updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
|
|
17100
17118
|
code: "start_browsers"
|
|
17101
17119
|
});
|
|
@@ -18518,7 +18536,7 @@ async function executeRenderPipeline(input) {
|
|
|
18518
18536
|
"drawElement capture failed; retrying with a fresh screenshot session"
|
|
18519
18537
|
);
|
|
18520
18538
|
rmSync13(framesDir, { recursive: true, force: true });
|
|
18521
|
-
|
|
18539
|
+
mkdirSync15(framesDir, { recursive: true });
|
|
18522
18540
|
resetCaptureAttemptProgress(job);
|
|
18523
18541
|
dedupPerfs.length = 0;
|
|
18524
18542
|
cfg.useDrawElement = false;
|
|
@@ -18826,12 +18844,12 @@ import {
|
|
|
18826
18844
|
REFERENCE_BACKGROUND_FIELD as REFERENCE_BACKGROUND_FIELD4,
|
|
18827
18845
|
referenceBackgroundResult as referenceBackgroundResult6
|
|
18828
18846
|
} from "@hyperframes/engine";
|
|
18829
|
-
import { mkdirSync as
|
|
18847
|
+
import { mkdirSync as mkdirSync23, mkdtempSync, readFileSync as readFileSync16, rmSync as rmSync19 } from "node:fs";
|
|
18830
18848
|
import { join as join50 } from "node:path";
|
|
18831
18849
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
18832
18850
|
|
|
18833
18851
|
// src/services/distributed/mp4Stitch.ts
|
|
18834
|
-
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as
|
|
18852
|
+
import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync16, rmSync as rmSync14 } from "node:fs";
|
|
18835
18853
|
import { open } from "node:fs/promises";
|
|
18836
18854
|
import { renameWithRetry as renameWithRetry6 } from "@hyperframes/engine";
|
|
18837
18855
|
import { basename as basename8, dirname as dirname17, join as join37 } from "node:path";
|
|
@@ -19199,7 +19217,7 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
19199
19217
|
const sourcePaths = audioPath ? [audioPath, ...chunkPaths] : chunkPaths;
|
|
19200
19218
|
const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
|
|
19201
19219
|
const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
|
|
19202
|
-
|
|
19220
|
+
mkdirSync16(dirname17(outputPath), { recursive: true });
|
|
19203
19221
|
const workDir = createStagingDir4(dirname17(outputPath), `${basename8(outputPath)}.stitch-`);
|
|
19204
19222
|
const out = createWriteStream(join37(workDir, "out.mp4"));
|
|
19205
19223
|
try {
|
|
@@ -19226,7 +19244,7 @@ import {
|
|
|
19226
19244
|
cpSync as cpSync2,
|
|
19227
19245
|
existsSync as existsSync27,
|
|
19228
19246
|
linkSync,
|
|
19229
|
-
mkdirSync as
|
|
19247
|
+
mkdirSync as mkdirSync19,
|
|
19230
19248
|
rmSync as rmSync15,
|
|
19231
19249
|
writeFileSync as writeFileSync11
|
|
19232
19250
|
} from "node:fs";
|
|
@@ -19903,7 +19921,7 @@ async function readPlanReferenceBackground(input) {
|
|
|
19903
19921
|
}
|
|
19904
19922
|
|
|
19905
19923
|
// src/services/render/stages/freezePlan.ts
|
|
19906
|
-
import { existsSync as existsSync25, mkdirSync as
|
|
19924
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync17, readFileSync as readFileSync12, readdirSync as readdirSync8, writeFileSync as writeFileSync9 } from "node:fs";
|
|
19907
19925
|
import { join as join42, relative as relative6, resolve as resolve11 } from "node:path";
|
|
19908
19926
|
import {
|
|
19909
19927
|
REFERENCE_BACKGROUND_FIELD,
|
|
@@ -20209,7 +20227,7 @@ async function freezePlan(input) {
|
|
|
20209
20227
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
20210
20228
|
}
|
|
20211
20229
|
const metaDir = join42(planDir, "meta");
|
|
20212
|
-
if (!existsSync25(metaDir))
|
|
20230
|
+
if (!existsSync25(metaDir)) mkdirSync17(metaDir, { recursive: true });
|
|
20213
20231
|
writeFileSync9(
|
|
20214
20232
|
join42(metaDir, "composition.json"),
|
|
20215
20233
|
`${JSON.stringify(composition, null, 2)}
|
|
@@ -20286,7 +20304,7 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
|
|
|
20286
20304
|
}
|
|
20287
20305
|
|
|
20288
20306
|
// src/services/distributed/chunkAudio.ts
|
|
20289
|
-
import { closeSync as closeSync7, existsSync as existsSync26, ftruncateSync, mkdirSync as
|
|
20307
|
+
import { closeSync as closeSync7, existsSync as existsSync26, ftruncateSync, mkdirSync as mkdirSync18, openSync as openSync7, readFileSync as readFileSync13 } from "node:fs";
|
|
20290
20308
|
import { writeFileSync as writeFileSync10, writeSync } from "node:fs";
|
|
20291
20309
|
import { join as join43 } from "node:path";
|
|
20292
20310
|
import { appendRenderProvenanceArgs, describeFfmpegFailure as describeFfmpegFailure4, runFfmpeg as runFfmpeg7 } from "@hyperframes/engine";
|
|
@@ -20376,7 +20394,7 @@ async function writeChunkAudioSlices(input) {
|
|
|
20376
20394
|
});
|
|
20377
20395
|
const bytes = readFileSync13(input.audioPath);
|
|
20378
20396
|
const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
|
|
20379
|
-
|
|
20397
|
+
mkdirSync18(join43(input.planDir, SLICE_DIR), { recursive: true });
|
|
20380
20398
|
input.chunks.forEach((_, index) => {
|
|
20381
20399
|
const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
|
|
20382
20400
|
if (!cut) return;
|
|
@@ -20967,7 +20985,7 @@ function createVideoSourceShipper(input) {
|
|
|
20967
20985
|
if (result === null) {
|
|
20968
20986
|
result = `video-sources/${shipped.size}${extname6(current)}`;
|
|
20969
20987
|
const destination = join45(input.planDir, ...result.split("/"));
|
|
20970
|
-
|
|
20988
|
+
mkdirSync19(join45(input.planDir, "video-sources"), { recursive: true });
|
|
20971
20989
|
try {
|
|
20972
20990
|
linkSync(current, destination);
|
|
20973
20991
|
} catch {
|
|
@@ -20987,7 +21005,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
20987
21005
|
useGpu: false,
|
|
20988
21006
|
browserGpuMode: "software"
|
|
20989
21007
|
});
|
|
20990
|
-
if (!existsSync27(planDir))
|
|
21008
|
+
if (!existsSync27(planDir)) mkdirSync19(planDir, { recursive: true });
|
|
20991
21009
|
const log = config.logger ?? defaultLogger;
|
|
20992
21010
|
const sizeLimitBytes = options.executionPlanSizeLimitBytes ?? config.planDirSizeLimitBytes ?? PLAN_DIR_SIZE_LIMIT_BYTES;
|
|
20993
21011
|
const abortSignal = config.abortSignal;
|
|
@@ -21027,9 +21045,9 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
21027
21045
|
}
|
|
21028
21046
|
const workDir = join45(planDir, ".plan-work");
|
|
21029
21047
|
rmSync15(workDir, { recursive: true, force: true });
|
|
21030
|
-
|
|
21048
|
+
mkdirSync19(workDir, { recursive: true });
|
|
21031
21049
|
const compiledDir = join45(workDir, "compiled");
|
|
21032
|
-
|
|
21050
|
+
mkdirSync19(compiledDir, { recursive: true });
|
|
21033
21051
|
let stageStarted = Date.now();
|
|
21034
21052
|
cpSync2(projectDir, compiledDir, {
|
|
21035
21053
|
recursive: true,
|
|
@@ -21264,7 +21282,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
21264
21282
|
if (existsSync27(stagedVideoFrames)) {
|
|
21265
21283
|
renameWithRetry7(stagedVideoFrames, videoFramesDst);
|
|
21266
21284
|
} else {
|
|
21267
|
-
|
|
21285
|
+
mkdirSync19(videoFramesDst, { recursive: true });
|
|
21268
21286
|
}
|
|
21269
21287
|
if (existsSync27(finalCompiledDir)) rmSync15(finalCompiledDir, { recursive: true, force: true });
|
|
21270
21288
|
renameWithRetry7(compiledDir, finalCompiledDir);
|
|
@@ -21296,7 +21314,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
21296
21314
|
};
|
|
21297
21315
|
})
|
|
21298
21316
|
});
|
|
21299
|
-
|
|
21317
|
+
mkdirSync19(join45(planDir, "meta"), { recursive: true });
|
|
21300
21318
|
writePlanRemoteFiles(
|
|
21301
21319
|
planDir,
|
|
21302
21320
|
remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
|
|
@@ -21512,7 +21530,7 @@ async function plan(projectDir, config, planDir, options = {}) {
|
|
|
21512
21530
|
|
|
21513
21531
|
// src/services/distributed/renderChunk.ts
|
|
21514
21532
|
import { randomBytes } from "node:crypto";
|
|
21515
|
-
import { existsSync as existsSync30, mkdirSync as
|
|
21533
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync22, readFileSync as readFileSync15, readdirSync as readdirSync11, rmSync as rmSync18, writeFileSync as writeFileSync14 } from "node:fs";
|
|
21516
21534
|
import { join as join49 } from "node:path";
|
|
21517
21535
|
import {
|
|
21518
21536
|
assertSwiftShader,
|
|
@@ -21541,7 +21559,7 @@ import {
|
|
|
21541
21559
|
copyFileSync as copyFileSync8,
|
|
21542
21560
|
existsSync as existsSync29,
|
|
21543
21561
|
lstatSync as lstatSync5,
|
|
21544
|
-
mkdirSync as
|
|
21562
|
+
mkdirSync as mkdirSync21,
|
|
21545
21563
|
readFileSync as readFileSync14,
|
|
21546
21564
|
readdirSync as readdirSync10,
|
|
21547
21565
|
rmSync as rmSync17,
|
|
@@ -21562,7 +21580,7 @@ import {
|
|
|
21562
21580
|
copyFileSync as copyFileSync7,
|
|
21563
21581
|
existsSync as existsSync28,
|
|
21564
21582
|
linkSync as linkSync2,
|
|
21565
|
-
mkdirSync as
|
|
21583
|
+
mkdirSync as mkdirSync20,
|
|
21566
21584
|
rmSync as rmSync16,
|
|
21567
21585
|
statSync as statSync11,
|
|
21568
21586
|
writeFileSync as writeFileSync12
|
|
@@ -21629,7 +21647,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
21629
21647
|
}
|
|
21630
21648
|
this.destinationDir = destinationDir;
|
|
21631
21649
|
this.#linkFile = options.linkFile ?? linkSync2;
|
|
21632
|
-
|
|
21650
|
+
mkdirSync20(dirname19(destinationDir), { recursive: true });
|
|
21633
21651
|
this.temporaryDir = createStagingDir5(dirname19(destinationDir), ".plan-v2-publish-");
|
|
21634
21652
|
}
|
|
21635
21653
|
async putBlob(blob) {
|
|
@@ -21642,7 +21660,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
21642
21660
|
}
|
|
21643
21661
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
21644
21662
|
if (existsSync28(destinationPath)) return;
|
|
21645
|
-
|
|
21663
|
+
mkdirSync20(dirname19(destinationPath), { recursive: true });
|
|
21646
21664
|
const stagingDir = createStagingDir5(dirname19(destinationPath), ".plan-v2-blob-");
|
|
21647
21665
|
const temporaryPath = join47(stagingDir, "blob");
|
|
21648
21666
|
try {
|
|
@@ -21843,7 +21861,7 @@ function materializeExtractedVideoDirectories(planDir) {
|
|
|
21843
21861
|
if (!existsSync29(videosPath)) return;
|
|
21844
21862
|
const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
|
|
21845
21863
|
for (const video of videos.extracted) {
|
|
21846
|
-
|
|
21864
|
+
mkdirSync21(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
|
|
21847
21865
|
}
|
|
21848
21866
|
}
|
|
21849
21867
|
function parseChunkSlices(value) {
|
|
@@ -21934,7 +21952,7 @@ function computeManifestHash(manifest) {
|
|
|
21934
21952
|
}
|
|
21935
21953
|
function writeBlob(sourcePath, destinationPath) {
|
|
21936
21954
|
if (existsSync29(destinationPath)) return;
|
|
21937
|
-
|
|
21955
|
+
mkdirSync21(dirname20(destinationPath), { recursive: true });
|
|
21938
21956
|
const temporaryDir = createStagingDir6(dirname20(destinationPath), ".plan-v2-blob-");
|
|
21939
21957
|
const temporaryPath = join48(temporaryDir, "blob");
|
|
21940
21958
|
try {
|
|
@@ -22060,7 +22078,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
22060
22078
|
if (publication.storedBlobs.length > 0) {
|
|
22061
22079
|
throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
|
|
22062
22080
|
}
|
|
22063
|
-
|
|
22081
|
+
mkdirSync21(dirname20(planV2Dir), { recursive: true });
|
|
22064
22082
|
const tempDir = createStagingDir6(dirname20(planV2Dir), ".plan-v2-build-");
|
|
22065
22083
|
try {
|
|
22066
22084
|
for (const blob of publication.blobs) {
|
|
@@ -22341,12 +22359,12 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
22341
22359
|
artifact,
|
|
22342
22360
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
22343
22361
|
}));
|
|
22344
|
-
|
|
22362
|
+
mkdirSync21(dirname20(destinationDir), { recursive: true });
|
|
22345
22363
|
const tempDir = createStagingDir6(dirname20(destinationDir), ".plan-v2-materialize-");
|
|
22346
22364
|
try {
|
|
22347
22365
|
for (const { artifact, sourcePath } of verified) {
|
|
22348
22366
|
const destinationPath = join48(tempDir, ...artifact.path.split("/"));
|
|
22349
|
-
|
|
22367
|
+
mkdirSync21(dirname20(destinationPath), { recursive: true });
|
|
22350
22368
|
copyFileSync8(sourcePath, destinationPath);
|
|
22351
22369
|
}
|
|
22352
22370
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
@@ -22678,9 +22696,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22678
22696
|
forceScreenshotExplicitlyOptedOut: !encoder.forceScreenshot
|
|
22679
22697
|
};
|
|
22680
22698
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
|
|
22681
|
-
|
|
22699
|
+
mkdirSync22(workDir, { recursive: true });
|
|
22682
22700
|
const framesDir = join49(workDir, "captured-frames");
|
|
22683
|
-
|
|
22701
|
+
mkdirSync22(framesDir, { recursive: true });
|
|
22684
22702
|
const videoFramesDir = `${workDir}.video-frames`;
|
|
22685
22703
|
const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
|
|
22686
22704
|
const chunkFps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
|
|
@@ -22874,10 +22892,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22874
22892
|
const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
|
|
22875
22893
|
const videoOnlyPath = encoder.chunksCarryAudio ? `${outputChunkPath}.video.mp4` : outputChunkPath;
|
|
22876
22894
|
if (isPngSequence) {
|
|
22877
|
-
if (!existsSync30(outputChunkPath))
|
|
22895
|
+
if (!existsSync30(outputChunkPath)) mkdirSync22(outputChunkPath, { recursive: true });
|
|
22878
22896
|
} else {
|
|
22879
22897
|
const outDir = join49(outputChunkPath, "..");
|
|
22880
|
-
if (!existsSync30(outDir))
|
|
22898
|
+
if (!existsSync30(outDir)) mkdirSync22(outDir, { recursive: true });
|
|
22881
22899
|
}
|
|
22882
22900
|
const encodeInput = {
|
|
22883
22901
|
job,
|
|
@@ -22998,7 +23016,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22998
23016
|
resetForScreenshotRetry: () => {
|
|
22999
23017
|
rmSync18(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
23000
23018
|
boxesMeasured();
|
|
23001
|
-
|
|
23019
|
+
mkdirSync22(framesDir, { recursive: true });
|
|
23002
23020
|
capturePerfs.length = 0;
|
|
23003
23021
|
captureAttempts.length = 0;
|
|
23004
23022
|
job.framesRendered = 0;
|
|
@@ -23157,7 +23175,7 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
|
|
|
23157
23175
|
try {
|
|
23158
23176
|
const planDir = join50(workDir, "plan");
|
|
23159
23177
|
const partsDir = join50(workDir, "parts");
|
|
23160
|
-
|
|
23178
|
+
mkdirSync23(partsDir, { recursive: true });
|
|
23161
23179
|
const planned = await plan(
|
|
23162
23180
|
projectDir,
|
|
23163
23181
|
{ ...config, rejectOnSystemFonts: false, failClosedFontFetch: false },
|
|
@@ -23864,7 +23882,7 @@ import {
|
|
|
23864
23882
|
existsSync as existsSync33,
|
|
23865
23883
|
fstatSync as fstatSync5,
|
|
23866
23884
|
lstatSync as lstatSync6,
|
|
23867
|
-
mkdirSync as
|
|
23885
|
+
mkdirSync as mkdirSync24,
|
|
23868
23886
|
openSync as openSync9,
|
|
23869
23887
|
statSync as statSync14,
|
|
23870
23888
|
mkdtempSync as mkdtempSync2,
|
|
@@ -24356,7 +24374,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
24356
24374
|
const absoluteOutputPath = resolveOutputPath(input.projectDir, outputCandidate, rendersDir, log);
|
|
24357
24375
|
const outputDir = dirname23(absoluteOutputPath);
|
|
24358
24376
|
if (confineOutput) {
|
|
24359
|
-
|
|
24377
|
+
mkdirSync24(rendersDir, { recursive: true, mode: SERVER_FOLDER_MODE });
|
|
24360
24378
|
if (!isSafePath4(rendersDir, absoluteOutputPath)) {
|
|
24361
24379
|
throw new Error("outputPath must be inside the renders directory");
|
|
24362
24380
|
}
|
|
@@ -24367,7 +24385,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
24367
24385
|
);
|
|
24368
24386
|
}
|
|
24369
24387
|
}
|
|
24370
|
-
if (!existsSync33(outputDir))
|
|
24388
|
+
if (!existsSync33(outputDir)) mkdirSync24(outputDir, { recursive: true, mode: SERVER_FOLDER_MODE });
|
|
24371
24389
|
return { input, cleanupProjectDir, absoluteOutputPath, serverNamed };
|
|
24372
24390
|
}
|
|
24373
24391
|
var STICKY_BIT = 512;
|
|
@@ -25072,7 +25090,7 @@ function serverAuth(options, hostname2, port) {
|
|
|
25072
25090
|
options.authTokenFile?.trim() || process.env.PRODUCER_AUTH_TOKEN_FILE?.trim() || join53(homedir(), ".hyperframes", "producer", `${port}.token`)
|
|
25073
25091
|
);
|
|
25074
25092
|
const token = crypto.randomBytes(32).toString("base64url");
|
|
25075
|
-
|
|
25093
|
+
mkdirSync24(dirname23(file), { recursive: true, mode: 448 });
|
|
25076
25094
|
rmSync20(file, { force: true });
|
|
25077
25095
|
writeFileSync15(file, `${token}
|
|
25078
25096
|
`, { flag: "wx", mode: 384 });
|
|
@@ -25164,7 +25182,7 @@ import {
|
|
|
25164
25182
|
import {
|
|
25165
25183
|
cpSync as cpSync3,
|
|
25166
25184
|
existsSync as existsSync34,
|
|
25167
|
-
mkdirSync as
|
|
25185
|
+
mkdirSync as mkdirSync25,
|
|
25168
25186
|
readFileSync as readFileSync18,
|
|
25169
25187
|
readdirSync as readdirSync12,
|
|
25170
25188
|
rmSync as rmSync21,
|
|
@@ -25221,7 +25239,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
25221
25239
|
const format = plan2.dimensions.format;
|
|
25222
25240
|
const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
|
|
25223
25241
|
if (!existsSync34(dirname24(outputPath))) {
|
|
25224
|
-
|
|
25242
|
+
mkdirSync25(dirname24(outputPath), { recursive: true });
|
|
25225
25243
|
}
|
|
25226
25244
|
const workDir = createStagingDir7(dirname24(outputPath), `${basename10(outputPath)}.assemble-work-`);
|
|
25227
25245
|
const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
|
|
@@ -25458,7 +25476,7 @@ function readCfrEncoder(planDir, format) {
|
|
|
25458
25476
|
}
|
|
25459
25477
|
function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
|
|
25460
25478
|
if (existsSync34(outputPath)) rmSync21(outputPath, { recursive: true, force: true });
|
|
25461
|
-
|
|
25479
|
+
mkdirSync25(outputPath, { recursive: true });
|
|
25462
25480
|
let globalIdx = 0;
|
|
25463
25481
|
for (const chunkDir of chunkPaths) {
|
|
25464
25482
|
if (!statSync15(chunkDir).isDirectory()) {
|