@hyperframes/producer 0.9.94 → 0.9.96
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 +49 -30
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/index.js +89 -57
- package/dist/public-server.js +80 -48
- 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";
|
|
@@ -411,7 +412,11 @@ import { fileURLToPath as fileURLToPath5 } from "url";
|
|
|
411
412
|
// src/services/fileServer.ts
|
|
412
413
|
import { Hono } from "hono";
|
|
413
414
|
import { serve } from "@hono/node-server";
|
|
414
|
-
import {
|
|
415
|
+
import {
|
|
416
|
+
answerOwnLoopbackHostOnly,
|
|
417
|
+
boundedPageText,
|
|
418
|
+
settleOnBrowserSafePort
|
|
419
|
+
} from "@hyperframes/engine";
|
|
415
420
|
import {
|
|
416
421
|
existsSync as existsSync2,
|
|
417
422
|
realpathSync,
|
|
@@ -1171,12 +1176,13 @@ function closeFileServerSafely(fileServer, label, log = defaultLogger) {
|
|
|
1171
1176
|
});
|
|
1172
1177
|
}
|
|
1173
1178
|
}
|
|
1179
|
+
var NO_FILE_AT_NAME = /* @__PURE__ */ new Set(["ENOENT", "ENOTDIR", "ENAMETOOLONG"]);
|
|
1174
1180
|
function openRegularFile(filePath) {
|
|
1175
1181
|
let fd;
|
|
1176
1182
|
try {
|
|
1177
1183
|
fd = openSync(filePath, constants.O_RDONLY | constants.O_NONBLOCK);
|
|
1178
1184
|
} catch (error) {
|
|
1179
|
-
if (error instanceof Error && "code" in error && (error.code
|
|
1185
|
+
if (error instanceof Error && "code" in error && NO_FILE_AT_NAME.has(String(error.code)))
|
|
1180
1186
|
return null;
|
|
1181
1187
|
if (!statSync2(filePath, { throwIfNoEntry: false })?.isFile()) return null;
|
|
1182
1188
|
throw error;
|
|
@@ -1239,7 +1245,7 @@ function createFileServer(options) {
|
|
|
1239
1245
|
}
|
|
1240
1246
|
if (!file) {
|
|
1241
1247
|
if (!/favicon\.ico$/i.test(requestPath)) {
|
|
1242
|
-
console.warn(`[FileServer] 404 Not Found: ${terminalText2(requestPath)}`);
|
|
1248
|
+
console.warn(`[FileServer] 404 Not Found: ${terminalText2(boundedPageText(requestPath))}`);
|
|
1243
1249
|
}
|
|
1244
1250
|
return c.text("Not found", 404);
|
|
1245
1251
|
}
|
|
@@ -1313,13 +1319,13 @@ function createFileServer(options) {
|
|
|
1313
1319
|
if (!streamOwnsFd) closeSync(fd);
|
|
1314
1320
|
}
|
|
1315
1321
|
});
|
|
1316
|
-
return new Promise((
|
|
1322
|
+
return new Promise((resolve13, reject) => {
|
|
1317
1323
|
const connections = /* @__PURE__ */ new Set();
|
|
1318
1324
|
const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
|
|
1319
1325
|
const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
|
|
1320
1326
|
bound.then((boundPort) => {
|
|
1321
1327
|
listeningPort = boundPort;
|
|
1322
|
-
|
|
1328
|
+
resolve13({
|
|
1323
1329
|
url: `http://localhost:${boundPort}`,
|
|
1324
1330
|
port: boundPort,
|
|
1325
1331
|
addPreHeadScript: (script) => {
|
|
@@ -2007,8 +2013,8 @@ var OrderedRenderEventPublisher = class {
|
|
|
2007
2013
|
let timer;
|
|
2008
2014
|
const drained = await Promise.race([
|
|
2009
2015
|
this.tail.then(() => true),
|
|
2010
|
-
new Promise((
|
|
2011
|
-
timer = setTimeout(() =>
|
|
2016
|
+
new Promise((resolve13) => {
|
|
2017
|
+
timer = setTimeout(() => resolve13(false), FLUSH_TIMEOUT_MS);
|
|
2012
2018
|
})
|
|
2013
2019
|
]);
|
|
2014
2020
|
clearTimeout(timer);
|
|
@@ -2683,6 +2689,7 @@ import {
|
|
|
2683
2689
|
concatVideoFiles,
|
|
2684
2690
|
createCaptureSession as createCaptureSession2,
|
|
2685
2691
|
getCapturePerfSummary as getCapturePerfSummary2,
|
|
2692
|
+
retainCapturePerf as retainCapturePerf3,
|
|
2686
2693
|
initializeSession as initializeSession2,
|
|
2687
2694
|
prepareCaptureSessionForReuse as prepareCaptureSessionForReuse2,
|
|
2688
2695
|
resolveDeVerifyMinDb as resolveDeVerifyMinDb2,
|
|
@@ -2696,7 +2703,7 @@ import { CaptureFailure, classifyCaptureFailure } from "@hyperframes/engine";
|
|
|
2696
2703
|
// src/services/render/perfSummary.ts
|
|
2697
2704
|
import { arch, platform, totalmem } from "node:os";
|
|
2698
2705
|
import { fpsToNumber as fpsToNumber2 } from "@hyperframes/core";
|
|
2699
|
-
import { hostCpuCount } from "@hyperframes/engine";
|
|
2706
|
+
import { hostCpuCount, retainCapturePerf } from "@hyperframes/engine";
|
|
2700
2707
|
|
|
2701
2708
|
// src/services/render/hdrPerf.ts
|
|
2702
2709
|
function createHdrPerfCollector() {
|
|
@@ -2812,7 +2819,7 @@ function worstSubTimelineWaitOutcome(perfs) {
|
|
|
2812
2819
|
}
|
|
2813
2820
|
function pushWorkerDedupPerfs(results, sink) {
|
|
2814
2821
|
for (const r of results) {
|
|
2815
|
-
if (r.perf) sink
|
|
2822
|
+
if (r.perf) retainCapturePerf(sink, r.perf);
|
|
2816
2823
|
}
|
|
2817
2824
|
}
|
|
2818
2825
|
function capturedBeyondViewport(perfs, fallback) {
|
|
@@ -4650,6 +4657,7 @@ import {
|
|
|
4650
4657
|
distributeFramesInterleaved,
|
|
4651
4658
|
executeParallelCapture,
|
|
4652
4659
|
getCapturePerfSummary,
|
|
4660
|
+
retainCapturePerf as retainCapturePerf2,
|
|
4653
4661
|
psnrDb,
|
|
4654
4662
|
resolveDeVerifyMinDb,
|
|
4655
4663
|
recaptureDrawElementFrameForVerify,
|
|
@@ -4731,7 +4739,7 @@ var SequentialCaptureStallError = class extends Error {
|
|
|
4731
4739
|
}
|
|
4732
4740
|
};
|
|
4733
4741
|
function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
4734
|
-
return new Promise((
|
|
4742
|
+
return new Promise((resolve13, reject) => {
|
|
4735
4743
|
const clock = createStallClock();
|
|
4736
4744
|
const trip = () => reject(
|
|
4737
4745
|
signal?.aborted ? new Error(
|
|
@@ -4756,7 +4764,7 @@ function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
|
4756
4764
|
promise.then(
|
|
4757
4765
|
(value) => {
|
|
4758
4766
|
clearTimeout(timer);
|
|
4759
|
-
|
|
4767
|
+
resolve13(value);
|
|
4760
4768
|
},
|
|
4761
4769
|
(error) => {
|
|
4762
4770
|
clearTimeout(timer);
|
|
@@ -5378,7 +5386,7 @@ async function runCaptureStreamingStage(input) {
|
|
|
5378
5386
|
);
|
|
5379
5387
|
}
|
|
5380
5388
|
}
|
|
5381
|
-
dedupPerfs
|
|
5389
|
+
retainCapturePerf2(dedupPerfs, getCapturePerfSummary(session));
|
|
5382
5390
|
} catch (error) {
|
|
5383
5391
|
lastBrowserConsole = session.browserConsoleBuffer;
|
|
5384
5392
|
if (!resumesAfterStall(error, abortSignal, resume, resumes)) {
|
|
@@ -5678,7 +5686,7 @@ async function openSegmentWorkersTogether(run, workersToCloseLater) {
|
|
|
5678
5686
|
if (failure && failure.status === "rejected") throw failure.reason;
|
|
5679
5687
|
}
|
|
5680
5688
|
async function recycleWorkerSession(run, worker, why) {
|
|
5681
|
-
run.input.dedupPerfs
|
|
5689
|
+
retainCapturePerf3(run.input.dedupPerfs, getCapturePerfSummary2(worker.ctx.session));
|
|
5682
5690
|
const memory = worker.ctx.session.chromeMemory?.stats();
|
|
5683
5691
|
await run.deps.closeSession(worker.ctx.session);
|
|
5684
5692
|
const { frames } = worker.ctx;
|
|
@@ -5807,7 +5815,8 @@ async function runCaptureSegmentedStage(input) {
|
|
|
5807
5815
|
assertNotAborted();
|
|
5808
5816
|
await openSegmentWorkersTogether(run, workers);
|
|
5809
5817
|
const outcomes = await Promise.allSettled(workers.map((w) => runWorkerLoop(w)));
|
|
5810
|
-
for (const worker of workers)
|
|
5818
|
+
for (const worker of workers)
|
|
5819
|
+
retainCapturePerf3(dedupPerfs, getCapturePerfSummary2(worker.ctx.session));
|
|
5811
5820
|
const failure = outcomes.find((o) => o.status === "rejected");
|
|
5812
5821
|
if (failure && failure.status === "rejected") throw failure.reason;
|
|
5813
5822
|
} catch (error) {
|
|
@@ -7266,7 +7275,7 @@ function countAuthoredTimedClips(html) {
|
|
|
7266
7275
|
|
|
7267
7276
|
// src/services/render/stages/compileStage.ts
|
|
7268
7277
|
import { existsSync as existsSync13, writeFileSync as writeFileSync5 } from "node:fs";
|
|
7269
|
-
import { join as join23, relative as relative5 } from "node:path";
|
|
7278
|
+
import { join as join23, relative as relative5, resolve as resolve9 } from "node:path";
|
|
7270
7279
|
import { privateCacheRoot } from "@hyperframes/engine";
|
|
7271
7280
|
import { suggestMatchingPreset } from "@hyperframes/core";
|
|
7272
7281
|
import { extractStandaloneEntryFromIndex, isTemplateEntry } from "@hyperframes/core/compiler";
|
|
@@ -7275,6 +7284,7 @@ import { assertCompositionFileSize as assertCompositionFileSize2 } from "@hyperf
|
|
|
7275
7284
|
|
|
7276
7285
|
// src/services/compileInWorker.ts
|
|
7277
7286
|
import { existsSync as existsSync12, rmSync as rmSync11 } from "node:fs";
|
|
7287
|
+
import { ffmpegCwd } from "@hyperframes/parsers/ff-binaries";
|
|
7278
7288
|
import { dirname as dirname11, isAbsolute as isAbsolute4, join as join22, relative as relative4, resolve as resolvePath } from "node:path";
|
|
7279
7289
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7280
7290
|
import { Worker } from "node:worker_threads";
|
|
@@ -7346,6 +7356,7 @@ import { gsapCdnDist, normalizeGsapBaseUrl } from "@hyperframes/core/gsap-cdn";
|
|
|
7346
7356
|
import {
|
|
7347
7357
|
assignBundledRuntimeCompositionIds,
|
|
7348
7358
|
assignMediaRenderIds,
|
|
7359
|
+
dropAuthoredCompositionFiles,
|
|
7349
7360
|
emitVariablesByCompScript,
|
|
7350
7361
|
inlineSubCompositions as inlineSubCompositionsShared,
|
|
7351
7362
|
ensureExternalLinkTag,
|
|
@@ -8003,10 +8014,10 @@ var Semaphore = class {
|
|
|
8003
8014
|
this.active++;
|
|
8004
8015
|
return () => this.release();
|
|
8005
8016
|
}
|
|
8006
|
-
return new Promise((
|
|
8017
|
+
return new Promise((resolve13) => {
|
|
8007
8018
|
this.queue.push(() => {
|
|
8008
8019
|
this.active++;
|
|
8009
|
-
|
|
8020
|
+
resolve13(() => this.release());
|
|
8010
8021
|
});
|
|
8011
8022
|
});
|
|
8012
8023
|
}
|
|
@@ -8808,7 +8819,7 @@ var AssetDownloads = class {
|
|
|
8808
8819
|
}
|
|
8809
8820
|
async download(url, destDir) {
|
|
8810
8821
|
while (this.running >= ASSET_DOWNLOADS_AT_ONCE) {
|
|
8811
|
-
await new Promise((
|
|
8822
|
+
await new Promise((resolve13) => this.queued.push(resolve13));
|
|
8812
8823
|
}
|
|
8813
8824
|
if (this.signal?.aborted) {
|
|
8814
8825
|
this.queued.shift()?.();
|
|
@@ -9197,6 +9208,7 @@ function coalesceHeadStylesAndBodyScripts(html) {
|
|
|
9197
9208
|
}
|
|
9198
9209
|
function inlineSubCompositions(html, subCompositions, projectDir, variableOverrides, assetRoot, outsideFiles, budget) {
|
|
9199
9210
|
const { document: document2 } = parseHTML5(html);
|
|
9211
|
+
dropAuthoredCompositionFiles(document2);
|
|
9200
9212
|
budget.chargeElements(ENTRY_PAGE, document2.querySelectorAll("*").length);
|
|
9201
9213
|
const head = document2.querySelector("head");
|
|
9202
9214
|
const body = document2.querySelector("body");
|
|
@@ -10724,9 +10736,15 @@ async function compileForRenderInWorker(projectDir, htmlPath, downloadDir, optio
|
|
|
10724
10736
|
if (!entry) return compileForRender(projectDir, htmlPath, downloadDir, options);
|
|
10725
10737
|
abortSignal?.throwIfAborted();
|
|
10726
10738
|
const timeoutMs = worker.timeoutMs ?? compileTimeoutMs();
|
|
10727
|
-
return new Promise((
|
|
10739
|
+
return new Promise((resolve13, reject) => {
|
|
10728
10740
|
const thread = new Worker(entry, {
|
|
10729
|
-
workerData: {
|
|
10741
|
+
workerData: {
|
|
10742
|
+
projectDir,
|
|
10743
|
+
htmlPath,
|
|
10744
|
+
downloadDir,
|
|
10745
|
+
options: cloneable,
|
|
10746
|
+
emptyFolder: ffmpegCwd() !== void 0
|
|
10747
|
+
}
|
|
10730
10748
|
});
|
|
10731
10749
|
const children = /* @__PURE__ */ new Map();
|
|
10732
10750
|
const scratchRoots = [downloadDir, options.animatedGifCacheDir].flatMap(
|
|
@@ -10780,7 +10798,7 @@ async function compileForRenderInWorker(projectDir, htmlPath, downloadDir, optio
|
|
|
10780
10798
|
log?.[message.level](message.message ?? "", message.meta);
|
|
10781
10799
|
} else if (message.type === "result" && message.compiled) {
|
|
10782
10800
|
const { compiled } = message;
|
|
10783
|
-
settle(() =>
|
|
10801
|
+
settle(() => resolve13(compiled));
|
|
10784
10802
|
retire(ADVISORY_GRACE_MS);
|
|
10785
10803
|
} else if (message.type === "error" && message.error) {
|
|
10786
10804
|
const { error } = message;
|
|
@@ -10812,7 +10830,7 @@ async function compileForRenderInWorker(projectDir, htmlPath, downloadDir, optio
|
|
|
10812
10830
|
// src/services/render/stages/compileStage.ts
|
|
10813
10831
|
function animatedGifCacheDir(extractCacheDir) {
|
|
10814
10832
|
try {
|
|
10815
|
-
const root = extractCacheDir && privateCacheRoot(extractCacheDir);
|
|
10833
|
+
const root = extractCacheDir && privateCacheRoot(resolve9(extractCacheDir));
|
|
10816
10834
|
return root ? join23(root, "animated-gif") : void 0;
|
|
10817
10835
|
} catch {
|
|
10818
10836
|
return void 0;
|
|
@@ -12498,7 +12516,7 @@ import {
|
|
|
12498
12516
|
} from "@hyperframes/engine";
|
|
12499
12517
|
|
|
12500
12518
|
// src/services/render/audioPadTrim.ts
|
|
12501
|
-
import { localContainerInputArgs } from "@hyperframes/parsers/ff-binaries";
|
|
12519
|
+
import { ffmpegCwd as ffmpegCwd2, localContainerInputArgs } from "@hyperframes/parsers/ff-binaries";
|
|
12502
12520
|
import { spawn } from "node:child_process";
|
|
12503
12521
|
import { dirname as dirname12, join as join26 } from "node:path";
|
|
12504
12522
|
import {
|
|
@@ -12969,6 +12987,7 @@ async function spawnFfprobeJson(args, env, signal) {
|
|
|
12969
12987
|
const proc = spawn(getFfprobeBinary(), args, {
|
|
12970
12988
|
...env && { env },
|
|
12971
12989
|
stdio: ["ignore", "pipe", "pipe"],
|
|
12990
|
+
cwd: ffmpegCwd2(),
|
|
12972
12991
|
windowsHide: true
|
|
12973
12992
|
});
|
|
12974
12993
|
trackChildProcess(proc);
|
|
@@ -13256,6 +13275,7 @@ import {
|
|
|
13256
13275
|
completeDeferredDrawElementInit as completeDeferredDrawElementInit3,
|
|
13257
13276
|
createCaptureSession as createCaptureSession5,
|
|
13258
13277
|
getCapturePerfSummary as getCapturePerfSummary3,
|
|
13278
|
+
retainCapturePerf as retainCapturePerf4,
|
|
13259
13279
|
initializeSession as initializeSession5,
|
|
13260
13280
|
prepareCaptureSessionForReuse as prepareCaptureSessionForReuse3
|
|
13261
13281
|
} from "@hyperframes/engine";
|
|
@@ -13617,7 +13637,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
13617
13637
|
},
|
|
13618
13638
|
false
|
|
13619
13639
|
);
|
|
13620
|
-
dedupPerfs
|
|
13640
|
+
retainCapturePerf4(dedupPerfs, getCapturePerfSummary3(session));
|
|
13621
13641
|
}
|
|
13622
13642
|
|
|
13623
13643
|
// src/services/render/stages/captureHdrStage.ts
|
|
@@ -14033,8 +14053,8 @@ async function createShaderTransitionWorkerPool(opts) {
|
|
|
14033
14053
|
if (terminated) {
|
|
14034
14054
|
throw new Error("shader-blend pool already terminated");
|
|
14035
14055
|
}
|
|
14036
|
-
return new Promise((
|
|
14037
|
-
const task = traceEnabled ? { req, resolve:
|
|
14056
|
+
return new Promise((resolve13, reject) => {
|
|
14057
|
+
const task = traceEnabled ? { req, resolve: resolve13, reject, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve13, reject };
|
|
14038
14058
|
const idle = slots.find((s) => !s.busy && !s.dead);
|
|
14039
14059
|
if (idle) {
|
|
14040
14060
|
queue.unshift(task);
|
|
@@ -14863,7 +14883,7 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
|
14863
14883
|
const stream = await encoder;
|
|
14864
14884
|
for (let next = 0; next < totalFrames; next++) {
|
|
14865
14885
|
while (!landed.has(next) && !captureDone && !signal.aborted) {
|
|
14866
|
-
await new Promise((
|
|
14886
|
+
await new Promise((resolve13) => wake = resolve13);
|
|
14867
14887
|
}
|
|
14868
14888
|
if (signal.aborted) return;
|
|
14869
14889
|
const mergedPath = join34(input.framesDir, formatCaptureFrameName(next, "jpg"));
|
|
@@ -16155,10 +16175,22 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
16155
16175
|
};
|
|
16156
16176
|
}
|
|
16157
16177
|
function resolveRenderDebugDir() {
|
|
16158
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ?
|
|
16178
|
+
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve10(process.env.PRODUCER_RENDERS_DIR, "..") : resolve10(dirname16(fileURLToPath5(import.meta.url)), "../..");
|
|
16159
16179
|
return join35(producerRoot, ".debug");
|
|
16160
16180
|
}
|
|
16161
|
-
|
|
16181
|
+
function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
16182
|
+
return fromEmptyFolder(
|
|
16183
|
+
() => renderJob(
|
|
16184
|
+
job,
|
|
16185
|
+
resolve10(projectDir),
|
|
16186
|
+
resolve10(outputPath),
|
|
16187
|
+
progressSink,
|
|
16188
|
+
abortSignal,
|
|
16189
|
+
assertRenderActive
|
|
16190
|
+
)
|
|
16191
|
+
);
|
|
16192
|
+
}
|
|
16193
|
+
async function renderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
16162
16194
|
validateHlsRenderConfig(job.config);
|
|
16163
16195
|
validateDeliveryEncoderConfig(job.config);
|
|
16164
16196
|
validateChromaSubsamplingConfig(job.config);
|
|
@@ -18465,7 +18497,7 @@ import {
|
|
|
18465
18497
|
closeSync as closeSync6,
|
|
18466
18498
|
constants as constants4
|
|
18467
18499
|
} from "node:fs";
|
|
18468
|
-
import { resolve as
|
|
18500
|
+
import { resolve as resolve11, join as join36, relative as relative6, isAbsolute as isAbsolute5, sep as sep5, dirname as dirname17 } from "node:path";
|
|
18469
18501
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
18470
18502
|
import { Worker as Worker3 } from "node:worker_threads";
|
|
18471
18503
|
function isStringRecord(value) {
|
|
@@ -18515,7 +18547,7 @@ function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
|
|
|
18515
18547
|
return entryRelativePath === ".." || entryRelativePath.startsWith(`..${sep5}`) || isAbsolute5(entryRelativePath) || isAllowedEntry !== void 0 && !isAllowedEntry(absoluteEntryPath);
|
|
18516
18548
|
}
|
|
18517
18549
|
function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
18518
|
-
const absProjectDir =
|
|
18550
|
+
const absProjectDir = resolve11(projectDir);
|
|
18519
18551
|
if (!existsSync23(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
|
|
18520
18552
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
18521
18553
|
}
|
|
@@ -18523,7 +18555,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
|
18523
18555
|
(value) => typeof value === "string" && value.trim().length > 0
|
|
18524
18556
|
);
|
|
18525
18557
|
for (const entryFile of entryCandidates) {
|
|
18526
|
-
const absoluteEntryPath =
|
|
18558
|
+
const absoluteEntryPath = resolve11(absProjectDir, entryFile);
|
|
18527
18559
|
if (leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry)) {
|
|
18528
18560
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
18529
18561
|
}
|
|
@@ -18583,16 +18615,16 @@ function takeLintSlot(limit, waitMs) {
|
|
|
18583
18615
|
running++;
|
|
18584
18616
|
return Promise.resolve(true);
|
|
18585
18617
|
}
|
|
18586
|
-
return new Promise((
|
|
18618
|
+
return new Promise((resolve13) => {
|
|
18587
18619
|
const entry = () => {
|
|
18588
18620
|
clearTimeout(timer);
|
|
18589
18621
|
running++;
|
|
18590
|
-
|
|
18622
|
+
resolve13(true);
|
|
18591
18623
|
};
|
|
18592
18624
|
const timer = setTimeout(
|
|
18593
18625
|
() => {
|
|
18594
18626
|
waiting.splice(waiting.indexOf(entry), 1);
|
|
18595
|
-
|
|
18627
|
+
resolve13(false);
|
|
18596
18628
|
},
|
|
18597
18629
|
Math.max(0, waitMs)
|
|
18598
18630
|
);
|
|
@@ -18696,12 +18728,12 @@ async function startHealthWorker(options = {}) {
|
|
|
18696
18728
|
stdout: false,
|
|
18697
18729
|
stderr: false
|
|
18698
18730
|
});
|
|
18699
|
-
await new Promise((
|
|
18731
|
+
await new Promise((resolve13, reject) => {
|
|
18700
18732
|
const onMessage = (msg) => {
|
|
18701
18733
|
if (msg?.type === "listening") {
|
|
18702
18734
|
worker.off("error", onError);
|
|
18703
18735
|
worker.off("message", onMessage);
|
|
18704
|
-
|
|
18736
|
+
resolve13();
|
|
18705
18737
|
} else if (msg?.type === "listen-error") {
|
|
18706
18738
|
worker.off("error", onError);
|
|
18707
18739
|
worker.off("message", onMessage);
|
|
@@ -19366,7 +19398,7 @@ function buildRenderJobConfig(input, outputPath, log) {
|
|
|
19366
19398
|
function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
19367
19399
|
const { input, cleanupProjectDir } = prepared;
|
|
19368
19400
|
const serverNamed = input.outputPath == null;
|
|
19369
|
-
const outputCandidate = input.outputPath ?? join40(rendersDir, `${basename8(
|
|
19401
|
+
const outputCandidate = input.outputPath ?? join40(rendersDir, `${basename8(resolve12(input.projectDir))}-${crypto.randomUUID()}.mp4`);
|
|
19370
19402
|
const absoluteOutputPath = resolveOutputPath(input.projectDir, outputCandidate, rendersDir, log);
|
|
19371
19403
|
const outputDir = dirname20(absoluteOutputPath);
|
|
19372
19404
|
if (confineOutput) {
|
|
@@ -19388,7 +19420,7 @@ var STICKY_BIT = 512;
|
|
|
19388
19420
|
var SERVER_FOLDER_MODE = 493;
|
|
19389
19421
|
function folderAnotherAccountCanChange(dir, rendersDir) {
|
|
19390
19422
|
const foreign = foreignWritablePath(dir, rendersDir);
|
|
19391
|
-
const stickyRoot = foreign ===
|
|
19423
|
+
const stickyRoot = foreign === resolve12(rendersDir) && (lstatSync4(foreign).mode & STICKY_BIT) !== 0;
|
|
19392
19424
|
return stickyRoot ? void 0 : foreign;
|
|
19393
19425
|
}
|
|
19394
19426
|
function prepareRenderJob(prepared, rendersDir, log, confineOutput) {
|
|
@@ -19449,7 +19481,7 @@ function validateOutputResolutionOverride(body) {
|
|
|
19449
19481
|
var MAX_PREVIEW_HTML_BYTES = 20 * 1024 * 1024;
|
|
19450
19482
|
function resolveRenderRequestPolicy(options) {
|
|
19451
19483
|
return {
|
|
19452
|
-
projectsDir:
|
|
19484
|
+
projectsDir: resolve12(
|
|
19453
19485
|
options.projectsDir ?? (process.env.PRODUCER_PROJECTS_DIR || process.cwd())
|
|
19454
19486
|
),
|
|
19455
19487
|
allowDebug: options.allowDebug ?? process.env.PRODUCER_ALLOW_DEBUG === "1"
|
|
@@ -19464,13 +19496,13 @@ function isAllowedEntryPath(policy, projectDir, path) {
|
|
|
19464
19496
|
function prepareProjectDirectory(projectDir, options, policy) {
|
|
19465
19497
|
const candidate = nonEmptyString(projectDir);
|
|
19466
19498
|
if (!candidate) return null;
|
|
19467
|
-
const absProjectDir = policy ?
|
|
19499
|
+
const absProjectDir = policy ? resolve12(policy.projectsDir, candidate) : resolve12(candidate);
|
|
19468
19500
|
const shown = policy ? candidate : absProjectDir;
|
|
19469
19501
|
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync26(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
|
|
19470
19502
|
return { error: `Project directory not found: ${shown}` };
|
|
19471
19503
|
}
|
|
19472
19504
|
const entry = options.entryFile || "index.html";
|
|
19473
|
-
const entryPath =
|
|
19505
|
+
const entryPath = resolve12(absProjectDir, entry);
|
|
19474
19506
|
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !existsSync26(entryPath)) {
|
|
19475
19507
|
return { error: `Entry file "${entry}" not found in project directory: ${shown}` };
|
|
19476
19508
|
}
|
|
@@ -19521,7 +19553,7 @@ function resolveOutputPath(projectDir, outputCandidate, rendersDir, log) {
|
|
|
19521
19553
|
try {
|
|
19522
19554
|
return resolveRenderPaths(projectDir, outputCandidate, rendersDir).absoluteOutputPath;
|
|
19523
19555
|
} catch (error) {
|
|
19524
|
-
const fallbackPath =
|
|
19556
|
+
const fallbackPath = resolve12(rendersDir, `producer-fallback-${Date.now()}.mp4`);
|
|
19525
19557
|
log.warn("Failed to resolve output path, using fallback", {
|
|
19526
19558
|
fallback: fallbackPath,
|
|
19527
19559
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -19728,7 +19760,7 @@ function createRenderHandlers(options = {}) {
|
|
|
19728
19760
|
const lintProjectDir = nonEmptyString(body.projectDir);
|
|
19729
19761
|
let isAllowedEntry;
|
|
19730
19762
|
if (policy && lintProjectDir) {
|
|
19731
|
-
const absProjectDir =
|
|
19763
|
+
const absProjectDir = resolve12(policy.projectsDir, lintProjectDir);
|
|
19732
19764
|
if (!isAllowedProjectPath(policy.projectsDir, absProjectDir)) {
|
|
19733
19765
|
const error = `Project directory not found: ${lintProjectDir}`;
|
|
19734
19766
|
return c.json({ success: false, requestId, error }, 400);
|
|
@@ -20082,7 +20114,7 @@ function serverAuth(options, hostname2, port) {
|
|
|
20082
20114
|
`Refusing to listen on ${hostname2} without an auth token. Set authToken or PRODUCER_AUTH_TOKEN, or listen on a loopback address.`
|
|
20083
20115
|
);
|
|
20084
20116
|
}
|
|
20085
|
-
const file =
|
|
20117
|
+
const file = resolve12(
|
|
20086
20118
|
options.authTokenFile?.trim() || process.env.PRODUCER_AUTH_TOKEN_FILE?.trim() || join40(homedir(), ".hyperframes", "producer", `${port}.token`)
|
|
20087
20119
|
);
|
|
20088
20120
|
const token = crypto.randomBytes(32).toString("base64url");
|
|
@@ -20142,7 +20174,7 @@ function startServer(options = {}) {
|
|
|
20142
20174
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
20143
20175
|
return server;
|
|
20144
20176
|
}
|
|
20145
|
-
var entryScript = process.argv[1] ?
|
|
20177
|
+
var entryScript = process.argv[1] ? resolve12(process.argv[1]) : "";
|
|
20146
20178
|
var isPublicServerEntry = entryScript.endsWith("/public-server.js") || entryScript.endsWith("/src/server.ts");
|
|
20147
20179
|
if (isPublicServerEntry) {
|
|
20148
20180
|
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.96",
|
|
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/
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/core": "0.9.96",
|
|
39
|
+
"@hyperframes/engine": "0.9.96",
|
|
40
|
+
"@hyperframes/parsers": "0.9.96",
|
|
41
|
+
"@hyperframes/lint": "0.9.96",
|
|
42
|
+
"@hyperframes/studio-server": "0.9.96"
|
|
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.96"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|