patchright-core 1.52.4 → 1.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ThirdPartyNotices.txt +65 -123
- package/bin/reinstall_chrome_beta_mac.sh +1 -1
- package/bin/reinstall_chrome_stable_mac.sh +1 -1
- package/bin/reinstall_msedge_beta_mac.sh +1 -1
- package/bin/reinstall_msedge_dev_mac.sh +1 -1
- package/bin/reinstall_msedge_stable_mac.sh +1 -1
- package/browsers.json +14 -14
- package/index.js +1 -1
- package/lib/androidServerImpl.js +4 -2
- package/lib/browserServerImpl.js +47 -12
- package/lib/cli/program.js +116 -50
- package/lib/cli/programWithTestStub.js +1 -1
- package/lib/client/android.js +30 -34
- package/lib/client/browser.js +54 -17
- package/lib/client/browserContext.js +67 -71
- package/lib/client/browserType.js +25 -34
- package/lib/client/channelOwner.js +20 -24
- package/lib/client/connection.js +6 -10
- package/lib/client/electron.js +8 -3
- package/lib/client/elementHandle.js +18 -21
- package/lib/client/fetch.js +5 -3
- package/lib/client/frame.js +57 -35
- package/lib/client/input.js +3 -1
- package/lib/client/jsHandle.js +4 -0
- package/lib/client/localUtils.js +0 -1
- package/lib/client/locator.js +32 -28
- package/lib/client/network.js +5 -12
- package/lib/client/page.js +32 -32
- package/lib/client/playwright.js +6 -16
- package/lib/client/selectors.js +18 -38
- package/lib/client/timeoutSettings.js +12 -8
- package/lib/client/tracing.js +24 -20
- package/lib/client/waiter.js +2 -2
- package/lib/client/webSocket.js +4 -22
- package/lib/generated/bindingsControllerSource.js +28 -0
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/generated/storageScriptSource.js +28 -0
- package/lib/generated/utilityScriptSource.js +1 -1
- package/lib/generated/webSocketMockSource.js +12 -50
- package/lib/inProcessFactory.js +9 -6
- package/lib/outofprocess.js +0 -2
- package/lib/protocol/validator.js +423 -346
- package/lib/protocol/validatorPrimitives.js +18 -4
- package/lib/remote/playwrightConnection.js +29 -166
- package/lib/remote/playwrightServer.js +233 -35
- package/lib/server/android/android.js +97 -83
- package/lib/server/android/backendAdb.js +0 -2
- package/lib/server/bidi/bidiBrowser.js +139 -73
- package/lib/server/bidi/bidiChromium.js +23 -22
- package/lib/server/bidi/bidiExecutionContext.js +2 -1
- package/lib/server/bidi/bidiFirefox.js +17 -14
- package/lib/server/bidi/bidiInput.js +22 -22
- package/lib/server/bidi/bidiNetworkManager.js +8 -11
- package/lib/server/bidi/bidiPage.js +42 -86
- package/lib/server/bidi/third_party/bidiProtocol.js +5 -133
- package/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/lib/server/{dispatchers/selectorsDispatcher.js → bidi/third_party/bidiProtocolPermissions.js} +20 -18
- package/lib/server/browser.js +30 -21
- package/lib/server/browserContext.js +203 -165
- package/lib/server/browserType.js +109 -107
- package/lib/server/chromium/chromium.js +84 -69
- package/lib/server/chromium/chromiumSwitches.js +13 -20
- package/lib/server/chromium/crBrowser.js +74 -40
- package/lib/server/chromium/crConnection.js +8 -9
- package/lib/server/chromium/crCoverage.js +11 -8
- package/lib/server/chromium/crDragDrop.js +25 -20
- package/lib/server/chromium/crExecutionContext.js +2 -1
- package/lib/server/chromium/crInput.js +32 -29
- package/lib/server/chromium/crNetworkManager.js +45 -33
- package/lib/server/chromium/crPage.js +98 -73
- package/lib/server/chromium/crServiceWorker.js +13 -18
- package/lib/server/chromium/videoRecorder.js +10 -18
- package/lib/server/clock.js +51 -39
- package/lib/server/codegen/csharp.js +10 -5
- package/lib/server/codegen/java.js +1 -1
- package/lib/server/codegen/javascript.js +1 -1
- package/lib/server/codegen/jsonl.js +2 -1
- package/lib/server/codegen/language.js +22 -1
- package/lib/server/codegen/languages.js +4 -4
- package/lib/server/codegen/python.js +1 -1
- package/lib/server/cookieStore.js +3 -1
- package/lib/server/debugController.js +105 -71
- package/lib/server/debugger.js +6 -23
- package/lib/server/deviceDescriptorsSource.json +237 -127
- package/lib/server/dialog.js +50 -6
- package/lib/server/dispatchers/androidDispatcher.js +77 -62
- package/lib/server/dispatchers/artifactDispatcher.js +18 -18
- package/lib/server/dispatchers/browserContextDispatcher.js +141 -91
- package/lib/server/dispatchers/browserDispatcher.js +55 -88
- package/lib/server/dispatchers/browserTypeDispatcher.js +18 -9
- package/lib/server/dispatchers/cdpSessionDispatcher.js +4 -4
- package/lib/server/dispatchers/debugControllerDispatcher.js +12 -21
- package/lib/server/dispatchers/dialogDispatcher.js +4 -4
- package/lib/server/dispatchers/dispatcher.js +78 -53
- package/lib/server/dispatchers/electronDispatcher.js +19 -20
- package/lib/server/dispatchers/elementHandlerDispatcher.js +83 -93
- package/lib/server/dispatchers/frameDispatcher.js +99 -102
- package/lib/server/dispatchers/jsHandleDispatcher.js +21 -16
- package/lib/server/dispatchers/jsonPipeDispatcher.js +4 -4
- package/lib/server/dispatchers/localUtilsDispatcher.js +53 -59
- package/lib/server/dispatchers/networkDispatchers.js +41 -35
- package/lib/server/dispatchers/pageDispatcher.js +156 -107
- package/lib/server/dispatchers/playwrightDispatcher.js +37 -25
- package/lib/server/dispatchers/streamDispatcher.js +15 -8
- package/lib/server/dispatchers/tracingDispatcher.js +22 -13
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +46 -35
- package/lib/server/dispatchers/writableStreamDispatcher.js +16 -10
- package/lib/server/dom.js +198 -266
- package/lib/server/download.js +3 -3
- package/lib/server/electron/electron.js +96 -103
- package/lib/server/electron/loader.js +1 -1
- package/lib/server/fetch.js +22 -41
- package/lib/server/fileUploadUtils.js +1 -1
- package/lib/server/firefox/ffBrowser.js +79 -55
- package/lib/server/firefox/ffExecutionContext.js +2 -1
- package/lib/server/firefox/ffInput.js +23 -23
- package/lib/server/firefox/ffNetworkManager.js +8 -6
- package/lib/server/firefox/ffPage.js +39 -36
- package/lib/server/firefox/firefox.js +9 -10
- package/lib/server/frameSelectors.js +65 -22
- package/lib/server/frames.js +516 -544
- package/lib/server/har/harRecorder.js +1 -1
- package/lib/server/har/harTracer.js +4 -2
- package/lib/server/helper.js +3 -7
- package/lib/server/index.js +0 -3
- package/lib/server/input.js +47 -54
- package/lib/server/instrumentation.js +8 -14
- package/lib/server/javascript.js +9 -17
- package/lib/server/launchApp.js +48 -30
- package/lib/server/localUtils.js +45 -38
- package/lib/server/network.js +44 -10
- package/lib/server/page.js +233 -178
- package/lib/server/pageBinding.js +6 -7
- package/lib/server/playwright.js +4 -14
- package/lib/server/progress.js +57 -49
- package/lib/server/recorder/recorderApp.js +298 -95
- package/lib/server/recorder/recorderRunner.js +23 -24
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/recorder/recorderUtils.js +67 -10
- package/lib/server/recorder.js +284 -146
- package/lib/server/registry/index.js +83 -48
- package/lib/server/registry/nativeDeps.js +175 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +1 -1
- package/lib/server/screenshotter.js +84 -83
- package/lib/server/selectors.js +12 -12
- package/lib/server/socksClientCertificatesInterceptor.js +198 -136
- package/lib/server/trace/recorder/snapshotter.js +12 -19
- package/lib/server/trace/recorder/tracing.js +36 -27
- package/lib/server/trace/viewer/traceViewer.js +11 -20
- package/lib/server/transport.js +20 -22
- package/lib/server/utils/comparators.js +2 -2
- package/lib/server/utils/debug.js +3 -8
- package/lib/server/utils/debugLogger.js +8 -0
- package/lib/server/utils/hostPlatform.js +3 -1
- package/lib/server/utils/network.js +35 -25
- package/lib/server/utils/nodePlatform.js +1 -1
- package/lib/server/utils/processLauncher.js +4 -1
- package/lib/server/utils/wsServer.js +11 -17
- package/lib/server/webkit/webkit.js +5 -2
- package/lib/server/webkit/wkBrowser.js +51 -28
- package/lib/server/webkit/wkExecutionContext.js +2 -1
- package/lib/server/webkit/wkInput.js +25 -25
- package/lib/server/webkit/wkInterceptableRequest.js +1 -1
- package/lib/server/webkit/wkPage.js +80 -59
- package/lib/server/webkit/wkProvisionalPage.js +1 -1
- package/lib/server/webkit/wkWorkers.js +7 -7
- package/lib/utils/isomorphic/ariaSnapshot.js +13 -7
- package/lib/utils/isomorphic/cssParser.js +1 -2
- package/lib/utils/isomorphic/locatorGenerators.js +18 -0
- package/lib/utils/isomorphic/manualPromise.js +1 -2
- package/lib/utils/isomorphic/mimeType.js +1 -2
- package/lib/utils/isomorphic/multimap.js +1 -2
- package/lib/utils/isomorphic/oldUtilityScriptSerializers.js +248 -0
- package/lib/utils/isomorphic/protocolFormatter.js +78 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +318 -0
- package/lib/utils/isomorphic/selectorParser.js +3 -4
- package/lib/utils/isomorphic/stringUtils.js +3 -24
- package/lib/utils/isomorphic/time.js +9 -4
- package/lib/utils/isomorphic/timeoutRunner.js +3 -4
- package/lib/utils/isomorphic/traceUtils.js +2 -3
- package/lib/utils/isomorphic/urlMatch.js +21 -7
- package/lib/utils/isomorphic/utilityScriptSerializers.js +208 -205
- package/lib/utils.js +8 -2
- package/lib/utilsBundleImpl/index.js +160 -150
- package/lib/vite/htmlReport/index.html +17 -17
- package/lib/vite/recorder/assets/{codeMirrorModule-CXVeovup.js → codeMirrorModule-DzQ0k89p.js} +1 -1
- package/lib/vite/recorder/assets/{index-eHBmevrY.css → index-CI4HQ-Zb.css} +1 -1
- package/lib/vite/recorder/assets/index-D7C7daHH.js +184 -0
- package/lib/vite/recorder/index.html +3 -3
- package/lib/vite/traceViewer/assets/{codeMirrorModule-_GLjJL-7.js → codeMirrorModule-Di48jgWx.js} +1 -1
- package/lib/vite/traceViewer/assets/defaultSettingsView-szBn8781.js +256 -0
- package/lib/vite/traceViewer/defaultSettingsView.DVJHpiGt.css +1 -0
- package/lib/vite/traceViewer/index.BFsek2M6.css +1 -0
- package/lib/vite/traceViewer/index.DQvXoPLL.js +2 -0
- package/lib/vite/traceViewer/index.html +6 -6
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.dBV3oN9h.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +4 -4
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +1 -1
- package/types/protocol.d.ts +712 -107
- package/types/types.d.ts +148 -37
- package/lib/generated/consoleApiSource.js +0 -28
- package/lib/protocol/debug.js +0 -211
- package/lib/server/recorder/contextRecorder.js +0 -286
- package/lib/server/recorder/recorderCollection.js +0 -116
- package/lib/server/recorder/recorderFrontend.js +0 -16
- package/lib/server/storageScript.js +0 -154
- package/lib/server/timeoutSettings.js +0 -89
- package/lib/utils/isomorphic/builtins.js +0 -86
- package/lib/vite/recorder/assets/index-BsWQsSGl.js +0 -184
- package/lib/vite/traceViewer/assets/defaultSettingsView-DtCQiGHe.js +0 -265
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.cFZzK9RN.js +0 -2
- package/lib/vite/traceViewer/uiMode.XVPIqBeS.js +0 -5
|
@@ -25,8 +25,8 @@ __export(ariaSnapshot_exports, {
|
|
|
25
25
|
valueOrRegex: () => valueOrRegex
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(ariaSnapshot_exports);
|
|
28
|
-
function parseAriaSnapshotUnsafe(yaml, text) {
|
|
29
|
-
const result = parseAriaSnapshot(yaml, text);
|
|
28
|
+
function parseAriaSnapshotUnsafe(yaml, text, options = {}) {
|
|
29
|
+
const result = parseAriaSnapshot(yaml, text, options);
|
|
30
30
|
if (result.errors.length)
|
|
31
31
|
throw new Error(result.errors[0].message);
|
|
32
32
|
return result.fragment;
|
|
@@ -173,9 +173,9 @@ function parseAriaSnapshot(yaml, text, options = {}) {
|
|
|
173
173
|
convertSeq(fragment, yamlDoc.contents);
|
|
174
174
|
if (errors.length)
|
|
175
175
|
return { errors, fragment: emptyFragment };
|
|
176
|
-
if (fragment.children?.length === 1)
|
|
177
|
-
return { fragment: fragment.children[0], errors };
|
|
178
|
-
return { fragment, errors };
|
|
176
|
+
if (fragment.children?.length === 1 && (!fragment.containerMode || fragment.containerMode === "contain"))
|
|
177
|
+
return { fragment: fragment.children[0], errors: [] };
|
|
178
|
+
return { fragment, errors: [] };
|
|
179
179
|
}
|
|
180
180
|
const emptyFragment = { kind: "role", role: "fragment" };
|
|
181
181
|
function normalizeWhitespace(text) {
|
|
@@ -187,7 +187,7 @@ function valueOrRegex(value) {
|
|
|
187
187
|
class KeyParser {
|
|
188
188
|
static parse(text, options, errors) {
|
|
189
189
|
try {
|
|
190
|
-
return new KeyParser(text.value)._parse();
|
|
190
|
+
return new KeyParser(text.value, options)._parse();
|
|
191
191
|
} catch (e) {
|
|
192
192
|
if (e instanceof ParserError) {
|
|
193
193
|
const message = options.prettyErrors === false ? e.message : e.message + ":\n\n" + text.value + "\n" + " ".repeat(e.pos) + "^\n";
|
|
@@ -200,10 +200,11 @@ class KeyParser {
|
|
|
200
200
|
throw e;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
constructor(input) {
|
|
203
|
+
constructor(input, options) {
|
|
204
204
|
this._input = input;
|
|
205
205
|
this._pos = 0;
|
|
206
206
|
this._length = input.length;
|
|
207
|
+
this._options = options;
|
|
207
208
|
}
|
|
208
209
|
_peek() {
|
|
209
210
|
return this._input[this._pos] || "";
|
|
@@ -346,6 +347,11 @@ class KeyParser {
|
|
|
346
347
|
node.expanded = value === "true";
|
|
347
348
|
return;
|
|
348
349
|
}
|
|
350
|
+
if (key === "active") {
|
|
351
|
+
this._assert(value === "true" || value === "false", 'Value of "active" attribute must be a boolean', errorPos);
|
|
352
|
+
node.active = value === "true";
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
349
355
|
if (key === "level") {
|
|
350
356
|
this._assert(!isNaN(Number(value)), 'Value of "level" attribute must be a number', errorPos);
|
|
351
357
|
node.level = Number(value);
|
|
@@ -34,7 +34,6 @@ __export(cssParser_exports, {
|
|
|
34
34
|
serializeSelector: () => serializeSelector
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(cssParser_exports);
|
|
37
|
-
var import_builtins = require("./builtins");
|
|
38
37
|
var css = __toESM(require("./cssTokenizer"));
|
|
39
38
|
class InvalidSelectorError extends Error {
|
|
40
39
|
}
|
|
@@ -65,7 +64,7 @@ function parseCSS(selector, customNames) {
|
|
|
65
64
|
if (unsupportedToken)
|
|
66
65
|
throw new InvalidSelectorError(`Unsupported token "${unsupportedToken.toSource()}" while parsing css selector "${selector}". Did you mean to CSS.escape it?`);
|
|
67
66
|
let pos = 0;
|
|
68
|
-
const names = new
|
|
67
|
+
const names = /* @__PURE__ */ new Set();
|
|
69
68
|
function unexpected() {
|
|
70
69
|
return new InvalidSelectorError(`Unexpected token "${tokens[pos].toSource()}" while parsing css selector "${selector}". Did you mean to CSS.escape it?`);
|
|
71
70
|
}
|
|
@@ -24,11 +24,26 @@ __export(locatorGenerators_exports, {
|
|
|
24
24
|
JsonlLocatorFactory: () => JsonlLocatorFactory,
|
|
25
25
|
PythonLocatorFactory: () => PythonLocatorFactory,
|
|
26
26
|
asLocator: () => asLocator,
|
|
27
|
+
asLocatorDescription: () => asLocatorDescription,
|
|
27
28
|
asLocators: () => asLocators
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(locatorGenerators_exports);
|
|
30
31
|
var import_selectorParser = require("./selectorParser");
|
|
31
32
|
var import_stringUtils = require("./stringUtils");
|
|
33
|
+
function asLocatorDescription(lang, selector) {
|
|
34
|
+
try {
|
|
35
|
+
const parsed = (0, import_selectorParser.parseSelector)(selector);
|
|
36
|
+
const lastPart = parsed.parts[parsed.parts.length - 1];
|
|
37
|
+
if (lastPart?.name === "internal:describe") {
|
|
38
|
+
const description = JSON.parse(lastPart.body);
|
|
39
|
+
if (typeof description === "string")
|
|
40
|
+
return description;
|
|
41
|
+
}
|
|
42
|
+
return innerAsLocators(new generators[lang](), parsed, false, 1)[0];
|
|
43
|
+
} catch (e) {
|
|
44
|
+
return selector;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
function asLocator(lang, selector, isFrameLocator = false) {
|
|
33
48
|
return asLocators(lang, selector, isFrameLocator, 1)[0];
|
|
34
49
|
}
|
|
@@ -47,6 +62,8 @@ function innerAsLocators(factory, parsed, isFrameLocator = false, maxOutputSize
|
|
|
47
62
|
const part = parts[index];
|
|
48
63
|
const base = nextBase;
|
|
49
64
|
nextBase = "locator";
|
|
65
|
+
if (part.name === "internal:describe")
|
|
66
|
+
continue;
|
|
50
67
|
if (part.name === "nth") {
|
|
51
68
|
if (part.body === "0")
|
|
52
69
|
tokens.push([factory.generateLocator(base, "first", ""), factory.generateLocator(base, "nth", "0")]);
|
|
@@ -651,5 +668,6 @@ function isRegExp(obj) {
|
|
|
651
668
|
JsonlLocatorFactory,
|
|
652
669
|
PythonLocatorFactory,
|
|
653
670
|
asLocator,
|
|
671
|
+
asLocatorDescription,
|
|
654
672
|
asLocators
|
|
655
673
|
});
|
|
@@ -22,7 +22,6 @@ __export(manualPromise_exports, {
|
|
|
22
22
|
ManualPromise: () => ManualPromise
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(manualPromise_exports);
|
|
25
|
-
var import_builtins = require("./builtins");
|
|
26
25
|
var import_stackTrace = require("./stackTrace");
|
|
27
26
|
class ManualPromise extends Promise {
|
|
28
27
|
constructor() {
|
|
@@ -56,7 +55,7 @@ class ManualPromise extends Promise {
|
|
|
56
55
|
}
|
|
57
56
|
class LongStandingScope {
|
|
58
57
|
constructor() {
|
|
59
|
-
this._terminatePromises = new
|
|
58
|
+
this._terminatePromises = /* @__PURE__ */ new Map();
|
|
60
59
|
this._isClosed = false;
|
|
61
60
|
}
|
|
62
61
|
reject(error) {
|
|
@@ -23,7 +23,6 @@ __export(mimeType_exports, {
|
|
|
23
23
|
isTextualMimeType: () => isTextualMimeType
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(mimeType_exports);
|
|
26
|
-
var import_builtins = require("./builtins");
|
|
27
26
|
function isJsonMimeType(mimeType) {
|
|
28
27
|
return !!mimeType.match(/^(application\/json|application\/.*?\+json|text\/(x-)?json)(;\s*charset=.*)?$/);
|
|
29
28
|
}
|
|
@@ -37,7 +36,7 @@ function getMimeTypeForPath(path) {
|
|
|
37
36
|
const extension = path.substring(dotIndex + 1);
|
|
38
37
|
return types.get(extension) || null;
|
|
39
38
|
}
|
|
40
|
-
const types = new
|
|
39
|
+
const types = /* @__PURE__ */ new Map([
|
|
41
40
|
["ez", "application/andrew-inset"],
|
|
42
41
|
["aw", "application/applixware"],
|
|
43
42
|
["atom", "application/atom+xml"],
|
|
@@ -21,10 +21,9 @@ __export(multimap_exports, {
|
|
|
21
21
|
MultiMap: () => MultiMap
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(multimap_exports);
|
|
24
|
-
var import_builtins = require("./builtins");
|
|
25
24
|
class MultiMap {
|
|
26
25
|
constructor() {
|
|
27
|
-
this._map = new
|
|
26
|
+
this._map = /* @__PURE__ */ new Map();
|
|
28
27
|
}
|
|
29
28
|
set(key, value) {
|
|
30
29
|
let values = this._map.get(key);
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var oldUtilityScriptSerializers_exports = {};
|
|
20
|
+
__export(oldUtilityScriptSerializers_exports, {
|
|
21
|
+
source: () => source
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(oldUtilityScriptSerializers_exports);
|
|
24
|
+
function source() {
|
|
25
|
+
function isRegExp(obj) {
|
|
26
|
+
try {
|
|
27
|
+
return obj instanceof RegExp || Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
28
|
+
} catch (error) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function isDate(obj) {
|
|
33
|
+
try {
|
|
34
|
+
return obj instanceof Date || Object.prototype.toString.call(obj) === "[object Date]";
|
|
35
|
+
} catch (error) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function isURL(obj) {
|
|
40
|
+
try {
|
|
41
|
+
return obj instanceof URL || Object.prototype.toString.call(obj) === "[object URL]";
|
|
42
|
+
} catch (error) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function isError(obj) {
|
|
47
|
+
try {
|
|
48
|
+
return obj instanceof Error || obj && Object.getPrototypeOf(obj)?.name === "Error";
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function isTypedArray(obj, constructor) {
|
|
54
|
+
try {
|
|
55
|
+
return obj instanceof constructor || Object.prototype.toString.call(obj) === `[object ${constructor.name}]`;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const typedArrayConstructors = {
|
|
61
|
+
i8: Int8Array,
|
|
62
|
+
ui8: Uint8Array,
|
|
63
|
+
ui8c: Uint8ClampedArray,
|
|
64
|
+
i16: Int16Array,
|
|
65
|
+
ui16: Uint16Array,
|
|
66
|
+
i32: Int32Array,
|
|
67
|
+
ui32: Uint32Array,
|
|
68
|
+
// TODO: add Float16Array once it's in baseline
|
|
69
|
+
f32: Float32Array,
|
|
70
|
+
f64: Float64Array,
|
|
71
|
+
bi64: BigInt64Array,
|
|
72
|
+
bui64: BigUint64Array
|
|
73
|
+
};
|
|
74
|
+
function typedArrayToBase64(array) {
|
|
75
|
+
if ("toBase64" in array)
|
|
76
|
+
return array.toBase64();
|
|
77
|
+
const binary = Array.from(new Uint8Array(array.buffer, array.byteOffset, array.byteLength)).map((b) => String.fromCharCode(b)).join("");
|
|
78
|
+
return btoa(binary);
|
|
79
|
+
}
|
|
80
|
+
function base64ToTypedArray(base64, TypedArrayConstructor) {
|
|
81
|
+
const binary = atob(base64);
|
|
82
|
+
const bytes = new Uint8Array(binary.length);
|
|
83
|
+
for (let i = 0; i < binary.length; i++)
|
|
84
|
+
bytes[i] = binary.charCodeAt(i);
|
|
85
|
+
return new TypedArrayConstructor(bytes.buffer);
|
|
86
|
+
}
|
|
87
|
+
function parseEvaluationResultValue(value, handles = [], refs = /* @__PURE__ */ new Map()) {
|
|
88
|
+
if (Object.is(value, void 0))
|
|
89
|
+
return void 0;
|
|
90
|
+
if (typeof value === "object" && value) {
|
|
91
|
+
if ("ref" in value)
|
|
92
|
+
return refs.get(value.ref);
|
|
93
|
+
if ("v" in value) {
|
|
94
|
+
if (value.v === "undefined")
|
|
95
|
+
return void 0;
|
|
96
|
+
if (value.v === "null")
|
|
97
|
+
return null;
|
|
98
|
+
if (value.v === "NaN")
|
|
99
|
+
return NaN;
|
|
100
|
+
if (value.v === "Infinity")
|
|
101
|
+
return Infinity;
|
|
102
|
+
if (value.v === "-Infinity")
|
|
103
|
+
return -Infinity;
|
|
104
|
+
if (value.v === "-0")
|
|
105
|
+
return -0;
|
|
106
|
+
return void 0;
|
|
107
|
+
}
|
|
108
|
+
if ("d" in value)
|
|
109
|
+
return new Date(value.d);
|
|
110
|
+
if ("u" in value)
|
|
111
|
+
return new URL(value.u);
|
|
112
|
+
if ("bi" in value)
|
|
113
|
+
return BigInt(value.bi);
|
|
114
|
+
if ("e" in value) {
|
|
115
|
+
const error = new Error(value.e.m);
|
|
116
|
+
error.name = value.e.n;
|
|
117
|
+
error.stack = value.e.s;
|
|
118
|
+
return error;
|
|
119
|
+
}
|
|
120
|
+
if ("r" in value)
|
|
121
|
+
return new RegExp(value.r.p, value.r.f);
|
|
122
|
+
if ("a" in value) {
|
|
123
|
+
const result = [];
|
|
124
|
+
refs.set(value.id, result);
|
|
125
|
+
for (const a of value.a)
|
|
126
|
+
result.push(parseEvaluationResultValue(a, handles, refs));
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
if ("o" in value) {
|
|
130
|
+
const result = {};
|
|
131
|
+
refs.set(value.id, result);
|
|
132
|
+
for (const { k, v } of value.o)
|
|
133
|
+
result[k] = parseEvaluationResultValue(v, handles, refs);
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
if ("h" in value)
|
|
137
|
+
return handles[value.h];
|
|
138
|
+
if ("ta" in value)
|
|
139
|
+
return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);
|
|
140
|
+
}
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
function serializeAsCallArgument(value, handleSerializer) {
|
|
144
|
+
return serialize(value, handleSerializer, { visited: /* @__PURE__ */ new Map(), lastId: 0 });
|
|
145
|
+
}
|
|
146
|
+
function serialize(value, handleSerializer, visitorInfo) {
|
|
147
|
+
if (value && typeof value === "object") {
|
|
148
|
+
if (typeof globalThis.Window === "function" && value instanceof globalThis.Window)
|
|
149
|
+
return "ref: <Window>";
|
|
150
|
+
if (typeof globalThis.Document === "function" && value instanceof globalThis.Document)
|
|
151
|
+
return "ref: <Document>";
|
|
152
|
+
if (typeof globalThis.Node === "function" && value instanceof globalThis.Node)
|
|
153
|
+
return "ref: <Node>";
|
|
154
|
+
}
|
|
155
|
+
return innerSerialize(value, handleSerializer, visitorInfo);
|
|
156
|
+
}
|
|
157
|
+
function innerSerialize(value, handleSerializer, visitorInfo) {
|
|
158
|
+
const result = handleSerializer(value);
|
|
159
|
+
if ("fallThrough" in result)
|
|
160
|
+
value = result.fallThrough;
|
|
161
|
+
else
|
|
162
|
+
return result;
|
|
163
|
+
if (typeof value === "symbol")
|
|
164
|
+
return { v: "undefined" };
|
|
165
|
+
if (Object.is(value, void 0))
|
|
166
|
+
return { v: "undefined" };
|
|
167
|
+
if (Object.is(value, null))
|
|
168
|
+
return { v: "null" };
|
|
169
|
+
if (Object.is(value, NaN))
|
|
170
|
+
return { v: "NaN" };
|
|
171
|
+
if (Object.is(value, Infinity))
|
|
172
|
+
return { v: "Infinity" };
|
|
173
|
+
if (Object.is(value, -Infinity))
|
|
174
|
+
return { v: "-Infinity" };
|
|
175
|
+
if (Object.is(value, -0))
|
|
176
|
+
return { v: "-0" };
|
|
177
|
+
if (typeof value === "boolean")
|
|
178
|
+
return value;
|
|
179
|
+
if (typeof value === "number")
|
|
180
|
+
return value;
|
|
181
|
+
if (typeof value === "string")
|
|
182
|
+
return value;
|
|
183
|
+
if (typeof value === "bigint")
|
|
184
|
+
return { bi: value.toString() };
|
|
185
|
+
if (isError(value)) {
|
|
186
|
+
let stack;
|
|
187
|
+
if (value.stack?.startsWith(value.name + ": " + value.message)) {
|
|
188
|
+
stack = value.stack;
|
|
189
|
+
} else {
|
|
190
|
+
stack = `${value.name}: ${value.message}
|
|
191
|
+
${value.stack}`;
|
|
192
|
+
}
|
|
193
|
+
return { e: { n: value.name, m: value.message, s: stack } };
|
|
194
|
+
}
|
|
195
|
+
if (isDate(value))
|
|
196
|
+
return { d: value.toJSON() };
|
|
197
|
+
if (isURL(value))
|
|
198
|
+
return { u: value.toJSON() };
|
|
199
|
+
if (isRegExp(value))
|
|
200
|
+
return { r: { p: value.source, f: value.flags } };
|
|
201
|
+
for (const [k, ctor] of Object.entries(typedArrayConstructors)) {
|
|
202
|
+
if (isTypedArray(value, ctor))
|
|
203
|
+
return { ta: { b: typedArrayToBase64(value), k } };
|
|
204
|
+
}
|
|
205
|
+
const id = visitorInfo.visited.get(value);
|
|
206
|
+
if (id)
|
|
207
|
+
return { ref: id };
|
|
208
|
+
if (Array.isArray(value)) {
|
|
209
|
+
const a = [];
|
|
210
|
+
const id2 = ++visitorInfo.lastId;
|
|
211
|
+
visitorInfo.visited.set(value, id2);
|
|
212
|
+
for (let i = 0; i < value.length; ++i)
|
|
213
|
+
a.push(serialize(value[i], handleSerializer, visitorInfo));
|
|
214
|
+
return { a, id: id2 };
|
|
215
|
+
}
|
|
216
|
+
if (typeof value === "object") {
|
|
217
|
+
const o = [];
|
|
218
|
+
const id2 = ++visitorInfo.lastId;
|
|
219
|
+
visitorInfo.visited.set(value, id2);
|
|
220
|
+
for (const name of Object.keys(value)) {
|
|
221
|
+
let item;
|
|
222
|
+
try {
|
|
223
|
+
item = value[name];
|
|
224
|
+
} catch (e) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (name === "toJSON" && typeof item === "function")
|
|
228
|
+
o.push({ k: name, v: { o: [], id: 0 } });
|
|
229
|
+
else
|
|
230
|
+
o.push({ k: name, v: serialize(item, handleSerializer, visitorInfo) });
|
|
231
|
+
}
|
|
232
|
+
let jsonWrapper;
|
|
233
|
+
try {
|
|
234
|
+
if (o.length === 0 && value.toJSON && typeof value.toJSON === "function")
|
|
235
|
+
jsonWrapper = { value: value.toJSON() };
|
|
236
|
+
} catch (e) {
|
|
237
|
+
}
|
|
238
|
+
if (jsonWrapper)
|
|
239
|
+
return innerSerialize(jsonWrapper.value, handleSerializer, visitorInfo);
|
|
240
|
+
return { o, id: id2 };
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return { parseEvaluationResultValue, serializeAsCallArgument };
|
|
244
|
+
}
|
|
245
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
246
|
+
0 && (module.exports = {
|
|
247
|
+
source
|
|
248
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var protocolFormatter_exports = {};
|
|
20
|
+
__export(protocolFormatter_exports, {
|
|
21
|
+
formatProtocolParam: () => formatProtocolParam,
|
|
22
|
+
getActionGroup: () => getActionGroup,
|
|
23
|
+
renderTitleForCall: () => renderTitleForCall
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(protocolFormatter_exports);
|
|
26
|
+
var import_protocolMetainfo = require("./protocolMetainfo");
|
|
27
|
+
function formatProtocolParam(params, alternatives) {
|
|
28
|
+
if (!params)
|
|
29
|
+
return void 0;
|
|
30
|
+
for (const name of alternatives.split("|")) {
|
|
31
|
+
if (name === "url") {
|
|
32
|
+
try {
|
|
33
|
+
const urlObject = new URL(params[name]);
|
|
34
|
+
if (urlObject.protocol === "data:")
|
|
35
|
+
return urlObject.protocol;
|
|
36
|
+
if (urlObject.protocol === "about:")
|
|
37
|
+
return params[name];
|
|
38
|
+
return urlObject.pathname + urlObject.search;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (params[name] !== void 0)
|
|
41
|
+
return params[name];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (name === "timeNumber" && params[name] !== void 0) {
|
|
45
|
+
return new Date(params[name]).toString();
|
|
46
|
+
}
|
|
47
|
+
const value = deepParam(params, name);
|
|
48
|
+
if (value !== void 0)
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function deepParam(params, name) {
|
|
53
|
+
const tokens = name.split(".");
|
|
54
|
+
let current = params;
|
|
55
|
+
for (const token of tokens) {
|
|
56
|
+
if (typeof current !== "object" || current === null)
|
|
57
|
+
return void 0;
|
|
58
|
+
current = current[token];
|
|
59
|
+
}
|
|
60
|
+
if (current === void 0)
|
|
61
|
+
return void 0;
|
|
62
|
+
return String(current);
|
|
63
|
+
}
|
|
64
|
+
function renderTitleForCall(metadata) {
|
|
65
|
+
const titleFormat = metadata.title ?? import_protocolMetainfo.methodMetainfo.get(metadata.type + "." + metadata.method)?.title ?? metadata.method;
|
|
66
|
+
return titleFormat.replace(/\{([^}]+)\}/g, (fullMatch, p1) => {
|
|
67
|
+
return formatProtocolParam(metadata.params, p1) ?? fullMatch;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function getActionGroup(metadata) {
|
|
71
|
+
return import_protocolMetainfo.methodMetainfo.get(metadata.type + "." + metadata.method)?.group;
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
formatProtocolParam,
|
|
76
|
+
getActionGroup,
|
|
77
|
+
renderTitleForCall
|
|
78
|
+
});
|