@lunora/browser 1.0.0-alpha.7 → 1.0.0-alpha.8

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/README.md CHANGED
@@ -10,6 +10,8 @@
10
10
 
11
11
  <!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
12
12
 
13
+ > **Experimental** — this package is outside the Lunora 1.0 stability promise: its API may change in any release, without a major version bump.
14
+
13
15
  <br />
14
16
 
15
17
  <div align="center">
package/dist/index.d.mts CHANGED
@@ -12,6 +12,7 @@
12
12
  * always has one) so the marker actually excludes an arbitrary value like `{}` —
13
13
  * a bare object fails to type-check where a binding is required, catching the
14
14
  * misuse at the call site instead of deferring to an opaque launch error.
15
+ * @experimental
15
16
  */
16
17
  interface BrowserBindingLike {
17
18
  readonly fetch: (...args: never[]) => unknown;
@@ -37,6 +38,7 @@ interface RouteLike {
37
38
  * Minimal projection of a Playwright `Page` — just the methods the helpers drive.
38
39
  * Declared structurally so a test can inject a plain stub instead of a real
39
40
  * headless page (which needs workerd + the Browser Rendering binding).
41
+ * @experimental
40
42
  */
41
43
  interface PageLike {
42
44
  /** Return the page's serialized HTML after the navigation settles. */
@@ -68,6 +70,7 @@ interface PageLike {
68
70
  /**
69
71
  * Minimal projection of a Playwright `BrowserContext`. Only `newPage` is used;
70
72
  * declared structurally for the same test-double reason as {@link PageLike}.
73
+ * @experimental
71
74
  */
72
75
  interface BrowserContextLike {
73
76
  newPage: () => Promise<PageLike>;
@@ -76,6 +79,7 @@ interface BrowserContextLike {
76
79
  * Minimal projection of a Playwright `Browser` (the value `launch` resolves to).
77
80
  * Only `newContext`/`close` are used; declared structurally for the same
78
81
  * test-double reason as {@link PageLike}.
82
+ * @experimental
79
83
  */
80
84
  interface BrowserLike {
81
85
  close: () => Promise<void>;
@@ -88,9 +92,13 @@ interface BrowserLike {
88
92
  * `@cloudflare/playwright` at module top — that keeps the heavy optional peer
89
93
  * dep out of the bundle for apps that never screenshot, and lets tests pass a
90
94
  * fake. Calling it with the Browser Rendering binding resolves a {@link BrowserLike}.
95
+ * @experimental
91
96
  */
92
97
  type BrowserLaunchLike = (binding: BrowserBindingLike, options?: Record<string, unknown>) => Promise<BrowserLike>;
93
- /** Options shared by the page-driving helpers ({@link Browser.screenshot} etc.). */
98
+ /**
99
+ * Options shared by the page-driving helpers ({@link Browser.screenshot} etc.).
100
+ * @experimental
101
+ */
94
102
  interface NavigateOptions {
95
103
  /**
96
104
  * Hard timeout in milliseconds for the navigation + operation. Clamped to a
@@ -104,7 +112,10 @@ interface NavigateOptions {
104
112
  */
105
113
  waitUntil?: "commit" | "domcontentloaded" | "load" | "networkidle";
106
114
  }
107
- /** Options for {@link Browser.screenshot}. */
115
+ /**
116
+ * Options for {@link Browser.screenshot}.
117
+ * @experimental
118
+ */
108
119
  interface ScreenshotOptions extends NavigateOptions {
109
120
  /** Capture the full scrollable page rather than just the viewport. */
110
121
  fullPage?: boolean;
@@ -119,7 +130,10 @@ interface ScreenshotOptions extends NavigateOptions {
119
130
  width: number;
120
131
  };
121
132
  }
122
- /** Options for {@link Browser.pdf}. */
133
+ /**
134
+ * Options for {@link Browser.pdf}.
135
+ * @experimental
136
+ */
123
137
  interface PdfOptions extends NavigateOptions {
124
138
  /** Paper format (`A4`, `Letter`, …) forwarded to Playwright. */
125
139
  format?: string;
@@ -134,6 +148,10 @@ interface PdfOptions extends NavigateOptions {
134
148
  width: number;
135
149
  };
136
150
  }
151
+ /**
152
+ * `LunoraBrowserOptions` is part of the experimental `@lunora/browser` API and may change without a major version bump.
153
+ * @experimental
154
+ */
137
155
  interface LunoraBrowserOptions {
138
156
  /**
139
157
  * Strict host allowlist. When set (non-empty), a navigation URL is refused
@@ -193,6 +211,7 @@ interface LunoraBrowserOptions {
193
211
  * browser, opens a context + page, navigates, performs the op, and always
194
212
  * closes the browser in a `finally` (a leaked session is billed and
195
213
  * rate-limited).
214
+ * @experimental
196
215
  */
197
216
  interface Browser {
198
217
  /** Serialized HTML of `url` after navigation settles. */
@@ -215,5 +234,9 @@ interface Browser {
215
234
  /** Render `url` to an image buffer (PNG by default). */
216
235
  screenshot: (url: string, options?: ScreenshotOptions) => Promise<Uint8Array>;
217
236
  }
237
+ /**
238
+ * `createBrowser` is part of the experimental `@lunora/browser` API and may change without a major version bump.
239
+ * @experimental
240
+ */
218
241
  declare const createBrowser: (options: LunoraBrowserOptions) => Browser;
219
242
  export { type Browser, type BrowserBindingLike, type BrowserContextLike, type BrowserLaunchLike, type BrowserLike, type LunoraBrowserOptions, type NavigateOptions, type PageLike, type PdfOptions, type ScreenshotOptions, createBrowser };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  * always has one) so the marker actually excludes an arbitrary value like `{}` —
13
13
  * a bare object fails to type-check where a binding is required, catching the
14
14
  * misuse at the call site instead of deferring to an opaque launch error.
15
+ * @experimental
15
16
  */
16
17
  interface BrowserBindingLike {
17
18
  readonly fetch: (...args: never[]) => unknown;
@@ -37,6 +38,7 @@ interface RouteLike {
37
38
  * Minimal projection of a Playwright `Page` — just the methods the helpers drive.
38
39
  * Declared structurally so a test can inject a plain stub instead of a real
39
40
  * headless page (which needs workerd + the Browser Rendering binding).
41
+ * @experimental
40
42
  */
41
43
  interface PageLike {
42
44
  /** Return the page's serialized HTML after the navigation settles. */
@@ -68,6 +70,7 @@ interface PageLike {
68
70
  /**
69
71
  * Minimal projection of a Playwright `BrowserContext`. Only `newPage` is used;
70
72
  * declared structurally for the same test-double reason as {@link PageLike}.
73
+ * @experimental
71
74
  */
72
75
  interface BrowserContextLike {
73
76
  newPage: () => Promise<PageLike>;
@@ -76,6 +79,7 @@ interface BrowserContextLike {
76
79
  * Minimal projection of a Playwright `Browser` (the value `launch` resolves to).
77
80
  * Only `newContext`/`close` are used; declared structurally for the same
78
81
  * test-double reason as {@link PageLike}.
82
+ * @experimental
79
83
  */
80
84
  interface BrowserLike {
81
85
  close: () => Promise<void>;
@@ -88,9 +92,13 @@ interface BrowserLike {
88
92
  * `@cloudflare/playwright` at module top — that keeps the heavy optional peer
89
93
  * dep out of the bundle for apps that never screenshot, and lets tests pass a
90
94
  * fake. Calling it with the Browser Rendering binding resolves a {@link BrowserLike}.
95
+ * @experimental
91
96
  */
92
97
  type BrowserLaunchLike = (binding: BrowserBindingLike, options?: Record<string, unknown>) => Promise<BrowserLike>;
93
- /** Options shared by the page-driving helpers ({@link Browser.screenshot} etc.). */
98
+ /**
99
+ * Options shared by the page-driving helpers ({@link Browser.screenshot} etc.).
100
+ * @experimental
101
+ */
94
102
  interface NavigateOptions {
95
103
  /**
96
104
  * Hard timeout in milliseconds for the navigation + operation. Clamped to a
@@ -104,7 +112,10 @@ interface NavigateOptions {
104
112
  */
105
113
  waitUntil?: "commit" | "domcontentloaded" | "load" | "networkidle";
106
114
  }
107
- /** Options for {@link Browser.screenshot}. */
115
+ /**
116
+ * Options for {@link Browser.screenshot}.
117
+ * @experimental
118
+ */
108
119
  interface ScreenshotOptions extends NavigateOptions {
109
120
  /** Capture the full scrollable page rather than just the viewport. */
110
121
  fullPage?: boolean;
@@ -119,7 +130,10 @@ interface ScreenshotOptions extends NavigateOptions {
119
130
  width: number;
120
131
  };
121
132
  }
122
- /** Options for {@link Browser.pdf}. */
133
+ /**
134
+ * Options for {@link Browser.pdf}.
135
+ * @experimental
136
+ */
123
137
  interface PdfOptions extends NavigateOptions {
124
138
  /** Paper format (`A4`, `Letter`, …) forwarded to Playwright. */
125
139
  format?: string;
@@ -134,6 +148,10 @@ interface PdfOptions extends NavigateOptions {
134
148
  width: number;
135
149
  };
136
150
  }
151
+ /**
152
+ * `LunoraBrowserOptions` is part of the experimental `@lunora/browser` API and may change without a major version bump.
153
+ * @experimental
154
+ */
137
155
  interface LunoraBrowserOptions {
138
156
  /**
139
157
  * Strict host allowlist. When set (non-empty), a navigation URL is refused
@@ -193,6 +211,7 @@ interface LunoraBrowserOptions {
193
211
  * browser, opens a context + page, navigates, performs the op, and always
194
212
  * closes the browser in a `finally` (a leaked session is billed and
195
213
  * rate-limited).
214
+ * @experimental
196
215
  */
197
216
  interface Browser {
198
217
  /** Serialized HTML of `url` after navigation settles. */
@@ -215,5 +234,9 @@ interface Browser {
215
234
  /** Render `url` to an image buffer (PNG by default). */
216
235
  screenshot: (url: string, options?: ScreenshotOptions) => Promise<Uint8Array>;
217
236
  }
237
+ /**
238
+ * `createBrowser` is part of the experimental `@lunora/browser` API and may change without a major version bump.
239
+ * @experimental
240
+ */
218
241
  declare const createBrowser: (options: LunoraBrowserOptions) => Browser;
219
242
  export { type Browser, type BrowserBindingLike, type BrowserContextLike, type BrowserLaunchLike, type BrowserLike, type LunoraBrowserOptions, type NavigateOptions, type PageLike, type PdfOptions, type ScreenshotOptions, createBrowser };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/browser",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-alpha.8",
4
4
  "description": "Cloudflare Browser Rendering for Lunora: ctx.browser screenshots, PDF, and scraping in actions",
5
5
  "keywords": [
6
6
  "browser-rendering",
@@ -46,7 +46,7 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@lunora/errors": "1.0.0-alpha.4"
49
+ "@lunora/errors": "1.0.0-alpha.5"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@cloudflare/playwright": ">=1.0.0"