bunwright 0.1.0

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.
@@ -0,0 +1,83 @@
1
+ type WebViewBackend = Bun.WebView.ConstructorOptions["backend"];
2
+ type ScreenshotFormat = "png" | "jpeg" | "webp";
3
+ interface InstructionConfig {
4
+ backend?: WebViewBackend;
5
+ width?: number;
6
+ height?: number;
7
+ url?: string;
8
+ console?: boolean;
9
+ dataStore?: "ephemeral" | {
10
+ directory: string;
11
+ };
12
+ }
13
+ type InstructionStep = {
14
+ action: "navigate";
15
+ url: string;
16
+ } | {
17
+ action: "click";
18
+ selector: string;
19
+ } | {
20
+ action: "click";
21
+ x: number;
22
+ y: number;
23
+ } | {
24
+ action: "type";
25
+ selector: string;
26
+ text: string;
27
+ } | {
28
+ action: "press";
29
+ key: string;
30
+ modifiers?: Bun.WebView.PressOptions["modifiers"];
31
+ } | {
32
+ action: "evaluate";
33
+ script: string;
34
+ } | {
35
+ action: "wait";
36
+ ms: number;
37
+ } | {
38
+ action: "screenshot";
39
+ path?: string;
40
+ format?: ScreenshotFormat;
41
+ quality?: number;
42
+ } | {
43
+ action: "scroll";
44
+ dx: number;
45
+ dy: number;
46
+ } | {
47
+ action: "scrollTo";
48
+ selector: string;
49
+ block?: Bun.WebView.ScrollToOptions["block"];
50
+ } | {
51
+ action: "resize";
52
+ width: number;
53
+ height: number;
54
+ } | {
55
+ action: "back";
56
+ } | {
57
+ action: "forward";
58
+ } | {
59
+ action: "reload";
60
+ };
61
+ interface InstructionDocument {
62
+ config?: InstructionConfig;
63
+ steps: InstructionStep[];
64
+ }
65
+ interface StepSuccessResult {
66
+ index: number;
67
+ action: InstructionStep["action"];
68
+ attempt: number;
69
+ result?: unknown;
70
+ screenshotPath?: string;
71
+ }
72
+ interface FailureOutput {
73
+ ok: false;
74
+ error: {
75
+ code: "VALIDATION_ERROR" | "ARGUMENT_ERROR" | "STEP_FAILED";
76
+ message: string;
77
+ stepIndex?: number;
78
+ stepAction?: InstructionStep["action"];
79
+ attempts?: number;
80
+ details?: unknown;
81
+ };
82
+ }
83
+ export type { InstructionDocument, InstructionConfig, InstructionStep, StepSuccessResult, FailureOutput, ScreenshotFormat };
@@ -0,0 +1,30 @@
1
+ {
2
+ "config": {
3
+ "backend": "chrome",
4
+ "width": 1440,
5
+ "height": 900,
6
+ "console": true,
7
+ "dataStore": {
8
+ "directory": "./generated/profile"
9
+ }
10
+ },
11
+ "steps": [
12
+ {
13
+ "action": "navigate",
14
+ "url": "https://example.com"
15
+ },
16
+ {
17
+ "action": "wait",
18
+ "ms": 1000
19
+ },
20
+ {
21
+ "action": "evaluate",
22
+ "script": "document.title"
23
+ },
24
+ {
25
+ "action": "screenshot",
26
+ "path": "./generated/example-homepage.png",
27
+ "format": "png"
28
+ }
29
+ ]
30
+ }
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "bunwright",
3
+ "version": "0.1.0",
4
+ "description": "JSON-driven Bun.WebView automation CLI",
5
+ "module": "./dist/bunwright.mjs",
6
+ "types": "./dist/types.d.ts",
7
+ "bin": {
8
+ "bunwright": "dist/bunwright.mjs"
9
+ },
10
+ "scripts": {
11
+ "build": "bun run build:dist && bun run build:types",
12
+ "build:dist": "bun build.ts",
13
+ "build:types": "bun --bun tsc --declaration --emitDeclarationOnly --outDir dist --ignoreConfig --types bun src/types.ts",
14
+ "test": "bun test",
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "dependencies": {
18
+ "@drizzle-team/brocli": "^0.10.2",
19
+ "dotenv": "^16.6.1"
20
+ },
21
+ "devDependencies": {
22
+ "@types/bun": "latest"
23
+ },
24
+ "peerDependencies": {
25
+ "typescript": "^6.0.2"
26
+ },
27
+ "type": "module"
28
+ }