@hyperframes/engine 0.6.118 → 0.6.120

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.
Files changed (73) hide show
  1. package/package.json +24 -7
  2. package/scripts/generate-lut-reference.py +0 -168
  3. package/scripts/test-fitTextFontSize-browser.ts +0 -135
  4. package/src/cdp-headless-experimental.d.ts +0 -54
  5. package/src/config.test.ts +0 -213
  6. package/src/config.ts +0 -417
  7. package/src/index.ts +0 -273
  8. package/src/services/audioMixer.test.ts +0 -326
  9. package/src/services/audioMixer.ts +0 -604
  10. package/src/services/audioMixer.types.ts +0 -35
  11. package/src/services/audioVolumeEnvelope.test.ts +0 -176
  12. package/src/services/audioVolumeEnvelope.ts +0 -138
  13. package/src/services/browserManager.test.ts +0 -330
  14. package/src/services/browserManager.ts +0 -670
  15. package/src/services/chunkEncoder.test.ts +0 -1415
  16. package/src/services/chunkEncoder.ts +0 -831
  17. package/src/services/chunkEncoder.types.ts +0 -60
  18. package/src/services/extractionCache.test.ts +0 -199
  19. package/src/services/extractionCache.ts +0 -216
  20. package/src/services/fileServer.ts +0 -110
  21. package/src/services/frameCapture-discardWarmup.test.ts +0 -183
  22. package/src/services/frameCapture-namePolyfill.test.ts +0 -78
  23. package/src/services/frameCapture-pollImagesReady.test.ts +0 -153
  24. package/src/services/frameCapture-staticDedupIndex.test.ts +0 -76
  25. package/src/services/frameCapture-warmupTicks.test.ts +0 -174
  26. package/src/services/frameCapture.test.ts +0 -192
  27. package/src/services/frameCapture.ts +0 -1934
  28. package/src/services/hdrCapture.test.ts +0 -159
  29. package/src/services/hdrCapture.ts +0 -315
  30. package/src/services/parallelCoordinator.test.ts +0 -139
  31. package/src/services/parallelCoordinator.ts +0 -437
  32. package/src/services/screenshotService.test.ts +0 -510
  33. package/src/services/screenshotService.ts +0 -615
  34. package/src/services/streamingEncoder.test.ts +0 -832
  35. package/src/services/streamingEncoder.ts +0 -594
  36. package/src/services/systemMemory.test.ts +0 -324
  37. package/src/services/systemMemory.ts +0 -180
  38. package/src/services/videoFrameExtractor.test.ts +0 -1062
  39. package/src/services/videoFrameExtractor.ts +0 -1139
  40. package/src/services/videoFrameInjector.test.ts +0 -300
  41. package/src/services/videoFrameInjector.ts +0 -687
  42. package/src/services/vp9Options.ts +0 -13
  43. package/src/types.ts +0 -191
  44. package/src/utils/alphaBlit.test.ts +0 -1349
  45. package/src/utils/alphaBlit.ts +0 -1015
  46. package/src/utils/assertSwiftShader.test.ts +0 -130
  47. package/src/utils/assertSwiftShader.ts +0 -126
  48. package/src/utils/ffmpegBinaries.test.ts +0 -43
  49. package/src/utils/ffmpegBinaries.ts +0 -63
  50. package/src/utils/ffprobe.test.ts +0 -342
  51. package/src/utils/ffprobe.ts +0 -457
  52. package/src/utils/gpuEncoder.test.ts +0 -140
  53. package/src/utils/gpuEncoder.ts +0 -268
  54. package/src/utils/hdr.test.ts +0 -191
  55. package/src/utils/hdr.ts +0 -137
  56. package/src/utils/hdrCompositing.test.ts +0 -130
  57. package/src/utils/htmlTemplate.test.ts +0 -42
  58. package/src/utils/htmlTemplate.ts +0 -42
  59. package/src/utils/layerCompositor.test.ts +0 -150
  60. package/src/utils/layerCompositor.ts +0 -58
  61. package/src/utils/parityContract.ts +0 -1
  62. package/src/utils/processTracker.test.ts +0 -74
  63. package/src/utils/processTracker.ts +0 -41
  64. package/src/utils/readWebGlVendorInfoFromCanvas.ts +0 -52
  65. package/src/utils/runFfmpeg.test.ts +0 -102
  66. package/src/utils/runFfmpeg.ts +0 -136
  67. package/src/utils/shaderTransitions.test.ts +0 -738
  68. package/src/utils/shaderTransitions.ts +0 -1130
  69. package/src/utils/uint16-alignment-audit.test.ts +0 -125
  70. package/src/utils/urlDownloader.test.ts +0 -65
  71. package/src/utils/urlDownloader.ts +0 -143
  72. package/tsconfig.json +0 -19
  73. package/vitest.config.ts +0 -7
@@ -1,192 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import {
3
- formatHttpErrorDiagnostic,
4
- formatNavigationFailureDiagnostic,
5
- formatNavigationStartDiagnostic,
6
- formatRequestFailureDiagnostic,
7
- isFontResourceError,
8
- sanitizeDiagnosticUrl,
9
- } from "./frameCapture.js";
10
-
11
- describe("isFontResourceError", () => {
12
- it("matches Google Fonts CSS load failures via location.url", () => {
13
- expect(
14
- isFontResourceError(
15
- "error",
16
- "Failed to load resource: net::ERR_FAILED",
17
- "https://fonts.googleapis.com/css2?family=Inter",
18
- ),
19
- ).toBe(true);
20
- });
21
-
22
- it("matches gstatic font binaries via location.url", () => {
23
- expect(
24
- isFontResourceError(
25
- "error",
26
- "Failed to load resource: the server responded with a status of 404 (Not Found)",
27
- "https://fonts.gstatic.com/s/inter/v12/foo.woff2",
28
- ),
29
- ).toBe(true);
30
- });
31
-
32
- it("matches self-hosted woff2 failures", () => {
33
- expect(
34
- isFontResourceError(
35
- "error",
36
- "Failed to load resource: net::ERR_CONNECTION_REFUSED",
37
- "http://localhost:9999/font.woff2",
38
- ),
39
- ).toBe(true);
40
- });
41
-
42
- it("matches .ttf and .otf URLs", () => {
43
- expect(
44
- isFontResourceError("error", "Failed to load resource: 404", "http://example.com/a.ttf"),
45
- ).toBe(true);
46
- expect(
47
- isFontResourceError("error", "Failed to load resource: 404", "http://example.com/b.otf"),
48
- ).toBe(true);
49
- });
50
-
51
- it("does NOT match non-font resources (images, scripts, videos)", () => {
52
- expect(
53
- isFontResourceError("error", "Failed to load resource: 404", "https://example.com/img.png"),
54
- ).toBe(false);
55
- expect(
56
- isFontResourceError(
57
- "error",
58
- "Failed to load resource: 404",
59
- "https://cdn.example.com/bundle.js",
60
- ),
61
- ).toBe(false);
62
- expect(
63
- isFontResourceError("error", "Failed to load resource: 404", "https://example.com/video.mp4"),
64
- ).toBe(false);
65
- });
66
-
67
- it("does NOT match when location.url is missing and text has no URL (safe default)", () => {
68
- expect(isFontResourceError("error", "Failed to load resource: 404", "")).toBe(false);
69
- });
70
-
71
- it("still matches when URL appears in text (older Chrome formats)", () => {
72
- expect(
73
- isFontResourceError(
74
- "error",
75
- "Failed to load resource: https://fonts.googleapis.com/... 404",
76
- "",
77
- ),
78
- ).toBe(true);
79
- });
80
-
81
- it("does NOT match non-error console messages", () => {
82
- expect(
83
- isFontResourceError(
84
- "warn",
85
- "Failed to load resource: 404",
86
- "https://fonts.googleapis.com/css2",
87
- ),
88
- ).toBe(false);
89
- expect(
90
- isFontResourceError(
91
- "info",
92
- "Failed to load resource: 404",
93
- "https://fonts.googleapis.com/css2",
94
- ),
95
- ).toBe(false);
96
- });
97
-
98
- it("does NOT match unrelated error messages", () => {
99
- expect(isFontResourceError("error", "Uncaught ReferenceError: x is not defined", "")).toBe(
100
- false,
101
- );
102
- expect(
103
- isFontResourceError("error", "Some other error", "https://fonts.googleapis.com/css2"),
104
- ).toBe(false);
105
- });
106
-
107
- it("is case-insensitive for URL matching", () => {
108
- expect(
109
- isFontResourceError(
110
- "error",
111
- "Failed to load resource: 404",
112
- "https://FONTS.GOOGLEAPIS.COM/css2",
113
- ),
114
- ).toBe(true);
115
- expect(
116
- isFontResourceError("error", "Failed to load resource: 404", "http://example.com/FONT.WOFF2"),
117
- ).toBe(true);
118
- });
119
- });
120
-
121
- describe("navigation diagnostics", () => {
122
- it("redacts credentials, query strings, and fragments from diagnostic URLs", () => {
123
- expect(
124
- sanitizeDiagnosticUrl("https://user:pass@example.com/assets/video.mp4?token=secret#frag"),
125
- ).toBe("https://example.com/assets/video.mp4");
126
- });
127
-
128
- it("redacts data and blob URLs", () => {
129
- expect(sanitizeDiagnosticUrl("data:image/png;base64,abc123")).toBe("data:<redacted>");
130
- expect(sanitizeDiagnosticUrl("blob:https://example.com/abc123")).toBe("blob:<redacted>");
131
- });
132
-
133
- it("redacts query strings from relative URLs", () => {
134
- expect(sanitizeDiagnosticUrl("/relative/path.png?token=secret#frag")).toBe(
135
- "/relative/path.png",
136
- );
137
- });
138
-
139
- it("formats page.goto failures with mode, timeout, elapsed time, and sanitized URL", () => {
140
- const diagnostic = formatNavigationFailureDiagnostic({
141
- captureMode: "screenshot",
142
- url: "http://127.0.0.1:4173/index.html?claim_token=secret",
143
- timeoutMs: 60_000,
144
- elapsedMs: 60_123,
145
- error: new Error("Navigation timeout of 60000 ms exceeded"),
146
- });
147
-
148
- expect(diagnostic).toContain("[FrameCapture:ERROR] page.goto failed");
149
- expect(diagnostic).toContain("mode=screenshot");
150
- expect(diagnostic).toContain("timeoutMs=60000");
151
- expect(diagnostic).toContain("elapsedMs=60123");
152
- expect(diagnostic).toContain("url=http://127.0.0.1:4173/index.html");
153
- expect(diagnostic).not.toContain("claim_token");
154
- });
155
-
156
- it("formats page.goto starts with mode, timeout, and sanitized URL", () => {
157
- const diagnostic = formatNavigationStartDiagnostic({
158
- captureMode: "screenshot",
159
- url: "http://127.0.0.1:4173/index.html?claim_token=secret",
160
- timeoutMs: 60_000,
161
- });
162
-
163
- expect(diagnostic).toContain("[FrameCapture:NAV] page.goto start");
164
- expect(diagnostic).toContain("mode=screenshot");
165
- expect(diagnostic).toContain("timeoutMs=60000");
166
- expect(diagnostic).toContain("url=http://127.0.0.1:4173/index.html");
167
- expect(diagnostic).not.toContain("claim_token");
168
- });
169
-
170
- it("formats request and HTTP failures with sanitized URLs", () => {
171
- expect(
172
- formatRequestFailureDiagnostic({
173
- method: "GET",
174
- resourceType: "media",
175
- url: "https://cdn.example.com/video.mp4?token=secret",
176
- failureText: "net::ERR_FAILED",
177
- }),
178
- ).toBe(
179
- "[Browser:REQUESTFAILED] GET https://cdn.example.com/video.mp4 resource=media error=net::ERR_FAILED",
180
- );
181
-
182
- expect(
183
- formatHttpErrorDiagnostic({
184
- method: "GET",
185
- resourceType: "image",
186
- url: "https://cdn.example.com/frame.png?token=secret",
187
- status: 403,
188
- statusText: "Forbidden",
189
- }),
190
- ).toBe("[Browser:HTTP403] GET https://cdn.example.com/frame.png resource=image Forbidden");
191
- });
192
- });