@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 +1 -1
- package/src/browser-manager.js +21 -1
package/package.json
CHANGED
package/src/browser-manager.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|