hyperframes 0.8.14 → 0.8.15

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.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runtimeVersionError } from "../dist/runtimeVersion.js";
4
+
5
+ const error = runtimeVersionError(process.versions.node);
6
+ if (error) {
7
+ console.error(error);
8
+ process.exitCode = 1;
9
+ } else {
10
+ const { main } = await import("../dist/fontLocalizeCli.js");
11
+ process.exitCode = await main();
12
+ }
package/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ var VERSION;
50
50
  var init_version = __esm({
51
51
  "src/version.ts"() {
52
52
  "use strict";
53
- VERSION = true ? "0.8.14" : "0.0.0-dev";
53
+ VERSION = true ? "0.8.15" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -80081,13 +80081,7 @@ function readDecodedAttr(tagSource, attr2) {
80081
80081
  return value;
80082
80082
  }
80083
80083
  function readJsonAttr(tagSource, attr2) {
80084
- if (!tagSource) return null;
80085
- const escaped = attr2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
80086
- const match = tagSource.match(
80087
- new RegExp(`(?<![\\w-])${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i")
80088
- );
80089
- if (!match) return null;
80090
- return match[1] ?? match[2] ?? null;
80084
+ return readDecodedAttr(tagSource, attr2);
80091
80085
  }
80092
80086
  function collectCompositionIds(tags) {
80093
80087
  const ids = /* @__PURE__ */ new Set();
@@ -90705,6 +90699,24 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
90705
90699
  function shouldVerifyWorkerGpu(workerId, config) {
90706
90700
  return config?.browserGpuMode === "software" && workerId === 0;
90707
90701
  }
90702
+ function raceAgainstAbort(promise, signal) {
90703
+ if (!signal) return promise;
90704
+ if (signal.aborted) return Promise.reject(new Error("Parallel worker cancelled"));
90705
+ return new Promise((resolve79, reject2) => {
90706
+ const onAbort = () => reject2(new Error("Parallel worker cancelled"));
90707
+ signal.addEventListener("abort", onAbort, { once: true });
90708
+ promise.then(
90709
+ (value) => {
90710
+ signal.removeEventListener("abort", onAbort);
90711
+ resolve79(value);
90712
+ },
90713
+ (error) => {
90714
+ signal.removeEventListener("abort", onAbort);
90715
+ reject2(error);
90716
+ }
90717
+ );
90718
+ });
90719
+ }
90708
90720
  async function captureFrameRange(session, task, captureOptions, signal, onFrameCaptured, onFrameBuffer) {
90709
90721
  let framesCaptured = 0;
90710
90722
  const outputOffset = task.outputFrameOffset ?? 0;
@@ -90720,7 +90732,10 @@ async function captureFrameRange(session, task, captureOptions, signal, onFrameC
90720
90732
  if (dbg && i2 < task.startFrame + dbgWin) {
90721
90733
  console.log(`[par:w${task.workerId}] +${Date.now() - dbgT0}ms produce ${i2} start`);
90722
90734
  }
90723
- const { encodeResult } = await captureFrameToBufferPipelined(session, i2 - outputOffset, time);
90735
+ const { encodeResult } = await raceAgainstAbort(
90736
+ captureFrameToBufferPipelined(session, i2 - outputOffset, time),
90737
+ signal
90738
+ );
90724
90739
  encodeResult.catch(() => {
90725
90740
  });
90726
90741
  if (dbg && i2 < task.startFrame + dbgWin) {
@@ -90759,10 +90774,13 @@ async function captureFrameRange(session, task, captureOptions, signal, onFrameC
90759
90774
  const time = i2 * captureOptions.fps.den / captureOptions.fps.num;
90760
90775
  const fileFrameIdx = i2 - outputOffset;
90761
90776
  if (onFrameBuffer) {
90762
- const { buffer } = await captureFrameToBuffer(session, fileFrameIdx, time);
90777
+ const { buffer } = await raceAgainstAbort(
90778
+ captureFrameToBuffer(session, fileFrameIdx, time),
90779
+ signal
90780
+ );
90763
90781
  await onFrameBuffer(i2, buffer, session);
90764
90782
  } else {
90765
- await captureFrame(session, fileFrameIdx, time);
90783
+ await raceAgainstAbort(captureFrame(session, fileFrameIdx, time), signal);
90766
90784
  }
90767
90785
  framesCaptured++;
90768
90786
  if (onFrameCaptured) onFrameCaptured(task.workerId, i2);
@@ -122382,10 +122400,16 @@ async function fetchGoogleFont(familyName, options, fontText) {
122382
122400
  function extractGoogleFontsText(html) {
122383
122401
  const { document: document2 } = parseHTML(html);
122384
122402
  const decodedBodyText = document2.body?.textContent ?? "";
122385
- const uniqueCharacters = [.../* @__PURE__ */ new Set([...Array.from(html), ...Array.from(decodedBodyText)])].join(
122386
- ""
122387
- );
122388
- return encodeURIComponent(uniqueCharacters).length <= GOOGLE_FONTS_TEXT_MAX_ENCODED_LENGTH ? uniqueCharacters : void 0;
122403
+ const characters = [...Array.from(html), ...Array.from(decodedBodyText)];
122404
+ const uniqueCharacters = /* @__PURE__ */ new Set();
122405
+ for (const character of characters) {
122406
+ uniqueCharacters.add(character);
122407
+ for (const variant of `${character.toUpperCase()}${character.toLowerCase()}`) {
122408
+ uniqueCharacters.add(variant);
122409
+ }
122410
+ }
122411
+ const fontText = [...uniqueCharacters].join("");
122412
+ return encodeURIComponent(fontText).length <= GOOGLE_FONTS_TEXT_MAX_ENCODED_LENGTH ? fontText : void 0;
122389
122413
  }
122390
122414
  function resolveFontFetchRetryPolicy(configured) {
122391
122415
  return {
@@ -145685,7 +145709,7 @@ function maybeConsumeDeParallelRouterTrial(routerActive, job, quiet) {
145685
145709
  const config = readConfigFresh();
145686
145710
  const renderCount = (config.deParallelRouterTrialRenderCount ?? 0) + 1;
145687
145711
  config.deParallelRouterTrialRenderCount = renderCount;
145688
- const fired = outcome === "reverted";
145712
+ const fired = outcome !== "routed";
145689
145713
  if (fired) {
145690
145714
  config.deParallelRouterTrialFired = true;
145691
145715
  deParallelRouterBreakerTrippedThisProcess = true;