@hyperframes/producer 0.9.53 → 0.9.55

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.
@@ -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 dirname16, join as join37 } from "node:path";
13
+ import { resolve as resolve10, dirname as dirname17, 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";
@@ -86,7 +86,7 @@ import {
86
86
  referenceBackgroundResult,
87
87
  createReferenceBackgroundRecorder
88
88
  } from "@hyperframes/engine";
89
- import { join as join32, dirname as dirname13, resolve as resolve8 } from "path";
89
+ import { join as join32, dirname as dirname14, resolve as resolve8 } from "path";
90
90
  import { totalmem as totalmem2 } from "node:os";
91
91
  import { randomUUID } from "crypto";
92
92
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -94,7 +94,7 @@ import { fileURLToPath as fileURLToPath4 } from "url";
94
94
  // src/services/fileServer.ts
95
95
  import { Hono } from "hono";
96
96
  import { serve } from "@hono/node-server";
97
- import { settleOnBrowserSafePort } from "@hyperframes/engine";
97
+ import { answerOwnLoopbackHostOnly, settleOnBrowserSafePort } from "@hyperframes/engine";
98
98
  import {
99
99
  existsSync as existsSync2,
100
100
  realpathSync,
@@ -110,8 +110,10 @@ import { promisify } from "node:util";
110
110
  import { Readable } from "node:stream";
111
111
  import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
112
112
  import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
113
+ import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
114
+ import { PREVIEW_FOR_ANOTHER_SITE_META } from "@hyperframes/core/studio-preview-mark";
113
115
  import { fpsToNumber } from "@hyperframes/core";
114
- import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
116
+ import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
115
117
  import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
116
118
  import { openRangeEnd } from "@hyperframes/studio-server/media-range";
117
119
 
@@ -831,6 +833,7 @@ var HF_BRIDGE_SCRIPT = `(function() {
831
833
  if (bridge()) __realClearInterval(iv);
832
834
  }, 50);
833
835
  })();`;
836
+ var OFFER_NO_FRAMING_SITE_AN_EDITING_PORT = `<meta name="${PREVIEW_FOR_ANOTHER_SITE_META}">`;
834
837
  var RENDER_CAPTURE_MODE_SHIM = "globalThis.__HF_RENDER_CAPTURE_MODE = true;";
835
838
  function closeFileServerSafely(fileServer, label, log = defaultLogger) {
836
839
  try {
@@ -878,10 +881,12 @@ function createFileServer(options) {
878
881
  const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
879
882
  const app = new Hono();
880
883
  const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
884
+ let listeningPort = -1;
881
885
  app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
882
886
  await next();
883
887
  c.res.headers.set("X-Content-Type-Options", "nosniff");
884
888
  });
889
+ answerOwnLoopbackHostOnly(app, () => listeningPort);
885
890
  app.get("/*", async (c) => {
886
891
  let requestPath = c.req.path;
887
892
  if (requestPath === "/") requestPath = "/index.html";
@@ -891,7 +896,7 @@ function createFileServer(options) {
891
896
  const candidate = join2(root, relativePath);
892
897
  const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
893
898
  if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
894
- if (isPrivateFileUnder(root, candidate, isVcsOrSecretPath)) continue;
899
+ if (isPrivateFileUnder(root, candidate, isStudioPrivatePath)) continue;
895
900
  const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
896
901
  if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
897
902
  file = openRegularFile(candidate);
@@ -916,6 +921,7 @@ function createFileServer(options) {
916
921
  html = injectScriptsAtHeadStart(html, preHeadScripts);
917
922
  }
918
923
  html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
924
+ html = injectTagsAtHeadStart(html, OFFER_NO_FRAMING_SITE_AN_EDITING_PORT);
919
925
  return c.text(html, 200, { "Content-Type": contentType });
920
926
  }
921
927
  if (ext === ".png") {
@@ -977,6 +983,7 @@ function createFileServer(options) {
977
983
  const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
978
984
  const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
979
985
  bound.then((boundPort) => {
986
+ listeningPort = boundPort;
980
987
  resolve11({
981
988
  url: `http://localhost:${boundPort}`,
982
989
  port: boundPort,
@@ -6561,7 +6568,7 @@ import {
6561
6568
  } from "@hyperframes/parsers/css-url-scans";
6562
6569
  import { createHash as createHash6 } from "node:crypto";
6563
6570
  import { createReadStream as createReadStream2, existsSync as existsSync11, mkdirSync as mkdirSync9, readFileSync as readFileSync8 } from "fs";
6564
- import { join as join19, dirname as dirname8, resolve as resolve7, basename as basename5, relative as relative2, sep as sep3 } from "path";
6571
+ import { join as join19, dirname as dirname9, resolve as resolve7, basename as basename5, relative as relative2, sep as sep3 } from "path";
6565
6572
  import { parseHTML as parseHTML5 } from "linkedom";
6566
6573
 
6567
6574
  // src/services/bundledScripts.ts
@@ -6633,7 +6640,7 @@ import {
6633
6640
  readTextFile,
6634
6641
  resolveCompositionSrc
6635
6642
  } from "@hyperframes/parsers/asset-resolution";
6636
- import { isPrivateFileUnder as isPrivateFileUnder2, isVcsOrSecretPath as isVcsOrSecretPath2 } from "@hyperframes/core/safe-path";
6643
+ import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
6637
6644
 
6638
6645
  // src/services/renderMediaCollector.ts
6639
6646
  import { parseHTML as parseHTML2 } from "linkedom";
@@ -7465,9 +7472,11 @@ import { getPositionEditsRenderScript } from "@hyperframes/core/runtime/position
7465
7472
 
7466
7473
  // src/services/assetMediaType.ts
7467
7474
  import { existsSync as existsSync10 } from "node:fs";
7468
- import { join as join18 } from "node:path";
7475
+ import { dirname as dirname8, join as join18 } from "node:path";
7469
7476
  import {
7470
7477
  fingerprintElementId,
7478
+ isHttpUrl as isHttpUrl2,
7479
+ isInsideAssetRoots,
7471
7480
  isNotMediaPayload,
7472
7481
  playlistLeavesItsFolder,
7473
7482
  NotMediaPayloadError,
@@ -7513,17 +7522,17 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
7513
7522
  }
7514
7523
  ]);
7515
7524
  }
7516
- function isRemoteOrInlineSource(src) {
7517
- return /^(?:https?:|data:|blob:|about:)/i.test(src.trim());
7525
+ function mediaAssetRoots(projectDir, compiledDir) {
7526
+ return [projectDir, compiledDir, join18(dirname8(compiledDir), "downloads")];
7518
7527
  }
7519
7528
  function dropMediaOutsideProject(input) {
7520
7529
  const { projectDir, workDir, composition, log } = input;
7521
7530
  const compiledDir = join18(workDir, "compiled");
7522
- const roots = [projectDir, compiledDir, join18(workDir, "downloads")];
7531
+ const roots = mediaAssetRoots(projectDir, compiledDir);
7523
7532
  const staysInside = ({ id, src }) => {
7524
- if (!src || isRemoteOrInlineSource(src)) return true;
7533
+ if (!src || isHttpUrl2(src)) return true;
7525
7534
  const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
7526
- if (roots.some((root) => !escapesAssetRoot(path, root))) return true;
7535
+ if (isInsideAssetRoots(path, roots)) return true;
7527
7536
  if (input.allowOutsideProjectAssets) {
7528
7537
  const refusal = outsideAssetRefusal(projectDir, path);
7529
7538
  if (refusal) log.warn(`[Render] ${leftOutOfRender(`Media "${id}"`, src, refusal)}`);
@@ -7561,7 +7570,7 @@ async function preflightCompositionAssetMediaTypes(input) {
7561
7570
  ];
7562
7571
  const byPath = /* @__PURE__ */ new Map();
7563
7572
  for (const reference of references) {
7564
- if (!reference.src || isRemoteOrInlineSource(reference.src)) continue;
7573
+ if (!reference.src || isHttpUrl2(reference.src)) continue;
7565
7574
  const resolvedPath = resolveProjectRelativeSrc3(
7566
7575
  reference.src,
7567
7576
  input.projectDir,
@@ -7671,7 +7680,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
7671
7680
  const file = resolveCompositionPath(projectDir, src, assetRoot);
7672
7681
  return file !== null && COMPOSITION_FILE.test(file) ? file : null;
7673
7682
  }
7674
- var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isVcsOrSecretPath2);
7683
+ var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
7675
7684
  function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
7676
7685
  const { document: document2 } = parseHTML5(html);
7677
7686
  const hosts = [...document2.querySelectorAll("[data-composition-src]")];
@@ -7690,7 +7699,10 @@ function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @
7690
7699
  continue;
7691
7700
  }
7692
7701
  if (isPrivateCompositionFile(projectDir, filePath)) {
7693
- problems.push({ srcPath, detail: "it is git metadata or an env file" });
7702
+ problems.push({
7703
+ srcPath,
7704
+ detail: "it is git metadata, an env file or a private tool record"
7705
+ });
7694
7706
  continue;
7695
7707
  }
7696
7708
  if (!COMPOSITION_FILE.test(filePath)) {
@@ -8019,7 +8031,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
8019
8031
  workItems.map(async (item) => {
8020
8032
  const { html: compiledSub } = await compileHtmlFile(
8021
8033
  rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
8022
- dirname8(item.filePath),
8034
+ dirname9(item.filePath),
8023
8035
  downloadDir,
8024
8036
  void 0,
8025
8037
  urlByAbsentLocalPath,
@@ -8681,7 +8693,7 @@ function projectStylesheetFontFamilies(html, projectDir) {
8681
8693
  const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
8682
8694
  const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
8683
8695
  const path = decodedUrlPath(url);
8684
- const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(dirname8(sheet), path);
8696
+ const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(dirname9(sheet), path);
8685
8697
  return isPathInside(file, projectDir) && existsSync11(file);
8686
8698
  });
8687
8699
  if (family && shipsFile) families.push(family);
@@ -10363,7 +10375,8 @@ import {
10363
10375
  rebaseVideoToWindow,
10364
10376
  resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
10365
10377
  resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
10366
- isHttpUrl as isHttpUrl2,
10378
+ isHttpUrl as isHttpUrl3,
10379
+ isInsideAssetRoots as isInsideAssetRoots2,
10367
10380
  assertPublicHttpsUrl,
10368
10381
  downloadToTemp as downloadToTemp2,
10369
10382
  resolveRestrictPageNetwork,
@@ -10608,6 +10621,7 @@ async function runExtractVideosStage(input) {
10608
10621
  skipFrameExtractionIds = []
10609
10622
  } = input;
10610
10623
  const stage2Start = Date.now();
10624
+ const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
10611
10625
  const extractionPolicy = resolveVideoExtractionPolicy();
10612
10626
  composition.videos = composition.videos.filter(
10613
10627
  (video) => !isVideoPastTimelineEnd(video, composition.duration)
@@ -10626,7 +10640,7 @@ async function runExtractVideosStage(input) {
10626
10640
  const probeFailures = await Promise.all(
10627
10641
  composition.videos.map(async (v) => {
10628
10642
  const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
10629
- if (!existsSync13(videoPath)) return null;
10643
+ if (!opensLocally(videoPath, assetRoots)) return null;
10630
10644
  try {
10631
10645
  const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
10632
10646
  signal: abortSignal,
@@ -10664,7 +10678,7 @@ async function runExtractVideosStage(input) {
10664
10678
  const probed = await Promise.all(
10665
10679
  composition.images.map(async (img) => {
10666
10680
  const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
10667
- if (!existsSync13(imgPath)) return null;
10681
+ if (!opensLocally(imgPath, assetRoots)) return null;
10668
10682
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
10669
10683
  if (isHdrColorSpace2(colorSpace)) {
10670
10684
  nativeHdrImageIds.add(img.id);
@@ -10683,6 +10697,7 @@ async function runExtractVideosStage(input) {
10683
10697
  composition,
10684
10698
  urlByAbsentLocalPath,
10685
10699
  downloadDir: audioDownloadDir,
10700
+ allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
10686
10701
  signal: abortSignal,
10687
10702
  log
10688
10703
  });
@@ -10716,6 +10731,7 @@ async function runExtractVideosStage(input) {
10716
10731
  shownBoxes,
10717
10732
  contentKeyedDirs: [join22(compiledDir, REMOTE_MEDIA_SUBDIR)],
10718
10733
  urlByAbsentLocalPath,
10734
+ assetRoots,
10719
10735
  onProgress: ({ planned = 0, done = 0 }) => {
10720
10736
  framesPlanned += planned;
10721
10737
  framesDone += done;
@@ -10792,10 +10808,14 @@ function isPublicHttpsUrl(url) {
10792
10808
  return false;
10793
10809
  }
10794
10810
  }
10811
+ function opensLocally(path, assetRoots) {
10812
+ return existsSync13(path) && (!assetRoots || isInsideAssetRoots2(path, assetRoots));
10813
+ }
10795
10814
  function localProbeSource(src, input) {
10796
10815
  const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
10797
10816
  const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
10798
- return isHttpUrl2(readFrom) || existsSync13(readFrom) ? readFrom : null;
10817
+ const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
10818
+ return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
10799
10819
  }
10800
10820
  async function remoteProbeSource(video, input) {
10801
10821
  if (!isPublicHttpsUrl(video.src)) return null;
@@ -10821,7 +10841,7 @@ async function appendVideoAudioFromProbe(input) {
10821
10841
  );
10822
10842
  const probed = await Promise.all(
10823
10843
  videos.map(async (video) => {
10824
- const readFrom = isHttpUrl2(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
10844
+ const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
10825
10845
  if (readFrom === null) return null;
10826
10846
  const metadata = await extractMediaMetadata4(readFrom);
10827
10847
  const window2 = await resolveFinalFrameExtractionWindow2(
@@ -10845,7 +10865,7 @@ async function appendVideoAudioFromProbe(input) {
10845
10865
  import { existsSync as existsSync14 } from "node:fs";
10846
10866
  import {
10847
10867
  buildVideoLayerInput,
10848
- isHttpUrl as isHttpUrl3,
10868
+ isHttpUrl as isHttpUrl4,
10849
10869
  qualifyVideoLayer,
10850
10870
  resolveProjectRelativeSrc as resolveProjectRelativeSrc5
10851
10871
  } from "@hyperframes/engine";
@@ -10908,7 +10928,7 @@ async function planVideoLayerPassthrough(input) {
10908
10928
  const q = qualifyVideoLayer(input.videos, input.duration);
10909
10929
  if (!q.qualifies) return { reason: q.reason };
10910
10930
  const { video } = q;
10911
- if (isHttpUrl3(video.src)) return { reason: "remote_source" };
10931
+ if (isHttpUrl4(video.src)) return { reason: "remote_source" };
10912
10932
  const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
10913
10933
  if (!existsSync14(path)) return { reason: "source_missing" };
10914
10934
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
@@ -10937,7 +10957,7 @@ import {
10937
10957
 
10938
10958
  // src/services/render/audioDeliveryLimit.ts
10939
10959
  import { existsSync as existsSync15 } from "node:fs";
10940
- import { dirname as dirname10, join as join24 } from "node:path";
10960
+ import { dirname as dirname11, join as join24 } from "node:path";
10941
10961
  import {
10942
10962
  applyAudioFxChain,
10943
10963
  describeFfmpegFailure as describeFfmpegFailure3,
@@ -10947,7 +10967,7 @@ import {
10947
10967
 
10948
10968
  // src/services/render/audioPadTrim.ts
10949
10969
  import { spawn } from "node:child_process";
10950
- import { dirname as dirname9, join as join23 } from "node:path";
10970
+ import { dirname as dirname10, join as join23 } from "node:path";
10951
10971
  import {
10952
10972
  DEFAULT_CONFIG,
10953
10973
  describeFfmpegFailure as describeFfmpegFailure2,
@@ -11241,7 +11261,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
11241
11261
  async function enforceAacTruePeak(input) {
11242
11262
  let scratchDir;
11243
11263
  try {
11244
- scratchDir = createStagingDir3(dirname9(input.audioPath), ".true-peak-");
11264
+ scratchDir = createStagingDir3(dirname10(input.audioPath), ".true-peak-");
11245
11265
  const correctedPath = join23(scratchDir, "audio.m4a");
11246
11266
  const measurements = [];
11247
11267
  let attenuationDb = 0;
@@ -11452,7 +11472,7 @@ async function limitDeliveryPeaks(input, deps = {
11452
11472
  const peak = await deps.measure(audioPath, { timeoutMs, signal });
11453
11473
  if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
11454
11474
  const alternating = ["a", "b"].map(
11455
- (k) => join24(dirname10(sourcePath), `audio-source-limited-${k}.wav`)
11475
+ (k) => join24(dirname11(sourcePath), `audio-source-limited-${k}.wav`)
11456
11476
  );
11457
11477
  let encodedFrom;
11458
11478
  let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
@@ -11610,7 +11630,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
11610
11630
  masterFxChain,
11611
11631
  urlByAbsentLocalPath,
11612
11632
  audioSidecarUrlByLocalPath,
11613
- keepEncoderInputAt: pcmSourcePath
11633
+ keepEncoderInputAt: pcmSourcePath,
11634
+ assetRoots: input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir)
11614
11635
  },
11615
11636
  compiledDir
11616
11637
  );
@@ -12290,7 +12311,7 @@ import {
12290
12311
  // src/services/shaderTransitionWorkerPool.ts
12291
12312
  import { Worker } from "node:worker_threads";
12292
12313
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
12293
- import { dirname as dirname11, join as join28 } from "node:path";
12314
+ import { dirname as dirname12, join as join28 } from "node:path";
12294
12315
  import { createRequire } from "node:module";
12295
12316
  import { usableCpuCount } from "@hyperframes/engine";
12296
12317
  import { existsSync as existsSync18 } from "node:fs";
@@ -12303,7 +12324,7 @@ function resolveWorkerEntry(explicit) {
12303
12324
  const isTs = override.endsWith(".ts");
12304
12325
  return { path: override, isTs };
12305
12326
  }
12306
- const moduleDir = dirname11(fileURLToPath3(import.meta.url));
12327
+ const moduleDir = dirname12(fileURLToPath3(import.meta.url));
12307
12328
  const jsPath = join28(moduleDir, "shaderTransitionWorker.js");
12308
12329
  if (existsSync18(jsPath)) return { path: jsPath, isTs: false };
12309
12330
  const tsPath = join28(moduleDir, "shaderTransitionWorker.ts");
@@ -13032,7 +13053,7 @@ import {
13032
13053
  writeFileSync as writeFileSync6
13033
13054
  } from "node:fs";
13034
13055
  import { readFile as readFile2 } from "node:fs/promises";
13035
- import { dirname as dirname12, join as join31 } from "node:path";
13056
+ import { dirname as dirname13, join as join31 } from "node:path";
13036
13057
  import {
13037
13058
  encodeFramesChunkedConcat,
13038
13059
  encodeFramesFromDir,
@@ -13350,7 +13371,7 @@ async function runEncodeStage(input) {
13350
13371
  const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
13351
13372
  fps: job.config.fps,
13352
13373
  loop,
13353
- palettePath: join31(dirname12(videoOnlyPath), "gif-palette.png"),
13374
+ palettePath: join31(dirname13(videoOnlyPath), "gif-palette.png"),
13354
13375
  preserveAlpha: needsAlpha,
13355
13376
  signal: abortSignal,
13356
13377
  timeout: engineCfg.ffmpegEncodeTimeout
@@ -13795,7 +13816,7 @@ function getNextRetryWorkerCount(currentWorkers) {
13795
13816
  }
13796
13817
  function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
13797
13818
  if (platform2 === "win32" || platform2 === "darwin") return join32(systemTempDir, "hf-render-");
13798
- return join32(dirname13(outputPath), `work-${jobId}-`);
13819
+ return join32(dirname14(outputPath), `work-${jobId}-`);
13799
13820
  }
13800
13821
  var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
13801
13822
  function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
@@ -14521,7 +14542,7 @@ function deVerifyFallbackTelemetry(err) {
14521
14542
  };
14522
14543
  }
14523
14544
  function resolveRenderDebugDir() {
14524
- const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(dirname13(fileURLToPath4(import.meta.url)), "../..");
14545
+ const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(dirname14(fileURLToPath4(import.meta.url)), "../..");
14525
14546
  return join32(producerRoot, ".debug");
14526
14547
  }
14527
14548
  async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
@@ -14529,7 +14550,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
14529
14550
  validateDeliveryEncoderConfig(job.config);
14530
14551
  validateChromaSubsamplingConfig(job.config);
14531
14552
  const debugDir = resolveRenderDebugDir();
14532
- const outputDir = dirname13(outputPath);
14553
+ const outputDir = dirname14(outputPath);
14533
14554
  if (!existsSync21(outputDir)) mkdirSync12(outputDir, { recursive: true });
14534
14555
  const workDir = job.config.debug ? join32(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
14535
14556
  const pipelineStart = Date.now();
@@ -15028,6 +15049,7 @@ async function executeRenderPipeline(input) {
15028
15049
  audioGain: cfg.audioGain,
15029
15050
  audios: composition.audios,
15030
15051
  masterFxChain: composition.masterFxChain,
15052
+ allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
15031
15053
  abortSignal: executionSignal,
15032
15054
  assertNotAborted,
15033
15055
  log,
@@ -16814,7 +16836,7 @@ async function runHyperframeLint(prepared) {
16814
16836
  // src/services/healthWorker.ts
16815
16837
  import { Worker as Worker2 } from "node:worker_threads";
16816
16838
  import { fileURLToPath as fileURLToPath5 } from "node:url";
16817
- import { dirname as dirname14, join as join34 } from "node:path";
16839
+ import { dirname as dirname15, join as join34 } from "node:path";
16818
16840
  import { existsSync as existsSync23 } from "node:fs";
16819
16841
  var DEFAULT_HEALTH_PORT = 9848;
16820
16842
  async function startHealthWorker(options = {}) {
@@ -16889,7 +16911,7 @@ function defaultLogger2() {
16889
16911
  };
16890
16912
  }
16891
16913
  function resolveWorkerEntry2() {
16892
- const here = dirname14(fileURLToPath5(import.meta.url));
16914
+ const here = dirname15(fileURLToPath5(import.meta.url));
16893
16915
  const candidates = [join34(here, "healthWorkerThread.js"), join34(here, "healthWorkerThread.ts")];
16894
16916
  for (const candidate of candidates) {
16895
16917
  if (existsSync23(candidate)) return candidate;
@@ -16965,7 +16987,7 @@ import {
16965
16987
 
16966
16988
  // src/services/distributed/shared.ts
16967
16989
  import { execFile as execFileCallback } from "node:child_process";
16968
- import { dirname as dirname15, join as join35 } from "node:path";
16990
+ import { dirname as dirname16, join as join35 } from "node:path";
16969
16991
  import { existsSync as existsSync24, readFileSync as readFileSync11 } from "node:fs";
16970
16992
  import { fileURLToPath as fileURLToPath6 } from "node:url";
16971
16993
  import { promisify as promisify2 } from "node:util";
@@ -16978,7 +17000,7 @@ var execFile = promisify2(execFileCallback);
16978
17000
  var cachedProducerVersion = null;
16979
17001
  function readProducerVersion() {
16980
17002
  if (cachedProducerVersion !== null) return cachedProducerVersion;
16981
- const startDir = dirname15(fileURLToPath6(import.meta.url));
17003
+ const startDir = dirname16(fileURLToPath6(import.meta.url));
16982
17004
  let current = startDir;
16983
17005
  for (let i = 0; i < 10; i++) {
16984
17006
  const candidate = join35(current, "package.json");
@@ -16992,7 +17014,7 @@ function readProducerVersion() {
16992
17014
  } catch {
16993
17015
  }
16994
17016
  }
16995
- const parent = dirname15(current);
17017
+ const parent = dirname16(current);
16996
17018
  if (parent === current) break;
16997
17019
  current = parent;
16998
17020
  }
@@ -17498,7 +17520,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
17498
17520
  throw new Error("outputPath must be inside the renders directory");
17499
17521
  }
17500
17522
  }
17501
- const outputDir = dirname16(absoluteOutputPath);
17523
+ const outputDir = dirname17(absoluteOutputPath);
17502
17524
  if (!existsSync25(outputDir)) mkdirSync13(outputDir, { recursive: true });
17503
17525
  return { input, cleanupProjectDir, absoluteOutputPath };
17504
17526
  }
@@ -23,6 +23,7 @@ interface CompositionMediaAssets {
23
23
  audios: readonly AudioElement[];
24
24
  images: readonly ImageElement[];
25
25
  }
26
+ export declare function mediaAssetRoots(projectDir: string, compiledDir: string): string[];
26
27
  /** Treats local media outside the project, compiled and download dirs as missing: no probe or extraction opens it. */
27
28
  export declare function dropMediaOutsideProject(input: {
28
29
  projectDir: string;
@@ -37,6 +37,7 @@ export interface AudioStageInput {
37
37
  masterFxChain?: string;
38
38
  urlByAbsentLocalPath?: ReadonlyMap<string, string>;
39
39
  audioSidecarUrlByLocalPath?: ReadonlyMap<string, string>;
40
+ allowOutsideProjectAssets?: boolean;
40
41
  abortSignal: AbortSignal | undefined;
41
42
  assertNotAborted: () => void;
42
43
  /** Where a per-track failure's detail goes. Optional so tests need not pass one. */
@@ -145,6 +145,7 @@ interface VideoAudioProbeInput {
145
145
  urlByAbsentLocalPath?: ReadonlyMap<string, string>;
146
146
  /** Where a composition URL is downloaded before probing on a render service: the mixer's work folder, so the mix reuses it. */
147
147
  downloadDir?: string;
148
+ allowOutsideProjectAssets?: boolean;
148
149
  signal?: AbortSignal;
149
150
  log?: ProducerLogger;
150
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.53",
3
+ "version": "0.9.55",
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/core": "0.9.53",
39
- "@hyperframes/parsers": "0.9.53",
40
- "@hyperframes/studio-server": "0.9.53",
41
- "@hyperframes/engine": "0.9.53",
42
- "@hyperframes/lint": "0.9.53"
38
+ "@hyperframes/engine": "0.9.55",
39
+ "@hyperframes/lint": "0.9.55",
40
+ "@hyperframes/parsers": "0.9.55",
41
+ "@hyperframes/core": "0.9.55",
42
+ "@hyperframes/studio-server": "0.9.55"
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.53"
51
+ "@hyperframes/aws-lambda": "0.9.55"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"