@hyperframes/producer 0.9.33 → 0.9.35

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.
@@ -2248,6 +2248,7 @@ import {
2248
2248
  readTextFile,
2249
2249
  resolveCompositionSrc
2250
2250
  } from "@hyperframes/parsers/asset-resolution";
2251
+ import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
2251
2252
 
2252
2253
  // src/services/renderMediaCollector.ts
2253
2254
  import { parseHTML as parseHTML2 } from "linkedom";
@@ -3245,6 +3246,7 @@ function normalizeCompositionSrcs(html, projectDir) {
3245
3246
  return `${name}${quote}${relative2(projectDir, file).split(sep2).join("/")}${quote}`;
3246
3247
  });
3247
3248
  }
3249
+ var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder(projectDir, filePath, isVcsOrSecretPath);
3248
3250
  function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */ new Set()) {
3249
3251
  const { document: document2 } = parseHTML5(html);
3250
3252
  const hosts = [...document2.querySelectorAll("[data-composition-src]")];
@@ -3258,6 +3260,10 @@ function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */
3258
3260
  problems.push({ srcPath, detail: "it is outside the project folder" });
3259
3261
  continue;
3260
3262
  }
3263
+ if (isPrivateCompositionFile(projectDir, filePath)) {
3264
+ problems.push({ srcPath, detail: "it is git metadata or an env file" });
3265
+ continue;
3266
+ }
3261
3267
  if (visited.has(filePath)) continue;
3262
3268
  const read = readProjectFile(filePath);
3263
3269
  if (read.kind === "missing") {
@@ -3561,7 +3567,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
3561
3567
  const srcPath = el.getAttribute("data-composition-src");
3562
3568
  if (!srcPath) continue;
3563
3569
  const filePath = resolveCompositionSrc(projectDir, srcPath);
3564
- if (filePath === null) continue;
3570
+ if (filePath === null || isPrivateCompositionFile(projectDir, filePath)) continue;
3565
3571
  if (visited.has(filePath)) {
3566
3572
  continue;
3567
3573
  }
@@ -3758,7 +3764,7 @@ function inlineSubCompositions(html, subCompositions, projectDir, variableOverri
3758
3764
  let compHtml = subCompositions.get(srcPath) || null;
3759
3765
  if (!compHtml) {
3760
3766
  const filePath = resolveCompositionSrc(projectDir, srcPath);
3761
- const read = filePath ? readProjectFile(filePath) : null;
3767
+ const read = filePath && !isPrivateCompositionFile(projectDir, filePath) ? readProjectFile(filePath) : null;
3762
3768
  if (read?.kind === "file") {
3763
3769
  compHtml = rewriteUnresolvableGsapToCdn(read.text, projectDir, srcPath);
3764
3770
  }
@@ -5254,8 +5260,15 @@ function hasRuntimeMediaChanges(html) {
5254
5260
  }
5255
5261
  return false;
5256
5262
  }
5263
+ function checksVariablesInBrowser(config) {
5264
+ return config.strictVariables === true && Object.keys(config.variables ?? {}).length > 0;
5265
+ }
5266
+ function strictVariablesAttestation(config, probeSession) {
5267
+ if (config.strictVariables !== true) return void 0;
5268
+ return !checksVariablesInBrowser(config) || probeSession?.strictVariablesChecked === true;
5269
+ }
5257
5270
  function probeRequiresBrowser(args) {
5258
- return args.durationSeconds <= 0 || args.unresolvedCompositionCount > 0 || args.hasAutoStart || args.hasScriptedAudio || args.hasVariableMedia || args.hasInsertedMedia;
5271
+ return args.requiresVariablesCheck === true || args.durationSeconds <= 0 || args.unresolvedCompositionCount > 0 || args.hasAutoStart || args.hasScriptedAudio || args.hasVariableMedia || args.hasInsertedMedia;
5259
5272
  }
5260
5273
  function reportedLengthSource(source) {
5261
5274
  if (!source) return null;
@@ -5303,7 +5316,8 @@ async function runProbeStage(input) {
5303
5316
  hasAutoStart,
5304
5317
  hasScriptedAudio,
5305
5318
  hasVariableMedia,
5306
- hasInsertedMedia
5319
+ hasInsertedMedia,
5320
+ requiresVariablesCheck: checksVariablesInBrowser(job.config)
5307
5321
  });
5308
5322
  try {
5309
5323
  if (needsBrowser) {
@@ -5337,6 +5351,7 @@ async function runProbeStage(input) {
5337
5351
  job.config.quality
5338
5352
  ),
5339
5353
  variables: job.config.variables,
5354
+ strictVariables: job.config.strictVariables,
5340
5355
  deviceScaleFactor,
5341
5356
  motionBlur,
5342
5357
  pageMotionBlur: job.config.pageMotionBlur,
@@ -5742,6 +5757,7 @@ async function runProbeStage(input) {
5742
5757
  }
5743
5758
  }
5744
5759
  return {
5760
+ strictVariablesChecked: strictVariablesAttestation(job.config, probeSession),
5745
5761
  compiled,
5746
5762
  fileServer,
5747
5763
  probeSession,
@@ -8502,6 +8518,7 @@ function buildSyntheticRenderJob(input) {
8502
8518
  strictness: input.strictness,
8503
8519
  producerConfig: input.producerConfig,
8504
8520
  variables: input.variables,
8521
+ strictVariables: input.strictVariables,
8505
8522
  pageMotionBlur: input.pageMotionBlur
8506
8523
  };
8507
8524
  return createRenderJob(renderConfig);
@@ -10365,6 +10382,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
10365
10382
  logger: config.logger,
10366
10383
  producerConfig: cfg,
10367
10384
  variables: config.variables,
10385
+ strictVariables: config.strictVariables,
10368
10386
  pageMotionBlur: config.pageMotionBlur
10369
10387
  });
10370
10388
  const entryFile = config.entryFile ?? "index.html";
@@ -10477,6 +10495,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
10477
10495
  logPlanStage(log, "reference_background", stageStarted);
10478
10496
  }
10479
10497
  compiled = probeResult.compiled;
10498
+ job.strictVariablesChecked = probeResult.strictVariablesChecked;
10480
10499
  job.duration = probeResult.duration;
10481
10500
  job.totalFrames = probeResult.totalFrames;
10482
10501
  const totalFrames = probeResult.totalFrames;
@@ -10824,7 +10843,8 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
10824
10843
  height,
10825
10844
  format: config.format,
10826
10845
  ffmpegVersion,
10827
- producerVersion
10846
+ producerVersion,
10847
+ ...job.strictVariablesChecked === void 0 ? {} : { strictVariablesChecked: job.strictVariablesChecked }
10828
10848
  };
10829
10849
  }
10830
10850
  async function buildPlanAudio(projectDir, config, workRoot, outputPath, options = {}) {
@@ -11434,7 +11454,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
11434
11454
  const stagingRoot = createStagingDir6(options.stagingParentDir ?? tmpdir(), ".execution-plan-");
11435
11455
  const digests = /* @__PURE__ */ new Map();
11436
11456
  try {
11437
- await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
11457
+ const planned = await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
11438
11458
  executionPlanSizeLimitBytes: Number.MAX_SAFE_INTEGER,
11439
11459
  deferVideoExtraction: true,
11440
11460
  remoteFiles: options.remoteFiles,
@@ -11450,6 +11470,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
11450
11470
  sliceChunkAudio: true,
11451
11471
  deferAudio: options.deferAudio
11452
11472
  });
11473
+ options.onPlanned?.({ strictVariablesChecked: planned.strictVariablesChecked });
11453
11474
  return await publishExecutionPlan(stagingRoot, publisher, { digests, log: config.logger });
11454
11475
  } catch (error) {
11455
11476
  try {
@@ -13033,6 +13054,9 @@ function validateDistributedRenderConfig(config) {
13033
13054
  if (config.variables !== void 0) {
13034
13055
  validateVariablesPayload(config.variables);
13035
13056
  }
13057
+ if (config.strictVariables !== void 0 && typeof config.strictVariables !== "boolean") {
13058
+ throw new InvalidConfigError("config.strictVariables", "must be a boolean");
13059
+ }
13036
13060
  if (config.engineConfig !== void 0) {
13037
13061
  try {
13038
13062
  validateEngineConfigSnapshot(config.engineConfig);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "43e6217729301c467e1ae43d8cc1ec8ad1c0c9c1d483e0c60227b8348ff7ba7e",
4
+ "sha256": "829e51fed8f17ae34c6be9aead791e6370c28e9c809255971a9b4e8b2332a47e",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"