effect-playwright 0.4.1 → 0.4.2

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/LICENSE CHANGED
@@ -1,7 +1,21 @@
1
- ISC License
1
+ MIT License
2
2
 
3
- Copyright 2025 Jobflow GmbH
3
+ Copyright (c) 2026 Jobflow GmbH
4
4
 
5
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,4 +1,4 @@
1
- import { A as PlaywrightError, D as PlaywrightFrameService, d as PlaywrightPageService, o as PlaywrightBrowser, s as PlaywrightBrowserService } from "../index-COItPgGw.mjs";
1
+ import { A as PlaywrightError, D as PlaywrightFrameService, d as PlaywrightPageService, o as PlaywrightBrowser, s as PlaywrightBrowserService } from "../index-6Wt-fD8d.mjs";
2
2
  import { Context, Effect, Layer, Stream } from "effect";
3
3
  import { BrowserType, LaunchOptions } from "playwright-core";
4
4
  import { Scope as Scope$1 } from "effect/Scope";
@@ -11,7 +11,7 @@ declare namespace browser_utils_d_exports {
11
11
  * Returns all pages in the browser from all contexts.
12
12
  * @category util
13
13
  */
14
- declare const allPages: (browser: PlaywrightBrowserService) => Effect.Effect<PlaywrightPageService[], never, never>;
14
+ declare const allPages: (browser: PlaywrightBrowserService) => PlaywrightPageService[];
15
15
  /**
16
16
  * Returns all frames in the browser from all pages in all contexts.
17
17
  * @category util
@@ -34,8 +34,7 @@ declare const PlaywrightEnvironment_base: Context.TagClass<PlaywrightEnvironment
34
34
  * `PlaywrightEnvironment` is a service that allows you to configure how browsers are launched once. You can then
35
35
  * use `PlaywrightEnvironment.browser` to start browsers scoped to the current lifetime. They will be closed when the scope is closed.
36
36
  *
37
- * You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect. This
38
- * also allows you to re-use the same browser as many times as you want.
37
+ * This service will not start a browser on its own. You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect.
39
38
  *
40
39
  * @since 0.1.0
41
40
  * @category tag
@@ -73,6 +72,8 @@ declare const layer: (browser: BrowserType, launchOptions?: LaunchOptions) => La
73
72
  *
74
73
  * You will need to provide the `PlaywrightEnvironment` layer first.
75
74
  *
75
+ * This will start a browser and close it when the scope is closed.
76
+ *
76
77
  * @example
77
78
  *
78
79
  * ```ts
@@ -91,6 +92,6 @@ declare const layer: (browser: BrowserType, launchOptions?: LaunchOptions) => La
91
92
  * @since 0.1.0
92
93
  * @category util
93
94
  */
94
- declare const withBrowser: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, PlaywrightError | E, PlaywrightEnvironment | Exclude<R, PlaywrightBrowser>>;
95
+ declare const withBrowser: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, PlaywrightError | E, PlaywrightEnvironment | Exclude<Exclude<R, PlaywrightBrowser>, Scope$1>>;
95
96
  //#endregion
96
97
  export { browser_utils_d_exports as BrowserUtils, environment_d_exports as PlaywrightEnvironment };
@@ -11,12 +11,12 @@ var browser_utils_exports = /* @__PURE__ */ __exportAll({
11
11
  * Returns all pages in the browser from all contexts.
12
12
  * @category util
13
13
  */
14
- const allPages = (browser) => Effect.sync(() => Array.flatten(browser.contexts().map((context) => context.pages())));
14
+ const allPages = (browser) => Array.flatten(browser.contexts().map((context) => context.pages()));
15
15
  /**
16
16
  * Returns all frames in the browser from all pages in all contexts.
17
17
  * @category util
18
18
  */
19
- const allFrames = (browser) => allPages(browser).pipe(Effect.flatMap((pages) => Effect.all(pages.map((page) => page.frames))), Effect.map(Array.flatten));
19
+ const allFrames = (browser) => Effect.all(allPages(browser).map((page) => page.frames)).pipe(Effect.map(Array.flatten));
20
20
  /**
21
21
  * Returns a stream of all framenavigated events for all current and future pages in the browser.
22
22
  * In all current contexts (but not future contexts).
@@ -40,8 +40,7 @@ var environment_exports = /* @__PURE__ */ __exportAll({
40
40
  * `PlaywrightEnvironment` is a service that allows you to configure how browsers are launched once. You can then
41
41
  * use `PlaywrightEnvironment.browser` to start browsers scoped to the current lifetime. They will be closed when the scope is closed.
42
42
  *
43
- * You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect. This
44
- * also allows you to re-use the same browser as many times as you want.
43
+ * This service will not start a browser on its own. You can use {@link withBrowser} to provide the `PlaywrightBrowser` service to the wrapped effect.
45
44
  *
46
45
  * @since 0.1.0
47
46
  * @category tag
@@ -73,16 +72,15 @@ var PlaywrightEnvironment = class extends Context.Tag("effect-playwright/experim
73
72
  * @since 0.1.0
74
73
  * @category layer
75
74
  */
76
- const layer = (browser, launchOptions) => {
77
- return Layer.effect(PlaywrightEnvironment, Playwright.pipe(Effect.map((playwright) => {
78
- return PlaywrightEnvironment.of({ browser: playwright.launchScoped(browser, launchOptions) });
79
- }), Effect.provide(Playwright.layer)));
80
- };
75
+ const layer = (browser, launchOptions) => Playwright.pipe(Effect.map((playwright) => PlaywrightEnvironment.of({ browser: playwright.launchScoped(browser, launchOptions) })), Layer.effect(PlaywrightEnvironment), Layer.provide(Playwright.layer));
76
+ const withBrowserUnscoped = Effect.provideServiceEffect(PlaywrightBrowser, PlaywrightEnvironment.pipe(Effect.flatMap((e) => e.browser)));
81
77
  /**
82
78
  * Provides a scoped `PlaywrightBrowser` service, allowing you to access the browser from the context (e.g. by yielding `PlaywrightBrowser`).
83
79
  *
84
80
  * You will need to provide the `PlaywrightEnvironment` layer first.
85
81
  *
82
+ * This will start a browser and close it when the scope is closed.
83
+ *
86
84
  * @example
87
85
  *
88
86
  * ```ts
@@ -101,6 +99,6 @@ const layer = (browser, launchOptions) => {
101
99
  * @since 0.1.0
102
100
  * @category util
103
101
  */
104
- const withBrowser = Effect.provide(PlaywrightEnvironment.pipe(Effect.map((e) => e.browser), Effect.flatten, Layer.scoped(PlaywrightBrowser)));
102
+ const withBrowser = (self) => Effect.scoped(withBrowserUnscoped(self));
105
103
  //#endregion
106
104
  export { browser_utils_exports as BrowserUtils, environment_exports as PlaywrightEnvironment };
@@ -2194,23 +2194,23 @@ interface PlaywrightBrowserService {
2194
2194
  */
2195
2195
  readonly close: Effect.Effect<void, PlaywrightError>;
2196
2196
  /**
2197
- * An Effect that returns the list of all open browser contexts.
2197
+ * Returns the list of all open browser contexts.
2198
2198
  * @see {@link Browser.contexts}
2199
2199
  */
2200
2200
  readonly contexts: () => Array<typeof PlaywrightBrowserContext.Service>;
2201
2201
  readonly newContext: (options?: NewContextOptions) => Effect.Effect<typeof PlaywrightBrowserContext.Service, PlaywrightError, Scope$1>;
2202
2202
  /**
2203
- * An Effect that returns the browser type (chromium, firefox or webkit) that the browser belongs to.
2203
+ * Returns the browser type (chromium, firefox or webkit) that the browser belongs to.
2204
2204
  * @see {@link Browser.browserType}
2205
2205
  */
2206
2206
  readonly browserType: () => BrowserType;
2207
2207
  /**
2208
- * An Effect that returns the version of the browser.
2208
+ * Returns the version of the browser.
2209
2209
  * @see {@link Browser.version}
2210
2210
  */
2211
2211
  readonly version: () => string;
2212
2212
  /**
2213
- * An Effect that returns whether the browser is connected.
2213
+ * Returns whether the browser is connected.
2214
2214
  * @see {@link Browser.isConnected}
2215
2215
  */
2216
2216
  readonly isConnected: () => boolean;
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as PlaywrightError, C as PlaywrightWorker, D as PlaywrightFrameService, E as PlaywrightFrame, O as PlaywrightLocator, S as PlaywrightResponse, T as PlaywrightClockService, _ as PlaywrightKeyboardService, a as NewPageOptions, b as PlaywrightFileChooser, c as PlaywrightBrowserContext, d as PlaywrightPageService, f as PlaywrightTouchscreen, g as PlaywrightKeyboard, h as PlaywrightMouseService, i as NewContextOptions, j as PlaywrightErrorReason, k as PlaywrightLocatorService, l as PlaywrightBrowserContextService, m as PlaywrightMouse, n as PlaywrightService, o as PlaywrightBrowser, p as PlaywrightTouchscreenService, r as LaunchOptions, s as PlaywrightBrowserService, t as Playwright, u as PlaywrightPage, v as PlaywrightDialog, w as PlaywrightClock, x as PlaywrightRequest, y as PlaywrightDownload } from "./index-COItPgGw.mjs";
1
+ import { A as PlaywrightError, C as PlaywrightWorker, D as PlaywrightFrameService, E as PlaywrightFrame, O as PlaywrightLocator, S as PlaywrightResponse, T as PlaywrightClockService, _ as PlaywrightKeyboardService, a as NewPageOptions, b as PlaywrightFileChooser, c as PlaywrightBrowserContext, d as PlaywrightPageService, f as PlaywrightTouchscreen, g as PlaywrightKeyboard, h as PlaywrightMouseService, i as NewContextOptions, j as PlaywrightErrorReason, k as PlaywrightLocatorService, l as PlaywrightBrowserContextService, m as PlaywrightMouse, n as PlaywrightService, o as PlaywrightBrowser, p as PlaywrightTouchscreenService, r as LaunchOptions, s as PlaywrightBrowserService, t as Playwright, u as PlaywrightPage, v as PlaywrightDialog, w as PlaywrightClock, x as PlaywrightRequest, y as PlaywrightDownload } from "./index-6Wt-fD8d.mjs";
2
2
  export { LaunchOptions, NewContextOptions, NewPageOptions, Playwright, PlaywrightBrowser, PlaywrightBrowserContext, PlaywrightBrowserContextService, PlaywrightBrowserService, PlaywrightClock, PlaywrightClockService, PlaywrightDialog, PlaywrightDownload, PlaywrightError, PlaywrightErrorReason, PlaywrightFileChooser, PlaywrightFrame, PlaywrightFrameService, PlaywrightKeyboard, PlaywrightKeyboardService, PlaywrightLocator, PlaywrightLocatorService, PlaywrightMouse, PlaywrightMouseService, PlaywrightPage, PlaywrightPageService, PlaywrightRequest, PlaywrightResponse, PlaywrightService, PlaywrightTouchscreen, PlaywrightTouchscreenService, PlaywrightWorker };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "effect-playwright",
3
3
  "type": "module",
4
- "version": "0.4.1",
4
+ "version": "0.4.2",
5
5
  "description": "An Effect-based Playwright library.",
6
6
  "author": "Jobflow GmbH",
7
- "license": "ISC",
7
+ "license": "MIT",
8
8
  "homepage": "https://github.com/Jobflow-io/effect-playwright",
9
9
  "repository": {
10
10
  "type": "git",
@@ -29,28 +29,29 @@
29
29
  "automation"
30
30
  ],
31
31
  "dependencies": {
32
- "playwright-core": "^1.58.2"
32
+ "playwright-core": "^1.59.1"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@effect/platform": "^0.93.3",
36
36
  "effect": "^3.19.6"
37
37
  },
38
38
  "devDependencies": {
39
- "@biomejs/biome": "2.4.9",
40
- "@effect/cli": "^0.75.0",
41
- "@effect/language-service": "0.84.2",
42
- "@effect/platform": "^0.96.0",
39
+ "@biomejs/biome": "2.4.14",
40
+ "@effect/cli": "^0.75.1",
41
+ "@effect/language-service": "0.85.1",
42
+ "@effect/platform": "^0.96.1",
43
43
  "@effect/platform-node": "^0.106.0",
44
44
  "@effect/vitest": "^0.29.0",
45
- "@types/node": "^25.5.0",
46
- "effect": "^3.21.0",
47
- "playwright": "^1.58.2",
48
- "ts-morph": "^27.0.2",
49
- "tsdown": "0.21.7",
45
+ "@types/node": "^25.6.1",
46
+ "effect": "^3.21.2",
47
+ "playwright": "^1.59.1",
48
+ "ts-morph": "^28.0.0",
49
+ "tsdown": "0.22.0",
50
50
  "tsx": "^4.21.0",
51
- "typedoc": "^0.28.18",
52
- "typescript": "^6.0.2",
53
- "vitest": "^4.1.2"
51
+ "typedoc": "^0.28.19",
52
+ "typescript": "^6.0.3",
53
+ "vite": "^8.0.11",
54
+ "vitest": "^4.1.5"
54
55
  },
55
56
  "types": "./dist/index.d.mts",
56
57
  "scripts": {