@holydeck/cli 2026.9.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 +21 -0
- package/README.md +234 -0
- package/dist/BrowserWebSocketTransport-H3D6MINS.js +12 -0
- package/dist/BrowserWebSocketTransport-H3D6MINS.js.map +1 -0
- package/dist/LaunchOptions-42ZS55HH.js +12 -0
- package/dist/LaunchOptions-42ZS55HH.js.map +1 -0
- package/dist/NodeWebSocketTransport-BXHQGXRM.js +15 -0
- package/dist/NodeWebSocketTransport-BXHQGXRM.js.map +1 -0
- package/dist/bidi-25S23FWJ.js +18358 -0
- package/dist/bidi-25S23FWJ.js.map +1 -0
- package/dist/chunk-2BLOYUSF.js +795 -0
- package/dist/chunk-2BLOYUSF.js.map +1 -0
- package/dist/chunk-43CZTS57.js +38 -0
- package/dist/chunk-43CZTS57.js.map +1 -0
- package/dist/chunk-DIBLSFAG.js +34 -0
- package/dist/chunk-DIBLSFAG.js.map +1 -0
- package/dist/chunk-IEJ3OX3N.js +52 -0
- package/dist/chunk-IEJ3OX3N.js.map +1 -0
- package/dist/chunk-JM4YIWBN.js +3796 -0
- package/dist/chunk-JM4YIWBN.js.map +1 -0
- package/dist/chunk-NP3DTWF7.js +23282 -0
- package/dist/chunk-NP3DTWF7.js.map +1 -0
- package/dist/chunk-SWG4X375.js +51 -0
- package/dist/chunk-SWG4X375.js.map +1 -0
- package/dist/chunk-UC6TFXMD.js +2821 -0
- package/dist/chunk-UC6TFXMD.js.map +1 -0
- package/dist/chunk-V4BIHFVZ.js +2287 -0
- package/dist/chunk-V4BIHFVZ.js.map +1 -0
- package/dist/chunk-V77AQPDK.js +20 -0
- package/dist/chunk-V77AQPDK.js.map +1 -0
- package/dist/chunk-XAENXL52.js +101 -0
- package/dist/chunk-XAENXL52.js.map +1 -0
- package/dist/cli.js +64101 -0
- package/dist/cli.js.map +1 -0
- package/dist/dist-3ZE2HBJQ.js +20447 -0
- package/dist/dist-3ZE2HBJQ.js.map +1 -0
- package/dist/dist-575AQY5L.js +1161 -0
- package/dist/dist-575AQY5L.js.map +1 -0
- package/dist/dist-DL5M2SDJ.js +117 -0
- package/dist/dist-DL5M2SDJ.js.map +1 -0
- package/dist/dist-OMWR53J4.js +4713 -0
- package/dist/dist-OMWR53J4.js.map +1 -0
- package/dist/dist-UT6HKKCD.js +281 -0
- package/dist/dist-UT6HKKCD.js.map +1 -0
- package/dist/fs-P6GYHPGZ.js +1685 -0
- package/dist/fs-P6GYHPGZ.js.map +1 -0
- package/dist/helpers-64DWIL6C.js +21 -0
- package/dist/helpers-64DWIL6C.js.map +1 -0
- package/dist/main-IQ64YDOJ.js +61 -0
- package/dist/main-IQ64YDOJ.js.map +1 -0
- package/dist/puppeteer-RDWY6FSG.js +2386 -0
- package/dist/puppeteer-RDWY6FSG.js.map +1 -0
- package/dist/yargs-KMQWKLG6.js +3264 -0
- package/dist/yargs-KMQWKLG6.js.map +1 -0
- package/dist/yauzl-7KG7KPPF.js +1355 -0
- package/dist/yauzl-7KG7KPPF.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,2386 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __holydeckCreateRequire } from 'node:module';
|
|
3
|
+
const require = __holydeckCreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
convertPuppeteerChannelToBrowsersChannel
|
|
6
|
+
} from "./chunk-DIBLSFAG.js";
|
|
7
|
+
import {
|
|
8
|
+
Browser as Browser2,
|
|
9
|
+
CDP_WEBSOCKET_ENDPOINT_REGEX,
|
|
10
|
+
TimeoutError as TimeoutError2,
|
|
11
|
+
WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX,
|
|
12
|
+
computeExecutablePath,
|
|
13
|
+
computeSystemExecutablePath,
|
|
14
|
+
createProfile,
|
|
15
|
+
detectBrowserPlatform,
|
|
16
|
+
getInstalledBrowsers,
|
|
17
|
+
launch,
|
|
18
|
+
resolveBuildId,
|
|
19
|
+
uninstall
|
|
20
|
+
} from "./chunk-UC6TFXMD.js";
|
|
21
|
+
import {
|
|
22
|
+
ARIAQueryHandler,
|
|
23
|
+
Accessibility,
|
|
24
|
+
AsyncDisposableStack,
|
|
25
|
+
AsyncDisposableStackPolyfill,
|
|
26
|
+
AsyncIterableUtil,
|
|
27
|
+
Binding,
|
|
28
|
+
Browser,
|
|
29
|
+
BrowserContext,
|
|
30
|
+
CDPSession,
|
|
31
|
+
CDPSessionEvent,
|
|
32
|
+
CDP_BINDING_PREFIX,
|
|
33
|
+
CSSCoverage,
|
|
34
|
+
Callback,
|
|
35
|
+
CallbackRegistry,
|
|
36
|
+
CdpBluetoothEmulation,
|
|
37
|
+
CdpBrowser,
|
|
38
|
+
CdpBrowserContext,
|
|
39
|
+
CdpCDPSession,
|
|
40
|
+
CdpDeviceRequestPrompt,
|
|
41
|
+
CdpDeviceRequestPromptManager,
|
|
42
|
+
CdpDialog,
|
|
43
|
+
CdpElementHandle,
|
|
44
|
+
CdpFrame,
|
|
45
|
+
CdpHTTPRequest,
|
|
46
|
+
CdpHTTPResponse,
|
|
47
|
+
CdpJSHandle,
|
|
48
|
+
CdpKeyboard,
|
|
49
|
+
CdpMouse,
|
|
50
|
+
CdpPage,
|
|
51
|
+
CdpPreloadScript,
|
|
52
|
+
CdpScreenRecording,
|
|
53
|
+
CdpTarget,
|
|
54
|
+
CdpTouchHandle,
|
|
55
|
+
CdpTouchscreen,
|
|
56
|
+
CdpWebWorker,
|
|
57
|
+
Connection,
|
|
58
|
+
ConnectionClosedError,
|
|
59
|
+
ConsoleMessage,
|
|
60
|
+
Coverage,
|
|
61
|
+
CustomQueryHandlerRegistry,
|
|
62
|
+
DEFAULT_INTERCEPT_RESOLUTION_PRIORITY,
|
|
63
|
+
DEFAULT_VIEWPORT,
|
|
64
|
+
Deferred,
|
|
65
|
+
DelegatedLocator,
|
|
66
|
+
DevToolsTarget,
|
|
67
|
+
DeviceRequestPrompt,
|
|
68
|
+
Dialog,
|
|
69
|
+
DisposableStack,
|
|
70
|
+
DisposableStackPolyfill,
|
|
71
|
+
ElementHandle,
|
|
72
|
+
EmulatedState,
|
|
73
|
+
EmulationManager,
|
|
74
|
+
EventEmitter,
|
|
75
|
+
ExecutionContext,
|
|
76
|
+
Extension,
|
|
77
|
+
ExtensionTransport,
|
|
78
|
+
FileChooser,
|
|
79
|
+
FilteredLocator,
|
|
80
|
+
Frame,
|
|
81
|
+
FrameEvent,
|
|
82
|
+
FrameManager,
|
|
83
|
+
FrameManagerEvent,
|
|
84
|
+
FrameTree,
|
|
85
|
+
FunctionLocator,
|
|
86
|
+
HTTPRequest,
|
|
87
|
+
HTTPResponse,
|
|
88
|
+
InitializationStatus,
|
|
89
|
+
InterceptResolutionAction,
|
|
90
|
+
IsolatedWorld,
|
|
91
|
+
JSCoverage,
|
|
92
|
+
JSHandle,
|
|
93
|
+
Keyboard,
|
|
94
|
+
KnownDevices,
|
|
95
|
+
LazyArg,
|
|
96
|
+
LifecycleWatcher,
|
|
97
|
+
Locator,
|
|
98
|
+
LocatorEvent,
|
|
99
|
+
MAIN_WORLD,
|
|
100
|
+
MappedLocator,
|
|
101
|
+
Mouse,
|
|
102
|
+
MouseButton,
|
|
103
|
+
Mutex,
|
|
104
|
+
NETWORK_IDLE_TIME,
|
|
105
|
+
NetworkEventManager,
|
|
106
|
+
NetworkManager,
|
|
107
|
+
NetworkManagerEvent,
|
|
108
|
+
NodeLocator,
|
|
109
|
+
OtherTarget,
|
|
110
|
+
PQueryHandler,
|
|
111
|
+
PUPPETEER_REVISIONS,
|
|
112
|
+
PUPPETEER_WORLD,
|
|
113
|
+
Page,
|
|
114
|
+
PageTarget,
|
|
115
|
+
PierceQueryHandler,
|
|
116
|
+
PredefinedNetworkConditions,
|
|
117
|
+
ProtocolError,
|
|
118
|
+
Puppeteer,
|
|
119
|
+
PuppeteerError,
|
|
120
|
+
PuppeteerURL,
|
|
121
|
+
QueryHandler,
|
|
122
|
+
RETRY_DELAY,
|
|
123
|
+
RaceLocator,
|
|
124
|
+
Realm,
|
|
125
|
+
SOURCE_URL_REGEX,
|
|
126
|
+
STATUS_TEXTS,
|
|
127
|
+
ScreenRecording,
|
|
128
|
+
ScriptInjector,
|
|
129
|
+
SecurityDetails,
|
|
130
|
+
SuppressedError,
|
|
131
|
+
Target,
|
|
132
|
+
TargetCloseError,
|
|
133
|
+
TargetManager,
|
|
134
|
+
TargetType,
|
|
135
|
+
TaskManager,
|
|
136
|
+
TaskQueue,
|
|
137
|
+
TextQueryHandler,
|
|
138
|
+
TimeoutError,
|
|
139
|
+
TimeoutSettings,
|
|
140
|
+
TouchError,
|
|
141
|
+
Touchscreen,
|
|
142
|
+
Tracing,
|
|
143
|
+
UTILITY_WORLD_NAME,
|
|
144
|
+
UnsupportedOperation,
|
|
145
|
+
WEB_PERMISSION_TO_PROTOCOL_PERMISSION,
|
|
146
|
+
WaitTask,
|
|
147
|
+
WebMCP,
|
|
148
|
+
WebMCPTool,
|
|
149
|
+
WebMCPToolCall,
|
|
150
|
+
WebWorker,
|
|
151
|
+
WebWorkerEvent,
|
|
152
|
+
WorkerTarget,
|
|
153
|
+
XPathQueryHandler,
|
|
154
|
+
_connectToCdpBrowser,
|
|
155
|
+
_keyDefinitions,
|
|
156
|
+
addPageBinding,
|
|
157
|
+
assert,
|
|
158
|
+
assertSupportedUrlRestrictions,
|
|
159
|
+
asyncDisposeSymbol,
|
|
160
|
+
bindIsolatedHandle,
|
|
161
|
+
bufferCount,
|
|
162
|
+
concatMap,
|
|
163
|
+
convertConsoleMessageLevel,
|
|
164
|
+
convertCookiesPartitionKeyFromPuppeteerToCdp,
|
|
165
|
+
convertSameSiteFromPuppeteerToCdp,
|
|
166
|
+
createClientError,
|
|
167
|
+
createConsoleMessage,
|
|
168
|
+
createEvaluationError,
|
|
169
|
+
createIncrementalIdGenerator,
|
|
170
|
+
createProtocolErrorMessage,
|
|
171
|
+
customQueryHandlers,
|
|
172
|
+
disposeSymbol,
|
|
173
|
+
evaluationString,
|
|
174
|
+
filter,
|
|
175
|
+
filterAsync,
|
|
176
|
+
firstValueFrom,
|
|
177
|
+
from,
|
|
178
|
+
fromAbortSignal,
|
|
179
|
+
fromEmitterEvent,
|
|
180
|
+
fromEvent,
|
|
181
|
+
getQueryHandlerAndSelector,
|
|
182
|
+
getReadableAsTypedArray,
|
|
183
|
+
getReadableFromProtocolStream,
|
|
184
|
+
getSourcePuppeteerURLIfAvailable,
|
|
185
|
+
getSourceUrlComment,
|
|
186
|
+
guarded,
|
|
187
|
+
handleError,
|
|
188
|
+
headersArray,
|
|
189
|
+
isDate,
|
|
190
|
+
isErrnoException,
|
|
191
|
+
isErrorLike,
|
|
192
|
+
isNumber,
|
|
193
|
+
isPlainObject,
|
|
194
|
+
isRegExp,
|
|
195
|
+
isString,
|
|
196
|
+
isTargetClosedError,
|
|
197
|
+
lastValueFrom,
|
|
198
|
+
map,
|
|
199
|
+
normalizeHeaderValue,
|
|
200
|
+
pageBindingInitString,
|
|
201
|
+
paperFormats,
|
|
202
|
+
parsePDFOptions,
|
|
203
|
+
parsePSelectors,
|
|
204
|
+
race,
|
|
205
|
+
referrerPolicyToProtocol,
|
|
206
|
+
releaseObject,
|
|
207
|
+
rewriteError,
|
|
208
|
+
scriptInjector,
|
|
209
|
+
setDefaultScreenshotOptions,
|
|
210
|
+
supportedMetrics,
|
|
211
|
+
takeUntil,
|
|
212
|
+
tap,
|
|
213
|
+
throwIfDetached,
|
|
214
|
+
timeout,
|
|
215
|
+
timer,
|
|
216
|
+
transposeIterableHandle,
|
|
217
|
+
unitToPixels,
|
|
218
|
+
validateDialogType,
|
|
219
|
+
valueFromJSHandle,
|
|
220
|
+
valueFromPrimitiveRemoteObject,
|
|
221
|
+
valueFromRemoteObjectReference,
|
|
222
|
+
withSourcePuppeteerURLIfNone
|
|
223
|
+
} from "./chunk-NP3DTWF7.js";
|
|
224
|
+
import {
|
|
225
|
+
BrowserWebSocketTransport
|
|
226
|
+
} from "./chunk-SWG4X375.js";
|
|
227
|
+
import {
|
|
228
|
+
NodeWebSocketTransport
|
|
229
|
+
} from "./chunk-JM4YIWBN.js";
|
|
230
|
+
import "./chunk-V77AQPDK.js";
|
|
231
|
+
import {
|
|
232
|
+
DEBUG_PREFIXES,
|
|
233
|
+
debug,
|
|
234
|
+
environment,
|
|
235
|
+
getCapturedLogs,
|
|
236
|
+
setLogCapture
|
|
237
|
+
} from "./chunk-XAENXL52.js";
|
|
238
|
+
import {
|
|
239
|
+
__commonJS,
|
|
240
|
+
__require,
|
|
241
|
+
__toESM
|
|
242
|
+
} from "./chunk-IEJ3OX3N.js";
|
|
243
|
+
|
|
244
|
+
// ../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js
|
|
245
|
+
var require_src = __commonJS({
|
|
246
|
+
"../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"(exports, module) {
|
|
247
|
+
"use strict";
|
|
248
|
+
var path4 = __require("path");
|
|
249
|
+
var fs4 = __require("fs");
|
|
250
|
+
var os4 = __require("os");
|
|
251
|
+
var url = __require("url");
|
|
252
|
+
var fsReadFileAsync = fs4.promises.readFile;
|
|
253
|
+
function getDefaultSearchPlaces(name, sync) {
|
|
254
|
+
return [
|
|
255
|
+
"package.json",
|
|
256
|
+
`.${name}rc.json`,
|
|
257
|
+
`.${name}rc.js`,
|
|
258
|
+
`.${name}rc.cjs`,
|
|
259
|
+
...sync ? [] : [`.${name}rc.mjs`],
|
|
260
|
+
`.config/${name}rc`,
|
|
261
|
+
`.config/${name}rc.json`,
|
|
262
|
+
`.config/${name}rc.js`,
|
|
263
|
+
`.config/${name}rc.cjs`,
|
|
264
|
+
...sync ? [] : [`.config/${name}rc.mjs`],
|
|
265
|
+
`${name}.config.js`,
|
|
266
|
+
`${name}.config.cjs`,
|
|
267
|
+
...sync ? [] : [`${name}.config.mjs`]
|
|
268
|
+
];
|
|
269
|
+
}
|
|
270
|
+
function parentDir(p) {
|
|
271
|
+
return path4.dirname(p) || path4.sep;
|
|
272
|
+
}
|
|
273
|
+
var jsonLoader = (_, content) => JSON.parse(content);
|
|
274
|
+
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
275
|
+
var defaultLoadersSync = Object.freeze({
|
|
276
|
+
".js": requireFunc,
|
|
277
|
+
".json": requireFunc,
|
|
278
|
+
".cjs": requireFunc,
|
|
279
|
+
noExt: jsonLoader
|
|
280
|
+
});
|
|
281
|
+
module.exports.defaultLoadersSync = defaultLoadersSync;
|
|
282
|
+
var dynamicImport = async (id) => {
|
|
283
|
+
try {
|
|
284
|
+
const fileUrl = url.pathToFileURL(id).href;
|
|
285
|
+
const mod = await import(
|
|
286
|
+
/* webpackIgnore: true */
|
|
287
|
+
fileUrl
|
|
288
|
+
);
|
|
289
|
+
return mod.default;
|
|
290
|
+
} catch (e) {
|
|
291
|
+
try {
|
|
292
|
+
return requireFunc(id);
|
|
293
|
+
} catch (requireE) {
|
|
294
|
+
if (requireE.code === "ERR_REQUIRE_ESM" || requireE instanceof SyntaxError && requireE.toString().includes("Cannot use import statement outside a module")) {
|
|
295
|
+
throw e;
|
|
296
|
+
}
|
|
297
|
+
throw requireE;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
var defaultLoaders = Object.freeze({
|
|
302
|
+
".js": dynamicImport,
|
|
303
|
+
".mjs": dynamicImport,
|
|
304
|
+
".cjs": dynamicImport,
|
|
305
|
+
".json": jsonLoader,
|
|
306
|
+
noExt: jsonLoader
|
|
307
|
+
});
|
|
308
|
+
module.exports.defaultLoaders = defaultLoaders;
|
|
309
|
+
function getOptions(name, options, sync) {
|
|
310
|
+
const conf = {
|
|
311
|
+
stopDir: os4.homedir(),
|
|
312
|
+
searchPlaces: getDefaultSearchPlaces(name, sync),
|
|
313
|
+
ignoreEmptySearchPlaces: true,
|
|
314
|
+
cache: true,
|
|
315
|
+
transform: (x) => x,
|
|
316
|
+
packageProp: [name],
|
|
317
|
+
...options,
|
|
318
|
+
loaders: {
|
|
319
|
+
...sync ? defaultLoadersSync : defaultLoaders,
|
|
320
|
+
...options.loaders
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
conf.searchPlaces.forEach((place) => {
|
|
324
|
+
const key = path4.extname(place) || "noExt";
|
|
325
|
+
const loader = conf.loaders[key];
|
|
326
|
+
if (!loader) {
|
|
327
|
+
throw new Error(`Missing loader for extension "${place}"`);
|
|
328
|
+
}
|
|
329
|
+
if (typeof loader !== "function") {
|
|
330
|
+
throw new Error(
|
|
331
|
+
`Loader for extension "${place}" is not a function: Received ${typeof loader}.`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
return conf;
|
|
336
|
+
}
|
|
337
|
+
function getPackageProp(props, obj) {
|
|
338
|
+
if (typeof props === "string" && props in obj) return obj[props];
|
|
339
|
+
return (Array.isArray(props) ? props : props.split(".")).reduce(
|
|
340
|
+
(acc, prop) => acc === void 0 ? acc : acc[prop],
|
|
341
|
+
obj
|
|
342
|
+
) || null;
|
|
343
|
+
}
|
|
344
|
+
function validateFilePath(filepath) {
|
|
345
|
+
if (!filepath) throw new Error("load must pass a non-empty string");
|
|
346
|
+
}
|
|
347
|
+
function validateLoader(loader, ext) {
|
|
348
|
+
if (!loader) throw new Error(`No loader specified for extension "${ext}"`);
|
|
349
|
+
if (typeof loader !== "function") throw new Error("loader is not a function");
|
|
350
|
+
}
|
|
351
|
+
var makeEmplace = (enableCache) => (c, filepath, res) => {
|
|
352
|
+
if (enableCache) c.set(filepath, res);
|
|
353
|
+
return res;
|
|
354
|
+
};
|
|
355
|
+
module.exports.lilconfig = function lilconfig2(name, options) {
|
|
356
|
+
const {
|
|
357
|
+
ignoreEmptySearchPlaces,
|
|
358
|
+
loaders,
|
|
359
|
+
packageProp,
|
|
360
|
+
searchPlaces,
|
|
361
|
+
stopDir,
|
|
362
|
+
transform,
|
|
363
|
+
cache
|
|
364
|
+
} = getOptions(name, options ?? {}, false);
|
|
365
|
+
const searchCache = /* @__PURE__ */ new Map();
|
|
366
|
+
const loadCache = /* @__PURE__ */ new Map();
|
|
367
|
+
const emplace = makeEmplace(cache);
|
|
368
|
+
return {
|
|
369
|
+
async search(searchFrom = process.cwd()) {
|
|
370
|
+
const result = {
|
|
371
|
+
config: null,
|
|
372
|
+
filepath: ""
|
|
373
|
+
};
|
|
374
|
+
const visited = /* @__PURE__ */ new Set();
|
|
375
|
+
let dir = searchFrom;
|
|
376
|
+
dirLoop: while (true) {
|
|
377
|
+
if (cache) {
|
|
378
|
+
const r = searchCache.get(dir);
|
|
379
|
+
if (r !== void 0) {
|
|
380
|
+
for (const p of visited) searchCache.set(p, r);
|
|
381
|
+
return r;
|
|
382
|
+
}
|
|
383
|
+
visited.add(dir);
|
|
384
|
+
}
|
|
385
|
+
for (const searchPlace of searchPlaces) {
|
|
386
|
+
const filepath = path4.join(dir, searchPlace);
|
|
387
|
+
try {
|
|
388
|
+
await fs4.promises.access(filepath);
|
|
389
|
+
} catch {
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
const content = String(await fsReadFileAsync(filepath));
|
|
393
|
+
const loaderKey = path4.extname(searchPlace) || "noExt";
|
|
394
|
+
const loader = loaders[loaderKey];
|
|
395
|
+
if (searchPlace === "package.json") {
|
|
396
|
+
const pkg = await loader(filepath, content);
|
|
397
|
+
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
398
|
+
if (maybeConfig != null) {
|
|
399
|
+
result.config = maybeConfig;
|
|
400
|
+
result.filepath = filepath;
|
|
401
|
+
break dirLoop;
|
|
402
|
+
}
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
const isEmpty = content.trim() === "";
|
|
406
|
+
if (isEmpty && ignoreEmptySearchPlaces) continue;
|
|
407
|
+
if (isEmpty) {
|
|
408
|
+
result.isEmpty = true;
|
|
409
|
+
result.config = void 0;
|
|
410
|
+
} else {
|
|
411
|
+
validateLoader(loader, loaderKey);
|
|
412
|
+
result.config = await loader(filepath, content);
|
|
413
|
+
}
|
|
414
|
+
result.filepath = filepath;
|
|
415
|
+
break dirLoop;
|
|
416
|
+
}
|
|
417
|
+
if (dir === stopDir || dir === parentDir(dir)) break dirLoop;
|
|
418
|
+
dir = parentDir(dir);
|
|
419
|
+
}
|
|
420
|
+
const transformed = (
|
|
421
|
+
// not found
|
|
422
|
+
result.filepath === "" && result.config === null ? transform(null) : transform(result)
|
|
423
|
+
);
|
|
424
|
+
if (cache) {
|
|
425
|
+
for (const p of visited) searchCache.set(p, transformed);
|
|
426
|
+
}
|
|
427
|
+
return transformed;
|
|
428
|
+
},
|
|
429
|
+
async load(filepath) {
|
|
430
|
+
validateFilePath(filepath);
|
|
431
|
+
const absPath = path4.resolve(process.cwd(), filepath);
|
|
432
|
+
if (cache && loadCache.has(absPath)) {
|
|
433
|
+
return loadCache.get(absPath);
|
|
434
|
+
}
|
|
435
|
+
const { base, ext } = path4.parse(absPath);
|
|
436
|
+
const loaderKey = ext || "noExt";
|
|
437
|
+
const loader = loaders[loaderKey];
|
|
438
|
+
validateLoader(loader, loaderKey);
|
|
439
|
+
const content = String(await fsReadFileAsync(absPath));
|
|
440
|
+
if (base === "package.json") {
|
|
441
|
+
const pkg = await loader(absPath, content);
|
|
442
|
+
return emplace(
|
|
443
|
+
loadCache,
|
|
444
|
+
absPath,
|
|
445
|
+
transform({
|
|
446
|
+
config: getPackageProp(packageProp, pkg),
|
|
447
|
+
filepath: absPath
|
|
448
|
+
})
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
const result = {
|
|
452
|
+
config: null,
|
|
453
|
+
filepath: absPath
|
|
454
|
+
};
|
|
455
|
+
const isEmpty = content.trim() === "";
|
|
456
|
+
if (isEmpty && ignoreEmptySearchPlaces)
|
|
457
|
+
return emplace(
|
|
458
|
+
loadCache,
|
|
459
|
+
absPath,
|
|
460
|
+
transform({
|
|
461
|
+
config: void 0,
|
|
462
|
+
filepath: absPath,
|
|
463
|
+
isEmpty: true
|
|
464
|
+
})
|
|
465
|
+
);
|
|
466
|
+
result.config = isEmpty ? void 0 : await loader(absPath, content);
|
|
467
|
+
return emplace(
|
|
468
|
+
loadCache,
|
|
469
|
+
absPath,
|
|
470
|
+
transform(isEmpty ? { ...result, isEmpty, config: void 0 } : result)
|
|
471
|
+
);
|
|
472
|
+
},
|
|
473
|
+
clearLoadCache() {
|
|
474
|
+
if (cache) loadCache.clear();
|
|
475
|
+
},
|
|
476
|
+
clearSearchCache() {
|
|
477
|
+
if (cache) searchCache.clear();
|
|
478
|
+
},
|
|
479
|
+
clearCaches() {
|
|
480
|
+
if (cache) {
|
|
481
|
+
loadCache.clear();
|
|
482
|
+
searchCache.clear();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
module.exports.lilconfigSync = function lilconfigSync(name, options) {
|
|
488
|
+
const {
|
|
489
|
+
ignoreEmptySearchPlaces,
|
|
490
|
+
loaders,
|
|
491
|
+
packageProp,
|
|
492
|
+
searchPlaces,
|
|
493
|
+
stopDir,
|
|
494
|
+
transform,
|
|
495
|
+
cache
|
|
496
|
+
} = getOptions(name, options ?? {}, true);
|
|
497
|
+
const searchCache = /* @__PURE__ */ new Map();
|
|
498
|
+
const loadCache = /* @__PURE__ */ new Map();
|
|
499
|
+
const emplace = makeEmplace(cache);
|
|
500
|
+
return {
|
|
501
|
+
search(searchFrom = process.cwd()) {
|
|
502
|
+
const result = {
|
|
503
|
+
config: null,
|
|
504
|
+
filepath: ""
|
|
505
|
+
};
|
|
506
|
+
const visited = /* @__PURE__ */ new Set();
|
|
507
|
+
let dir = searchFrom;
|
|
508
|
+
dirLoop: while (true) {
|
|
509
|
+
if (cache) {
|
|
510
|
+
const r = searchCache.get(dir);
|
|
511
|
+
if (r !== void 0) {
|
|
512
|
+
for (const p of visited) searchCache.set(p, r);
|
|
513
|
+
return r;
|
|
514
|
+
}
|
|
515
|
+
visited.add(dir);
|
|
516
|
+
}
|
|
517
|
+
for (const searchPlace of searchPlaces) {
|
|
518
|
+
const filepath = path4.join(dir, searchPlace);
|
|
519
|
+
try {
|
|
520
|
+
fs4.accessSync(filepath);
|
|
521
|
+
} catch {
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
const loaderKey = path4.extname(searchPlace) || "noExt";
|
|
525
|
+
const loader = loaders[loaderKey];
|
|
526
|
+
const content = String(fs4.readFileSync(filepath));
|
|
527
|
+
if (searchPlace === "package.json") {
|
|
528
|
+
const pkg = loader(filepath, content);
|
|
529
|
+
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
530
|
+
if (maybeConfig != null) {
|
|
531
|
+
result.config = maybeConfig;
|
|
532
|
+
result.filepath = filepath;
|
|
533
|
+
break dirLoop;
|
|
534
|
+
}
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
const isEmpty = content.trim() === "";
|
|
538
|
+
if (isEmpty && ignoreEmptySearchPlaces) continue;
|
|
539
|
+
if (isEmpty) {
|
|
540
|
+
result.isEmpty = true;
|
|
541
|
+
result.config = void 0;
|
|
542
|
+
} else {
|
|
543
|
+
validateLoader(loader, loaderKey);
|
|
544
|
+
result.config = loader(filepath, content);
|
|
545
|
+
}
|
|
546
|
+
result.filepath = filepath;
|
|
547
|
+
break dirLoop;
|
|
548
|
+
}
|
|
549
|
+
if (dir === stopDir || dir === parentDir(dir)) break dirLoop;
|
|
550
|
+
dir = parentDir(dir);
|
|
551
|
+
}
|
|
552
|
+
const transformed = (
|
|
553
|
+
// not found
|
|
554
|
+
result.filepath === "" && result.config === null ? transform(null) : transform(result)
|
|
555
|
+
);
|
|
556
|
+
if (cache) {
|
|
557
|
+
for (const p of visited) searchCache.set(p, transformed);
|
|
558
|
+
}
|
|
559
|
+
return transformed;
|
|
560
|
+
},
|
|
561
|
+
load(filepath) {
|
|
562
|
+
validateFilePath(filepath);
|
|
563
|
+
const absPath = path4.resolve(process.cwd(), filepath);
|
|
564
|
+
if (cache && loadCache.has(absPath)) {
|
|
565
|
+
return loadCache.get(absPath);
|
|
566
|
+
}
|
|
567
|
+
const { base, ext } = path4.parse(absPath);
|
|
568
|
+
const loaderKey = ext || "noExt";
|
|
569
|
+
const loader = loaders[loaderKey];
|
|
570
|
+
validateLoader(loader, loaderKey);
|
|
571
|
+
const content = String(fs4.readFileSync(absPath));
|
|
572
|
+
if (base === "package.json") {
|
|
573
|
+
const pkg = loader(absPath, content);
|
|
574
|
+
return transform({
|
|
575
|
+
config: getPackageProp(packageProp, pkg),
|
|
576
|
+
filepath: absPath
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
const result = {
|
|
580
|
+
config: null,
|
|
581
|
+
filepath: absPath
|
|
582
|
+
};
|
|
583
|
+
const isEmpty = content.trim() === "";
|
|
584
|
+
if (isEmpty && ignoreEmptySearchPlaces)
|
|
585
|
+
return emplace(
|
|
586
|
+
loadCache,
|
|
587
|
+
absPath,
|
|
588
|
+
transform({
|
|
589
|
+
filepath: absPath,
|
|
590
|
+
config: void 0,
|
|
591
|
+
isEmpty: true
|
|
592
|
+
})
|
|
593
|
+
);
|
|
594
|
+
result.config = isEmpty ? void 0 : loader(absPath, content);
|
|
595
|
+
return emplace(
|
|
596
|
+
loadCache,
|
|
597
|
+
absPath,
|
|
598
|
+
transform(isEmpty ? { ...result, isEmpty, config: void 0 } : result)
|
|
599
|
+
);
|
|
600
|
+
},
|
|
601
|
+
clearLoadCache() {
|
|
602
|
+
if (cache) loadCache.clear();
|
|
603
|
+
},
|
|
604
|
+
clearSearchCache() {
|
|
605
|
+
if (cache) searchCache.clear();
|
|
606
|
+
},
|
|
607
|
+
clearCaches() {
|
|
608
|
+
if (cache) {
|
|
609
|
+
loadCache.clear();
|
|
610
|
+
searchCache.clear();
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node-env-setup.js
|
|
619
|
+
import fs from "fs";
|
|
620
|
+
import path from "path";
|
|
621
|
+
import { debuglog } from "util";
|
|
622
|
+
var READ_NOFOLLOW_FLAGS = fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW;
|
|
623
|
+
var WRITE_NOFOLLOW_FLAGS = fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_TRUNC | fs.constants.O_NOFOLLOW;
|
|
624
|
+
var WRITE_NOFOLLOW_NOOVERWRITE_FLAGS = fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_NOFOLLOW;
|
|
625
|
+
var WRITE_NOOVERWRITE_FLAGS = fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL;
|
|
626
|
+
var WRITE_NOFOLLOW_MODE = 384;
|
|
627
|
+
async function readFile(path4, encoding) {
|
|
628
|
+
if (!environment.value.followSymlinks && fs.constants.O_NOFOLLOW !== void 0) {
|
|
629
|
+
return await fs.promises.readFile(path4, {
|
|
630
|
+
encoding,
|
|
631
|
+
flag: READ_NOFOLLOW_FLAGS
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
return await fs.promises.readFile(path4, { encoding });
|
|
635
|
+
}
|
|
636
|
+
environment.value = {
|
|
637
|
+
path,
|
|
638
|
+
debuglog,
|
|
639
|
+
ScreenRecorder: environment.value.ScreenRecorder,
|
|
640
|
+
followSymlinks: true,
|
|
641
|
+
readFile,
|
|
642
|
+
writeFile: async (filePath, data) => {
|
|
643
|
+
if (!environment.value.followSymlinks && fs.constants.O_NOFOLLOW !== void 0) {
|
|
644
|
+
await fs.promises.writeFile(filePath, data, {
|
|
645
|
+
flag: WRITE_NOFOLLOW_FLAGS,
|
|
646
|
+
mode: WRITE_NOFOLLOW_MODE
|
|
647
|
+
});
|
|
648
|
+
} else {
|
|
649
|
+
await fs.promises.writeFile(filePath, data);
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
openFileForWriting: async (filePath) => {
|
|
653
|
+
if (!environment.value.followSymlinks && fs.constants.O_NOFOLLOW !== void 0) {
|
|
654
|
+
return await fs.promises.open(filePath, WRITE_NOFOLLOW_FLAGS, WRITE_NOFOLLOW_MODE);
|
|
655
|
+
}
|
|
656
|
+
return await fs.promises.open(filePath, "w+");
|
|
657
|
+
},
|
|
658
|
+
createWriteStream: (filePath, options) => {
|
|
659
|
+
const encoding = options?.encoding;
|
|
660
|
+
const overwrite = options?.overwrite ?? true;
|
|
661
|
+
if (!environment.value.followSymlinks && fs.constants.O_NOFOLLOW !== void 0) {
|
|
662
|
+
const flags = overwrite ? WRITE_NOFOLLOW_FLAGS : WRITE_NOFOLLOW_NOOVERWRITE_FLAGS;
|
|
663
|
+
const fd = fs.openSync(filePath, flags, WRITE_NOFOLLOW_MODE);
|
|
664
|
+
return fs.createWriteStream("", {
|
|
665
|
+
fd,
|
|
666
|
+
mode: WRITE_NOFOLLOW_MODE,
|
|
667
|
+
encoding
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
if (!overwrite) {
|
|
671
|
+
const fd = fs.openSync(filePath, WRITE_NOOVERWRITE_FLAGS);
|
|
672
|
+
return fs.createWriteStream("", {
|
|
673
|
+
fd,
|
|
674
|
+
encoding
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
return fs.createWriteStream(filePath, encoding ? { encoding } : void 0);
|
|
678
|
+
},
|
|
679
|
+
mkdir: async (dirPath, options) => {
|
|
680
|
+
await fs.promises.mkdir(dirPath, options);
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/ChromeLauncher.js
|
|
685
|
+
import { mkdtemp } from "fs/promises";
|
|
686
|
+
import os from "os";
|
|
687
|
+
import path2 from "path";
|
|
688
|
+
|
|
689
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/BrowserLauncher.js
|
|
690
|
+
import { accessSync, constants, existsSync } from "fs";
|
|
691
|
+
import { tmpdir } from "os";
|
|
692
|
+
import { join } from "path";
|
|
693
|
+
|
|
694
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/PipeTransport.js
|
|
695
|
+
var PipeTransport = class {
|
|
696
|
+
#pipeWrite;
|
|
697
|
+
#subscriptions = new DisposableStack();
|
|
698
|
+
#logger;
|
|
699
|
+
#isClosed = false;
|
|
700
|
+
#pendingMessage = [];
|
|
701
|
+
onclose;
|
|
702
|
+
onmessage;
|
|
703
|
+
constructor(pipeWrite, pipeRead, logger) {
|
|
704
|
+
this.#pipeWrite = pipeWrite;
|
|
705
|
+
this.#logger = logger;
|
|
706
|
+
const pipeReadEmitter = this.#subscriptions.use(
|
|
707
|
+
// NodeJS event emitters don't support `*` so we need to typecast
|
|
708
|
+
// As long as we don't use it we should be OK.
|
|
709
|
+
new EventEmitter(pipeRead, logger)
|
|
710
|
+
);
|
|
711
|
+
pipeReadEmitter.on("data", (buffer) => {
|
|
712
|
+
return this.#dispatch(buffer);
|
|
713
|
+
});
|
|
714
|
+
pipeReadEmitter.on("close", () => {
|
|
715
|
+
if (this.onclose) {
|
|
716
|
+
this.onclose.call(null);
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
pipeReadEmitter.on("error", (err) => {
|
|
720
|
+
this.#logger?.(DEBUG_PREFIXES.error)?.(err);
|
|
721
|
+
});
|
|
722
|
+
const pipeWriteEmitter = this.#subscriptions.use(
|
|
723
|
+
// NodeJS event emitters don't support `*` so we need to typecast
|
|
724
|
+
// As long as we don't use it we should be OK.
|
|
725
|
+
new EventEmitter(pipeWrite)
|
|
726
|
+
);
|
|
727
|
+
pipeWriteEmitter.on("error", (err) => {
|
|
728
|
+
this.#logger?.(DEBUG_PREFIXES.error)?.(err);
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
send(message) {
|
|
732
|
+
assert(!this.#isClosed, "`PipeTransport` is closed.");
|
|
733
|
+
this.#pipeWrite.write(message);
|
|
734
|
+
this.#pipeWrite.write("\0");
|
|
735
|
+
}
|
|
736
|
+
#dispatch(buffer) {
|
|
737
|
+
assert(!this.#isClosed, "`PipeTransport` is closed.");
|
|
738
|
+
this.#pendingMessage.push(buffer);
|
|
739
|
+
if (buffer.indexOf("\0") === -1) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
const concatBuffer = Buffer.concat(this.#pendingMessage);
|
|
743
|
+
let start = 0;
|
|
744
|
+
let end = concatBuffer.indexOf("\0");
|
|
745
|
+
while (end !== -1) {
|
|
746
|
+
const message = concatBuffer.toString(void 0, start, end);
|
|
747
|
+
setImmediate(() => {
|
|
748
|
+
if (this.onmessage) {
|
|
749
|
+
this.onmessage.call(null, message);
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
start = end + 1;
|
|
753
|
+
end = concatBuffer.indexOf("\0", start);
|
|
754
|
+
}
|
|
755
|
+
if (start >= concatBuffer.length) {
|
|
756
|
+
this.#pendingMessage = [];
|
|
757
|
+
} else {
|
|
758
|
+
this.#pendingMessage = [concatBuffer.subarray(start)];
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
close() {
|
|
762
|
+
this.#isClosed = true;
|
|
763
|
+
this.#subscriptions.dispose();
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/BrowserLauncher.js
|
|
768
|
+
function isWritableDirectory(directory) {
|
|
769
|
+
try {
|
|
770
|
+
accessSync(directory, constants.W_OK);
|
|
771
|
+
return true;
|
|
772
|
+
} catch {
|
|
773
|
+
return !existsSync(directory);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function getBrowserTypeDisplayName(browserType) {
|
|
777
|
+
switch (browserType) {
|
|
778
|
+
case Browser2.FIREFOX:
|
|
779
|
+
case Browser2.CHROME:
|
|
780
|
+
return browserType.charAt(0).toUpperCase() + browserType.slice(1);
|
|
781
|
+
default:
|
|
782
|
+
return browserType;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
var BrowserLauncher = class {
|
|
786
|
+
#browser;
|
|
787
|
+
#logger;
|
|
788
|
+
/**
|
|
789
|
+
* @internal
|
|
790
|
+
*/
|
|
791
|
+
/**
|
|
792
|
+
* @internal
|
|
793
|
+
*/
|
|
794
|
+
puppeteer;
|
|
795
|
+
/**
|
|
796
|
+
* @internal
|
|
797
|
+
*/
|
|
798
|
+
constructor(puppeteer3, browser, logger) {
|
|
799
|
+
this.puppeteer = puppeteer3;
|
|
800
|
+
this.#browser = browser;
|
|
801
|
+
this.#logger = logger;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* @internal
|
|
805
|
+
*/
|
|
806
|
+
get logger() {
|
|
807
|
+
return this.#logger;
|
|
808
|
+
}
|
|
809
|
+
get browser() {
|
|
810
|
+
return this.#browser;
|
|
811
|
+
}
|
|
812
|
+
async launch(options = {}) {
|
|
813
|
+
options.logger ??= this.#logger;
|
|
814
|
+
const { dumpio = false, enableExtensions = false, extensionsEnabledInIncognito = [], env = process.env, handleSIGINT = true, handleSIGTERM = true, handleSIGHUP = true, acceptInsecureCerts = false, networkEnabled = true, issuesEnabled = true, defaultViewport = DEFAULT_VIEWPORT, downloadBehavior, slowMo = 0, timeout: timeout2 = 3e4, waitForInitialPage = true, protocolTimeout, handleDevToolsAsPage, idGenerator = createIncrementalIdGenerator(), blocklist, allowlist } = options;
|
|
815
|
+
let { protocol } = options;
|
|
816
|
+
if (this.#browser === "firefox" && protocol === void 0) {
|
|
817
|
+
protocol = "webDriverBiDi";
|
|
818
|
+
}
|
|
819
|
+
assertSupportedUrlRestrictions({
|
|
820
|
+
allowlist,
|
|
821
|
+
blocklist,
|
|
822
|
+
protocol
|
|
823
|
+
});
|
|
824
|
+
if (this.#browser === "firefox" && protocol === "cdp") {
|
|
825
|
+
throw new Error("Connecting to Firefox using CDP is no longer supported");
|
|
826
|
+
}
|
|
827
|
+
const launchArgs = await this.computeLaunchArguments({
|
|
828
|
+
...options,
|
|
829
|
+
protocol
|
|
830
|
+
});
|
|
831
|
+
if (!existsSync(launchArgs.executablePath)) {
|
|
832
|
+
if (launchArgs.isTempUserDataDir) {
|
|
833
|
+
await this.cleanUserDataDir(launchArgs.userDataDir, {
|
|
834
|
+
isTemp: true
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);
|
|
838
|
+
}
|
|
839
|
+
const usePipe = launchArgs.args.includes("--remote-debugging-pipe");
|
|
840
|
+
const onProcessExit = async () => {
|
|
841
|
+
await this.cleanUserDataDir(launchArgs.userDataDir, {
|
|
842
|
+
isTemp: launchArgs.isTempUserDataDir
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
if (this.#browser === "firefox" && protocol === "webDriverBiDi" && usePipe) {
|
|
846
|
+
throw new Error("Pipe connections are not supported with Firefox and WebDriver BiDi");
|
|
847
|
+
}
|
|
848
|
+
const browserProcess = launch({
|
|
849
|
+
executablePath: launchArgs.executablePath,
|
|
850
|
+
args: launchArgs.args,
|
|
851
|
+
handleSIGHUP,
|
|
852
|
+
handleSIGTERM,
|
|
853
|
+
handleSIGINT,
|
|
854
|
+
dumpio,
|
|
855
|
+
env,
|
|
856
|
+
pipe: usePipe,
|
|
857
|
+
onExit: onProcessExit,
|
|
858
|
+
signal: options.signal,
|
|
859
|
+
logger: options.logger
|
|
860
|
+
});
|
|
861
|
+
let browser;
|
|
862
|
+
let cdpConnection;
|
|
863
|
+
let closing = false;
|
|
864
|
+
const browserCloseCallback = async () => {
|
|
865
|
+
if (closing) {
|
|
866
|
+
return;
|
|
867
|
+
}
|
|
868
|
+
closing = true;
|
|
869
|
+
await this.closeBrowser(browserProcess, cdpConnection);
|
|
870
|
+
};
|
|
871
|
+
try {
|
|
872
|
+
if (this.#browser === "firefox") {
|
|
873
|
+
browser = await this.createBiDiBrowser(browserProcess, browserCloseCallback, {
|
|
874
|
+
timeout: timeout2,
|
|
875
|
+
protocolTimeout,
|
|
876
|
+
slowMo,
|
|
877
|
+
defaultViewport,
|
|
878
|
+
acceptInsecureCerts,
|
|
879
|
+
networkEnabled,
|
|
880
|
+
idGenerator,
|
|
881
|
+
logger: options.logger
|
|
882
|
+
});
|
|
883
|
+
} else {
|
|
884
|
+
if (usePipe) {
|
|
885
|
+
cdpConnection = await this.createCdpPipeConnection(browserProcess, {
|
|
886
|
+
timeout: timeout2,
|
|
887
|
+
protocolTimeout,
|
|
888
|
+
slowMo,
|
|
889
|
+
idGenerator,
|
|
890
|
+
logger: options.logger
|
|
891
|
+
});
|
|
892
|
+
} else {
|
|
893
|
+
cdpConnection = await this.createCdpSocketConnection(browserProcess, {
|
|
894
|
+
timeout: timeout2,
|
|
895
|
+
protocolTimeout,
|
|
896
|
+
slowMo,
|
|
897
|
+
idGenerator,
|
|
898
|
+
logger: options.logger
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
if (protocol === "webDriverBiDi") {
|
|
902
|
+
browser = await this.createBiDiOverCdpBrowser(browserProcess, cdpConnection, browserCloseCallback, {
|
|
903
|
+
defaultViewport,
|
|
904
|
+
acceptInsecureCerts,
|
|
905
|
+
networkEnabled,
|
|
906
|
+
issuesEnabled,
|
|
907
|
+
logger: options.logger
|
|
908
|
+
});
|
|
909
|
+
} else {
|
|
910
|
+
browser = await CdpBrowser._create(cdpConnection, [], acceptInsecureCerts, defaultViewport, downloadBehavior, browserProcess.nodeProcess, browserCloseCallback, options.targetFilter, void 0, void 0, networkEnabled, issuesEnabled, handleDevToolsAsPage, blocklist, allowlist, options.logger);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
} catch (error) {
|
|
914
|
+
void browserCloseCallback();
|
|
915
|
+
const logs = browserProcess.getRecentLogs().join("\n");
|
|
916
|
+
if (logs.includes("Failed to create a ProcessSingleton for your profile directory") || // On Windows we will not get logs due to the singleton process handover. See
|
|
917
|
+
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/process_singleton_win.cc;l=46;drc=fc7952f0422b5073515a205a04ec9c3a1ae81658
|
|
918
|
+
process.platform === "win32" && existsSync(join(launchArgs.userDataDir, "lockfile"))) {
|
|
919
|
+
if (!isWritableDirectory(launchArgs.userDataDir)) {
|
|
920
|
+
throw new Error(`The browser cannot write to ${launchArgs.userDataDir}. Make the \`userDataDir\` writable or use a different one.`);
|
|
921
|
+
}
|
|
922
|
+
throw new Error(`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`);
|
|
923
|
+
}
|
|
924
|
+
if (logs.includes("Missing X server") && options.headless === false) {
|
|
925
|
+
throw new Error(`Missing X server to start the headful browser. Either set headless to true or use xvfb-run to run your Puppeteer script.`);
|
|
926
|
+
}
|
|
927
|
+
if (error instanceof TimeoutError2) {
|
|
928
|
+
throw new TimeoutError(error.message);
|
|
929
|
+
}
|
|
930
|
+
throw error;
|
|
931
|
+
}
|
|
932
|
+
if (Array.isArray(enableExtensions)) {
|
|
933
|
+
await Promise.all([
|
|
934
|
+
enableExtensions.map((path4) => {
|
|
935
|
+
return browser.installExtension(path4, {
|
|
936
|
+
enabledInIncognito: extensionsEnabledInIncognito.includes(path4)
|
|
937
|
+
});
|
|
938
|
+
})
|
|
939
|
+
]);
|
|
940
|
+
}
|
|
941
|
+
if (waitForInitialPage) {
|
|
942
|
+
await this.waitForPageTarget(browser, timeout2);
|
|
943
|
+
}
|
|
944
|
+
return browser;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* @internal
|
|
948
|
+
*/
|
|
949
|
+
async closeBrowser(browserProcess, cdpConnection) {
|
|
950
|
+
if (cdpConnection) {
|
|
951
|
+
try {
|
|
952
|
+
await cdpConnection.closeBrowser();
|
|
953
|
+
await browserProcess.hasClosed();
|
|
954
|
+
} catch (error) {
|
|
955
|
+
this.#logger?.(DEBUG_PREFIXES.error)?.(error);
|
|
956
|
+
await browserProcess.close();
|
|
957
|
+
}
|
|
958
|
+
} else {
|
|
959
|
+
await firstValueFrom(race(from(browserProcess.hasClosed()), timer(5e3).pipe(map(() => {
|
|
960
|
+
return from(browserProcess.close());
|
|
961
|
+
}))));
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* @internal
|
|
966
|
+
*/
|
|
967
|
+
async waitForPageTarget(browser, timeout2) {
|
|
968
|
+
try {
|
|
969
|
+
await browser.waitForTarget((t) => {
|
|
970
|
+
return t.type() === "page";
|
|
971
|
+
}, { timeout: timeout2 });
|
|
972
|
+
} catch (error) {
|
|
973
|
+
await browser.close();
|
|
974
|
+
throw error;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* @internal
|
|
979
|
+
*/
|
|
980
|
+
async createCdpSocketConnection(browserProcess, opts) {
|
|
981
|
+
const browserWSEndpoint = await browserProcess.waitForLineOutput(CDP_WEBSOCKET_ENDPOINT_REGEX, opts.timeout);
|
|
982
|
+
const transport = await NodeWebSocketTransport.create(browserWSEndpoint, void 0, opts.logger, opts.wsOptions);
|
|
983
|
+
return new Connection(
|
|
984
|
+
browserWSEndpoint,
|
|
985
|
+
transport,
|
|
986
|
+
opts.slowMo,
|
|
987
|
+
opts.protocolTimeout,
|
|
988
|
+
/* rawErrors */
|
|
989
|
+
false,
|
|
990
|
+
opts.idGenerator,
|
|
991
|
+
opts.logger
|
|
992
|
+
);
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* @internal
|
|
996
|
+
*/
|
|
997
|
+
async createCdpPipeConnection(browserProcess, opts) {
|
|
998
|
+
const { 3: pipeWrite, 4: pipeRead } = browserProcess.nodeProcess.stdio;
|
|
999
|
+
const transport = new PipeTransport(pipeWrite, pipeRead, opts.logger);
|
|
1000
|
+
return new Connection(
|
|
1001
|
+
"",
|
|
1002
|
+
transport,
|
|
1003
|
+
opts.slowMo,
|
|
1004
|
+
opts.protocolTimeout,
|
|
1005
|
+
/* rawErrors */
|
|
1006
|
+
false,
|
|
1007
|
+
opts.idGenerator,
|
|
1008
|
+
opts.logger
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* @internal
|
|
1013
|
+
*/
|
|
1014
|
+
async createBiDiOverCdpBrowser(browserProcess, cdpConnection, closeCallback, opts) {
|
|
1015
|
+
const bidiOnly = process.env["PUPPETEER_WEBDRIVER_BIDI_ONLY"] === "true";
|
|
1016
|
+
const BiDi = await import(
|
|
1017
|
+
/* webpackIgnore: true */
|
|
1018
|
+
"./bidi-25S23FWJ.js"
|
|
1019
|
+
);
|
|
1020
|
+
const bidiConnection = await BiDi.connectBidiOverCdp(cdpConnection, opts.logger);
|
|
1021
|
+
return await BiDi.BidiBrowser.create({
|
|
1022
|
+
connection: bidiConnection,
|
|
1023
|
+
// Do not provide CDP connection to Browser, if BiDi-only mode is enabled. This
|
|
1024
|
+
// would restrict Browser to use only BiDi endpoint.
|
|
1025
|
+
cdpConnection: bidiOnly ? void 0 : cdpConnection,
|
|
1026
|
+
closeCallback,
|
|
1027
|
+
process: browserProcess.nodeProcess,
|
|
1028
|
+
defaultViewport: opts.defaultViewport,
|
|
1029
|
+
acceptInsecureCerts: opts.acceptInsecureCerts,
|
|
1030
|
+
networkEnabled: opts.networkEnabled,
|
|
1031
|
+
issuesEnabled: opts.issuesEnabled,
|
|
1032
|
+
logger: opts.logger
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* @internal
|
|
1037
|
+
*/
|
|
1038
|
+
async createBiDiBrowser(browserProcess, closeCallback, opts) {
|
|
1039
|
+
const browserWSEndpoint = await browserProcess.waitForLineOutput(WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, opts.timeout) + "/session";
|
|
1040
|
+
const transport = await NodeWebSocketTransport.create(browserWSEndpoint, void 0, opts.logger, opts.wsOptions);
|
|
1041
|
+
const BiDi = await import(
|
|
1042
|
+
/* webpackIgnore: true */
|
|
1043
|
+
"./bidi-25S23FWJ.js"
|
|
1044
|
+
);
|
|
1045
|
+
const bidiConnection = new BiDi.BidiConnection(browserWSEndpoint, transport, opts.idGenerator, opts.slowMo, opts.protocolTimeout, opts.logger);
|
|
1046
|
+
return await BiDi.BidiBrowser.create({
|
|
1047
|
+
connection: bidiConnection,
|
|
1048
|
+
closeCallback,
|
|
1049
|
+
process: browserProcess.nodeProcess,
|
|
1050
|
+
defaultViewport: opts.defaultViewport,
|
|
1051
|
+
acceptInsecureCerts: opts.acceptInsecureCerts,
|
|
1052
|
+
networkEnabled: opts.networkEnabled ?? true,
|
|
1053
|
+
issuesEnabled: opts.issuesEnabled ?? true,
|
|
1054
|
+
logger: opts.logger
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* @internal
|
|
1059
|
+
*/
|
|
1060
|
+
async getProfilePath() {
|
|
1061
|
+
const config = await this.puppeteer.configuration();
|
|
1062
|
+
return join(config.temporaryDirectory ?? tmpdir(), `puppeteer_dev_${this.browser}_profile-`);
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* @internal
|
|
1066
|
+
*/
|
|
1067
|
+
async resolveExecutablePath(headless, validatePath = true) {
|
|
1068
|
+
const config = await this.puppeteer.configuration();
|
|
1069
|
+
let executablePath3 = config.executablePath;
|
|
1070
|
+
if (executablePath3) {
|
|
1071
|
+
if (validatePath && !existsSync(executablePath3)) {
|
|
1072
|
+
throw new Error(`Tried to find the browser at the configured path (${executablePath3}), but no executable was found.`);
|
|
1073
|
+
}
|
|
1074
|
+
return executablePath3;
|
|
1075
|
+
}
|
|
1076
|
+
function puppeteerBrowserToInstalledBrowser(browser, headless2) {
|
|
1077
|
+
switch (browser) {
|
|
1078
|
+
case "chrome":
|
|
1079
|
+
if (headless2 === "shell") {
|
|
1080
|
+
return Browser2.CHROMEHEADLESSSHELL;
|
|
1081
|
+
}
|
|
1082
|
+
return Browser2.CHROME;
|
|
1083
|
+
case "firefox":
|
|
1084
|
+
return Browser2.FIREFOX;
|
|
1085
|
+
}
|
|
1086
|
+
return Browser2.CHROME;
|
|
1087
|
+
}
|
|
1088
|
+
const browserType = puppeteerBrowserToInstalledBrowser(this.browser, headless);
|
|
1089
|
+
const defaultDownloadPath = await this.puppeteer.defaultDownloadPath();
|
|
1090
|
+
const browserVersion = await this.puppeteer.browserVersion();
|
|
1091
|
+
executablePath3 = computeExecutablePath({
|
|
1092
|
+
cacheDir: defaultDownloadPath,
|
|
1093
|
+
browser: browserType,
|
|
1094
|
+
buildId: browserVersion
|
|
1095
|
+
});
|
|
1096
|
+
if (validatePath && !existsSync(executablePath3)) {
|
|
1097
|
+
const configVersion = config?.[this.browser]?.version;
|
|
1098
|
+
if (configVersion) {
|
|
1099
|
+
throw new Error(`Tried to find the browser at the configured path (${executablePath3}) for version ${configVersion}, but no executable was found.`);
|
|
1100
|
+
}
|
|
1101
|
+
throw new Error(`Could not find ${getBrowserTypeDisplayName(browserType)} (ver. ${browserVersion}). This can occur if either
|
|
1102
|
+
1. you did not perform an installation before running the script (e.g. \`npx puppeteer browsers install ${browserType}\`) or
|
|
1103
|
+
2. your cache path is incorrectly configured (which is: ${config.cacheDirectory}).
|
|
1104
|
+
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.`);
|
|
1105
|
+
}
|
|
1106
|
+
return executablePath3;
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/util/fs.js
|
|
1111
|
+
import fs2 from "fs";
|
|
1112
|
+
var rmOptions = {
|
|
1113
|
+
force: true,
|
|
1114
|
+
recursive: true,
|
|
1115
|
+
maxRetries: 10,
|
|
1116
|
+
retryDelay: 100
|
|
1117
|
+
};
|
|
1118
|
+
async function rm(path4) {
|
|
1119
|
+
await fs2.promises.rm(path4, rmOptions);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/ChromeLauncher.js
|
|
1123
|
+
var ChromeLauncher = class extends BrowserLauncher {
|
|
1124
|
+
constructor(puppeteer3, logger) {
|
|
1125
|
+
super(puppeteer3, "chrome", logger);
|
|
1126
|
+
}
|
|
1127
|
+
async launch(options = {}) {
|
|
1128
|
+
const config = await this.puppeteer.configuration();
|
|
1129
|
+
if (config.logLevel === "warn" && process.platform === "darwin" && process.arch === "x64") {
|
|
1130
|
+
const cpus = os.cpus();
|
|
1131
|
+
if (cpus[0]?.model.includes("Apple")) {
|
|
1132
|
+
console.warn([
|
|
1133
|
+
"\x1B[1m\x1B[43m\x1B[30m",
|
|
1134
|
+
"Degraded performance warning:\x1B[0m\x1B[33m",
|
|
1135
|
+
"Launching Chrome on Mac Silicon (arm64) from an x64 Node installation results in",
|
|
1136
|
+
"Rosetta translating the Chrome binary, even if Chrome is already arm64. This would",
|
|
1137
|
+
"result in huge performance issues. To resolve this, you must run Puppeteer with",
|
|
1138
|
+
"a version of Node built for arm64."
|
|
1139
|
+
].join("\n "));
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
return await super.launch(options);
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* @internal
|
|
1146
|
+
*/
|
|
1147
|
+
async computeLaunchArguments(options = {}) {
|
|
1148
|
+
const { ignoreDefaultArgs = false, args = [], pipe = false, debuggingPort, channel, executablePath: executablePath3 } = options;
|
|
1149
|
+
const chromeArguments = [];
|
|
1150
|
+
if (!ignoreDefaultArgs) {
|
|
1151
|
+
chromeArguments.push(...this.defaultArgs(options));
|
|
1152
|
+
} else if (Array.isArray(ignoreDefaultArgs)) {
|
|
1153
|
+
chromeArguments.push(...this.defaultArgs(options).filter((arg) => {
|
|
1154
|
+
return !ignoreDefaultArgs.includes(arg);
|
|
1155
|
+
}));
|
|
1156
|
+
} else {
|
|
1157
|
+
chromeArguments.push(...args);
|
|
1158
|
+
}
|
|
1159
|
+
if (!chromeArguments.some((argument) => {
|
|
1160
|
+
return argument.startsWith("--remote-debugging-");
|
|
1161
|
+
})) {
|
|
1162
|
+
if (pipe) {
|
|
1163
|
+
assert(!debuggingPort, "Browser should be launched with either pipe or debugging port - not both.");
|
|
1164
|
+
chromeArguments.push("--remote-debugging-pipe");
|
|
1165
|
+
} else {
|
|
1166
|
+
chromeArguments.push(`--remote-debugging-port=${debuggingPort || 0}`);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
let isTempUserDataDir = false;
|
|
1170
|
+
const userDataDirIndex = chromeArguments.findIndex((arg) => {
|
|
1171
|
+
return arg.startsWith("--user-data-dir");
|
|
1172
|
+
});
|
|
1173
|
+
let userDataDir;
|
|
1174
|
+
if (userDataDirIndex < 0) {
|
|
1175
|
+
isTempUserDataDir = true;
|
|
1176
|
+
const profilePath = await this.getProfilePath();
|
|
1177
|
+
userDataDir = await mkdtemp(profilePath);
|
|
1178
|
+
chromeArguments.push(`--user-data-dir=${userDataDir}`);
|
|
1179
|
+
} else {
|
|
1180
|
+
const parsedUserDataDir = chromeArguments[userDataDirIndex].split("=", 2)[1];
|
|
1181
|
+
assert(typeof parsedUserDataDir === "string", "`--user-data-dir` is malformed");
|
|
1182
|
+
userDataDir = parsedUserDataDir;
|
|
1183
|
+
}
|
|
1184
|
+
let chromeExecutable = executablePath3;
|
|
1185
|
+
if (!chromeExecutable) {
|
|
1186
|
+
assert(channel || !this.puppeteer._isPuppeteerCore, `An \`executablePath\` or \`channel\` must be specified for \`puppeteer-core\``);
|
|
1187
|
+
chromeExecutable = channel ? await this.executablePath(channel) : await this.resolveExecutablePath(options.headless ?? true);
|
|
1188
|
+
}
|
|
1189
|
+
return {
|
|
1190
|
+
executablePath: chromeExecutable,
|
|
1191
|
+
args: chromeArguments,
|
|
1192
|
+
isTempUserDataDir,
|
|
1193
|
+
userDataDir
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* @internal
|
|
1198
|
+
*/
|
|
1199
|
+
async cleanUserDataDir(path4, opts) {
|
|
1200
|
+
if (opts.isTemp) {
|
|
1201
|
+
try {
|
|
1202
|
+
await rm(path4);
|
|
1203
|
+
} catch (error) {
|
|
1204
|
+
this.logger(DEBUG_PREFIXES.error)?.(error);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
defaultArgs(options = {}) {
|
|
1209
|
+
const userDisabledFeatures = getFeatures("--disable-features", options.args);
|
|
1210
|
+
if (options.args && userDisabledFeatures.length > 0) {
|
|
1211
|
+
removeMatchingFlags(options.args, "--disable-features");
|
|
1212
|
+
}
|
|
1213
|
+
const turnOnExperimentalFeaturesForTesting = process.env["PUPPETEER_TEST_EXPERIMENTAL_CHROME_FEATURES"] === "true";
|
|
1214
|
+
const userEnabledFeatures = getFeatures("--enable-features", options.args);
|
|
1215
|
+
if (options.args && userEnabledFeatures.length > 0) {
|
|
1216
|
+
removeMatchingFlags(options.args, "--enable-features");
|
|
1217
|
+
}
|
|
1218
|
+
const enabledFeatures = [
|
|
1219
|
+
"PdfOopif",
|
|
1220
|
+
// Add features to enable by default here.
|
|
1221
|
+
...userEnabledFeatures
|
|
1222
|
+
].filter((feature) => {
|
|
1223
|
+
return feature !== "";
|
|
1224
|
+
});
|
|
1225
|
+
const disabledFeatures = [
|
|
1226
|
+
"Translate",
|
|
1227
|
+
// AcceptCHFrame disabled because of crbug.com/1348106.
|
|
1228
|
+
"AcceptCHFrame",
|
|
1229
|
+
"MediaRouter",
|
|
1230
|
+
"OptimizationHints",
|
|
1231
|
+
"WebUIReloadButton",
|
|
1232
|
+
"WebUIOmniboxPopup",
|
|
1233
|
+
"WebUIOmniboxAimPopup",
|
|
1234
|
+
...turnOnExperimentalFeaturesForTesting ? [] : [
|
|
1235
|
+
// https://crbug.com/1492053
|
|
1236
|
+
"ProcessPerSiteUpToMainFrameThreshold",
|
|
1237
|
+
// https://github.com/puppeteer/puppeteer/issues/10715
|
|
1238
|
+
"IsolateSandboxedIframes"
|
|
1239
|
+
],
|
|
1240
|
+
...userDisabledFeatures
|
|
1241
|
+
].filter((feature) => {
|
|
1242
|
+
return feature !== "";
|
|
1243
|
+
}).filter((disabledFeature) => {
|
|
1244
|
+
return !enabledFeatures.includes(disabledFeature);
|
|
1245
|
+
});
|
|
1246
|
+
const chromeArguments = [
|
|
1247
|
+
"--allow-pre-commit-input",
|
|
1248
|
+
"--disable-background-networking",
|
|
1249
|
+
"--disable-background-timer-throttling",
|
|
1250
|
+
"--disable-backgrounding-occluded-windows",
|
|
1251
|
+
"--disable-breakpad",
|
|
1252
|
+
"--disable-client-side-phishing-detection",
|
|
1253
|
+
"--disable-component-extensions-with-background-pages",
|
|
1254
|
+
"--disable-crash-reporter",
|
|
1255
|
+
// No crash reporting in CfT.
|
|
1256
|
+
"--disable-default-apps",
|
|
1257
|
+
"--disable-dev-shm-usage",
|
|
1258
|
+
"--disable-hang-monitor",
|
|
1259
|
+
"--disable-infobars",
|
|
1260
|
+
"--disable-ipc-flooding-protection",
|
|
1261
|
+
"--disable-popup-blocking",
|
|
1262
|
+
"--disable-prompt-on-repost",
|
|
1263
|
+
"--disable-renderer-backgrounding",
|
|
1264
|
+
"--disable-search-engine-choice-screen",
|
|
1265
|
+
"--disable-sync",
|
|
1266
|
+
"--enable-automation",
|
|
1267
|
+
"--export-tagged-pdf",
|
|
1268
|
+
"--force-color-profile=srgb",
|
|
1269
|
+
"--generate-pdf-document-outline",
|
|
1270
|
+
"--metrics-recording-only",
|
|
1271
|
+
"--no-first-run",
|
|
1272
|
+
"--password-store=basic",
|
|
1273
|
+
"--use-mock-keychain",
|
|
1274
|
+
`--disable-features=${disabledFeatures.join(",")}`,
|
|
1275
|
+
`--enable-features=${enabledFeatures.join(",")}`
|
|
1276
|
+
].filter((arg) => {
|
|
1277
|
+
return arg !== "";
|
|
1278
|
+
});
|
|
1279
|
+
const { devtools = false, headless = !devtools, args = [], userDataDir, enableExtensions = false } = options;
|
|
1280
|
+
if (process.env["PUPPETEER_DANGEROUS_NO_SANDBOX"] === "true" && !args.includes("--no-sandbox")) {
|
|
1281
|
+
chromeArguments.push("--no-sandbox");
|
|
1282
|
+
}
|
|
1283
|
+
if (userDataDir) {
|
|
1284
|
+
chromeArguments.push(`--user-data-dir=${path2.posix.isAbsolute(userDataDir) || path2.win32.isAbsolute(userDataDir) ? userDataDir : path2.resolve(userDataDir)}`);
|
|
1285
|
+
}
|
|
1286
|
+
if (devtools) {
|
|
1287
|
+
chromeArguments.push("--auto-open-devtools-for-tabs");
|
|
1288
|
+
}
|
|
1289
|
+
if (headless) {
|
|
1290
|
+
chromeArguments.push(headless === "shell" ? "--headless" : "--headless=new", "--hide-scrollbars", "--mute-audio");
|
|
1291
|
+
}
|
|
1292
|
+
if (!enableExtensions) {
|
|
1293
|
+
chromeArguments.push("--disable-extensions");
|
|
1294
|
+
}
|
|
1295
|
+
if (args.every((arg) => {
|
|
1296
|
+
return arg.startsWith("-");
|
|
1297
|
+
})) {
|
|
1298
|
+
chromeArguments.push("about:blank");
|
|
1299
|
+
}
|
|
1300
|
+
chromeArguments.push(...args);
|
|
1301
|
+
return chromeArguments;
|
|
1302
|
+
}
|
|
1303
|
+
async executablePath(channel, validatePath = true) {
|
|
1304
|
+
if (channel) {
|
|
1305
|
+
return computeSystemExecutablePath({
|
|
1306
|
+
browser: Browser2.CHROME,
|
|
1307
|
+
channel: convertPuppeteerChannelToBrowsersChannel(channel)
|
|
1308
|
+
}, validatePath);
|
|
1309
|
+
} else {
|
|
1310
|
+
return await this.resolveExecutablePath(void 0, validatePath);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
function getFeatures(flag, options = []) {
|
|
1315
|
+
const prefix = flag.endsWith("=") ? flag : `${flag}=`;
|
|
1316
|
+
return options.filter((s) => {
|
|
1317
|
+
return s.startsWith(prefix);
|
|
1318
|
+
}).flatMap((s) => {
|
|
1319
|
+
return s.substring(s.indexOf("=") + 1).trim().split(",").map((feature) => {
|
|
1320
|
+
return feature.trim();
|
|
1321
|
+
});
|
|
1322
|
+
}).filter((s) => {
|
|
1323
|
+
return s;
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
function removeMatchingFlags(array, flag) {
|
|
1327
|
+
const prefix = flag.endsWith("=") ? flag : `${flag}=`;
|
|
1328
|
+
let i = 0;
|
|
1329
|
+
while (i < array.length) {
|
|
1330
|
+
if (array[i].startsWith(prefix)) {
|
|
1331
|
+
array.splice(i, 1);
|
|
1332
|
+
} else {
|
|
1333
|
+
i++;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
return array;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/FirefoxLauncher.js
|
|
1340
|
+
import fs3 from "fs";
|
|
1341
|
+
import { rename, unlink, mkdtemp as mkdtemp2 } from "fs/promises";
|
|
1342
|
+
import os2 from "os";
|
|
1343
|
+
import path3 from "path";
|
|
1344
|
+
var FirefoxLauncher = class _FirefoxLauncher extends BrowserLauncher {
|
|
1345
|
+
constructor(puppeteer3, logger) {
|
|
1346
|
+
super(puppeteer3, "firefox", logger);
|
|
1347
|
+
}
|
|
1348
|
+
static getPreferences(extraPrefsFirefox) {
|
|
1349
|
+
return {
|
|
1350
|
+
...extraPrefsFirefox,
|
|
1351
|
+
// Force all web content to use a single content process. TODO: remove
|
|
1352
|
+
// this once Firefox supports mouse event dispatch from the main frame
|
|
1353
|
+
// context. See https://bugzilla.mozilla.org/show_bug.cgi?id=1773393.
|
|
1354
|
+
"fission.webContentIsolationStrategy": 0
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* @internal
|
|
1359
|
+
*/
|
|
1360
|
+
async computeLaunchArguments(options = {}) {
|
|
1361
|
+
const { ignoreDefaultArgs = false, args = [], executablePath: executablePath3, pipe = false, extraPrefsFirefox = {}, debuggingPort = null } = options;
|
|
1362
|
+
const firefoxArguments = [];
|
|
1363
|
+
if (!ignoreDefaultArgs) {
|
|
1364
|
+
firefoxArguments.push(...this.defaultArgs(options));
|
|
1365
|
+
} else if (Array.isArray(ignoreDefaultArgs)) {
|
|
1366
|
+
firefoxArguments.push(...this.defaultArgs(options).filter((arg) => {
|
|
1367
|
+
return !ignoreDefaultArgs.includes(arg);
|
|
1368
|
+
}));
|
|
1369
|
+
} else {
|
|
1370
|
+
firefoxArguments.push(...args);
|
|
1371
|
+
}
|
|
1372
|
+
if (!firefoxArguments.some((argument) => {
|
|
1373
|
+
return argument.startsWith("--remote-debugging-");
|
|
1374
|
+
})) {
|
|
1375
|
+
if (pipe) {
|
|
1376
|
+
assert(debuggingPort === null, "Browser should be launched with either pipe or debugging port - not both.");
|
|
1377
|
+
}
|
|
1378
|
+
firefoxArguments.push(`--remote-debugging-port=${debuggingPort || 0}`);
|
|
1379
|
+
}
|
|
1380
|
+
let userDataDir;
|
|
1381
|
+
let isTempUserDataDir = true;
|
|
1382
|
+
const profileArgIndex = firefoxArguments.findIndex((arg) => {
|
|
1383
|
+
return ["-profile", "--profile"].includes(arg);
|
|
1384
|
+
});
|
|
1385
|
+
if (profileArgIndex !== -1) {
|
|
1386
|
+
userDataDir = firefoxArguments[profileArgIndex + 1];
|
|
1387
|
+
if (!userDataDir) {
|
|
1388
|
+
throw new Error(`Missing value for profile command line argument`);
|
|
1389
|
+
}
|
|
1390
|
+
isTempUserDataDir = false;
|
|
1391
|
+
} else {
|
|
1392
|
+
const profilePath = await this.getProfilePath();
|
|
1393
|
+
userDataDir = await mkdtemp2(profilePath);
|
|
1394
|
+
firefoxArguments.push("--profile");
|
|
1395
|
+
firefoxArguments.push(userDataDir);
|
|
1396
|
+
}
|
|
1397
|
+
await createProfile(Browser2.FIREFOX, {
|
|
1398
|
+
path: userDataDir,
|
|
1399
|
+
preferences: _FirefoxLauncher.getPreferences(extraPrefsFirefox)
|
|
1400
|
+
});
|
|
1401
|
+
let firefoxExecutable;
|
|
1402
|
+
if (this.puppeteer._isPuppeteerCore || executablePath3) {
|
|
1403
|
+
assert(executablePath3, `An \`executablePath\` must be specified for \`puppeteer-core\``);
|
|
1404
|
+
firefoxExecutable = executablePath3;
|
|
1405
|
+
} else {
|
|
1406
|
+
firefoxExecutable = await this.executablePath(void 0);
|
|
1407
|
+
}
|
|
1408
|
+
return {
|
|
1409
|
+
isTempUserDataDir,
|
|
1410
|
+
userDataDir,
|
|
1411
|
+
args: firefoxArguments,
|
|
1412
|
+
executablePath: firefoxExecutable
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* @internal
|
|
1417
|
+
*/
|
|
1418
|
+
async cleanUserDataDir(userDataDir, opts) {
|
|
1419
|
+
if (opts.isTemp) {
|
|
1420
|
+
try {
|
|
1421
|
+
await rm(userDataDir);
|
|
1422
|
+
} catch (error) {
|
|
1423
|
+
this.logger(DEBUG_PREFIXES.error)?.(error);
|
|
1424
|
+
}
|
|
1425
|
+
} else {
|
|
1426
|
+
try {
|
|
1427
|
+
const backupSuffix = ".puppeteer";
|
|
1428
|
+
const backupFiles = ["prefs.js", "user.js"];
|
|
1429
|
+
const results = await Promise.allSettled(backupFiles.map(async (file) => {
|
|
1430
|
+
const prefsBackupPath = path3.join(userDataDir, file + backupSuffix);
|
|
1431
|
+
if (fs3.existsSync(prefsBackupPath)) {
|
|
1432
|
+
const prefsPath = path3.join(userDataDir, file);
|
|
1433
|
+
await unlink(prefsPath);
|
|
1434
|
+
await rename(prefsBackupPath, prefsPath);
|
|
1435
|
+
}
|
|
1436
|
+
}));
|
|
1437
|
+
for (const result of results) {
|
|
1438
|
+
if (result.status === "rejected") {
|
|
1439
|
+
throw result.reason;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
} catch (error) {
|
|
1443
|
+
this.logger(DEBUG_PREFIXES.error)?.(error);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
async executablePath(_, validatePath = true) {
|
|
1448
|
+
return await this.resolveExecutablePath(
|
|
1449
|
+
void 0,
|
|
1450
|
+
/* validatePath=*/
|
|
1451
|
+
validatePath
|
|
1452
|
+
);
|
|
1453
|
+
}
|
|
1454
|
+
defaultArgs(options = {}) {
|
|
1455
|
+
const { devtools = false, headless = !devtools, args = [], userDataDir = null } = options;
|
|
1456
|
+
const firefoxArguments = [];
|
|
1457
|
+
switch (os2.platform()) {
|
|
1458
|
+
case "darwin":
|
|
1459
|
+
firefoxArguments.push("--foreground");
|
|
1460
|
+
break;
|
|
1461
|
+
case "win32":
|
|
1462
|
+
firefoxArguments.push("--wait-for-browser");
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1465
|
+
if (userDataDir) {
|
|
1466
|
+
firefoxArguments.push("--profile");
|
|
1467
|
+
firefoxArguments.push(userDataDir);
|
|
1468
|
+
}
|
|
1469
|
+
if (headless) {
|
|
1470
|
+
firefoxArguments.push("--headless");
|
|
1471
|
+
}
|
|
1472
|
+
if (devtools) {
|
|
1473
|
+
firefoxArguments.push("--devtools");
|
|
1474
|
+
}
|
|
1475
|
+
if (args.every((arg) => {
|
|
1476
|
+
return arg.startsWith("-");
|
|
1477
|
+
})) {
|
|
1478
|
+
firefoxArguments.push("about:blank");
|
|
1479
|
+
}
|
|
1480
|
+
firefoxArguments.push(...args);
|
|
1481
|
+
return firefoxArguments;
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/PuppeteerNode.js
|
|
1486
|
+
var PuppeteerNode = class extends Puppeteer {
|
|
1487
|
+
#launcher;
|
|
1488
|
+
#lastLaunchedBrowser;
|
|
1489
|
+
configuration;
|
|
1490
|
+
/**
|
|
1491
|
+
* @internal
|
|
1492
|
+
*/
|
|
1493
|
+
constructor(settings) {
|
|
1494
|
+
const { configuration, ...commonSettings } = settings;
|
|
1495
|
+
super(commonSettings);
|
|
1496
|
+
if (configuration) {
|
|
1497
|
+
this.configuration = configuration;
|
|
1498
|
+
} else {
|
|
1499
|
+
this.configuration = () => {
|
|
1500
|
+
return Promise.resolve({});
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
this.connect = this.connect.bind(this);
|
|
1504
|
+
this.launch = this.launch.bind(this);
|
|
1505
|
+
this.executablePath = this.executablePath.bind(this);
|
|
1506
|
+
this.defaultArgs = this.defaultArgs.bind(this);
|
|
1507
|
+
this.trimCache = this.trimCache.bind(this);
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* This method attaches Puppeteer to an existing browser instance.
|
|
1511
|
+
*
|
|
1512
|
+
* @param options - Set of configurable options to set on the browser.
|
|
1513
|
+
* @returns Promise which resolves to browser instance.
|
|
1514
|
+
*/
|
|
1515
|
+
connect(options) {
|
|
1516
|
+
options.logger ??= debug;
|
|
1517
|
+
return super.connect(options);
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Launches a browser instance with given arguments and options when
|
|
1521
|
+
* specified.
|
|
1522
|
+
*
|
|
1523
|
+
* When using with `puppeteer-core`,
|
|
1524
|
+
* {@link LaunchOptions.executablePath | options.executablePath} or
|
|
1525
|
+
* {@link LaunchOptions.channel | options.channel} must be provided.
|
|
1526
|
+
*
|
|
1527
|
+
* @example
|
|
1528
|
+
* You can use {@link LaunchOptions.ignoreDefaultArgs | options.ignoreDefaultArgs}
|
|
1529
|
+
* to filter out `--mute-audio` from default arguments:
|
|
1530
|
+
*
|
|
1531
|
+
* ```ts
|
|
1532
|
+
* const browser = await puppeteer.launch({
|
|
1533
|
+
* ignoreDefaultArgs: ['--mute-audio'],
|
|
1534
|
+
* });
|
|
1535
|
+
* ```
|
|
1536
|
+
*
|
|
1537
|
+
* @remarks
|
|
1538
|
+
* Puppeteer can also be used to control the Chrome browser, but it works best
|
|
1539
|
+
* with the version of Chrome for Testing downloaded by default.
|
|
1540
|
+
* There is no guarantee it will work with any other version. If Google Chrome
|
|
1541
|
+
* (rather than Chrome for Testing) is preferred, a
|
|
1542
|
+
* {@link https://www.google.com/chrome/browser/canary.html | Chrome Canary}
|
|
1543
|
+
* or
|
|
1544
|
+
* {@link https://www.chromium.org/getting-involved/dev-channel | Dev Channel}
|
|
1545
|
+
* build is suggested. See
|
|
1546
|
+
* {@link https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/ | this article}
|
|
1547
|
+
* for a description of the differences between Chromium and Chrome.
|
|
1548
|
+
* {@link https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md | This article}
|
|
1549
|
+
* describes some differences for Linux users. See
|
|
1550
|
+
* {@link https://developer.chrome.com/blog/chrome-for-testing/ | this doc} for the description
|
|
1551
|
+
* of Chrome for Testing.
|
|
1552
|
+
*
|
|
1553
|
+
* @param options - Options to configure launching behavior.
|
|
1554
|
+
*/
|
|
1555
|
+
async launch(options = {}) {
|
|
1556
|
+
options.logger ??= debug;
|
|
1557
|
+
const { browser = await this.defaultBrowser() } = options;
|
|
1558
|
+
this.#lastLaunchedBrowser = browser;
|
|
1559
|
+
if (!["chrome", "firefox"].includes(browser)) {
|
|
1560
|
+
throw new Error(`Unknown product: ${browser}`);
|
|
1561
|
+
}
|
|
1562
|
+
this.#launcher = this.#getLauncher(browser, options.logger);
|
|
1563
|
+
return await this.#launcher.launch(options);
|
|
1564
|
+
}
|
|
1565
|
+
#getLauncher(browser, logger) {
|
|
1566
|
+
if (this.#launcher && this.#launcher.browser === browser) {
|
|
1567
|
+
return this.#launcher;
|
|
1568
|
+
}
|
|
1569
|
+
switch (browser) {
|
|
1570
|
+
case "chrome":
|
|
1571
|
+
return new ChromeLauncher(this, logger);
|
|
1572
|
+
case "firefox":
|
|
1573
|
+
return new FirefoxLauncher(this, logger);
|
|
1574
|
+
default:
|
|
1575
|
+
throw new Error(`Unknown product: ${browser}`);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
async executablePath(optsOrChannel) {
|
|
1579
|
+
if (optsOrChannel === void 0) {
|
|
1580
|
+
return await this.#getLauncher(await this.lastLaunchedBrowser(), debug).executablePath(
|
|
1581
|
+
void 0,
|
|
1582
|
+
/* validatePath= */
|
|
1583
|
+
false
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
if (typeof optsOrChannel === "string") {
|
|
1587
|
+
return await this.#getLauncher("chrome", debug).executablePath(
|
|
1588
|
+
optsOrChannel,
|
|
1589
|
+
/* validatePath= */
|
|
1590
|
+
false
|
|
1591
|
+
);
|
|
1592
|
+
}
|
|
1593
|
+
return await this.#getLauncher(optsOrChannel.browser ?? await this.lastLaunchedBrowser(), optsOrChannel.logger ?? debug).resolveExecutablePath(
|
|
1594
|
+
optsOrChannel.headless,
|
|
1595
|
+
/* validatePath= */
|
|
1596
|
+
false
|
|
1597
|
+
);
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* @internal
|
|
1601
|
+
*/
|
|
1602
|
+
async browserVersion() {
|
|
1603
|
+
const config = await this.configuration();
|
|
1604
|
+
const lastLaunched = await this.lastLaunchedBrowser();
|
|
1605
|
+
return config?.[lastLaunched]?.version ?? PUPPETEER_REVISIONS[lastLaunched];
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* The default download path for puppeteer. For puppeteer-core, this
|
|
1609
|
+
* code should never be called as it is never defined.
|
|
1610
|
+
*
|
|
1611
|
+
* @internal
|
|
1612
|
+
*/
|
|
1613
|
+
async defaultDownloadPath() {
|
|
1614
|
+
const config = await this.configuration();
|
|
1615
|
+
return config.cacheDirectory;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* The name of the browser that was last launched.
|
|
1619
|
+
*/
|
|
1620
|
+
async lastLaunchedBrowser() {
|
|
1621
|
+
return this.#lastLaunchedBrowser ?? await this.defaultBrowser();
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* The name of the browser that will be launched by default. For
|
|
1625
|
+
* `puppeteer`, this is influenced by your configuration. Otherwise, it's
|
|
1626
|
+
* `chrome`.
|
|
1627
|
+
*/
|
|
1628
|
+
async defaultBrowser() {
|
|
1629
|
+
const config = await this.configuration();
|
|
1630
|
+
return config.defaultBrowser ?? "chrome";
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* @param options - Set of configurable options to set on the browser.
|
|
1634
|
+
*
|
|
1635
|
+
* @returns The default arguments that the browser will be launched with.
|
|
1636
|
+
*/
|
|
1637
|
+
async defaultArgs(options = {}) {
|
|
1638
|
+
return this.#getLauncher(options.browser ?? await this.lastLaunchedBrowser(), options.logger ?? debug).defaultArgs(options);
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Removes all non-current Firefox and Chrome binaries in the cache directory
|
|
1642
|
+
* identified by the provided Puppeteer configuration. The current browser
|
|
1643
|
+
* version is determined by resolving PUPPETEER_REVISIONS from Puppeteer
|
|
1644
|
+
* unless `configuration.browserRevision` is provided.
|
|
1645
|
+
*
|
|
1646
|
+
* @remarks
|
|
1647
|
+
*
|
|
1648
|
+
* Note that the method does not check if any other Puppeteer versions
|
|
1649
|
+
* installed on the host that use the same cache directory require the
|
|
1650
|
+
* non-current binaries.
|
|
1651
|
+
*
|
|
1652
|
+
* @public
|
|
1653
|
+
*/
|
|
1654
|
+
async trimCache() {
|
|
1655
|
+
const platform = detectBrowserPlatform();
|
|
1656
|
+
if (!platform) {
|
|
1657
|
+
throw new Error("The current platform is not supported.");
|
|
1658
|
+
}
|
|
1659
|
+
const config = await this.configuration();
|
|
1660
|
+
const cacheDir = config.cacheDirectory;
|
|
1661
|
+
const installedBrowsers = await getInstalledBrowsers({
|
|
1662
|
+
cacheDir
|
|
1663
|
+
});
|
|
1664
|
+
const puppeteerBrowsers = [
|
|
1665
|
+
{
|
|
1666
|
+
product: "chrome",
|
|
1667
|
+
browser: Browser2.CHROME,
|
|
1668
|
+
currentBuildId: ""
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
product: "firefox",
|
|
1672
|
+
browser: Browser2.FIREFOX,
|
|
1673
|
+
currentBuildId: ""
|
|
1674
|
+
}
|
|
1675
|
+
];
|
|
1676
|
+
await Promise.all(puppeteerBrowsers.map(async (item) => {
|
|
1677
|
+
const tag = config?.[item.product]?.version ?? PUPPETEER_REVISIONS[item.product];
|
|
1678
|
+
item.currentBuildId = await resolveBuildId(item.browser, platform, tag);
|
|
1679
|
+
}));
|
|
1680
|
+
const currentBrowserBuilds = new Set(puppeteerBrowsers.map((browser) => {
|
|
1681
|
+
return `${browser.browser}_${browser.currentBuildId}`;
|
|
1682
|
+
}));
|
|
1683
|
+
const currentBrowsers = new Set(puppeteerBrowsers.map((browser) => {
|
|
1684
|
+
return browser.browser;
|
|
1685
|
+
}));
|
|
1686
|
+
for (const installedBrowser of installedBrowsers) {
|
|
1687
|
+
if (!currentBrowsers.has(installedBrowser.browser)) {
|
|
1688
|
+
continue;
|
|
1689
|
+
}
|
|
1690
|
+
if (currentBrowserBuilds.has(`${installedBrowser.browser}_${installedBrowser.buildId}`)) {
|
|
1691
|
+
continue;
|
|
1692
|
+
}
|
|
1693
|
+
await uninstall({
|
|
1694
|
+
browser: installedBrowser.browser,
|
|
1695
|
+
platform,
|
|
1696
|
+
cacheDir,
|
|
1697
|
+
buildId: installedBrowser.buildId
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
/**
|
|
1702
|
+
* Defines whether Puppeteer should follow symlinks for file operations.
|
|
1703
|
+
*
|
|
1704
|
+
* @param followSymlinks - Whether Puppeteer should follow symlinks.
|
|
1705
|
+
*
|
|
1706
|
+
* @public
|
|
1707
|
+
*/
|
|
1708
|
+
setFollowSymlinks(followSymlinks) {
|
|
1709
|
+
environment.value.followSymlinks = followSymlinks;
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/node/ScreenRecorder.js
|
|
1714
|
+
import { spawn, spawnSync } from "child_process";
|
|
1715
|
+
import os3 from "os";
|
|
1716
|
+
import { PassThrough } from "stream";
|
|
1717
|
+
var __runInitializers = function(thisArg, initializers, value) {
|
|
1718
|
+
var useValue = arguments.length > 2;
|
|
1719
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
1720
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
1721
|
+
}
|
|
1722
|
+
return useValue ? value : void 0;
|
|
1723
|
+
};
|
|
1724
|
+
var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
1725
|
+
function accept(f) {
|
|
1726
|
+
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
1727
|
+
return f;
|
|
1728
|
+
}
|
|
1729
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
1730
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
1731
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
1732
|
+
var _, done = false;
|
|
1733
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1734
|
+
var context = {};
|
|
1735
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
1736
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
1737
|
+
context.addInitializer = function(f) {
|
|
1738
|
+
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
1739
|
+
extraInitializers.push(accept(f || null));
|
|
1740
|
+
};
|
|
1741
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
1742
|
+
if (kind === "accessor") {
|
|
1743
|
+
if (result === void 0) continue;
|
|
1744
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
1745
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
1746
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
1747
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
1748
|
+
} else if (_ = accept(result)) {
|
|
1749
|
+
if (kind === "field") initializers.unshift(_);
|
|
1750
|
+
else descriptor[key] = _;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
1754
|
+
done = true;
|
|
1755
|
+
};
|
|
1756
|
+
var __setFunctionName = function(f, name, prefix) {
|
|
1757
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
1758
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
1759
|
+
};
|
|
1760
|
+
var CRF_VALUE = 30;
|
|
1761
|
+
var DEFAULT_FPS = 30;
|
|
1762
|
+
function countFrames(startTimestamp, previousTimestamp, timestamp, fps) {
|
|
1763
|
+
const end = Math.round((timestamp - startTimestamp) * fps);
|
|
1764
|
+
const start = Math.round((previousTimestamp - startTimestamp) * fps);
|
|
1765
|
+
return Math.max(0, end - start);
|
|
1766
|
+
}
|
|
1767
|
+
var ScreenRecorder = (() => {
|
|
1768
|
+
let _classSuper = PassThrough;
|
|
1769
|
+
let _instanceExtraInitializers = [];
|
|
1770
|
+
let _private_writeFrame_decorators;
|
|
1771
|
+
let _private_writeFrame_descriptor;
|
|
1772
|
+
let _stop_decorators;
|
|
1773
|
+
return class ScreenRecorder extends _classSuper {
|
|
1774
|
+
static {
|
|
1775
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
1776
|
+
__esDecorate(this, _private_writeFrame_descriptor = { value: __setFunctionName(async function(buffer) {
|
|
1777
|
+
const error = await new Promise((resolve) => {
|
|
1778
|
+
this.#process.stdin.write(buffer, resolve);
|
|
1779
|
+
});
|
|
1780
|
+
if (error) {
|
|
1781
|
+
console.log(`ffmpeg failed to write: ${error.message}.`);
|
|
1782
|
+
}
|
|
1783
|
+
}, "#writeFrame") }, _private_writeFrame_decorators, { kind: "method", name: "#writeFrame", static: false, private: true, access: { has: (obj) => #writeFrame in obj, get: (obj) => obj.#writeFrame }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1784
|
+
__esDecorate(this, null, _stop_decorators, { kind: "method", name: "stop", static: false, private: false, access: { has: (obj) => "stop" in obj, get: (obj) => obj.stop }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
1785
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
1786
|
+
}
|
|
1787
|
+
#page = __runInitializers(this, _instanceExtraInitializers);
|
|
1788
|
+
#process;
|
|
1789
|
+
#controller = new AbortController();
|
|
1790
|
+
#lastFrame;
|
|
1791
|
+
#fps;
|
|
1792
|
+
#logger;
|
|
1793
|
+
/**
|
|
1794
|
+
* @internal
|
|
1795
|
+
*/
|
|
1796
|
+
constructor(page, width, height, { ffmpegPath, speed, scale, crop, format, fps, loop, delay, quality, colors } = {}, logger) {
|
|
1797
|
+
super({ allowHalfOpen: false });
|
|
1798
|
+
this.#logger = logger;
|
|
1799
|
+
ffmpegPath ??= "ffmpeg";
|
|
1800
|
+
format ??= "webm";
|
|
1801
|
+
fps ??= DEFAULT_FPS;
|
|
1802
|
+
loop ||= -1;
|
|
1803
|
+
delay ??= -1;
|
|
1804
|
+
quality ??= CRF_VALUE;
|
|
1805
|
+
colors ??= 256;
|
|
1806
|
+
this.#fps = fps;
|
|
1807
|
+
const { error } = spawnSync(ffmpegPath);
|
|
1808
|
+
if (error) {
|
|
1809
|
+
throw error;
|
|
1810
|
+
}
|
|
1811
|
+
const filters = [
|
|
1812
|
+
`crop='min(${width},iw):min(${height},ih):0:0'`,
|
|
1813
|
+
`pad=${width}:${height}:0:0`
|
|
1814
|
+
];
|
|
1815
|
+
if (speed) {
|
|
1816
|
+
filters.push(`setpts=${1 / speed}*PTS`);
|
|
1817
|
+
}
|
|
1818
|
+
if (crop) {
|
|
1819
|
+
filters.push(`crop=${crop.width}:${crop.height}:${crop.x}:${crop.y}`);
|
|
1820
|
+
}
|
|
1821
|
+
if (scale) {
|
|
1822
|
+
filters.push(`scale=iw*${scale}:-1:flags=lanczos`);
|
|
1823
|
+
}
|
|
1824
|
+
const formatArgs = this.#getFormatArgs(format, fps, loop, delay, quality, colors);
|
|
1825
|
+
const vf = formatArgs.indexOf("-vf");
|
|
1826
|
+
if (vf !== -1) {
|
|
1827
|
+
filters.push(formatArgs.splice(vf, 2).at(-1) ?? "");
|
|
1828
|
+
}
|
|
1829
|
+
this.#process = spawn(
|
|
1830
|
+
ffmpegPath,
|
|
1831
|
+
// See https://trac.ffmpeg.org/wiki/Encode/VP9 for more information on flags.
|
|
1832
|
+
[
|
|
1833
|
+
["-loglevel", "error"],
|
|
1834
|
+
// Reduces general buffering.
|
|
1835
|
+
["-avioflags", "direct"],
|
|
1836
|
+
// Reduces initial buffering while analyzing input fps and other stats.
|
|
1837
|
+
[
|
|
1838
|
+
"-fpsprobesize",
|
|
1839
|
+
"0",
|
|
1840
|
+
"-probesize",
|
|
1841
|
+
"32",
|
|
1842
|
+
"-analyzeduration",
|
|
1843
|
+
"0",
|
|
1844
|
+
"-fflags",
|
|
1845
|
+
"nobuffer"
|
|
1846
|
+
],
|
|
1847
|
+
// Forces input to be read from standard input, and forces png input
|
|
1848
|
+
// image format. `-framerate` is an input option and must appear before
|
|
1849
|
+
// `-i`; otherwise ffmpeg ignores it and the image2pipe demuxer falls
|
|
1850
|
+
// back to its default 25fps, stretching the output timeline relative to
|
|
1851
|
+
// the frames we feed it at `fps`.
|
|
1852
|
+
// prettier-ignore
|
|
1853
|
+
["-framerate", `${fps}`, "-f", "image2pipe", "-vcodec", "png", "-i", "pipe:0"],
|
|
1854
|
+
// No audio
|
|
1855
|
+
["-an"],
|
|
1856
|
+
// This drastically reduces stalling when cpu is overbooked. By default
|
|
1857
|
+
// VP9 tries to use all available threads?
|
|
1858
|
+
["-threads", "1"],
|
|
1859
|
+
// Disable bitrate.
|
|
1860
|
+
["-b:v", "0"],
|
|
1861
|
+
// Specifies the encoding and format we are using.
|
|
1862
|
+
formatArgs,
|
|
1863
|
+
// Filters to ensure the images are piped correctly,
|
|
1864
|
+
// combined with any format-specific filters.
|
|
1865
|
+
["-vf", filters.join()],
|
|
1866
|
+
"pipe:1"
|
|
1867
|
+
].flat(),
|
|
1868
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1869
|
+
);
|
|
1870
|
+
this.#process.stdout.pipe(this);
|
|
1871
|
+
this.#process.stderr.on("data", (data) => {
|
|
1872
|
+
this.#logger?.(DEBUG_PREFIXES.ffmpeg)?.(data.toString("utf8"));
|
|
1873
|
+
});
|
|
1874
|
+
this.#page = page;
|
|
1875
|
+
const { client } = this.#page.mainFrame();
|
|
1876
|
+
client.once(CDPSessionEvent.Disconnected, () => {
|
|
1877
|
+
void this.stop().catch((err) => {
|
|
1878
|
+
this.#logger?.(DEBUG_PREFIXES.error)?.(err);
|
|
1879
|
+
});
|
|
1880
|
+
});
|
|
1881
|
+
let startTimestamp;
|
|
1882
|
+
this.#lastFrame = lastValueFrom(fromEmitterEvent(client, "Page.screencastFrame").pipe(tap((event) => {
|
|
1883
|
+
void client.send("Page.screencastFrameAck", {
|
|
1884
|
+
sessionId: event.sessionId
|
|
1885
|
+
});
|
|
1886
|
+
}), filter((event) => {
|
|
1887
|
+
return event.metadata.timestamp !== void 0;
|
|
1888
|
+
}), map((event) => {
|
|
1889
|
+
return {
|
|
1890
|
+
buffer: Buffer.from(event.data, "base64"),
|
|
1891
|
+
timestamp: event.metadata.timestamp
|
|
1892
|
+
};
|
|
1893
|
+
}), bufferCount(2, 1), concatMap(([{ timestamp: previousTimestamp, buffer }, { timestamp }]) => {
|
|
1894
|
+
startTimestamp ??= previousTimestamp;
|
|
1895
|
+
return from(Array(countFrames(startTimestamp, previousTimestamp, timestamp, fps)).fill(buffer));
|
|
1896
|
+
}), map((buffer) => {
|
|
1897
|
+
void this.#writeFrame(buffer);
|
|
1898
|
+
return [buffer, performance.now()];
|
|
1899
|
+
}), takeUntil(fromEvent(this.#controller.signal, "abort"))), { defaultValue: [Buffer.from([]), performance.now()] });
|
|
1900
|
+
}
|
|
1901
|
+
#getFormatArgs(format, fps, loop, delay, quality, colors) {
|
|
1902
|
+
const libvpx = [
|
|
1903
|
+
["-vcodec", "vp9"],
|
|
1904
|
+
// Sets the quality. Lower the better.
|
|
1905
|
+
["-crf", `${quality}`],
|
|
1906
|
+
// Sets the quality and how efficient the compression will be.
|
|
1907
|
+
[
|
|
1908
|
+
"-deadline",
|
|
1909
|
+
"realtime",
|
|
1910
|
+
"-cpu-used",
|
|
1911
|
+
`${Math.min(os3.cpus().length / 2, 8)}`
|
|
1912
|
+
]
|
|
1913
|
+
];
|
|
1914
|
+
switch (format) {
|
|
1915
|
+
case "webm":
|
|
1916
|
+
return [
|
|
1917
|
+
...libvpx,
|
|
1918
|
+
// Sets the format
|
|
1919
|
+
["-f", "webm"]
|
|
1920
|
+
].flat();
|
|
1921
|
+
case "gif":
|
|
1922
|
+
fps = DEFAULT_FPS === fps ? 20 : "source_fps";
|
|
1923
|
+
if (loop === Infinity) {
|
|
1924
|
+
loop = 0;
|
|
1925
|
+
}
|
|
1926
|
+
if (delay !== -1) {
|
|
1927
|
+
delay /= 10;
|
|
1928
|
+
}
|
|
1929
|
+
return [
|
|
1930
|
+
// Sets the frame rate and uses a custom palette generated from the
|
|
1931
|
+
// input.
|
|
1932
|
+
[
|
|
1933
|
+
"-vf",
|
|
1934
|
+
`fps=${fps},split[s0][s1];[s0]palettegen=stats_mode=diff:max_colors=${colors}[p];[s1][p]paletteuse=dither=bayer`
|
|
1935
|
+
],
|
|
1936
|
+
// Sets the number of times to loop playback.
|
|
1937
|
+
["-loop", `${loop}`],
|
|
1938
|
+
// Sets the delay between iterations of a loop.
|
|
1939
|
+
["-final_delay", `${delay}`],
|
|
1940
|
+
// Sets the format
|
|
1941
|
+
["-f", "gif"]
|
|
1942
|
+
].flat();
|
|
1943
|
+
case "mp4":
|
|
1944
|
+
return [
|
|
1945
|
+
...libvpx,
|
|
1946
|
+
// Fragment file during stream to avoid errors.
|
|
1947
|
+
["-movflags", "hybrid_fragmented"],
|
|
1948
|
+
// Sets the format
|
|
1949
|
+
["-f", "mp4"]
|
|
1950
|
+
].flat();
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
get #writeFrame() {
|
|
1954
|
+
return _private_writeFrame_descriptor.value;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Stops the recorder.
|
|
1958
|
+
*
|
|
1959
|
+
* @public
|
|
1960
|
+
*/
|
|
1961
|
+
async stop() {
|
|
1962
|
+
if (this.#controller.signal.aborted) {
|
|
1963
|
+
return;
|
|
1964
|
+
}
|
|
1965
|
+
await this.#page._stopScreencast().catch((err) => {
|
|
1966
|
+
this.#logger?.(DEBUG_PREFIXES.error)?.(err);
|
|
1967
|
+
});
|
|
1968
|
+
this.#controller.abort();
|
|
1969
|
+
const [buffer, timestamp] = await this.#lastFrame;
|
|
1970
|
+
await Promise.all(Array(Math.max(1, Math.round(this.#fps * (performance.now() - timestamp) / 1e3))).fill(buffer).map(this.#writeFrame.bind(this)));
|
|
1971
|
+
this.#process.stdin.end();
|
|
1972
|
+
await new Promise((resolve) => {
|
|
1973
|
+
this.#process.once("close", resolve);
|
|
1974
|
+
});
|
|
1975
|
+
}
|
|
1976
|
+
async [(_private_writeFrame_decorators = [guarded()], _stop_decorators = [guarded()], asyncDisposeSymbol)]() {
|
|
1977
|
+
await this.stop();
|
|
1978
|
+
await super[asyncDisposeSymbol]();
|
|
1979
|
+
}
|
|
1980
|
+
};
|
|
1981
|
+
})();
|
|
1982
|
+
|
|
1983
|
+
// ../../node_modules/.pnpm/puppeteer-core@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer-core/lib/puppeteer/puppeteer-core.js
|
|
1984
|
+
environment.value.ScreenRecorder = ScreenRecorder;
|
|
1985
|
+
var puppeteer = new PuppeteerNode({
|
|
1986
|
+
isPuppeteerCore: true
|
|
1987
|
+
});
|
|
1988
|
+
var {
|
|
1989
|
+
/**
|
|
1990
|
+
* @public
|
|
1991
|
+
*/
|
|
1992
|
+
connect,
|
|
1993
|
+
/**
|
|
1994
|
+
* @public
|
|
1995
|
+
*/
|
|
1996
|
+
defaultArgs,
|
|
1997
|
+
/**
|
|
1998
|
+
* @public
|
|
1999
|
+
*/
|
|
2000
|
+
executablePath,
|
|
2001
|
+
/**
|
|
2002
|
+
* @public
|
|
2003
|
+
*/
|
|
2004
|
+
launch: launch2
|
|
2005
|
+
} = puppeteer;
|
|
2006
|
+
|
|
2007
|
+
// ../../node_modules/.pnpm/puppeteer@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer/lib/puppeteer/getConfiguration.js
|
|
2008
|
+
var import_lilconfig = __toESM(require_src(), 1);
|
|
2009
|
+
import { homedir } from "os";
|
|
2010
|
+
import { join as join2 } from "path";
|
|
2011
|
+
function getBooleanEnvVar(name) {
|
|
2012
|
+
const env = process.env[name];
|
|
2013
|
+
if (env === void 0) {
|
|
2014
|
+
return;
|
|
2015
|
+
}
|
|
2016
|
+
switch (env.toLowerCase()) {
|
|
2017
|
+
case "":
|
|
2018
|
+
case "0":
|
|
2019
|
+
case "false":
|
|
2020
|
+
case "off":
|
|
2021
|
+
return false;
|
|
2022
|
+
default:
|
|
2023
|
+
return true;
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
function isSupportedBrowser(product) {
|
|
2027
|
+
switch (product) {
|
|
2028
|
+
case "chrome":
|
|
2029
|
+
case "firefox":
|
|
2030
|
+
return true;
|
|
2031
|
+
default:
|
|
2032
|
+
return false;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
function getDefaultBrowser(browser) {
|
|
2036
|
+
if (!browser) {
|
|
2037
|
+
return "chrome";
|
|
2038
|
+
}
|
|
2039
|
+
if (!isSupportedBrowser(browser)) {
|
|
2040
|
+
throw new Error(`Unsupported browser ${browser}`);
|
|
2041
|
+
}
|
|
2042
|
+
return browser;
|
|
2043
|
+
}
|
|
2044
|
+
function getLogLevel(logLevel) {
|
|
2045
|
+
switch (logLevel) {
|
|
2046
|
+
case "silent":
|
|
2047
|
+
return "silent";
|
|
2048
|
+
case "error":
|
|
2049
|
+
return "error";
|
|
2050
|
+
default:
|
|
2051
|
+
return "warn";
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
function getBrowserSetting(browser, configuration, defaultConfig = {}) {
|
|
2055
|
+
const browserSetting = {};
|
|
2056
|
+
const browserEnvName = browser.replaceAll("-", "_").toUpperCase();
|
|
2057
|
+
browserSetting.version = process.env[`PUPPETEER_${browserEnvName}_VERSION`] ?? configuration[browser]?.version ?? defaultConfig.version;
|
|
2058
|
+
browserSetting.downloadBaseUrl = process.env[`PUPPETEER_${browserEnvName}_DOWNLOAD_BASE_URL`] ?? configuration[browser]?.downloadBaseUrl ?? defaultConfig.downloadBaseUrl;
|
|
2059
|
+
browserSetting.skipDownload = getBooleanEnvVar(`PUPPETEER_${browserEnvName}_SKIP_DOWNLOAD`) ?? getBooleanEnvVar(`PUPPETEER_SKIP_${browserEnvName}_DOWNLOAD`) ?? configuration[browser]?.skipDownload ?? configuration.skipDownload ?? defaultConfig.skipDownload;
|
|
2060
|
+
return browserSetting;
|
|
2061
|
+
}
|
|
2062
|
+
var getConfiguration = async () => {
|
|
2063
|
+
const result = await (0, import_lilconfig.lilconfig)("puppeteer", {
|
|
2064
|
+
searchPlaces: [
|
|
2065
|
+
"package.json",
|
|
2066
|
+
".config/puppeteer.config.cjs",
|
|
2067
|
+
".config/puppeteer.config.js",
|
|
2068
|
+
".config/puppeteerrc.cjs",
|
|
2069
|
+
".config/puppeteerrc.js",
|
|
2070
|
+
".config/puppeteerrc.json",
|
|
2071
|
+
".config/puppeteerrc",
|
|
2072
|
+
".puppeteerrc.cjs",
|
|
2073
|
+
".puppeteerrc.js",
|
|
2074
|
+
".puppeteerrc.json",
|
|
2075
|
+
".puppeteerrc",
|
|
2076
|
+
"puppeteer.config.cjs",
|
|
2077
|
+
"puppeteer.config.js"
|
|
2078
|
+
]
|
|
2079
|
+
}).search();
|
|
2080
|
+
const configuration = result ? { ...result.config } : {};
|
|
2081
|
+
configuration.logLevel = getLogLevel(process.env["PUPPETEER_LOGLEVEL"] ?? configuration.logLevel);
|
|
2082
|
+
configuration.defaultBrowser = getDefaultBrowser(process.env["PUPPETEER_BROWSER"] ?? configuration.defaultBrowser);
|
|
2083
|
+
configuration.executablePath = process.env["PUPPETEER_EXECUTABLE_PATH"] ?? configuration.executablePath;
|
|
2084
|
+
if (configuration.executablePath) {
|
|
2085
|
+
configuration.skipDownload = true;
|
|
2086
|
+
}
|
|
2087
|
+
configuration.skipDownload = getBooleanEnvVar("PUPPETEER_SKIP_DOWNLOAD") ?? configuration.skipDownload;
|
|
2088
|
+
configuration.chrome = getBrowserSetting("chrome", configuration);
|
|
2089
|
+
configuration["chrome-headless-shell"] = getBrowserSetting("chrome-headless-shell", configuration);
|
|
2090
|
+
configuration.firefox = getBrowserSetting("firefox", configuration, {
|
|
2091
|
+
skipDownload: true
|
|
2092
|
+
});
|
|
2093
|
+
configuration.cacheDirectory = process.env["PUPPETEER_CACHE_DIR"] ?? configuration.cacheDirectory ?? join2(homedir(), ".cache", "puppeteer");
|
|
2094
|
+
configuration.temporaryDirectory = process.env["PUPPETEER_TMP_DIR"] ?? configuration.temporaryDirectory;
|
|
2095
|
+
configuration.experiments ??= {};
|
|
2096
|
+
return configuration;
|
|
2097
|
+
};
|
|
2098
|
+
|
|
2099
|
+
// ../../node_modules/.pnpm/puppeteer@25.10.0_proxy-agent@8.0.2_yauzl@3.4.0/node_modules/puppeteer/lib/puppeteer/puppeteer.js
|
|
2100
|
+
var puppeteer2 = new PuppeteerNode({
|
|
2101
|
+
isPuppeteerCore: false,
|
|
2102
|
+
configuration: getConfiguration
|
|
2103
|
+
});
|
|
2104
|
+
var {
|
|
2105
|
+
/**
|
|
2106
|
+
* @public
|
|
2107
|
+
*/
|
|
2108
|
+
connect: connect2,
|
|
2109
|
+
/**
|
|
2110
|
+
* @public
|
|
2111
|
+
*/
|
|
2112
|
+
defaultArgs: defaultArgs2,
|
|
2113
|
+
/**
|
|
2114
|
+
* @public
|
|
2115
|
+
*/
|
|
2116
|
+
executablePath: executablePath2,
|
|
2117
|
+
/**
|
|
2118
|
+
* @public
|
|
2119
|
+
*/
|
|
2120
|
+
launch: launch3,
|
|
2121
|
+
/**
|
|
2122
|
+
* @public
|
|
2123
|
+
*/
|
|
2124
|
+
trimCache,
|
|
2125
|
+
/**
|
|
2126
|
+
* @public
|
|
2127
|
+
*/
|
|
2128
|
+
setFollowSymlinks
|
|
2129
|
+
} = puppeteer2;
|
|
2130
|
+
var puppeteer_default = puppeteer2;
|
|
2131
|
+
export {
|
|
2132
|
+
ARIAQueryHandler,
|
|
2133
|
+
Accessibility,
|
|
2134
|
+
AsyncDisposableStack,
|
|
2135
|
+
AsyncDisposableStackPolyfill,
|
|
2136
|
+
AsyncIterableUtil,
|
|
2137
|
+
Binding,
|
|
2138
|
+
Browser,
|
|
2139
|
+
BrowserContext,
|
|
2140
|
+
BrowserLauncher,
|
|
2141
|
+
BrowserWebSocketTransport,
|
|
2142
|
+
CDPSession,
|
|
2143
|
+
CDPSessionEvent,
|
|
2144
|
+
CDP_BINDING_PREFIX,
|
|
2145
|
+
CSSCoverage,
|
|
2146
|
+
Callback,
|
|
2147
|
+
CallbackRegistry,
|
|
2148
|
+
CdpBluetoothEmulation,
|
|
2149
|
+
CdpBrowser,
|
|
2150
|
+
CdpBrowserContext,
|
|
2151
|
+
CdpCDPSession,
|
|
2152
|
+
CdpDeviceRequestPrompt,
|
|
2153
|
+
CdpDeviceRequestPromptManager,
|
|
2154
|
+
CdpDialog,
|
|
2155
|
+
CdpElementHandle,
|
|
2156
|
+
CdpFrame,
|
|
2157
|
+
CdpHTTPRequest,
|
|
2158
|
+
CdpHTTPResponse,
|
|
2159
|
+
CdpJSHandle,
|
|
2160
|
+
CdpKeyboard,
|
|
2161
|
+
CdpMouse,
|
|
2162
|
+
CdpPage,
|
|
2163
|
+
CdpPreloadScript,
|
|
2164
|
+
CdpScreenRecording,
|
|
2165
|
+
CdpTarget,
|
|
2166
|
+
CdpTouchHandle,
|
|
2167
|
+
CdpTouchscreen,
|
|
2168
|
+
CdpWebWorker,
|
|
2169
|
+
ChromeLauncher,
|
|
2170
|
+
Connection,
|
|
2171
|
+
ConnectionClosedError,
|
|
2172
|
+
ConsoleMessage,
|
|
2173
|
+
Coverage,
|
|
2174
|
+
CustomQueryHandlerRegistry,
|
|
2175
|
+
DEBUG_PREFIXES,
|
|
2176
|
+
DEFAULT_INTERCEPT_RESOLUTION_PRIORITY,
|
|
2177
|
+
DEFAULT_VIEWPORT,
|
|
2178
|
+
Deferred,
|
|
2179
|
+
DelegatedLocator,
|
|
2180
|
+
DevToolsTarget,
|
|
2181
|
+
DeviceRequestPrompt,
|
|
2182
|
+
Dialog,
|
|
2183
|
+
DisposableStack,
|
|
2184
|
+
DisposableStackPolyfill,
|
|
2185
|
+
ElementHandle,
|
|
2186
|
+
EmulatedState,
|
|
2187
|
+
EmulationManager,
|
|
2188
|
+
EventEmitter,
|
|
2189
|
+
ExecutionContext,
|
|
2190
|
+
Extension,
|
|
2191
|
+
ExtensionTransport,
|
|
2192
|
+
FileChooser,
|
|
2193
|
+
FilteredLocator,
|
|
2194
|
+
FirefoxLauncher,
|
|
2195
|
+
Frame,
|
|
2196
|
+
FrameEvent,
|
|
2197
|
+
FrameManager,
|
|
2198
|
+
FrameManagerEvent,
|
|
2199
|
+
FrameTree,
|
|
2200
|
+
FunctionLocator,
|
|
2201
|
+
HTTPRequest,
|
|
2202
|
+
HTTPResponse,
|
|
2203
|
+
InitializationStatus,
|
|
2204
|
+
InterceptResolutionAction,
|
|
2205
|
+
IsolatedWorld,
|
|
2206
|
+
JSCoverage,
|
|
2207
|
+
JSHandle,
|
|
2208
|
+
Keyboard,
|
|
2209
|
+
KnownDevices,
|
|
2210
|
+
LazyArg,
|
|
2211
|
+
LifecycleWatcher,
|
|
2212
|
+
Locator,
|
|
2213
|
+
LocatorEvent,
|
|
2214
|
+
MAIN_WORLD,
|
|
2215
|
+
MappedLocator,
|
|
2216
|
+
Mouse,
|
|
2217
|
+
MouseButton,
|
|
2218
|
+
Mutex,
|
|
2219
|
+
NETWORK_IDLE_TIME,
|
|
2220
|
+
NetworkEventManager,
|
|
2221
|
+
NetworkManager,
|
|
2222
|
+
NetworkManagerEvent,
|
|
2223
|
+
NodeLocator,
|
|
2224
|
+
OtherTarget,
|
|
2225
|
+
PQueryHandler,
|
|
2226
|
+
PUPPETEER_REVISIONS,
|
|
2227
|
+
PUPPETEER_WORLD,
|
|
2228
|
+
Page,
|
|
2229
|
+
PageTarget,
|
|
2230
|
+
PierceQueryHandler,
|
|
2231
|
+
PipeTransport,
|
|
2232
|
+
PredefinedNetworkConditions,
|
|
2233
|
+
ProtocolError,
|
|
2234
|
+
Puppeteer,
|
|
2235
|
+
PuppeteerError,
|
|
2236
|
+
PuppeteerNode,
|
|
2237
|
+
PuppeteerURL,
|
|
2238
|
+
QueryHandler,
|
|
2239
|
+
RETRY_DELAY,
|
|
2240
|
+
RaceLocator,
|
|
2241
|
+
Realm,
|
|
2242
|
+
SOURCE_URL_REGEX,
|
|
2243
|
+
STATUS_TEXTS,
|
|
2244
|
+
ScreenRecorder,
|
|
2245
|
+
ScreenRecording,
|
|
2246
|
+
ScriptInjector,
|
|
2247
|
+
SecurityDetails,
|
|
2248
|
+
SuppressedError,
|
|
2249
|
+
Target,
|
|
2250
|
+
TargetCloseError,
|
|
2251
|
+
TargetManager,
|
|
2252
|
+
TargetType,
|
|
2253
|
+
TaskManager,
|
|
2254
|
+
TaskQueue,
|
|
2255
|
+
TextQueryHandler,
|
|
2256
|
+
TimeoutError,
|
|
2257
|
+
TimeoutSettings,
|
|
2258
|
+
TouchError,
|
|
2259
|
+
Touchscreen,
|
|
2260
|
+
Tracing,
|
|
2261
|
+
UTILITY_WORLD_NAME,
|
|
2262
|
+
UnsupportedOperation,
|
|
2263
|
+
WEB_PERMISSION_TO_PROTOCOL_PERMISSION,
|
|
2264
|
+
WaitTask,
|
|
2265
|
+
WebMCP,
|
|
2266
|
+
WebMCPTool,
|
|
2267
|
+
WebMCPToolCall,
|
|
2268
|
+
WebWorker,
|
|
2269
|
+
WebWorkerEvent,
|
|
2270
|
+
WorkerTarget,
|
|
2271
|
+
XPathQueryHandler,
|
|
2272
|
+
_connectToCdpBrowser,
|
|
2273
|
+
_keyDefinitions,
|
|
2274
|
+
addPageBinding,
|
|
2275
|
+
assert,
|
|
2276
|
+
asyncDisposeSymbol,
|
|
2277
|
+
bindIsolatedHandle,
|
|
2278
|
+
connect2 as connect,
|
|
2279
|
+
convertConsoleMessageLevel,
|
|
2280
|
+
convertCookiesPartitionKeyFromPuppeteerToCdp,
|
|
2281
|
+
convertSameSiteFromPuppeteerToCdp,
|
|
2282
|
+
countFrames,
|
|
2283
|
+
createClientError,
|
|
2284
|
+
createConsoleMessage,
|
|
2285
|
+
createEvaluationError,
|
|
2286
|
+
createIncrementalIdGenerator,
|
|
2287
|
+
createProtocolErrorMessage,
|
|
2288
|
+
customQueryHandlers,
|
|
2289
|
+
debug,
|
|
2290
|
+
puppeteer_default as default,
|
|
2291
|
+
defaultArgs2 as defaultArgs,
|
|
2292
|
+
disposeSymbol,
|
|
2293
|
+
evaluationString,
|
|
2294
|
+
executablePath2 as executablePath,
|
|
2295
|
+
filterAsync,
|
|
2296
|
+
fromAbortSignal,
|
|
2297
|
+
fromEmitterEvent,
|
|
2298
|
+
getBrowserTypeDisplayName,
|
|
2299
|
+
getCapturedLogs,
|
|
2300
|
+
getFeatures,
|
|
2301
|
+
getQueryHandlerAndSelector,
|
|
2302
|
+
getReadableAsTypedArray,
|
|
2303
|
+
getReadableFromProtocolStream,
|
|
2304
|
+
getSourcePuppeteerURLIfAvailable,
|
|
2305
|
+
getSourceUrlComment,
|
|
2306
|
+
handleError,
|
|
2307
|
+
headersArray,
|
|
2308
|
+
isDate,
|
|
2309
|
+
isErrnoException,
|
|
2310
|
+
isErrorLike,
|
|
2311
|
+
isNumber,
|
|
2312
|
+
isPlainObject,
|
|
2313
|
+
isRegExp,
|
|
2314
|
+
isString,
|
|
2315
|
+
isTargetClosedError,
|
|
2316
|
+
launch3 as launch,
|
|
2317
|
+
normalizeHeaderValue,
|
|
2318
|
+
pageBindingInitString,
|
|
2319
|
+
paperFormats,
|
|
2320
|
+
parsePDFOptions,
|
|
2321
|
+
parsePSelectors,
|
|
2322
|
+
referrerPolicyToProtocol,
|
|
2323
|
+
releaseObject,
|
|
2324
|
+
removeMatchingFlags,
|
|
2325
|
+
rewriteError,
|
|
2326
|
+
scriptInjector,
|
|
2327
|
+
setDefaultScreenshotOptions,
|
|
2328
|
+
setFollowSymlinks,
|
|
2329
|
+
setLogCapture,
|
|
2330
|
+
supportedMetrics,
|
|
2331
|
+
throwIfDetached,
|
|
2332
|
+
timeout,
|
|
2333
|
+
transposeIterableHandle,
|
|
2334
|
+
trimCache,
|
|
2335
|
+
unitToPixels,
|
|
2336
|
+
validateDialogType,
|
|
2337
|
+
valueFromJSHandle,
|
|
2338
|
+
valueFromPrimitiveRemoteObject,
|
|
2339
|
+
valueFromRemoteObjectReference,
|
|
2340
|
+
withSourcePuppeteerURLIfNone
|
|
2341
|
+
};
|
|
2342
|
+
/*! Bundled license information:
|
|
2343
|
+
|
|
2344
|
+
puppeteer-core/lib/puppeteer/node-env-setup.js:
|
|
2345
|
+
(**
|
|
2346
|
+
* @license
|
|
2347
|
+
* Copyright 2026 Google Inc.
|
|
2348
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2349
|
+
*)
|
|
2350
|
+
|
|
2351
|
+
puppeteer-core/lib/puppeteer/node/BrowserLauncher.js:
|
|
2352
|
+
puppeteer-core/lib/puppeteer/index.js:
|
|
2353
|
+
puppeteer-core/lib/puppeteer/puppeteer-core.js:
|
|
2354
|
+
puppeteer/lib/puppeteer/puppeteer.js:
|
|
2355
|
+
(**
|
|
2356
|
+
* @license
|
|
2357
|
+
* Copyright 2017 Google Inc.
|
|
2358
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2359
|
+
*)
|
|
2360
|
+
|
|
2361
|
+
puppeteer-core/lib/puppeteer/node/util/fs.js:
|
|
2362
|
+
puppeteer-core/lib/puppeteer/node/ChromeLauncher.js:
|
|
2363
|
+
puppeteer-core/lib/puppeteer/node/FirefoxLauncher.js:
|
|
2364
|
+
puppeteer-core/lib/puppeteer/node/ScreenRecorder.js:
|
|
2365
|
+
puppeteer/lib/puppeteer/getConfiguration.js:
|
|
2366
|
+
(**
|
|
2367
|
+
* @license
|
|
2368
|
+
* Copyright 2023 Google Inc.
|
|
2369
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2370
|
+
*)
|
|
2371
|
+
|
|
2372
|
+
puppeteer-core/lib/puppeteer/node/PuppeteerNode.js:
|
|
2373
|
+
(**
|
|
2374
|
+
* @license
|
|
2375
|
+
* Copyright 2020 Google Inc.
|
|
2376
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2377
|
+
*)
|
|
2378
|
+
|
|
2379
|
+
puppeteer-core/lib/puppeteer/node/node.js:
|
|
2380
|
+
(**
|
|
2381
|
+
* @license
|
|
2382
|
+
* Copyright 2022 Google Inc.
|
|
2383
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
2384
|
+
*)
|
|
2385
|
+
*/
|
|
2386
|
+
//# sourceMappingURL=puppeteer-RDWY6FSG.js.map
|