@hyperframes/producer 0.9.25 → 0.9.27

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.
@@ -1333,6 +1333,7 @@ import {
1333
1333
 
1334
1334
  // src/services/render/renderDirOwner.ts
1335
1335
  import { RENDER_TEMP_DIR } from "@hyperframes/core/project-folders";
1336
+ import { createStagingDir } from "@hyperframes/core/atomic-file";
1336
1337
 
1337
1338
  // src/services/render/capturePlan.ts
1338
1339
  function assertWorkerCount(workerCount) {
@@ -1484,6 +1485,7 @@ import {
1484
1485
  videoStartOnMediaTimeline
1485
1486
  } from "@hyperframes/engine";
1486
1487
  import { fpsToFfmpegArg, fpsToNumber as fpsToNumber3 } from "@hyperframes/core";
1488
+ import { createStagingDir as createStagingDir2 } from "@hyperframes/core/atomic-file";
1487
1489
  var BYTES_PER_MIB = 1024 * 1024;
1488
1490
  var DEFAULT_HDR_WINDOW_BYTES = 512 * BYTES_PER_MIB;
1489
1491
 
@@ -6218,7 +6220,6 @@ import {
6218
6220
 
6219
6221
  // src/services/render/audioPadTrim.ts
6220
6222
  import { spawn } from "node:child_process";
6221
- import { mkdtempSync } from "node:fs";
6222
6223
  import { dirname as dirname7, join as join11 } from "node:path";
6223
6224
  import {
6224
6225
  DEFAULT_CONFIG,
@@ -6326,6 +6327,7 @@ async function measureTruePeakDbfs(audioPath, options) {
6326
6327
  }
6327
6328
 
6328
6329
  // src/services/render/audioPadTrim.ts
6330
+ import { createStagingDir as createStagingDir3 } from "@hyperframes/core/atomic-file";
6329
6331
  var AUDIO_DURATION_TOLERANCE_SECONDS = 1e-3;
6330
6332
  var AAC_DELIVERY_TRUE_PEAK_DBFS = -1;
6331
6333
  var AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB = 0.5;
@@ -6512,7 +6514,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
6512
6514
  async function enforceAacTruePeak(input) {
6513
6515
  let scratchDir;
6514
6516
  try {
6515
- scratchDir = mkdtempSync(join11(dirname7(input.audioPath), ".true-peak-"));
6517
+ scratchDir = createStagingDir3(dirname7(input.audioPath), ".true-peak-");
6516
6518
  const correctedPath = join11(scratchDir, "audio.m4a");
6517
6519
  const measurements = [];
6518
6520
  let attenuationDb = 0;
@@ -8394,7 +8396,7 @@ function buildSyntheticRenderJob(input) {
8394
8396
  strictness: input.strictness,
8395
8397
  producerConfig: input.producerConfig,
8396
8398
  variables: input.variables,
8397
- pageMotionBlur: "off"
8399
+ pageMotionBlur: input.pageMotionBlur
8398
8400
  };
8399
8401
  return createRenderJob(renderConfig);
8400
8402
  }
@@ -8511,7 +8513,7 @@ function buildChunkCaptureOptions(input) {
8511
8513
  skipReadinessVideoIds: input.skipReadinessVideoIds,
8512
8514
  videoMetadataHints: input.videoMetadataHints,
8513
8515
  ...videoCaptureBeyondViewport !== void 0 ? { captureBeyondViewport: videoCaptureBeyondViewport } : {},
8514
- pageMotionBlur: encoder.pageMotionBlur ?? "distributed-render",
8516
+ pageMotionBlur: encoder.pageMotionBlur,
8515
8517
  // A fixed warmup count keeps `beginFrameTimeTicks` host-independent.
8516
8518
  lockWarmupTicks: true,
8517
8519
  requiresWebGpu: compositionRequiresWebGpu3(input.html)
@@ -9148,11 +9150,12 @@ import { join as join23 } from "node:path";
9148
9150
  import { appendRenderProvenanceArgs, describeFfmpegFailure as describeFfmpegFailure4, runFfmpeg as runFfmpeg7 } from "@hyperframes/engine";
9149
9151
 
9150
9152
  // src/services/distributed/mp4Stitch.ts
9151
- import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync2, rmSync as rmSync6 } from "node:fs";
9153
+ import { createReadStream as createReadStream4, createWriteStream, mkdirSync as mkdirSync8, rmSync as rmSync6 } from "node:fs";
9152
9154
  import { open } from "node:fs/promises";
9153
9155
  import { renameWithRetry as renameWithRetry7 } from "@hyperframes/engine";
9154
- import { dirname as dirname12, join as join22 } from "node:path";
9156
+ import { basename as basename5, dirname as dirname12, join as join22 } from "node:path";
9155
9157
  import { finished, pipeline } from "node:stream/promises";
9158
+ import { createStagingDir as createStagingDir4 } from "@hyperframes/core/atomic-file";
9156
9159
  function boxAt(src, off, at, limit) {
9157
9160
  let size = src.readUInt32BE(off);
9158
9161
  let bodyStart = at + 8;
@@ -9516,7 +9519,7 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
9516
9519
  const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
9517
9520
  const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
9518
9521
  mkdirSync8(dirname12(outputPath), { recursive: true });
9519
- const workDir = mkdtempSync2(`${outputPath}.stitch-`);
9522
+ const workDir = createStagingDir4(dirname12(outputPath), `${basename5(outputPath)}.stitch-`);
9520
9523
  const out = createWriteStream(join22(workDir, "out.mp4"));
9521
9524
  try {
9522
9525
  out.write(header);
@@ -10255,7 +10258,8 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
10255
10258
  entryFile: config.entryFile ?? "index.html",
10256
10259
  logger: config.logger,
10257
10260
  producerConfig: cfg,
10258
- variables: config.variables
10261
+ variables: config.variables,
10262
+ pageMotionBlur: config.pageMotionBlur
10259
10263
  });
10260
10264
  const entryFile = config.entryFile ?? "index.html";
10261
10265
  const htmlPath = join25(projectDir, entryFile);
@@ -10750,7 +10754,6 @@ import {
10750
10754
  existsSync as existsSync21,
10751
10755
  lstatSync as lstatSync2,
10752
10756
  mkdirSync as mkdirSync12,
10753
- mkdtempSync as mkdtempSync4,
10754
10757
  readFileSync as readFileSync9,
10755
10758
  readdirSync as readdirSync7,
10756
10759
  rmSync as rmSync9,
@@ -10768,7 +10771,6 @@ import {
10768
10771
  existsSync as existsSync20,
10769
10772
  linkSync as linkSync2,
10770
10773
  mkdirSync as mkdirSync11,
10771
- mkdtempSync as mkdtempSync3,
10772
10774
  rmSync as rmSync8,
10773
10775
  statSync as statSync6,
10774
10776
  writeFileSync as writeFileSync9
@@ -10803,6 +10805,7 @@ function planV2BlobPath(root, sha256) {
10803
10805
  }
10804
10806
 
10805
10807
  // src/services/distributed/planV2Publisher.ts
10808
+ import { createStagingDir as createStagingDir5 } from "@hyperframes/core/atomic-file";
10806
10809
  function canFallbackToCopy(error) {
10807
10810
  if (!(error instanceof Error) || !("code" in error)) return false;
10808
10811
  const code = error.code;
@@ -10840,7 +10843,7 @@ var LocalPlanV2ArtifactPublisher = class {
10840
10843
  this.destinationDir = destinationDir;
10841
10844
  this.#linkFile = options.linkFile ?? linkSync2;
10842
10845
  mkdirSync11(dirname13(destinationDir), { recursive: true });
10843
- this.temporaryDir = mkdtempSync3(join27(dirname13(destinationDir), ".plan-v2-publish-"));
10846
+ this.temporaryDir = createStagingDir5(dirname13(destinationDir), ".plan-v2-publish-");
10844
10847
  }
10845
10848
  async putBlob(blob) {
10846
10849
  const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
@@ -10853,7 +10856,7 @@ var LocalPlanV2ArtifactPublisher = class {
10853
10856
  const destinationPath = planV2BlobPath(this.temporaryDir, digest);
10854
10857
  if (existsSync20(destinationPath)) return;
10855
10858
  mkdirSync11(dirname13(destinationPath), { recursive: true });
10856
- const stagingDir = mkdtempSync3(join27(dirname13(destinationPath), ".plan-v2-blob-"));
10859
+ const stagingDir = createStagingDir5(dirname13(destinationPath), ".plan-v2-blob-");
10857
10860
  const temporaryPath = join27(stagingDir, "blob");
10858
10861
  try {
10859
10862
  try {
@@ -10887,6 +10890,7 @@ var LocalPlanV2ArtifactPublisher = class {
10887
10890
  };
10888
10891
 
10889
10892
  // src/services/distributed/planV2.ts
10893
+ import { createStagingDir as createStagingDir6 } from "@hyperframes/core/atomic-file";
10890
10894
  var PLAN_V2_HASH_PREFIX = "hyperframes-plan-manifest-hash-v2\0";
10891
10895
  var EXTRACTION_CACHE_COMPLETE_SENTINEL = ".hf-complete";
10892
10896
  var PLAN_V2_MATERIALIZATION_MARKER = ".hyperframes-plan-v2.json";
@@ -11144,7 +11148,7 @@ function computeManifestHash(manifest) {
11144
11148
  function writeBlob(sourcePath, destinationPath) {
11145
11149
  if (existsSync21(destinationPath)) return;
11146
11150
  mkdirSync12(dirname14(destinationPath), { recursive: true });
11147
- const temporaryDir = mkdtempSync4(join28(dirname14(destinationPath), ".plan-v2-blob-"));
11151
+ const temporaryDir = createStagingDir6(dirname14(destinationPath), ".plan-v2-blob-");
11148
11152
  const temporaryPath = join28(temporaryDir, "blob");
11149
11153
  try {
11150
11154
  copyFileSync8(sourcePath, temporaryPath);
@@ -11270,7 +11274,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
11270
11274
  throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
11271
11275
  }
11272
11276
  mkdirSync12(dirname14(planV2Dir), { recursive: true });
11273
- const tempDir = mkdtempSync4(join28(dirname14(planV2Dir), ".plan-v2-build-"));
11277
+ const tempDir = createStagingDir6(dirname14(planV2Dir), ".plan-v2-build-");
11274
11278
  try {
11275
11279
  for (const blob of publication.blobs) {
11276
11280
  writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
@@ -11317,7 +11321,7 @@ async function publishExecutionPlan(executionPlanDir, publisher, { digests, log
11317
11321
  }
11318
11322
  }
11319
11323
  async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
11320
- const stagingRoot = mkdtempSync4(join28(options.stagingParentDir ?? tmpdir(), ".execution-plan-"));
11324
+ const stagingRoot = createStagingDir6(options.stagingParentDir ?? tmpdir(), ".execution-plan-");
11321
11325
  const digests = /* @__PURE__ */ new Map();
11322
11326
  try {
11323
11327
  await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
@@ -11547,7 +11551,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
11547
11551
  sourcePath: verifyBlob(planV2Dir, artifact)
11548
11552
  }));
11549
11553
  mkdirSync12(dirname14(destinationDir), { recursive: true });
11550
- const tempDir = mkdtempSync4(join28(dirname14(destinationDir), ".plan-v2-materialize-"));
11554
+ const tempDir = createStagingDir6(dirname14(destinationDir), ".plan-v2-materialize-");
11551
11555
  try {
11552
11556
  for (const { artifact, sourcePath } of verified) {
11553
11557
  const destinationPath = join28(tempDir, ...artifact.path.split("/"));
@@ -11630,7 +11634,7 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
11630
11634
  }
11631
11635
 
11632
11636
  // src/services/distributed/planV2Execution.ts
11633
- import { mkdtempSync as mkdtempSync6, rmSync as rmSync12 } from "node:fs";
11637
+ import { mkdtempSync, rmSync as rmSync12 } from "node:fs";
11634
11638
  import { tmpdir as tmpdir2 } from "node:os";
11635
11639
  import { join as join31 } from "node:path";
11636
11640
 
@@ -11643,14 +11647,13 @@ import {
11643
11647
  cpSync as cpSync3,
11644
11648
  existsSync as existsSync22,
11645
11649
  mkdirSync as mkdirSync13,
11646
- mkdtempSync as mkdtempSync5,
11647
11650
  readFileSync as readFileSync10,
11648
11651
  readdirSync as readdirSync8,
11649
11652
  rmSync as rmSync10,
11650
11653
  statSync as statSync8,
11651
11654
  writeFileSync as writeFileSync11
11652
11655
  } from "node:fs";
11653
- import { dirname as dirname15, join as join29 } from "node:path";
11656
+ import { basename as basename6, dirname as dirname15, join as join29 } from "node:path";
11654
11657
  import {
11655
11658
  appendRateCapArgs as appendRateCapArgs2,
11656
11659
  appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
@@ -11664,6 +11667,7 @@ import {
11664
11667
  renameWithRetry as renameWithRetry11
11665
11668
  } from "@hyperframes/engine";
11666
11669
  import { fpsToFfmpegArg as fpsToFfmpegArg3 } from "@hyperframes/core";
11670
+ import { createStagingDir as createStagingDir7 } from "@hyperframes/core/atomic-file";
11667
11671
  function cfrRateControlArgs(locked) {
11668
11672
  const preset = getEncoderPreset5(locked.quality ?? "standard", "mp4");
11669
11673
  if (locked.crf == null && locked.bitrate) {
@@ -11699,7 +11703,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
11699
11703
  if (!existsSync22(dirname15(outputPath))) {
11700
11704
  mkdirSync13(dirname15(outputPath), { recursive: true });
11701
11705
  }
11702
- const workDir = mkdtempSync5(`${outputPath}.assemble-work-`);
11706
+ const workDir = createStagingDir7(dirname15(outputPath), `${basename6(outputPath)}.assemble-work-`);
11703
11707
  const fps = { num: plan.dimensions.fpsNum, den: plan.dimensions.fpsDen };
11704
11708
  const stageMs = {};
11705
11709
  const ctx = {
@@ -12234,7 +12238,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
12234
12238
  crf: encoder.crf,
12235
12239
  bitrate: encoder.bitrate,
12236
12240
  hdrMode: "force-sdr",
12237
- entryFile: "index.html"
12241
+ entryFile: "index.html",
12242
+ pageMotionBlur: encoder.pageMotionBlur
12238
12243
  });
12239
12244
  job.totalFrames = framesInChunk;
12240
12245
  job.duration = framesInChunk * plan.dimensions.fpsDen / plan.dimensions.fpsNum;
@@ -12688,7 +12693,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
12688
12693
 
12689
12694
  // src/services/distributed/planV2Execution.ts
12690
12695
  async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
12691
- const workRoot = mkdtempSync6(join31(tmpdir2(), "hf-plan-v2-chunk-"));
12696
+ const workRoot = mkdtempSync(join31(tmpdir2(), "hf-plan-v2-chunk-"));
12692
12697
  const materializedPlanDir = join31(workRoot, "plan");
12693
12698
  try {
12694
12699
  materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
@@ -12698,7 +12703,7 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
12698
12703
  }
12699
12704
  }
12700
12705
  async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
12701
- const workRoot = mkdtempSync6(join31(tmpdir2(), "hf-plan-v2-assembler-"));
12706
+ const workRoot = mkdtempSync(join31(tmpdir2(), "hf-plan-v2-assembler-"));
12702
12707
  const materializedPlanDir = join31(workRoot, "plan");
12703
12708
  try {
12704
12709
  const materialized = materializePlanV2Target(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "45f46e9913dc55f109773ed9565b251a21bb466671e246bb489abd72c2c08069",
4
+ "sha256": "4219dc246b9277eea209b849aff15c3fd5ca7e104c7e61f8a7ffb553bde31c8a",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"