@hyperframes/producer 0.9.94 → 0.9.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compileWorker.js +6 -2
- package/dist/distributed.js +41 -27
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +66 -66
- package/dist/index.js +81 -54
- package/dist/public-server.js +72 -45
- package/package.json +7 -7
package/dist/public-server.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
createReadStream as createReadStream4
|
|
33
33
|
} from "node:fs";
|
|
34
34
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
35
|
-
import { basename as basename8, resolve as
|
|
35
|
+
import { basename as basename8, resolve as resolve12, dirname as dirname20, join as join40 } from "node:path";
|
|
36
36
|
import { homedir, tmpdir as tmpdir4 } from "node:os";
|
|
37
37
|
import { parseArgs } from "node:util";
|
|
38
38
|
import { isIP } from "node:net";
|
|
@@ -403,7 +403,8 @@ import {
|
|
|
403
403
|
referenceBackgroundResult,
|
|
404
404
|
createReferenceBackgroundRecorder
|
|
405
405
|
} from "@hyperframes/engine";
|
|
406
|
-
import { join as join35, dirname as dirname16, resolve as
|
|
406
|
+
import { join as join35, dirname as dirname16, resolve as resolve10 } from "path";
|
|
407
|
+
import { fromEmptyFolder } from "@hyperframes/parsers/ff-binaries";
|
|
407
408
|
import { totalmem as totalmem2 } from "node:os";
|
|
408
409
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
409
410
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -1313,13 +1314,13 @@ function createFileServer(options) {
|
|
|
1313
1314
|
if (!streamOwnsFd) closeSync(fd);
|
|
1314
1315
|
}
|
|
1315
1316
|
});
|
|
1316
|
-
return new Promise((
|
|
1317
|
+
return new Promise((resolve13, reject) => {
|
|
1317
1318
|
const connections = /* @__PURE__ */ new Set();
|
|
1318
1319
|
const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
|
|
1319
1320
|
const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
|
|
1320
1321
|
bound.then((boundPort) => {
|
|
1321
1322
|
listeningPort = boundPort;
|
|
1322
|
-
|
|
1323
|
+
resolve13({
|
|
1323
1324
|
url: `http://localhost:${boundPort}`,
|
|
1324
1325
|
port: boundPort,
|
|
1325
1326
|
addPreHeadScript: (script) => {
|
|
@@ -2007,8 +2008,8 @@ var OrderedRenderEventPublisher = class {
|
|
|
2007
2008
|
let timer;
|
|
2008
2009
|
const drained = await Promise.race([
|
|
2009
2010
|
this.tail.then(() => true),
|
|
2010
|
-
new Promise((
|
|
2011
|
-
timer = setTimeout(() =>
|
|
2011
|
+
new Promise((resolve13) => {
|
|
2012
|
+
timer = setTimeout(() => resolve13(false), FLUSH_TIMEOUT_MS);
|
|
2012
2013
|
})
|
|
2013
2014
|
]);
|
|
2014
2015
|
clearTimeout(timer);
|
|
@@ -2683,6 +2684,7 @@ import {
|
|
|
2683
2684
|
concatVideoFiles,
|
|
2684
2685
|
createCaptureSession as createCaptureSession2,
|
|
2685
2686
|
getCapturePerfSummary as getCapturePerfSummary2,
|
|
2687
|
+
retainCapturePerf as retainCapturePerf3,
|
|
2686
2688
|
initializeSession as initializeSession2,
|
|
2687
2689
|
prepareCaptureSessionForReuse as prepareCaptureSessionForReuse2,
|
|
2688
2690
|
resolveDeVerifyMinDb as resolveDeVerifyMinDb2,
|
|
@@ -2696,7 +2698,7 @@ import { CaptureFailure, classifyCaptureFailure } from "@hyperframes/engine";
|
|
|
2696
2698
|
// src/services/render/perfSummary.ts
|
|
2697
2699
|
import { arch, platform, totalmem } from "node:os";
|
|
2698
2700
|
import { fpsToNumber as fpsToNumber2 } from "@hyperframes/core";
|
|
2699
|
-
import { hostCpuCount } from "@hyperframes/engine";
|
|
2701
|
+
import { hostCpuCount, retainCapturePerf } from "@hyperframes/engine";
|
|
2700
2702
|
|
|
2701
2703
|
// src/services/render/hdrPerf.ts
|
|
2702
2704
|
function createHdrPerfCollector() {
|
|
@@ -2812,7 +2814,7 @@ function worstSubTimelineWaitOutcome(perfs) {
|
|
|
2812
2814
|
}
|
|
2813
2815
|
function pushWorkerDedupPerfs(results, sink) {
|
|
2814
2816
|
for (const r of results) {
|
|
2815
|
-
if (r.perf) sink
|
|
2817
|
+
if (r.perf) retainCapturePerf(sink, r.perf);
|
|
2816
2818
|
}
|
|
2817
2819
|
}
|
|
2818
2820
|
function capturedBeyondViewport(perfs, fallback) {
|
|
@@ -4650,6 +4652,7 @@ import {
|
|
|
4650
4652
|
distributeFramesInterleaved,
|
|
4651
4653
|
executeParallelCapture,
|
|
4652
4654
|
getCapturePerfSummary,
|
|
4655
|
+
retainCapturePerf as retainCapturePerf2,
|
|
4653
4656
|
psnrDb,
|
|
4654
4657
|
resolveDeVerifyMinDb,
|
|
4655
4658
|
recaptureDrawElementFrameForVerify,
|
|
@@ -4731,7 +4734,7 @@ var SequentialCaptureStallError = class extends Error {
|
|
|
4731
4734
|
}
|
|
4732
4735
|
};
|
|
4733
4736
|
function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
4734
|
-
return new Promise((
|
|
4737
|
+
return new Promise((resolve13, reject) => {
|
|
4735
4738
|
const clock = createStallClock();
|
|
4736
4739
|
const trip = () => reject(
|
|
4737
4740
|
signal?.aborted ? new Error(
|
|
@@ -4756,7 +4759,7 @@ function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
|
4756
4759
|
promise.then(
|
|
4757
4760
|
(value) => {
|
|
4758
4761
|
clearTimeout(timer);
|
|
4759
|
-
|
|
4762
|
+
resolve13(value);
|
|
4760
4763
|
},
|
|
4761
4764
|
(error) => {
|
|
4762
4765
|
clearTimeout(timer);
|
|
@@ -5378,7 +5381,7 @@ async function runCaptureStreamingStage(input) {
|
|
|
5378
5381
|
);
|
|
5379
5382
|
}
|
|
5380
5383
|
}
|
|
5381
|
-
dedupPerfs
|
|
5384
|
+
retainCapturePerf2(dedupPerfs, getCapturePerfSummary(session));
|
|
5382
5385
|
} catch (error) {
|
|
5383
5386
|
lastBrowserConsole = session.browserConsoleBuffer;
|
|
5384
5387
|
if (!resumesAfterStall(error, abortSignal, resume, resumes)) {
|
|
@@ -5678,7 +5681,7 @@ async function openSegmentWorkersTogether(run, workersToCloseLater) {
|
|
|
5678
5681
|
if (failure && failure.status === "rejected") throw failure.reason;
|
|
5679
5682
|
}
|
|
5680
5683
|
async function recycleWorkerSession(run, worker, why) {
|
|
5681
|
-
run.input.dedupPerfs
|
|
5684
|
+
retainCapturePerf3(run.input.dedupPerfs, getCapturePerfSummary2(worker.ctx.session));
|
|
5682
5685
|
const memory = worker.ctx.session.chromeMemory?.stats();
|
|
5683
5686
|
await run.deps.closeSession(worker.ctx.session);
|
|
5684
5687
|
const { frames } = worker.ctx;
|
|
@@ -5807,7 +5810,8 @@ async function runCaptureSegmentedStage(input) {
|
|
|
5807
5810
|
assertNotAborted();
|
|
5808
5811
|
await openSegmentWorkersTogether(run, workers);
|
|
5809
5812
|
const outcomes = await Promise.allSettled(workers.map((w) => runWorkerLoop(w)));
|
|
5810
|
-
for (const worker of workers)
|
|
5813
|
+
for (const worker of workers)
|
|
5814
|
+
retainCapturePerf3(dedupPerfs, getCapturePerfSummary2(worker.ctx.session));
|
|
5811
5815
|
const failure = outcomes.find((o) => o.status === "rejected");
|
|
5812
5816
|
if (failure && failure.status === "rejected") throw failure.reason;
|
|
5813
5817
|
} catch (error) {
|
|
@@ -7266,7 +7270,7 @@ function countAuthoredTimedClips(html) {
|
|
|
7266
7270
|
|
|
7267
7271
|
// src/services/render/stages/compileStage.ts
|
|
7268
7272
|
import { existsSync as existsSync13, writeFileSync as writeFileSync5 } from "node:fs";
|
|
7269
|
-
import { join as join23, relative as relative5 } from "node:path";
|
|
7273
|
+
import { join as join23, relative as relative5, resolve as resolve9 } from "node:path";
|
|
7270
7274
|
import { privateCacheRoot } from "@hyperframes/engine";
|
|
7271
7275
|
import { suggestMatchingPreset } from "@hyperframes/core";
|
|
7272
7276
|
import { extractStandaloneEntryFromIndex, isTemplateEntry } from "@hyperframes/core/compiler";
|
|
@@ -7275,6 +7279,7 @@ import { assertCompositionFileSize as assertCompositionFileSize2 } from "@hyperf
|
|
|
7275
7279
|
|
|
7276
7280
|
// src/services/compileInWorker.ts
|
|
7277
7281
|
import { existsSync as existsSync12, rmSync as rmSync11 } from "node:fs";
|
|
7282
|
+
import { ffmpegCwd } from "@hyperframes/parsers/ff-binaries";
|
|
7278
7283
|
import { dirname as dirname11, isAbsolute as isAbsolute4, join as join22, relative as relative4, resolve as resolvePath } from "node:path";
|
|
7279
7284
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7280
7285
|
import { Worker } from "node:worker_threads";
|
|
@@ -7346,6 +7351,7 @@ import { gsapCdnDist, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
|
|
|
7346
7351
|
import {
|
|
7347
7352
|
assignBundledRuntimeCompositionIds,
|
|
7348
7353
|
assignMediaRenderIds,
|
|
7354
|
+
dropAuthoredCompositionFiles,
|
|
7349
7355
|
emitVariablesByCompScript,
|
|
7350
7356
|
inlineSubCompositions as inlineSubCompositionsShared,
|
|
7351
7357
|
ensureExternalLinkTag,
|
|
@@ -8003,10 +8009,10 @@ var Semaphore = class {
|
|
|
8003
8009
|
this.active++;
|
|
8004
8010
|
return () => this.release();
|
|
8005
8011
|
}
|
|
8006
|
-
return new Promise((
|
|
8012
|
+
return new Promise((resolve13) => {
|
|
8007
8013
|
this.queue.push(() => {
|
|
8008
8014
|
this.active++;
|
|
8009
|
-
|
|
8015
|
+
resolve13(() => this.release());
|
|
8010
8016
|
});
|
|
8011
8017
|
});
|
|
8012
8018
|
}
|
|
@@ -8808,7 +8814,7 @@ var AssetDownloads = class {
|
|
|
8808
8814
|
}
|
|
8809
8815
|
async download(url, destDir) {
|
|
8810
8816
|
while (this.running >= ASSET_DOWNLOADS_AT_ONCE) {
|
|
8811
|
-
await new Promise((
|
|
8817
|
+
await new Promise((resolve13) => this.queued.push(resolve13));
|
|
8812
8818
|
}
|
|
8813
8819
|
if (this.signal?.aborted) {
|
|
8814
8820
|
this.queued.shift()?.();
|
|
@@ -9197,6 +9203,7 @@ function coalesceHeadStylesAndBodyScripts(html) {
|
|
|
9197
9203
|
}
|
|
9198
9204
|
function inlineSubCompositions(html, subCompositions, projectDir, variableOverrides, assetRoot, outsideFiles, budget) {
|
|
9199
9205
|
const { document: document2 } = parseHTML5(html);
|
|
9206
|
+
dropAuthoredCompositionFiles(document2);
|
|
9200
9207
|
budget.chargeElements(ENTRY_PAGE, document2.querySelectorAll("*").length);
|
|
9201
9208
|
const head = document2.querySelector("head");
|
|
9202
9209
|
const body = document2.querySelector("body");
|
|
@@ -10724,9 +10731,15 @@ async function compileForRenderInWorker(projectDir, htmlPath, downloadDir, optio
|
|
|
10724
10731
|
if (!entry) return compileForRender(projectDir, htmlPath, downloadDir, options);
|
|
10725
10732
|
abortSignal?.throwIfAborted();
|
|
10726
10733
|
const timeoutMs = worker.timeoutMs ?? compileTimeoutMs();
|
|
10727
|
-
return new Promise((
|
|
10734
|
+
return new Promise((resolve13, reject) => {
|
|
10728
10735
|
const thread = new Worker(entry, {
|
|
10729
|
-
workerData: {
|
|
10736
|
+
workerData: {
|
|
10737
|
+
projectDir,
|
|
10738
|
+
htmlPath,
|
|
10739
|
+
downloadDir,
|
|
10740
|
+
options: cloneable,
|
|
10741
|
+
emptyFolder: ffmpegCwd() !== void 0
|
|
10742
|
+
}
|
|
10730
10743
|
});
|
|
10731
10744
|
const children = /* @__PURE__ */ new Map();
|
|
10732
10745
|
const scratchRoots = [downloadDir, options.animatedGifCacheDir].flatMap(
|
|
@@ -10780,7 +10793,7 @@ async function compileForRenderInWorker(projectDir, htmlPath, downloadDir, optio
|
|
|
10780
10793
|
log?.[message.level](message.message ?? "", message.meta);
|
|
10781
10794
|
} else if (message.type === "result" && message.compiled) {
|
|
10782
10795
|
const { compiled } = message;
|
|
10783
|
-
settle(() =>
|
|
10796
|
+
settle(() => resolve13(compiled));
|
|
10784
10797
|
retire(ADVISORY_GRACE_MS);
|
|
10785
10798
|
} else if (message.type === "error" && message.error) {
|
|
10786
10799
|
const { error } = message;
|
|
@@ -10812,7 +10825,7 @@ async function compileForRenderInWorker(projectDir, htmlPath, downloadDir, optio
|
|
|
10812
10825
|
// src/services/render/stages/compileStage.ts
|
|
10813
10826
|
function animatedGifCacheDir(extractCacheDir) {
|
|
10814
10827
|
try {
|
|
10815
|
-
const root = extractCacheDir && privateCacheRoot(extractCacheDir);
|
|
10828
|
+
const root = extractCacheDir && privateCacheRoot(resolve9(extractCacheDir));
|
|
10816
10829
|
return root ? join23(root, "animated-gif") : void 0;
|
|
10817
10830
|
} catch {
|
|
10818
10831
|
return void 0;
|
|
@@ -12498,7 +12511,7 @@ import {
|
|
|
12498
12511
|
} from "@hyperframes/engine";
|
|
12499
12512
|
|
|
12500
12513
|
// src/services/render/audioPadTrim.ts
|
|
12501
|
-
import { localContainerInputArgs } from "@hyperframes/parsers/ff-binaries";
|
|
12514
|
+
import { ffmpegCwd as ffmpegCwd2, localContainerInputArgs } from "@hyperframes/parsers/ff-binaries";
|
|
12502
12515
|
import { spawn } from "node:child_process";
|
|
12503
12516
|
import { dirname as dirname12, join as join26 } from "node:path";
|
|
12504
12517
|
import {
|
|
@@ -12969,6 +12982,7 @@ async function spawnFfprobeJson(args, env, signal) {
|
|
|
12969
12982
|
const proc = spawn(getFfprobeBinary(), args, {
|
|
12970
12983
|
...env && { env },
|
|
12971
12984
|
stdio: ["ignore", "pipe", "pipe"],
|
|
12985
|
+
cwd: ffmpegCwd2(),
|
|
12972
12986
|
windowsHide: true
|
|
12973
12987
|
});
|
|
12974
12988
|
trackChildProcess(proc);
|
|
@@ -13256,6 +13270,7 @@ import {
|
|
|
13256
13270
|
completeDeferredDrawElementInit as completeDeferredDrawElementInit3,
|
|
13257
13271
|
createCaptureSession as createCaptureSession5,
|
|
13258
13272
|
getCapturePerfSummary as getCapturePerfSummary3,
|
|
13273
|
+
retainCapturePerf as retainCapturePerf4,
|
|
13259
13274
|
initializeSession as initializeSession5,
|
|
13260
13275
|
prepareCaptureSessionForReuse as prepareCaptureSessionForReuse3
|
|
13261
13276
|
} from "@hyperframes/engine";
|
|
@@ -13617,7 +13632,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
13617
13632
|
},
|
|
13618
13633
|
false
|
|
13619
13634
|
);
|
|
13620
|
-
dedupPerfs
|
|
13635
|
+
retainCapturePerf4(dedupPerfs, getCapturePerfSummary3(session));
|
|
13621
13636
|
}
|
|
13622
13637
|
|
|
13623
13638
|
// src/services/render/stages/captureHdrStage.ts
|
|
@@ -14033,8 +14048,8 @@ async function createShaderTransitionWorkerPool(opts) {
|
|
|
14033
14048
|
if (terminated) {
|
|
14034
14049
|
throw new Error("shader-blend pool already terminated");
|
|
14035
14050
|
}
|
|
14036
|
-
return new Promise((
|
|
14037
|
-
const task = traceEnabled ? { req, resolve:
|
|
14051
|
+
return new Promise((resolve13, reject) => {
|
|
14052
|
+
const task = traceEnabled ? { req, resolve: resolve13, reject, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve13, reject };
|
|
14038
14053
|
const idle = slots.find((s) => !s.busy && !s.dead);
|
|
14039
14054
|
if (idle) {
|
|
14040
14055
|
queue.unshift(task);
|
|
@@ -14863,7 +14878,7 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
|
14863
14878
|
const stream = await encoder;
|
|
14864
14879
|
for (let next = 0; next < totalFrames; next++) {
|
|
14865
14880
|
while (!landed.has(next) && !captureDone && !signal.aborted) {
|
|
14866
|
-
await new Promise((
|
|
14881
|
+
await new Promise((resolve13) => wake = resolve13);
|
|
14867
14882
|
}
|
|
14868
14883
|
if (signal.aborted) return;
|
|
14869
14884
|
const mergedPath = join34(input.framesDir, formatCaptureFrameName(next, "jpg"));
|
|
@@ -16155,10 +16170,22 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
16155
16170
|
};
|
|
16156
16171
|
}
|
|
16157
16172
|
function resolveRenderDebugDir() {
|
|
16158
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ?
|
|
16173
|
+
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve10(process.env.PRODUCER_RENDERS_DIR, "..") : resolve10(dirname16(fileURLToPath5(import.meta.url)), "../..");
|
|
16159
16174
|
return join35(producerRoot, ".debug");
|
|
16160
16175
|
}
|
|
16161
|
-
|
|
16176
|
+
function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
16177
|
+
return fromEmptyFolder(
|
|
16178
|
+
() => renderJob(
|
|
16179
|
+
job,
|
|
16180
|
+
resolve10(projectDir),
|
|
16181
|
+
resolve10(outputPath),
|
|
16182
|
+
progressSink,
|
|
16183
|
+
abortSignal,
|
|
16184
|
+
assertRenderActive
|
|
16185
|
+
)
|
|
16186
|
+
);
|
|
16187
|
+
}
|
|
16188
|
+
async function renderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
16162
16189
|
validateHlsRenderConfig(job.config);
|
|
16163
16190
|
validateDeliveryEncoderConfig(job.config);
|
|
16164
16191
|
validateChromaSubsamplingConfig(job.config);
|
|
@@ -18465,7 +18492,7 @@ import {
|
|
|
18465
18492
|
closeSync as closeSync6,
|
|
18466
18493
|
constants as constants4
|
|
18467
18494
|
} from "node:fs";
|
|
18468
|
-
import { resolve as
|
|
18495
|
+
import { resolve as resolve11, join as join36, relative as relative6, isAbsolute as isAbsolute5, sep as sep5, dirname as dirname17 } from "node:path";
|
|
18469
18496
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
18470
18497
|
import { Worker as Worker3 } from "node:worker_threads";
|
|
18471
18498
|
function isStringRecord(value) {
|
|
@@ -18515,7 +18542,7 @@ function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
|
|
|
18515
18542
|
return entryRelativePath === ".." || entryRelativePath.startsWith(`..${sep5}`) || isAbsolute5(entryRelativePath) || isAllowedEntry !== void 0 && !isAllowedEntry(absoluteEntryPath);
|
|
18516
18543
|
}
|
|
18517
18544
|
function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
18518
|
-
const absProjectDir =
|
|
18545
|
+
const absProjectDir = resolve11(projectDir);
|
|
18519
18546
|
if (!existsSync23(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
|
|
18520
18547
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
18521
18548
|
}
|
|
@@ -18523,7 +18550,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
|
18523
18550
|
(value) => typeof value === "string" && value.trim().length > 0
|
|
18524
18551
|
);
|
|
18525
18552
|
for (const entryFile of entryCandidates) {
|
|
18526
|
-
const absoluteEntryPath =
|
|
18553
|
+
const absoluteEntryPath = resolve11(absProjectDir, entryFile);
|
|
18527
18554
|
if (leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry)) {
|
|
18528
18555
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
18529
18556
|
}
|
|
@@ -18583,16 +18610,16 @@ function takeLintSlot(limit, waitMs) {
|
|
|
18583
18610
|
running++;
|
|
18584
18611
|
return Promise.resolve(true);
|
|
18585
18612
|
}
|
|
18586
|
-
return new Promise((
|
|
18613
|
+
return new Promise((resolve13) => {
|
|
18587
18614
|
const entry = () => {
|
|
18588
18615
|
clearTimeout(timer);
|
|
18589
18616
|
running++;
|
|
18590
|
-
|
|
18617
|
+
resolve13(true);
|
|
18591
18618
|
};
|
|
18592
18619
|
const timer = setTimeout(
|
|
18593
18620
|
() => {
|
|
18594
18621
|
waiting.splice(waiting.indexOf(entry), 1);
|
|
18595
|
-
|
|
18622
|
+
resolve13(false);
|
|
18596
18623
|
},
|
|
18597
18624
|
Math.max(0, waitMs)
|
|
18598
18625
|
);
|
|
@@ -18696,12 +18723,12 @@ async function startHealthWorker(options = {}) {
|
|
|
18696
18723
|
stdout: false,
|
|
18697
18724
|
stderr: false
|
|
18698
18725
|
});
|
|
18699
|
-
await new Promise((
|
|
18726
|
+
await new Promise((resolve13, reject) => {
|
|
18700
18727
|
const onMessage = (msg) => {
|
|
18701
18728
|
if (msg?.type === "listening") {
|
|
18702
18729
|
worker.off("error", onError);
|
|
18703
18730
|
worker.off("message", onMessage);
|
|
18704
|
-
|
|
18731
|
+
resolve13();
|
|
18705
18732
|
} else if (msg?.type === "listen-error") {
|
|
18706
18733
|
worker.off("error", onError);
|
|
18707
18734
|
worker.off("message", onMessage);
|
|
@@ -19366,7 +19393,7 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
19366
19393
|
function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
19367
19394
|
const { input, cleanupProjectDir } = prepared;
|
|
19368
19395
|
const serverNamed = input.outputPath == null;
|
|
19369
|
-
const outputCandidate = input.outputPath ?? join40(rendersDir, `${basename8(
|
|
19396
|
+
const outputCandidate = input.outputPath ?? join40(rendersDir, `${basename8(resolve12(input.projectDir))}-${crypto.randomUUID()}.mp4`);
|
|
19370
19397
|
const absoluteOutputPath = resolveOutputPath(input.projectDir, outputCandidate, rendersDir, log);
|
|
19371
19398
|
const outputDir = dirname20(absoluteOutputPath);
|
|
19372
19399
|
if (confineOutput) {
|
|
@@ -19388,7 +19415,7 @@ var STICKY_BIT = 512;
|
|
|
19388
19415
|
var SERVER_FOLDER_MODE = 493;
|
|
19389
19416
|
function folderAnotherAccountCanChange(dir, rendersDir) {
|
|
19390
19417
|
const foreign = foreignWritablePath(dir, rendersDir);
|
|
19391
|
-
const stickyRoot = foreign ===
|
|
19418
|
+
const stickyRoot = foreign === resolve12(rendersDir) && (lstatSync4(foreign).mode & STICKY_BIT) !== 0;
|
|
19392
19419
|
return stickyRoot ? void 0 : foreign;
|
|
19393
19420
|
}
|
|
19394
19421
|
function prepareRenderJob(prepared, rendersDir, log, confineOutput) {
|
|
@@ -19449,7 +19476,7 @@ function validateOutputResolutionOverride(body) {
|
|
|
19449
19476
|
var MAX_PREVIEW_HTML_BYTES = 20 * 1024 * 1024;
|
|
19450
19477
|
function resolveRenderRequestPolicy(options) {
|
|
19451
19478
|
return {
|
|
19452
|
-
projectsDir:
|
|
19479
|
+
projectsDir: resolve12(
|
|
19453
19480
|
options.projectsDir ?? (process.env.PRODUCER_PROJECTS_DIR || process.cwd())
|
|
19454
19481
|
),
|
|
19455
19482
|
allowDebug: options.allowDebug ?? process.env.PRODUCER_ALLOW_DEBUG === "1"
|
|
@@ -19464,13 +19491,13 @@ function isAllowedEntryPath(policy, projectDir, path) {
|
|
|
19464
19491
|
function prepareProjectDirectory(projectDir, options, policy) {
|
|
19465
19492
|
const candidate = nonEmptyString(projectDir);
|
|
19466
19493
|
if (!candidate) return null;
|
|
19467
|
-
const absProjectDir = policy ?
|
|
19494
|
+
const absProjectDir = policy ? resolve12(policy.projectsDir, candidate) : resolve12(candidate);
|
|
19468
19495
|
const shown = policy ? candidate : absProjectDir;
|
|
19469
19496
|
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync26(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
|
|
19470
19497
|
return { error: `Project directory not found: ${shown}` };
|
|
19471
19498
|
}
|
|
19472
19499
|
const entry = options.entryFile || "index.html";
|
|
19473
|
-
const entryPath =
|
|
19500
|
+
const entryPath = resolve12(absProjectDir, entry);
|
|
19474
19501
|
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !existsSync26(entryPath)) {
|
|
19475
19502
|
return { error: `Entry file "${entry}" not found in project directory: ${shown}` };
|
|
19476
19503
|
}
|
|
@@ -19521,7 +19548,7 @@ function resolveOutputPath(projectDir, outputCandidate, rendersDir, log) {
|
|
|
19521
19548
|
try {
|
|
19522
19549
|
return resolveRenderPaths(projectDir, outputCandidate, rendersDir).absoluteOutputPath;
|
|
19523
19550
|
} catch (error) {
|
|
19524
|
-
const fallbackPath =
|
|
19551
|
+
const fallbackPath = resolve12(rendersDir, `producer-fallback-${Date.now()}.mp4`);
|
|
19525
19552
|
log.warn("Failed to resolve output path, using fallback", {
|
|
19526
19553
|
fallback: fallbackPath,
|
|
19527
19554
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -19728,7 +19755,7 @@ function createRenderHandlers(options = {}) {
|
|
|
19728
19755
|
const lintProjectDir = nonEmptyString(body.projectDir);
|
|
19729
19756
|
let isAllowedEntry;
|
|
19730
19757
|
if (policy && lintProjectDir) {
|
|
19731
|
-
const absProjectDir =
|
|
19758
|
+
const absProjectDir = resolve12(policy.projectsDir, lintProjectDir);
|
|
19732
19759
|
if (!isAllowedProjectPath(policy.projectsDir, absProjectDir)) {
|
|
19733
19760
|
const error = `Project directory not found: ${lintProjectDir}`;
|
|
19734
19761
|
return c.json({ success: false, requestId, error }, 400);
|
|
@@ -20082,7 +20109,7 @@ function serverAuth(options, hostname2, port) {
|
|
|
20082
20109
|
`Refusing to listen on ${hostname2} without an auth token. Set authToken or PRODUCER_AUTH_TOKEN, or listen on a loopback address.`
|
|
20083
20110
|
);
|
|
20084
20111
|
}
|
|
20085
|
-
const file =
|
|
20112
|
+
const file = resolve12(
|
|
20086
20113
|
options.authTokenFile?.trim() || process.env.PRODUCER_AUTH_TOKEN_FILE?.trim() || join40(homedir(), ".hyperframes", "producer", `${port}.token`)
|
|
20087
20114
|
);
|
|
20088
20115
|
const token = crypto.randomBytes(32).toString("base64url");
|
|
@@ -20142,7 +20169,7 @@ function startServer(options = {}) {
|
|
|
20142
20169
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
20143
20170
|
return server;
|
|
20144
20171
|
}
|
|
20145
|
-
var entryScript = process.argv[1] ?
|
|
20172
|
+
var entryScript = process.argv[1] ? resolve12(process.argv[1]) : "";
|
|
20146
20173
|
var isPublicServerEntry = entryScript.endsWith("/public-server.js") || entryScript.endsWith("/src/server.ts");
|
|
20147
20174
|
if (isPublicServerEntry) {
|
|
20148
20175
|
const { values } = parseArgs({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.95",
|
|
4
4
|
"description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"postcss": "^8.4.0",
|
|
36
36
|
"puppeteer": "~25.13.0",
|
|
37
37
|
"puppeteer-core": "^25.13.0",
|
|
38
|
-
"@hyperframes/
|
|
39
|
-
"@hyperframes/
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/studio-server": "0.9.
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/core": "0.9.95",
|
|
39
|
+
"@hyperframes/engine": "0.9.95",
|
|
40
|
+
"@hyperframes/lint": "0.9.95",
|
|
41
|
+
"@hyperframes/studio-server": "0.9.95",
|
|
42
|
+
"@hyperframes/parsers": "0.9.95"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.10",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsx": "^4.21.0",
|
|
49
49
|
"typescript": "^5.7.2",
|
|
50
50
|
"vitest": "^4.1.12",
|
|
51
|
-
"@hyperframes/aws-lambda": "0.9.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.95"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|