@purepageio/fetch-engines 0.2.7 → 0.2.8
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/dist/index.cjs +1 -1635
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1671
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,1610 +1,4 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
-
};
|
|
16
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
17
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
-
};
|
|
19
|
-
var __export = (target, all) => {
|
|
20
|
-
for (var name in all)
|
|
21
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
-
};
|
|
23
|
-
var __copyProps = (to, from, except, desc) => {
|
|
24
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
-
for (let key of __getOwnPropNames(from))
|
|
26
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
-
}
|
|
29
|
-
return to;
|
|
30
|
-
};
|
|
31
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
32
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
33
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
34
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
35
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
36
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
37
|
-
mod
|
|
38
|
-
));
|
|
39
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
|
-
|
|
41
|
-
// node_modules/.pnpm/tsup@8.4.0_postcss@8.5.3_typescript@5.8.2/node_modules/tsup/assets/esm_shims.js
|
|
42
|
-
var init_esm_shims = __esm({
|
|
43
|
-
"node_modules/.pnpm/tsup@8.4.0_postcss@8.5.3_typescript@5.8.2/node_modules/tsup/assets/esm_shims.js"() {
|
|
44
|
-
"use strict";
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// ../node_modules/ms/index.js
|
|
49
|
-
var require_ms = __commonJS({
|
|
50
|
-
"../node_modules/ms/index.js"(exports, module) {
|
|
51
|
-
"use strict";
|
|
52
|
-
init_esm_shims();
|
|
53
|
-
var s = 1e3;
|
|
54
|
-
var m = s * 60;
|
|
55
|
-
var h = m * 60;
|
|
56
|
-
var d = h * 24;
|
|
57
|
-
var w = d * 7;
|
|
58
|
-
var y = d * 365.25;
|
|
59
|
-
module.exports = function(val, options) {
|
|
60
|
-
options = options || {};
|
|
61
|
-
var type = typeof val;
|
|
62
|
-
if (type === "string" && val.length > 0) {
|
|
63
|
-
return parse2(val);
|
|
64
|
-
} else if (type === "number" && isFinite(val)) {
|
|
65
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
66
|
-
}
|
|
67
|
-
throw new Error(
|
|
68
|
-
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
function parse2(str) {
|
|
72
|
-
str = String(str);
|
|
73
|
-
if (str.length > 100) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
77
|
-
str
|
|
78
|
-
);
|
|
79
|
-
if (!match) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
var n = parseFloat(match[1]);
|
|
83
|
-
var type = (match[2] || "ms").toLowerCase();
|
|
84
|
-
switch (type) {
|
|
85
|
-
case "years":
|
|
86
|
-
case "year":
|
|
87
|
-
case "yrs":
|
|
88
|
-
case "yr":
|
|
89
|
-
case "y":
|
|
90
|
-
return n * y;
|
|
91
|
-
case "weeks":
|
|
92
|
-
case "week":
|
|
93
|
-
case "w":
|
|
94
|
-
return n * w;
|
|
95
|
-
case "days":
|
|
96
|
-
case "day":
|
|
97
|
-
case "d":
|
|
98
|
-
return n * d;
|
|
99
|
-
case "hours":
|
|
100
|
-
case "hour":
|
|
101
|
-
case "hrs":
|
|
102
|
-
case "hr":
|
|
103
|
-
case "h":
|
|
104
|
-
return n * h;
|
|
105
|
-
case "minutes":
|
|
106
|
-
case "minute":
|
|
107
|
-
case "mins":
|
|
108
|
-
case "min":
|
|
109
|
-
case "m":
|
|
110
|
-
return n * m;
|
|
111
|
-
case "seconds":
|
|
112
|
-
case "second":
|
|
113
|
-
case "secs":
|
|
114
|
-
case "sec":
|
|
115
|
-
case "s":
|
|
116
|
-
return n * s;
|
|
117
|
-
case "milliseconds":
|
|
118
|
-
case "millisecond":
|
|
119
|
-
case "msecs":
|
|
120
|
-
case "msec":
|
|
121
|
-
case "ms":
|
|
122
|
-
return n;
|
|
123
|
-
default:
|
|
124
|
-
return void 0;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function fmtShort(ms) {
|
|
128
|
-
var msAbs = Math.abs(ms);
|
|
129
|
-
if (msAbs >= d) {
|
|
130
|
-
return Math.round(ms / d) + "d";
|
|
131
|
-
}
|
|
132
|
-
if (msAbs >= h) {
|
|
133
|
-
return Math.round(ms / h) + "h";
|
|
134
|
-
}
|
|
135
|
-
if (msAbs >= m) {
|
|
136
|
-
return Math.round(ms / m) + "m";
|
|
137
|
-
}
|
|
138
|
-
if (msAbs >= s) {
|
|
139
|
-
return Math.round(ms / s) + "s";
|
|
140
|
-
}
|
|
141
|
-
return ms + "ms";
|
|
142
|
-
}
|
|
143
|
-
function fmtLong(ms) {
|
|
144
|
-
var msAbs = Math.abs(ms);
|
|
145
|
-
if (msAbs >= d) {
|
|
146
|
-
return plural(ms, msAbs, d, "day");
|
|
147
|
-
}
|
|
148
|
-
if (msAbs >= h) {
|
|
149
|
-
return plural(ms, msAbs, h, "hour");
|
|
150
|
-
}
|
|
151
|
-
if (msAbs >= m) {
|
|
152
|
-
return plural(ms, msAbs, m, "minute");
|
|
153
|
-
}
|
|
154
|
-
if (msAbs >= s) {
|
|
155
|
-
return plural(ms, msAbs, s, "second");
|
|
156
|
-
}
|
|
157
|
-
return ms + " ms";
|
|
158
|
-
}
|
|
159
|
-
function plural(ms, msAbs, n, name) {
|
|
160
|
-
var isPlural = msAbs >= n * 1.5;
|
|
161
|
-
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
// ../node_modules/debug/src/common.js
|
|
167
|
-
var require_common = __commonJS({
|
|
168
|
-
"../node_modules/debug/src/common.js"(exports, module) {
|
|
169
|
-
"use strict";
|
|
170
|
-
init_esm_shims();
|
|
171
|
-
function setup(env) {
|
|
172
|
-
createDebug.debug = createDebug;
|
|
173
|
-
createDebug.default = createDebug;
|
|
174
|
-
createDebug.coerce = coerce;
|
|
175
|
-
createDebug.disable = disable;
|
|
176
|
-
createDebug.enable = enable;
|
|
177
|
-
createDebug.enabled = enabled;
|
|
178
|
-
createDebug.humanize = require_ms();
|
|
179
|
-
createDebug.destroy = destroy;
|
|
180
|
-
Object.keys(env).forEach((key) => {
|
|
181
|
-
createDebug[key] = env[key];
|
|
182
|
-
});
|
|
183
|
-
createDebug.names = [];
|
|
184
|
-
createDebug.skips = [];
|
|
185
|
-
createDebug.formatters = {};
|
|
186
|
-
function selectColor(namespace) {
|
|
187
|
-
let hash = 0;
|
|
188
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
189
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
190
|
-
hash |= 0;
|
|
191
|
-
}
|
|
192
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
193
|
-
}
|
|
194
|
-
createDebug.selectColor = selectColor;
|
|
195
|
-
function createDebug(namespace) {
|
|
196
|
-
let prevTime;
|
|
197
|
-
let enableOverride = null;
|
|
198
|
-
let namespacesCache;
|
|
199
|
-
let enabledCache;
|
|
200
|
-
function debug2(...args) {
|
|
201
|
-
if (!debug2.enabled) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const self = debug2;
|
|
205
|
-
const curr = Number(/* @__PURE__ */ new Date());
|
|
206
|
-
const ms = curr - (prevTime || curr);
|
|
207
|
-
self.diff = ms;
|
|
208
|
-
self.prev = prevTime;
|
|
209
|
-
self.curr = curr;
|
|
210
|
-
prevTime = curr;
|
|
211
|
-
args[0] = createDebug.coerce(args[0]);
|
|
212
|
-
if (typeof args[0] !== "string") {
|
|
213
|
-
args.unshift("%O");
|
|
214
|
-
}
|
|
215
|
-
let index = 0;
|
|
216
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
217
|
-
if (match === "%%") {
|
|
218
|
-
return "%";
|
|
219
|
-
}
|
|
220
|
-
index++;
|
|
221
|
-
const formatter = createDebug.formatters[format];
|
|
222
|
-
if (typeof formatter === "function") {
|
|
223
|
-
const val = args[index];
|
|
224
|
-
match = formatter.call(self, val);
|
|
225
|
-
args.splice(index, 1);
|
|
226
|
-
index--;
|
|
227
|
-
}
|
|
228
|
-
return match;
|
|
229
|
-
});
|
|
230
|
-
createDebug.formatArgs.call(self, args);
|
|
231
|
-
const logFn = self.log || createDebug.log;
|
|
232
|
-
logFn.apply(self, args);
|
|
233
|
-
}
|
|
234
|
-
debug2.namespace = namespace;
|
|
235
|
-
debug2.useColors = createDebug.useColors();
|
|
236
|
-
debug2.color = createDebug.selectColor(namespace);
|
|
237
|
-
debug2.extend = extend;
|
|
238
|
-
debug2.destroy = createDebug.destroy;
|
|
239
|
-
Object.defineProperty(debug2, "enabled", {
|
|
240
|
-
enumerable: true,
|
|
241
|
-
configurable: false,
|
|
242
|
-
get: () => {
|
|
243
|
-
if (enableOverride !== null) {
|
|
244
|
-
return enableOverride;
|
|
245
|
-
}
|
|
246
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
247
|
-
namespacesCache = createDebug.namespaces;
|
|
248
|
-
enabledCache = createDebug.enabled(namespace);
|
|
249
|
-
}
|
|
250
|
-
return enabledCache;
|
|
251
|
-
},
|
|
252
|
-
set: (v) => {
|
|
253
|
-
enableOverride = v;
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
if (typeof createDebug.init === "function") {
|
|
257
|
-
createDebug.init(debug2);
|
|
258
|
-
}
|
|
259
|
-
return debug2;
|
|
260
|
-
}
|
|
261
|
-
function extend(namespace, delimiter) {
|
|
262
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
263
|
-
newDebug.log = this.log;
|
|
264
|
-
return newDebug;
|
|
265
|
-
}
|
|
266
|
-
function enable(namespaces) {
|
|
267
|
-
createDebug.save(namespaces);
|
|
268
|
-
createDebug.namespaces = namespaces;
|
|
269
|
-
createDebug.names = [];
|
|
270
|
-
createDebug.skips = [];
|
|
271
|
-
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
|
|
272
|
-
for (const ns of split) {
|
|
273
|
-
if (ns[0] === "-") {
|
|
274
|
-
createDebug.skips.push(ns.slice(1));
|
|
275
|
-
} else {
|
|
276
|
-
createDebug.names.push(ns);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
function matchesTemplate(search, template) {
|
|
281
|
-
let searchIndex = 0;
|
|
282
|
-
let templateIndex = 0;
|
|
283
|
-
let starIndex = -1;
|
|
284
|
-
let matchIndex = 0;
|
|
285
|
-
while (searchIndex < search.length) {
|
|
286
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
287
|
-
if (template[templateIndex] === "*") {
|
|
288
|
-
starIndex = templateIndex;
|
|
289
|
-
matchIndex = searchIndex;
|
|
290
|
-
templateIndex++;
|
|
291
|
-
} else {
|
|
292
|
-
searchIndex++;
|
|
293
|
-
templateIndex++;
|
|
294
|
-
}
|
|
295
|
-
} else if (starIndex !== -1) {
|
|
296
|
-
templateIndex = starIndex + 1;
|
|
297
|
-
matchIndex++;
|
|
298
|
-
searchIndex = matchIndex;
|
|
299
|
-
} else {
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
304
|
-
templateIndex++;
|
|
305
|
-
}
|
|
306
|
-
return templateIndex === template.length;
|
|
307
|
-
}
|
|
308
|
-
function disable() {
|
|
309
|
-
const namespaces = [
|
|
310
|
-
...createDebug.names,
|
|
311
|
-
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
312
|
-
].join(",");
|
|
313
|
-
createDebug.enable("");
|
|
314
|
-
return namespaces;
|
|
315
|
-
}
|
|
316
|
-
function enabled(name) {
|
|
317
|
-
for (const skip of createDebug.skips) {
|
|
318
|
-
if (matchesTemplate(name, skip)) {
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
for (const ns of createDebug.names) {
|
|
323
|
-
if (matchesTemplate(name, ns)) {
|
|
324
|
-
return true;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return false;
|
|
328
|
-
}
|
|
329
|
-
function coerce(val) {
|
|
330
|
-
if (val instanceof Error) {
|
|
331
|
-
return val.stack || val.message;
|
|
332
|
-
}
|
|
333
|
-
return val;
|
|
334
|
-
}
|
|
335
|
-
function destroy() {
|
|
336
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
337
|
-
}
|
|
338
|
-
createDebug.enable(createDebug.load());
|
|
339
|
-
return createDebug;
|
|
340
|
-
}
|
|
341
|
-
module.exports = setup;
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
// ../node_modules/debug/src/browser.js
|
|
346
|
-
var require_browser = __commonJS({
|
|
347
|
-
"../node_modules/debug/src/browser.js"(exports, module) {
|
|
348
|
-
"use strict";
|
|
349
|
-
init_esm_shims();
|
|
350
|
-
exports.formatArgs = formatArgs;
|
|
351
|
-
exports.save = save;
|
|
352
|
-
exports.load = load;
|
|
353
|
-
exports.useColors = useColors;
|
|
354
|
-
exports.storage = localstorage();
|
|
355
|
-
exports.destroy = /* @__PURE__ */ (() => {
|
|
356
|
-
let warned = false;
|
|
357
|
-
return () => {
|
|
358
|
-
if (!warned) {
|
|
359
|
-
warned = true;
|
|
360
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
})();
|
|
364
|
-
exports.colors = [
|
|
365
|
-
"#0000CC",
|
|
366
|
-
"#0000FF",
|
|
367
|
-
"#0033CC",
|
|
368
|
-
"#0033FF",
|
|
369
|
-
"#0066CC",
|
|
370
|
-
"#0066FF",
|
|
371
|
-
"#0099CC",
|
|
372
|
-
"#0099FF",
|
|
373
|
-
"#00CC00",
|
|
374
|
-
"#00CC33",
|
|
375
|
-
"#00CC66",
|
|
376
|
-
"#00CC99",
|
|
377
|
-
"#00CCCC",
|
|
378
|
-
"#00CCFF",
|
|
379
|
-
"#3300CC",
|
|
380
|
-
"#3300FF",
|
|
381
|
-
"#3333CC",
|
|
382
|
-
"#3333FF",
|
|
383
|
-
"#3366CC",
|
|
384
|
-
"#3366FF",
|
|
385
|
-
"#3399CC",
|
|
386
|
-
"#3399FF",
|
|
387
|
-
"#33CC00",
|
|
388
|
-
"#33CC33",
|
|
389
|
-
"#33CC66",
|
|
390
|
-
"#33CC99",
|
|
391
|
-
"#33CCCC",
|
|
392
|
-
"#33CCFF",
|
|
393
|
-
"#6600CC",
|
|
394
|
-
"#6600FF",
|
|
395
|
-
"#6633CC",
|
|
396
|
-
"#6633FF",
|
|
397
|
-
"#66CC00",
|
|
398
|
-
"#66CC33",
|
|
399
|
-
"#9900CC",
|
|
400
|
-
"#9900FF",
|
|
401
|
-
"#9933CC",
|
|
402
|
-
"#9933FF",
|
|
403
|
-
"#99CC00",
|
|
404
|
-
"#99CC33",
|
|
405
|
-
"#CC0000",
|
|
406
|
-
"#CC0033",
|
|
407
|
-
"#CC0066",
|
|
408
|
-
"#CC0099",
|
|
409
|
-
"#CC00CC",
|
|
410
|
-
"#CC00FF",
|
|
411
|
-
"#CC3300",
|
|
412
|
-
"#CC3333",
|
|
413
|
-
"#CC3366",
|
|
414
|
-
"#CC3399",
|
|
415
|
-
"#CC33CC",
|
|
416
|
-
"#CC33FF",
|
|
417
|
-
"#CC6600",
|
|
418
|
-
"#CC6633",
|
|
419
|
-
"#CC9900",
|
|
420
|
-
"#CC9933",
|
|
421
|
-
"#CCCC00",
|
|
422
|
-
"#CCCC33",
|
|
423
|
-
"#FF0000",
|
|
424
|
-
"#FF0033",
|
|
425
|
-
"#FF0066",
|
|
426
|
-
"#FF0099",
|
|
427
|
-
"#FF00CC",
|
|
428
|
-
"#FF00FF",
|
|
429
|
-
"#FF3300",
|
|
430
|
-
"#FF3333",
|
|
431
|
-
"#FF3366",
|
|
432
|
-
"#FF3399",
|
|
433
|
-
"#FF33CC",
|
|
434
|
-
"#FF33FF",
|
|
435
|
-
"#FF6600",
|
|
436
|
-
"#FF6633",
|
|
437
|
-
"#FF9900",
|
|
438
|
-
"#FF9933",
|
|
439
|
-
"#FFCC00",
|
|
440
|
-
"#FFCC33"
|
|
441
|
-
];
|
|
442
|
-
function useColors() {
|
|
443
|
-
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
|
|
444
|
-
return true;
|
|
445
|
-
}
|
|
446
|
-
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
447
|
-
return false;
|
|
448
|
-
}
|
|
449
|
-
let m;
|
|
450
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
451
|
-
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
452
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
453
|
-
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
454
|
-
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
455
|
-
}
|
|
456
|
-
function formatArgs(args) {
|
|
457
|
-
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
458
|
-
if (!this.useColors) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
const c = "color: " + this.color;
|
|
462
|
-
args.splice(1, 0, c, "color: inherit");
|
|
463
|
-
let index = 0;
|
|
464
|
-
let lastC = 0;
|
|
465
|
-
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
466
|
-
if (match === "%%") {
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
index++;
|
|
470
|
-
if (match === "%c") {
|
|
471
|
-
lastC = index;
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
args.splice(lastC, 0, c);
|
|
475
|
-
}
|
|
476
|
-
exports.log = console.debug || console.log || (() => {
|
|
477
|
-
});
|
|
478
|
-
function save(namespaces) {
|
|
479
|
-
try {
|
|
480
|
-
if (namespaces) {
|
|
481
|
-
exports.storage.setItem("debug", namespaces);
|
|
482
|
-
} else {
|
|
483
|
-
exports.storage.removeItem("debug");
|
|
484
|
-
}
|
|
485
|
-
} catch (error) {
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
function load() {
|
|
489
|
-
let r;
|
|
490
|
-
try {
|
|
491
|
-
r = exports.storage.getItem("debug");
|
|
492
|
-
} catch (error) {
|
|
493
|
-
}
|
|
494
|
-
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
495
|
-
r = process.env.DEBUG;
|
|
496
|
-
}
|
|
497
|
-
return r;
|
|
498
|
-
}
|
|
499
|
-
function localstorage() {
|
|
500
|
-
try {
|
|
501
|
-
return localStorage;
|
|
502
|
-
} catch (error) {
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
module.exports = require_common()(exports);
|
|
506
|
-
var { formatters } = module.exports;
|
|
507
|
-
formatters.j = function(v) {
|
|
508
|
-
try {
|
|
509
|
-
return JSON.stringify(v);
|
|
510
|
-
} catch (error) {
|
|
511
|
-
return "[UnexpectedJSONParseError]: " + error.message;
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
// ../node_modules/debug/src/node.js
|
|
518
|
-
var require_node = __commonJS({
|
|
519
|
-
"../node_modules/debug/src/node.js"(exports, module) {
|
|
520
|
-
"use strict";
|
|
521
|
-
init_esm_shims();
|
|
522
|
-
var tty = __require("tty");
|
|
523
|
-
var util = __require("util");
|
|
524
|
-
exports.init = init;
|
|
525
|
-
exports.log = log;
|
|
526
|
-
exports.formatArgs = formatArgs;
|
|
527
|
-
exports.save = save;
|
|
528
|
-
exports.load = load;
|
|
529
|
-
exports.useColors = useColors;
|
|
530
|
-
exports.destroy = util.deprecate(
|
|
531
|
-
() => {
|
|
532
|
-
},
|
|
533
|
-
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
534
|
-
);
|
|
535
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
536
|
-
try {
|
|
537
|
-
const supportsColor = __require("supports-color");
|
|
538
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
539
|
-
exports.colors = [
|
|
540
|
-
20,
|
|
541
|
-
21,
|
|
542
|
-
26,
|
|
543
|
-
27,
|
|
544
|
-
32,
|
|
545
|
-
33,
|
|
546
|
-
38,
|
|
547
|
-
39,
|
|
548
|
-
40,
|
|
549
|
-
41,
|
|
550
|
-
42,
|
|
551
|
-
43,
|
|
552
|
-
44,
|
|
553
|
-
45,
|
|
554
|
-
56,
|
|
555
|
-
57,
|
|
556
|
-
62,
|
|
557
|
-
63,
|
|
558
|
-
68,
|
|
559
|
-
69,
|
|
560
|
-
74,
|
|
561
|
-
75,
|
|
562
|
-
76,
|
|
563
|
-
77,
|
|
564
|
-
78,
|
|
565
|
-
79,
|
|
566
|
-
80,
|
|
567
|
-
81,
|
|
568
|
-
92,
|
|
569
|
-
93,
|
|
570
|
-
98,
|
|
571
|
-
99,
|
|
572
|
-
112,
|
|
573
|
-
113,
|
|
574
|
-
128,
|
|
575
|
-
129,
|
|
576
|
-
134,
|
|
577
|
-
135,
|
|
578
|
-
148,
|
|
579
|
-
149,
|
|
580
|
-
160,
|
|
581
|
-
161,
|
|
582
|
-
162,
|
|
583
|
-
163,
|
|
584
|
-
164,
|
|
585
|
-
165,
|
|
586
|
-
166,
|
|
587
|
-
167,
|
|
588
|
-
168,
|
|
589
|
-
169,
|
|
590
|
-
170,
|
|
591
|
-
171,
|
|
592
|
-
172,
|
|
593
|
-
173,
|
|
594
|
-
178,
|
|
595
|
-
179,
|
|
596
|
-
184,
|
|
597
|
-
185,
|
|
598
|
-
196,
|
|
599
|
-
197,
|
|
600
|
-
198,
|
|
601
|
-
199,
|
|
602
|
-
200,
|
|
603
|
-
201,
|
|
604
|
-
202,
|
|
605
|
-
203,
|
|
606
|
-
204,
|
|
607
|
-
205,
|
|
608
|
-
206,
|
|
609
|
-
207,
|
|
610
|
-
208,
|
|
611
|
-
209,
|
|
612
|
-
214,
|
|
613
|
-
215,
|
|
614
|
-
220,
|
|
615
|
-
221
|
|
616
|
-
];
|
|
617
|
-
}
|
|
618
|
-
} catch (error) {
|
|
619
|
-
}
|
|
620
|
-
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
621
|
-
return /^debug_/i.test(key);
|
|
622
|
-
}).reduce((obj, key) => {
|
|
623
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
624
|
-
return k.toUpperCase();
|
|
625
|
-
});
|
|
626
|
-
let val = process.env[key];
|
|
627
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
628
|
-
val = true;
|
|
629
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
630
|
-
val = false;
|
|
631
|
-
} else if (val === "null") {
|
|
632
|
-
val = null;
|
|
633
|
-
} else {
|
|
634
|
-
val = Number(val);
|
|
635
|
-
}
|
|
636
|
-
obj[prop] = val;
|
|
637
|
-
return obj;
|
|
638
|
-
}, {});
|
|
639
|
-
function useColors() {
|
|
640
|
-
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
641
|
-
}
|
|
642
|
-
function formatArgs(args) {
|
|
643
|
-
const { namespace: name, useColors: useColors2 } = this;
|
|
644
|
-
if (useColors2) {
|
|
645
|
-
const c = this.color;
|
|
646
|
-
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
647
|
-
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
648
|
-
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
649
|
-
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
650
|
-
} else {
|
|
651
|
-
args[0] = getDate() + name + " " + args[0];
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
function getDate() {
|
|
655
|
-
if (exports.inspectOpts.hideDate) {
|
|
656
|
-
return "";
|
|
657
|
-
}
|
|
658
|
-
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
659
|
-
}
|
|
660
|
-
function log(...args) {
|
|
661
|
-
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
662
|
-
}
|
|
663
|
-
function save(namespaces) {
|
|
664
|
-
if (namespaces) {
|
|
665
|
-
process.env.DEBUG = namespaces;
|
|
666
|
-
} else {
|
|
667
|
-
delete process.env.DEBUG;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
function load() {
|
|
671
|
-
return process.env.DEBUG;
|
|
672
|
-
}
|
|
673
|
-
function init(debug2) {
|
|
674
|
-
debug2.inspectOpts = {};
|
|
675
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
676
|
-
for (let i = 0; i < keys.length; i++) {
|
|
677
|
-
debug2.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
module.exports = require_common()(exports);
|
|
681
|
-
var { formatters } = module.exports;
|
|
682
|
-
formatters.o = function(v) {
|
|
683
|
-
this.inspectOpts.colors = this.useColors;
|
|
684
|
-
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
685
|
-
};
|
|
686
|
-
formatters.O = function(v) {
|
|
687
|
-
this.inspectOpts.colors = this.useColors;
|
|
688
|
-
return util.inspect(v, this.inspectOpts);
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
|
|
693
|
-
// ../node_modules/debug/src/index.js
|
|
694
|
-
var require_src = __commonJS({
|
|
695
|
-
"../node_modules/debug/src/index.js"(exports, module) {
|
|
696
|
-
"use strict";
|
|
697
|
-
init_esm_shims();
|
|
698
|
-
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
699
|
-
module.exports = require_browser();
|
|
700
|
-
} else {
|
|
701
|
-
module.exports = require_node();
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
});
|
|
705
|
-
|
|
706
|
-
// ../node_modules/arr-union/index.js
|
|
707
|
-
var require_arr_union = __commonJS({
|
|
708
|
-
"../node_modules/arr-union/index.js"(exports, module) {
|
|
709
|
-
"use strict";
|
|
710
|
-
init_esm_shims();
|
|
711
|
-
module.exports = function union(init) {
|
|
712
|
-
if (!Array.isArray(init)) {
|
|
713
|
-
throw new TypeError("arr-union expects the first argument to be an array.");
|
|
714
|
-
}
|
|
715
|
-
var len = arguments.length;
|
|
716
|
-
var i = 0;
|
|
717
|
-
while (++i < len) {
|
|
718
|
-
var arg = arguments[i];
|
|
719
|
-
if (!arg) continue;
|
|
720
|
-
if (!Array.isArray(arg)) {
|
|
721
|
-
arg = [arg];
|
|
722
|
-
}
|
|
723
|
-
for (var j = 0; j < arg.length; j++) {
|
|
724
|
-
var ele = arg[j];
|
|
725
|
-
if (init.indexOf(ele) >= 0) {
|
|
726
|
-
continue;
|
|
727
|
-
}
|
|
728
|
-
init.push(ele);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
return init;
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
// ../node_modules/lazy-cache/index.js
|
|
737
|
-
var require_lazy_cache = __commonJS({
|
|
738
|
-
"../node_modules/lazy-cache/index.js"(exports, module) {
|
|
739
|
-
"use strict";
|
|
740
|
-
init_esm_shims();
|
|
741
|
-
function lazyCache(fn) {
|
|
742
|
-
var cache = {};
|
|
743
|
-
var proxy = function(mod, name) {
|
|
744
|
-
name = name || camelcase(mod);
|
|
745
|
-
if (process.env.UNLAZY === "true" || process.env.UNLAZY === true || process.env.TRAVIS) {
|
|
746
|
-
cache[name] = fn(mod);
|
|
747
|
-
}
|
|
748
|
-
Object.defineProperty(proxy, name, {
|
|
749
|
-
enumerable: true,
|
|
750
|
-
configurable: true,
|
|
751
|
-
get: getter
|
|
752
|
-
});
|
|
753
|
-
function getter() {
|
|
754
|
-
if (cache.hasOwnProperty(name)) {
|
|
755
|
-
return cache[name];
|
|
756
|
-
}
|
|
757
|
-
return cache[name] = fn(mod);
|
|
758
|
-
}
|
|
759
|
-
return getter;
|
|
760
|
-
};
|
|
761
|
-
return proxy;
|
|
762
|
-
}
|
|
763
|
-
function camelcase(str) {
|
|
764
|
-
if (str.length === 1) {
|
|
765
|
-
return str.toLowerCase();
|
|
766
|
-
}
|
|
767
|
-
str = str.replace(/^[\W_]+|[\W_]+$/g, "").toLowerCase();
|
|
768
|
-
return str.replace(/[\W_]+(\w|$)/g, function(_, ch) {
|
|
769
|
-
return ch.toUpperCase();
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
module.exports = lazyCache;
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
|
|
776
|
-
// ../node_modules/for-in/index.js
|
|
777
|
-
var require_for_in = __commonJS({
|
|
778
|
-
"../node_modules/for-in/index.js"(exports, module) {
|
|
779
|
-
"use strict";
|
|
780
|
-
init_esm_shims();
|
|
781
|
-
module.exports = function forIn(obj, fn, thisArg) {
|
|
782
|
-
for (var key in obj) {
|
|
783
|
-
if (fn.call(thisArg, obj[key], key, obj) === false) {
|
|
784
|
-
break;
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
});
|
|
790
|
-
|
|
791
|
-
// ../node_modules/for-own/index.js
|
|
792
|
-
var require_for_own = __commonJS({
|
|
793
|
-
"../node_modules/for-own/index.js"(exports, module) {
|
|
794
|
-
"use strict";
|
|
795
|
-
init_esm_shims();
|
|
796
|
-
var forIn = require_for_in();
|
|
797
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
798
|
-
module.exports = function forOwn(obj, fn, thisArg) {
|
|
799
|
-
forIn(obj, function(val, key) {
|
|
800
|
-
if (hasOwn.call(obj, key)) {
|
|
801
|
-
return fn.call(thisArg, obj[key], key, obj);
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
|
|
808
|
-
// ../node_modules/clone-deep/utils.js
|
|
809
|
-
var require_utils = __commonJS({
|
|
810
|
-
"../node_modules/clone-deep/utils.js"(exports, module) {
|
|
811
|
-
"use strict";
|
|
812
|
-
init_esm_shims();
|
|
813
|
-
var utils = require_lazy_cache()(__require);
|
|
814
|
-
var fn = __require;
|
|
815
|
-
__require = utils;
|
|
816
|
-
__require("is-plain-object", "isObject");
|
|
817
|
-
__require("shallow-clone", "clone");
|
|
818
|
-
__require("kind-of", "typeOf");
|
|
819
|
-
require_for_own();
|
|
820
|
-
__require = fn;
|
|
821
|
-
module.exports = utils;
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
|
|
825
|
-
// ../node_modules/clone-deep/index.js
|
|
826
|
-
var require_clone_deep = __commonJS({
|
|
827
|
-
"../node_modules/clone-deep/index.js"(exports, module) {
|
|
828
|
-
"use strict";
|
|
829
|
-
init_esm_shims();
|
|
830
|
-
var utils = require_utils();
|
|
831
|
-
function cloneDeep(val, instanceClone) {
|
|
832
|
-
switch (utils.typeOf(val)) {
|
|
833
|
-
case "object":
|
|
834
|
-
return cloneObjectDeep(val, instanceClone);
|
|
835
|
-
case "array":
|
|
836
|
-
return cloneArrayDeep(val, instanceClone);
|
|
837
|
-
default:
|
|
838
|
-
return utils.clone(val);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
function cloneObjectDeep(obj, instanceClone) {
|
|
842
|
-
if (utils.isObject(obj)) {
|
|
843
|
-
var res = {};
|
|
844
|
-
utils.forOwn(obj, function(obj2, key) {
|
|
845
|
-
this[key] = cloneDeep(obj2, instanceClone);
|
|
846
|
-
}, res);
|
|
847
|
-
return res;
|
|
848
|
-
} else if (instanceClone) {
|
|
849
|
-
return instanceClone(obj);
|
|
850
|
-
} else {
|
|
851
|
-
return obj;
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
function cloneArrayDeep(arr, instanceClone) {
|
|
855
|
-
var len = arr.length, res = [];
|
|
856
|
-
var i = -1;
|
|
857
|
-
while (++i < len) {
|
|
858
|
-
res[i] = cloneDeep(arr[i], instanceClone);
|
|
859
|
-
}
|
|
860
|
-
return res;
|
|
861
|
-
}
|
|
862
|
-
module.exports = cloneDeep;
|
|
863
|
-
}
|
|
864
|
-
});
|
|
865
|
-
|
|
866
|
-
// ../node_modules/is-buffer/index.js
|
|
867
|
-
var require_is_buffer = __commonJS({
|
|
868
|
-
"../node_modules/is-buffer/index.js"(exports, module) {
|
|
869
|
-
"use strict";
|
|
870
|
-
init_esm_shims();
|
|
871
|
-
module.exports = function(obj) {
|
|
872
|
-
return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
|
|
873
|
-
};
|
|
874
|
-
function isBuffer(obj) {
|
|
875
|
-
return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
876
|
-
}
|
|
877
|
-
function isSlowBuffer(obj) {
|
|
878
|
-
return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isBuffer(obj.slice(0, 0));
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
});
|
|
882
|
-
|
|
883
|
-
// ../node_modules/kind-of/index.js
|
|
884
|
-
var require_kind_of = __commonJS({
|
|
885
|
-
"../node_modules/kind-of/index.js"(exports, module) {
|
|
886
|
-
"use strict";
|
|
887
|
-
init_esm_shims();
|
|
888
|
-
var isBuffer = require_is_buffer();
|
|
889
|
-
var toString = Object.prototype.toString;
|
|
890
|
-
module.exports = function kindOf(val) {
|
|
891
|
-
if (typeof val === "undefined") {
|
|
892
|
-
return "undefined";
|
|
893
|
-
}
|
|
894
|
-
if (val === null) {
|
|
895
|
-
return "null";
|
|
896
|
-
}
|
|
897
|
-
if (val === true || val === false || val instanceof Boolean) {
|
|
898
|
-
return "boolean";
|
|
899
|
-
}
|
|
900
|
-
if (typeof val === "string" || val instanceof String) {
|
|
901
|
-
return "string";
|
|
902
|
-
}
|
|
903
|
-
if (typeof val === "number" || val instanceof Number) {
|
|
904
|
-
return "number";
|
|
905
|
-
}
|
|
906
|
-
if (typeof val === "function" || val instanceof Function) {
|
|
907
|
-
return "function";
|
|
908
|
-
}
|
|
909
|
-
if (typeof Array.isArray !== "undefined" && Array.isArray(val)) {
|
|
910
|
-
return "array";
|
|
911
|
-
}
|
|
912
|
-
if (val instanceof RegExp) {
|
|
913
|
-
return "regexp";
|
|
914
|
-
}
|
|
915
|
-
if (val instanceof Date) {
|
|
916
|
-
return "date";
|
|
917
|
-
}
|
|
918
|
-
var type = toString.call(val);
|
|
919
|
-
if (type === "[object RegExp]") {
|
|
920
|
-
return "regexp";
|
|
921
|
-
}
|
|
922
|
-
if (type === "[object Date]") {
|
|
923
|
-
return "date";
|
|
924
|
-
}
|
|
925
|
-
if (type === "[object Arguments]") {
|
|
926
|
-
return "arguments";
|
|
927
|
-
}
|
|
928
|
-
if (type === "[object Error]") {
|
|
929
|
-
return "error";
|
|
930
|
-
}
|
|
931
|
-
if (isBuffer(val)) {
|
|
932
|
-
return "buffer";
|
|
933
|
-
}
|
|
934
|
-
if (type === "[object Set]") {
|
|
935
|
-
return "set";
|
|
936
|
-
}
|
|
937
|
-
if (type === "[object WeakSet]") {
|
|
938
|
-
return "weakset";
|
|
939
|
-
}
|
|
940
|
-
if (type === "[object Map]") {
|
|
941
|
-
return "map";
|
|
942
|
-
}
|
|
943
|
-
if (type === "[object WeakMap]") {
|
|
944
|
-
return "weakmap";
|
|
945
|
-
}
|
|
946
|
-
if (type === "[object Symbol]") {
|
|
947
|
-
return "symbol";
|
|
948
|
-
}
|
|
949
|
-
if (type === "[object Int8Array]") {
|
|
950
|
-
return "int8array";
|
|
951
|
-
}
|
|
952
|
-
if (type === "[object Uint8Array]") {
|
|
953
|
-
return "uint8array";
|
|
954
|
-
}
|
|
955
|
-
if (type === "[object Uint8ClampedArray]") {
|
|
956
|
-
return "uint8clampedarray";
|
|
957
|
-
}
|
|
958
|
-
if (type === "[object Int16Array]") {
|
|
959
|
-
return "int16array";
|
|
960
|
-
}
|
|
961
|
-
if (type === "[object Uint16Array]") {
|
|
962
|
-
return "uint16array";
|
|
963
|
-
}
|
|
964
|
-
if (type === "[object Int32Array]") {
|
|
965
|
-
return "int32array";
|
|
966
|
-
}
|
|
967
|
-
if (type === "[object Uint32Array]") {
|
|
968
|
-
return "uint32array";
|
|
969
|
-
}
|
|
970
|
-
if (type === "[object Float32Array]") {
|
|
971
|
-
return "float32array";
|
|
972
|
-
}
|
|
973
|
-
if (type === "[object Float64Array]") {
|
|
974
|
-
return "float64array";
|
|
975
|
-
}
|
|
976
|
-
return "object";
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
});
|
|
980
|
-
|
|
981
|
-
// ../node_modules/merge-deep/index.js
|
|
982
|
-
var require_merge_deep = __commonJS({
|
|
983
|
-
"../node_modules/merge-deep/index.js"(exports, module) {
|
|
984
|
-
"use strict";
|
|
985
|
-
init_esm_shims();
|
|
986
|
-
var union = require_arr_union();
|
|
987
|
-
var clone = require_clone_deep();
|
|
988
|
-
var typeOf = require_kind_of();
|
|
989
|
-
module.exports = function mergeDeep(orig, objects) {
|
|
990
|
-
if (!isObject(orig) && !Array.isArray(orig)) {
|
|
991
|
-
orig = {};
|
|
992
|
-
}
|
|
993
|
-
var target = clone(orig);
|
|
994
|
-
var len = arguments.length;
|
|
995
|
-
var idx = 0;
|
|
996
|
-
while (++idx < len) {
|
|
997
|
-
var val = arguments[idx];
|
|
998
|
-
if (isObject(val) || Array.isArray(val)) {
|
|
999
|
-
merge2(target, val);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
return target;
|
|
1003
|
-
};
|
|
1004
|
-
function merge2(target, obj) {
|
|
1005
|
-
for (var key in obj) {
|
|
1006
|
-
if (!isValidKey(key) || !hasOwn(obj, key)) {
|
|
1007
|
-
continue;
|
|
1008
|
-
}
|
|
1009
|
-
var oldVal = obj[key];
|
|
1010
|
-
var newVal = target[key];
|
|
1011
|
-
if (isObject(newVal) && isObject(oldVal)) {
|
|
1012
|
-
target[key] = merge2(newVal, oldVal);
|
|
1013
|
-
} else if (Array.isArray(newVal)) {
|
|
1014
|
-
target[key] = union([], newVal, oldVal);
|
|
1015
|
-
} else {
|
|
1016
|
-
target[key] = clone(oldVal);
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
return target;
|
|
1020
|
-
}
|
|
1021
|
-
function hasOwn(obj, key) {
|
|
1022
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
1023
|
-
}
|
|
1024
|
-
function isObject(val) {
|
|
1025
|
-
return typeOf(val) === "object" || typeOf(val) === "function";
|
|
1026
|
-
}
|
|
1027
|
-
function isValidKey(key) {
|
|
1028
|
-
return key !== "__proto__" && key !== "constructor" && key !== "prototype";
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
|
|
1033
|
-
// ../node_modules/puppeteer-extra-plugin/dist/index.esm.js
|
|
1034
|
-
var index_esm_exports = {};
|
|
1035
|
-
__export(index_esm_exports, {
|
|
1036
|
-
PuppeteerExtraPlugin: () => PuppeteerExtraPlugin
|
|
1037
|
-
});
|
|
1038
|
-
var import_debug, merge, PuppeteerExtraPlugin;
|
|
1039
|
-
var init_index_esm = __esm({
|
|
1040
|
-
"../node_modules/puppeteer-extra-plugin/dist/index.esm.js"() {
|
|
1041
|
-
"use strict";
|
|
1042
|
-
init_esm_shims();
|
|
1043
|
-
import_debug = __toESM(require_src());
|
|
1044
|
-
merge = require_merge_deep();
|
|
1045
|
-
PuppeteerExtraPlugin = class {
|
|
1046
|
-
constructor(opts) {
|
|
1047
|
-
this._debugBase = (0, import_debug.default)(`puppeteer-extra-plugin:base:${this.name}`);
|
|
1048
|
-
this._childClassMembers = [];
|
|
1049
|
-
this._opts = merge(this.defaults, opts || {});
|
|
1050
|
-
this._debugBase("Initialized.");
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Plugin name (required).
|
|
1054
|
-
*
|
|
1055
|
-
* Convention:
|
|
1056
|
-
* - Package: `puppeteer-extra-plugin-anonymize-ua`
|
|
1057
|
-
* - Name: `anonymize-ua`
|
|
1058
|
-
*
|
|
1059
|
-
* @example
|
|
1060
|
-
* get name () { return 'anonymize-ua' }
|
|
1061
|
-
*/
|
|
1062
|
-
get name() {
|
|
1063
|
-
throw new Error('Plugin must override "name"');
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* Plugin defaults (optional).
|
|
1067
|
-
*
|
|
1068
|
-
* If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation).
|
|
1069
|
-
*
|
|
1070
|
-
* The result of merging defaults with user supplied options can be accessed through `this.opts`.
|
|
1071
|
-
*
|
|
1072
|
-
* @see [[opts]]
|
|
1073
|
-
*
|
|
1074
|
-
* @example
|
|
1075
|
-
* get defaults () {
|
|
1076
|
-
* return {
|
|
1077
|
-
* stripHeadless: true,
|
|
1078
|
-
* makeWindows: true,
|
|
1079
|
-
* customFn: null
|
|
1080
|
-
* }
|
|
1081
|
-
* }
|
|
1082
|
-
*
|
|
1083
|
-
* // Users can overwrite plugin defaults during instantiation:
|
|
1084
|
-
* puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false }))
|
|
1085
|
-
*/
|
|
1086
|
-
get defaults() {
|
|
1087
|
-
return {};
|
|
1088
|
-
}
|
|
1089
|
-
/**
|
|
1090
|
-
* Plugin requirements (optional).
|
|
1091
|
-
*
|
|
1092
|
-
* Signal certain plugin requirements to the base class and the user.
|
|
1093
|
-
*
|
|
1094
|
-
* Currently supported:
|
|
1095
|
-
* - `launch`
|
|
1096
|
-
* - If the plugin only supports locally created browser instances (no `puppeteer.connect()`),
|
|
1097
|
-
* will output a warning to the user.
|
|
1098
|
-
* - `headful`
|
|
1099
|
-
* - If the plugin doesn't work in `headless: true` mode,
|
|
1100
|
-
* will output a warning to the user.
|
|
1101
|
-
* - `dataFromPlugins`
|
|
1102
|
-
* - In case the plugin requires data from other plugins.
|
|
1103
|
-
* will enable usage of `this.getDataFromPlugins()`.
|
|
1104
|
-
* - `runLast`
|
|
1105
|
-
* - In case the plugin prefers to run after the others.
|
|
1106
|
-
* Useful when the plugin needs data from others.
|
|
1107
|
-
*
|
|
1108
|
-
* @example
|
|
1109
|
-
* get requirements () {
|
|
1110
|
-
* return new Set(['runLast', 'dataFromPlugins'])
|
|
1111
|
-
* }
|
|
1112
|
-
*/
|
|
1113
|
-
get requirements() {
|
|
1114
|
-
return /* @__PURE__ */ new Set([]);
|
|
1115
|
-
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Plugin dependencies (optional).
|
|
1118
|
-
*
|
|
1119
|
-
* Missing plugins will be required() by puppeteer-extra.
|
|
1120
|
-
*
|
|
1121
|
-
* @example
|
|
1122
|
-
* get dependencies () {
|
|
1123
|
-
* return new Set(['user-preferences'])
|
|
1124
|
-
* }
|
|
1125
|
-
* // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded.
|
|
1126
|
-
*/
|
|
1127
|
-
get dependencies() {
|
|
1128
|
-
return /* @__PURE__ */ new Set([]);
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Plugin data (optional).
|
|
1132
|
-
*
|
|
1133
|
-
* Plugins can expose data (an array of objects), which in turn can be consumed by other plugins,
|
|
1134
|
-
* that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`).
|
|
1135
|
-
*
|
|
1136
|
-
* Convention: `[ {name: 'Any name', value: 'Any value'} ]`
|
|
1137
|
-
*
|
|
1138
|
-
* @see [[getDataFromPlugins]]
|
|
1139
|
-
*
|
|
1140
|
-
* @example
|
|
1141
|
-
* // plugin1.js
|
|
1142
|
-
* get data () {
|
|
1143
|
-
* return [
|
|
1144
|
-
* {
|
|
1145
|
-
* name: 'userPreferences',
|
|
1146
|
-
* value: { foo: 'bar' }
|
|
1147
|
-
* },
|
|
1148
|
-
* {
|
|
1149
|
-
* name: 'userPreferences',
|
|
1150
|
-
* value: { hello: 'world' }
|
|
1151
|
-
* }
|
|
1152
|
-
* ]
|
|
1153
|
-
*
|
|
1154
|
-
* // plugin2.js
|
|
1155
|
-
* get requirements () { return new Set(['dataFromPlugins']) }
|
|
1156
|
-
*
|
|
1157
|
-
* async beforeLaunch () {
|
|
1158
|
-
* const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value)
|
|
1159
|
-
* this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ]
|
|
1160
|
-
* }
|
|
1161
|
-
*/
|
|
1162
|
-
get data() {
|
|
1163
|
-
return [];
|
|
1164
|
-
}
|
|
1165
|
-
/**
|
|
1166
|
-
* Access the plugin options (usually the `defaults` merged with user defined options)
|
|
1167
|
-
*
|
|
1168
|
-
* To skip the auto-merging of defaults with user supplied opts don't define a `defaults`
|
|
1169
|
-
* property and set the `this._opts` Object in your plugin constructor directly.
|
|
1170
|
-
*
|
|
1171
|
-
* @see [[defaults]]
|
|
1172
|
-
*
|
|
1173
|
-
* @example
|
|
1174
|
-
* get defaults () { return { foo: "bar" } }
|
|
1175
|
-
*
|
|
1176
|
-
* async onPageCreated (page) {
|
|
1177
|
-
* this.debug(this.opts.foo) // => bar
|
|
1178
|
-
* }
|
|
1179
|
-
*/
|
|
1180
|
-
get opts() {
|
|
1181
|
-
return this._opts;
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Convenience debug logger based on the [debug] module.
|
|
1185
|
-
* Will automatically namespace the logging output to the plugin package name.
|
|
1186
|
-
* [debug]: https://www.npmjs.com/package/debug
|
|
1187
|
-
*
|
|
1188
|
-
* ```bash
|
|
1189
|
-
* # toggle output using environment variables
|
|
1190
|
-
* DEBUG=puppeteer-extra-plugin:<plugin_name> node foo.js
|
|
1191
|
-
* # to debug all the things:
|
|
1192
|
-
* DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js
|
|
1193
|
-
* ```
|
|
1194
|
-
*
|
|
1195
|
-
* @example
|
|
1196
|
-
* this.debug('hello world')
|
|
1197
|
-
* // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world'
|
|
1198
|
-
*/
|
|
1199
|
-
get debug() {
|
|
1200
|
-
return (0, import_debug.default)(`puppeteer-extra-plugin:${this.name}`);
|
|
1201
|
-
}
|
|
1202
|
-
/**
|
|
1203
|
-
* Before a new browser instance is created/launched.
|
|
1204
|
-
*
|
|
1205
|
-
* Can be used to modify the puppeteer launch options by modifying or returning them.
|
|
1206
|
-
*
|
|
1207
|
-
* Plugins using this method will be called in sequence to each
|
|
1208
|
-
* be able to update the launch options.
|
|
1209
|
-
*
|
|
1210
|
-
* @example
|
|
1211
|
-
* async beforeLaunch (options) {
|
|
1212
|
-
* if (this.opts.flashPluginPath) {
|
|
1213
|
-
* options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`)
|
|
1214
|
-
* }
|
|
1215
|
-
* }
|
|
1216
|
-
*
|
|
1217
|
-
* @param options - Puppeteer launch options
|
|
1218
|
-
*/
|
|
1219
|
-
async beforeLaunch(options) {
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* After the browser has launched.
|
|
1223
|
-
*
|
|
1224
|
-
* Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
|
|
1225
|
-
* It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created.
|
|
1226
|
-
* In order to make the plugins as stateless as possible don't store a reference to the browser instance
|
|
1227
|
-
* in the plugin but rather consider alternatives.
|
|
1228
|
-
*
|
|
1229
|
-
* E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`.
|
|
1230
|
-
*
|
|
1231
|
-
* Alternatively you could expose a class method that takes a browser instance as a parameter to work with:
|
|
1232
|
-
*
|
|
1233
|
-
* ```es6
|
|
1234
|
-
* const fancyPlugin = require('puppeteer-extra-plugin-fancy')()
|
|
1235
|
-
* puppeteer.use(fancyPlugin)
|
|
1236
|
-
* const browser = await puppeteer.launch()
|
|
1237
|
-
* await fancyPlugin.killBrowser(browser)
|
|
1238
|
-
* ```
|
|
1239
|
-
*
|
|
1240
|
-
* @param browser - The `puppeteer` browser instance.
|
|
1241
|
-
* @param opts.options - Puppeteer launch options used.
|
|
1242
|
-
*
|
|
1243
|
-
* @example
|
|
1244
|
-
* async afterLaunch (browser, opts) {
|
|
1245
|
-
* this.debug('browser has been launched', opts.options)
|
|
1246
|
-
* }
|
|
1247
|
-
*/
|
|
1248
|
-
async afterLaunch(browser, opts = { options: {} }) {
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Before connecting to an existing browser instance.
|
|
1252
|
-
*
|
|
1253
|
-
* Can be used to modify the puppeteer connect options by modifying or returning them.
|
|
1254
|
-
*
|
|
1255
|
-
* Plugins using this method will be called in sequence to each
|
|
1256
|
-
* be able to update the launch options.
|
|
1257
|
-
*
|
|
1258
|
-
* @param {Object} options - Puppeteer connect options
|
|
1259
|
-
* @return {Object=}
|
|
1260
|
-
*/
|
|
1261
|
-
async beforeConnect(options) {
|
|
1262
|
-
}
|
|
1263
|
-
/**
|
|
1264
|
-
* After connecting to an existing browser instance.
|
|
1265
|
-
*
|
|
1266
|
-
* > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
|
|
1267
|
-
*
|
|
1268
|
-
* @param browser - The `puppeteer` browser instance.
|
|
1269
|
-
* @param {Object} opts
|
|
1270
|
-
* @param {Object} opts.options - Puppeteer connect options used.
|
|
1271
|
-
*
|
|
1272
|
-
*/
|
|
1273
|
-
async afterConnect(browser, opts = {}) {
|
|
1274
|
-
}
|
|
1275
|
-
/**
|
|
1276
|
-
* Called when a browser instance is available.
|
|
1277
|
-
*
|
|
1278
|
-
* This applies to both `puppeteer.launch()` and `puppeteer.connect()`.
|
|
1279
|
-
*
|
|
1280
|
-
* Convenience method created for plugins that need access to a browser instance
|
|
1281
|
-
* and don't mind if it has been created through `launch` or `connect`.
|
|
1282
|
-
*
|
|
1283
|
-
* > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.
|
|
1284
|
-
*
|
|
1285
|
-
* @param browser - The `puppeteer` browser instance.
|
|
1286
|
-
*/
|
|
1287
|
-
async onBrowser(browser, opts) {
|
|
1288
|
-
}
|
|
1289
|
-
/**
|
|
1290
|
-
* Called when a target is created, for example when a new page is opened by window.open or browser.newPage.
|
|
1291
|
-
*
|
|
1292
|
-
* > Note: This includes target creations in incognito browser contexts.
|
|
1293
|
-
*
|
|
1294
|
-
* > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
|
|
1295
|
-
*
|
|
1296
|
-
* @param {Puppeteer.Target} target
|
|
1297
|
-
*/
|
|
1298
|
-
async onTargetCreated(target) {
|
|
1299
|
-
}
|
|
1300
|
-
/**
|
|
1301
|
-
* Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience.
|
|
1302
|
-
*
|
|
1303
|
-
* > Note: This includes page creations in incognito browser contexts.
|
|
1304
|
-
*
|
|
1305
|
-
* > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
|
|
1306
|
-
*
|
|
1307
|
-
* @param {Puppeteer.Target} target
|
|
1308
|
-
*
|
|
1309
|
-
* @example
|
|
1310
|
-
* async onPageCreated (page) {
|
|
1311
|
-
* let ua = await page.browser().userAgent()
|
|
1312
|
-
* if (this.opts.stripHeadless) {
|
|
1313
|
-
* ua = ua.replace('HeadlessChrome/', 'Chrome/')
|
|
1314
|
-
* }
|
|
1315
|
-
* this.debug('new ua', ua)
|
|
1316
|
-
* await page.setUserAgent(ua)
|
|
1317
|
-
* }
|
|
1318
|
-
*/
|
|
1319
|
-
async onPageCreated(page) {
|
|
1320
|
-
}
|
|
1321
|
-
/**
|
|
1322
|
-
* Called when the url of a target changes.
|
|
1323
|
-
*
|
|
1324
|
-
* > Note: This includes target changes in incognito browser contexts.
|
|
1325
|
-
*
|
|
1326
|
-
* > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
|
|
1327
|
-
*
|
|
1328
|
-
* @param {Puppeteer.Target} target
|
|
1329
|
-
*/
|
|
1330
|
-
async onTargetChanged(target) {
|
|
1331
|
-
}
|
|
1332
|
-
/**
|
|
1333
|
-
* Called when a target is destroyed, for example when a page is closed.
|
|
1334
|
-
*
|
|
1335
|
-
* > Note: This includes target destructions in incognito browser contexts.
|
|
1336
|
-
*
|
|
1337
|
-
* > Note: This includes browser instances created through `.launch()` as well as `.connect()`.
|
|
1338
|
-
*
|
|
1339
|
-
* @param {Puppeteer.Target} target
|
|
1340
|
-
*/
|
|
1341
|
-
async onTargetDestroyed(target) {
|
|
1342
|
-
}
|
|
1343
|
-
/**
|
|
1344
|
-
* Called when Puppeteer gets disconnected from the Chromium instance.
|
|
1345
|
-
*
|
|
1346
|
-
* This might happen because of one of the following:
|
|
1347
|
-
* - Chromium is closed or crashed
|
|
1348
|
-
* - The `browser.disconnect` method was called
|
|
1349
|
-
*/
|
|
1350
|
-
async onDisconnected() {
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
* **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved
|
|
1354
|
-
* and should be used instead of `onClose`.
|
|
1355
|
-
*
|
|
1356
|
-
* In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios.
|
|
1357
|
-
* In order for plugins to clean up properly (e.g. deleting temporary files)
|
|
1358
|
-
* the `onClose` method had been introduced.
|
|
1359
|
-
*
|
|
1360
|
-
* > Note: Might be called multiple times on exit.
|
|
1361
|
-
*
|
|
1362
|
-
* > Note: This only includes browser instances created through `.launch()`.
|
|
1363
|
-
*/
|
|
1364
|
-
async onClose() {
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
* After the plugin has been registered in `puppeteer-extra`.
|
|
1368
|
-
*
|
|
1369
|
-
* Normally right after `puppeteer.use(plugin)` is called
|
|
1370
|
-
*/
|
|
1371
|
-
async onPluginRegistered() {
|
|
1372
|
-
}
|
|
1373
|
-
/**
|
|
1374
|
-
* Helper method to retrieve `data` objects from other plugins.
|
|
1375
|
-
*
|
|
1376
|
-
* A plugin needs to state the `dataFromPlugins` requirement
|
|
1377
|
-
* in order to use this method. Will be mapped to `puppeteer.getPluginData`.
|
|
1378
|
-
*
|
|
1379
|
-
* @param name - Filter data by `name` property
|
|
1380
|
-
*
|
|
1381
|
-
* @see [data]
|
|
1382
|
-
* @see [requirements]
|
|
1383
|
-
*/
|
|
1384
|
-
getDataFromPlugins(name) {
|
|
1385
|
-
return [];
|
|
1386
|
-
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Will match plugin dependencies against all currently registered plugins.
|
|
1389
|
-
* Is being called by `puppeteer-extra` and used to require missing dependencies.
|
|
1390
|
-
*
|
|
1391
|
-
* @param {Array<Object>} plugins
|
|
1392
|
-
* @return {Set} - list of missing plugin names
|
|
1393
|
-
*
|
|
1394
|
-
* @private
|
|
1395
|
-
*/
|
|
1396
|
-
_getMissingDependencies(plugins) {
|
|
1397
|
-
const pluginNames = new Set(plugins.map((p) => p.name));
|
|
1398
|
-
const missing = new Set(Array.from(this.dependencies.values()).filter((x) => !pluginNames.has(x)));
|
|
1399
|
-
return missing;
|
|
1400
|
-
}
|
|
1401
|
-
/**
|
|
1402
|
-
* Conditionally bind browser/process events to class members.
|
|
1403
|
-
* The idea is to reduce event binding boilerplate in plugins.
|
|
1404
|
-
*
|
|
1405
|
-
* For efficiency we make sure the plugin is using the respective event
|
|
1406
|
-
* by checking the child class members before registering the listener.
|
|
1407
|
-
*
|
|
1408
|
-
* @param {<Puppeteer.Browser>} browser
|
|
1409
|
-
* @param {Object} opts - Options
|
|
1410
|
-
* @param {string} opts.context - Puppeteer context (launch/connect)
|
|
1411
|
-
* @param {Object} [opts.options] - Puppeteer launch or connect options
|
|
1412
|
-
* @param {Array<string>} [opts.defaultArgs] - The default flags that Chromium will be launched with
|
|
1413
|
-
*
|
|
1414
|
-
* @private
|
|
1415
|
-
*/
|
|
1416
|
-
async _bindBrowserEvents(browser, opts = {}) {
|
|
1417
|
-
if (this._hasChildClassMember("onTargetCreated") || this._hasChildClassMember("onPageCreated")) {
|
|
1418
|
-
browser.on("targetcreated", this._onTargetCreated.bind(this));
|
|
1419
|
-
}
|
|
1420
|
-
if (this._hasChildClassMember("onTargetChanged") && this.onTargetChanged) {
|
|
1421
|
-
browser.on("targetchanged", this.onTargetChanged.bind(this));
|
|
1422
|
-
}
|
|
1423
|
-
if (this._hasChildClassMember("onTargetDestroyed") && this.onTargetDestroyed) {
|
|
1424
|
-
browser.on("targetdestroyed", this.onTargetDestroyed.bind(this));
|
|
1425
|
-
}
|
|
1426
|
-
if (this._hasChildClassMember("onDisconnected") && this.onDisconnected) {
|
|
1427
|
-
browser.on("disconnected", this.onDisconnected.bind(this));
|
|
1428
|
-
}
|
|
1429
|
-
if (opts.context === "launch" && this._hasChildClassMember("onClose")) {
|
|
1430
|
-
if (this.onClose) {
|
|
1431
|
-
process.on("exit", this.onClose.bind(this));
|
|
1432
|
-
browser.on("disconnected", this.onClose.bind(this));
|
|
1433
|
-
if (opts.options.handleSIGINT !== false) {
|
|
1434
|
-
process.on("SIGINT", this.onClose.bind(this));
|
|
1435
|
-
}
|
|
1436
|
-
if (opts.options.handleSIGTERM !== false) {
|
|
1437
|
-
process.on("SIGTERM", this.onClose.bind(this));
|
|
1438
|
-
}
|
|
1439
|
-
if (opts.options.handleSIGHUP !== false) {
|
|
1440
|
-
process.on("SIGHUP", this.onClose.bind(this));
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
if (opts.context === "launch" && this.afterLaunch) {
|
|
1445
|
-
await this.afterLaunch(browser, opts);
|
|
1446
|
-
}
|
|
1447
|
-
if (opts.context === "connect" && this.afterConnect) {
|
|
1448
|
-
await this.afterConnect(browser, opts);
|
|
1449
|
-
}
|
|
1450
|
-
if (this.onBrowser)
|
|
1451
|
-
await this.onBrowser(browser, opts);
|
|
1452
|
-
}
|
|
1453
|
-
/**
|
|
1454
|
-
* @private
|
|
1455
|
-
*/
|
|
1456
|
-
async _onTargetCreated(target) {
|
|
1457
|
-
if (this.onTargetCreated)
|
|
1458
|
-
await this.onTargetCreated(target);
|
|
1459
|
-
if (target.type() === "page") {
|
|
1460
|
-
try {
|
|
1461
|
-
const page = await target.page();
|
|
1462
|
-
if (!page) {
|
|
1463
|
-
return;
|
|
1464
|
-
}
|
|
1465
|
-
const validPage = "isClosed" in page && !page.isClosed();
|
|
1466
|
-
if (this.onPageCreated && validPage) {
|
|
1467
|
-
await this.onPageCreated(page);
|
|
1468
|
-
}
|
|
1469
|
-
} catch (err) {
|
|
1470
|
-
console.error(err);
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
/**
|
|
1475
|
-
* @private
|
|
1476
|
-
*/
|
|
1477
|
-
_register(prototype) {
|
|
1478
|
-
this._registerChildClassMembers(prototype);
|
|
1479
|
-
if (this.onPluginRegistered)
|
|
1480
|
-
this.onPluginRegistered();
|
|
1481
|
-
}
|
|
1482
|
-
/**
|
|
1483
|
-
* @private
|
|
1484
|
-
*/
|
|
1485
|
-
_registerChildClassMembers(prototype) {
|
|
1486
|
-
this._childClassMembers = Object.getOwnPropertyNames(prototype);
|
|
1487
|
-
}
|
|
1488
|
-
/**
|
|
1489
|
-
* @private
|
|
1490
|
-
*/
|
|
1491
|
-
_hasChildClassMember(name) {
|
|
1492
|
-
return !!this._childClassMembers.includes(name);
|
|
1493
|
-
}
|
|
1494
|
-
/**
|
|
1495
|
-
* @private
|
|
1496
|
-
*/
|
|
1497
|
-
get _isPuppeteerExtraPlugin() {
|
|
1498
|
-
return true;
|
|
1499
|
-
}
|
|
1500
|
-
};
|
|
1501
|
-
}
|
|
1502
|
-
});
|
|
1503
|
-
|
|
1504
|
-
// ../node_modules/puppeteer-extra-plugin-stealth/index.js
|
|
1505
|
-
var require_puppeteer_extra_plugin_stealth = __commonJS({
|
|
1506
|
-
"../node_modules/puppeteer-extra-plugin-stealth/index.js"(exports, module) {
|
|
1507
|
-
"use strict";
|
|
1508
|
-
init_esm_shims();
|
|
1509
|
-
var { PuppeteerExtraPlugin: PuppeteerExtraPlugin2 } = (init_index_esm(), __toCommonJS(index_esm_exports));
|
|
1510
|
-
var StealthPlugin = class extends PuppeteerExtraPlugin2 {
|
|
1511
|
-
constructor(opts = {}) {
|
|
1512
|
-
super(opts);
|
|
1513
|
-
}
|
|
1514
|
-
get name() {
|
|
1515
|
-
return "stealth";
|
|
1516
|
-
}
|
|
1517
|
-
get defaults() {
|
|
1518
|
-
const availableEvasions = /* @__PURE__ */ new Set([
|
|
1519
|
-
"chrome.app",
|
|
1520
|
-
"chrome.csi",
|
|
1521
|
-
"chrome.loadTimes",
|
|
1522
|
-
"chrome.runtime",
|
|
1523
|
-
"defaultArgs",
|
|
1524
|
-
"iframe.contentWindow",
|
|
1525
|
-
"media.codecs",
|
|
1526
|
-
"navigator.hardwareConcurrency",
|
|
1527
|
-
"navigator.languages",
|
|
1528
|
-
"navigator.permissions",
|
|
1529
|
-
"navigator.plugins",
|
|
1530
|
-
"navigator.webdriver",
|
|
1531
|
-
"sourceurl",
|
|
1532
|
-
"user-agent-override",
|
|
1533
|
-
"webgl.vendor",
|
|
1534
|
-
"window.outerdimensions"
|
|
1535
|
-
]);
|
|
1536
|
-
return {
|
|
1537
|
-
availableEvasions,
|
|
1538
|
-
// Enable all available evasions by default
|
|
1539
|
-
enabledEvasions: /* @__PURE__ */ new Set([...availableEvasions])
|
|
1540
|
-
};
|
|
1541
|
-
}
|
|
1542
|
-
/**
|
|
1543
|
-
* Requires evasion techniques dynamically based on configuration.
|
|
1544
|
-
*
|
|
1545
|
-
* @private
|
|
1546
|
-
*/
|
|
1547
|
-
get dependencies() {
|
|
1548
|
-
return new Set(
|
|
1549
|
-
[...this.opts.enabledEvasions].map((e) => `${this.name}/evasions/${e}`)
|
|
1550
|
-
);
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* Get all available evasions.
|
|
1554
|
-
*
|
|
1555
|
-
* Please look into the [evasions directory](./evasions/) for an up to date list.
|
|
1556
|
-
*
|
|
1557
|
-
* @type {Set<string>} - A Set of all available evasions.
|
|
1558
|
-
*
|
|
1559
|
-
* @example
|
|
1560
|
-
* const pluginStealth = require('puppeteer-extra-plugin-stealth')()
|
|
1561
|
-
* console.log(pluginStealth.availableEvasions) // => Set { 'user-agent', 'console.debug' }
|
|
1562
|
-
* puppeteer.use(pluginStealth)
|
|
1563
|
-
*/
|
|
1564
|
-
get availableEvasions() {
|
|
1565
|
-
return this.defaults.availableEvasions;
|
|
1566
|
-
}
|
|
1567
|
-
/**
|
|
1568
|
-
* Get all enabled evasions.
|
|
1569
|
-
*
|
|
1570
|
-
* Enabled evasions can be configured either through `opts` or by modifying this property.
|
|
1571
|
-
*
|
|
1572
|
-
* @type {Set<string>} - A Set of all enabled evasions.
|
|
1573
|
-
*
|
|
1574
|
-
* @example
|
|
1575
|
-
* // Remove specific evasion from enabled ones dynamically
|
|
1576
|
-
* const pluginStealth = require('puppeteer-extra-plugin-stealth')()
|
|
1577
|
-
* pluginStealth.enabledEvasions.delete('console.debug')
|
|
1578
|
-
* puppeteer.use(pluginStealth)
|
|
1579
|
-
*/
|
|
1580
|
-
get enabledEvasions() {
|
|
1581
|
-
return this.opts.enabledEvasions;
|
|
1582
|
-
}
|
|
1583
|
-
/**
|
|
1584
|
-
* @private
|
|
1585
|
-
*/
|
|
1586
|
-
set enabledEvasions(evasions) {
|
|
1587
|
-
this.opts.enabledEvasions = evasions;
|
|
1588
|
-
}
|
|
1589
|
-
async onBrowser(browser) {
|
|
1590
|
-
if (browser && browser.setMaxListeners) {
|
|
1591
|
-
browser.setMaxListeners(30);
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
};
|
|
1595
|
-
var defaultExport = (opts) => new StealthPlugin(opts);
|
|
1596
|
-
module.exports = defaultExport;
|
|
1597
|
-
}
|
|
1598
|
-
});
|
|
1599
|
-
|
|
1600
|
-
// src/index.ts
|
|
1601
|
-
init_esm_shims();
|
|
1602
|
-
|
|
1603
|
-
// src/FetchEngine.ts
|
|
1604
|
-
init_esm_shims();
|
|
1605
|
-
|
|
1606
1
|
// src/utils/markdown-converter.ts
|
|
1607
|
-
init_esm_shims();
|
|
1608
2
|
import TurndownService from "turndown";
|
|
1609
3
|
import { gfm } from "turndown-plugin-gfm";
|
|
1610
4
|
import { parse, HTMLElement as NHPHTMLElement } from "node-html-parser";
|
|
@@ -2234,7 +628,6 @@ ${p2}`);
|
|
|
2234
628
|
};
|
|
2235
629
|
|
|
2236
630
|
// src/errors.ts
|
|
2237
|
-
init_esm_shims();
|
|
2238
631
|
var FetchError = class _FetchError extends Error {
|
|
2239
632
|
/** A specific error code (e.g., ERR_NAVIGATION_TIMEOUT, ERR_HTTP_ERROR). */
|
|
2240
633
|
code;
|
|
@@ -2359,30 +752,11 @@ var FetchEngine = class _FetchEngine {
|
|
|
2359
752
|
}
|
|
2360
753
|
};
|
|
2361
754
|
|
|
2362
|
-
// src/PlaywrightEngine.ts
|
|
2363
|
-
init_esm_shims();
|
|
2364
|
-
|
|
2365
755
|
// src/browser/PlaywrightBrowserPool.ts
|
|
2366
|
-
init_esm_shims();
|
|
2367
756
|
import { chromium as playwrightChromium } from "playwright";
|
|
2368
757
|
import UserAgent from "user-agents";
|
|
2369
758
|
import { v4 as uuidv4 } from "uuid";
|
|
2370
759
|
import PQueue from "p-queue";
|
|
2371
|
-
import { addExtra } from "playwright-extra";
|
|
2372
|
-
var chromiumWithExtras;
|
|
2373
|
-
var StealthPluginInstance;
|
|
2374
|
-
async function loadDependencies() {
|
|
2375
|
-
if (!chromiumWithExtras) {
|
|
2376
|
-
chromiumWithExtras = addExtra(playwrightChromium);
|
|
2377
|
-
const StealthPluginModule = await Promise.resolve().then(() => __toESM(require_puppeteer_extra_plugin_stealth(), 1));
|
|
2378
|
-
const stealthPluginFactory = typeof StealthPluginModule.default === "function" ? StealthPluginModule.default : StealthPluginModule;
|
|
2379
|
-
if (typeof stealthPluginFactory !== "function") {
|
|
2380
|
-
throw new Error("puppeteer-extra-plugin-stealth export is not a function or module structure is unexpected.");
|
|
2381
|
-
}
|
|
2382
|
-
StealthPluginInstance = stealthPluginFactory();
|
|
2383
|
-
chromiumWithExtras.use(StealthPluginInstance);
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
760
|
var PlaywrightBrowserPool = class _PlaywrightBrowserPool {
|
|
2387
761
|
pool = /* @__PURE__ */ new Set();
|
|
2388
762
|
maxBrowsers;
|
|
@@ -2434,7 +808,6 @@ var PlaywrightBrowserPool = class _PlaywrightBrowserPool {
|
|
|
2434
808
|
this.proxyConfig = config.proxy;
|
|
2435
809
|
}
|
|
2436
810
|
async initialize() {
|
|
2437
|
-
await loadDependencies();
|
|
2438
811
|
if (this.isCleaningUp) return;
|
|
2439
812
|
await this.ensureMinimumInstances();
|
|
2440
813
|
this.scheduleHealthCheck();
|
|
@@ -2462,7 +835,6 @@ var PlaywrightBrowserPool = class _PlaywrightBrowserPool {
|
|
|
2462
835
|
}
|
|
2463
836
|
}
|
|
2464
837
|
async createBrowserInstance() {
|
|
2465
|
-
await loadDependencies();
|
|
2466
838
|
const id = uuidv4();
|
|
2467
839
|
const launchOptions = {
|
|
2468
840
|
headless: !this.useHeadedMode,
|
|
@@ -2479,7 +851,7 @@ var PlaywrightBrowserPool = class _PlaywrightBrowserPool {
|
|
|
2479
851
|
],
|
|
2480
852
|
proxy: this.proxyConfig
|
|
2481
853
|
};
|
|
2482
|
-
const browser = await
|
|
854
|
+
const browser = await playwrightChromium.launch(launchOptions);
|
|
2483
855
|
const context = await browser.newContext({
|
|
2484
856
|
userAgent: new UserAgent().toString(),
|
|
2485
857
|
viewport: {
|
|
@@ -3173,7 +1545,6 @@ var PlaywrightEngine = class _PlaywrightEngine {
|
|
|
3173
1545
|
};
|
|
3174
1546
|
|
|
3175
1547
|
// src/HybridEngine.ts
|
|
3176
|
-
init_esm_shims();
|
|
3177
1548
|
var HybridEngine = class {
|
|
3178
1549
|
fetchEngine;
|
|
3179
1550
|
playwrightEngine;
|
|
@@ -3227,45 +1598,4 @@ export {
|
|
|
3227
1598
|
HybridEngine,
|
|
3228
1599
|
PlaywrightEngine
|
|
3229
1600
|
};
|
|
3230
|
-
/*! Bundled license information:
|
|
3231
|
-
|
|
3232
|
-
for-in/index.js:
|
|
3233
|
-
(*!
|
|
3234
|
-
* for-in <https://github.com/jonschlinkert/for-in>
|
|
3235
|
-
*
|
|
3236
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
3237
|
-
* Released under the MIT License.
|
|
3238
|
-
*)
|
|
3239
|
-
|
|
3240
|
-
for-own/index.js:
|
|
3241
|
-
(*!
|
|
3242
|
-
* for-own <https://github.com/jonschlinkert/for-own>
|
|
3243
|
-
*
|
|
3244
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
3245
|
-
* Released under the MIT License.
|
|
3246
|
-
*)
|
|
3247
|
-
|
|
3248
|
-
is-buffer/index.js:
|
|
3249
|
-
(*!
|
|
3250
|
-
* Determine if an object is a Buffer
|
|
3251
|
-
*
|
|
3252
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
3253
|
-
* @license MIT
|
|
3254
|
-
*)
|
|
3255
|
-
|
|
3256
|
-
merge-deep/index.js:
|
|
3257
|
-
(*!
|
|
3258
|
-
* merge-deep <https://github.com/jonschlinkert/merge-deep>
|
|
3259
|
-
*
|
|
3260
|
-
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
3261
|
-
* Licensed under the MIT License.
|
|
3262
|
-
*)
|
|
3263
|
-
|
|
3264
|
-
puppeteer-extra-plugin/dist/index.esm.js:
|
|
3265
|
-
(*!
|
|
3266
|
-
* puppeteer-extra-plugin v3.2.2 by berstend
|
|
3267
|
-
* https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin
|
|
3268
|
-
* @license MIT
|
|
3269
|
-
*)
|
|
3270
|
-
*/
|
|
3271
1601
|
//# sourceMappingURL=index.js.map
|