@stablyai/internal-playwright-core 0.1.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +3 -0
- package/ThirdPartyNotices.txt +1134 -0
- package/bin/install_media_pack.ps1 +5 -0
- package/bin/install_webkit_wsl.ps1 +35 -0
- package/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/browsers.json +80 -0
- package/cli.js +18 -0
- package/index.d.ts +17 -0
- package/index.js +32 -0
- package/index.mjs +28 -0
- package/lib/androidServerImpl.js +65 -0
- package/lib/browserServerImpl.js +120 -0
- package/lib/cli/cli.js +58 -0
- package/lib/cli/driver.js +97 -0
- package/lib/cli/program.js +634 -0
- package/lib/cli/programWithTestStub.js +74 -0
- package/lib/client/accessibility.js +49 -0
- package/lib/client/android.js +361 -0
- package/lib/client/api.js +137 -0
- package/lib/client/artifact.js +79 -0
- package/lib/client/browser.js +163 -0
- package/lib/client/browserContext.js +529 -0
- package/lib/client/browserType.js +184 -0
- package/lib/client/cdpSession.js +51 -0
- package/lib/client/channelOwner.js +194 -0
- package/lib/client/clientHelper.js +64 -0
- package/lib/client/clientInstrumentation.js +55 -0
- package/lib/client/clientStackTrace.js +69 -0
- package/lib/client/clock.js +68 -0
- package/lib/client/connection.js +314 -0
- package/lib/client/consoleMessage.js +54 -0
- package/lib/client/coverage.js +44 -0
- package/lib/client/dialog.js +56 -0
- package/lib/client/download.js +62 -0
- package/lib/client/electron.js +138 -0
- package/lib/client/elementHandle.js +281 -0
- package/lib/client/errors.js +77 -0
- package/lib/client/eventEmitter.js +314 -0
- package/lib/client/events.js +99 -0
- package/lib/client/fetch.js +369 -0
- package/lib/client/fileChooser.js +46 -0
- package/lib/client/fileUtils.js +34 -0
- package/lib/client/frame.js +408 -0
- package/lib/client/harRouter.js +87 -0
- package/lib/client/input.js +84 -0
- package/lib/client/jsHandle.js +109 -0
- package/lib/client/jsonPipe.js +39 -0
- package/lib/client/localUtils.js +60 -0
- package/lib/client/locator.js +368 -0
- package/lib/client/network.js +747 -0
- package/lib/client/page.js +721 -0
- package/lib/client/platform.js +74 -0
- package/lib/client/playwright.js +71 -0
- package/lib/client/selectors.js +55 -0
- package/lib/client/stream.js +39 -0
- package/lib/client/timeoutSettings.js +79 -0
- package/lib/client/tracing.js +117 -0
- package/lib/client/types.js +28 -0
- package/lib/client/video.js +59 -0
- package/lib/client/waiter.js +142 -0
- package/lib/client/webError.js +39 -0
- package/lib/client/webSocket.js +93 -0
- package/lib/client/worker.js +63 -0
- package/lib/client/writableStream.js +39 -0
- package/lib/common/debugLogger.js +90 -0
- package/lib/common/socksProxy.js +569 -0
- package/lib/common/timeoutSettings.js +73 -0
- package/lib/common/types.js +5 -0
- package/lib/generated/bindingsControllerSource.js +28 -0
- package/lib/generated/clockSource.js +28 -0
- package/lib/generated/consoleApiSource.js +28 -0
- package/lib/generated/injectedScriptSource.js +28 -0
- package/lib/generated/pollingRecorderSource.js +28 -0
- package/lib/generated/recorderSource.js +28 -0
- package/lib/generated/storageScriptSource.js +28 -0
- package/lib/generated/utilityScriptSource.js +28 -0
- package/lib/generated/webSocketMockSource.js +336 -0
- package/lib/image_tools/colorUtils.js +98 -0
- package/lib/image_tools/compare.js +108 -0
- package/lib/image_tools/imageChannel.js +70 -0
- package/lib/image_tools/stats.js +102 -0
- package/lib/inProcessFactory.js +60 -0
- package/lib/index.js +19 -0
- package/lib/inprocess.js +3 -0
- package/lib/outofprocess.js +76 -0
- package/lib/protocol/debug.js +27 -0
- package/lib/protocol/serializers.js +192 -0
- package/lib/protocol/transport.js +82 -0
- package/lib/protocol/validator.js +2919 -0
- package/lib/protocol/validatorPrimitives.js +193 -0
- package/lib/remote/playwrightConnection.js +129 -0
- package/lib/remote/playwrightServer.js +335 -0
- package/lib/server/accessibility.js +69 -0
- package/lib/server/android/android.js +465 -0
- package/lib/server/android/backendAdb.js +177 -0
- package/lib/server/artifact.js +127 -0
- package/lib/server/bidi/bidiBrowser.js +490 -0
- package/lib/server/bidi/bidiChromium.js +153 -0
- package/lib/server/bidi/bidiConnection.js +212 -0
- package/lib/server/bidi/bidiExecutionContext.js +221 -0
- package/lib/server/bidi/bidiFirefox.js +130 -0
- package/lib/server/bidi/bidiInput.js +146 -0
- package/lib/server/bidi/bidiNetworkManager.js +383 -0
- package/lib/server/bidi/bidiOverCdp.js +102 -0
- package/lib/server/bidi/bidiPage.js +552 -0
- package/lib/server/bidi/bidiPdf.js +106 -0
- package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/lib/server/bidi/third_party/bidiDeserializer.js +98 -0
- package/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- package/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
- package/lib/server/browser.js +149 -0
- package/lib/server/browserContext.js +695 -0
- package/lib/server/browserType.js +328 -0
- package/lib/server/callLog.js +82 -0
- package/lib/server/chromium/appIcon.png +0 -0
- package/lib/server/chromium/chromium.js +402 -0
- package/lib/server/chromium/chromiumSwitches.js +95 -0
- package/lib/server/chromium/crAccessibility.js +263 -0
- package/lib/server/chromium/crBrowser.js +501 -0
- package/lib/server/chromium/crConnection.js +202 -0
- package/lib/server/chromium/crCoverage.js +235 -0
- package/lib/server/chromium/crDevTools.js +113 -0
- package/lib/server/chromium/crDragDrop.js +131 -0
- package/lib/server/chromium/crExecutionContext.js +146 -0
- package/lib/server/chromium/crInput.js +187 -0
- package/lib/server/chromium/crNetworkManager.js +666 -0
- package/lib/server/chromium/crPage.js +1069 -0
- package/lib/server/chromium/crPdf.js +121 -0
- package/lib/server/chromium/crProtocolHelper.js +145 -0
- package/lib/server/chromium/crServiceWorker.js +123 -0
- package/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/lib/server/chromium/protocol.d.js +16 -0
- package/lib/server/chromium/videoRecorder.js +113 -0
- package/lib/server/clock.js +149 -0
- package/lib/server/codegen/csharp.js +327 -0
- package/lib/server/codegen/java.js +274 -0
- package/lib/server/codegen/javascript.js +270 -0
- package/lib/server/codegen/jsonl.js +52 -0
- package/lib/server/codegen/language.js +132 -0
- package/lib/server/codegen/languages.js +68 -0
- package/lib/server/codegen/python.js +279 -0
- package/lib/server/codegen/types.js +16 -0
- package/lib/server/console.js +53 -0
- package/lib/server/cookieStore.js +206 -0
- package/lib/server/debugController.js +191 -0
- package/lib/server/debugger.js +119 -0
- package/lib/server/deviceDescriptors.js +39 -0
- package/lib/server/deviceDescriptorsSource.json +1779 -0
- package/lib/server/dialog.js +116 -0
- package/lib/server/dispatchers/androidDispatcher.js +325 -0
- package/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/lib/server/dispatchers/browserContextDispatcher.js +364 -0
- package/lib/server/dispatchers/browserDispatcher.js +118 -0
- package/lib/server/dispatchers/browserTypeDispatcher.js +64 -0
- package/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
- package/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
- package/lib/server/dispatchers/dialogDispatcher.js +47 -0
- package/lib/server/dispatchers/dispatcher.js +371 -0
- package/lib/server/dispatchers/electronDispatcher.js +89 -0
- package/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
- package/lib/server/dispatchers/frameDispatcher.js +227 -0
- package/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
- package/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- package/lib/server/dispatchers/localUtilsDispatcher.js +149 -0
- package/lib/server/dispatchers/networkDispatchers.js +213 -0
- package/lib/server/dispatchers/pageDispatcher.js +401 -0
- package/lib/server/dispatchers/playwrightDispatcher.js +108 -0
- package/lib/server/dispatchers/selectorsDispatcher.js +36 -0
- package/lib/server/dispatchers/streamDispatcher.js +67 -0
- package/lib/server/dispatchers/tracingDispatcher.js +68 -0
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +165 -0
- package/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
- package/lib/server/dom.js +806 -0
- package/lib/server/download.js +70 -0
- package/lib/server/electron/electron.js +270 -0
- package/lib/server/electron/loader.js +29 -0
- package/lib/server/errors.js +69 -0
- package/lib/server/fetch.js +621 -0
- package/lib/server/fileChooser.js +43 -0
- package/lib/server/fileUploadUtils.js +84 -0
- package/lib/server/firefox/ffAccessibility.js +238 -0
- package/lib/server/firefox/ffBrowser.js +428 -0
- package/lib/server/firefox/ffConnection.js +147 -0
- package/lib/server/firefox/ffExecutionContext.js +150 -0
- package/lib/server/firefox/ffInput.js +159 -0
- package/lib/server/firefox/ffNetworkManager.js +256 -0
- package/lib/server/firefox/ffPage.js +503 -0
- package/lib/server/firefox/firefox.js +116 -0
- package/lib/server/firefox/protocol.d.js +16 -0
- package/lib/server/formData.js +147 -0
- package/lib/server/frameSelectors.js +156 -0
- package/lib/server/frames.js +1502 -0
- package/lib/server/har/harRecorder.js +147 -0
- package/lib/server/har/harTracer.js +607 -0
- package/lib/server/harBackend.js +157 -0
- package/lib/server/helper.js +96 -0
- package/lib/server/index.js +58 -0
- package/lib/server/input.js +273 -0
- package/lib/server/instrumentation.js +69 -0
- package/lib/server/isomorphic/utilityScriptSerializers.js +212 -0
- package/lib/server/javascript.js +291 -0
- package/lib/server/launchApp.js +128 -0
- package/lib/server/localUtils.js +218 -0
- package/lib/server/macEditingCommands.js +143 -0
- package/lib/server/network.js +629 -0
- package/lib/server/page.js +871 -0
- package/lib/server/pipeTransport.js +89 -0
- package/lib/server/playwright.js +69 -0
- package/lib/server/progress.js +112 -0
- package/lib/server/protocolError.js +52 -0
- package/lib/server/recorder/chat.js +161 -0
- package/lib/server/recorder/codeGenerator.js +153 -0
- package/lib/server/recorder/csharp.js +310 -0
- package/lib/server/recorder/java.js +248 -0
- package/lib/server/recorder/javascript.js +229 -0
- package/lib/server/recorder/jsonl.js +47 -0
- package/lib/server/recorder/language.js +44 -0
- package/lib/server/recorder/python.js +276 -0
- package/lib/server/recorder/recorderActions.js +5 -0
- package/lib/server/recorder/recorderApp.js +387 -0
- package/lib/server/recorder/recorderRunner.js +138 -0
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/recorder/recorderUtils.js +157 -0
- package/lib/server/recorder/throttledFile.js +57 -0
- package/lib/server/recorder/utils.js +45 -0
- package/lib/server/recorder.js +499 -0
- package/lib/server/registry/browserFetcher.js +175 -0
- package/lib/server/registry/dependencies.js +371 -0
- package/lib/server/registry/index.js +1331 -0
- package/lib/server/registry/nativeDeps.js +1280 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +120 -0
- package/lib/server/screenshotter.js +333 -0
- package/lib/server/selectors.js +112 -0
- package/lib/server/socksClientCertificatesInterceptor.js +383 -0
- package/lib/server/socksInterceptor.js +95 -0
- package/lib/server/stably/ai-tools/http-request.js +70 -0
- package/lib/server/stably/ai-tools/stablyApiCaller.js +137 -0
- package/lib/server/stably/autohealing/elementHandleFromCoordinates.js +64 -0
- package/lib/server/stably/autohealing/healingService.js +228 -0
- package/lib/server/stably/autohealing/screenshotFrame.js +41 -0
- package/lib/server/stably/constants.js +31 -0
- package/lib/server/trace/recorder/snapshotter.js +147 -0
- package/lib/server/trace/recorder/snapshotterInjected.js +541 -0
- package/lib/server/trace/recorder/tracing.js +602 -0
- package/lib/server/trace/test/inMemorySnapshotter.js +87 -0
- package/lib/server/trace/viewer/traceViewer.js +240 -0
- package/lib/server/transport.js +181 -0
- package/lib/server/types.js +28 -0
- package/lib/server/usKeyboardLayout.js +145 -0
- package/lib/server/utils/ascii.js +44 -0
- package/lib/server/utils/comparators.js +161 -0
- package/lib/server/utils/crypto.js +216 -0
- package/lib/server/utils/debug.js +42 -0
- package/lib/server/utils/debugLogger.js +122 -0
- package/lib/server/utils/env.js +73 -0
- package/lib/server/utils/eventsHelper.js +39 -0
- package/lib/server/utils/expectUtils.js +38 -0
- package/lib/server/utils/fileUtils.js +191 -0
- package/lib/server/utils/happyEyeballs.js +207 -0
- package/lib/server/utils/hostPlatform.js +111 -0
- package/lib/server/utils/httpServer.js +218 -0
- package/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/lib/server/utils/image_tools/compare.js +109 -0
- package/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/lib/server/utils/image_tools/stats.js +102 -0
- package/lib/server/utils/linuxUtils.js +71 -0
- package/lib/server/utils/network.js +233 -0
- package/lib/server/utils/nodePlatform.js +148 -0
- package/lib/server/utils/pipeTransport.js +84 -0
- package/lib/server/utils/processLauncher.js +241 -0
- package/lib/server/utils/profiler.js +65 -0
- package/lib/server/utils/socksProxy.js +511 -0
- package/lib/server/utils/spawnAsync.js +41 -0
- package/lib/server/utils/task.js +51 -0
- package/lib/server/utils/userAgent.js +98 -0
- package/lib/server/utils/wsServer.js +121 -0
- package/lib/server/utils/zipFile.js +74 -0
- package/lib/server/utils/zones.js +57 -0
- package/lib/server/webkit/protocol.d.js +16 -0
- package/lib/server/webkit/webkit.js +119 -0
- package/lib/server/webkit/wkAccessibility.js +237 -0
- package/lib/server/webkit/wkBrowser.js +339 -0
- package/lib/server/webkit/wkConnection.js +149 -0
- package/lib/server/webkit/wkExecutionContext.js +154 -0
- package/lib/server/webkit/wkInput.js +181 -0
- package/lib/server/webkit/wkInterceptableRequest.js +169 -0
- package/lib/server/webkit/wkPage.js +1134 -0
- package/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/lib/server/webkit/wkWorkers.js +104 -0
- package/lib/server/webkit/wsl/webkit-wsl-transport-client.js +74 -0
- package/lib/server/webkit/wsl/webkit-wsl-transport-server.js +113 -0
- package/lib/third_party/diff_match_patch.js +2222 -0
- package/lib/third_party/pixelmatch.js +255 -0
- package/lib/utils/ascii.js +31 -0
- package/lib/utils/comparators.js +171 -0
- package/lib/utils/crypto.js +33 -0
- package/lib/utils/debug.js +46 -0
- package/lib/utils/debugLogger.js +89 -0
- package/lib/utils/env.js +49 -0
- package/lib/utils/eventsHelper.js +38 -0
- package/lib/utils/fileUtils.js +205 -0
- package/lib/utils/glob.js +83 -0
- package/lib/utils/happy-eyeballs.js +160 -0
- package/lib/utils/headers.js +52 -0
- package/lib/utils/hostPlatform.js +128 -0
- package/lib/utils/httpServer.js +236 -0
- package/lib/utils/index.js +346 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +392 -0
- package/lib/utils/isomorphic/assert.js +31 -0
- package/lib/utils/isomorphic/colors.js +72 -0
- package/lib/utils/isomorphic/cssParser.js +245 -0
- package/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- package/lib/utils/isomorphic/headers.js +53 -0
- package/lib/utils/isomorphic/locatorGenerators.js +673 -0
- package/lib/utils/isomorphic/locatorParser.js +176 -0
- package/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/lib/utils/isomorphic/manualPromise.js +114 -0
- package/lib/utils/isomorphic/mimeType.js +459 -0
- package/lib/utils/isomorphic/multimap.js +80 -0
- package/lib/utils/isomorphic/protocolFormatter.js +78 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +321 -0
- package/lib/utils/isomorphic/rtti.js +43 -0
- package/lib/utils/isomorphic/selectorParser.js +386 -0
- package/lib/utils/isomorphic/semaphore.js +54 -0
- package/lib/utils/isomorphic/stackTrace.js +158 -0
- package/lib/utils/isomorphic/stringUtils.js +155 -0
- package/lib/utils/isomorphic/time.js +49 -0
- package/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/lib/utils/isomorphic/traceUtils.js +58 -0
- package/lib/utils/isomorphic/types.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +176 -0
- package/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/lib/utils/linuxUtils.js +78 -0
- package/lib/utils/manualPromise.js +109 -0
- package/lib/utils/mimeType.js +29 -0
- package/lib/utils/multimap.js +75 -0
- package/lib/utils/network.js +188 -0
- package/lib/utils/processLauncher.js +248 -0
- package/lib/utils/profiler.js +53 -0
- package/lib/utils/rtti.js +44 -0
- package/lib/utils/semaphore.js +51 -0
- package/lib/utils/spawnAsync.js +45 -0
- package/lib/utils/stackTrace.js +121 -0
- package/lib/utils/task.js +58 -0
- package/lib/utils/time.js +37 -0
- package/lib/utils/timeoutRunner.js +66 -0
- package/lib/utils/traceUtils.js +44 -0
- package/lib/utils/userAgent.js +105 -0
- package/lib/utils/wsServer.js +127 -0
- package/lib/utils/zipFile.js +75 -0
- package/lib/utils/zones.js +62 -0
- package/lib/utils.js +107 -0
- package/lib/utilsBundle.js +109 -0
- package/lib/utilsBundleImpl/index.js +218 -0
- package/lib/utilsBundleImpl/xdg-open +1066 -0
- package/lib/vite/htmlReport/index.html +84 -0
- package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +1 -0
- package/lib/vite/recorder/assets/codeMirrorModule-RJCXzfmE.js +24 -0
- package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/lib/vite/recorder/assets/index-Ri0uHF7I.css +1 -0
- package/lib/vite/recorder/assets/index-Y-X2TGJv.js +193 -0
- package/lib/vite/recorder/index.html +29 -0
- package/lib/vite/recorder/playwright-logo.svg +9 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-Bhnc5o2x.js +24 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-ClwvkA2N.js +265 -0
- package/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +1 -0
- package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/lib/vite/traceViewer/defaultSettingsView.TQ8_7ybu.css +1 -0
- package/lib/vite/traceViewer/index.DFO9NNF5.js +2 -0
- package/lib/vite/traceViewer/index.I8N9v4jT.css +1 -0
- package/lib/vite/traceViewer/index.html +43 -0
- package/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/lib/vite/traceViewer/snapshot.html +21 -0
- package/lib/vite/traceViewer/sw.bundle.js +3 -0
- package/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/lib/vite/traceViewer/uiMode.Shu3QS-1.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +17 -0
- package/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- package/lib/zipBundle.js +34 -0
- package/lib/zipBundleImpl.js +5 -0
- package/package.json +43 -0
- package/types/protocol.d.ts +23130 -0
- package/types/structs.d.ts +45 -0
- package/types/types.d.ts +22857 -0
@@ -0,0 +1,155 @@
|
|
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 stringUtils_exports = {};
|
20
|
+
__export(stringUtils_exports, {
|
21
|
+
cacheNormalizedWhitespaces: () => cacheNormalizedWhitespaces,
|
22
|
+
escapeForAttributeSelector: () => escapeForAttributeSelector,
|
23
|
+
escapeForTextSelector: () => escapeForTextSelector,
|
24
|
+
escapeHTML: () => escapeHTML,
|
25
|
+
escapeHTMLAttribute: () => escapeHTMLAttribute,
|
26
|
+
escapeRegExp: () => escapeRegExp,
|
27
|
+
escapeTemplateString: () => escapeTemplateString,
|
28
|
+
escapeWithQuotes: () => escapeWithQuotes,
|
29
|
+
isString: () => isString,
|
30
|
+
longestCommonSubstring: () => longestCommonSubstring,
|
31
|
+
normalizeEscapedRegexQuotes: () => normalizeEscapedRegexQuotes,
|
32
|
+
normalizeWhiteSpace: () => normalizeWhiteSpace,
|
33
|
+
quoteCSSAttributeValue: () => quoteCSSAttributeValue,
|
34
|
+
toSnakeCase: () => toSnakeCase,
|
35
|
+
toTitleCase: () => toTitleCase,
|
36
|
+
trimString: () => trimString,
|
37
|
+
trimStringWithEllipsis: () => trimStringWithEllipsis
|
38
|
+
});
|
39
|
+
module.exports = __toCommonJS(stringUtils_exports);
|
40
|
+
function escapeWithQuotes(text, char = "'") {
|
41
|
+
const stringified = JSON.stringify(text);
|
42
|
+
const escapedText = stringified.substring(1, stringified.length - 1).replace(/\\"/g, '"');
|
43
|
+
if (char === "'")
|
44
|
+
return char + escapedText.replace(/[']/g, "\\'") + char;
|
45
|
+
if (char === '"')
|
46
|
+
return char + escapedText.replace(/["]/g, '\\"') + char;
|
47
|
+
if (char === "`")
|
48
|
+
return char + escapedText.replace(/[`]/g, "\\`") + char;
|
49
|
+
throw new Error("Invalid escape char");
|
50
|
+
}
|
51
|
+
function escapeTemplateString(text) {
|
52
|
+
return text.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
53
|
+
}
|
54
|
+
function isString(obj) {
|
55
|
+
return typeof obj === "string" || obj instanceof String;
|
56
|
+
}
|
57
|
+
function toTitleCase(name) {
|
58
|
+
return name.charAt(0).toUpperCase() + name.substring(1);
|
59
|
+
}
|
60
|
+
function toSnakeCase(name) {
|
61
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toLowerCase();
|
62
|
+
}
|
63
|
+
function quoteCSSAttributeValue(text) {
|
64
|
+
return `"${text.replace(/["\\]/g, (char) => "\\" + char)}"`;
|
65
|
+
}
|
66
|
+
let normalizedWhitespaceCache;
|
67
|
+
function cacheNormalizedWhitespaces() {
|
68
|
+
normalizedWhitespaceCache = /* @__PURE__ */ new Map();
|
69
|
+
}
|
70
|
+
function normalizeWhiteSpace(text) {
|
71
|
+
let result = normalizedWhitespaceCache?.get(text);
|
72
|
+
if (result === void 0) {
|
73
|
+
result = text.replace(/[\u200b\u00ad]/g, "").trim().replace(/\s+/g, " ");
|
74
|
+
normalizedWhitespaceCache?.set(text, result);
|
75
|
+
}
|
76
|
+
return result;
|
77
|
+
}
|
78
|
+
function normalizeEscapedRegexQuotes(source) {
|
79
|
+
return source.replace(/(^|[^\\])(\\\\)*\\(['"`])/g, "$1$2$3");
|
80
|
+
}
|
81
|
+
function escapeRegexForSelector(re) {
|
82
|
+
if (re.unicode || re.unicodeSets)
|
83
|
+
return String(re);
|
84
|
+
return String(re).replace(/(^|[^\\])(\\\\)*(["'`])/g, "$1$2\\$3").replace(/>>/g, "\\>\\>");
|
85
|
+
}
|
86
|
+
function escapeForTextSelector(text, exact) {
|
87
|
+
if (typeof text !== "string")
|
88
|
+
return escapeRegexForSelector(text);
|
89
|
+
return `${JSON.stringify(text)}${exact ? "s" : "i"}`;
|
90
|
+
}
|
91
|
+
function escapeForAttributeSelector(value, exact) {
|
92
|
+
if (typeof value !== "string")
|
93
|
+
return escapeRegexForSelector(value);
|
94
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/["]/g, '\\"')}"${exact ? "s" : "i"}`;
|
95
|
+
}
|
96
|
+
function trimString(input, cap, suffix = "") {
|
97
|
+
if (input.length <= cap)
|
98
|
+
return input;
|
99
|
+
const chars = [...input];
|
100
|
+
if (chars.length > cap)
|
101
|
+
return chars.slice(0, cap - suffix.length).join("") + suffix;
|
102
|
+
return chars.join("");
|
103
|
+
}
|
104
|
+
function trimStringWithEllipsis(input, cap) {
|
105
|
+
return trimString(input, cap, "\u2026");
|
106
|
+
}
|
107
|
+
function escapeRegExp(s) {
|
108
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
109
|
+
}
|
110
|
+
const escaped = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
111
|
+
function escapeHTMLAttribute(s) {
|
112
|
+
return s.replace(/[&<>"']/ug, (char) => escaped[char]);
|
113
|
+
}
|
114
|
+
function escapeHTML(s) {
|
115
|
+
return s.replace(/[&<]/ug, (char) => escaped[char]);
|
116
|
+
}
|
117
|
+
function longestCommonSubstring(s1, s2) {
|
118
|
+
const n = s1.length;
|
119
|
+
const m = s2.length;
|
120
|
+
let maxLen = 0;
|
121
|
+
let endingIndex = 0;
|
122
|
+
const dp = Array(n + 1).fill(null).map(() => Array(m + 1).fill(0));
|
123
|
+
for (let i = 1; i <= n; i++) {
|
124
|
+
for (let j = 1; j <= m; j++) {
|
125
|
+
if (s1[i - 1] === s2[j - 1]) {
|
126
|
+
dp[i][j] = dp[i - 1][j - 1] + 1;
|
127
|
+
if (dp[i][j] > maxLen) {
|
128
|
+
maxLen = dp[i][j];
|
129
|
+
endingIndex = i;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
return s1.slice(endingIndex - maxLen, endingIndex);
|
135
|
+
}
|
136
|
+
// Annotate the CommonJS export names for ESM import in node:
|
137
|
+
0 && (module.exports = {
|
138
|
+
cacheNormalizedWhitespaces,
|
139
|
+
escapeForAttributeSelector,
|
140
|
+
escapeForTextSelector,
|
141
|
+
escapeHTML,
|
142
|
+
escapeHTMLAttribute,
|
143
|
+
escapeRegExp,
|
144
|
+
escapeTemplateString,
|
145
|
+
escapeWithQuotes,
|
146
|
+
isString,
|
147
|
+
longestCommonSubstring,
|
148
|
+
normalizeEscapedRegexQuotes,
|
149
|
+
normalizeWhiteSpace,
|
150
|
+
quoteCSSAttributeValue,
|
151
|
+
toSnakeCase,
|
152
|
+
toTitleCase,
|
153
|
+
trimString,
|
154
|
+
trimStringWithEllipsis
|
155
|
+
});
|
@@ -0,0 +1,49 @@
|
|
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 time_exports = {};
|
20
|
+
__export(time_exports, {
|
21
|
+
DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT: () => DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT,
|
22
|
+
DEFAULT_PLAYWRIGHT_TIMEOUT: () => DEFAULT_PLAYWRIGHT_TIMEOUT,
|
23
|
+
monotonicTime: () => monotonicTime,
|
24
|
+
setTimeOrigin: () => setTimeOrigin,
|
25
|
+
timeOrigin: () => timeOrigin
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(time_exports);
|
28
|
+
let _timeOrigin = performance.timeOrigin;
|
29
|
+
let _timeShift = 0;
|
30
|
+
function setTimeOrigin(origin) {
|
31
|
+
_timeOrigin = origin;
|
32
|
+
_timeShift = performance.timeOrigin - origin;
|
33
|
+
}
|
34
|
+
function timeOrigin() {
|
35
|
+
return _timeOrigin;
|
36
|
+
}
|
37
|
+
function monotonicTime() {
|
38
|
+
return Math.floor((performance.now() + _timeShift) * 1e3) / 1e3;
|
39
|
+
}
|
40
|
+
const DEFAULT_PLAYWRIGHT_TIMEOUT = 3e4;
|
41
|
+
const DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT = 3 * 60 * 1e3;
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
43
|
+
0 && (module.exports = {
|
44
|
+
DEFAULT_PLAYWRIGHT_LAUNCH_TIMEOUT,
|
45
|
+
DEFAULT_PLAYWRIGHT_TIMEOUT,
|
46
|
+
monotonicTime,
|
47
|
+
setTimeOrigin,
|
48
|
+
timeOrigin
|
49
|
+
});
|
@@ -0,0 +1,66 @@
|
|
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 timeoutRunner_exports = {};
|
20
|
+
__export(timeoutRunner_exports, {
|
21
|
+
pollAgainstDeadline: () => pollAgainstDeadline,
|
22
|
+
raceAgainstDeadline: () => raceAgainstDeadline
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(timeoutRunner_exports);
|
25
|
+
var import_time = require("./time");
|
26
|
+
async function raceAgainstDeadline(cb, deadline) {
|
27
|
+
let timer;
|
28
|
+
return Promise.race([
|
29
|
+
cb().then((result) => {
|
30
|
+
return { result, timedOut: false };
|
31
|
+
}),
|
32
|
+
new Promise((resolve) => {
|
33
|
+
const kMaxDeadline = 2147483647;
|
34
|
+
const timeout = (deadline || kMaxDeadline) - (0, import_time.monotonicTime)();
|
35
|
+
timer = setTimeout(() => resolve({ timedOut: true }), timeout);
|
36
|
+
})
|
37
|
+
]).finally(() => {
|
38
|
+
clearTimeout(timer);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
async function pollAgainstDeadline(callback, deadline, pollIntervals = [100, 250, 500, 1e3]) {
|
42
|
+
const lastPollInterval = pollIntervals.pop() ?? 1e3;
|
43
|
+
let lastResult;
|
44
|
+
const wrappedCallback = () => Promise.resolve().then(callback);
|
45
|
+
while (true) {
|
46
|
+
const time = (0, import_time.monotonicTime)();
|
47
|
+
if (deadline && time >= deadline)
|
48
|
+
break;
|
49
|
+
const received = await raceAgainstDeadline(wrappedCallback, deadline);
|
50
|
+
if (received.timedOut)
|
51
|
+
break;
|
52
|
+
lastResult = received.result.result;
|
53
|
+
if (!received.result.continuePolling)
|
54
|
+
return { result: lastResult, timedOut: false };
|
55
|
+
const interval = pollIntervals.shift() ?? lastPollInterval;
|
56
|
+
if (deadline && deadline <= (0, import_time.monotonicTime)() + interval)
|
57
|
+
break;
|
58
|
+
await new Promise((x) => setTimeout(x, interval));
|
59
|
+
}
|
60
|
+
return { timedOut: true, result: lastResult };
|
61
|
+
}
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
63
|
+
0 && (module.exports = {
|
64
|
+
pollAgainstDeadline,
|
65
|
+
raceAgainstDeadline
|
66
|
+
});
|
@@ -0,0 +1,58 @@
|
|
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 traceUtils_exports = {};
|
20
|
+
__export(traceUtils_exports, {
|
21
|
+
parseClientSideCallMetadata: () => parseClientSideCallMetadata,
|
22
|
+
serializeClientSideCallMetadata: () => serializeClientSideCallMetadata
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(traceUtils_exports);
|
25
|
+
function parseClientSideCallMetadata(data) {
|
26
|
+
const result = /* @__PURE__ */ new Map();
|
27
|
+
const { files, stacks } = data;
|
28
|
+
for (const s of stacks) {
|
29
|
+
const [id, ff] = s;
|
30
|
+
result.set(`call@${id}`, ff.map((f) => ({ file: files[f[0]], line: f[1], column: f[2], function: f[3] })));
|
31
|
+
}
|
32
|
+
return result;
|
33
|
+
}
|
34
|
+
function serializeClientSideCallMetadata(metadatas) {
|
35
|
+
const fileNames = /* @__PURE__ */ new Map();
|
36
|
+
const stacks = [];
|
37
|
+
for (const m of metadatas) {
|
38
|
+
if (!m.stack || !m.stack.length)
|
39
|
+
continue;
|
40
|
+
const stack = [];
|
41
|
+
for (const frame of m.stack) {
|
42
|
+
let ordinal = fileNames.get(frame.file);
|
43
|
+
if (typeof ordinal !== "number") {
|
44
|
+
ordinal = fileNames.size;
|
45
|
+
fileNames.set(frame.file, ordinal);
|
46
|
+
}
|
47
|
+
const stackFrame = [ordinal, frame.line || 0, frame.column || 0, frame.function || ""];
|
48
|
+
stack.push(stackFrame);
|
49
|
+
}
|
50
|
+
stacks.push([m.id, stack]);
|
51
|
+
}
|
52
|
+
return { files: [...fileNames.keys()], stacks };
|
53
|
+
}
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
55
|
+
0 && (module.exports = {
|
56
|
+
parseClientSideCallMetadata,
|
57
|
+
serializeClientSideCallMetadata
|
58
|
+
});
|
@@ -0,0 +1,16 @@
|
|
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 __copyProps = (to, from, except, desc) => {
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
for (let key of __getOwnPropNames(from))
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
|
+
}
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
var types_exports = {};
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
@@ -0,0 +1,176 @@
|
|
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 urlMatch_exports = {};
|
20
|
+
__export(urlMatch_exports, {
|
21
|
+
constructURLBasedOnBaseURL: () => constructURLBasedOnBaseURL,
|
22
|
+
globToRegexPattern: () => globToRegexPattern,
|
23
|
+
resolveGlobToRegexPattern: () => resolveGlobToRegexPattern,
|
24
|
+
urlMatches: () => urlMatches,
|
25
|
+
urlMatchesEqual: () => urlMatchesEqual
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(urlMatch_exports);
|
28
|
+
var import_stringUtils = require("./stringUtils");
|
29
|
+
const escapedChars = /* @__PURE__ */ new Set(["$", "^", "+", ".", "*", "(", ")", "|", "\\", "?", "{", "}", "[", "]"]);
|
30
|
+
function globToRegexPattern(glob) {
|
31
|
+
const tokens = ["^"];
|
32
|
+
let inGroup = false;
|
33
|
+
for (let i = 0; i < glob.length; ++i) {
|
34
|
+
const c = glob[i];
|
35
|
+
if (c === "\\" && i + 1 < glob.length) {
|
36
|
+
const char = glob[++i];
|
37
|
+
tokens.push(escapedChars.has(char) ? "\\" + char : char);
|
38
|
+
continue;
|
39
|
+
}
|
40
|
+
if (c === "*") {
|
41
|
+
let starCount = 1;
|
42
|
+
while (glob[i + 1] === "*") {
|
43
|
+
starCount++;
|
44
|
+
i++;
|
45
|
+
}
|
46
|
+
if (starCount > 1)
|
47
|
+
tokens.push("(.*)");
|
48
|
+
else
|
49
|
+
tokens.push("([^/]*)");
|
50
|
+
continue;
|
51
|
+
}
|
52
|
+
switch (c) {
|
53
|
+
case "{":
|
54
|
+
inGroup = true;
|
55
|
+
tokens.push("(");
|
56
|
+
break;
|
57
|
+
case "}":
|
58
|
+
inGroup = false;
|
59
|
+
tokens.push(")");
|
60
|
+
break;
|
61
|
+
case ",":
|
62
|
+
if (inGroup) {
|
63
|
+
tokens.push("|");
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
tokens.push("\\" + c);
|
67
|
+
break;
|
68
|
+
default:
|
69
|
+
tokens.push(escapedChars.has(c) ? "\\" + c : c);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
tokens.push("$");
|
73
|
+
return tokens.join("");
|
74
|
+
}
|
75
|
+
function isRegExp(obj) {
|
76
|
+
return obj instanceof RegExp || Object.prototype.toString.call(obj) === "[object RegExp]";
|
77
|
+
}
|
78
|
+
function urlMatchesEqual(match1, match2) {
|
79
|
+
if (isRegExp(match1) && isRegExp(match2))
|
80
|
+
return match1.source === match2.source && match1.flags === match2.flags;
|
81
|
+
return match1 === match2;
|
82
|
+
}
|
83
|
+
function urlMatches(baseURL, urlString, match, webSocketUrl) {
|
84
|
+
if (match === void 0 || match === "")
|
85
|
+
return true;
|
86
|
+
if ((0, import_stringUtils.isString)(match))
|
87
|
+
match = new RegExp(resolveGlobToRegexPattern(baseURL, match, webSocketUrl));
|
88
|
+
if (isRegExp(match)) {
|
89
|
+
const r = match.test(urlString);
|
90
|
+
return r;
|
91
|
+
}
|
92
|
+
const url = parseURL(urlString);
|
93
|
+
if (!url)
|
94
|
+
return false;
|
95
|
+
if (typeof match !== "function")
|
96
|
+
throw new Error("url parameter should be string, RegExp or function");
|
97
|
+
return match(url);
|
98
|
+
}
|
99
|
+
function resolveGlobToRegexPattern(baseURL, glob, webSocketUrl) {
|
100
|
+
if (webSocketUrl)
|
101
|
+
baseURL = toWebSocketBaseUrl(baseURL);
|
102
|
+
glob = resolveGlobBase(baseURL, glob);
|
103
|
+
return globToRegexPattern(glob);
|
104
|
+
}
|
105
|
+
function toWebSocketBaseUrl(baseURL) {
|
106
|
+
if (baseURL && /^https?:\/\//.test(baseURL))
|
107
|
+
baseURL = baseURL.replace(/^http/, "ws");
|
108
|
+
return baseURL;
|
109
|
+
}
|
110
|
+
function resolveGlobBase(baseURL, match) {
|
111
|
+
if (!match.startsWith("*")) {
|
112
|
+
let mapToken2 = function(original, replacement) {
|
113
|
+
if (original.length === 0)
|
114
|
+
return "";
|
115
|
+
tokenMap.set(replacement, original);
|
116
|
+
return replacement;
|
117
|
+
};
|
118
|
+
var mapToken = mapToken2;
|
119
|
+
const tokenMap = /* @__PURE__ */ new Map();
|
120
|
+
match = match.replaceAll(/\\\\\?/g, "?");
|
121
|
+
if (match.startsWith("about:") || match.startsWith("data:") || match.startsWith("chrome:") || match.startsWith("edge:") || match.startsWith("file:"))
|
122
|
+
return match;
|
123
|
+
const relativePath = match.split("/").map((token, index) => {
|
124
|
+
if (token === "." || token === ".." || token === "")
|
125
|
+
return token;
|
126
|
+
if (index === 0 && token.endsWith(":"))
|
127
|
+
return mapToken2(token, "http:");
|
128
|
+
const questionIndex = token.indexOf("?");
|
129
|
+
if (questionIndex === -1)
|
130
|
+
return mapToken2(token, `$_${index}_$`);
|
131
|
+
const newPrefix = mapToken2(token.substring(0, questionIndex), `$_${index}_$`);
|
132
|
+
const newSuffix = mapToken2(token.substring(questionIndex), `?$_${index}_$`);
|
133
|
+
return newPrefix + newSuffix;
|
134
|
+
}).join("/");
|
135
|
+
const result = resolveBaseURL(baseURL, relativePath);
|
136
|
+
let resolved = result.resolved;
|
137
|
+
for (const [token, original] of tokenMap) {
|
138
|
+
const normalize = result.caseInsensitivePart?.includes(token);
|
139
|
+
resolved = resolved.replace(token, normalize ? original.toLowerCase() : original);
|
140
|
+
}
|
141
|
+
match = resolved;
|
142
|
+
}
|
143
|
+
return match;
|
144
|
+
}
|
145
|
+
function parseURL(url) {
|
146
|
+
try {
|
147
|
+
return new URL(url);
|
148
|
+
} catch (e) {
|
149
|
+
return null;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
function constructURLBasedOnBaseURL(baseURL, givenURL) {
|
153
|
+
try {
|
154
|
+
return resolveBaseURL(baseURL, givenURL).resolved;
|
155
|
+
} catch (e) {
|
156
|
+
return givenURL;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
function resolveBaseURL(baseURL, givenURL) {
|
160
|
+
try {
|
161
|
+
const url = new URL(givenURL, baseURL);
|
162
|
+
const resolved = url.toString();
|
163
|
+
const caseInsensitivePrefix = url.origin;
|
164
|
+
return { resolved, caseInsensitivePart: caseInsensitivePrefix };
|
165
|
+
} catch (e) {
|
166
|
+
return { resolved: givenURL };
|
167
|
+
}
|
168
|
+
}
|
169
|
+
// Annotate the CommonJS export names for ESM import in node:
|
170
|
+
0 && (module.exports = {
|
171
|
+
constructURLBasedOnBaseURL,
|
172
|
+
globToRegexPattern,
|
173
|
+
resolveGlobToRegexPattern,
|
174
|
+
urlMatches,
|
175
|
+
urlMatchesEqual
|
176
|
+
});
|