@hyperframes/producer 0.9.61 → 0.9.64

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.
@@ -143,7 +143,7 @@ function formatExportFrameName(index, ext) {
143
143
  }
144
144
 
145
145
  // src/services/renderOrchestrator.ts
146
- import { audioFailureDiagnostics as audioFailureDiagnostics2 } from "@hyperframes/engine";
146
+ import { audioFailureDiagnostics as audioFailureDiagnostics2, usableCpuCount as usableCpuCount2 } from "@hyperframes/engine";
147
147
  import {
148
148
  existsSync as existsSync14,
149
149
  mkdirSync as mkdirSync6,
@@ -399,7 +399,10 @@ import { Readable } from "node:stream";
399
399
  import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
400
400
  import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
401
401
  import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
402
- import { PREVIEW_FOR_ANOTHER_SITE_META } from "@hyperframes/core/studio-preview-mark";
402
+ import {
403
+ PREVIEW_FOR_ANOTHER_SITE_META,
404
+ serviceWorkerScriptFetch
405
+ } from "@hyperframes/core/studio-preview-mark";
403
406
  import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
404
407
  import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
405
408
  import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
@@ -1058,6 +1061,12 @@ function createFileServer(options) {
1058
1061
  c.res.headers.set("X-Content-Type-Options", "nosniff");
1059
1062
  });
1060
1063
  answerOwnLoopbackHostOnly(app, () => listeningPort);
1064
+ app.use(async function refuseServiceWorkerScripts(c, next) {
1065
+ const serviceWorker = c.req.header("service-worker");
1066
+ if (!serviceWorkerScriptFetch({ serviceWorker, fetchDest: c.req.header("sec-fetch-dest") }))
1067
+ return next();
1068
+ return c.text("Forbidden", 403);
1069
+ });
1061
1070
  app.get("/*", async (c) => {
1062
1071
  let requestPath = c.req.path;
1063
1072
  if (requestPath === "/") requestPath = "/index.html";
@@ -3652,16 +3661,23 @@ function assertOutsideMarkupAsked(projectDir, filePath, srcPath, assetRoot, outs
3652
3661
  }
3653
3662
  }
3654
3663
  var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
3655
- var mountSrcsUnder = (root) => [...root.querySelectorAll("[data-composition-src]")].map((el) => el.getAttribute("data-composition-src")).filter((srcPath) => !!srcPath && !isUnresolvedAssetPlaceholder(srcPath));
3656
3664
  function compositionSrcsIn(html) {
3657
3665
  const { document: document2 } = parseHTML5(html);
3666
+ const mounts = [];
3658
3667
  const templated = [];
3659
- const templates = [...document2.querySelectorAll("template")];
3660
- for (let template = templates.pop(); template; template = templates.pop()) {
3661
- templated.push(...mountSrcsUnder(template.content));
3662
- templates.push(...template.content.querySelectorAll("template"));
3668
+ const stack = [...document2.children].reverse().map((el) => [el, false]);
3669
+ for (let next = stack.pop(); next; next = stack.pop()) {
3670
+ const [el, inTemplate] = next;
3671
+ const srcPath = el.getAttribute("data-composition-src");
3672
+ if (srcPath && !isUnresolvedAssetPlaceholder(srcPath)) {
3673
+ (inTemplate ? templated : mounts).push(srcPath);
3674
+ }
3675
+ const childrenInTemplate = inTemplate || el.localName === "template";
3676
+ const children = [...el.children];
3677
+ for (let i = children.length - 1; i >= 0; i -= 1)
3678
+ stack.push([children[i], childrenInTemplate]);
3663
3679
  }
3664
- return { mounts: mountSrcsUnder(document2), templated };
3680
+ return { mounts, templated };
3665
3681
  }
3666
3682
  function compositionPathProblem(projectDir, filePath, assetRoot, outsideFiles) {
3667
3683
  if (outsideAssetRefusal(projectDir, filePath) === "blocklisted") {
@@ -8390,7 +8406,7 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
8390
8406
  error: String(failure ?? result?.error)
8391
8407
  }
8392
8408
  );
8393
- return runEncodeStage(input);
8409
+ return runEncodeStage({ ...input, hasAudio: false });
8394
8410
  },
8395
8411
  abort: async () => {
8396
8412
  stop.abort();
@@ -12830,7 +12846,7 @@ import {
12830
12846
  probeBeginFrameLiveness as probeBeginFrameLiveness2,
12831
12847
  readWebGlVendorInfoFromCanvas,
12832
12848
  resolveConfig as resolveConfig5,
12833
- usableCpuCount as usableCpuCount2
12849
+ usableCpuCount as usableCpuCount3
12834
12850
  } from "@hyperframes/engine";
12835
12851
  import { readWebGlVendorInfoFromCanvas as readWebGlVendorInfoFromCanvas2 } from "@hyperframes/engine";
12836
12852
  var LEGACY_DISTRIBUTED_VP9_CPU_USED = 2;
@@ -13360,9 +13376,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
13360
13376
  const captureSession = session;
13361
13377
  session = null;
13362
13378
  verifyStarted = Date.now();
13363
- overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, usableCpuCount2()) ? encodeWhileCapturing(encodeInput, framesInChunk, {
13379
+ overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, usableCpuCount3()) ? encodeWhileCapturing(encodeInput, framesInChunk, {
13364
13380
  workerCount: chunkWorkerCount,
13365
- cpuCount: usableCpuCount2()
13381
+ cpuCount: usableCpuCount3()
13366
13382
  }) : null;
13367
13383
  await observeRenderStage(
13368
13384
  new RenderObservabilityRecorder({ pipelineStartMs: start, log }),
@@ -13874,7 +13890,8 @@ function statEntry(full, relPath) {
13874
13890
  throw new Error(`[listSiteFiles] cannot read ${relPath} (dangling symlink?)`, { cause: err });
13875
13891
  }
13876
13892
  }
13877
- function listSiteFiles(projectDir, onPrivate, onOutside) {
13893
+ function listSiteFiles(projectDir, onPrivate, onOutside = () => {
13894
+ }) {
13878
13895
  const files = [];
13879
13896
  const root = realpathSync2(projectDir);
13880
13897
  const ancestors = /* @__PURE__ */ new Set([root]);
@@ -13882,7 +13899,9 @@ function listSiteFiles(projectDir, onPrivate, onOutside) {
13882
13899
  if (isPrivateFileUnder3(projectDir, full, isStudioPrivatePath3)) return void onPrivate?.(relPath);
13883
13900
  const stat = statEntry(full, relPath);
13884
13901
  if (!stat.isFile() && !stat.isDirectory()) return;
13885
- if (onOutside && outsideFolder(root, realpathSync2(full))) return void onOutside(relPath);
13902
+ if (onOutside !== "include" && outsideFolder(root, realpathSync2(full))) {
13903
+ return void onOutside(relPath);
13904
+ }
13886
13905
  if (stat.isFile()) return void files.push(relPath);
13887
13906
  const real = realpathSync2(full);
13888
13907
  if (ancestors.has(real)) return;
@@ -13905,22 +13924,22 @@ var printablePath = (path) => [...path].map((ch) => {
13905
13924
  const control = code < 32 && code !== 9 || code >= 127 && code <= 159;
13906
13925
  return control ? `\\x${code.toString(16).padStart(2, "0")}` : ch;
13907
13926
  }).join("");
13908
- function listSiteFilesForUpload(projectDir, onNotice, includeOutsideFiles = false) {
13927
+ function listSiteFilesForUpload(projectDir, onNotice = (message) => console.warn(message), includeOutsideFiles = false) {
13909
13928
  const leftOut = [];
13910
13929
  const outside = [];
13911
13930
  const files = listSiteFiles(
13912
13931
  projectDir,
13913
13932
  (path) => leftOut.push(path),
13914
- includeOutsideFiles ? void 0 : (path) => outside.push(path)
13933
+ includeOutsideFiles ? "include" : (path) => outside.push(path)
13915
13934
  );
13916
13935
  if (leftOut.length > 0) {
13917
13936
  const more = leftOut.length > 5 ? ` and ${leftOut.length - 5} more` : "";
13918
- onNotice?.(
13937
+ onNotice(
13919
13938
  `[deploySite] left out private files no composition loads (env, Git, credentials, tool state): ${leftOut.slice(0, 5).map(printablePath).join(", ")}${more}`
13920
13939
  );
13921
13940
  }
13922
13941
  if (outside.length > 0) {
13923
- onNotice?.(
13942
+ onNotice(
13924
13943
  `[deploySite] left out files linked in from outside the project: ${outside.map(printablePath).join(", ")}. Pass --include-outside-files (includeOutsideFiles in the SDK) to upload them.`
13925
13944
  );
13926
13945
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "f76d696c6c5f7b052ef85a8ea93b3cea91bfa744211c38732c09dd1a7a7c05c9",
4
+ "sha256": "9908c266bf0c428907be35f907a443dd2d6d3fe4c2706f935269903361f95c30",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"