@guanzhu.me/pw-cli 0.0.18 → 0.0.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guanzhu.me/pw-cli",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Persistent Playwright browser CLI with headed defaults, profile support, queueing, and script execution",
5
5
  "bin": {
6
6
  "pw-cli": "./bin/pw-cli.js"
@@ -9,7 +9,27 @@ const crypto = require('crypto');
9
9
  const { execSync } = require('child_process');
10
10
  const { readState, writeState, clearState, getProfileDir } = require('./state');
11
11
  const { probeCDP, findFreePort, sleep, fetchActivePageUrl } = require('./utils');
12
- const { ws, wsServer } = require('../node_modules/@playwright/cli/node_modules/playwright-core/lib/utilsBundleImpl');
12
+
13
+ function loadPlaywrightUtilsBundle() {
14
+ const candidates = [
15
+ '../node_modules/@playwright/cli/node_modules/playwright-core/lib/utilsBundleImpl',
16
+ '../node_modules/@playwright/cli/node_modules/playwright-core/lib/utilsBundleImpl/index.js',
17
+ ];
18
+
19
+ for (const candidate of candidates) {
20
+ try {
21
+ return require(candidate);
22
+ } catch (error) {
23
+ if (error.code !== 'MODULE_NOT_FOUND') {
24
+ throw error;
25
+ }
26
+ }
27
+ }
28
+
29
+ throw new Error('Unable to load playwright-core utilsBundleImpl from @playwright/cli. Reinstall @playwright/cli or playwright.');
30
+ }
31
+
32
+ const { ws, wsServer } = loadPlaywrightUtilsBundle();
13
33
 
14
34
  const DAEMON_SCRIPT = path.join(__dirname, 'launch-daemon.js');
15
35