@hyperframes/engine 0.9.22 → 0.9.23

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.
@@ -490,6 +490,8 @@ export interface ScriptLoadCause {
490
490
  origin: ScriptLoadOrigin;
491
491
  /** `net::ERR_*`, `http-<status>` or `unknown`. */
492
492
  code: string;
493
+ /** `name@x.y.z` of a public CDN's npm package, so a report says which library failed; never the URL. */
494
+ lib?: string;
493
495
  }
494
496
  /** Where a failed script came from and why, never its URL, host or path. */
495
497
  export declare function classifyScriptLoadCause(url: string, serverUrl: string, failure: string | number): ScriptLoadCause;
@@ -2039,6 +2039,22 @@ function recordScriptLoadFailure(session, url, cause) {
2039
2039
  }
2040
2040
  }
2041
2041
  const CDN_HOSTS = /^(?:cdn\.jsdelivr\.net|unpkg\.com|cdnjs\.cloudflare\.com)$/;
2042
+ const LIB = "([a-z0-9][a-z0-9._-]{0,48})";
2043
+ const VERSION = "(\\d+\\.\\d+\\.\\d+)";
2044
+ const LIB_PATHS = [
2045
+ ["cdn.jsdelivr.net", new RegExp(`^/npm/${LIB}@${VERSION}/`)],
2046
+ ["unpkg.com", new RegExp(`^/${LIB}@${VERSION}/`)],
2047
+ ["cdnjs.cloudflare.com", new RegExp(`^/ajax/libs/${LIB}/${VERSION}/`)],
2048
+ ];
2049
+ /** `name@x.y.z` for an unscoped package at one exact version on a public CDN, else undefined. */
2050
+ function cdnLib(url) {
2051
+ for (const [host, path] of LIB_PATHS) {
2052
+ const match = url.hostname === host ? path.exec(url.pathname) : null;
2053
+ if (match)
2054
+ return `${match[1]}@${match[2]}`;
2055
+ }
2056
+ return undefined;
2057
+ }
2042
2058
  /** Where a failed script came from and why, never its URL, host or path. */
2043
2059
  export function classifyScriptLoadCause(url, serverUrl, failure) {
2044
2060
  let origin = "unknown";
@@ -2052,11 +2068,16 @@ export function classifyScriptLoadCause(url, serverUrl, failure) {
2052
2068
  : /^net::ERR_[A-Z0-9_]{1,40}$/.test(failure)
2053
2069
  ? failure
2054
2070
  : "unknown";
2055
- return { origin, code };
2071
+ const lib = origin === "cdn" ? cdnLib(new URL(url)) : undefined;
2072
+ return lib ? { origin, code, lib } : { origin, code };
2056
2073
  }
2074
+ /** Each cause's origin and code, then the failed libraries in a bracket the first bracket's readers ignore. */
2057
2075
  function scriptLoadCauseSuffix(causes) {
2058
2076
  const shown = causes.slice(0, 4).map((c) => `${c.origin}/${c.code}`);
2059
- return shown.length === 0 ? "" : ` [script_load: ${shown.join(", ")}]`;
2077
+ if (shown.length === 0)
2078
+ return "";
2079
+ const libs = [...new Set(causes.slice(0, 4).flatMap((c) => (c.lib ? [c.lib] : [])))];
2080
+ return ` [script_load: ${shown.join(", ")}]${libs.length > 0 ? ` [script_lib: ${libs.join(", ")}]` : ""}`;
2060
2081
  }
2061
2082
  const CANCELLED_BY_THE_PAGE_NOT_REFUSED = "net::ERR_ABORTED";
2062
2083
  export function recordFailedRequest(session, request) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/engine",
3
- "version": "0.9.22",
3
+ "version": "0.9.23",
4
4
  "description": "Seekable web page to video rendering engine (Puppeteer + FFmpeg)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,8 +61,8 @@
61
61
  "puppeteer": "~25.11.0",
62
62
  "puppeteer-core": "^25.11.0",
63
63
  "undici": "7.25.0",
64
- "@hyperframes/core": "^0.9.22",
65
- "@hyperframes/parsers": "^0.9.22"
64
+ "@hyperframes/core": "^0.9.23",
65
+ "@hyperframes/parsers": "^0.9.23"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/node": "^25.0.10",