@checkly/playwright-core 1.48.22 → 1.51.11-beta.1
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 +60 -48
- package/bin/reinstall_chrome_beta_linux.sh +10 -8
- package/bin/reinstall_chrome_stable_linux.sh +10 -8
- package/bin/reinstall_msedge_beta_linux.sh +17 -9
- package/bin/reinstall_msedge_dev_linux.sh +17 -9
- package/bin/reinstall_msedge_stable_linux.sh +17 -9
- package/browsers.json +33 -12
- package/index.js +0 -1
- package/lib/androidServerImpl.js +5 -5
- package/lib/browserServerImpl.js +18 -9
- package/lib/checkly/secretsFilter.js +1 -1
- package/lib/cli/driver.js +6 -6
- package/lib/cli/program.js +38 -43
- package/lib/cli/programWithTestStub.js +2 -1
- package/lib/client/android.js +37 -58
- package/lib/client/artifact.js +4 -7
- package/lib/client/browser.js +10 -15
- package/lib/client/browserContext.js +69 -62
- package/lib/client/browserType.js +30 -64
- package/lib/client/channelOwner.js +53 -68
- package/lib/client/clientHelper.js +4 -6
- package/lib/client/clientInstrumentation.js +2 -0
- package/lib/client/clientStackTrace.js +65 -0
- package/lib/client/connection.js +48 -41
- package/lib/client/consoleMessage.js +4 -7
- package/lib/client/electron.js +10 -10
- package/lib/client/elementHandle.js +32 -33
- package/lib/client/errors.js +2 -2
- package/lib/client/eventEmitter.js +5 -8
- package/lib/client/fetch.js +61 -62
- package/lib/client/fileUtils.js +31 -0
- package/lib/client/frame.js +22 -23
- package/lib/client/harRouter.js +7 -9
- package/lib/client/jsHandle.js +3 -4
- package/lib/client/localUtils.js +24 -0
- package/lib/client/locator.js +27 -13
- package/lib/client/network.js +44 -37
- package/lib/client/page.js +50 -41
- package/lib/client/platform.js +71 -0
- package/lib/client/playwright.js +21 -1
- package/lib/client/selectors.js +8 -2
- package/lib/client/stream.js +2 -21
- package/lib/client/timeoutSettings.js +65 -0
- package/lib/client/tracing.js +29 -7
- package/lib/client/video.js +2 -2
- package/lib/client/waiter.js +19 -16
- package/lib/client/webSocket.js +106 -0
- package/lib/client/worker.js +4 -4
- package/lib/client/writableStream.js +2 -21
- package/lib/generated/consoleApiSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/generated/recorderSource.js +7 -0
- package/lib/generated/webSocketMockSource.js +1 -1
- package/lib/inProcessFactory.js +8 -3
- package/lib/outofprocess.js +12 -8
- package/lib/protocol/debug.js +1 -1
- package/lib/protocol/validator.js +77 -11
- package/lib/protocol/validatorPrimitives.js +1 -2
- package/lib/remote/playwrightConnection.js +21 -12
- package/lib/remote/playwrightServer.js +22 -8
- package/lib/server/android/android.js +17 -14
- package/lib/server/android/backendAdb.js +14 -14
- package/lib/server/artifact.js +3 -3
- package/lib/server/bidi/bidiBrowser.js +11 -8
- package/lib/server/bidi/bidiChromium.js +5 -4
- package/lib/server/bidi/bidiConnection.js +1 -3
- package/lib/server/bidi/bidiExecutionContext.js +71 -25
- package/lib/server/bidi/bidiFirefox.js +4 -3
- package/lib/server/bidi/bidiInput.js +11 -12
- package/lib/server/bidi/bidiNetworkManager.js +11 -12
- package/lib/server/bidi/bidiOverCdp.js +2 -2
- package/lib/server/bidi/bidiPage.js +39 -66
- package/lib/server/bidi/third_party/bidiKeyboard.js +9 -7
- package/lib/server/bidi/third_party/firefoxPrefs.js +19 -3
- package/lib/server/browser.js +2 -2
- package/lib/server/browserContext.js +60 -55
- package/lib/server/browserType.js +22 -18
- package/lib/server/callLog.js +79 -0
- package/lib/server/chromium/chromium.js +20 -16
- package/lib/server/chromium/chromiumSwitches.js +32 -9
- package/lib/server/chromium/crBrowser.js +25 -24
- package/lib/server/chromium/crConnection.js +2 -2
- package/lib/server/chromium/crCoverage.js +1 -1
- package/lib/server/chromium/crDevTools.js +1 -1
- package/lib/server/chromium/crDragDrop.js +1 -1
- package/lib/server/chromium/crExecutionContext.js +26 -35
- package/lib/server/chromium/crInput.js +17 -6
- package/lib/server/chromium/crNetworkManager.js +3 -3
- package/lib/server/chromium/crPage.js +43 -55
- package/lib/server/chromium/crPdf.js +1 -1
- package/lib/server/chromium/crProtocolHelper.js +3 -3
- package/lib/server/chromium/crServiceWorker.js +2 -2
- package/lib/server/chromium/videoRecorder.js +2 -2
- package/lib/server/clock.js +1 -1
- package/lib/server/codegen/csharp.js +21 -16
- package/lib/server/codegen/java.js +17 -9
- package/lib/server/codegen/javascript.js +37 -7
- package/lib/server/codegen/jsonl.js +1 -1
- package/lib/server/codegen/languages.js +2 -2
- package/lib/server/codegen/python.js +14 -17
- package/lib/server/debugController.js +23 -45
- package/lib/server/debugger.js +1 -1
- package/lib/server/deviceDescriptors.js +1 -1
- package/lib/server/deviceDescriptorsSource.json +131 -131
- package/lib/server/dispatchers/androidDispatcher.js +14 -3
- package/lib/server/dispatchers/artifactDispatcher.js +3 -3
- package/lib/server/dispatchers/browserContextDispatcher.js +21 -32
- package/lib/server/dispatchers/browserTypeDispatcher.js +1 -1
- package/lib/server/dispatchers/cdpSessionDispatcher.js +1 -1
- package/lib/server/dispatchers/debugControllerDispatcher.js +5 -3
- package/lib/server/dispatchers/dispatcher.js +27 -25
- package/lib/server/dispatchers/electronDispatcher.js +3 -3
- package/lib/server/dispatchers/elementHandlerDispatcher.js +7 -2
- package/lib/server/dispatchers/frameDispatcher.js +9 -3
- package/lib/server/dispatchers/jsonPipeDispatcher.js +2 -2
- package/lib/server/dispatchers/localUtilsDispatcher.js +25 -291
- package/lib/server/dispatchers/networkDispatchers.js +3 -3
- package/lib/server/dispatchers/pageDispatcher.js +10 -8
- package/lib/server/dispatchers/playwrightDispatcher.js +5 -5
- package/lib/server/dispatchers/streamDispatcher.js +4 -3
- package/lib/server/dispatchers/tracingDispatcher.js +10 -0
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +18 -18
- package/lib/server/dispatchers/writableStreamDispatcher.js +5 -6
- package/lib/server/dom.js +102 -48
- package/lib/server/download.js +1 -1
- package/lib/server/electron/electron.js +17 -16
- package/lib/server/errors.js +1 -1
- package/lib/server/fetch.js +49 -33
- package/lib/server/fileUploadUtils.js +7 -4
- package/lib/server/firefox/ffBrowser.js +17 -9
- package/lib/server/firefox/ffConnection.js +1 -1
- package/lib/server/firefox/ffExecutionContext.js +25 -29
- package/lib/server/firefox/ffInput.js +15 -4
- package/lib/server/firefox/ffNetworkManager.js +3 -3
- package/lib/server/firefox/ffPage.js +29 -50
- package/lib/server/firefox/firefox.js +7 -9
- package/lib/server/frameSelectors.js +1 -1
- package/lib/server/frames.js +65 -55
- package/lib/server/har/harRecorder.js +4 -4
- package/lib/server/har/harTracer.js +8 -9
- package/lib/server/harBackend.js +157 -0
- package/lib/server/helper.js +2 -2
- package/lib/server/index.js +1 -14
- package/lib/server/input.js +3 -4
- package/lib/server/instrumentation.js +2 -2
- package/lib/server/isomorphic/utilityScriptSerializers.js +3 -0
- package/lib/server/javascript.js +26 -33
- package/lib/server/launchApp.js +7 -7
- package/lib/server/localUtils.js +203 -0
- package/lib/server/network.js +5 -5
- package/lib/server/page.js +76 -37
- package/lib/server/pipeTransport.js +1 -1
- package/lib/server/playwright.js +5 -5
- package/lib/server/progress.js +1 -4
- package/lib/server/protocolError.js +1 -1
- package/lib/server/recorder/chat.js +177 -0
- package/lib/server/recorder/codeGenerator.js +154 -0
- package/lib/server/recorder/contextRecorder.js +9 -18
- package/lib/server/recorder/csharp.js +311 -0
- package/lib/server/recorder/java.js +249 -0
- package/lib/server/recorder/javascript.js +230 -0
- package/lib/server/recorder/jsonl.js +48 -0
- package/lib/server/recorder/language.js +45 -0
- package/lib/server/recorder/python.js +276 -0
- package/lib/server/recorder/recorderActions.js +6 -0
- package/lib/server/recorder/recorderApp.js +25 -28
- package/lib/server/recorder/recorderCollection.js +9 -21
- package/lib/server/recorder/recorderInTraceViewer.js +1 -1
- package/lib/server/recorder/recorderRunner.js +7 -3
- package/lib/server/recorder/recorderUtils.js +5 -28
- package/lib/server/recorder/throttledFile.js +3 -4
- package/lib/server/recorder/utils.js +46 -0
- package/lib/server/recorder.js +83 -43
- package/lib/server/registry/browserFetcher.js +10 -8
- package/lib/server/registry/dependencies.js +20 -20
- package/lib/server/registry/index.js +215 -61
- package/lib/server/registry/nativeDeps.js +10 -4
- package/lib/server/registry/oopDownloadBrowserMain.js +3 -3
- package/lib/server/screenshotter.js +1 -1
- package/lib/server/selectors.js +3 -3
- package/lib/server/socksClientCertificatesInterceptor.js +8 -8
- package/lib/server/socksInterceptor.js +8 -5
- package/lib/server/storageScript.js +160 -0
- package/lib/server/timeoutSettings.js +74 -0
- package/lib/server/trace/recorder/snapshotter.js +10 -20
- package/lib/server/trace/recorder/snapshotterInjected.js +26 -1
- package/lib/server/trace/recorder/tracing.js +108 -45
- package/lib/server/trace/test/inMemorySnapshotter.js +6 -6
- package/lib/server/trace/viewer/traceViewer.js +21 -7
- package/lib/server/transport.js +3 -2
- package/lib/server/utils/ascii.js +31 -0
- package/lib/server/utils/comparators.js +159 -0
- package/lib/server/utils/crypto.js +171 -0
- package/lib/server/utils/debug.js +38 -0
- package/lib/server/utils/debugLogger.js +93 -0
- package/lib/server/utils/env.js +53 -0
- package/lib/server/utils/eventsHelper.js +38 -0
- package/lib/server/utils/expectUtils.js +33 -0
- package/lib/server/utils/fileUtils.js +204 -0
- package/lib/server/utils/happyEyeballs.js +207 -0
- package/lib/server/utils/hostPlatform.js +145 -0
- package/lib/server/utils/httpServer.js +233 -0
- package/lib/server/utils/image_tools/colorUtils.js +98 -0
- package/lib/server/utils/image_tools/compare.js +108 -0
- package/lib/server/utils/image_tools/imageChannel.js +70 -0
- package/lib/server/utils/image_tools/stats.js +102 -0
- package/lib/server/utils/linuxUtils.js +58 -0
- package/lib/server/utils/network.js +160 -0
- package/lib/server/utils/nodePlatform.js +140 -0
- package/lib/server/utils/pipeTransport.js +82 -0
- package/lib/server/utils/processLauncher.js +248 -0
- package/lib/server/utils/profiler.js +52 -0
- package/lib/server/utils/socksProxy.js +570 -0
- package/lib/server/utils/spawnAsync.js +45 -0
- package/lib/server/utils/task.js +58 -0
- package/lib/server/utils/userAgent.js +91 -0
- package/lib/server/utils/wsServer.js +128 -0
- package/lib/server/utils/zipFile.js +75 -0
- package/lib/server/utils/zones.js +54 -0
- package/lib/server/webkit/webkit.js +4 -4
- package/lib/server/webkit/wkBrowser.js +10 -10
- package/lib/server/webkit/wkConnection.js +1 -1
- package/lib/server/webkit/wkExecutionContext.js +26 -30
- package/lib/server/webkit/wkInput.js +17 -7
- package/lib/server/webkit/wkInterceptableRequest.js +2 -2
- package/lib/server/webkit/wkPage.js +80 -66
- package/lib/server/webkit/wkProvisionalPage.js +1 -1
- package/lib/server/webkit/wkWorkers.js +2 -2
- package/lib/utils/fileUtils.js +1 -1
- package/lib/utils/glob.js +84 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +392 -0
- package/lib/utils/isomorphic/assert.js +25 -0
- package/lib/utils/isomorphic/colors.js +65 -0
- package/lib/utils/isomorphic/cssParser.js +5 -5
- package/lib/utils/isomorphic/headers.js +52 -0
- package/lib/utils/isomorphic/locatorGenerators.js +38 -8
- package/lib/utils/isomorphic/locatorParser.js +19 -13
- package/lib/utils/isomorphic/manualPromise.js +107 -0
- package/lib/utils/isomorphic/mimeType.js +11 -3
- package/lib/utils/isomorphic/multimap.js +73 -0
- package/lib/utils/isomorphic/rtti.js +41 -0
- package/lib/utils/isomorphic/semaphore.js +51 -0
- package/lib/utils/isomorphic/stackTrace.js +169 -0
- package/lib/utils/isomorphic/stringUtils.js +31 -1
- package/lib/utils/isomorphic/time.js +25 -0
- package/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/lib/utils/isomorphic/traceUtils.js +23 -0
- package/lib/utils/isomorphic/types.js +5 -0
- package/lib/utils/isomorphic/urlMatch.js +7 -5
- package/lib/utils/mimeType.js +30 -0
- package/lib/utils/stackTrace.js +1 -1
- package/lib/utils.js +447 -0
- package/lib/utilsBundle.js +4 -29
- package/lib/utilsBundleImpl/index.js +188 -33
- package/lib/vite/htmlReport/index.html +20 -17
- package/lib/vite/recorder/assets/codeMirrorModule-B9YMkrwa.js +24 -0
- package/lib/vite/recorder/assets/index-ELPgmkwA.js +184 -0
- package/lib/vite/recorder/assets/{index-BW-aOBcL.css → index-eHBmevrY.css} +1 -1
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-gU1OOCQO.js +24 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-B5n_FjMx.js +1 -0
- package/lib/vite/traceViewer/assets/inspectorTab-6Tru8Mn_.js +235 -0
- package/lib/vite/traceViewer/assets/workbench-B_Nj4NA2.js +25 -0
- package/lib/vite/traceViewer/assets/{xtermModule-BeNbaIVa.js → xtermModule-BoAIEibi.js} +7 -7
- package/lib/vite/traceViewer/defaultSettingsView.CO3FR0CX.css +1 -0
- package/lib/vite/traceViewer/{embedded.BkvOrz5Z.js → embedded.DpNPH6mk.js} +2 -2
- package/lib/vite/traceViewer/embedded.html +6 -6
- package/lib/vite/traceViewer/index.CuE3SYGw.js +2 -0
- package/lib/vite/traceViewer/index.html +27 -9
- package/lib/vite/traceViewer/inspectorTab.CXDulcFG.css +1 -0
- package/lib/vite/traceViewer/{recorder.DNMfnSiu.js → recorder.BD-uZJs7.js} +2 -2
- package/lib/vite/traceViewer/recorder.html +4 -4
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/{uiMode.CAYqod-m.css → uiMode.BatfzHMG.css} +1 -1
- package/lib/vite/traceViewer/uiMode.DHrNgddz.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +8 -7
- package/lib/vite/traceViewer/workbench.B9vIAzH9.css +1 -0
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +7 -7
- package/types/protocol.d.ts +820 -153
- package/types/types.d.ts +285 -82
- package/bin/PrintDeps.exe +0 -0
- package/bin/README.md +0 -2
- package/lib/vite/recorder/assets/codeMirrorModule-d0KhC1qL.js +0 -24
- package/lib/vite/recorder/assets/index-Bxxcmxlu.js +0 -42
- package/lib/vite/traceViewer/assets/codeMirrorModule-pBPtArIT.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-tzBrK1V4.js +0 -24
- package/lib/vite/traceViewer/assets/inspectorTab-BuJ3wAX_.js +0 -64
- package/lib/vite/traceViewer/assets/inspectorTab-Soeeuvzv.js +0 -64
- package/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
- package/lib/vite/traceViewer/assets/workbench-DdmJ9AJV.js +0 -9
- package/lib/vite/traceViewer/assets/workbench-lypYlf00.js +0 -9
- package/lib/vite/traceViewer/embedded.DInvAijy.js +0 -2
- package/lib/vite/traceViewer/index.Dha3cgqs.js +0 -2
- package/lib/vite/traceViewer/index._Iolt-uE.js +0 -2
- package/lib/vite/traceViewer/inspectorTab.DLjBDrQR.css +0 -1
- package/lib/vite/traceViewer/recorder.DTSaNaly.js +0 -2
- package/lib/vite/traceViewer/uiMode.BM7yhjzl.js +0 -5
- package/lib/vite/traceViewer/uiMode.Cr1tvTWS.js +0 -5
- package/lib/vite/traceViewer/workbench.DlsCx8k5.css +0 -1
- /package/lib/vite/recorder/assets/{codeMirrorModule-ez37Vkbh.css → codeMirrorModule-C3UTv-Ge.css} +0 -0
- /package/lib/vite/traceViewer/{codeMirrorModule.ez37Vkbh.css → codeMirrorModule.C3UTv-Ge.css} +0 -0
- /package/lib/vite/traceViewer/{embedded.w7WN2u1R.css → embedded.mLhjB5IF.css} +0 -0
- /package/lib/vite/traceViewer/{index.CrbWWHbf.css → index.CFOW-Ezb.css} +0 -0
- /package/lib/vite/traceViewer/{recorder.B_SY1GJM.css → recorder.tn0RQdqM.css} +0 -0
- /package/lib/vite/traceViewer/{xtermModule.DSXBckUd.css → xtermModule.Beg8tuEN.css} +0 -0
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.PythonLocatorFactory = exports.JsonlLocatorFactory = exports.JavaScriptLocatorFactory = exports.JavaLocatorFactory = exports.CSharpLocatorFactory = void 0;
|
|
7
7
|
exports.asLocator = asLocator;
|
|
8
8
|
exports.asLocators = asLocators;
|
|
9
|
-
var _stringUtils = require("./stringUtils");
|
|
10
9
|
var _selectorParser = require("./selectorParser");
|
|
10
|
+
var _stringUtils = require("./stringUtils");
|
|
11
11
|
/**
|
|
12
12
|
* Copyright (c) Microsoft Corporation.
|
|
13
13
|
*
|
|
@@ -25,7 +25,7 @@ var _selectorParser = require("./selectorParser");
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
function asLocator(lang, selector, isFrameLocator = false) {
|
|
28
|
-
return asLocators(lang, selector, isFrameLocator)[0];
|
|
28
|
+
return asLocators(lang, selector, isFrameLocator, 1)[0];
|
|
29
29
|
}
|
|
30
30
|
function asLocators(lang, selector, isFrameLocator = false, maxOutputSize = 20, preferredQuote) {
|
|
31
31
|
try {
|
|
@@ -47,6 +47,10 @@ function innerAsLocators(factory, parsed, isFrameLocator = false, maxOutputSize
|
|
|
47
47
|
if (part.body === '0') tokens.push([factory.generateLocator(base, 'first', ''), factory.generateLocator(base, 'nth', '0')]);else if (part.body === '-1') tokens.push([factory.generateLocator(base, 'last', ''), factory.generateLocator(base, 'nth', '-1')]);else tokens.push([factory.generateLocator(base, 'nth', part.body)]);
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
|
+
if (part.name === 'visible') {
|
|
51
|
+
tokens.push([factory.generateLocator(base, 'visible', part.body), factory.generateLocator(base, 'default', `visible=${part.body}`)]);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
50
54
|
if (part.name === 'internal:text') {
|
|
51
55
|
const {
|
|
52
56
|
exact,
|
|
@@ -175,17 +179,27 @@ function innerAsLocators(factory, parsed, isFrameLocator = false, maxOutputSize
|
|
|
175
179
|
}
|
|
176
180
|
}
|
|
177
181
|
if (part.name === 'internal:control' && part.body === 'enter-frame') {
|
|
178
|
-
tokens.
|
|
182
|
+
// transform last tokens from `${selector}` into `${selector}.contentFrame()` and `frameLocator(${selector})`
|
|
183
|
+
const lastTokens = tokens[tokens.length - 1];
|
|
184
|
+
const lastPart = parts[index - 1];
|
|
185
|
+
const transformed = lastTokens.map(token => factory.chainLocators([token, factory.generateLocator(base, 'frame', '')]));
|
|
186
|
+
if (['xpath', 'css'].includes(lastPart.name)) {
|
|
187
|
+
transformed.push(factory.generateLocator(base, 'frame-locator', (0, _selectorParser.stringifySelector)({
|
|
188
|
+
parts: [lastPart]
|
|
189
|
+
})), factory.generateLocator(base, 'frame-locator', (0, _selectorParser.stringifySelector)({
|
|
190
|
+
parts: [lastPart]
|
|
191
|
+
}, true)));
|
|
192
|
+
}
|
|
193
|
+
lastTokens.splice(0, lastTokens.length, ...transformed);
|
|
179
194
|
nextBase = 'frame-locator';
|
|
180
195
|
continue;
|
|
181
196
|
}
|
|
182
|
-
let locatorType = 'default';
|
|
183
197
|
const nextPart = parts[index + 1];
|
|
184
198
|
const selectorPart = (0, _selectorParser.stringifySelector)({
|
|
185
199
|
parts: [part]
|
|
186
200
|
});
|
|
187
|
-
const locatorPart = factory.generateLocator(base,
|
|
188
|
-
if (
|
|
201
|
+
const locatorPart = factory.generateLocator(base, 'default', selectorPart);
|
|
202
|
+
if (nextPart && ['internal:has-text', 'internal:has-not-text'].includes(nextPart.name)) {
|
|
189
203
|
const {
|
|
190
204
|
exact,
|
|
191
205
|
text
|
|
@@ -213,7 +227,7 @@ function innerAsLocators(factory, parsed, isFrameLocator = false, maxOutputSize
|
|
|
213
227
|
const selectorPart = (0, _selectorParser.stringifySelector)({
|
|
214
228
|
parts: [part]
|
|
215
229
|
}, /* forceEngineName */true);
|
|
216
|
-
locatorPartWithEngine = factory.generateLocator(base,
|
|
230
|
+
locatorPartWithEngine = factory.generateLocator(base, 'default', selectorPart);
|
|
217
231
|
}
|
|
218
232
|
tokens.push([locatorPart, locatorPartWithEngine].filter(Boolean));
|
|
219
233
|
}
|
|
@@ -225,7 +239,7 @@ function combineTokens(factory, tokens, maxOutputSize) {
|
|
|
225
239
|
const visit = index => {
|
|
226
240
|
if (index === tokens.length) {
|
|
227
241
|
result.push(factory.chainLocators(currentTokens));
|
|
228
|
-
return
|
|
242
|
+
return result.length < maxOutputSize;
|
|
229
243
|
}
|
|
230
244
|
for (const taken of tokens[index]) {
|
|
231
245
|
currentTokens[index] = taken;
|
|
@@ -267,6 +281,8 @@ class JavaScriptLocatorFactory {
|
|
|
267
281
|
if (options.hasText !== undefined) return `locator(${this.quote(body)}, { hasText: ${this.toHasText(options.hasText)} })`;
|
|
268
282
|
if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, { hasNotText: ${this.toHasText(options.hasNotText)} })`;
|
|
269
283
|
return `locator(${this.quote(body)})`;
|
|
284
|
+
case 'frame-locator':
|
|
285
|
+
return `frameLocator(${this.quote(body)})`;
|
|
270
286
|
case 'frame':
|
|
271
287
|
return `contentFrame()`;
|
|
272
288
|
case 'nth':
|
|
@@ -275,6 +291,8 @@ class JavaScriptLocatorFactory {
|
|
|
275
291
|
return `first()`;
|
|
276
292
|
case 'last':
|
|
277
293
|
return `last()`;
|
|
294
|
+
case 'visible':
|
|
295
|
+
return `filter({ visible: ${body === 'true' ? 'true' : 'false'} })`;
|
|
278
296
|
case 'role':
|
|
279
297
|
const attrs = [];
|
|
280
298
|
if (isRegExp(options.name)) {
|
|
@@ -350,6 +368,8 @@ class PythonLocatorFactory {
|
|
|
350
368
|
if (options.hasText !== undefined) return `locator(${this.quote(body)}, has_text=${this.toHasText(options.hasText)})`;
|
|
351
369
|
if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, has_not_text=${this.toHasText(options.hasNotText)})`;
|
|
352
370
|
return `locator(${this.quote(body)})`;
|
|
371
|
+
case 'frame-locator':
|
|
372
|
+
return `frame_locator(${this.quote(body)})`;
|
|
353
373
|
case 'frame':
|
|
354
374
|
return `content_frame`;
|
|
355
375
|
case 'nth':
|
|
@@ -358,6 +378,8 @@ class PythonLocatorFactory {
|
|
|
358
378
|
return `first`;
|
|
359
379
|
case 'last':
|
|
360
380
|
return `last`;
|
|
381
|
+
case 'visible':
|
|
382
|
+
return `filter(visible=${body === 'true' ? 'True' : 'False'})`;
|
|
361
383
|
case 'role':
|
|
362
384
|
const attrs = [];
|
|
363
385
|
if (isRegExp(options.name)) {
|
|
@@ -450,6 +472,8 @@ class JavaLocatorFactory {
|
|
|
450
472
|
if (options.hasText !== undefined) return `locator(${this.quote(body)}, new ${clazz}.LocatorOptions().setHasText(${this.toHasText(options.hasText)}))`;
|
|
451
473
|
if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, new ${clazz}.LocatorOptions().setHasNotText(${this.toHasText(options.hasNotText)}))`;
|
|
452
474
|
return `locator(${this.quote(body)})`;
|
|
475
|
+
case 'frame-locator':
|
|
476
|
+
return `frameLocator(${this.quote(body)})`;
|
|
453
477
|
case 'frame':
|
|
454
478
|
return `contentFrame()`;
|
|
455
479
|
case 'nth':
|
|
@@ -458,6 +482,8 @@ class JavaLocatorFactory {
|
|
|
458
482
|
return `first()`;
|
|
459
483
|
case 'last':
|
|
460
484
|
return `last()`;
|
|
485
|
+
case 'visible':
|
|
486
|
+
return `filter(new ${clazz}.FilterOptions().setVisible(${body === 'true' ? 'true' : 'false'}))`;
|
|
461
487
|
case 'role':
|
|
462
488
|
const attrs = [];
|
|
463
489
|
if (isRegExp(options.name)) {
|
|
@@ -534,6 +560,8 @@ class CSharpLocatorFactory {
|
|
|
534
560
|
if (options.hasText !== undefined) return `Locator(${this.quote(body)}, new() { ${this.toHasText(options.hasText)} })`;
|
|
535
561
|
if (options.hasNotText !== undefined) return `Locator(${this.quote(body)}, new() { ${this.toHasNotText(options.hasNotText)} })`;
|
|
536
562
|
return `Locator(${this.quote(body)})`;
|
|
563
|
+
case 'frame-locator':
|
|
564
|
+
return `FrameLocator(${this.quote(body)})`;
|
|
537
565
|
case 'frame':
|
|
538
566
|
return `ContentFrame`;
|
|
539
567
|
case 'nth':
|
|
@@ -542,6 +570,8 @@ class CSharpLocatorFactory {
|
|
|
542
570
|
return `First`;
|
|
543
571
|
case 'last':
|
|
544
572
|
return `Last`;
|
|
573
|
+
case 'visible':
|
|
574
|
+
return `Filter(new() { Visible = ${body === 'true' ? 'true' : 'false'} })`;
|
|
545
575
|
case 'role':
|
|
546
576
|
const attrs = [];
|
|
547
577
|
if (isRegExp(options.name)) {
|
|
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.locatorOrSelectorAsSelector = locatorOrSelectorAsSelector;
|
|
7
|
-
|
|
7
|
+
exports.unsafeLocatorOrSelectorAsSelector = unsafeLocatorOrSelectorAsSelector;
|
|
8
8
|
var _locatorGenerators = require("./locatorGenerators");
|
|
9
9
|
var _selectorParser = require("./selectorParser");
|
|
10
|
+
var _stringUtils = require("./stringUtils");
|
|
10
11
|
/**
|
|
11
12
|
* Copyright (c) Microsoft Corporation.
|
|
12
13
|
*
|
|
@@ -66,7 +67,7 @@ function parseLocator(locator, testIdAttributeName) {
|
|
|
66
67
|
template = template.toLowerCase().replace(/get_by_alt_text/g, 'getbyalttext').replace(/get_by_test_id/g, 'getbytestid').replace(/get_by_([\w]+)/g, 'getby$1').replace(/has_not_text/g, 'hasnottext').replace(/has_text/g, 'hastext').replace(/has_not/g, 'hasnot').replace(/frame_locator/g, 'framelocator').replace(/content_frame/g, 'contentframe').replace(/[{}\s]/g, '').replace(/new\(\)/g, '').replace(/new[\w]+\.[\w]+options\(\)/g, '').replace(/\.set/g, ',set').replace(/\.or_\(/g, 'or(') // Python has "or_" instead of "or".
|
|
67
68
|
.replace(/\.and_\(/g, 'and(') // Python has "and_" instead of "and".
|
|
68
69
|
.replace(/:/g, '=').replace(/,re\.ignorecase/g, 'i').replace(/,pattern.case_insensitive/g, 'i').replace(/,regexoptions.ignorecase/g, 'i').replace(/re.compile\(([^)]+)\)/g, '$1') // Python has regex strings as r"foo"
|
|
69
|
-
.replace(/pattern.compile\(([^)]+)\)/g, 'r$1').replace(/newregex\(([^)]+)\)/g, 'r$1').replace(/string=/g, '=').replace(/regex=/g, '=').replace(/,,/g, ',');
|
|
70
|
+
.replace(/pattern.compile\(([^)]+)\)/g, 'r$1').replace(/newregex\(([^)]+)\)/g, 'r$1').replace(/string=/g, '=').replace(/regex=/g, '=').replace(/,,/g, ',').replace(/,\)/g, ')');
|
|
70
71
|
const preferredQuote = params.map(p => p.quote).filter(quote => '\'"`'.includes(quote))[0];
|
|
71
72
|
return {
|
|
72
73
|
selector: transform(template, params, testIdAttributeName),
|
|
@@ -123,7 +124,7 @@ function transform(template, params, testIdAttributeName) {
|
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
// Transform to selector engines.
|
|
126
|
-
template = template.replace(/\,set([\w]+)\(([^)]+)\)/g, (_, group1, group2) => ',' + group1.toLowerCase() + '=' + group2.toLowerCase()).replace(/framelocator\(([^)]+)\)/g, '$1.internal:control=enter-frame').replace(/contentframe(\(\))?/g, 'internal:control=enter-frame').replace(/locator\(([^)]+),hastext=([^),]+)\)/g, 'locator($1).internal:has-text=$2').replace(/locator\(([^)]+),hasnottext=([^),]+)\)/g, 'locator($1).internal:has-not-text=$2').replace(/locator\(([^)]+),hastext=([^),]+)\)/g, 'locator($1).internal:has-text=$2').replace(/locator\(([^)]+)\)/g, '$1').replace(/getbyrole\(([^)]+)\)/g, 'internal:role=$1').replace(/getbytext\(([^)]+)\)/g, 'internal:text=$1').replace(/getbylabel\(([^)]+)\)/g, 'internal:label=$1').replace(/getbytestid\(([^)]+)\)/g, `internal:testid=[${testIdAttributeName}=$1]`).replace(/getby(placeholder|alt|title)(?:text)?\(([^)]+)\)/g, 'internal:attr=[$1=$2]').replace(/first(\(\))?/g, 'nth=0').replace(/last(\(\))?/g, 'nth=-1').replace(/nth\(([^)]+)\)/g, 'nth=$1').replace(/filter\(,?hastext=([^)]+)\)/g, 'internal:has-text=$1').replace(/filter\(,?hasnottext=([^)]+)\)/g, 'internal:has-not-text=$1').replace(/filter\(,?has2=([^)]+)\)/g, 'internal:has=$1').replace(/filter\(,?hasnot2=([^)]+)\)/g, 'internal:has-not=$1').replace(/,exact=false/g, '').replace(/,exact=true/g, 's').replace(/\,/g, '][');
|
|
127
|
+
template = template.replace(/\,set([\w]+)\(([^)]+)\)/g, (_, group1, group2) => ',' + group1.toLowerCase() + '=' + group2.toLowerCase()).replace(/framelocator\(([^)]+)\)/g, '$1.internal:control=enter-frame').replace(/contentframe(\(\))?/g, 'internal:control=enter-frame').replace(/locator\(([^)]+),hastext=([^),]+)\)/g, 'locator($1).internal:has-text=$2').replace(/locator\(([^)]+),hasnottext=([^),]+)\)/g, 'locator($1).internal:has-not-text=$2').replace(/locator\(([^)]+),hastext=([^),]+)\)/g, 'locator($1).internal:has-text=$2').replace(/locator\(([^)]+)\)/g, '$1').replace(/getbyrole\(([^)]+)\)/g, 'internal:role=$1').replace(/getbytext\(([^)]+)\)/g, 'internal:text=$1').replace(/getbylabel\(([^)]+)\)/g, 'internal:label=$1').replace(/getbytestid\(([^)]+)\)/g, `internal:testid=[${testIdAttributeName}=$1]`).replace(/getby(placeholder|alt|title)(?:text)?\(([^)]+)\)/g, 'internal:attr=[$1=$2]').replace(/first(\(\))?/g, 'nth=0').replace(/last(\(\))?/g, 'nth=-1').replace(/nth\(([^)]+)\)/g, 'nth=$1').replace(/filter\(,?visible=true\)/g, 'visible=true').replace(/filter\(,?visible=false\)/g, 'visible=false').replace(/filter\(,?hastext=([^)]+)\)/g, 'internal:has-text=$1').replace(/filter\(,?hasnottext=([^)]+)\)/g, 'internal:has-not-text=$1').replace(/filter\(,?has2=([^)]+)\)/g, 'internal:has=$1').replace(/filter\(,?hasnot2=([^)]+)\)/g, 'internal:has-not=$1').replace(/,exact=false/g, '').replace(/,exact=true/g, 's').replace(/,includehidden=/g, ',include-hidden=').replace(/\,/g, '][');
|
|
127
128
|
const parts = template.split('.');
|
|
128
129
|
// Turn "internal:control=enter-frame >> nth=0" into "nth=0 >> internal:control=enter-frame"
|
|
129
130
|
// because these are swapped in locators vs selectors.
|
|
@@ -157,23 +158,28 @@ function transform(template, params, testIdAttributeName) {
|
|
|
157
158
|
}).join(' >> ');
|
|
158
159
|
}
|
|
159
160
|
function locatorOrSelectorAsSelector(language, locator, testIdAttributeName) {
|
|
161
|
+
try {
|
|
162
|
+
return unsafeLocatorOrSelectorAsSelector(language, locator, testIdAttributeName);
|
|
163
|
+
} catch (e) {
|
|
164
|
+
return '';
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function unsafeLocatorOrSelectorAsSelector(language, locator, testIdAttributeName) {
|
|
160
168
|
try {
|
|
161
169
|
(0, _selectorParser.parseSelector)(locator);
|
|
162
170
|
return locator;
|
|
163
171
|
} catch (e) {}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (locators.some(candidate => digestForComparison(language, candidate) === digest)) return selector;
|
|
172
|
-
} catch (e) {}
|
|
172
|
+
const {
|
|
173
|
+
selector,
|
|
174
|
+
preferredQuote
|
|
175
|
+
} = parseLocator(locator, testIdAttributeName);
|
|
176
|
+
const locators = (0, _locatorGenerators.asLocators)(language, selector, undefined, undefined, preferredQuote);
|
|
177
|
+
const digest = digestForComparison(language, locator);
|
|
178
|
+
if (locators.some(candidate => digestForComparison(language, candidate) === digest)) return selector;
|
|
173
179
|
return '';
|
|
174
180
|
}
|
|
175
181
|
function digestForComparison(language, locator) {
|
|
176
182
|
locator = locator.replace(/\s/g, '');
|
|
177
|
-
if (language === 'javascript') locator = locator.replace(/\\?["`]/g, '\'');
|
|
183
|
+
if (language === 'javascript') locator = locator.replace(/\\?["`]/g, '\'').replace(/,{}/g, '');
|
|
178
184
|
return locator;
|
|
179
185
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ManualPromise = exports.LongStandingScope = void 0;
|
|
7
|
+
var _stackTrace = require("./stackTrace");
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) Microsoft Corporation.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
class ManualPromise extends Promise {
|
|
25
|
+
constructor() {
|
|
26
|
+
let resolve;
|
|
27
|
+
let reject;
|
|
28
|
+
super((f, r) => {
|
|
29
|
+
resolve = f;
|
|
30
|
+
reject = r;
|
|
31
|
+
});
|
|
32
|
+
this._resolve = void 0;
|
|
33
|
+
this._reject = void 0;
|
|
34
|
+
this._isDone = void 0;
|
|
35
|
+
this._isDone = false;
|
|
36
|
+
this._resolve = resolve;
|
|
37
|
+
this._reject = reject;
|
|
38
|
+
}
|
|
39
|
+
isDone() {
|
|
40
|
+
return this._isDone;
|
|
41
|
+
}
|
|
42
|
+
resolve(t) {
|
|
43
|
+
this._isDone = true;
|
|
44
|
+
this._resolve(t);
|
|
45
|
+
}
|
|
46
|
+
reject(e) {
|
|
47
|
+
this._isDone = true;
|
|
48
|
+
this._reject(e);
|
|
49
|
+
}
|
|
50
|
+
static get [Symbol.species]() {
|
|
51
|
+
return Promise;
|
|
52
|
+
}
|
|
53
|
+
get [Symbol.toStringTag]() {
|
|
54
|
+
return 'ManualPromise';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.ManualPromise = ManualPromise;
|
|
58
|
+
class LongStandingScope {
|
|
59
|
+
constructor() {
|
|
60
|
+
this._terminateError = void 0;
|
|
61
|
+
this._closeError = void 0;
|
|
62
|
+
this._terminatePromises = new Map();
|
|
63
|
+
this._isClosed = false;
|
|
64
|
+
}
|
|
65
|
+
reject(error) {
|
|
66
|
+
this._isClosed = true;
|
|
67
|
+
this._terminateError = error;
|
|
68
|
+
for (const p of this._terminatePromises.keys()) p.resolve(error);
|
|
69
|
+
}
|
|
70
|
+
close(error) {
|
|
71
|
+
this._isClosed = true;
|
|
72
|
+
this._closeError = error;
|
|
73
|
+
for (const [p, frames] of this._terminatePromises) p.resolve(cloneError(error, frames));
|
|
74
|
+
}
|
|
75
|
+
isClosed() {
|
|
76
|
+
return this._isClosed;
|
|
77
|
+
}
|
|
78
|
+
static async raceMultiple(scopes, promise) {
|
|
79
|
+
return Promise.race(scopes.map(s => s.race(promise)));
|
|
80
|
+
}
|
|
81
|
+
async race(promise) {
|
|
82
|
+
return this._race(Array.isArray(promise) ? promise : [promise], false);
|
|
83
|
+
}
|
|
84
|
+
async safeRace(promise, defaultValue) {
|
|
85
|
+
return this._race([promise], true, defaultValue);
|
|
86
|
+
}
|
|
87
|
+
async _race(promises, safe, defaultValue) {
|
|
88
|
+
const terminatePromise = new ManualPromise();
|
|
89
|
+
const frames = (0, _stackTrace.captureRawStack)();
|
|
90
|
+
if (this._terminateError) terminatePromise.resolve(this._terminateError);
|
|
91
|
+
if (this._closeError) terminatePromise.resolve(cloneError(this._closeError, frames));
|
|
92
|
+
this._terminatePromises.set(terminatePromise, frames);
|
|
93
|
+
try {
|
|
94
|
+
return await Promise.race([terminatePromise.then(e => safe ? defaultValue : Promise.reject(e)), ...promises]);
|
|
95
|
+
} finally {
|
|
96
|
+
this._terminatePromises.delete(terminatePromise);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.LongStandingScope = LongStandingScope;
|
|
101
|
+
function cloneError(error, frames) {
|
|
102
|
+
const clone = new Error();
|
|
103
|
+
clone.name = error.name;
|
|
104
|
+
clone.message = error.message;
|
|
105
|
+
clone.stack = [error.name + ':' + error.message, ...frames].join('\n');
|
|
106
|
+
return clone;
|
|
107
|
+
}
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getMimeTypeForPath = getMimeTypeForPath;
|
|
6
7
|
exports.isJsonMimeType = isJsonMimeType;
|
|
7
8
|
exports.isTextualMimeType = isTextualMimeType;
|
|
8
9
|
/**
|
|
9
10
|
* Copyright (c) Microsoft Corporation.
|
|
10
11
|
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
12
13
|
* you may not use this file except in compliance with the License.
|
|
13
14
|
* You may obtain a copy of the License at
|
|
14
15
|
*
|
|
15
16
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
17
|
*
|
|
17
18
|
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an
|
|
19
|
+
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
19
20
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
21
|
* See the License for the specific language governing permissions and
|
|
21
22
|
* limitations under the License.
|
|
@@ -26,4 +27,11 @@ function isJsonMimeType(mimeType) {
|
|
|
26
27
|
}
|
|
27
28
|
function isTextualMimeType(mimeType) {
|
|
28
29
|
return !!mimeType.match(/^(text\/.*?|application\/(json|(x-)?javascript|xml.*?|ecmascript|graphql|x-www-form-urlencoded)|image\/svg(\+xml)?|application\/.*?(\+json|\+xml))(;\s*charset=.*)?$/);
|
|
29
|
-
}
|
|
30
|
+
}
|
|
31
|
+
function getMimeTypeForPath(path) {
|
|
32
|
+
const dotIndex = path.lastIndexOf('.');
|
|
33
|
+
if (dotIndex === -1) return null;
|
|
34
|
+
const extension = path.substring(dotIndex + 1);
|
|
35
|
+
return types.get(extension) || null;
|
|
36
|
+
}
|
|
37
|
+
const types = new Map([['ez', 'application/andrew-inset'], ['aw', 'application/applixware'], ['atom', 'application/atom+xml'], ['atomcat', 'application/atomcat+xml'], ['atomdeleted', 'application/atomdeleted+xml'], ['atomsvc', 'application/atomsvc+xml'], ['dwd', 'application/atsc-dwd+xml'], ['held', 'application/atsc-held+xml'], ['rsat', 'application/atsc-rsat+xml'], ['bdoc', 'application/bdoc'], ['xcs', 'application/calendar+xml'], ['ccxml', 'application/ccxml+xml'], ['cdfx', 'application/cdfx+xml'], ['cdmia', 'application/cdmi-capability'], ['cdmic', 'application/cdmi-container'], ['cdmid', 'application/cdmi-domain'], ['cdmio', 'application/cdmi-object'], ['cdmiq', 'application/cdmi-queue'], ['cu', 'application/cu-seeme'], ['mpd', 'application/dash+xml'], ['davmount', 'application/davmount+xml'], ['dbk', 'application/docbook+xml'], ['dssc', 'application/dssc+der'], ['xdssc', 'application/dssc+xml'], ['ecma', 'application/ecmascript'], ['es', 'application/ecmascript'], ['emma', 'application/emma+xml'], ['emotionml', 'application/emotionml+xml'], ['epub', 'application/epub+zip'], ['exi', 'application/exi'], ['exp', 'application/express'], ['fdt', 'application/fdt+xml'], ['pfr', 'application/font-tdpfr'], ['geojson', 'application/geo+json'], ['gml', 'application/gml+xml'], ['gpx', 'application/gpx+xml'], ['gxf', 'application/gxf'], ['gz', 'application/gzip'], ['hjson', 'application/hjson'], ['stk', 'application/hyperstudio'], ['ink', 'application/inkml+xml'], ['inkml', 'application/inkml+xml'], ['ipfix', 'application/ipfix'], ['its', 'application/its+xml'], ['ear', 'application/java-archive'], ['jar', 'application/java-archive'], ['war', 'application/java-archive'], ['ser', 'application/java-serialized-object'], ['class', 'application/java-vm'], ['js', 'application/javascript'], ['mjs', 'application/javascript'], ['json', 'application/json'], ['map', 'application/json'], ['json5', 'application/json5'], ['jsonml', 'application/jsonml+json'], ['jsonld', 'application/ld+json'], ['lgr', 'application/lgr+xml'], ['lostxml', 'application/lost+xml'], ['hqx', 'application/mac-binhex40'], ['cpt', 'application/mac-compactpro'], ['mads', 'application/mads+xml'], ['webmanifest', 'application/manifest+json'], ['mrc', 'application/marc'], ['mrcx', 'application/marcxml+xml'], ['ma', 'application/mathematica'], ['mb', 'application/mathematica'], ['nb', 'application/mathematica'], ['mathml', 'application/mathml+xml'], ['mbox', 'application/mbox'], ['mscml', 'application/mediaservercontrol+xml'], ['metalink', 'application/metalink+xml'], ['meta4', 'application/metalink4+xml'], ['mets', 'application/mets+xml'], ['maei', 'application/mmt-aei+xml'], ['musd', 'application/mmt-usd+xml'], ['mods', 'application/mods+xml'], ['m21', 'application/mp21'], ['mp21', 'application/mp21'], ['m4p', 'application/mp4'], ['mp4s', 'application/mp4'], ['doc', 'application/msword'], ['dot', 'application/msword'], ['mxf', 'application/mxf'], ['nq', 'application/n-quads'], ['nt', 'application/n-triples'], ['cjs', 'application/node'], ['bin', 'application/octet-stream'], ['bpk', 'application/octet-stream'], ['buffer', 'application/octet-stream'], ['deb', 'application/octet-stream'], ['deploy', 'application/octet-stream'], ['dist', 'application/octet-stream'], ['distz', 'application/octet-stream'], ['dll', 'application/octet-stream'], ['dmg', 'application/octet-stream'], ['dms', 'application/octet-stream'], ['dump', 'application/octet-stream'], ['elc', 'application/octet-stream'], ['exe', 'application/octet-stream'], ['img', 'application/octet-stream'], ['iso', 'application/octet-stream'], ['lrf', 'application/octet-stream'], ['mar', 'application/octet-stream'], ['msi', 'application/octet-stream'], ['msm', 'application/octet-stream'], ['msp', 'application/octet-stream'], ['pkg', 'application/octet-stream'], ['so', 'application/octet-stream'], ['oda', 'application/oda'], ['opf', 'application/oebps-package+xml'], ['ogx', 'application/ogg'], ['omdoc', 'application/omdoc+xml'], ['onepkg', 'application/onenote'], ['onetmp', 'application/onenote'], ['onetoc', 'application/onenote'], ['onetoc2', 'application/onenote'], ['oxps', 'application/oxps'], ['relo', 'application/p2p-overlay+xml'], ['xer', 'application/patch-ops-error+xml'], ['pdf', 'application/pdf'], ['pgp', 'application/pgp-encrypted'], ['asc', 'application/pgp-signature'], ['sig', 'application/pgp-signature'], ['prf', 'application/pics-rules'], ['p10', 'application/pkcs10'], ['p7c', 'application/pkcs7-mime'], ['p7m', 'application/pkcs7-mime'], ['p7s', 'application/pkcs7-signature'], ['p8', 'application/pkcs8'], ['ac', 'application/pkix-attr-cert'], ['cer', 'application/pkix-cert'], ['crl', 'application/pkix-crl'], ['pkipath', 'application/pkix-pkipath'], ['pki', 'application/pkixcmp'], ['pls', 'application/pls+xml'], ['ai', 'application/postscript'], ['eps', 'application/postscript'], ['ps', 'application/postscript'], ['provx', 'application/provenance+xml'], ['pskcxml', 'application/pskc+xml'], ['raml', 'application/raml+yaml'], ['owl', 'application/rdf+xml'], ['rdf', 'application/rdf+xml'], ['rif', 'application/reginfo+xml'], ['rnc', 'application/relax-ng-compact-syntax'], ['rl', 'application/resource-lists+xml'], ['rld', 'application/resource-lists-diff+xml'], ['rs', 'application/rls-services+xml'], ['rapd', 'application/route-apd+xml'], ['sls', 'application/route-s-tsid+xml'], ['rusd', 'application/route-usd+xml'], ['gbr', 'application/rpki-ghostbusters'], ['mft', 'application/rpki-manifest'], ['roa', 'application/rpki-roa'], ['rsd', 'application/rsd+xml'], ['rss', 'application/rss+xml'], ['rtf', 'application/rtf'], ['sbml', 'application/sbml+xml'], ['scq', 'application/scvp-cv-request'], ['scs', 'application/scvp-cv-response'], ['spq', 'application/scvp-vp-request'], ['spp', 'application/scvp-vp-response'], ['sdp', 'application/sdp'], ['senmlx', 'application/senml+xml'], ['sensmlx', 'application/sensml+xml'], ['setpay', 'application/set-payment-initiation'], ['setreg', 'application/set-registration-initiation'], ['shf', 'application/shf+xml'], ['sieve', 'application/sieve'], ['siv', 'application/sieve'], ['smi', 'application/smil+xml'], ['smil', 'application/smil+xml'], ['rq', 'application/sparql-query'], ['srx', 'application/sparql-results+xml'], ['gram', 'application/srgs'], ['grxml', 'application/srgs+xml'], ['sru', 'application/sru+xml'], ['ssdl', 'application/ssdl+xml'], ['ssml', 'application/ssml+xml'], ['swidtag', 'application/swid+xml'], ['tei', 'application/tei+xml'], ['teicorpus', 'application/tei+xml'], ['tfi', 'application/thraud+xml'], ['tsd', 'application/timestamped-data'], ['toml', 'application/toml'], ['trig', 'application/trig'], ['ttml', 'application/ttml+xml'], ['ubj', 'application/ubjson'], ['rsheet', 'application/urc-ressheet+xml'], ['td', 'application/urc-targetdesc+xml'], ['vxml', 'application/voicexml+xml'], ['wasm', 'application/wasm'], ['wgt', 'application/widget'], ['hlp', 'application/winhlp'], ['wsdl', 'application/wsdl+xml'], ['wspolicy', 'application/wspolicy+xml'], ['xaml', 'application/xaml+xml'], ['xav', 'application/xcap-att+xml'], ['xca', 'application/xcap-caps+xml'], ['xdf', 'application/xcap-diff+xml'], ['xel', 'application/xcap-el+xml'], ['xns', 'application/xcap-ns+xml'], ['xenc', 'application/xenc+xml'], ['xht', 'application/xhtml+xml'], ['xhtml', 'application/xhtml+xml'], ['xlf', 'application/xliff+xml'], ['rng', 'application/xml'], ['xml', 'application/xml'], ['xsd', 'application/xml'], ['xsl', 'application/xml'], ['dtd', 'application/xml-dtd'], ['xop', 'application/xop+xml'], ['xpl', 'application/xproc+xml'], ['*xsl', 'application/xslt+xml'], ['xslt', 'application/xslt+xml'], ['xspf', 'application/xspf+xml'], ['mxml', 'application/xv+xml'], ['xhvml', 'application/xv+xml'], ['xvm', 'application/xv+xml'], ['xvml', 'application/xv+xml'], ['yang', 'application/yang'], ['yin', 'application/yin+xml'], ['zip', 'application/zip'], ['*3gpp', 'audio/3gpp'], ['adp', 'audio/adpcm'], ['amr', 'audio/amr'], ['au', 'audio/basic'], ['snd', 'audio/basic'], ['kar', 'audio/midi'], ['mid', 'audio/midi'], ['midi', 'audio/midi'], ['rmi', 'audio/midi'], ['mxmf', 'audio/mobile-xmf'], ['*mp3', 'audio/mp3'], ['m4a', 'audio/mp4'], ['mp4a', 'audio/mp4'], ['m2a', 'audio/mpeg'], ['m3a', 'audio/mpeg'], ['mp2', 'audio/mpeg'], ['mp2a', 'audio/mpeg'], ['mp3', 'audio/mpeg'], ['mpga', 'audio/mpeg'], ['oga', 'audio/ogg'], ['ogg', 'audio/ogg'], ['opus', 'audio/ogg'], ['spx', 'audio/ogg'], ['s3m', 'audio/s3m'], ['sil', 'audio/silk'], ['wav', 'audio/wav'], ['*wav', 'audio/wave'], ['weba', 'audio/webm'], ['xm', 'audio/xm'], ['ttc', 'font/collection'], ['otf', 'font/otf'], ['ttf', 'font/ttf'], ['woff', 'font/woff'], ['woff2', 'font/woff2'], ['exr', 'image/aces'], ['apng', 'image/apng'], ['avif', 'image/avif'], ['bmp', 'image/bmp'], ['cgm', 'image/cgm'], ['drle', 'image/dicom-rle'], ['emf', 'image/emf'], ['fits', 'image/fits'], ['g3', 'image/g3fax'], ['gif', 'image/gif'], ['heic', 'image/heic'], ['heics', 'image/heic-sequence'], ['heif', 'image/heif'], ['heifs', 'image/heif-sequence'], ['hej2', 'image/hej2k'], ['hsj2', 'image/hsj2'], ['ief', 'image/ief'], ['jls', 'image/jls'], ['jp2', 'image/jp2'], ['jpg2', 'image/jp2'], ['jpe', 'image/jpeg'], ['jpeg', 'image/jpeg'], ['jpg', 'image/jpeg'], ['jph', 'image/jph'], ['jhc', 'image/jphc'], ['jpm', 'image/jpm'], ['jpf', 'image/jpx'], ['jpx', 'image/jpx'], ['jxr', 'image/jxr'], ['jxra', 'image/jxra'], ['jxrs', 'image/jxrs'], ['jxs', 'image/jxs'], ['jxsc', 'image/jxsc'], ['jxsi', 'image/jxsi'], ['jxss', 'image/jxss'], ['ktx', 'image/ktx'], ['ktx2', 'image/ktx2'], ['png', 'image/png'], ['sgi', 'image/sgi'], ['svg', 'image/svg+xml'], ['svgz', 'image/svg+xml'], ['t38', 'image/t38'], ['tif', 'image/tiff'], ['tiff', 'image/tiff'], ['tfx', 'image/tiff-fx'], ['webp', 'image/webp'], ['wmf', 'image/wmf'], ['disposition-notification', 'message/disposition-notification'], ['u8msg', 'message/global'], ['u8dsn', 'message/global-delivery-status'], ['u8mdn', 'message/global-disposition-notification'], ['u8hdr', 'message/global-headers'], ['eml', 'message/rfc822'], ['mime', 'message/rfc822'], ['3mf', 'model/3mf'], ['gltf', 'model/gltf+json'], ['glb', 'model/gltf-binary'], ['iges', 'model/iges'], ['igs', 'model/iges'], ['mesh', 'model/mesh'], ['msh', 'model/mesh'], ['silo', 'model/mesh'], ['mtl', 'model/mtl'], ['obj', 'model/obj'], ['stpx', 'model/step+xml'], ['stpz', 'model/step+zip'], ['stpxz', 'model/step-xml+zip'], ['stl', 'model/stl'], ['vrml', 'model/vrml'], ['wrl', 'model/vrml'], ['*x3db', 'model/x3d+binary'], ['x3dbz', 'model/x3d+binary'], ['x3db', 'model/x3d+fastinfoset'], ['*x3dv', 'model/x3d+vrml'], ['x3dvz', 'model/x3d+vrml'], ['x3d', 'model/x3d+xml'], ['x3dz', 'model/x3d+xml'], ['x3dv', 'model/x3d-vrml'], ['appcache', 'text/cache-manifest'], ['manifest', 'text/cache-manifest'], ['ics', 'text/calendar'], ['ifb', 'text/calendar'], ['coffee', 'text/coffeescript'], ['litcoffee', 'text/coffeescript'], ['css', 'text/css'], ['csv', 'text/csv'], ['htm', 'text/html'], ['html', 'text/html'], ['shtml', 'text/html'], ['jade', 'text/jade'], ['jsx', 'text/jsx'], ['less', 'text/less'], ['markdown', 'text/markdown'], ['md', 'text/markdown'], ['mml', 'text/mathml'], ['mdx', 'text/mdx'], ['n3', 'text/n3'], ['conf', 'text/plain'], ['def', 'text/plain'], ['in', 'text/plain'], ['ini', 'text/plain'], ['list', 'text/plain'], ['log', 'text/plain'], ['text', 'text/plain'], ['txt', 'text/plain'], ['rtx', 'text/richtext'], ['*rtf', 'text/rtf'], ['sgm', 'text/sgml'], ['sgml', 'text/sgml'], ['shex', 'text/shex'], ['slim', 'text/slim'], ['slm', 'text/slim'], ['spdx', 'text/spdx'], ['styl', 'text/stylus'], ['stylus', 'text/stylus'], ['tsv', 'text/tab-separated-values'], ['man', 'text/troff'], ['me', 'text/troff'], ['ms', 'text/troff'], ['roff', 'text/troff'], ['t', 'text/troff'], ['tr', 'text/troff'], ['ttl', 'text/turtle'], ['uri', 'text/uri-list'], ['uris', 'text/uri-list'], ['urls', 'text/uri-list'], ['vcard', 'text/vcard'], ['vtt', 'text/vtt'], ['*xml', 'text/xml'], ['yaml', 'text/yaml'], ['yml', 'text/yaml'], ['3gp', 'video/3gpp'], ['3gpp', 'video/3gpp'], ['3g2', 'video/3gpp2'], ['h261', 'video/h261'], ['h263', 'video/h263'], ['h264', 'video/h264'], ['m4s', 'video/iso.segment'], ['jpgv', 'video/jpeg'], ['jpm', 'video/jpm'], ['jpgm', 'video/jpm'], ['mj2', 'video/mj2'], ['mjp2', 'video/mj2'], ['ts', 'video/mp2t'], ['mp4', 'video/mp4'], ['mp4v', 'video/mp4'], ['mpg4', 'video/mp4'], ['m1v', 'video/mpeg'], ['m2v', 'video/mpeg'], ['mpe', 'video/mpeg'], ['mpeg', 'video/mpeg'], ['mpg', 'video/mpeg'], ['ogv', 'video/ogg'], ['mov', 'video/quicktime'], ['qt', 'video/quicktime'], ['webm', 'video/webm']]);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MultiMap = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) Microsoft Corporation.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
class MultiMap {
|
|
24
|
+
constructor() {
|
|
25
|
+
this._map = void 0;
|
|
26
|
+
this._map = new Map();
|
|
27
|
+
}
|
|
28
|
+
set(key, value) {
|
|
29
|
+
let values = this._map.get(key);
|
|
30
|
+
if (!values) {
|
|
31
|
+
values = [];
|
|
32
|
+
this._map.set(key, values);
|
|
33
|
+
}
|
|
34
|
+
values.push(value);
|
|
35
|
+
}
|
|
36
|
+
get(key) {
|
|
37
|
+
return this._map.get(key) || [];
|
|
38
|
+
}
|
|
39
|
+
has(key) {
|
|
40
|
+
return this._map.has(key);
|
|
41
|
+
}
|
|
42
|
+
delete(key, value) {
|
|
43
|
+
const values = this._map.get(key);
|
|
44
|
+
if (!values) return;
|
|
45
|
+
if (values.includes(value)) this._map.set(key, values.filter(v => value !== v));
|
|
46
|
+
}
|
|
47
|
+
deleteAll(key) {
|
|
48
|
+
this._map.delete(key);
|
|
49
|
+
}
|
|
50
|
+
hasValue(key, value) {
|
|
51
|
+
const values = this._map.get(key);
|
|
52
|
+
if (!values) return false;
|
|
53
|
+
return values.includes(value);
|
|
54
|
+
}
|
|
55
|
+
get size() {
|
|
56
|
+
return this._map.size;
|
|
57
|
+
}
|
|
58
|
+
[Symbol.iterator]() {
|
|
59
|
+
return this._map[Symbol.iterator]();
|
|
60
|
+
}
|
|
61
|
+
keys() {
|
|
62
|
+
return this._map.keys();
|
|
63
|
+
}
|
|
64
|
+
values() {
|
|
65
|
+
const result = [];
|
|
66
|
+
for (const key of this.keys()) result.push(...this.get(key));
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
clear() {
|
|
70
|
+
this._map.clear();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.MultiMap = MultiMap;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isError = isError;
|
|
7
|
+
exports.isObject = isObject;
|
|
8
|
+
exports.isRegExp = isRegExp;
|
|
9
|
+
Object.defineProperty(exports, "isString", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _stringUtils.isString;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _stringUtils = require("./stringUtils");
|
|
16
|
+
/**
|
|
17
|
+
* Copyright (c) Microsoft Corporation.
|
|
18
|
+
*
|
|
19
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License.
|
|
21
|
+
* You may obtain a copy of the License at
|
|
22
|
+
*
|
|
23
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
+
* See the License for the specific language governing permissions and
|
|
29
|
+
* limitations under the License.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
function isRegExp(obj) {
|
|
33
|
+
return obj instanceof RegExp || Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
34
|
+
}
|
|
35
|
+
function isObject(obj) {
|
|
36
|
+
return typeof obj === 'object' && obj !== null;
|
|
37
|
+
}
|
|
38
|
+
function isError(obj) {
|
|
39
|
+
var _Object$getPrototypeO;
|
|
40
|
+
return obj instanceof Error || obj && ((_Object$getPrototypeO = Object.getPrototypeOf(obj)) === null || _Object$getPrototypeO === void 0 ? void 0 : _Object$getPrototypeO.name) === 'Error';
|
|
41
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Semaphore = void 0;
|
|
7
|
+
var _manualPromise = require("./manualPromise");
|
|
8
|
+
/**
|
|
9
|
+
* Copyright (c) Microsoft Corporation.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
class Semaphore {
|
|
25
|
+
constructor(max) {
|
|
26
|
+
this._max = void 0;
|
|
27
|
+
this._acquired = 0;
|
|
28
|
+
this._queue = [];
|
|
29
|
+
this._max = max;
|
|
30
|
+
}
|
|
31
|
+
setMax(max) {
|
|
32
|
+
this._max = max;
|
|
33
|
+
}
|
|
34
|
+
acquire() {
|
|
35
|
+
const lock = new _manualPromise.ManualPromise();
|
|
36
|
+
this._queue.push(lock);
|
|
37
|
+
this._flush();
|
|
38
|
+
return lock;
|
|
39
|
+
}
|
|
40
|
+
release() {
|
|
41
|
+
--this._acquired;
|
|
42
|
+
this._flush();
|
|
43
|
+
}
|
|
44
|
+
_flush() {
|
|
45
|
+
while (this._acquired < this._max && this._queue.length) {
|
|
46
|
+
++this._acquired;
|
|
47
|
+
this._queue.shift().resolve();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Semaphore = Semaphore;
|