@hyperframes/engine 0.8.211 → 0.8.212
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.
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export { chromeMajorCeiling } from "./services/chromeHostCeiling.js";
|
|
|
38
38
|
export { acquireBrowser, setHostHandlesSigint, releaseBrowser, drainBrowserPool, closeBrowserPool, resolveHeadlessShellPath, resolveBrowserGpuMode, buildChromeArgs, compositionRequiresWebGpu, assertWebGpuAdapterAvailable, usesSoftwareWebGpu, WebGpuUnavailableError, ENABLE_BROWSER_POOL, BrowserLeasePool, type GpuProbeLifecycle, type BuildChromeArgsOptions, type BrowserLaunchFingerprint, type BrowserLease, type BrowserPoolState, type CaptureMode, type AcquiredBrowser, } from "./services/browserManager.js";
|
|
39
39
|
export { augmentProtocolTimeoutError, isProtocolTimeoutError, } from "./services/protocolTimeoutErrorHint.js";
|
|
40
40
|
export { augmentPageNavigationTimeoutError, isPageNavigationTimeoutError, type NavigationTimeoutHintContext, } from "./services/pageNavigationTimeoutErrorHint.js";
|
|
41
|
+
export { forcePreservedDrawingBuffer } from "./services/drawElementService.js";
|
|
41
42
|
export { createCaptureSession, initializeSession, closeCaptureSession, captureFrame, captureFrameToBuffer, captureFrameToBufferPipelined, captureFramesBatchPipelined, DrawElementVerificationError, isDrawElementVerificationError, getDrawElementVerificationDetails, type DrawElementVerificationDetails, recaptureDrawElementFrameForVerify, completeDeferredDrawElementInit, writeCapturedFrame, discardWarmupCapture, getCompositionDuration, getCapturePerfSummary, percentileOf, prepareCaptureSessionForReuse, deriveBeginFrameProbeTimeTicks, type CaptureSession, isTransientBrowserError, isMemoryExhaustionError, type BeforeCaptureHook, type DiscardWarmupInnerCapture, type StaticVerificationOutcome, VfxFailureError, waitForImagesReady, evaluateHfDiagnostic, buildZeroDurationDiagnostic, } from "./services/frameCapture.js";
|
|
42
43
|
export { CaptureFailure, classifyCaptureFailure, isFatalCaptureFailure, type CaptureFailureKind, type CaptureWorkerDiagnostic, } from "./services/captureFailure.js";
|
|
43
44
|
export { createChromeMemorySampler, type ChromeMemoryStats, } from "./services/chromeMemorySampler.js";
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ export { acquireBrowser, setHostHandlesSigint, releaseBrowser, drainBrowserPool,
|
|
|
40
40
|
export { augmentProtocolTimeoutError, isProtocolTimeoutError, } from "./services/protocolTimeoutErrorHint.js";
|
|
41
41
|
export { augmentPageNavigationTimeoutError, isPageNavigationTimeoutError, } from "./services/pageNavigationTimeoutErrorHint.js";
|
|
42
42
|
// ── Frame capture pipeline ──────────────────────────────────────────────────────
|
|
43
|
+
export { forcePreservedDrawingBuffer } from "./services/drawElementService.js";
|
|
43
44
|
export { createCaptureSession, initializeSession, closeCaptureSession, captureFrame, captureFrameToBuffer, captureFrameToBufferPipelined, captureFramesBatchPipelined, DrawElementVerificationError, isDrawElementVerificationError, getDrawElementVerificationDetails, recaptureDrawElementFrameForVerify, completeDeferredDrawElementInit, writeCapturedFrame, discardWarmupCapture, getCompositionDuration, getCapturePerfSummary, percentileOf, prepareCaptureSessionForReuse, deriveBeginFrameProbeTimeTicks, isTransientBrowserError, isMemoryExhaustionError, VfxFailureError, waitForImagesReady, evaluateHfDiagnostic, buildZeroDurationDiagnostic, } from "./services/frameCapture.js";
|
|
44
45
|
export { CaptureFailure, classifyCaptureFailure, isFatalCaptureFailure, } from "./services/captureFailure.js";
|
|
45
46
|
export { createChromeMemorySampler, } from "./services/chromeMemorySampler.js";
|
|
@@ -78,7 +78,14 @@ export async function diagnoseChromeStartup(executablePath, args, options = {})
|
|
|
78
78
|
}
|
|
79
79
|
/** The launch error, with the startup diagnosis appended; the original stays as `cause`. */
|
|
80
80
|
export async function explainChromeLaunchFailure(error, executablePath, args, signal) {
|
|
81
|
-
if (!
|
|
81
|
+
if (!(error instanceof Error))
|
|
82
|
+
return error;
|
|
83
|
+
const { code, errno, syscall } = error;
|
|
84
|
+
if (code === "UNKNOWN" && syscall === "spawn")
|
|
85
|
+
return new Error(`Windows refused to start the browser${executablePath ? ` at ${executablePath}` : ""} (error ${errno ?? "unknown"}, spawn UNKNOWN). ` +
|
|
86
|
+
"Security software may be blocking it, or the computer may be out of memory. " +
|
|
87
|
+
"Close other apps and retry; if it persists, run `hyperframes browser ensure --force` to download it again.", { cause: error });
|
|
88
|
+
if (!executablePath)
|
|
82
89
|
return error;
|
|
83
90
|
const diagnosis = await diagnoseChromeStartup(executablePath, args ?? [], { signal });
|
|
84
91
|
return new Error(`${error.message}\n${diagnosis}`, { cause: error });
|
|
@@ -71,13 +71,16 @@ export declare function resolveDrawElementCaptureMode(isSwiftShader: boolean, tr
|
|
|
71
71
|
* captureDrawElementFrame can hide them from paint records and drawImage
|
|
72
72
|
* their live content underneath the drawElementImage output.
|
|
73
73
|
*
|
|
74
|
-
*
|
|
75
|
-
* without it the drawing buffer is cleared after each compositor present and
|
|
76
|
-
* drawImage(glCanvas) reads blank.
|
|
74
|
+
* Register forcePreservedDrawingBuffer first: this wrapper only records.
|
|
77
75
|
*
|
|
78
76
|
* Must be registered via page.evaluateOnNewDocument BEFORE navigation.
|
|
79
77
|
*/
|
|
80
78
|
export declare function instrumentAcceleratedCanvases(): void;
|
|
79
|
+
/**
|
|
80
|
+
* WebGL contexts keep their drawing buffer after a frame is presented, so drawImage(glCanvas) reads the frame
|
|
81
|
+
* instead of blank. Must be registered via page.evaluateOnNewDocument BEFORE navigation.
|
|
82
|
+
*/
|
|
83
|
+
export declare function forcePreservedDrawingBuffer(): void;
|
|
81
84
|
export interface GpuBackendInfo {
|
|
82
85
|
/** SwiftShader (software rasterizer) — e.g. Docker headless-shell. */
|
|
83
86
|
isSwiftShader: boolean;
|
|
@@ -79,9 +79,7 @@ export function resolveDrawElementCaptureMode(isSwiftShader, transparent) {
|
|
|
79
79
|
* captureDrawElementFrame can hide them from paint records and drawImage
|
|
80
80
|
* their live content underneath the drawElementImage output.
|
|
81
81
|
*
|
|
82
|
-
*
|
|
83
|
-
* without it the drawing buffer is cleared after each compositor present and
|
|
84
|
-
* drawImage(glCanvas) reads blank.
|
|
82
|
+
* Register forcePreservedDrawingBuffer first: this wrapper only records.
|
|
85
83
|
*
|
|
86
84
|
* Must be registered via page.evaluateOnNewDocument BEFORE navigation.
|
|
87
85
|
*/
|
|
@@ -92,11 +90,9 @@ export function instrumentAcceleratedCanvases() {
|
|
|
92
90
|
const orig = HTMLCanvasElement.prototype.getContext;
|
|
93
91
|
// oxlint-disable-next-line no-explicit-any
|
|
94
92
|
HTMLCanvasElement.prototype.getContext = function (type, attrs) {
|
|
95
|
-
const
|
|
96
|
-
const isAccel = isGl || type === "webgpu";
|
|
97
|
-
const finalAttrs = isGl ? { ...attrs, preserveDrawingBuffer: true } : attrs;
|
|
93
|
+
const isAccel = type === "webgl" || type === "webgl2" || type === "experimental-webgl" || type === "webgpu";
|
|
98
94
|
// oxlint-disable-next-line no-explicit-any
|
|
99
|
-
const ctx = orig.call(this, type,
|
|
95
|
+
const ctx = orig.call(this, type, attrs);
|
|
100
96
|
if (ctx && isAccel) {
|
|
101
97
|
const list = w.__hf_accel_canvases ?? [];
|
|
102
98
|
if (!list.includes(this))
|
|
@@ -117,6 +113,19 @@ export function instrumentAcceleratedCanvases() {
|
|
|
117
113
|
return ctx;
|
|
118
114
|
};
|
|
119
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* WebGL contexts keep their drawing buffer after a frame is presented, so drawImage(glCanvas) reads the frame
|
|
118
|
+
* instead of blank. Must be registered via page.evaluateOnNewDocument BEFORE navigation.
|
|
119
|
+
*/
|
|
120
|
+
export function forcePreservedDrawingBuffer() {
|
|
121
|
+
const orig = HTMLCanvasElement.prototype.getContext;
|
|
122
|
+
// oxlint-disable-next-line no-explicit-any
|
|
123
|
+
HTMLCanvasElement.prototype.getContext = function (type, attrs) {
|
|
124
|
+
const isGl = type === "webgl" || type === "webgl2" || type === "experimental-webgl";
|
|
125
|
+
// oxlint-disable-next-line no-explicit-any
|
|
126
|
+
return orig.call(this, type, isGl ? { ...attrs, preserveDrawingBuffer: true } : attrs);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
120
129
|
/**
|
|
121
130
|
* Low-cardinality bucket for a raw WebGL renderer string: `<backend>/<vendor>`
|
|
122
131
|
* (e.g. `metal/apple`, `d3d11/nvidia`, `swiftshader/other`).
|
|
@@ -18,7 +18,7 @@ import { describePageMotionBlur, describePageMotionBlurAtEnd, installPageMotionB
|
|
|
18
18
|
// ── Extracted modules ───────────────────────────────────────────────────────
|
|
19
19
|
import { acquireBrowser, releaseBrowser, forceReleaseBrowser, buildChromeArgs, resolveBrowserGpuMode, captureWithoutWaylandDisplay, resolveHeadlessShellPath, compositionRequiresWebGpu, assertWebGpuAdapterAvailable, usesSoftwareWebGpu, } from "./browserManager.js";
|
|
20
20
|
import { beginFrameCapture, ensureRenderFrameSiblings, getCdpSession, pageContentExceedsCaptureHeight, pageScreenshotCapture, initTransparentBackground, capturesAlpha, shouldDefaultCaptureBeyondViewport, } from "./screenshotService.js";
|
|
21
|
-
import { classifyGpuRenderer, detectGpuBackend, injectDrawElementCanvas, captureDrawElementFrame, resolveDrawElementCaptureMode, instrumentAcceleratedCanvases, initDrawElementWorkerEncode, cleanupDrawElementWorkerEncode, produceDrawElementFrame, produceDrawElementFrameBatch, DE_CANVAS_NOT_INITIALIZED_CODE, } from "./drawElementService.js";
|
|
21
|
+
import { classifyGpuRenderer, detectGpuBackend, injectDrawElementCanvas, captureDrawElementFrame, resolveDrawElementCaptureMode, forcePreservedDrawingBuffer, instrumentAcceleratedCanvases, initDrawElementWorkerEncode, cleanupDrawElementWorkerEncode, produceDrawElementFrame, produceDrawElementFrameBatch, DE_CANVAS_NOT_INITIALIZED_CODE, } from "./drawElementService.js";
|
|
22
22
|
import { initThreeDProjection, scanCssEffects } from "./threeDProjection.js";
|
|
23
23
|
import { planRiskFrames, scanCssEffectLiveFrames, riskSessionFits, withFramesAfterCallback, MAX_RISK_FRAME_FRACTION, } from "./riskFrames.js";
|
|
24
24
|
import { getAvailableMemoryMb } from "./systemMemory.js";
|
|
@@ -1006,6 +1006,7 @@ async function constructCaptureSession(input) {
|
|
|
1006
1006
|
// composites their live content via drawImage instead (see
|
|
1007
1007
|
// instrumentAcceleratedCanvases). Must be registered before navigation.
|
|
1008
1008
|
if (useDrawElement) {
|
|
1009
|
+
await page.evaluateOnNewDocument(forcePreservedDrawingBuffer);
|
|
1009
1010
|
await page.evaluateOnNewDocument(instrumentAcceleratedCanvases);
|
|
1010
1011
|
}
|
|
1011
1012
|
// The opacity → autoAlpha tween rewrite was RETIRED with the requestPaint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/engine",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.212",
|
|
4
4
|
"description": "Seekable web page to video rendering engine (Puppeteer + FFmpeg)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"linkedom": "^0.18.12",
|
|
55
55
|
"puppeteer": "~25.11.0",
|
|
56
56
|
"puppeteer-core": "^25.11.0",
|
|
57
|
-
"@hyperframes/
|
|
58
|
-
"@hyperframes/
|
|
57
|
+
"@hyperframes/core": "^0.8.212",
|
|
58
|
+
"@hyperframes/parsers": "^0.8.212"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "^25.0.10",
|