hyperframes 0.8.48 → 0.8.49

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.
@@ -59367,6 +59367,16 @@ function formatConsoleDiagnostic(type, text, locationUrl) {
59367
59367
  }
59368
59368
  function buildZeroDurationDiagnostic(diag) {
59369
59369
  const hints = [];
59370
+ if (diag.pendingBuildReadyKeys.length > 0) {
59371
+ hints.push(
59372
+ `window.__hf.buildReady never resolved for: ${diag.pendingBuildReadyKeys.join(", ")}. The runtime holds render-ready until every registered buildReady promise settles \u2014 find where the composition registers that key and confirm it actually resolves.`
59373
+ );
59374
+ }
59375
+ if (diag.rejectedBuildReadyKeys.length > 0) {
59376
+ hints.push(
59377
+ `window.__hf.buildReady rejected for: ${diag.rejectedBuildReadyKeys.join(", ")}. That key's build promise failed rather than hanging \u2014 find why it rejects.`
59378
+ );
59379
+ }
59370
59380
  if (!diag.hasPlayer) {
59371
59381
  hints.push("window.__player was never set \u2014 the HyperFrames runtime did not initialize.");
59372
59382
  }
@@ -61198,7 +61208,7 @@ var init_frameCapture = __esm({
61198
61208
  BEGIN_FRAME_CAPTURE_HEADROOM_INTERVALS = 10;
61199
61209
  BEGIN_FRAME_COMMIT_LEAD_INTERVALS = 6;
61200
61210
  BEGIN_FRAME_PROBE_LEAD_INTERVALS = 5;
61201
- HF_READY_DIAGNOSTIC_EXPR = `(function() {
61211
+ HF_READY_DIAGNOSTIC_EXPR = `(async function() {
61202
61212
  var hf = window.__hf;
61203
61213
  var player = window.__player;
61204
61214
  var renderReady = !!window.__renderReady;
@@ -61207,6 +61217,26 @@ var init_frameCapture = __esm({
61207
61217
  var hasTimeline = !!(window.__timelines && Object.keys(window.__timelines).length > 0);
61208
61218
  var root = document.querySelector("[data-composition-id]");
61209
61219
  var declaredDuration = root ? Number(root.getAttribute("data-duration")) : -1;
61220
+ var registry = (window.__hf && window.__hf.buildReady) || {};
61221
+ var keys = Object.keys(registry);
61222
+ // A microtask race mis-sorts a non-native thenable (extra adoption tick)
61223
+ // and rejects the whole expression on a rejected entry. Settling each
61224
+ // key onto its own record and waiting one macrotask avoids both.
61225
+ var settled = {};
61226
+ if (keys.length > 0) {
61227
+ keys.forEach(function(key) {
61228
+ Promise.resolve(registry[key]).then(
61229
+ function() { settled[key] = "resolved"; },
61230
+ function() { settled[key] = "rejected"; },
61231
+ );
61232
+ });
61233
+ await new Promise(function(r) { setTimeout(r, 0); });
61234
+ }
61235
+ // A thenable resolving via its own setTimeout(0) can still misreport as
61236
+ // pending here (macrotask registration order, not resolution order) \u2014 a
61237
+ // narrow case that self-corrects on the next ~1s diagnostic tick.
61238
+ var pendingBuildReadyKeys = keys.filter(function(key) { return !settled[key]; });
61239
+ var rejectedBuildReadyKeys = keys.filter(function(key) { return settled[key] === "rejected"; });
61210
61240
  return {
61211
61241
  renderReady: renderReady,
61212
61242
  hasHf: !!hf,
@@ -61215,6 +61245,8 @@ var init_frameCapture = __esm({
61215
61245
  duration: duration,
61216
61246
  hasTimeline: hasTimeline,
61217
61247
  declaredDuration: declaredDuration,
61248
+ pendingBuildReadyKeys: pendingBuildReadyKeys,
61249
+ rejectedBuildReadyKeys: rejectedBuildReadyKeys,
61218
61250
  };
61219
61251
  })()`;
61220
61252
  LIVE_MAP_MARKERS = [
@@ -65200,8 +65232,15 @@ function wrapScopedCompositionScript(source, compositionId, errorLabel = "[Hyper
65200
65232
  })
65201
65233
  : window;
65202
65234
  var __hfResolveGsapTarget = function(target) {
65203
- if (typeof target !== "string") return target;
65204
- return __hfQueryAll(target);
65235
+ if (typeof target === "string") return __hfQueryAll(target);
65236
+ if (!Array.isArray(target)) return target;
65237
+ return target.reduce(function(resolved, item) {
65238
+ if (typeof item === "string") {
65239
+ return resolved.concat(Array.prototype.slice.call(__hfQueryAll(item)));
65240
+ }
65241
+ resolved.push(item);
65242
+ return resolved;
65243
+ }, []);
65205
65244
  };
65206
65245
  var __hfScopeTimeline = function(timeline) {
65207
65246
  if (!timeline || timeline.__hfScopedCompositionRoot === __hfFindRoot()) return timeline;
@@ -89771,6 +89810,37 @@ async function ensureWoff2DataUri(cachePath, woff2Url, familyName, weight, style
89771
89810
  }
89772
89811
  return `data:font/woff2;base64,${readFileSync9(cachePath).toString("base64")}`;
89773
89812
  }
89813
+ var googleFontCssCache = /* @__PURE__ */ new Map();
89814
+ function raceAgainstAbort(promise, signal) {
89815
+ if (!signal) return promise;
89816
+ if (signal.aborted) return Promise.reject(callerAbortReason(signal));
89817
+ return new Promise((resolve18, reject) => {
89818
+ const onAbort = () => reject(callerAbortReason(signal));
89819
+ signal.addEventListener("abort", onAbort, { once: true });
89820
+ promise.then(resolve18, reject).finally(() => signal.removeEventListener("abort", onAbort));
89821
+ });
89822
+ }
89823
+ function fetchGoogleFontCss(url, familyName, options) {
89824
+ const key2 = `${options.failClosedFontFetch ? "closed" : "open"}:${url}`;
89825
+ let shared = googleFontCssCache.get(key2);
89826
+ if (!shared) {
89827
+ shared = fetchFontResource(
89828
+ url,
89829
+ { headers: { "User-Agent": WOFF2_USER_AGENT } },
89830
+ (response) => response.text(),
89831
+ familyName,
89832
+ "Google Fonts CSS",
89833
+ { ...options, abortSignal: void 0 }
89834
+ ).then((result) => {
89835
+ if (result.ok) return { ok: true, body: result.body };
89836
+ if (isRetryableFontFetchStatus(result.response.status)) googleFontCssCache.delete(key2);
89837
+ return { ok: false };
89838
+ });
89839
+ googleFontCssCache.set(key2, shared);
89840
+ shared.catch(() => googleFontCssCache.delete(key2));
89841
+ }
89842
+ return raceAgainstAbort(shared, options.abortSignal);
89843
+ }
89774
89844
  async function fetchGoogleFont(familyName, options, fontText) {
89775
89845
  const slug = fontSlug(familyName);
89776
89846
  const googleFamilyName = familyName.replace(/\+/g, " ");
@@ -89779,14 +89849,7 @@ async function fetchGoogleFont(familyName, options, fontText) {
89779
89849
  const url = `https://fonts.googleapis.com/css2?family=${encodedFamily}:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,700${textParam}`;
89780
89850
  let cssText;
89781
89851
  try {
89782
- const cssResult = await fetchFontResource(
89783
- url,
89784
- { headers: { "User-Agent": WOFF2_USER_AGENT } },
89785
- (response) => response.text(),
89786
- familyName,
89787
- "Google Fonts CSS",
89788
- options
89789
- );
89852
+ const cssResult = await fetchGoogleFontCss(url, familyName, options);
89790
89853
  if (!cssResult.ok) {
89791
89854
  return [];
89792
89855
  }
@@ -100654,8 +100717,8 @@ async function runFontLocalize(io, localize) {
100654
100717
  }
100655
100718
 
100656
100719
  // src/version.ts
100657
- var VERSION = true ? "0.8.48" : "0.0.0-dev";
100658
- var PRODUCER_VERSION = true ? "0.8.48" : "0.0.0-dev";
100720
+ var VERSION = true ? "0.8.49" : "0.0.0-dev";
100721
+ var PRODUCER_VERSION = true ? "0.8.49" : "0.0.0-dev";
100659
100722
 
100660
100723
  // src/fontLocalizeCli.ts
100661
100724
  async function readStdin() {