very-happy-dom 0.1.2 โ 0.1.4
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/CHANGELOG.md +53 -0
- package/dist/browser/BrowserPage.d.ts +5 -2
- package/dist/css/CSSOM.d.ts +3 -11
- package/package.json +3 -4
- package/dist/config.d.ts +0 -5
- package/dist/register.d.ts +0 -1
- package/dist/screenshot/index.d.ts +0 -38
- package/dist/screenshot/webview.d.ts +0 -116
- package/dist/types.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
+
[Compare changes](https://github.com/stacksjs/very-happy-dom/compare/v0.1.3...v0.1.4)
|
|
2
|
+
|
|
3
|
+
### ๐ Bug Fixes
|
|
4
|
+
|
|
5
|
+
- add setup-bun to publish-commit job ([0e0af08](https://github.com/stacksjs/very-happy-dom/commit/0e0af08)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
6
|
+
- ship dist only, remove bun export condition pointing to unpublished src ([bc412ee](https://github.com/stacksjs/very-happy-dom/commit/bc412ee)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
7
|
+
- include src/ in published files for bun export condition ([b0ba4fa](https://github.com/stacksjs/very-happy-dom/commit/b0ba4fa)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
8
|
+
|
|
9
|
+
### ๐ค Continuous Integration
|
|
10
|
+
|
|
11
|
+
- drop redundant setup-bun (pantry installs bun via deps.yaml) ([88ed1d6](https://github.com/stacksjs/very-happy-dom/commit/88ed1d6)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
12
|
+
|
|
13
|
+
### ๐งน Chores
|
|
14
|
+
|
|
15
|
+
- release v0.1.4 ([c3006e8](https://github.com/stacksjs/very-happy-dom/commit/c3006e8)) _(by Chris <chrisbreuer93@gmail.com>)_
|
|
16
|
+
- move dtsx deps to devDependencies and bump to ^0.9.17 ([719c347](https://github.com/stacksjs/very-happy-dom/commit/719c347)) _(by Chris <chrisbreuer93@gmail.com>)_
|
|
17
|
+
- refresh bun.lock to pick up latest pickier ([8e873c2](https://github.com/stacksjs/very-happy-dom/commit/8e873c2)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
18
|
+
- fresh install to pick up dtsx 0.9.14 and bunfig 0.15.9 ([85d5b2c](https://github.com/stacksjs/very-happy-dom/commit/85d5b2c)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
19
|
+
- bump to 0.1.3 with src/ in published files ([7809b72](https://github.com/stacksjs/very-happy-dom/commit/7809b72)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
20
|
+
- release v0.1.2 ([2e2a463](https://github.com/stacksjs/very-happy-dom/commit/2e2a463)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
21
|
+
- revert release v0.1.2 ([782f6c0](https://github.com/stacksjs/very-happy-dom/commit/782f6c0)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
22
|
+
|
|
23
|
+
### Contributors
|
|
24
|
+
|
|
25
|
+
- _Chris <chrisbreuer93@gmail.com>_
|
|
26
|
+
- _glennmichael123 <gtorregosa@gmail.com>_
|
|
27
|
+
|
|
28
|
+
[Compare changes](https://github.com/stacksjs/very-happy-dom/compare/v0.1.2...HEAD)
|
|
29
|
+
|
|
30
|
+
### ๐ Bug Fixes
|
|
31
|
+
|
|
32
|
+
- add setup-bun to publish-commit job ([0e0af08](https://github.com/stacksjs/very-happy-dom/commit/0e0af08)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
33
|
+
- ship dist only, remove bun export condition pointing to unpublished src ([bc412ee](https://github.com/stacksjs/very-happy-dom/commit/bc412ee)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
34
|
+
- include src/ in published files for bun export condition ([b0ba4fa](https://github.com/stacksjs/very-happy-dom/commit/b0ba4fa)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
35
|
+
|
|
36
|
+
### ๐ค Continuous Integration
|
|
37
|
+
|
|
38
|
+
- drop redundant setup-bun (pantry installs bun via deps.yaml) ([88ed1d6](https://github.com/stacksjs/very-happy-dom/commit/88ed1d6)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
39
|
+
|
|
40
|
+
### ๐งน Chores
|
|
41
|
+
|
|
42
|
+
- move dtsx deps to devDependencies and bump to ^0.9.17 ([719c347](https://github.com/stacksjs/very-happy-dom/commit/719c347)) _(by Chris <chrisbreuer93@gmail.com>)_
|
|
43
|
+
- refresh bun.lock to pick up latest pickier ([8e873c2](https://github.com/stacksjs/very-happy-dom/commit/8e873c2)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
44
|
+
- fresh install to pick up dtsx 0.9.14 and bunfig 0.15.9 ([85d5b2c](https://github.com/stacksjs/very-happy-dom/commit/85d5b2c)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
45
|
+
- bump to 0.1.3 with src/ in published files ([7809b72](https://github.com/stacksjs/very-happy-dom/commit/7809b72)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
46
|
+
- release v0.1.2 ([2e2a463](https://github.com/stacksjs/very-happy-dom/commit/2e2a463)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
47
|
+
- revert release v0.1.2 ([782f6c0](https://github.com/stacksjs/very-happy-dom/commit/782f6c0)) _(by glennmichael123 <gtorregosa@gmail.com>)_
|
|
48
|
+
|
|
49
|
+
### Contributors
|
|
50
|
+
|
|
51
|
+
- _Chris <chrisbreuer93@gmail.com>_
|
|
52
|
+
- _glennmichael123 <gtorregosa@gmail.com>_
|
|
53
|
+
|
|
1
54
|
[Compare changes](https://github.com/stacksjs/very-happy-dom/compare/v0.1.1...v0.1.2)
|
|
2
55
|
|
|
3
56
|
### ๐งน Chores
|
|
@@ -59,7 +59,7 @@ export declare class BrowserPage {
|
|
|
59
59
|
_emitError(error: Error): void;
|
|
60
60
|
dragAndDrop(source: string, target: string, options?: { delay?: number }): Promise<void>;
|
|
61
61
|
setRequestInterception(enabled: boolean): Promise<void>;
|
|
62
|
-
screenshot(options
|
|
62
|
+
screenshot(options?: {
|
|
63
63
|
type?: 'png' | 'jpeg' | 'webp'
|
|
64
64
|
quality?: number
|
|
65
65
|
fullPage?: boolean
|
|
@@ -72,7 +72,10 @@ export declare class BrowserPage {
|
|
|
72
72
|
timeout?: number
|
|
73
73
|
css?: string
|
|
74
74
|
baseUrl?: string
|
|
75
|
-
fonts?: Array<{ family: string, url: string, weight?: string, style?: string }>
|
|
75
|
+
fonts?: Array<{ family: string, url: string, weight?: string, style?: string }>
|
|
76
|
+
console?: true | ((event: unknown) => void)
|
|
77
|
+
}
|
|
78
|
+
}): Promise<string | Buffer>;
|
|
76
79
|
pdf(options?: {
|
|
77
80
|
path?: string
|
|
78
81
|
scale?: number
|
package/dist/css/CSSOM.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @defaultValue
|
|
3
|
-
* ```ts
|
|
4
|
-
* {
|
|
5
|
-
* escape: (value: string) => unknown,
|
|
6
|
-
* supports: (property: string, value?: string) => unknown
|
|
7
|
-
* }
|
|
8
|
-
* ```
|
|
9
|
-
*/
|
|
1
|
+
/** @defaultValue `{ supports: () => unknown }` */
|
|
10
2
|
export declare const CSS: {
|
|
11
|
-
escape: (value: string) =>
|
|
3
|
+
escape: (value: string) => string;
|
|
12
4
|
/**
|
|
13
5
|
* Best-effort CSS.supports(). Without a real CSS parser we stay permissive:
|
|
14
6
|
* accept any non-empty input, recognize "not (...)" for the 1-arg condition
|
|
15
7
|
* form, and reject clearly malformed declarations in the 2-arg form.
|
|
16
8
|
*/
|
|
17
|
-
supports: (property: string, value?: string) =>
|
|
9
|
+
supports: (property: string, value?: string) => boolean
|
|
18
10
|
};
|
|
19
11
|
/**
|
|
20
12
|
* CSS Object Model (CSSOM) implementation
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "very-happy-dom",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "Like a light-weight version of `happy-dom` powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,17 +30,14 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
32
|
"types": "./dist/index.d.ts",
|
|
33
|
-
"bun": "./src/index.ts",
|
|
34
33
|
"import": "./dist/index.js"
|
|
35
34
|
},
|
|
36
35
|
"./register": {
|
|
37
36
|
"types": "./dist/register.d.ts",
|
|
38
|
-
"bun": "./src/register.ts",
|
|
39
37
|
"import": "./dist/register.js"
|
|
40
38
|
},
|
|
41
39
|
"./jsdom": {
|
|
42
40
|
"types": "./dist/jsdom/index.d.ts",
|
|
43
|
-
"bun": "./src/jsdom/index.ts",
|
|
44
41
|
"import": "./dist/jsdom/index.js"
|
|
45
42
|
},
|
|
46
43
|
"./*": {
|
|
@@ -75,6 +72,8 @@
|
|
|
75
72
|
"devDependencies": {
|
|
76
73
|
"@stacksjs/bunpress": "^0.1.4",
|
|
77
74
|
"better-dx": "^0.2.7",
|
|
75
|
+
"@stacksjs/dtsx": "^0.9.17",
|
|
76
|
+
"bun-plugin-dtsx": "^0.9.17",
|
|
78
77
|
"bunfig": "^0.15.6",
|
|
79
78
|
"mitata": "^1.0.34"
|
|
80
79
|
},
|
package/dist/config.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { BinaryConfig } from './types';
|
|
2
|
-
export declare function getConfig(): Promise<BinaryConfig>;
|
|
3
|
-
export declare const defaultConfig: BinaryConfig;
|
|
4
|
-
// For backwards compatibility - synchronous access with default fallback
|
|
5
|
-
export declare const config: BinaryConfig;
|
package/dist/register.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Screenshot Module
|
|
3
|
-
* Renders HTML to actual PNG/JPEG images using a pure JavaScript rendering pipeline
|
|
4
|
-
* Zero external dependencies - everything is homegrown
|
|
5
|
-
*/
|
|
6
|
-
// Core renderer
|
|
7
|
-
export { createRenderer, HtmlRenderer, type RenderOptions, type RenderResult } from './renderer';
|
|
8
|
-
// Screenshot capture
|
|
9
|
-
export { captureHtml, captureUrl, ScreenshotCapture, type ScreenshotOptions } from './capture';
|
|
10
|
-
// Image comparison
|
|
11
|
-
export { compareImages, ImageDiff, type DiffOptions, type DiffResult } from './diff';
|
|
12
|
-
// Compression utilities
|
|
13
|
-
export { adler32, crc32, deflate, deflateRaw, deflateStore, inflate, inflateRaw } from './deflate';
|
|
14
|
-
// CSS utilities
|
|
15
|
-
export { blendColors, parseBoxValues, parseColor, parseInlineStyles, parseSize, type RGBA } from './css-utils';
|
|
16
|
-
// Layout engine
|
|
17
|
-
export { computeLayout, parseCSS, parseHTML, type Box, type ComputedStyles, type CSSRule, type LayoutNode, type ParsedElement } from './layout';
|
|
18
|
-
// Pixel rendering
|
|
19
|
-
export { PixelBuffer, renderHtmlToPixels, renderLayoutTree } from './pixel-renderer';
|
|
20
|
-
// WebP support
|
|
21
|
-
export { decodeWebP, encodeWebP, isWebP, type WebPOptions } from './webp';
|
|
22
|
-
// Bun.WebView-backed capture (real browser-rendered screenshots)
|
|
23
|
-
export {
|
|
24
|
-
canRenderWithWebView,
|
|
25
|
-
captureHtmlWithWebView,
|
|
26
|
-
captureUrlWithWebView,
|
|
27
|
-
isWebViewAvailable,
|
|
28
|
-
WebViewCapture,
|
|
29
|
-
type WebViewCaptureConstructorOptions,
|
|
30
|
-
type WebViewConsoleHook,
|
|
31
|
-
type WebViewEncoding,
|
|
32
|
-
type WebViewFont,
|
|
33
|
-
type WebViewImageFormat,
|
|
34
|
-
type WebViewScreenshotOptions,
|
|
35
|
-
type WebViewScreenshotResult,
|
|
36
|
-
WebViewTimeoutError,
|
|
37
|
-
WebViewUnavailableError,
|
|
38
|
-
} from './webview';
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
|
-
/**
|
|
3
|
-
* Returns true if the current runtime exposes Bun.WebView.
|
|
4
|
-
*
|
|
5
|
-
* Note: this only checks the constructor is present. Headless runners (e.g.
|
|
6
|
-
* Ubuntu CI without WebKit/Chromium installed) have the constructor but
|
|
7
|
-
* cannot actually render โ use `canRenderWithWebView` for that.
|
|
8
|
-
*/
|
|
9
|
-
export declare function isWebViewAvailable(): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Probe whether the runtime can actually render through Bun.WebView, not just
|
|
12
|
-
* expose the constructor. Constructs a 1ร1 headless view, navigates to a
|
|
13
|
-
* trivial data URL, and attempts a real screenshot โ all under a short
|
|
14
|
-
* timeout. Caches the result for the lifetime of the process. Safe to call
|
|
15
|
-
* from tests that want to skip real-capture assertions on environments
|
|
16
|
-
* without a working browser backend (e.g. headless Linux CI without
|
|
17
|
-
* WebKit/Chromium).
|
|
18
|
-
*
|
|
19
|
-
* We also require the screenshot step: on some runtimes `navigate('data:โฆ')`
|
|
20
|
-
* resolves even without a backend (data URLs are synthetic), but `screenshot`
|
|
21
|
-
* needs the backend to produce pixels and hangs when it's missing. That's the
|
|
22
|
-
* scenario we must catch.
|
|
23
|
-
*/
|
|
24
|
-
export declare function canRenderWithWebView(timeoutMs?: number): Promise<boolean>;
|
|
25
|
-
/**
|
|
26
|
-
* Convenience: capture a screenshot from HTML via Bun.WebView.
|
|
27
|
-
*/
|
|
28
|
-
export declare function captureHtmlWithWebView(html: string, options?: WebViewScreenshotOptions): Promise<WebViewScreenshotResult>;
|
|
29
|
-
/**
|
|
30
|
-
* Convenience: capture a screenshot from a URL via Bun.WebView.
|
|
31
|
-
*/
|
|
32
|
-
export declare function captureUrlWithWebView(url: string, options?: WebViewScreenshotOptions): Promise<WebViewScreenshotResult>;
|
|
33
|
-
/**
|
|
34
|
-
* Font face to preload via an injected @font-face rule.
|
|
35
|
-
*/
|
|
36
|
-
export declare interface WebViewFont {
|
|
37
|
-
family: string
|
|
38
|
-
url: string
|
|
39
|
-
weight?: string
|
|
40
|
-
style?: string
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* WebView-backed screenshot options
|
|
44
|
-
*/
|
|
45
|
-
export declare interface WebViewScreenshotOptions {
|
|
46
|
-
width?: number
|
|
47
|
-
height?: number
|
|
48
|
-
format?: WebViewImageFormat
|
|
49
|
-
quality?: number
|
|
50
|
-
encoding?: WebViewEncoding
|
|
51
|
-
path?: string
|
|
52
|
-
backend?: 'webkit' | 'chrome'
|
|
53
|
-
headless?: boolean
|
|
54
|
-
dataStore?: 'ephemeral' | { directory: string }
|
|
55
|
-
waitFor?: number
|
|
56
|
-
timeout?: number
|
|
57
|
-
css?: string
|
|
58
|
-
baseUrl?: string
|
|
59
|
-
fonts?: WebViewFont[]
|
|
60
|
-
console?: WebViewConsoleHook
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Construction-time options for WebViewCapture. These configure the underlying
|
|
64
|
-
* WebView lifecycle โ most apply only in `reuse` mode.
|
|
65
|
-
*/
|
|
66
|
-
export declare interface WebViewCaptureConstructorOptions {
|
|
67
|
-
reuse?: boolean
|
|
68
|
-
width?: number
|
|
69
|
-
height?: number
|
|
70
|
-
backend?: 'webkit' | 'chrome'
|
|
71
|
-
headless?: boolean
|
|
72
|
-
dataStore?: 'ephemeral' | { directory: string }
|
|
73
|
-
console?: WebViewConsoleHook
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Image format accepted by Bun.WebView.screenshot.
|
|
77
|
-
*/
|
|
78
|
-
export type WebViewImageFormat = 'png' | 'jpeg' | 'webp';
|
|
79
|
-
/**
|
|
80
|
-
* Encoding variants. `'binary'` is an alias for `'buffer'` to stay consistent
|
|
81
|
-
* with the project's existing ScreenshotOptions shape.
|
|
82
|
-
*/
|
|
83
|
-
export type WebViewEncoding = 'buffer' | 'binary' | 'base64' | 'blob' | 'shmem';
|
|
84
|
-
/**
|
|
85
|
-
* Console hook forwarded to Bun.WebView's `console` constructor option.
|
|
86
|
-
* The exact event shape is defined by Bun; passed through unchanged.
|
|
87
|
-
*/
|
|
88
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
89
|
-
export type WebViewConsoleHook = true | ((event: unknown) => void);
|
|
90
|
-
/**
|
|
91
|
-
* Return type of a capture call, determined by the requested encoding.
|
|
92
|
-
*/
|
|
93
|
-
export type WebViewScreenshotResult = Buffer | string | Blob | { name: string, size: number }
|
|
94
|
-
/**
|
|
95
|
-
* Thrown when WebView-backed capture is requested but Bun.WebView is unavailable.
|
|
96
|
-
*/
|
|
97
|
-
export declare class WebViewUnavailableError extends Error {
|
|
98
|
-
constructor();
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Thrown when a capture exceeds its `timeout` budget.
|
|
102
|
-
*/
|
|
103
|
-
export declare class WebViewTimeoutError extends Error {
|
|
104
|
-
constructor(phase: string, ms: number);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* WebView-backed screenshot capture.
|
|
108
|
-
*/
|
|
109
|
-
export declare class WebViewCapture {
|
|
110
|
-
constructor(init?: WebViewCaptureConstructorOptions);
|
|
111
|
-
capture(url: string, options?: WebViewScreenshotOptions): Promise<WebViewScreenshotResult>;
|
|
112
|
-
captureHtml(html: string, options?: WebViewScreenshotOptions): Promise<WebViewScreenshotResult>;
|
|
113
|
-
captureUrl(url: string, options?: WebViewScreenshotOptions): Promise<WebViewScreenshotResult>;
|
|
114
|
-
dispose(): void;
|
|
115
|
-
[Symbol.dispose](): void;
|
|
116
|
-
}
|
package/dist/types.d.ts
DELETED