@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,251 @@
|
|
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 utilityScriptSerializers_exports = {};
|
20
|
+
__export(utilityScriptSerializers_exports, {
|
21
|
+
parseEvaluationResultValue: () => parseEvaluationResultValue,
|
22
|
+
serializeAsCallArgument: () => serializeAsCallArgument
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(utilityScriptSerializers_exports);
|
25
|
+
function isRegExp(obj) {
|
26
|
+
try {
|
27
|
+
return obj instanceof RegExp || Object.prototype.toString.call(obj) === "[object RegExp]";
|
28
|
+
} catch (error) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
function isDate(obj) {
|
33
|
+
try {
|
34
|
+
return obj instanceof Date || Object.prototype.toString.call(obj) === "[object Date]";
|
35
|
+
} catch (error) {
|
36
|
+
return false;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
function isURL(obj) {
|
40
|
+
try {
|
41
|
+
return obj instanceof URL || Object.prototype.toString.call(obj) === "[object URL]";
|
42
|
+
} catch (error) {
|
43
|
+
return false;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
function isError(obj) {
|
47
|
+
try {
|
48
|
+
return obj instanceof Error || obj && Object.getPrototypeOf(obj)?.name === "Error";
|
49
|
+
} catch (error) {
|
50
|
+
return false;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
function isTypedArray(obj, constructor) {
|
54
|
+
try {
|
55
|
+
return obj instanceof constructor || Object.prototype.toString.call(obj) === `[object ${constructor.name}]`;
|
56
|
+
} catch (error) {
|
57
|
+
return false;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
const typedArrayConstructors = {
|
61
|
+
i8: Int8Array,
|
62
|
+
ui8: Uint8Array,
|
63
|
+
ui8c: Uint8ClampedArray,
|
64
|
+
i16: Int16Array,
|
65
|
+
ui16: Uint16Array,
|
66
|
+
i32: Int32Array,
|
67
|
+
ui32: Uint32Array,
|
68
|
+
// TODO: add Float16Array once it's in baseline
|
69
|
+
f32: Float32Array,
|
70
|
+
f64: Float64Array,
|
71
|
+
bi64: BigInt64Array,
|
72
|
+
bui64: BigUint64Array
|
73
|
+
};
|
74
|
+
function typedArrayToBase64(array) {
|
75
|
+
if ("toBase64" in array)
|
76
|
+
return array.toBase64();
|
77
|
+
const binary = Array.from(new Uint8Array(array.buffer, array.byteOffset, array.byteLength)).map((b) => String.fromCharCode(b)).join("");
|
78
|
+
return btoa(binary);
|
79
|
+
}
|
80
|
+
function base64ToTypedArray(base64, TypedArrayConstructor) {
|
81
|
+
const binary = atob(base64);
|
82
|
+
const bytes = new Uint8Array(binary.length);
|
83
|
+
for (let i = 0; i < binary.length; i++)
|
84
|
+
bytes[i] = binary.charCodeAt(i);
|
85
|
+
return new TypedArrayConstructor(bytes.buffer);
|
86
|
+
}
|
87
|
+
function parseEvaluationResultValue(value, handles = [], refs = /* @__PURE__ */ new Map()) {
|
88
|
+
if (Object.is(value, void 0))
|
89
|
+
return void 0;
|
90
|
+
if (typeof value === "object" && value) {
|
91
|
+
if ("ref" in value)
|
92
|
+
return refs.get(value.ref);
|
93
|
+
if ("v" in value) {
|
94
|
+
if (value.v === "undefined")
|
95
|
+
return void 0;
|
96
|
+
if (value.v === "null")
|
97
|
+
return null;
|
98
|
+
if (value.v === "NaN")
|
99
|
+
return NaN;
|
100
|
+
if (value.v === "Infinity")
|
101
|
+
return Infinity;
|
102
|
+
if (value.v === "-Infinity")
|
103
|
+
return -Infinity;
|
104
|
+
if (value.v === "-0")
|
105
|
+
return -0;
|
106
|
+
return void 0;
|
107
|
+
}
|
108
|
+
if ("d" in value) {
|
109
|
+
return new Date(value.d);
|
110
|
+
}
|
111
|
+
if ("u" in value)
|
112
|
+
return new URL(value.u);
|
113
|
+
if ("bi" in value)
|
114
|
+
return BigInt(value.bi);
|
115
|
+
if ("e" in value) {
|
116
|
+
const error = new Error(value.e.m);
|
117
|
+
error.name = value.e.n;
|
118
|
+
error.stack = value.e.s;
|
119
|
+
return error;
|
120
|
+
}
|
121
|
+
if ("r" in value)
|
122
|
+
return new RegExp(value.r.p, value.r.f);
|
123
|
+
if ("a" in value) {
|
124
|
+
const result = [];
|
125
|
+
refs.set(value.id, result);
|
126
|
+
for (const a of value.a)
|
127
|
+
result.push(parseEvaluationResultValue(a, handles, refs));
|
128
|
+
return result;
|
129
|
+
}
|
130
|
+
if ("o" in value) {
|
131
|
+
const result = {};
|
132
|
+
refs.set(value.id, result);
|
133
|
+
for (const { k, v } of value.o) {
|
134
|
+
if (k === "__proto__")
|
135
|
+
continue;
|
136
|
+
result[k] = parseEvaluationResultValue(v, handles, refs);
|
137
|
+
}
|
138
|
+
return result;
|
139
|
+
}
|
140
|
+
if ("h" in value)
|
141
|
+
return handles[value.h];
|
142
|
+
if ("ta" in value)
|
143
|
+
return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);
|
144
|
+
}
|
145
|
+
return value;
|
146
|
+
}
|
147
|
+
function serializeAsCallArgument(value, handleSerializer) {
|
148
|
+
return serialize(value, handleSerializer, { visited: /* @__PURE__ */ new Map(), lastId: 0 });
|
149
|
+
}
|
150
|
+
function serialize(value, handleSerializer, visitorInfo) {
|
151
|
+
if (value && typeof value === "object") {
|
152
|
+
if (typeof globalThis.Window === "function" && value instanceof globalThis.Window)
|
153
|
+
return "ref: <Window>";
|
154
|
+
if (typeof globalThis.Document === "function" && value instanceof globalThis.Document)
|
155
|
+
return "ref: <Document>";
|
156
|
+
if (typeof globalThis.Node === "function" && value instanceof globalThis.Node)
|
157
|
+
return "ref: <Node>";
|
158
|
+
}
|
159
|
+
return innerSerialize(value, handleSerializer, visitorInfo);
|
160
|
+
}
|
161
|
+
function innerSerialize(value, handleSerializer, visitorInfo) {
|
162
|
+
const result = handleSerializer(value);
|
163
|
+
if ("fallThrough" in result)
|
164
|
+
value = result.fallThrough;
|
165
|
+
else
|
166
|
+
return result;
|
167
|
+
if (typeof value === "symbol")
|
168
|
+
return { v: "undefined" };
|
169
|
+
if (Object.is(value, void 0))
|
170
|
+
return { v: "undefined" };
|
171
|
+
if (Object.is(value, null))
|
172
|
+
return { v: "null" };
|
173
|
+
if (Object.is(value, NaN))
|
174
|
+
return { v: "NaN" };
|
175
|
+
if (Object.is(value, Infinity))
|
176
|
+
return { v: "Infinity" };
|
177
|
+
if (Object.is(value, -Infinity))
|
178
|
+
return { v: "-Infinity" };
|
179
|
+
if (Object.is(value, -0))
|
180
|
+
return { v: "-0" };
|
181
|
+
if (typeof value === "boolean")
|
182
|
+
return value;
|
183
|
+
if (typeof value === "number")
|
184
|
+
return value;
|
185
|
+
if (typeof value === "string")
|
186
|
+
return value;
|
187
|
+
if (typeof value === "bigint")
|
188
|
+
return { bi: value.toString() };
|
189
|
+
if (isError(value)) {
|
190
|
+
let stack;
|
191
|
+
if (value.stack?.startsWith(value.name + ": " + value.message)) {
|
192
|
+
stack = value.stack;
|
193
|
+
} else {
|
194
|
+
stack = `${value.name}: ${value.message}
|
195
|
+
${value.stack}`;
|
196
|
+
}
|
197
|
+
return { e: { n: value.name, m: value.message, s: stack } };
|
198
|
+
}
|
199
|
+
if (isDate(value))
|
200
|
+
return { d: value.toJSON() };
|
201
|
+
if (isURL(value))
|
202
|
+
return { u: value.toJSON() };
|
203
|
+
if (isRegExp(value))
|
204
|
+
return { r: { p: value.source, f: value.flags } };
|
205
|
+
for (const [k, ctor] of Object.entries(typedArrayConstructors)) {
|
206
|
+
if (isTypedArray(value, ctor))
|
207
|
+
return { ta: { b: typedArrayToBase64(value), k } };
|
208
|
+
}
|
209
|
+
const id = visitorInfo.visited.get(value);
|
210
|
+
if (id)
|
211
|
+
return { ref: id };
|
212
|
+
if (Array.isArray(value)) {
|
213
|
+
const a = [];
|
214
|
+
const id2 = ++visitorInfo.lastId;
|
215
|
+
visitorInfo.visited.set(value, id2);
|
216
|
+
for (let i = 0; i < value.length; ++i)
|
217
|
+
a.push(serialize(value[i], handleSerializer, visitorInfo));
|
218
|
+
return { a, id: id2 };
|
219
|
+
}
|
220
|
+
if (typeof value === "object") {
|
221
|
+
const o = [];
|
222
|
+
const id2 = ++visitorInfo.lastId;
|
223
|
+
visitorInfo.visited.set(value, id2);
|
224
|
+
for (const name of Object.keys(value)) {
|
225
|
+
let item;
|
226
|
+
try {
|
227
|
+
item = value[name];
|
228
|
+
} catch (e) {
|
229
|
+
continue;
|
230
|
+
}
|
231
|
+
if (name === "toJSON" && typeof item === "function")
|
232
|
+
o.push({ k: name, v: { o: [], id: 0 } });
|
233
|
+
else
|
234
|
+
o.push({ k: name, v: serialize(item, handleSerializer, visitorInfo) });
|
235
|
+
}
|
236
|
+
let jsonWrapper;
|
237
|
+
try {
|
238
|
+
if (o.length === 0 && value.toJSON && typeof value.toJSON === "function")
|
239
|
+
jsonWrapper = { value: value.toJSON() };
|
240
|
+
} catch (e) {
|
241
|
+
}
|
242
|
+
if (jsonWrapper)
|
243
|
+
return innerSerialize(jsonWrapper.value, handleSerializer, visitorInfo);
|
244
|
+
return { o, id: id2 };
|
245
|
+
}
|
246
|
+
}
|
247
|
+
// Annotate the CommonJS export names for ESM import in node:
|
248
|
+
0 && (module.exports = {
|
249
|
+
parseEvaluationResultValue,
|
250
|
+
serializeAsCallArgument
|
251
|
+
});
|
@@ -0,0 +1,78 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getLinuxDistributionInfo = getLinuxDistributionInfo;
|
7
|
+
exports.getLinuxDistributionInfoSync = getLinuxDistributionInfoSync;
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
+
/**
|
11
|
+
* Copyright 2017 Google Inc. All rights reserved.
|
12
|
+
* Modifications copyright (c) Microsoft Corporation.
|
13
|
+
*
|
14
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
15
|
+
* you may not use this file except in compliance with the License.
|
16
|
+
* You may obtain a copy of the License at
|
17
|
+
*
|
18
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
*
|
20
|
+
* Unless required by applicable law or agreed to in writing, software
|
21
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
22
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
23
|
+
* See the License for the specific language governing permissions and
|
24
|
+
* limitations under the License.
|
25
|
+
*/
|
26
|
+
|
27
|
+
let didFailToReadOSRelease = false;
|
28
|
+
let osRelease;
|
29
|
+
async function getLinuxDistributionInfo() {
|
30
|
+
if (process.platform !== 'linux') return undefined;
|
31
|
+
if (!osRelease && !didFailToReadOSRelease) {
|
32
|
+
try {
|
33
|
+
var _fields$get, _fields$get2;
|
34
|
+
// List of /etc/os-release values for different distributions could be
|
35
|
+
// found here: https://gist.github.com/aslushnikov/8ceddb8288e4cf9db3039c02e0f4fb75
|
36
|
+
const osReleaseText = await _fs.default.promises.readFile('/etc/os-release', 'utf8');
|
37
|
+
const fields = parseOSReleaseText(osReleaseText);
|
38
|
+
osRelease = {
|
39
|
+
id: (_fields$get = fields.get('id')) !== null && _fields$get !== void 0 ? _fields$get : '',
|
40
|
+
version: (_fields$get2 = fields.get('version_id')) !== null && _fields$get2 !== void 0 ? _fields$get2 : ''
|
41
|
+
};
|
42
|
+
} catch (e) {
|
43
|
+
didFailToReadOSRelease = true;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return osRelease;
|
47
|
+
}
|
48
|
+
function getLinuxDistributionInfoSync() {
|
49
|
+
if (process.platform !== 'linux') return undefined;
|
50
|
+
if (!osRelease && !didFailToReadOSRelease) {
|
51
|
+
try {
|
52
|
+
var _fields$get3, _fields$get4;
|
53
|
+
// List of /etc/os-release values for different distributions could be
|
54
|
+
// found here: https://gist.github.com/aslushnikov/8ceddb8288e4cf9db3039c02e0f4fb75
|
55
|
+
const osReleaseText = _fs.default.readFileSync('/etc/os-release', 'utf8');
|
56
|
+
const fields = parseOSReleaseText(osReleaseText);
|
57
|
+
osRelease = {
|
58
|
+
id: (_fields$get3 = fields.get('id')) !== null && _fields$get3 !== void 0 ? _fields$get3 : '',
|
59
|
+
version: (_fields$get4 = fields.get('version_id')) !== null && _fields$get4 !== void 0 ? _fields$get4 : ''
|
60
|
+
};
|
61
|
+
} catch (e) {
|
62
|
+
didFailToReadOSRelease = true;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return osRelease;
|
66
|
+
}
|
67
|
+
function parseOSReleaseText(osReleaseText) {
|
68
|
+
const fields = new Map();
|
69
|
+
for (const line of osReleaseText.split('\n')) {
|
70
|
+
const tokens = line.split('=');
|
71
|
+
const name = tokens.shift();
|
72
|
+
let value = tokens.join('=').trim();
|
73
|
+
if (value.startsWith('"') && value.endsWith('"')) value = value.substring(1, value.length - 1);
|
74
|
+
if (!name) continue;
|
75
|
+
fields.set(name.toLowerCase(), value);
|
76
|
+
}
|
77
|
+
return fields;
|
78
|
+
}
|
@@ -0,0 +1,109 @@
|
|
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
|
+
let _Symbol$species, _Symbol$toStringTag;
|
9
|
+
/**
|
10
|
+
* Copyright (c) Microsoft Corporation.
|
11
|
+
*
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
13
|
+
* you may not use this file except in compliance with the License.
|
14
|
+
* You may obtain a copy of the License at
|
15
|
+
*
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
*
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21
|
+
* See the License for the specific language governing permissions and
|
22
|
+
* limitations under the License.
|
23
|
+
*/
|
24
|
+
_Symbol$species = Symbol.species;
|
25
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
26
|
+
class ManualPromise extends Promise {
|
27
|
+
constructor() {
|
28
|
+
let resolve;
|
29
|
+
let reject;
|
30
|
+
super((f, r) => {
|
31
|
+
resolve = f;
|
32
|
+
reject = r;
|
33
|
+
});
|
34
|
+
this._resolve = void 0;
|
35
|
+
this._reject = void 0;
|
36
|
+
this._isDone = void 0;
|
37
|
+
this._isDone = false;
|
38
|
+
this._resolve = resolve;
|
39
|
+
this._reject = reject;
|
40
|
+
}
|
41
|
+
isDone() {
|
42
|
+
return this._isDone;
|
43
|
+
}
|
44
|
+
resolve(t) {
|
45
|
+
this._isDone = true;
|
46
|
+
this._resolve(t);
|
47
|
+
}
|
48
|
+
reject(e) {
|
49
|
+
this._isDone = true;
|
50
|
+
this._reject(e);
|
51
|
+
}
|
52
|
+
static get [_Symbol$species]() {
|
53
|
+
return Promise;
|
54
|
+
}
|
55
|
+
get [_Symbol$toStringTag]() {
|
56
|
+
return 'ManualPromise';
|
57
|
+
}
|
58
|
+
}
|
59
|
+
exports.ManualPromise = ManualPromise;
|
60
|
+
class LongStandingScope {
|
61
|
+
constructor() {
|
62
|
+
this._terminateError = void 0;
|
63
|
+
this._closeError = void 0;
|
64
|
+
this._terminatePromises = new Map();
|
65
|
+
this._isClosed = false;
|
66
|
+
}
|
67
|
+
reject(error) {
|
68
|
+
this._isClosed = true;
|
69
|
+
this._terminateError = error;
|
70
|
+
for (const p of this._terminatePromises.keys()) p.resolve(error);
|
71
|
+
}
|
72
|
+
close(error) {
|
73
|
+
this._isClosed = true;
|
74
|
+
this._closeError = error;
|
75
|
+
for (const [p, frames] of this._terminatePromises) p.resolve(cloneError(error, frames));
|
76
|
+
}
|
77
|
+
isClosed() {
|
78
|
+
return this._isClosed;
|
79
|
+
}
|
80
|
+
static async raceMultiple(scopes, promise) {
|
81
|
+
return Promise.race(scopes.map(s => s.race(promise)));
|
82
|
+
}
|
83
|
+
async race(promise) {
|
84
|
+
return this._race(Array.isArray(promise) ? promise : [promise], false);
|
85
|
+
}
|
86
|
+
async safeRace(promise, defaultValue) {
|
87
|
+
return this._race([promise], true, defaultValue);
|
88
|
+
}
|
89
|
+
async _race(promises, safe, defaultValue) {
|
90
|
+
const terminatePromise = new ManualPromise();
|
91
|
+
const frames = (0, _stackTrace.captureRawStack)();
|
92
|
+
if (this._terminateError) terminatePromise.resolve(this._terminateError);
|
93
|
+
if (this._closeError) terminatePromise.resolve(cloneError(this._closeError, frames));
|
94
|
+
this._terminatePromises.set(terminatePromise, frames);
|
95
|
+
try {
|
96
|
+
return await Promise.race([terminatePromise.then(e => safe ? defaultValue : Promise.reject(e)), ...promises]);
|
97
|
+
} finally {
|
98
|
+
this._terminatePromises.delete(terminatePromise);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
exports.LongStandingScope = LongStandingScope;
|
103
|
+
function cloneError(error, frames) {
|
104
|
+
const clone = new Error();
|
105
|
+
clone.name = error.name;
|
106
|
+
clone.message = error.message;
|
107
|
+
clone.stack = [error.name + ':' + error.message, ...frames].join('\n');
|
108
|
+
return clone;
|
109
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.isJsonMimeType = isJsonMimeType;
|
7
|
+
exports.isTextualMimeType = isTextualMimeType;
|
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
|
+
function isJsonMimeType(mimeType) {
|
25
|
+
return !!mimeType.match(/^(application\/json|application\/.*?\+json|text\/(x-)?json)(;\s*charset=.*)?$/);
|
26
|
+
}
|
27
|
+
function isTextualMimeType(mimeType) {
|
28
|
+
return !!mimeType.match(/^(text\/.*?|application\/(json|(x-)?javascript|xml.*?|ecmascript|graphql|x-www-form-urlencoded)|image\/svg(\+xml)?|application\/.*?(\+json|\+xml))(;\s*charset=.*)?$/);
|
29
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.MultiMap = void 0;
|
7
|
+
let _Symbol$iterator;
|
8
|
+
_Symbol$iterator = Symbol.iterator;
|
9
|
+
/**
|
10
|
+
* Copyright (c) Microsoft Corporation.
|
11
|
+
*
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
13
|
+
* you may not use this file except in compliance with the License.
|
14
|
+
* You may obtain a copy of the License at
|
15
|
+
*
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
*
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21
|
+
* See the License for the specific language governing permissions and
|
22
|
+
* limitations under the License.
|
23
|
+
*/
|
24
|
+
|
25
|
+
class MultiMap {
|
26
|
+
constructor() {
|
27
|
+
this._map = void 0;
|
28
|
+
this._map = new Map();
|
29
|
+
}
|
30
|
+
set(key, value) {
|
31
|
+
let values = this._map.get(key);
|
32
|
+
if (!values) {
|
33
|
+
values = [];
|
34
|
+
this._map.set(key, values);
|
35
|
+
}
|
36
|
+
values.push(value);
|
37
|
+
}
|
38
|
+
get(key) {
|
39
|
+
return this._map.get(key) || [];
|
40
|
+
}
|
41
|
+
has(key) {
|
42
|
+
return this._map.has(key);
|
43
|
+
}
|
44
|
+
delete(key, value) {
|
45
|
+
const values = this._map.get(key);
|
46
|
+
if (!values) return;
|
47
|
+
if (values.includes(value)) this._map.set(key, values.filter(v => value !== v));
|
48
|
+
}
|
49
|
+
deleteAll(key) {
|
50
|
+
this._map.delete(key);
|
51
|
+
}
|
52
|
+
hasValue(key, value) {
|
53
|
+
const values = this._map.get(key);
|
54
|
+
if (!values) return false;
|
55
|
+
return values.includes(value);
|
56
|
+
}
|
57
|
+
get size() {
|
58
|
+
return this._map.size;
|
59
|
+
}
|
60
|
+
[_Symbol$iterator]() {
|
61
|
+
return this._map[Symbol.iterator]();
|
62
|
+
}
|
63
|
+
keys() {
|
64
|
+
return this._map.keys();
|
65
|
+
}
|
66
|
+
values() {
|
67
|
+
const result = [];
|
68
|
+
for (const key of this.keys()) result.push(...this.get(key));
|
69
|
+
return result;
|
70
|
+
}
|
71
|
+
clear() {
|
72
|
+
this._map.clear();
|
73
|
+
}
|
74
|
+
}
|
75
|
+
exports.MultiMap = MultiMap;
|