@hyperframes/producer 0.9.58 → 0.9.59
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 +35 -10
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -64
- package/dist/hyperframeLintWorker.js +9 -0
- package/dist/index.js +176 -30
- package/dist/public-server.js +176 -30
- package/dist/services/htmlCompiler.d.ts +1 -0
- package/dist/services/hyperframeLint.d.ts +8 -2
- package/dist/services/hyperframeLintWorker.d.ts +1 -0
- package/dist/services/render/shared.d.ts +7 -0
- package/dist/services/render/stages/audioStage.d.ts +1 -0
- package/dist/services/render/stages/probeStage.d.ts +4 -2
- package/package.json +7 -7
package/dist/public-server.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
rmSync as rmSync13,
|
|
11
11
|
createReadStream as createReadStream3
|
|
12
12
|
} from "node:fs";
|
|
13
|
-
import { resolve as resolve10, dirname as
|
|
13
|
+
import { resolve as resolve10, dirname as dirname18, join as join37 } from "node:path";
|
|
14
14
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
15
15
|
import { parseArgs } from "node:util";
|
|
16
16
|
import { isIP } from "node:net";
|
|
@@ -1596,6 +1596,30 @@ function reportEncodeProgress(job, done, total, onProgress, from) {
|
|
|
1596
1596
|
"encoding"
|
|
1597
1597
|
);
|
|
1598
1598
|
}
|
|
1599
|
+
var AUDIO_STAGE = "Processing audio tracks";
|
|
1600
|
+
var AUDIO_WAIT_REPORT_MS = 5e3;
|
|
1601
|
+
function audioWaitReporter(job, onProgress) {
|
|
1602
|
+
let waiting2 = false;
|
|
1603
|
+
let reportedAt = -Infinity;
|
|
1604
|
+
return {
|
|
1605
|
+
progressed() {
|
|
1606
|
+
const now = Date.now();
|
|
1607
|
+
if (!waiting2 || now - reportedAt < AUDIO_WAIT_REPORT_MS) return;
|
|
1608
|
+
reportedAt = now;
|
|
1609
|
+
updateJobStatus(job, job.status, AUDIO_STAGE, job.progress, onProgress, {
|
|
1610
|
+
code: "process_audio"
|
|
1611
|
+
});
|
|
1612
|
+
},
|
|
1613
|
+
async wait(audio) {
|
|
1614
|
+
waiting2 = true;
|
|
1615
|
+
try {
|
|
1616
|
+
return await audio;
|
|
1617
|
+
} finally {
|
|
1618
|
+
waiting2 = false;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1599
1623
|
var lastAssembleReportAt = /* @__PURE__ */ new WeakMap();
|
|
1600
1624
|
function reportAssembleProgress(job, done, total, onProgress) {
|
|
1601
1625
|
if (total <= 0) return;
|
|
@@ -8526,7 +8550,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
8526
8550
|
{},
|
|
8527
8551
|
variableOverrides
|
|
8528
8552
|
);
|
|
8529
|
-
return emitted ? document2.toString() : html;
|
|
8553
|
+
return { html: emitted ? document2.toString() : html, variablesByComp: {} };
|
|
8530
8554
|
}
|
|
8531
8555
|
const hostIdentityByElement = new ProducerHostIdentityMap(
|
|
8532
8556
|
document2,
|
|
@@ -8640,7 +8664,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
|
|
|
8640
8664
|
variableOverrides
|
|
8641
8665
|
);
|
|
8642
8666
|
assignMediaRenderIds(document2);
|
|
8643
|
-
return document2.toString();
|
|
8667
|
+
return { html: document2.toString(), variablesByComp: result.variablesByComp };
|
|
8644
8668
|
}
|
|
8645
8669
|
function ensureFullDocument(html) {
|
|
8646
8670
|
const trimmed = html.trim();
|
|
@@ -9234,7 +9258,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9234
9258
|
assetRoot
|
|
9235
9259
|
);
|
|
9236
9260
|
const fullHtml = ensureFullDocument(compiledHtml);
|
|
9237
|
-
const inlinedHtml = inlineSubCompositions(
|
|
9261
|
+
const { html: inlinedHtml, variablesByComp } = inlineSubCompositions(
|
|
9238
9262
|
fullHtml,
|
|
9239
9263
|
subCompositions,
|
|
9240
9264
|
projectDir,
|
|
@@ -9387,6 +9411,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
9387
9411
|
gradedCanvas,
|
|
9388
9412
|
...masterFxChain ? { masterFxChain } : {},
|
|
9389
9413
|
unresolvedCompositions,
|
|
9414
|
+
variablesByComp,
|
|
9390
9415
|
externalAssets,
|
|
9391
9416
|
width,
|
|
9392
9417
|
height,
|
|
@@ -10029,15 +10054,22 @@ function hasAutoStartVideos(html) {
|
|
|
10029
10054
|
const { document: document2 } = parseHTML6(html);
|
|
10030
10055
|
return document2.querySelector("video[data-hf-auto-start]") !== null;
|
|
10031
10056
|
}
|
|
10032
|
-
function
|
|
10057
|
+
function scopedVariablesFor(element, variablesByComp) {
|
|
10058
|
+
const scope = element.closest("[data-composition-id]");
|
|
10059
|
+
const compId = scope?.getAttribute("data-composition-id")?.trim() ?? "";
|
|
10060
|
+
return compId && Object.hasOwn(variablesByComp, compId) ? variablesByComp[compId] : void 0;
|
|
10061
|
+
}
|
|
10062
|
+
function variableHasValue(element, variableId, variables, variablesByComp) {
|
|
10033
10063
|
if (variables && Object.hasOwn(variables, variableId)) return true;
|
|
10064
|
+
const scoped = scopedVariablesFor(element, variablesByComp);
|
|
10065
|
+
if (scoped) return Object.hasOwn(scoped, variableId);
|
|
10034
10066
|
for (let scope = element.parentElement; scope; scope = scope.parentElement) {
|
|
10035
10067
|
if (Object.hasOwn(parseHostVariableValues2(scope), variableId)) return true;
|
|
10036
10068
|
if (Object.hasOwn(readDeclaredDefaults2(scope), variableId)) return true;
|
|
10037
10069
|
}
|
|
10038
10070
|
return Object.hasOwn(readDeclaredDefaults2(element.ownerDocument.documentElement), variableId);
|
|
10039
10071
|
}
|
|
10040
|
-
function hasVariableBoundMedia(html, variables) {
|
|
10072
|
+
function hasVariableBoundMedia(html, variables, variablesByComp = {}) {
|
|
10041
10073
|
const { document: document2 } = parseHTML6(html);
|
|
10042
10074
|
return Array.from(
|
|
10043
10075
|
document2.querySelectorAll(
|
|
@@ -10045,7 +10077,7 @@ function hasVariableBoundMedia(html, variables) {
|
|
|
10045
10077
|
)
|
|
10046
10078
|
).some((element) => {
|
|
10047
10079
|
const variableId = element.getAttribute("data-var-src")?.trim();
|
|
10048
|
-
return Boolean(variableId && variableHasValue(element, variableId, variables));
|
|
10080
|
+
return Boolean(variableId && variableHasValue(element, variableId, variables, variablesByComp));
|
|
10049
10081
|
});
|
|
10050
10082
|
}
|
|
10051
10083
|
function authoredMediaStarts(html) {
|
|
@@ -10160,7 +10192,11 @@ async function runProbeStage(input) {
|
|
|
10160
10192
|
compiled.html,
|
|
10161
10193
|
composition.audios.length
|
|
10162
10194
|
);
|
|
10163
|
-
const hasVariableMedia = hasVariableBoundMedia(
|
|
10195
|
+
const hasVariableMedia = hasVariableBoundMedia(
|
|
10196
|
+
compiled.html,
|
|
10197
|
+
job.config.variables,
|
|
10198
|
+
compiled.variablesByComp
|
|
10199
|
+
);
|
|
10164
10200
|
const hasInsertedMedia = hasRuntimeMediaChanges(compiled.html);
|
|
10165
10201
|
const needsBrowser = cfg.videoLayerPassthrough || input.measuresShownBoxes === true || probeRequiresBrowser({
|
|
10166
10202
|
durationSeconds: composition.duration,
|
|
@@ -11271,7 +11307,8 @@ import {
|
|
|
11271
11307
|
audioFailureDiagnostics,
|
|
11272
11308
|
processCompositionAudio,
|
|
11273
11309
|
removeScratch as removeScratch2,
|
|
11274
|
-
collectScratchLeftovers
|
|
11310
|
+
collectScratchLeftovers,
|
|
11311
|
+
withFfmpegProgress
|
|
11275
11312
|
} from "@hyperframes/engine";
|
|
11276
11313
|
|
|
11277
11314
|
// src/services/render/audioDeliveryLimit.ts
|
|
@@ -11297,7 +11334,8 @@ import {
|
|
|
11297
11334
|
removeScratch,
|
|
11298
11335
|
renameWithRetry as renameWithRetry5,
|
|
11299
11336
|
runFfmpeg as runFfmpeg5,
|
|
11300
|
-
trackChildProcess
|
|
11337
|
+
trackChildProcess,
|
|
11338
|
+
withPublicOnlyProxy
|
|
11301
11339
|
} from "@hyperframes/engine";
|
|
11302
11340
|
import { redactKnownPaths, redactTelemetryString as redactTelemetryString3 } from "@hyperframes/core";
|
|
11303
11341
|
|
|
@@ -11739,7 +11777,17 @@ async function runFfprobeJson(args, signal) {
|
|
|
11739
11777
|
if (!args.includes("--")) {
|
|
11740
11778
|
throw new Error('[audioPadTrim] ffprobe args must terminate options with "--".');
|
|
11741
11779
|
}
|
|
11780
|
+
const proxying = withPublicOnlyProxy(args, [args.indexOf("--") + 1]);
|
|
11781
|
+
const routed = proxying && await proxying;
|
|
11782
|
+
try {
|
|
11783
|
+
return await spawnFfprobeJson(routed?.args ?? args, routed?.env, signal);
|
|
11784
|
+
} finally {
|
|
11785
|
+
await routed?.close();
|
|
11786
|
+
}
|
|
11787
|
+
}
|
|
11788
|
+
async function spawnFfprobeJson(args, env, signal) {
|
|
11742
11789
|
const proc = spawn(getFfprobeBinary(), args, {
|
|
11790
|
+
...env && { env },
|
|
11743
11791
|
stdio: ["ignore", "pipe", "pipe"],
|
|
11744
11792
|
windowsHide: true
|
|
11745
11793
|
});
|
|
@@ -11855,7 +11903,8 @@ function assertAudioNotInterrupted(failures) {
|
|
|
11855
11903
|
}
|
|
11856
11904
|
function runAudioStage(input) {
|
|
11857
11905
|
return collectScratchLeftovers(
|
|
11858
|
-
() =>
|
|
11906
|
+
() => withFfmpegProgress(input.onFfmpegProgress ?? (() => {
|
|
11907
|
+
}), () => runAudioStageScoped(input)),
|
|
11859
11908
|
(left) => {
|
|
11860
11909
|
if (left.length > 0) input.log?.warn("[audio] scratch left behind", { count: left.length });
|
|
11861
11910
|
}
|
|
@@ -15360,9 +15409,10 @@ async function executeRenderPipeline(input) {
|
|
|
15360
15409
|
nativeHdrVideoCount: nativeHdrVideoIds.size,
|
|
15361
15410
|
nativeHdrImageCount: nativeHdrImageIds.size
|
|
15362
15411
|
});
|
|
15363
|
-
updateJobStatus(job, "preprocessing",
|
|
15412
|
+
updateJobStatus(job, "preprocessing", AUDIO_STAGE, 20, onProgress, {
|
|
15364
15413
|
code: "process_audio"
|
|
15365
15414
|
});
|
|
15415
|
+
const audioWait = audioWaitReporter(job, onProgress);
|
|
15366
15416
|
const audioStage = observeRenderStage(
|
|
15367
15417
|
observability,
|
|
15368
15418
|
"audio_process",
|
|
@@ -15381,7 +15431,8 @@ async function executeRenderPipeline(input) {
|
|
|
15381
15431
|
abortSignal: executionSignal,
|
|
15382
15432
|
assertNotAborted,
|
|
15383
15433
|
log,
|
|
15384
|
-
keepDeliverySource: true
|
|
15434
|
+
keepDeliverySource: true,
|
|
15435
|
+
onFfmpegProgress: audioWait.progressed
|
|
15385
15436
|
})
|
|
15386
15437
|
);
|
|
15387
15438
|
pendingAudio = audioStage.catch(() => void 0);
|
|
@@ -16191,7 +16242,7 @@ async function executeRenderPipeline(input) {
|
|
|
16191
16242
|
}
|
|
16192
16243
|
const effectiveQuality = job.config.crf ?? preset.quality;
|
|
16193
16244
|
const effectiveBitrate = job.config.crf != null ? void 0 : job.config.videoBitrate;
|
|
16194
|
-
const audioResult = await audioStage;
|
|
16245
|
+
const audioResult = await audioWait.wait(audioStage);
|
|
16195
16246
|
const { audioOutputPath, deliverySourcePath, hasAudio } = audioResult;
|
|
16196
16247
|
perfStages.audioProcessMs = audioResult.audioProcessMs;
|
|
16197
16248
|
recordLimiterAttenuation(job, audioResult.audioLoweredDb);
|
|
@@ -17047,8 +17098,9 @@ import {
|
|
|
17047
17098
|
closeSync as closeSync5,
|
|
17048
17099
|
constants as constants3
|
|
17049
17100
|
} from "node:fs";
|
|
17050
|
-
import { resolve as resolve9, join as join33, relative as relative4, isAbsolute as isAbsolute3, sep as sep4 } from "node:path";
|
|
17051
|
-
import {
|
|
17101
|
+
import { resolve as resolve9, join as join33, relative as relative4, isAbsolute as isAbsolute3, sep as sep4, dirname as dirname15 } from "node:path";
|
|
17102
|
+
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
17103
|
+
import { Worker as Worker2 } from "node:worker_threads";
|
|
17052
17104
|
function isStringRecord(value) {
|
|
17053
17105
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
17054
17106
|
return false;
|
|
@@ -17154,17 +17206,111 @@ function prepareHyperframeLintBody(body, isAllowedEntry) {
|
|
|
17154
17206
|
}
|
|
17155
17207
|
return { error: "Missing lint source: provide projectDir, files, or html" };
|
|
17156
17208
|
}
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
17209
|
+
var LINT_HEAP_MB = 512;
|
|
17210
|
+
var LINT_TIMEOUT_MS = 15e3;
|
|
17211
|
+
var LINT_MAX_WORKERS = 2;
|
|
17212
|
+
var waiting = [];
|
|
17213
|
+
var running = 0;
|
|
17214
|
+
function takeLintSlot(limit, waitMs) {
|
|
17215
|
+
if (running < limit) {
|
|
17216
|
+
running++;
|
|
17217
|
+
return Promise.resolve(true);
|
|
17218
|
+
}
|
|
17219
|
+
return new Promise((resolve11) => {
|
|
17220
|
+
const entry = () => {
|
|
17221
|
+
clearTimeout(timer);
|
|
17222
|
+
running++;
|
|
17223
|
+
resolve11(true);
|
|
17224
|
+
};
|
|
17225
|
+
const timer = setTimeout(
|
|
17226
|
+
() => {
|
|
17227
|
+
waiting.splice(waiting.indexOf(entry), 1);
|
|
17228
|
+
resolve11(false);
|
|
17229
|
+
},
|
|
17230
|
+
Math.max(0, waitMs)
|
|
17231
|
+
);
|
|
17232
|
+
waiting.push(entry);
|
|
17233
|
+
});
|
|
17234
|
+
}
|
|
17235
|
+
function freeLintSlot() {
|
|
17236
|
+
running--;
|
|
17237
|
+
waiting.shift()?.();
|
|
17238
|
+
}
|
|
17239
|
+
function resolveLintWorkerEntry() {
|
|
17240
|
+
const here = dirname15(fileURLToPath5(import.meta.url));
|
|
17241
|
+
for (const name of ["hyperframeLintWorker.js", "hyperframeLintWorker.ts"]) {
|
|
17242
|
+
const candidate = join33(here, name);
|
|
17243
|
+
if (existsSync22(candidate)) return candidate;
|
|
17244
|
+
}
|
|
17245
|
+
return void 0;
|
|
17246
|
+
}
|
|
17247
|
+
function abortedLintResult(filePath, afterMs) {
|
|
17248
|
+
return {
|
|
17249
|
+
ok: false,
|
|
17250
|
+
errorCount: 1,
|
|
17251
|
+
warningCount: 0,
|
|
17252
|
+
infoCount: 0,
|
|
17253
|
+
findings: [
|
|
17254
|
+
{
|
|
17255
|
+
code: "lint_aborted",
|
|
17256
|
+
severity: "error",
|
|
17257
|
+
message: "This composition's script could not be checked: linting it ran too long or out of memory, so it was stopped. A very large or deeply nested script is the usual cause.",
|
|
17258
|
+
file: filePath
|
|
17259
|
+
}
|
|
17260
|
+
],
|
|
17261
|
+
timings: { totalMs: afterMs, groupMs: {}, slowestRule: "", slowestRuleMs: 0 }
|
|
17262
|
+
};
|
|
17263
|
+
}
|
|
17264
|
+
async function runHyperframeLint(prepared, options = {}) {
|
|
17265
|
+
const began = performance.now();
|
|
17266
|
+
const aborted = () => abortedLintResult(prepared.entryFile, Math.round(performance.now() - began));
|
|
17267
|
+
const entry = options.workerEntry ?? resolveLintWorkerEntry();
|
|
17268
|
+
if (!entry) return aborted();
|
|
17269
|
+
const timeoutMs = options.timeoutMs ?? LINT_TIMEOUT_MS;
|
|
17270
|
+
const gotSlot = await takeLintSlot(options.maxWorkers ?? LINT_MAX_WORKERS, timeoutMs);
|
|
17271
|
+
if (!gotSlot) return aborted();
|
|
17272
|
+
const remainingMs = Math.max(0, timeoutMs - (performance.now() - began));
|
|
17273
|
+
return new Promise((resolvePromise, reject) => {
|
|
17274
|
+
let worker;
|
|
17275
|
+
try {
|
|
17276
|
+
worker = new Worker2(entry, {
|
|
17277
|
+
workerData: {
|
|
17278
|
+
html: prepared.html,
|
|
17279
|
+
opts: { filePath: prepared.entryFile, compSrcPath: prepared.entryFile }
|
|
17280
|
+
},
|
|
17281
|
+
resourceLimits: { maxOldGenerationSizeMb: options.heapMb ?? LINT_HEAP_MB },
|
|
17282
|
+
stdout: false,
|
|
17283
|
+
stderr: false
|
|
17284
|
+
});
|
|
17285
|
+
} catch {
|
|
17286
|
+
freeLintSlot();
|
|
17287
|
+
resolvePromise(aborted());
|
|
17288
|
+
return;
|
|
17289
|
+
}
|
|
17290
|
+
let settled = false;
|
|
17291
|
+
const settle = (finish) => {
|
|
17292
|
+
if (settled) return;
|
|
17293
|
+
settled = true;
|
|
17294
|
+
clearTimeout(timer);
|
|
17295
|
+
void worker.terminate().finally(freeLintSlot);
|
|
17296
|
+
finish();
|
|
17297
|
+
};
|
|
17298
|
+
const timer = setTimeout(() => settle(() => resolvePromise(aborted())), remainingMs);
|
|
17299
|
+
worker.on(
|
|
17300
|
+
"message",
|
|
17301
|
+
(message) => settle(
|
|
17302
|
+
() => message.result ? resolvePromise(message.result) : reject(new Error(message.error))
|
|
17303
|
+
)
|
|
17304
|
+
);
|
|
17305
|
+
worker.on("error", () => settle(() => resolvePromise(aborted())));
|
|
17306
|
+
worker.on("exit", () => settle(() => resolvePromise(aborted())));
|
|
17161
17307
|
});
|
|
17162
17308
|
}
|
|
17163
17309
|
|
|
17164
17310
|
// src/services/healthWorker.ts
|
|
17165
|
-
import { Worker as
|
|
17166
|
-
import { fileURLToPath as
|
|
17167
|
-
import { dirname as
|
|
17311
|
+
import { Worker as Worker3 } from "node:worker_threads";
|
|
17312
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
17313
|
+
import { dirname as dirname16, join as join34 } from "node:path";
|
|
17168
17314
|
import { existsSync as existsSync23 } from "node:fs";
|
|
17169
17315
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
17170
17316
|
async function startHealthWorker(options = {}) {
|
|
@@ -17176,7 +17322,7 @@ async function startHealthWorker(options = {}) {
|
|
|
17176
17322
|
"[healthWorker] could not resolve worker entry. Pass options.workerEntry or ensure healthWorkerThread.{js,ts} is co-located."
|
|
17177
17323
|
);
|
|
17178
17324
|
}
|
|
17179
|
-
const worker = new
|
|
17325
|
+
const worker = new Worker3(entry, {
|
|
17180
17326
|
workerData: { port },
|
|
17181
17327
|
// Keep stdio inherited so the worker's console logs land in the pod logs
|
|
17182
17328
|
// alongside the main thread's.
|
|
@@ -17239,7 +17385,7 @@ function defaultLogger2() {
|
|
|
17239
17385
|
};
|
|
17240
17386
|
}
|
|
17241
17387
|
function resolveWorkerEntry2() {
|
|
17242
|
-
const here =
|
|
17388
|
+
const here = dirname16(fileURLToPath6(import.meta.url));
|
|
17243
17389
|
const candidates = [join34(here, "healthWorkerThread.js"), join34(here, "healthWorkerThread.ts")];
|
|
17244
17390
|
for (const candidate of candidates) {
|
|
17245
17391
|
if (existsSync23(candidate)) return candidate;
|
|
@@ -17315,9 +17461,9 @@ import {
|
|
|
17315
17461
|
|
|
17316
17462
|
// src/services/distributed/shared.ts
|
|
17317
17463
|
import { execFile as execFileCallback } from "node:child_process";
|
|
17318
|
-
import { dirname as
|
|
17464
|
+
import { dirname as dirname17, join as join35 } from "node:path";
|
|
17319
17465
|
import { existsSync as existsSync24, readFileSync as readFileSync11 } from "node:fs";
|
|
17320
|
-
import { fileURLToPath as
|
|
17466
|
+
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
17321
17467
|
import { promisify as promisify2 } from "node:util";
|
|
17322
17468
|
import {
|
|
17323
17469
|
getFfmpegBinary,
|
|
@@ -17328,7 +17474,7 @@ var execFile = promisify2(execFileCallback);
|
|
|
17328
17474
|
var cachedProducerVersion = null;
|
|
17329
17475
|
function readProducerVersion() {
|
|
17330
17476
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
17331
|
-
const startDir =
|
|
17477
|
+
const startDir = dirname17(fileURLToPath7(import.meta.url));
|
|
17332
17478
|
let current = startDir;
|
|
17333
17479
|
for (let i = 0; i < 10; i++) {
|
|
17334
17480
|
const candidate = join35(current, "package.json");
|
|
@@ -17342,7 +17488,7 @@ function readProducerVersion() {
|
|
|
17342
17488
|
} catch {
|
|
17343
17489
|
}
|
|
17344
17490
|
}
|
|
17345
|
-
const parent =
|
|
17491
|
+
const parent = dirname17(current);
|
|
17346
17492
|
if (parent === current) break;
|
|
17347
17493
|
current = parent;
|
|
17348
17494
|
}
|
|
@@ -17848,7 +17994,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
17848
17994
|
throw new Error("outputPath must be inside the renders directory");
|
|
17849
17995
|
}
|
|
17850
17996
|
}
|
|
17851
|
-
const outputDir =
|
|
17997
|
+
const outputDir = dirname18(absoluteOutputPath);
|
|
17852
17998
|
if (!existsSync25(outputDir)) mkdirSync13(outputDir, { recursive: true });
|
|
17853
17999
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
17854
18000
|
}
|
|
@@ -12,6 +12,7 @@ export interface CompiledComposition {
|
|
|
12
12
|
gradedCanvas: boolean;
|
|
13
13
|
masterFxChain?: string;
|
|
14
14
|
unresolvedCompositions: UnresolvedElement[];
|
|
15
|
+
variablesByComp: Record<string, Record<string, unknown>>;
|
|
15
16
|
/** Assets that resolve outside projectDir. Keys are the path used in HTML, values are absolute filesystem paths. */
|
|
16
17
|
externalAssets: Map<string, string>;
|
|
17
18
|
width: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { HyperframeLintResult } from "@hyperframes/lint";
|
|
2
2
|
export interface PreparedHyperframeLintInput {
|
|
3
3
|
entryFile: string;
|
|
4
4
|
html: string;
|
|
@@ -9,4 +9,10 @@ export declare function prepareHyperframeLintBody(body: Record<string, unknown>,
|
|
|
9
9
|
} | {
|
|
10
10
|
error: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export interface HyperframeLintWorkerOptions {
|
|
13
|
+
workerEntry?: string;
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
heapMb?: number;
|
|
16
|
+
maxWorkers?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function runHyperframeLint(prepared: PreparedHyperframeLintInput, options?: HyperframeLintWorkerOptions): Promise<HyperframeLintResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -112,6 +112,13 @@ export declare function reportFrameProgress(job: RenderJob, stage: string, progr
|
|
|
112
112
|
export declare function reportExtractProgress(job: RenderJob, done: number, total: number, onProgress: ProgressCallback | undefined): void;
|
|
113
113
|
/** Frames ffmpeg has encoded, from where capture left the bar up to 90%; same cadence as capture. */
|
|
114
114
|
export declare function reportEncodeProgress(job: RenderJob, done: number, total: number, onProgress: ProgressCallback | undefined, from: number): void;
|
|
115
|
+
export declare const AUDIO_STAGE = "Processing audio tracks";
|
|
116
|
+
/** Once capture waits on the audio mix: a line at most every 5 s in which an FFmpeg of the mix wrote more, so whoever
|
|
117
|
+
* watches the render for silence hears it working, and a mix that writes nothing stays silent. */
|
|
118
|
+
export declare function audioWaitReporter(job: RenderJob, onProgress: ProgressCallback | undefined): {
|
|
119
|
+
progressed(): void;
|
|
120
|
+
wait<T>(audio: Promise<T>): Promise<T>;
|
|
121
|
+
};
|
|
115
122
|
/** Seconds of the final file written, 90% to 99%: only a complete file reaches 100. */
|
|
116
123
|
export declare function reportAssembleProgress(job: RenderJob, done: number, total: number, onProgress: ProgressCallback | undefined): void;
|
|
117
124
|
export declare function forgetWorkerPhases(job: object): void;
|
|
@@ -44,6 +44,7 @@ export interface AudioStageInput {
|
|
|
44
44
|
log?: ProducerLogger;
|
|
45
45
|
/** Leave the delivered PCM in `workDir` for the assemble stage; its owner removes the dir. */
|
|
46
46
|
keepDeliverySource?: boolean;
|
|
47
|
+
onFfmpegProgress?: () => void;
|
|
47
48
|
}
|
|
48
49
|
export interface AudioStageResult {
|
|
49
50
|
/** Actual delivery attenuation, for the render warning and metadata. */
|
|
@@ -92,11 +92,12 @@ export declare function hasScriptedAudioVolumeAutomation(html: string, audioCoun
|
|
|
92
92
|
* comment or prose that merely mentions the attribute (issue #1938).
|
|
93
93
|
*/
|
|
94
94
|
export declare function hasAutoStartVideos(html: string): boolean;
|
|
95
|
+
type VariablesByComp = Record<string, Record<string, unknown>>;
|
|
95
96
|
/**
|
|
96
97
|
* Variable-bound sources are resolved by the browser runtime, not the static compiler. Probe them whenever the
|
|
97
|
-
* element's variable has a value (the render's, its mount's
|
|
98
|
+
* element's variable has a value (the render's, its scope's compiled table entry, its mount's, a declared default).
|
|
98
99
|
*/
|
|
99
|
-
export declare function hasVariableBoundMedia(html: string, variables: Record<string, unknown> | undefined): boolean;
|
|
100
|
+
export declare function hasVariableBoundMedia(html: string, variables: Record<string, unknown> | undefined, variablesByComp?: VariablesByComp): boolean;
|
|
100
101
|
/** Reported `strictVariables`: undefined if not asked; true if checked or nothing needed checking; else false. */
|
|
101
102
|
export declare function strictVariablesAttestation(config: RenderConfig, probeSession: CaptureSession | null): boolean | undefined;
|
|
102
103
|
/**
|
|
@@ -143,3 +144,4 @@ export declare function pruneMutedBrowserMedia(composition: {
|
|
|
143
144
|
tagName: string;
|
|
144
145
|
muted?: boolean;
|
|
145
146
|
}[], existingAudioIds?: Set<string>): void;
|
|
147
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.59",
|
|
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/parsers": "0.9.
|
|
42
|
-
"@hyperframes/studio-server": "0.9.
|
|
38
|
+
"@hyperframes/lint": "0.9.59",
|
|
39
|
+
"@hyperframes/core": "0.9.59",
|
|
40
|
+
"@hyperframes/engine": "0.9.59",
|
|
41
|
+
"@hyperframes/parsers": "0.9.59",
|
|
42
|
+
"@hyperframes/studio-server": "0.9.59"
|
|
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.59"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|