@skrillex1224/playwright-toolkit 3.0.37 → 3.0.39
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/browser.js +39 -105
- package/dist/browser.js.map +4 -4
- package/dist/index.cjs +248 -282
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +248 -282
- package/dist/index.js.map +4 -4
- package/index.d.ts +0 -7
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -1398,9 +1398,9 @@ var require_picomatch = __commonJS({
|
|
|
1398
1398
|
var utils = require_utils();
|
|
1399
1399
|
var constants = require_constants();
|
|
1400
1400
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
1401
|
-
var
|
|
1401
|
+
var picomatch2 = (glob, options, returnState = false) => {
|
|
1402
1402
|
if (Array.isArray(glob)) {
|
|
1403
|
-
const fns = glob.map((input) =>
|
|
1403
|
+
const fns = glob.map((input) => picomatch2(input, options, returnState));
|
|
1404
1404
|
const arrayMatcher = (str) => {
|
|
1405
1405
|
for (const isMatch of fns) {
|
|
1406
1406
|
const state3 = isMatch(str);
|
|
@@ -1416,16 +1416,16 @@ var require_picomatch = __commonJS({
|
|
|
1416
1416
|
}
|
|
1417
1417
|
const opts = options || {};
|
|
1418
1418
|
const posix = opts.windows;
|
|
1419
|
-
const regex = isState ?
|
|
1419
|
+
const regex = isState ? picomatch2.compileRe(glob, options) : picomatch2.makeRe(glob, options, false, true);
|
|
1420
1420
|
const state2 = regex.state;
|
|
1421
1421
|
delete regex.state;
|
|
1422
1422
|
let isIgnored = () => false;
|
|
1423
1423
|
if (opts.ignore) {
|
|
1424
1424
|
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
1425
|
-
isIgnored =
|
|
1425
|
+
isIgnored = picomatch2(opts.ignore, ignoreOpts, returnState);
|
|
1426
1426
|
}
|
|
1427
1427
|
const matcher = (input, returnObject = false) => {
|
|
1428
|
-
const { isMatch, match, output } =
|
|
1428
|
+
const { isMatch, match, output } = picomatch2.test(input, regex, options, { glob, posix });
|
|
1429
1429
|
const result = { glob, state: state2, regex, posix, input, output, match, isMatch };
|
|
1430
1430
|
if (typeof opts.onResult === "function") {
|
|
1431
1431
|
opts.onResult(result);
|
|
@@ -1451,7 +1451,7 @@ var require_picomatch = __commonJS({
|
|
|
1451
1451
|
}
|
|
1452
1452
|
return matcher;
|
|
1453
1453
|
};
|
|
1454
|
-
|
|
1454
|
+
picomatch2.test = (input, regex, options, { glob, posix } = {}) => {
|
|
1455
1455
|
if (typeof input !== "string") {
|
|
1456
1456
|
throw new TypeError("Expected input to be a string");
|
|
1457
1457
|
}
|
|
@@ -1468,24 +1468,24 @@ var require_picomatch = __commonJS({
|
|
|
1468
1468
|
}
|
|
1469
1469
|
if (match === false || opts.capture === true) {
|
|
1470
1470
|
if (opts.matchBase === true || opts.basename === true) {
|
|
1471
|
-
match =
|
|
1471
|
+
match = picomatch2.matchBase(input, regex, options, posix);
|
|
1472
1472
|
} else {
|
|
1473
1473
|
match = regex.exec(output);
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
return { isMatch: Boolean(match), match, output };
|
|
1477
1477
|
};
|
|
1478
|
-
|
|
1479
|
-
const regex = glob instanceof RegExp ? glob :
|
|
1478
|
+
picomatch2.matchBase = (input, glob, options) => {
|
|
1479
|
+
const regex = glob instanceof RegExp ? glob : picomatch2.makeRe(glob, options);
|
|
1480
1480
|
return regex.test(utils.basename(input));
|
|
1481
1481
|
};
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
if (Array.isArray(pattern)) return pattern.map((p) =>
|
|
1482
|
+
picomatch2.isMatch = (str, patterns, options) => picomatch2(patterns, options)(str);
|
|
1483
|
+
picomatch2.parse = (pattern, options) => {
|
|
1484
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch2.parse(p, options));
|
|
1485
1485
|
return parse(pattern, { ...options, fastpaths: false });
|
|
1486
1486
|
};
|
|
1487
|
-
|
|
1488
|
-
|
|
1487
|
+
picomatch2.scan = (input, options) => scan(input, options);
|
|
1488
|
+
picomatch2.compileRe = (state2, options, returnOutput = false, returnState = false) => {
|
|
1489
1489
|
if (returnOutput === true) {
|
|
1490
1490
|
return state2.output;
|
|
1491
1491
|
}
|
|
@@ -1496,13 +1496,13 @@ var require_picomatch = __commonJS({
|
|
|
1496
1496
|
if (state2 && state2.negated === true) {
|
|
1497
1497
|
source = `^(?!${source}).*$`;
|
|
1498
1498
|
}
|
|
1499
|
-
const regex =
|
|
1499
|
+
const regex = picomatch2.toRegex(source, options);
|
|
1500
1500
|
if (returnState === true) {
|
|
1501
1501
|
regex.state = state2;
|
|
1502
1502
|
}
|
|
1503
1503
|
return regex;
|
|
1504
1504
|
};
|
|
1505
|
-
|
|
1505
|
+
picomatch2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
1506
1506
|
if (!input || typeof input !== "string") {
|
|
1507
1507
|
throw new TypeError("Expected a non-empty string");
|
|
1508
1508
|
}
|
|
@@ -1513,9 +1513,9 @@ var require_picomatch = __commonJS({
|
|
|
1513
1513
|
if (!parsed.output) {
|
|
1514
1514
|
parsed = parse(input, options);
|
|
1515
1515
|
}
|
|
1516
|
-
return
|
|
1516
|
+
return picomatch2.compileRe(parsed, options, returnOutput, returnState);
|
|
1517
1517
|
};
|
|
1518
|
-
|
|
1518
|
+
picomatch2.toRegex = (source, options) => {
|
|
1519
1519
|
try {
|
|
1520
1520
|
const opts = options || {};
|
|
1521
1521
|
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
@@ -1524,8 +1524,8 @@ var require_picomatch = __commonJS({
|
|
|
1524
1524
|
return /$^/;
|
|
1525
1525
|
}
|
|
1526
1526
|
};
|
|
1527
|
-
|
|
1528
|
-
module.exports =
|
|
1527
|
+
picomatch2.constants = constants;
|
|
1528
|
+
module.exports = picomatch2;
|
|
1529
1529
|
}
|
|
1530
1530
|
});
|
|
1531
1531
|
|
|
@@ -1535,14 +1535,14 @@ var require_picomatch2 = __commonJS({
|
|
|
1535
1535
|
"use strict";
|
|
1536
1536
|
var pico = require_picomatch();
|
|
1537
1537
|
var utils = require_utils();
|
|
1538
|
-
function
|
|
1538
|
+
function picomatch2(glob, options, returnState = false) {
|
|
1539
1539
|
if (options && (options.windows === null || options.windows === void 0)) {
|
|
1540
1540
|
options = { ...options, windows: utils.isWindows() };
|
|
1541
1541
|
}
|
|
1542
1542
|
return pico(glob, options, returnState);
|
|
1543
1543
|
}
|
|
1544
|
-
Object.assign(
|
|
1545
|
-
module.exports =
|
|
1544
|
+
Object.assign(picomatch2, pico);
|
|
1545
|
+
module.exports = picomatch2;
|
|
1546
1546
|
}
|
|
1547
1547
|
});
|
|
1548
1548
|
|
|
@@ -1574,18 +1574,18 @@ var fallbackLog = {
|
|
|
1574
1574
|
error: (...args) => console.error(...args),
|
|
1575
1575
|
debug: (...args) => console.debug ? console.debug(...args) : console.log(...args)
|
|
1576
1576
|
};
|
|
1577
|
-
var resolveLogMethod = (
|
|
1578
|
-
if (
|
|
1579
|
-
return
|
|
1577
|
+
var resolveLogMethod = (logger, name) => {
|
|
1578
|
+
if (logger && typeof logger[name] === "function") {
|
|
1579
|
+
return logger[name].bind(logger);
|
|
1580
1580
|
}
|
|
1581
|
-
if (name === "warning" &&
|
|
1582
|
-
return
|
|
1581
|
+
if (name === "warning" && logger && typeof logger.warn === "function") {
|
|
1582
|
+
return logger.warn.bind(logger);
|
|
1583
1583
|
}
|
|
1584
1584
|
return fallbackLog[name];
|
|
1585
1585
|
};
|
|
1586
1586
|
var defaultLogger = null;
|
|
1587
|
-
var setDefaultLogger = (
|
|
1588
|
-
defaultLogger =
|
|
1587
|
+
var setDefaultLogger = (logger) => {
|
|
1588
|
+
defaultLogger = logger;
|
|
1589
1589
|
};
|
|
1590
1590
|
var resolveLogger = (explicitLogger) => {
|
|
1591
1591
|
if (explicitLogger && typeof explicitLogger.info === "function") {
|
|
@@ -1612,8 +1612,8 @@ var colorize = (text, color) => {
|
|
|
1612
1612
|
var createBaseLogger = (prefix = "", explicitLogger) => {
|
|
1613
1613
|
const name = prefix ? String(prefix) : "";
|
|
1614
1614
|
const dispatch = (methodName, icon, message, color) => {
|
|
1615
|
-
const
|
|
1616
|
-
const logFn = resolveLogMethod(
|
|
1615
|
+
const logger = resolveLogger(explicitLogger);
|
|
1616
|
+
const logFn = resolveLogMethod(logger, methodName);
|
|
1617
1617
|
const timestamp = colorize(`[${formatTimestamp()}]`, ANSI.gray);
|
|
1618
1618
|
const line = formatLine(name, icon, message);
|
|
1619
1619
|
const coloredLine = colorize(line, color);
|
|
@@ -1629,38 +1629,6 @@ var createBaseLogger = (prefix = "", explicitLogger) => {
|
|
|
1629
1629
|
start: (message) => dispatch("info", "\u{1F537}", message, ANSI.blue)
|
|
1630
1630
|
};
|
|
1631
1631
|
};
|
|
1632
|
-
function createInternalLogger(moduleName, explicitLogger) {
|
|
1633
|
-
const baseLogger = createBaseLogger(moduleName, explicitLogger);
|
|
1634
|
-
return {
|
|
1635
|
-
start(methodName, params = "") {
|
|
1636
|
-
const paramStr = params ? ` (${params})` : "";
|
|
1637
|
-
baseLogger.start(`${methodName} \u5F00\u59CB${paramStr}`);
|
|
1638
|
-
},
|
|
1639
|
-
success(methodName, result = "") {
|
|
1640
|
-
const resultStr = result ? ` (${result})` : "";
|
|
1641
|
-
baseLogger.success(`${methodName} \u5B8C\u6210${resultStr}`);
|
|
1642
|
-
},
|
|
1643
|
-
fail(methodName, error) {
|
|
1644
|
-
const message = error instanceof Error ? error.message : error;
|
|
1645
|
-
baseLogger.error(`${methodName} \u5931\u8D25: ${message}`);
|
|
1646
|
-
},
|
|
1647
|
-
debug(message) {
|
|
1648
|
-
baseLogger.debug(message);
|
|
1649
|
-
},
|
|
1650
|
-
warn(message) {
|
|
1651
|
-
baseLogger.warning(message);
|
|
1652
|
-
},
|
|
1653
|
-
warning(message) {
|
|
1654
|
-
baseLogger.warning(message);
|
|
1655
|
-
},
|
|
1656
|
-
info(message) {
|
|
1657
|
-
baseLogger.info(message);
|
|
1658
|
-
},
|
|
1659
|
-
error(message) {
|
|
1660
|
-
baseLogger.error(message);
|
|
1661
|
-
}
|
|
1662
|
-
};
|
|
1663
|
-
}
|
|
1664
1632
|
|
|
1665
1633
|
// src/logger.js
|
|
1666
1634
|
var stripAnsi = (input) => {
|
|
@@ -2465,7 +2433,7 @@ var createTemplateLogger = (baseLogger = createBaseLogger()) => {
|
|
|
2465
2433
|
};
|
|
2466
2434
|
var getDefaultBaseLogger = () => createBaseLogger("");
|
|
2467
2435
|
var Logger = {
|
|
2468
|
-
setLogger: (
|
|
2436
|
+
setLogger: (logger) => setDefaultLogger(logger),
|
|
2469
2437
|
info: (message) => getDefaultBaseLogger().info(message),
|
|
2470
2438
|
success: (message) => getDefaultBaseLogger().success(message),
|
|
2471
2439
|
warning: (message) => getDefaultBaseLogger().warning(message),
|
|
@@ -2473,8 +2441,8 @@ var Logger = {
|
|
|
2473
2441
|
error: (message) => getDefaultBaseLogger().error(message),
|
|
2474
2442
|
debug: (message) => getDefaultBaseLogger().debug(message),
|
|
2475
2443
|
start: (message) => getDefaultBaseLogger().start(message),
|
|
2476
|
-
useTemplate: (
|
|
2477
|
-
if (
|
|
2444
|
+
useTemplate: (logger) => {
|
|
2445
|
+
if (logger) return createTemplateLogger(createBaseLogger("", logger));
|
|
2478
2446
|
return createTemplateLogger();
|
|
2479
2447
|
}
|
|
2480
2448
|
};
|
|
@@ -2758,7 +2726,7 @@ var ActorInfo = {
|
|
|
2758
2726
|
erine: createActorInfo({
|
|
2759
2727
|
key: "erine",
|
|
2760
2728
|
name: "\u6587\u5FC3\u4E00\u8A00",
|
|
2761
|
-
domain: "
|
|
2729
|
+
domain: "xiaoyan.baidu.com",
|
|
2762
2730
|
path: "/",
|
|
2763
2731
|
share: {
|
|
2764
2732
|
mode: "custom",
|
|
@@ -2960,16 +2928,12 @@ var ByPass = {
|
|
|
2960
2928
|
resolveRouteByProxy
|
|
2961
2929
|
};
|
|
2962
2930
|
|
|
2963
|
-
// src/runtime-env.js
|
|
2964
|
-
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
2965
|
-
|
|
2966
2931
|
// src/internals/constants.js
|
|
2967
2932
|
var PageRuntimeStateKey = "__playwright_toolkit_runtime_state__";
|
|
2968
2933
|
|
|
2969
2934
|
// src/runtime-env.js
|
|
2970
2935
|
var BROWSER_PROFILE_SCHEMA_VERSION = 1;
|
|
2971
2936
|
var SUPPORTED_CLOAK_FINGERPRINT_PLATFORMS = /* @__PURE__ */ new Set(["linux", "macos", "windows"]);
|
|
2972
|
-
var logger = createInternalLogger("RuntimeEnv");
|
|
2973
2937
|
var rememberedRuntimeState = null;
|
|
2974
2938
|
var isPlainObject = (value) => value && typeof value === "object" && !Array.isArray(value);
|
|
2975
2939
|
var normalizeKnownDevice = (value) => {
|
|
@@ -3127,18 +3091,6 @@ var uniqueStrings = (value) => {
|
|
|
3127
3091
|
});
|
|
3128
3092
|
return result;
|
|
3129
3093
|
};
|
|
3130
|
-
var buildApplyExcludeMatcher = (patterns = []) => {
|
|
3131
|
-
const normalized = (Array.isArray(patterns) ? patterns : []).map((pattern) => String(pattern || "").trim()).filter(Boolean);
|
|
3132
|
-
return normalized.length > 0 ? (0, import_picomatch2.default)(normalized, { nocase: true }) : () => false;
|
|
3133
|
-
};
|
|
3134
|
-
var filterApplyEntries = (entries = {}, matcher = () => false) => Object.entries(entries || {}).reduce((acc, [key, value]) => {
|
|
3135
|
-
if (matcher(key)) acc.skipped.push(key);
|
|
3136
|
-
else acc.payload[key] = value;
|
|
3137
|
-
return acc;
|
|
3138
|
-
}, { payload: {}, skipped: [] });
|
|
3139
|
-
var logApplySkipped = (type, keys = []) => {
|
|
3140
|
-
if (keys.length > 0) logger.info(`applyToPage \u8DF3\u8FC7\u6CE8\u5165 ${type}: ${keys.join(", ")}`);
|
|
3141
|
-
};
|
|
3142
3094
|
var normalizeHttpUrlList = (value) => uniqueStrings(
|
|
3143
3095
|
(Array.isArray(value) ? value : [value]).map((item) => normalizeHttpUrl(item)).filter(Boolean)
|
|
3144
3096
|
);
|
|
@@ -3613,24 +3565,9 @@ var RuntimeEnv = {
|
|
|
3613
3565
|
writable: true,
|
|
3614
3566
|
value: state2
|
|
3615
3567
|
});
|
|
3616
|
-
const
|
|
3617
|
-
const
|
|
3618
|
-
|
|
3619
|
-
buildApplyExcludeMatcher(exclude.local_storage)
|
|
3620
|
-
);
|
|
3621
|
-
const sessionStorageResult = filterApplyEntries(
|
|
3622
|
-
state2.sessionStorage || {},
|
|
3623
|
-
buildApplyExcludeMatcher(exclude.session_storage)
|
|
3624
|
-
);
|
|
3625
|
-
const cookieMatcher = buildApplyExcludeMatcher(exclude.cookies);
|
|
3626
|
-
const skippedCookies = [];
|
|
3627
|
-
const localStorage = localStorageResult.payload;
|
|
3628
|
-
const sessionStorage = sessionStorageResult.payload;
|
|
3629
|
-
const cookies = (state2.cookies || []).filter((cookie) => {
|
|
3630
|
-
if (!cookieMatcher(cookie == null ? void 0 : cookie.name)) return true;
|
|
3631
|
-
skippedCookies.push(cookie.name);
|
|
3632
|
-
return false;
|
|
3633
|
-
}).map((cookie) => {
|
|
3568
|
+
const localStorage = state2.localStorage || {};
|
|
3569
|
+
const sessionStorage = state2.sessionStorage || {};
|
|
3570
|
+
const cookies = (state2.cookies || []).map((cookie) => {
|
|
3634
3571
|
const normalized = { ...cookie };
|
|
3635
3572
|
if (!normalized.path) {
|
|
3636
3573
|
normalized.path = "/";
|
|
@@ -3640,9 +3577,6 @@ var RuntimeEnv = {
|
|
|
3640
3577
|
}
|
|
3641
3578
|
return normalized;
|
|
3642
3579
|
}).filter(Boolean);
|
|
3643
|
-
logApplySkipped("cookies", skippedCookies);
|
|
3644
|
-
logApplySkipped("local_storage", localStorageResult.skipped);
|
|
3645
|
-
logApplySkipped("session_storage", sessionStorageResult.skipped);
|
|
3646
3580
|
if (cookies.length > 0) {
|
|
3647
3581
|
await page.context().addCookies(cookies);
|
|
3648
3582
|
}
|