@intuned/runtime-dev 1.3.5-cli-enhancements.0 → 1.3.6-brave.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.
|
@@ -18,6 +18,7 @@ var _waitOn = _interopRequireDefault(require("wait-on"));
|
|
|
18
18
|
var _errors = require("./runApi/errors");
|
|
19
19
|
var _neverthrow = require("neverthrow");
|
|
20
20
|
var _setupContextHook = require("./setupContextHook");
|
|
21
|
+
var _which = _interopRequireDefault(require("which"));
|
|
21
22
|
var _portfinder = require("portfinder");
|
|
22
23
|
var _extensionsHelpers = require("./extensionsHelpers");
|
|
23
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -44,7 +45,8 @@ async function launchChromium({
|
|
|
44
45
|
downloadsPath,
|
|
45
46
|
cdpAddress,
|
|
46
47
|
cdpPort,
|
|
47
|
-
appModeInitialUrl
|
|
48
|
+
appModeInitialUrl,
|
|
49
|
+
executablePath
|
|
48
50
|
}) {
|
|
49
51
|
if (cdpAddress) {
|
|
50
52
|
const browser = await playwright.chromium.connectOverCDP(cdpAddress);
|
|
@@ -81,7 +83,15 @@ async function launchChromium({
|
|
|
81
83
|
if (appModeInitialUrl) {
|
|
82
84
|
extraArgs.push(`--app=${appModeInitialUrl}`);
|
|
83
85
|
}
|
|
86
|
+
if (executablePath) {
|
|
87
|
+
executablePath = await fs.realpath(executablePath);
|
|
88
|
+
if (!(await fs.exists(executablePath))) {
|
|
89
|
+
console.warn(`Executable path ${executablePath} does not exist. Falling back to default.`);
|
|
90
|
+
executablePath = undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
84
93
|
const context = await playwright.chromium.launchPersistentContext(userDataDir, {
|
|
94
|
+
executablePath,
|
|
85
95
|
headless,
|
|
86
96
|
viewport: null,
|
|
87
97
|
proxy,
|
|
@@ -149,7 +159,8 @@ async function withPlaywrightContext({
|
|
|
149
159
|
} = await launchChromium({
|
|
150
160
|
proxy,
|
|
151
161
|
headless,
|
|
152
|
-
downloadsPath
|
|
162
|
+
downloadsPath,
|
|
163
|
+
executablePath: await getExecutablePath()
|
|
153
164
|
}));
|
|
154
165
|
}
|
|
155
166
|
return await fn(context, page);
|
|
@@ -175,7 +186,8 @@ async function withPlaywrightContext({
|
|
|
175
186
|
proxy,
|
|
176
187
|
headless,
|
|
177
188
|
downloadsPath,
|
|
178
|
-
cdpPort: port
|
|
189
|
+
cdpPort: port,
|
|
190
|
+
executablePath: await getExecutablePath()
|
|
179
191
|
}));
|
|
180
192
|
}
|
|
181
193
|
let hookResult;
|
|
@@ -275,4 +287,12 @@ async function getRemotePlaywrightContext(cdpAddress) {
|
|
|
275
287
|
browser,
|
|
276
288
|
context
|
|
277
289
|
};
|
|
290
|
+
}
|
|
291
|
+
async function getExecutablePath() {
|
|
292
|
+
if (process.env.BROWSER_TYPE === "brave") {
|
|
293
|
+
return (await (0, _which.default)("brave-browser-stable", {
|
|
294
|
+
nothrow: true
|
|
295
|
+
})) || undefined;
|
|
296
|
+
}
|
|
297
|
+
return undefined;
|
|
278
298
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuned/runtime-dev",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6-brave.0",
|
|
4
4
|
"description": "Intuned runtime",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"typescript": "5.1.6",
|
|
94
94
|
"uuid": "11.1.0",
|
|
95
95
|
"wait-on": "7.2.0",
|
|
96
|
+
"which": "^5.0.0",
|
|
96
97
|
"yaml": "2.8.1",
|
|
97
98
|
"zod": "^3.21.4"
|
|
98
99
|
},
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
"@types/promptly": "^3.0.4",
|
|
111
112
|
"@types/terminal-kit": "^2.5.7",
|
|
112
113
|
"@types/wait-on": "^5.3.4",
|
|
114
|
+
"@types/which": "^3.0.4",
|
|
113
115
|
"@typescript-eslint/eslint-plugin": "^5.47.1",
|
|
114
116
|
"@typescript-eslint/parser": "^7.5.0",
|
|
115
117
|
"@vitest/ui": "^1.1.3",
|