@namzu/browser 0.1.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.
- package/CHANGELOG.md +32 -0
- package/LICENSE.md +110 -0
- package/README.md +149 -0
- package/dist/classifier.d.ts +70 -0
- package/dist/classifier.d.ts.map +1 -0
- package/dist/classifier.js +147 -0
- package/dist/classifier.js.map +1 -0
- package/dist/detect.d.ts +126 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +282 -0
- package/dist/detect.js.map +1 -0
- package/dist/errors.d.ts +64 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +99 -0
- package/dist/errors.js.map +1 -0
- package/dist/host.d.ts +167 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +1024 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/page-scripts.d.ts +51 -0
- package/dist/page-scripts.d.ts.map +1 -0
- package/dist/page-scripts.js +123 -0
- package/dist/page-scripts.js.map +1 -0
- package/dist/policy.d.ts +61 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +150 -0
- package/dist/policy.js.map +1 -0
- package/dist/profiles.d.ts +107 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +312 -0
- package/dist/profiles.js.map +1 -0
- package/dist/relay.d.ts +27 -0
- package/dist/relay.d.ts.map +1 -0
- package/dist/relay.js +69 -0
- package/dist/relay.js.map +1 -0
- package/dist/snapshot.d.ts +101 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +265 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/windows-bridge-script.d.ts +29 -0
- package/dist/windows-bridge-script.d.ts.map +1 -0
- package/dist/windows-bridge-script.js +161 -0
- package/dist/windows-bridge-script.js.map +1 -0
- package/dist/windows-bridge.d.ts +120 -0
- package/dist/windows-bridge.d.ts.map +1 -0
- package/dist/windows-bridge.js +267 -0
- package/dist/windows-bridge.js.map +1 -0
- package/dist/windows-engine.d.ts +55 -0
- package/dist/windows-engine.d.ts.map +1 -0
- package/dist/windows-engine.js +154 -0
- package/dist/windows-engine.js.map +1 -0
- package/dist/wsl.d.ts +52 -0
- package/dist/wsl.d.ts.map +1 -0
- package/dist/wsl.js +134 -0
- package/dist/wsl.js.map +1 -0
- package/package.json +74 -0
- package/src/classifier.ts +191 -0
- package/src/detect.ts +432 -0
- package/src/errors.ts +121 -0
- package/src/host.ts +1217 -0
- package/src/index.ts +79 -0
- package/src/page-scripts.ts +154 -0
- package/src/policy.ts +190 -0
- package/src/profiles.ts +373 -0
- package/src/relay.ts +101 -0
- package/src/snapshot.ts +317 -0
- package/src/windows-bridge-script.ts +160 -0
- package/src/windows-bridge.ts +358 -0
- package/src/windows-engine.ts +208 -0
- package/src/wsl.ts +155 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { WINDOWS_BRIDGE_SCRIPT } from './windows-bridge-script.js';
|
|
3
|
+
/** A refusal from the bridge script, before `ready`. */
|
|
4
|
+
export class WindowsBridgeError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
name = 'WindowsBridgeError';
|
|
7
|
+
constructor(code, message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const PARAMS_PLACEHOLDER = '__NAMZU_BRIDGE_PARAMS__';
|
|
13
|
+
/** PowerShell's `-EncodedCommand` form: the script as UTF-16LE, base64. */
|
|
14
|
+
export function encodePowerShellCommand(script) {
|
|
15
|
+
return Buffer.from(script, 'utf16le').toString('base64');
|
|
16
|
+
}
|
|
17
|
+
/** The bridge script with `params` embedded. */
|
|
18
|
+
export function bridgeScript(params) {
|
|
19
|
+
const encoded = Buffer.from(JSON.stringify(params), 'utf8').toString('base64');
|
|
20
|
+
return WINDOWS_BRIDGE_SCRIPT.replace(PARAMS_PLACEHOLDER, encoded);
|
|
21
|
+
}
|
|
22
|
+
/** `powershell.exe`'s arguments for the bridge. */
|
|
23
|
+
export function bridgeArguments(params) {
|
|
24
|
+
return [
|
|
25
|
+
'-NoLogo',
|
|
26
|
+
'-NoProfile',
|
|
27
|
+
'-NonInteractive',
|
|
28
|
+
'-ExecutionPolicy',
|
|
29
|
+
'Bypass',
|
|
30
|
+
'-EncodedCommand',
|
|
31
|
+
encodePowerShellCommand(bridgeScript(params)),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Chrome's `DevToolsActivePort` file: the port on the first line, the browser
|
|
36
|
+
* target's path on the second. `undefined` for anything else.
|
|
37
|
+
*/
|
|
38
|
+
export function parseDevToolsActivePort(text) {
|
|
39
|
+
if (text === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
const [first, second] = text.split(/\r?\n/);
|
|
42
|
+
const port = Number((first ?? '').trim());
|
|
43
|
+
const path = (second ?? '').trim();
|
|
44
|
+
if (!Number.isInteger(port) || port <= 0 || port > 65_535)
|
|
45
|
+
return undefined;
|
|
46
|
+
if (!/^\/devtools\/browser\/[A-Za-z0-9-]+$/.test(path))
|
|
47
|
+
return undefined;
|
|
48
|
+
return { port, path };
|
|
49
|
+
}
|
|
50
|
+
const NEWLINE = 0x0a;
|
|
51
|
+
const CARRIAGE_RETURN = 0x0d;
|
|
52
|
+
/**
|
|
53
|
+
* Cuts a byte stream into lines at `\n` (a trailing `\r` is dropped).
|
|
54
|
+
* Chunks are kept as they arrive and joined once per line, and only the new
|
|
55
|
+
* chunk is scanned, so a multi-megabyte line costs one copy.
|
|
56
|
+
*/
|
|
57
|
+
export class LineSplitter {
|
|
58
|
+
onLine;
|
|
59
|
+
pending = [];
|
|
60
|
+
pendingBytes = 0;
|
|
61
|
+
constructor(onLine) {
|
|
62
|
+
this.onLine = onLine;
|
|
63
|
+
}
|
|
64
|
+
push(chunk) {
|
|
65
|
+
let start = 0;
|
|
66
|
+
for (;;) {
|
|
67
|
+
const at = chunk.indexOf(NEWLINE, start);
|
|
68
|
+
if (at === -1)
|
|
69
|
+
break;
|
|
70
|
+
let line;
|
|
71
|
+
const part = chunk.subarray(start, at);
|
|
72
|
+
if (this.pendingBytes > 0) {
|
|
73
|
+
this.pending.push(part);
|
|
74
|
+
line = Buffer.concat(this.pending, this.pendingBytes + part.length);
|
|
75
|
+
this.pending = [];
|
|
76
|
+
this.pendingBytes = 0;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
line = part;
|
|
80
|
+
}
|
|
81
|
+
if (line.length > 0 && line[line.length - 1] === CARRIAGE_RETURN) {
|
|
82
|
+
line = line.subarray(0, line.length - 1);
|
|
83
|
+
}
|
|
84
|
+
this.onLine(line);
|
|
85
|
+
start = at + 1;
|
|
86
|
+
}
|
|
87
|
+
if (start < chunk.length) {
|
|
88
|
+
const rest = chunk.subarray(start);
|
|
89
|
+
this.pending.push(rest);
|
|
90
|
+
this.pendingBytes += rest.length;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Bytes held for a line not yet ended. */
|
|
94
|
+
get buffered() {
|
|
95
|
+
return this.pendingBytes;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const CONTROL_PREFIX = Buffer.from('@namzu ');
|
|
99
|
+
const OPEN_BRACE = 0x7b;
|
|
100
|
+
/** A running bridge: one `powershell.exe`, one browser connection. */
|
|
101
|
+
export class WindowsCdpBridge {
|
|
102
|
+
child;
|
|
103
|
+
ready;
|
|
104
|
+
stderrTail;
|
|
105
|
+
messageListener;
|
|
106
|
+
early = [];
|
|
107
|
+
exitedFlag = false;
|
|
108
|
+
/** Resolves when the bridge process has exited. */
|
|
109
|
+
exited;
|
|
110
|
+
constructor(child, ready, exited, early, stderrTail) {
|
|
111
|
+
this.child = child;
|
|
112
|
+
this.ready = ready;
|
|
113
|
+
this.stderrTail = stderrTail;
|
|
114
|
+
this.exited = exited;
|
|
115
|
+
this.early.push(...early);
|
|
116
|
+
void exited.then(() => {
|
|
117
|
+
this.exitedFlag = true;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** The bridge's process id on the Linux side. */
|
|
121
|
+
get pid() {
|
|
122
|
+
return this.child.pid;
|
|
123
|
+
}
|
|
124
|
+
get alive() {
|
|
125
|
+
return !this.exitedFlag;
|
|
126
|
+
}
|
|
127
|
+
static async start(options) {
|
|
128
|
+
const args = bridgeArguments(options.params);
|
|
129
|
+
const child = options.spawnProcess
|
|
130
|
+
? options.spawnProcess(options.powershell, args, options.env)
|
|
131
|
+
: spawn(options.powershell, args, {
|
|
132
|
+
env: options.env,
|
|
133
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
134
|
+
windowsHide: true,
|
|
135
|
+
});
|
|
136
|
+
const stderrTail = [];
|
|
137
|
+
child.stderr.setEncoding('utf8');
|
|
138
|
+
child.stderr.on('data', (text) => {
|
|
139
|
+
stderrTail.push(text);
|
|
140
|
+
while (stderrTail.join('').length > 4_000)
|
|
141
|
+
stderrTail.shift();
|
|
142
|
+
});
|
|
143
|
+
// A write to a bridge that has gone is reported by `exited`, not thrown.
|
|
144
|
+
child.stdin.on('error', () => undefined);
|
|
145
|
+
const exited = new Promise((resolve) => {
|
|
146
|
+
child.once('close', (code, signal) => resolve({ code, signal }));
|
|
147
|
+
child.once('error', () => resolve({ code: null, signal: null }));
|
|
148
|
+
});
|
|
149
|
+
const holder = {};
|
|
150
|
+
const early = [];
|
|
151
|
+
const readyTimeout = options.readyTimeoutMs ?? options.params.launchTimeoutMs + 15_000;
|
|
152
|
+
const ready = await new Promise((resolve, reject) => {
|
|
153
|
+
let settled = false;
|
|
154
|
+
const settle = (fn) => {
|
|
155
|
+
if (settled)
|
|
156
|
+
return;
|
|
157
|
+
settled = true;
|
|
158
|
+
clearTimeout(timer);
|
|
159
|
+
fn();
|
|
160
|
+
};
|
|
161
|
+
const timer = setTimeout(() => {
|
|
162
|
+
settle(() => reject(new WindowsBridgeError('bridge-timeout', `powershell.exe did not report within ${readyTimeout} ms.${tail(stderrTail)}`)));
|
|
163
|
+
}, readyTimeout);
|
|
164
|
+
const splitter = new LineSplitter((line) => {
|
|
165
|
+
if (line[0] === OPEN_BRACE) {
|
|
166
|
+
if (holder.bridge)
|
|
167
|
+
holder.bridge.deliver(line);
|
|
168
|
+
else
|
|
169
|
+
early.push(line);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (!startsWith(line, CONTROL_PREFIX))
|
|
173
|
+
return;
|
|
174
|
+
let control;
|
|
175
|
+
try {
|
|
176
|
+
control = JSON.parse(line.subarray(CONTROL_PREFIX.length).toString('utf8'));
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (control.type === 'ready')
|
|
182
|
+
settle(() => resolve(control));
|
|
183
|
+
else if (control.type === 'error') {
|
|
184
|
+
settle(() => reject(new WindowsBridgeError(String(control.code ?? 'bridge-error'), String(control.message ?? 'The bridge failed.'))));
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
child.stdout.on('data', (chunk) => splitter.push(chunk));
|
|
188
|
+
child.once('error', (error) => {
|
|
189
|
+
settle(() => reject(new WindowsBridgeError('spawn-failed', `Could not start ${options.powershell}: ${error.message}`)));
|
|
190
|
+
});
|
|
191
|
+
void exited.then(({ code }) => {
|
|
192
|
+
settle(() => reject(new WindowsBridgeError('bridge-exited', `powershell.exe exited (code ${code}) before the browser was ready.${tail(stderrTail)}`)));
|
|
193
|
+
});
|
|
194
|
+
}).catch((error) => {
|
|
195
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
196
|
+
child.kill('SIGKILL');
|
|
197
|
+
throw error;
|
|
198
|
+
});
|
|
199
|
+
holder.bridge = new WindowsCdpBridge(child, ready, exited, early, stderrTail);
|
|
200
|
+
return holder.bridge;
|
|
201
|
+
}
|
|
202
|
+
deliver(line) {
|
|
203
|
+
if (this.messageListener)
|
|
204
|
+
this.messageListener(line);
|
|
205
|
+
else
|
|
206
|
+
this.early.push(line);
|
|
207
|
+
}
|
|
208
|
+
/** Receive every CDP message from the browser, one per call, as UTF-8 JSON. */
|
|
209
|
+
onMessage(listener) {
|
|
210
|
+
this.messageListener = listener;
|
|
211
|
+
const held = this.early.splice(0);
|
|
212
|
+
for (const line of held)
|
|
213
|
+
listener(line);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Send one CDP message. A message with a raw newline (legal JSON
|
|
217
|
+
* whitespace, never produced by Playwright) is re-serialised so it stays
|
|
218
|
+
* one line.
|
|
219
|
+
*/
|
|
220
|
+
send(message) {
|
|
221
|
+
if (!this.alive || this.child.stdin.destroyed)
|
|
222
|
+
return false;
|
|
223
|
+
let text = typeof message === 'string' ? message : message.toString('utf8');
|
|
224
|
+
if (text.includes('\n') || text.includes('\r'))
|
|
225
|
+
text = JSON.stringify(JSON.parse(text));
|
|
226
|
+
this.child.stdin.write(`${text}\n`);
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
/** Leave a browser this bridge started running when it exits. */
|
|
230
|
+
keepBrowser() {
|
|
231
|
+
if (this.alive && !this.child.stdin.destroyed)
|
|
232
|
+
this.child.stdin.write('@namzu keep\n');
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Close stdin and wait for the bridge to exit (it closes a browser it
|
|
236
|
+
* started unless told to keep it). Killed after `timeoutMs`.
|
|
237
|
+
*/
|
|
238
|
+
async stop(timeoutMs = 15_000) {
|
|
239
|
+
if (!this.alive)
|
|
240
|
+
return;
|
|
241
|
+
this.child.stdin.end();
|
|
242
|
+
let timer;
|
|
243
|
+
const timedOut = new Promise((resolve) => {
|
|
244
|
+
timer = setTimeout(() => resolve('timeout'), timeoutMs);
|
|
245
|
+
});
|
|
246
|
+
const outcome = await Promise.race([this.exited, timedOut]);
|
|
247
|
+
clearTimeout(timer);
|
|
248
|
+
if (outcome === 'timeout') {
|
|
249
|
+
this.child.kill('SIGKILL');
|
|
250
|
+
await this.exited;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/** The end of what `powershell.exe` wrote to stderr. */
|
|
254
|
+
get stderr() {
|
|
255
|
+
return this.stderrTail.join('');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function startsWith(line, prefix) {
|
|
259
|
+
return line.length >= prefix.length && line.subarray(0, prefix.length).equals(prefix);
|
|
260
|
+
}
|
|
261
|
+
function tail(parts) {
|
|
262
|
+
const text = parts.join('').trim();
|
|
263
|
+
if (text.length === 0)
|
|
264
|
+
return '';
|
|
265
|
+
return ` PowerShell said: ${text.length > 600 ? `…${text.slice(-600)}` : text}`;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=windows-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windows-bridge.js","sourceRoot":"","sources":["../src/windows-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAyClE,wDAAwD;AACxD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAIlC;IAHQ,IAAI,GAAG,oBAAoB,CAAA;IAE7C,YACU,IAAY,EACrB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAA;QAHL,SAAI,GAAJ,IAAI,CAAQ;IAItB,CAAC;CACD;AAED,MAAM,kBAAkB,GAAG,yBAAyB,CAAA;AAEpD,2EAA2E;AAC3E,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACrD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AACzD,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,YAAY,CAAC,MAA2B;IACvD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CA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C,CAAC,IAAI,EAAE,CAAA;IAClC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAChC,OAAO,qBAAqB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAChF,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type Browser, type BrowserContext } from 'playwright-core';
|
|
2
|
+
import type { WindowsCdpBrowserPlan } from './detect.js';
|
|
3
|
+
import { type StartWindowsBridgeOptions, WindowsCdpBridge } from './windows-bridge.js';
|
|
4
|
+
/**
|
|
5
|
+
* The `windows-cdp` engine: the Windows browser, started (or found) by the
|
|
6
|
+
* PowerShell bridge, driven by Playwright over CDP.
|
|
7
|
+
*
|
|
8
|
+
* Under NAT networking, WSL cannot reach Windows' `127.0.0.1`, so Playwright
|
|
9
|
+
* connects to a relay on WSL's `127.0.0.1` and every message crosses the
|
|
10
|
+
* bridge's standard streams. Under mirrored networking it first tries the
|
|
11
|
+
* browser's own port, and falls back to the relay when that does not answer.
|
|
12
|
+
* Either way the bridge process stays up: it is what closes a browser it
|
|
13
|
+
* started if this process dies.
|
|
14
|
+
*/
|
|
15
|
+
export interface WindowsBrowserConnection {
|
|
16
|
+
readonly browser: Browser;
|
|
17
|
+
readonly context: BrowserContext;
|
|
18
|
+
readonly bridge: WindowsCdpBridge;
|
|
19
|
+
/** `relay` through the bridge, or `direct` to the browser's port (mirrored networking). */
|
|
20
|
+
readonly transport: 'relay' | 'direct';
|
|
21
|
+
/** The profile's user data directory, as Windows sees it. */
|
|
22
|
+
readonly userDataDir: string;
|
|
23
|
+
/** Whether the bridge started the browser (else it attached to one already running). */
|
|
24
|
+
readonly launched: boolean;
|
|
25
|
+
/** Close the browser, then the connection. */
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
/** Disconnect and leave the browser running. */
|
|
28
|
+
detach(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export interface ConnectWindowsBrowserOptions {
|
|
31
|
+
readonly plan: WindowsCdpBrowserPlan;
|
|
32
|
+
readonly profile: string;
|
|
33
|
+
/** The profile's user data directory (Windows path) when it is already known. */
|
|
34
|
+
readonly userDataDir?: string;
|
|
35
|
+
/** Close a browser the bridge started if this process goes away. */
|
|
36
|
+
readonly closeOnExit: boolean;
|
|
37
|
+
/** The environment `powershell.exe` is started with. */
|
|
38
|
+
readonly env: NodeJS.ProcessEnv;
|
|
39
|
+
/** Default 60 000. */
|
|
40
|
+
readonly timeoutMs?: number;
|
|
41
|
+
/** Called for each download the browser refuses, with its suggested file name. */
|
|
42
|
+
readonly onDownloadRefused?: (name: string) => void;
|
|
43
|
+
/** For tests. */
|
|
44
|
+
readonly spawnProcess?: StartWindowsBridgeOptions['spawnProcess'];
|
|
45
|
+
}
|
|
46
|
+
/** The environment for `powershell.exe`: the caller's, plus the interop socket the plan found. */
|
|
47
|
+
export declare function windowsBridgeEnv(plan: WindowsCdpBrowserPlan, env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
48
|
+
export declare function connectWindowsBrowser(options: ConnectWindowsBrowserOptions): Promise<WindowsBrowserConnection>;
|
|
49
|
+
/**
|
|
50
|
+
* Close the browser running on `userDataDir` through a fresh bridge that
|
|
51
|
+
* only attaches (it never starts one): `Browser.close` over CDP, which lets
|
|
52
|
+
* the browser save the profile.
|
|
53
|
+
*/
|
|
54
|
+
export declare function closeWindowsBrowser(options: Pick<ConnectWindowsBrowserOptions, 'plan' | 'profile' | 'env' | 'spawnProcess'>, userDataDir: string): Promise<boolean>;
|
|
55
|
+
//# sourceMappingURL=windows-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windows-engine.d.ts","sourceRoot":"","sources":["../src/windows-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAA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ACjE;AAID,kGAAkG;AAClG,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,qBAAqB,EAC3B,GAAG,EAAE,MAAM,CAAC,UAAU,GACpB,MAAM,CAAC,UAAU,CAEnB;AAED,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,4BAA4B,GACnC,OAAO,CAAC,wBAAwB,CAAC,CA+GnC;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,IAAI,CAAC,4BAA4B,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,cAAc,CAAC,EACxF,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC,CAwBlB"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { chromium } from 'playwright-core';
|
|
2
|
+
import { startCdpRelay } from './relay.js';
|
|
3
|
+
import { WindowsCdpBridge } from './windows-bridge.js';
|
|
4
|
+
const DIRECT_CONNECT_TIMEOUT_MS = 3_000;
|
|
5
|
+
/** The environment for `powershell.exe`: the caller's, plus the interop socket the plan found. */
|
|
6
|
+
export function windowsBridgeEnv(plan, env) {
|
|
7
|
+
return plan.interopSocket ? { ...env, WSL_INTEROP: plan.interopSocket } : { ...env };
|
|
8
|
+
}
|
|
9
|
+
export async function connectWindowsBrowser(options) {
|
|
10
|
+
const { plan } = options;
|
|
11
|
+
const timeoutMs = options.timeoutMs ?? 60_000;
|
|
12
|
+
const bridge = await WindowsCdpBridge.start({
|
|
13
|
+
powershell: plan.powershell,
|
|
14
|
+
env: windowsBridgeEnv(plan, options.env),
|
|
15
|
+
params: {
|
|
16
|
+
executable: plan.windowsExecutable,
|
|
17
|
+
profile: options.profile,
|
|
18
|
+
...(options.userDataDir ? { userDataDir: options.userDataDir } : {}),
|
|
19
|
+
headless: plan.headless,
|
|
20
|
+
closeOnExit: options.closeOnExit,
|
|
21
|
+
launchTimeoutMs: Math.max(5_000, timeoutMs - 15_000),
|
|
22
|
+
},
|
|
23
|
+
...(options.spawnProcess ? { spawnProcess: options.spawnProcess } : {}),
|
|
24
|
+
});
|
|
25
|
+
let relay;
|
|
26
|
+
let browser;
|
|
27
|
+
let transport = 'relay';
|
|
28
|
+
try {
|
|
29
|
+
if (plan.networkingMode === 'mirrored') {
|
|
30
|
+
browser = await chromium
|
|
31
|
+
.connectOverCDP(`ws://127.0.0.1:${bridge.ready.port}${bridge.ready.path}`, {
|
|
32
|
+
timeout: DIRECT_CONNECT_TIMEOUT_MS,
|
|
33
|
+
})
|
|
34
|
+
.catch(() => undefined);
|
|
35
|
+
if (browser)
|
|
36
|
+
transport = 'direct';
|
|
37
|
+
}
|
|
38
|
+
if (!browser) {
|
|
39
|
+
relay = await startCdpRelay(bridge);
|
|
40
|
+
browser = await chromium.connectOverCDP(relay.url, { timeout: timeoutMs });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
await relay?.close().catch(() => undefined);
|
|
45
|
+
// A browser the bridge started for a connection that never came up is
|
|
46
|
+
// not wanted: stopping the bridge closes it (when closeOnExit).
|
|
47
|
+
await bridge.stop().catch(() => undefined);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
const context = browser.contexts()[0];
|
|
51
|
+
if (!context) {
|
|
52
|
+
await browser.close().catch(() => undefined);
|
|
53
|
+
await relay?.close().catch(() => undefined);
|
|
54
|
+
await bridge.stop().catch(() => undefined);
|
|
55
|
+
throw new Error('The Windows browser has no default context.');
|
|
56
|
+
}
|
|
57
|
+
// Playwright points the browser's downloads at a temporary directory on
|
|
58
|
+
// this side, which on Windows names a path that does not exist (or worse,
|
|
59
|
+
// one that does). Refuse downloads in the browser itself instead, and
|
|
60
|
+
// report each one.
|
|
61
|
+
let session;
|
|
62
|
+
try {
|
|
63
|
+
session = await browser.newBrowserCDPSession();
|
|
64
|
+
await session.send('Browser.setDownloadBehavior', { behavior: 'deny', eventsEnabled: true });
|
|
65
|
+
session.on('Browser.downloadWillBegin', (event) => {
|
|
66
|
+
options.onDownloadRefused?.(event.suggestedFilename ?? 'a file');
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
await browser.close().catch(() => undefined);
|
|
71
|
+
await relay?.close().catch(() => undefined);
|
|
72
|
+
await bridge.stop().catch(() => undefined);
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
let finished = false;
|
|
76
|
+
const finish = async (closeBrowser) => {
|
|
77
|
+
if (finished)
|
|
78
|
+
return;
|
|
79
|
+
finished = true;
|
|
80
|
+
if (closeBrowser) {
|
|
81
|
+
await session
|
|
82
|
+
?.send('Browser.close')
|
|
83
|
+
.then(() => undefined)
|
|
84
|
+
.catch(() => undefined);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
bridge.keepBrowser();
|
|
88
|
+
}
|
|
89
|
+
await browser?.close().catch(() => undefined);
|
|
90
|
+
await relay?.close().catch(() => undefined);
|
|
91
|
+
await bridge.stop().catch(() => undefined);
|
|
92
|
+
};
|
|
93
|
+
browser.on('disconnected', () => {
|
|
94
|
+
void relay?.close().catch(() => undefined);
|
|
95
|
+
});
|
|
96
|
+
void bridge.exited.then(() => {
|
|
97
|
+
if (finished)
|
|
98
|
+
return;
|
|
99
|
+
// The bridge went away on its own: killed, or its interop session
|
|
100
|
+
// ended. A Windows process whose WSL side is killed is not told, so
|
|
101
|
+
// the browser it started would stay up with nobody driving it. Under
|
|
102
|
+
// NAT the bridge was the only way to the browser, so the connection is
|
|
103
|
+
// gone too.
|
|
104
|
+
finished = true;
|
|
105
|
+
if (transport === 'relay')
|
|
106
|
+
void browser?.close().catch(() => undefined);
|
|
107
|
+
void relay?.close().catch(() => undefined);
|
|
108
|
+
if (bridge.ready.launched && options.closeOnExit) {
|
|
109
|
+
void closeWindowsBrowser(options, bridge.ready.userDataDir).catch(() => undefined);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
browser,
|
|
114
|
+
context,
|
|
115
|
+
bridge,
|
|
116
|
+
transport,
|
|
117
|
+
userDataDir: bridge.ready.userDataDir,
|
|
118
|
+
launched: bridge.ready.launched,
|
|
119
|
+
close: () => finish(true),
|
|
120
|
+
detach: () => finish(false),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Close the browser running on `userDataDir` through a fresh bridge that
|
|
125
|
+
* only attaches (it never starts one): `Browser.close` over CDP, which lets
|
|
126
|
+
* the browser save the profile.
|
|
127
|
+
*/
|
|
128
|
+
export async function closeWindowsBrowser(options, userDataDir) {
|
|
129
|
+
let bridge;
|
|
130
|
+
try {
|
|
131
|
+
bridge = await WindowsCdpBridge.start({
|
|
132
|
+
powershell: options.plan.powershell,
|
|
133
|
+
env: windowsBridgeEnv(options.plan, options.env),
|
|
134
|
+
params: {
|
|
135
|
+
executable: options.plan.windowsExecutable,
|
|
136
|
+
profile: options.profile,
|
|
137
|
+
userDataDir,
|
|
138
|
+
headless: true,
|
|
139
|
+
closeOnExit: false,
|
|
140
|
+
launchTimeoutMs: 5_000,
|
|
141
|
+
attachOnly: true,
|
|
142
|
+
},
|
|
143
|
+
...(options.spawnProcess ? { spawnProcess: options.spawnProcess } : {}),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
bridge.send(JSON.stringify({ id: 1, method: 'Browser.close' }));
|
|
150
|
+
// The bridge exits by itself when the browser drops the connection.
|
|
151
|
+
await bridge.stop(10_000);
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=windows-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windows-engine.js","sourceRoot":"","sources":["../src/windows-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE9F,OAAO,EAAiB,aAAa,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAkC,gBA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}
|
package/dist/wsl.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WSL facts the Windows browser engine needs: where the Windows drives are
|
|
3
|
+
* mounted, how a Windows path reads from Linux and back, which networking
|
|
4
|
+
* mode the VM runs in, and which interop socket a process without
|
|
5
|
+
* `WSL_INTEROP` (a systemd service) can use to start a Windows program.
|
|
6
|
+
*
|
|
7
|
+
* Every function here is pure over its arguments, except the two listers
|
|
8
|
+
* that read the real file system and say so in their names.
|
|
9
|
+
*/
|
|
10
|
+
/** `wslinfo --networking-mode`'s answers, plus `unknown` when nothing said. */
|
|
11
|
+
export type WslNetworkingMode = 'nat' | 'mirrored' | 'virtioproxy' | 'none' | 'unknown';
|
|
12
|
+
/** The default mount root for Windows drives. */
|
|
13
|
+
export declare const DEFAULT_WSL_MOUNT_ROOT = "/mnt/";
|
|
14
|
+
/**
|
|
15
|
+
* The Linux path of a Windows drive path under `mountRoot` (`/mnt/` unless
|
|
16
|
+
* `/etc/wsl.conf` moved it): `C:\Users\A` → `/mnt/c/Users/A`. `undefined`
|
|
17
|
+
* for anything that is not `<letter>:\…` (a UNC path, a relative path).
|
|
18
|
+
*/
|
|
19
|
+
export declare function windowsPathToWsl(windowsPath: string, mountRoot?: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The Windows path of a Linux path on a mounted Windows drive:
|
|
22
|
+
* `/mnt/c/Program Files/x.exe` → `C:\Program Files\x.exe`. `undefined` for a
|
|
23
|
+
* path outside the drive mounts.
|
|
24
|
+
*/
|
|
25
|
+
export declare function wslPathToWindows(linuxPath: string, mountRoot?: string): string | undefined;
|
|
26
|
+
/** The `[automount] root` of `/etc/wsl.conf`, with a trailing slash; `/mnt/` by default. */
|
|
27
|
+
export declare function parseWslMountRoot(wslConf: string | undefined): string;
|
|
28
|
+
/** `wslinfo --networking-mode`'s output as a mode; `unknown` for anything else. */
|
|
29
|
+
export declare function parseNetworkingModeOutput(output: string | undefined): WslNetworkingMode;
|
|
30
|
+
/**
|
|
31
|
+
* The networking mode a `.wslconfig` asks for: `[wsl2] networkingMode`, or
|
|
32
|
+
* the older `[experimental] networkingMode`. No setting is NAT, WSL's
|
|
33
|
+
* default; a file that cannot be read is `unknown`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseWslConfigNetworkingMode(text: string | undefined): WslNetworkingMode;
|
|
36
|
+
/** An interop socket under `/run/WSL`, with its modification time. */
|
|
37
|
+
export interface WslInteropSocket {
|
|
38
|
+
readonly path: string;
|
|
39
|
+
readonly mtimeMs: number;
|
|
40
|
+
}
|
|
41
|
+
export declare const WSL_RUN_DIR = "/run/WSL";
|
|
42
|
+
/**
|
|
43
|
+
* The interop socket a process without `WSL_INTEROP` can use: a systemd
|
|
44
|
+
* service's, which WSL starts outside any session. `1_interop` is the one WSL
|
|
45
|
+
* links for systemd to the distro's own init, so it lives as long as the
|
|
46
|
+
* distro; failing that, the newest session's. The CLI's desktop
|
|
47
|
+
* notifications choose the same way.
|
|
48
|
+
*/
|
|
49
|
+
export declare function findWslInteropSocket(sockets: readonly WslInteropSocket[]): string | undefined;
|
|
50
|
+
/** The interop sockets under `/run/WSL` on this machine. Reads the file system. */
|
|
51
|
+
export declare function listWslInteropSockets(dir?: string): WslInteropSocket[];
|
|
52
|
+
//# sourceMappingURL=wsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wsl.d.ts","sourceRoot":"","sources":["../src/wsl.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,UAAU,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAA;AAIvF,iDAAiD;AACjD,eAAO,MAAM,sBAAsB,UAAU,CAAA;AAE7C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAA+B,GACxC,MAAM,GAAG,SAAS,CAOpB;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