@hyperframes/producer 0.9.104 → 0.9.106

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/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  mkdirSync as mkdirSync15,
14
14
  readdirSync as readdirSync6,
15
15
  rmSync as rmSync13,
16
- statSync as statSync10,
16
+ statSync as statSync9,
17
17
  writeFileSync as writeFileSync8,
18
18
  copyFileSync as copyFileSync5,
19
19
  appendFileSync
@@ -379,7 +379,7 @@ import {
379
379
  import {
380
380
  existsSync as existsSync2,
381
381
  realpathSync,
382
- statSync as statSync2,
382
+ statSync,
383
383
  createReadStream,
384
384
  openSync,
385
385
  fstatSync,
@@ -537,15 +537,12 @@ import {
537
537
  relative as nodeRelative,
538
538
  isAbsolute as nodeIsAbsolute
539
539
  } from "node:path";
540
- import { statSync } from "node:fs";
541
540
  import { fileURLToPath as fileURLToPath2 } from "node:url";
542
541
  import { isPrivateFileUnder, isSafePath, isStudioPrivatePath } from "@hyperframes/core/safe-path";
543
542
  import {
544
- isCopiedOutsideFileType,
545
- isPrivateOutsideFile,
546
- isUploadedOutsideFileType,
547
543
  leftOutWarning,
548
- linksOutside
544
+ linksOutside,
545
+ outsideLinkRefusal
549
546
  } from "@hyperframes/studio-server/outside-file";
550
547
  import { realFilePath } from "@hyperframes/studio-server/safe-path";
551
548
  var DEFAULT_RENDERS_DIR = process.env.PRODUCER_RENDERS_DIR ?? // fileURLToPath (not URL.pathname): on Windows .pathname is "/D:/..." which
@@ -566,15 +563,9 @@ function escapesAssetRoot(path, assetRoot) {
566
563
  return assetRoot !== void 0 && !isSafePath(assetRoot, path);
567
564
  }
568
565
  function outsideAssetRefusal(projectDir, path, policy = {}) {
569
- if (!linksOutside(projectDir, path)) {
570
- const privateByAnotherSpelling = !isPathInside(path, projectDir) && isPrivateFileUnder(projectDir, path, isStudioPrivatePath);
571
- return privateByAnotherSpelling ? "blocklisted" : null;
572
- }
573
- if (isPrivateOutsideFile(projectDir, path)) return "blocklisted";
574
- const folder = statSync(path, { throwIfNoEntry: false })?.isDirectory();
575
- if (folder || isUploadedOutsideFileType(path)) return null;
576
- if (!isCopiedOutsideFileType(path)) return "file_type";
577
- return policy.includeScripts ? null : "script";
566
+ if (linksOutside(projectDir, path)) return outsideLinkRefusal(projectDir, path, policy);
567
+ const privateByAnotherSpelling = !isPathInside(path, projectDir) && isPrivateFileUnder(projectDir, path, isStudioPrivatePath);
568
+ return privateByAnotherSpelling ? "blocklisted" : null;
578
569
  }
579
570
  var leftOutOfRender = (file, reference, reason) => leftOutWarning(file, reference, reason, "render");
580
571
  function refusesOutsideLink(projectDir, path, warn, policy = {}) {
@@ -1143,7 +1134,7 @@ function openRegularFile(filePath) {
1143
1134
  } catch (error) {
1144
1135
  if (error instanceof Error && "code" in error && NO_FILE_AT_NAME.has(String(error.code)))
1145
1136
  return null;
1146
- if (!statSync2(filePath, { throwIfNoEntry: false })?.isFile()) return null;
1137
+ if (!statSync(filePath, { throwIfNoEntry: false })?.isFile()) return null;
1147
1138
  throw error;
1148
1139
  }
1149
1140
  let accepted = false;
@@ -2663,7 +2654,7 @@ function replanAfterFailure(plan2, failure) {
2663
2654
  }
2664
2655
 
2665
2656
  // src/services/render/stages/captureSegmentedStage.ts
2666
- import { existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync6, statSync as statSync4 } from "node:fs";
2657
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync6, statSync as statSync3 } from "node:fs";
2667
2658
  import { join as join12 } from "node:path";
2668
2659
  import {
2669
2660
  captureFrameToBuffer as captureFrameToBuffer2,
@@ -3587,7 +3578,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
3587
3578
  }
3588
3579
 
3589
3580
  // src/services/render/stages/captureHdrResources.ts
3590
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync3, statfsSync } from "node:fs";
3581
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync2, statfsSync } from "node:fs";
3591
3582
  import {
3592
3583
  decodePngToRgb48le,
3593
3584
  extractMediaMetadata as extractMediaMetadata2,
@@ -4012,7 +4003,7 @@ async function extractHdrVideoFrames(args) {
4012
4003
  failureReason: result.failureReason
4013
4004
  });
4014
4005
  }
4015
- return Math.min(Math.floor(statSync3(spec.path).size / frameSize), spec.frames);
4006
+ return Math.min(Math.floor(statSync2(spec.path).size / frameSize), spec.frames);
4016
4007
  }
4017
4008
  });
4018
4009
  const first = await windows.lease(0);
@@ -5561,7 +5552,7 @@ async function captureSegmentToEncoder(ctx, segment) {
5561
5552
  path: segmentPath,
5562
5553
  // Recorded so resume can prove the file on disk is the one that
5563
5554
  // finished; absent only in unit tests, whose fake encoder writes none.
5564
- bytes: existsSync7(segmentPath) ? statSync4(segmentPath).size : 0,
5555
+ bytes: existsSync7(segmentPath) ? statSync3(segmentPath).size : 0,
5565
5556
  sha256: existsSync7(segmentPath) ? await hashSegmentFile(segmentPath) : ""
5566
5557
  });
5567
5558
  return encodeResult;
@@ -6623,7 +6614,7 @@ function createSegmentVideoFrames(input) {
6623
6614
  }
6624
6615
 
6625
6616
  // src/services/render/videoFrameWindow.ts
6626
- import { readdirSync as readdirSync3, statSync as statSync5 } from "node:fs";
6617
+ import { readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
6627
6618
  import { join as join16 } from "node:path";
6628
6619
  function shouldWindowVideoFrames(args) {
6629
6620
  return args.segmented && args.env.HF_VIDEO_FRAME_WINDOW?.trim().toLowerCase() === "true";
@@ -6639,7 +6630,7 @@ function directoryBytes(path) {
6639
6630
  for (const entry of entries) {
6640
6631
  const child3 = join16(path, entry.name);
6641
6632
  try {
6642
- bytes += entry.isDirectory() ? directoryBytes(child3) : statSync5(child3).size;
6633
+ bytes += entry.isDirectory() ? directoryBytes(child3) : statSync4(child3).size;
6643
6634
  } catch {
6644
6635
  }
6645
6636
  }
@@ -7365,7 +7356,7 @@ import {
7365
7356
  stylesheetLinkMatches
7366
7357
  } from "@hyperframes/parsers/css-url-scans";
7367
7358
  import { createHash as createHash6 } from "node:crypto";
7368
- import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync9, statSync as statSync8 } from "fs";
7359
+ import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync9, statSync as statSync7 } from "fs";
7369
7360
  import { join as join21, dirname as dirname10, resolve as resolve8, basename as basename6, relative as relative3, sep as sep4 } from "path";
7370
7361
  import { parseHTML as parseHTML5 } from "@hyperframes/parsers/linkedom";
7371
7362
  import { compositionRootSize } from "@hyperframes/parsers";
@@ -7654,7 +7645,7 @@ import {
7654
7645
 
7655
7646
  // src/services/animatedGifPrep.ts
7656
7647
  import { createHash as createHash4, randomUUID } from "node:crypto";
7657
- import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, readFileSync as readFileSync7, rmSync as rmSync9, statSync as statSync6 } from "node:fs";
7648
+ import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, readFileSync as readFileSync7, rmSync as rmSync9, statSync as statSync5 } from "node:fs";
7658
7649
  import { dirname as dirname7, isAbsolute as isAbsolute3, join as join18, resolve as resolve6 } from "node:path";
7659
7650
  import { parseHTML as parseHTML3 } from "@hyperframes/parsers/linkedom";
7660
7651
  import { parseAnimatedGifMetadata } from "@hyperframes/core";
@@ -7717,7 +7708,7 @@ function resolveLocalImageSourcePath(src, options) {
7717
7708
  }
7718
7709
  function isUsableFile(path) {
7719
7710
  try {
7720
- const stat = statSync6(path);
7711
+ const stat = statSync5(path);
7721
7712
  return stat.isFile() && stat.size > 0;
7722
7713
  } catch {
7723
7714
  return false;
@@ -7867,7 +7858,7 @@ async function ensurePreparedWebm(input) {
7867
7858
  if (!isUsableFile(tmpPath)) {
7868
7859
  throw new Error("Animated GIF transcode produced an empty output");
7869
7860
  }
7870
- if (statSync6(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP) {
7861
+ if (statSync5(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP) {
7871
7862
  throw new Error("Animated GIF transcode reached its output size limit");
7872
7863
  }
7873
7864
  if (!isUsableFile(input.cachePath)) {
@@ -8003,7 +7994,7 @@ import {
8003
7994
  readFileSync as readFileSync8,
8004
7995
  readSync as readSync3,
8005
7996
  rmSync as rmSync10,
8006
- statSync as statSync7,
7997
+ statSync as statSync6,
8007
7998
  writeFileSync as writeFileSync4
8008
7999
  } from "node:fs";
8009
8000
  import { dirname as dirname8, join as join19, resolve as resolve7 } from "node:path";
@@ -8259,7 +8250,7 @@ function resolveImageSource(src, options) {
8259
8250
  }
8260
8251
  function isUsableFile2(path) {
8261
8252
  try {
8262
- return statSync7(path).size > 0;
8253
+ return statSync6(path).size > 0;
8263
8254
  } catch {
8264
8255
  return false;
8265
8256
  }
@@ -8280,7 +8271,7 @@ async function ensurePreparedJpeg(source, cachePath, outputPath, options) {
8280
8271
  signal: options.signal
8281
8272
  });
8282
8273
  if (!isUsableFile2(tmpPath)) throw new Error("conversion produced an empty file");
8283
- if (statSync7(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP2) {
8274
+ if (statSync6(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP2) {
8284
8275
  throw new Error("conversion reached its output size limit");
8285
8276
  }
8286
8277
  renameWithRetry3(tmpPath, cachePath);
@@ -9958,7 +9949,7 @@ async function localFontDataUri(localPath, projectDir, assetRoot, dataUriByAbsol
9958
9949
  if (dataUriByAbsolutePath.has(absPath)) return dataUriByAbsolutePath.get(absPath);
9959
9950
  const ext = absPath.match(/\.(woff2?|ttf|otf|ttc)$/i)?.[1]?.toLowerCase() ?? "ttf";
9960
9951
  try {
9961
- if (!reserve(Math.ceil(statSync8(absPath).size / 3) * 4 + 64)) {
9952
+ if (!reserve(Math.ceil(statSync7(absPath).size / 3) * 4 + 64)) {
9962
9953
  dataUriByAbsolutePath.set(absPath, void 0);
9963
9954
  return void 0;
9964
9955
  }
@@ -15012,7 +15003,7 @@ import {
15012
15003
  readdirSync as readdirSync5,
15013
15004
  readFileSync as readFileSync10,
15014
15005
  rmSync as rmSync12,
15015
- statSync as statSync9,
15006
+ statSync as statSync8,
15016
15007
  writeFileSync as writeFileSync7
15017
15008
  } from "node:fs";
15018
15009
  import { readFile as readFile2 } from "node:fs/promises";
@@ -15141,7 +15132,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
15141
15132
  const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
15142
15133
  if (failure) return failure;
15143
15134
  }
15144
- const fileSize = existsSync21(outputPath) ? statSync9(outputPath).size : 0;
15135
+ const fileSize = existsSync21(outputPath) ? statSync8(outputPath).size : 0;
15145
15136
  return {
15146
15137
  success: true,
15147
15138
  outputPath,
@@ -15555,7 +15546,7 @@ function sampleDirectoryBytes(dir) {
15555
15546
  for (const name of entries) {
15556
15547
  const full = join36(current, name);
15557
15548
  try {
15558
- const st = statSync10(full);
15549
+ const st = statSync9(full);
15559
15550
  if (st.isDirectory()) {
15560
15551
  stack.push(full);
15561
15552
  } else if (st.isFile()) {
@@ -15719,7 +15710,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
15719
15710
  let rangeStart = null;
15720
15711
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
15721
15712
  const framePath = join36(framesDir, formatCaptureFrameName(frameIndex, frameExt));
15722
- const missing = !existsSync22(framePath) || statSync10(framePath).size <= 8;
15713
+ const missing = !existsSync22(framePath) || statSync9(framePath).size <= 8;
15723
15714
  if (missing && rangeStart === null) {
15724
15715
  rangeStart = frameIndex;
15725
15716
  } else if (!missing && rangeStart !== null) {
@@ -21563,7 +21554,7 @@ import {
21563
21554
  readFileSync as readFileSync14,
21564
21555
  readdirSync as readdirSync10,
21565
21556
  rmSync as rmSync17,
21566
- statSync as statSync12,
21557
+ statSync as statSync11,
21567
21558
  writeFileSync as writeFileSync13
21568
21559
  } from "node:fs";
21569
21560
  import { tmpdir as tmpdir4 } from "node:os";
@@ -21582,7 +21573,7 @@ import {
21582
21573
  linkSync as linkSync2,
21583
21574
  mkdirSync as mkdirSync20,
21584
21575
  rmSync as rmSync16,
21585
- statSync as statSync11,
21576
+ statSync as statSync10,
21586
21577
  writeFileSync as writeFileSync12
21587
21578
  } from "node:fs";
21588
21579
  import { renameWithRetry as renameWithRetry8 } from "@hyperframes/engine";
@@ -21652,7 +21643,7 @@ var LocalPlanV2ArtifactPublisher = class {
21652
21643
  }
21653
21644
  async putBlob(blob) {
21654
21645
  const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
21655
- const sourceSize = statSync11(blob.sourcePath).size;
21646
+ const sourceSize = statSync10(blob.sourcePath).size;
21656
21647
  if (sourceSize !== blob.sizeBytes) {
21657
21648
  throw new PlanV2IntegrityError(
21658
21649
  `published blob size changed for ${digest}: expected ${blob.sizeBytes}, got ${sourceSize}`
@@ -21966,7 +21957,7 @@ function publishBlobFor(absolutePath, digests) {
21966
21957
  return {
21967
21958
  sourcePath: absolutePath,
21968
21959
  sha256: planFileSha256(absolutePath, digests),
21969
- sizeBytes: statSync12(absolutePath).size
21960
+ sizeBytes: statSync11(absolutePath).size
21970
21961
  };
21971
21962
  }
21972
21963
  async function putBlobs(publisher, blobs) {
@@ -22337,7 +22328,7 @@ function verifyBlob(planV2Dir, artifact) {
22337
22328
  if (!existsSync29(sourcePath)) {
22338
22329
  throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
22339
22330
  }
22340
- const stats = statSync12(sourcePath);
22331
+ const stats = statSync11(sourcePath);
22341
22332
  if (!stats.isFile() || stats.size !== artifact.sizeBytes) {
22342
22333
  throw new PlanV2IntegrityError(`artifact size mismatch for ${artifact.path}`);
22343
22334
  }
@@ -22430,7 +22421,7 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
22430
22421
  for (const artifact of required) {
22431
22422
  if (Object.hasOwn(remoteSources, artifact.path)) continue;
22432
22423
  const path = join48(planDir, ...artifact.path.split("/"));
22433
- if (!existsSync29(path) || statSync12(path).size !== artifact.sizeBytes) {
22424
+ if (!existsSync29(path) || statSync11(path).size !== artifact.sizeBytes) {
22434
22425
  throw new PlanV2IntegrityError(
22435
22426
  `materialized artifact missing or truncated: ${artifact.path}`
22436
22427
  );
@@ -23884,7 +23875,7 @@ import {
23884
23875
  lstatSync as lstatSync6,
23885
23876
  mkdirSync as mkdirSync24,
23886
23877
  openSync as openSync9,
23887
- statSync as statSync14,
23878
+ statSync as statSync13,
23888
23879
  mkdtempSync as mkdtempSync2,
23889
23880
  writeFileSync as writeFileSync15,
23890
23881
  rmSync as rmSync20,
@@ -23911,7 +23902,7 @@ import { foreignWritablePath } from "@hyperframes/core/cache-dir";
23911
23902
  import {
23912
23903
  existsSync as existsSync31,
23913
23904
  readFileSync as readFileSync17,
23914
- statSync as statSync13,
23905
+ statSync as statSync12,
23915
23906
  openSync as openSync8,
23916
23907
  fstatSync as fstatSync4,
23917
23908
  closeSync as closeSync8,
@@ -23952,7 +23943,7 @@ function readEntryHtml(filePath) {
23952
23943
  } catch (error) {
23953
23944
  if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
23954
23945
  return null;
23955
- if (!statSync13(filePath, { throwIfNoEntry: false })?.isFile()) return null;
23946
+ if (!statSync12(filePath, { throwIfNoEntry: false })?.isFile()) return null;
23956
23947
  throw error;
23957
23948
  }
23958
23949
  try {
@@ -23968,7 +23959,7 @@ function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
23968
23959
  }
23969
23960
  function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
23970
23961
  const absProjectDir = resolve13(projectDir);
23971
- if (!existsSync31(absProjectDir) || !statSync13(absProjectDir).isDirectory()) {
23962
+ if (!existsSync31(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
23972
23963
  return { error: `Project directory not found: ${absProjectDir}` };
23973
23964
  }
23974
23965
  const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
@@ -24470,7 +24461,7 @@ function prepareProjectDirectory(projectDir, options, policy) {
24470
24461
  if (!candidate) return null;
24471
24462
  const absProjectDir = policy ? resolve14(policy.projectsDir, candidate) : resolve14(candidate);
24472
24463
  const shown = policy ? candidate : absProjectDir;
24473
- if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync33(absProjectDir) || !statSync14(absProjectDir).isDirectory()) {
24464
+ if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync33(absProjectDir) || !statSync13(absProjectDir).isDirectory()) {
24474
24465
  return { error: `Project directory not found: ${shown}` };
24475
24466
  }
24476
24467
  const entry = options.entryFile || "index.html";
@@ -24612,7 +24603,7 @@ function publicPerfSummary(job) {
24612
24603
  return job.perfSummary ? { ...job.perfSummary, renderId: void 0 } : null;
24613
24604
  }
24614
24605
  function outputFileSize(path) {
24615
- return existsSync33(path) ? statSync14(path).size : 0;
24606
+ return existsSync33(path) ? statSync13(path).size : 0;
24616
24607
  }
24617
24608
  function createBlockingProgressReporter(log, requestId) {
24618
24609
  let lastLoggedPct = -10;
@@ -25186,7 +25177,7 @@ import {
25186
25177
  readFileSync as readFileSync18,
25187
25178
  readdirSync as readdirSync12,
25188
25179
  rmSync as rmSync21,
25189
- statSync as statSync15
25180
+ statSync as statSync14
25190
25181
  } from "node:fs";
25191
25182
  import { localContainerInputArgs as localContainerInputArgs2 } from "@hyperframes/parsers/ff-binaries";
25192
25183
  import { basename as basename10, dirname as dirname24, join as join54 } from "node:path";
@@ -25233,7 +25224,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
25233
25224
  outputPath,
25234
25225
  durationMs: Date.now() - start,
25235
25226
  framesEncoded: plan2.totalFrames,
25236
- fileSize: statSync15(outputPath).size
25227
+ fileSize: statSync14(outputPath).size
25237
25228
  };
25238
25229
  }
25239
25230
  const format = plan2.dimensions.format;
@@ -25280,7 +25271,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
25280
25271
  });
25281
25272
  }
25282
25273
  }
25283
- const fileSize = existsSync34(outputPath) ? statSync15(outputPath).size : 0;
25274
+ const fileSize = existsSync34(outputPath) ? statSync14(outputPath).size : 0;
25284
25275
  return {
25285
25276
  ...referenceBackgroundResult8(plan2[REFERENCE_BACKGROUND_FIELD6]),
25286
25277
  outputPath,
@@ -25479,7 +25470,7 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
25479
25470
  mkdirSync25(outputPath, { recursive: true });
25480
25471
  let globalIdx = 0;
25481
25472
  for (const chunkDir of chunkPaths) {
25482
- if (!statSync15(chunkDir).isDirectory()) {
25473
+ if (!statSync14(chunkDir).isDirectory()) {
25483
25474
  throw new Error(
25484
25475
  `[assemble] png-sequence chunk must be a directory: ${chunkDir} (got a file)`
25485
25476
  );
@@ -25506,7 +25497,7 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
25506
25497
  let fileSize = 0;
25507
25498
  for (const name of readdirSync12(outputPath)) {
25508
25499
  try {
25509
- fileSize += statSync15(join54(outputPath, name)).size;
25500
+ fileSize += statSync14(join54(outputPath, name)).size;
25510
25501
  } catch {
25511
25502
  }
25512
25503
  }
@@ -25,7 +25,7 @@ import {
25
25
  lstatSync as lstatSync4,
26
26
  mkdirSync as mkdirSync16,
27
27
  openSync as openSync7,
28
- statSync as statSync12,
28
+ statSync as statSync11,
29
29
  mkdtempSync,
30
30
  writeFileSync as writeFileSync9,
31
31
  rmSync as rmSync14,
@@ -55,7 +55,7 @@ import {
55
55
  mkdirSync as mkdirSync15,
56
56
  readdirSync as readdirSync6,
57
57
  rmSync as rmSync13,
58
- statSync as statSync10,
58
+ statSync as statSync9,
59
59
  writeFileSync as writeFileSync8,
60
60
  copyFileSync as copyFileSync5,
61
61
  appendFileSync
@@ -421,7 +421,7 @@ import {
421
421
  import {
422
422
  existsSync as existsSync2,
423
423
  realpathSync,
424
- statSync as statSync2,
424
+ statSync,
425
425
  createReadStream,
426
426
  openSync,
427
427
  fstatSync,
@@ -579,15 +579,12 @@ import {
579
579
  relative as nodeRelative,
580
580
  isAbsolute as nodeIsAbsolute
581
581
  } from "node:path";
582
- import { statSync } from "node:fs";
583
582
  import { fileURLToPath as fileURLToPath2 } from "node:url";
584
583
  import { isPrivateFileUnder, isSafePath, isStudioPrivatePath } from "@hyperframes/core/safe-path";
585
584
  import {
586
- isCopiedOutsideFileType,
587
- isPrivateOutsideFile,
588
- isUploadedOutsideFileType,
589
585
  leftOutWarning,
590
- linksOutside
586
+ linksOutside,
587
+ outsideLinkRefusal
591
588
  } from "@hyperframes/studio-server/outside-file";
592
589
  import { realFilePath } from "@hyperframes/studio-server/safe-path";
593
590
  var DEFAULT_RENDERS_DIR = process.env.PRODUCER_RENDERS_DIR ?? // fileURLToPath (not URL.pathname): on Windows .pathname is "/D:/..." which
@@ -608,15 +605,9 @@ function escapesAssetRoot(path, assetRoot) {
608
605
  return assetRoot !== void 0 && !isSafePath(assetRoot, path);
609
606
  }
610
607
  function outsideAssetRefusal(projectDir, path, policy = {}) {
611
- if (!linksOutside(projectDir, path)) {
612
- const privateByAnotherSpelling = !isPathInside(path, projectDir) && isPrivateFileUnder(projectDir, path, isStudioPrivatePath);
613
- return privateByAnotherSpelling ? "blocklisted" : null;
614
- }
615
- if (isPrivateOutsideFile(projectDir, path)) return "blocklisted";
616
- const folder = statSync(path, { throwIfNoEntry: false })?.isDirectory();
617
- if (folder || isUploadedOutsideFileType(path)) return null;
618
- if (!isCopiedOutsideFileType(path)) return "file_type";
619
- return policy.includeScripts ? null : "script";
608
+ if (linksOutside(projectDir, path)) return outsideLinkRefusal(projectDir, path, policy);
609
+ const privateByAnotherSpelling = !isPathInside(path, projectDir) && isPrivateFileUnder(projectDir, path, isStudioPrivatePath);
610
+ return privateByAnotherSpelling ? "blocklisted" : null;
620
611
  }
621
612
  var leftOutOfRender = (file, reference, reason) => leftOutWarning(file, reference, reason, "render");
622
613
  function refusesOutsideLink(projectDir, path, warn, policy = {}) {
@@ -1185,7 +1176,7 @@ function openRegularFile(filePath) {
1185
1176
  } catch (error) {
1186
1177
  if (error instanceof Error && "code" in error && NO_FILE_AT_NAME.has(String(error.code)))
1187
1178
  return null;
1188
- if (!statSync2(filePath, { throwIfNoEntry: false })?.isFile()) return null;
1179
+ if (!statSync(filePath, { throwIfNoEntry: false })?.isFile()) return null;
1189
1180
  throw error;
1190
1181
  }
1191
1182
  let accepted = false;
@@ -2701,7 +2692,7 @@ function replanAfterFailure(plan, failure) {
2701
2692
  }
2702
2693
 
2703
2694
  // src/services/render/stages/captureSegmentedStage.ts
2704
- import { existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync6, statSync as statSync4 } from "node:fs";
2695
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, rmSync as rmSync6, statSync as statSync3 } from "node:fs";
2705
2696
  import { join as join12 } from "node:path";
2706
2697
  import {
2707
2698
  captureFrameToBuffer as captureFrameToBuffer2,
@@ -3625,7 +3616,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
3625
3616
  }
3626
3617
 
3627
3618
  // src/services/render/stages/captureHdrResources.ts
3628
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync3, statfsSync } from "node:fs";
3619
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync3, rmSync as rmSync5, statSync as statSync2, statfsSync } from "node:fs";
3629
3620
  import {
3630
3621
  decodePngToRgb48le,
3631
3622
  extractMediaMetadata as extractMediaMetadata2,
@@ -4050,7 +4041,7 @@ async function extractHdrVideoFrames(args) {
4050
4041
  failureReason: result.failureReason
4051
4042
  });
4052
4043
  }
4053
- return Math.min(Math.floor(statSync3(spec.path).size / frameSize), spec.frames);
4044
+ return Math.min(Math.floor(statSync2(spec.path).size / frameSize), spec.frames);
4054
4045
  }
4055
4046
  });
4056
4047
  const first = await windows.lease(0);
@@ -5599,7 +5590,7 @@ async function captureSegmentToEncoder(ctx, segment) {
5599
5590
  path: segmentPath,
5600
5591
  // Recorded so resume can prove the file on disk is the one that
5601
5592
  // finished; absent only in unit tests, whose fake encoder writes none.
5602
- bytes: existsSync7(segmentPath) ? statSync4(segmentPath).size : 0,
5593
+ bytes: existsSync7(segmentPath) ? statSync3(segmentPath).size : 0,
5603
5594
  sha256: existsSync7(segmentPath) ? await hashSegmentFile(segmentPath) : ""
5604
5595
  });
5605
5596
  return encodeResult;
@@ -6661,7 +6652,7 @@ function createSegmentVideoFrames(input) {
6661
6652
  }
6662
6653
 
6663
6654
  // src/services/render/videoFrameWindow.ts
6664
- import { readdirSync as readdirSync3, statSync as statSync5 } from "node:fs";
6655
+ import { readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
6665
6656
  import { join as join16 } from "node:path";
6666
6657
  function shouldWindowVideoFrames(args) {
6667
6658
  return args.segmented && args.env.HF_VIDEO_FRAME_WINDOW?.trim().toLowerCase() === "true";
@@ -6677,7 +6668,7 @@ function directoryBytes(path) {
6677
6668
  for (const entry of entries) {
6678
6669
  const child2 = join16(path, entry.name);
6679
6670
  try {
6680
- bytes += entry.isDirectory() ? directoryBytes(child2) : statSync5(child2).size;
6671
+ bytes += entry.isDirectory() ? directoryBytes(child2) : statSync4(child2).size;
6681
6672
  } catch {
6682
6673
  }
6683
6674
  }
@@ -7387,7 +7378,7 @@ import {
7387
7378
  stylesheetLinkMatches
7388
7379
  } from "@hyperframes/parsers/css-url-scans";
7389
7380
  import { createHash as createHash6 } from "node:crypto";
7390
- import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync9, statSync as statSync8 } from "fs";
7381
+ import { createReadStream as createReadStream3, existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync9, statSync as statSync7 } from "fs";
7391
7382
  import { join as join21, dirname as dirname10, resolve as resolve8, basename as basename6, relative as relative3, sep as sep4 } from "path";
7392
7383
  import { parseHTML as parseHTML5 } from "@hyperframes/parsers/linkedom";
7393
7384
  import { compositionRootSize } from "@hyperframes/parsers";
@@ -7676,7 +7667,7 @@ import {
7676
7667
 
7677
7668
  // src/services/animatedGifPrep.ts
7678
7669
  import { createHash as createHash4, randomUUID } from "node:crypto";
7679
- import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, readFileSync as readFileSync7, rmSync as rmSync9, statSync as statSync6 } from "node:fs";
7670
+ import { copyFileSync as copyFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, readFileSync as readFileSync7, rmSync as rmSync9, statSync as statSync5 } from "node:fs";
7680
7671
  import { dirname as dirname7, isAbsolute as isAbsolute3, join as join18, resolve as resolve6 } from "node:path";
7681
7672
  import { parseHTML as parseHTML3 } from "@hyperframes/parsers/linkedom";
7682
7673
  import { parseAnimatedGifMetadata } from "@hyperframes/core";
@@ -7739,7 +7730,7 @@ function resolveLocalImageSourcePath(src, options) {
7739
7730
  }
7740
7731
  function isUsableFile(path) {
7741
7732
  try {
7742
- const stat = statSync6(path);
7733
+ const stat = statSync5(path);
7743
7734
  return stat.isFile() && stat.size > 0;
7744
7735
  } catch {
7745
7736
  return false;
@@ -7889,7 +7880,7 @@ async function ensurePreparedWebm(input) {
7889
7880
  if (!isUsableFile(tmpPath)) {
7890
7881
  throw new Error("Animated GIF transcode produced an empty output");
7891
7882
  }
7892
- if (statSync6(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP) {
7883
+ if (statSync5(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP) {
7893
7884
  throw new Error("Animated GIF transcode reached its output size limit");
7894
7885
  }
7895
7886
  if (!isUsableFile(input.cachePath)) {
@@ -8025,7 +8016,7 @@ import {
8025
8016
  readFileSync as readFileSync8,
8026
8017
  readSync as readSync3,
8027
8018
  rmSync as rmSync10,
8028
- statSync as statSync7,
8019
+ statSync as statSync6,
8029
8020
  writeFileSync as writeFileSync4
8030
8021
  } from "node:fs";
8031
8022
  import { dirname as dirname8, join as join19, resolve as resolve7 } from "node:path";
@@ -8281,7 +8272,7 @@ function resolveImageSource(src, options) {
8281
8272
  }
8282
8273
  function isUsableFile2(path) {
8283
8274
  try {
8284
- return statSync7(path).size > 0;
8275
+ return statSync6(path).size > 0;
8285
8276
  } catch {
8286
8277
  return false;
8287
8278
  }
@@ -8302,7 +8293,7 @@ async function ensurePreparedJpeg(source, cachePath, outputPath, options) {
8302
8293
  signal: options.signal
8303
8294
  });
8304
8295
  if (!isUsableFile2(tmpPath)) throw new Error("conversion produced an empty file");
8305
- if (statSync7(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP2) {
8296
+ if (statSync6(tmpPath).size >= FFMPEG_SELF_OUTPUT_BYTES_CAP2) {
8306
8297
  throw new Error("conversion reached its output size limit");
8307
8298
  }
8308
8299
  renameWithRetry3(tmpPath, cachePath);
@@ -9977,7 +9968,7 @@ async function localFontDataUri(localPath, projectDir, assetRoot, dataUriByAbsol
9977
9968
  if (dataUriByAbsolutePath.has(absPath)) return dataUriByAbsolutePath.get(absPath);
9978
9969
  const ext = absPath.match(/\.(woff2?|ttf|otf|ttc)$/i)?.[1]?.toLowerCase() ?? "ttf";
9979
9970
  try {
9980
- if (!reserve(Math.ceil(statSync8(absPath).size / 3) * 4 + 64)) {
9971
+ if (!reserve(Math.ceil(statSync7(absPath).size / 3) * 4 + 64)) {
9981
9972
  dataUriByAbsolutePath.set(absPath, void 0);
9982
9973
  return void 0;
9983
9974
  }
@@ -14994,7 +14985,7 @@ import {
14994
14985
  readdirSync as readdirSync5,
14995
14986
  readFileSync as readFileSync10,
14996
14987
  rmSync as rmSync12,
14997
- statSync as statSync9,
14988
+ statSync as statSync8,
14998
14989
  writeFileSync as writeFileSync7
14999
14990
  } from "node:fs";
15000
14991
  import { readFile as readFile2 } from "node:fs/promises";
@@ -15123,7 +15114,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
15123
15114
  const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
15124
15115
  if (failure) return failure;
15125
15116
  }
15126
- const fileSize = existsSync21(outputPath) ? statSync9(outputPath).size : 0;
15117
+ const fileSize = existsSync21(outputPath) ? statSync8(outputPath).size : 0;
15127
15118
  return {
15128
15119
  success: true,
15129
15120
  outputPath,
@@ -15537,7 +15528,7 @@ function sampleDirectoryBytes(dir) {
15537
15528
  for (const name of entries) {
15538
15529
  const full = join36(current, name);
15539
15530
  try {
15540
- const st = statSync10(full);
15531
+ const st = statSync9(full);
15541
15532
  if (st.isDirectory()) {
15542
15533
  stack.push(full);
15543
15534
  } else if (st.isFile()) {
@@ -15701,7 +15692,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
15701
15692
  let rangeStart = null;
15702
15693
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
15703
15694
  const framePath = join36(framesDir, formatCaptureFrameName(frameIndex, frameExt));
15704
- const missing = !existsSync22(framePath) || statSync10(framePath).size <= 8;
15695
+ const missing = !existsSync22(framePath) || statSync9(framePath).size <= 8;
15705
15696
  if (missing && rangeStart === null) {
15706
15697
  rangeStart = frameIndex;
15707
15698
  } else if (!missing && rangeStart !== null) {
@@ -18825,7 +18816,7 @@ async function executeRenderPipeline(input) {
18825
18816
  import {
18826
18817
  existsSync as existsSync23,
18827
18818
  readFileSync as readFileSync11,
18828
- statSync as statSync11,
18819
+ statSync as statSync10,
18829
18820
  openSync as openSync6,
18830
18821
  fstatSync as fstatSync4,
18831
18822
  closeSync as closeSync6,
@@ -18866,7 +18857,7 @@ function readEntryHtml(filePath) {
18866
18857
  } catch (error) {
18867
18858
  if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR"))
18868
18859
  return null;
18869
- if (!statSync11(filePath, { throwIfNoEntry: false })?.isFile()) return null;
18860
+ if (!statSync10(filePath, { throwIfNoEntry: false })?.isFile()) return null;
18870
18861
  throw error;
18871
18862
  }
18872
18863
  try {
@@ -18882,7 +18873,7 @@ function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
18882
18873
  }
18883
18874
  function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
18884
18875
  const absProjectDir = resolve11(projectDir);
18885
- if (!existsSync23(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
18876
+ if (!existsSync23(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
18886
18877
  return { error: `Project directory not found: ${absProjectDir}` };
18887
18878
  }
18888
18879
  const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
@@ -19847,7 +19838,7 @@ function prepareProjectDirectory(projectDir, options, policy) {
19847
19838
  if (!candidate) return null;
19848
19839
  const absProjectDir = policy ? resolve12(policy.projectsDir, candidate) : resolve12(candidate);
19849
19840
  const shown = policy ? candidate : absProjectDir;
19850
- if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync26(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
19841
+ if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync26(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
19851
19842
  return { error: `Project directory not found: ${shown}` };
19852
19843
  }
19853
19844
  const entry = options.entryFile || "index.html";
@@ -19989,7 +19980,7 @@ function publicPerfSummary(job) {
19989
19980
  return job.perfSummary ? { ...job.perfSummary, renderId: void 0 } : null;
19990
19981
  }
19991
19982
  function outputFileSize(path) {
19992
- return existsSync26(path) ? statSync12(path).size : 0;
19983
+ return existsSync26(path) ? statSync11(path).size : 0;
19993
19984
  }
19994
19985
  function createBlockingProgressReporter(log, requestId) {
19995
19986
  let lastLoggedPct = -10;
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Path resolution utilities for the render pipeline.
3
3
  */
4
- import { type LeftOutReason } from "@hyperframes/studio-server/outside-file";
4
+ import { type LeftOutReason, type OutsideFilePolicy } from "@hyperframes/studio-server/outside-file";
5
+ export type { OutsideFilePolicy };
5
6
  export interface RenderPaths {
6
7
  absoluteProjectDir: string;
7
8
  absoluteOutputPath: string;
@@ -29,10 +30,6 @@ type IsPathInsideOptions = {
29
30
  export declare function isPathInside(childPath: string, parentPath: string, options?: IsPathInsideOptions): boolean;
30
31
  /** True when `assetRoot` is set and `path`, symlinks resolved, leaves it. */
31
32
  export declare function escapesAssetRoot(path: string, assetRoot: string | undefined): boolean;
32
- export interface OutsideFilePolicy {
33
- /** The person passed --include-outside-files, so scripts outside the project run too. */
34
- includeScripts?: boolean;
35
- }
36
33
  /** Why a trusted local render leaves out `path`, which leads outside `projectDir`, as publish does; null to bring it in. */
37
34
  export declare function outsideAssetRefusal(projectDir: string, path: string, policy?: OutsideFilePolicy): LeftOutReason | null;
38
35
  export declare const leftOutOfRender: (file: string, reference: string, reason: LeftOutReason) => string;
@@ -63,4 +60,3 @@ export declare function toExternalAssetKey(absPath: string): string;
63
60
  export declare function formatCaptureFrameName(index: number, ext: string): string;
64
61
  export declare function formatExportFrameName(index: number, ext: string): string;
65
62
  export declare function resolveRenderPaths(projectDir: string, outputPath: string | null | undefined, rendersDir?: string): RenderPaths;
66
- export {};