rebrowser-playwright-core 1.52.0 → 1.64.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 +7 -1554
- package/bin/install_webkit_wsl.ps1 +33 -0
- package/bin/reinstall_chrome_beta_linux.sh +1 -1
- package/bin/reinstall_chrome_beta_mac.sh +1 -1
- package/bin/reinstall_chrome_stable_linux.sh +1 -1
- package/bin/reinstall_chrome_stable_mac.sh +1 -1
- package/bin/reinstall_msedge_beta_linux.sh +1 -1
- package/bin/reinstall_msedge_beta_mac.sh +1 -1
- package/bin/reinstall_msedge_dev_linux.sh +1 -1
- package/bin/reinstall_msedge_dev_mac.sh +1 -1
- package/bin/reinstall_msedge_stable_linux.sh +1 -1
- package/bin/reinstall_msedge_stable_mac.sh +1 -1
- package/browsers.json +16 -44
- package/cli.js +5 -1
- package/index.js +2 -17
- package/lib/bootstrap.js +149 -0
- package/lib/coreBundle.js +78218 -0
- package/lib/entry/cliDaemon.js +5 -0
- package/lib/entry/dashboardApp.js +3 -0
- package/lib/entry/mcp.js +10 -0
- package/lib/entry/oopBrowserDownload.js +3 -0
- package/lib/{server/deviceDescriptors.js → package.js} +18 -7
- package/lib/server/electron/loader.js +108 -14
- package/lib/serverRegistry.js +1939 -0
- package/lib/serverRegistry.js.LICENSE +65 -0
- package/lib/tools/cli-client/channelSessions.js +141 -0
- package/lib/tools/cli-client/cli.js +7 -0
- package/lib/tools/cli-client/help.json +808 -0
- package/lib/tools/cli-client/minimist.js +128 -0
- package/lib/tools/cli-client/output.js +352 -0
- package/lib/tools/cli-client/program.js +422 -0
- package/lib/tools/cli-client/registry.js +180 -0
- package/lib/tools/cli-client/session.js +261 -0
- package/lib/tools/dashboard/appIcon.png +0 -0
- package/lib/tools/skills/playwright-cli/SKILL.md +493 -0
- package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
- package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- package/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
- package/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
- package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- package/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
- package/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
- package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
- package/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
- package/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
- package/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
- package/lib/tools/skills/playwright-trace/SKILL.md +174 -0
- package/lib/tools/utils/extension.js +112 -0
- package/lib/tools/utils/socketConnection.js +108 -0
- package/lib/utilsBundle.js +86038 -66
- package/lib/utilsBundle.js.LICENSE +1890 -0
- package/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/lib/vite/dashboard/index.html +29 -0
- package/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/lib/vite/htmlReport/index.html +2 -61
- package/lib/vite/htmlReport/report.css +2 -0
- package/lib/vite/htmlReport/report.js +32 -0
- package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
- package/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- package/lib/vite/recorder/index.html +3 -3
- package/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
- package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/lib/vite/traceViewer/index.html +9 -8
- package/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
- package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/lib/vite/traceViewer/snapshot.html +4 -15
- package/lib/vite/traceViewer/sw.bundle.js +4 -3
- package/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
- package/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/lib/vite/traceViewer/uiMode.html +6 -5
- package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/lib/webp_codec.LICENSE +173 -0
- package/lib/webp_codec.wasm +0 -0
- package/lib/{utilsBundleImpl/xdg-open → xdg-open} +338 -137
- package/package.json +6 -16
- package/types/protocol.d.ts +10495 -8030
- package/types/structs.d.ts +8 -1
- package/types/types.d.ts +9256 -4825
- package/lib/androidServerImpl.js +0 -63
- package/lib/browserServerImpl.js +0 -88
- package/lib/cli/driver.js +0 -97
- package/lib/cli/program.js +0 -567
- package/lib/cli/programWithTestStub.js +0 -74
- package/lib/client/accessibility.js +0 -49
- package/lib/client/android.js +0 -365
- package/lib/client/api.js +0 -137
- package/lib/client/artifact.js +0 -79
- package/lib/client/browser.js +0 -136
- package/lib/client/browserContext.js +0 -539
- package/lib/client/browserType.js +0 -193
- package/lib/client/cdpSession.js +0 -51
- package/lib/client/channelOwner.js +0 -205
- package/lib/client/clientHelper.js +0 -64
- package/lib/client/clientInstrumentation.js +0 -55
- package/lib/client/clientStackTrace.js +0 -69
- package/lib/client/clock.js +0 -68
- package/lib/client/connection.js +0 -318
- package/lib/client/consoleMessage.js +0 -55
- package/lib/client/coverage.js +0 -44
- package/lib/client/dialog.js +0 -56
- package/lib/client/download.js +0 -62
- package/lib/client/electron.js +0 -133
- package/lib/client/elementHandle.js +0 -284
- package/lib/client/errors.js +0 -77
- package/lib/client/eventEmitter.js +0 -314
- package/lib/client/events.js +0 -98
- package/lib/client/fetch.js +0 -367
- package/lib/client/fileChooser.js +0 -46
- package/lib/client/fileUtils.js +0 -34
- package/lib/client/frame.js +0 -386
- package/lib/client/harRouter.js +0 -87
- package/lib/client/input.js +0 -82
- package/lib/client/jsHandle.js +0 -105
- package/lib/client/jsonPipe.js +0 -39
- package/lib/client/localUtils.js +0 -61
- package/lib/client/locator.js +0 -362
- package/lib/client/network.js +0 -751
- package/lib/client/page.js +0 -709
- package/lib/client/platform.js +0 -74
- package/lib/client/playwright.js +0 -85
- package/lib/client/selectors.js +0 -75
- package/lib/client/stream.js +0 -39
- package/lib/client/timeoutSettings.js +0 -75
- package/lib/client/tracing.js +0 -114
- package/lib/client/types.js +0 -28
- package/lib/client/video.js +0 -59
- package/lib/client/waiter.js +0 -142
- package/lib/client/webError.js +0 -39
- package/lib/client/webSocket.js +0 -111
- package/lib/client/worker.js +0 -63
- package/lib/client/writableStream.js +0 -39
- package/lib/generated/clockSource.js +0 -28
- package/lib/generated/consoleApiSource.js +0 -28
- package/lib/generated/injectedScriptSource.js +0 -28
- package/lib/generated/pollingRecorderSource.js +0 -28
- package/lib/generated/utilityScriptSource.js +0 -28
- package/lib/generated/webSocketMockSource.js +0 -378
- package/lib/inProcessFactory.js +0 -59
- package/lib/inprocess.js +0 -3
- package/lib/outofprocess.js +0 -78
- package/lib/protocol/debug.js +0 -211
- package/lib/protocol/serializers.js +0 -192
- package/lib/protocol/validator.js +0 -2825
- package/lib/protocol/validatorPrimitives.js +0 -179
- package/lib/remote/playwrightConnection.js +0 -266
- package/lib/remote/playwrightServer.js +0 -139
- package/lib/server/accessibility.js +0 -69
- package/lib/server/android/android.js +0 -451
- package/lib/server/android/backendAdb.js +0 -179
- package/lib/server/artifact.js +0 -127
- package/lib/server/bidi/bidiBrowser.js +0 -380
- package/lib/server/bidi/bidiChromium.js +0 -152
- package/lib/server/bidi/bidiConnection.js +0 -187
- package/lib/server/bidi/bidiExecutionContext.js +0 -220
- package/lib/server/bidi/bidiFirefox.js +0 -112
- package/lib/server/bidi/bidiInput.js +0 -146
- package/lib/server/bidi/bidiNetworkManager.js +0 -320
- package/lib/server/bidi/bidiOverCdp.js +0 -102
- package/lib/server/bidi/bidiPage.js +0 -530
- package/lib/server/bidi/bidiPdf.js +0 -106
- package/lib/server/bidi/third_party/bidiCommands.d.js +0 -22
- package/lib/server/bidi/third_party/bidiDeserializer.js +0 -98
- package/lib/server/bidi/third_party/bidiKeyboard.js +0 -256
- package/lib/server/bidi/third_party/bidiProtocol.js +0 -152
- package/lib/server/bidi/third_party/bidiSerializer.js +0 -148
- package/lib/server/bidi/third_party/firefoxPrefs.js +0 -259
- package/lib/server/browser.js +0 -140
- package/lib/server/browserContext.js +0 -650
- package/lib/server/browserType.js +0 -326
- package/lib/server/callLog.js +0 -82
- package/lib/server/chromium/chromium.js +0 -376
- package/lib/server/chromium/chromiumSwitches.js +0 -101
- package/lib/server/chromium/crAccessibility.js +0 -263
- package/lib/server/chromium/crBrowser.js +0 -498
- package/lib/server/chromium/crConnection.js +0 -324
- package/lib/server/chromium/crCoverage.js +0 -232
- package/lib/server/chromium/crDevTools.js +0 -117
- package/lib/server/chromium/crDragDrop.js +0 -126
- package/lib/server/chromium/crExecutionContext.js +0 -145
- package/lib/server/chromium/crInput.js +0 -184
- package/lib/server/chromium/crNetworkManager.js +0 -666
- package/lib/server/chromium/crPage.js +0 -1055
- package/lib/server/chromium/crPdf.js +0 -121
- package/lib/server/chromium/crProtocolHelper.js +0 -145
- package/lib/server/chromium/crServiceWorker.js +0 -130
- package/lib/server/chromium/defaultFontFamilies.js +0 -162
- package/lib/server/chromium/protocol.d.js +0 -16
- package/lib/server/chromium/videoRecorder.js +0 -121
- package/lib/server/clock.js +0 -137
- package/lib/server/codegen/csharp.js +0 -329
- package/lib/server/codegen/java.js +0 -270
- package/lib/server/codegen/javascript.js +0 -268
- package/lib/server/codegen/jsonl.js +0 -51
- package/lib/server/codegen/language.js +0 -111
- package/lib/server/codegen/languages.js +0 -68
- package/lib/server/codegen/python.js +0 -277
- package/lib/server/codegen/types.js +0 -16
- package/lib/server/console.js +0 -53
- package/lib/server/cookieStore.js +0 -204
- package/lib/server/debugController.js +0 -185
- package/lib/server/debugger.js +0 -136
- package/lib/server/deviceDescriptorsSource.json +0 -1669
- package/lib/server/dialog.js +0 -72
- package/lib/server/dispatchers/androidDispatcher.js +0 -293
- package/lib/server/dispatchers/artifactDispatcher.js +0 -118
- package/lib/server/dispatchers/browserContextDispatcher.js +0 -328
- package/lib/server/dispatchers/browserDispatcher.js +0 -151
- package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
- package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -44
- package/lib/server/dispatchers/debugControllerDispatcher.js +0 -87
- package/lib/server/dispatchers/dialogDispatcher.js +0 -47
- package/lib/server/dispatchers/dispatcher.js +0 -346
- package/lib/server/dispatchers/electronDispatcher.js +0 -90
- package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -191
- package/lib/server/dispatchers/frameDispatcher.js +0 -224
- package/lib/server/dispatchers/jsHandleDispatcher.js +0 -80
- package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -58
- package/lib/server/dispatchers/localUtilsDispatcher.js +0 -155
- package/lib/server/dispatchers/networkDispatchers.js +0 -204
- package/lib/server/dispatchers/pageDispatcher.js +0 -328
- package/lib/server/dispatchers/playwrightDispatcher.js +0 -100
- package/lib/server/dispatchers/selectorsDispatcher.js +0 -40
- package/lib/server/dispatchers/streamDispatcher.js +0 -60
- package/lib/server/dispatchers/tracingDispatcher.js +0 -59
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -154
- package/lib/server/dispatchers/writableStreamDispatcher.js +0 -73
- package/lib/server/dom.js +0 -869
- package/lib/server/download.js +0 -70
- package/lib/server/electron/electron.js +0 -277
- package/lib/server/errors.js +0 -69
- package/lib/server/fetch.js +0 -640
- package/lib/server/fileChooser.js +0 -43
- package/lib/server/fileUploadUtils.js +0 -84
- package/lib/server/firefox/ffAccessibility.js +0 -238
- package/lib/server/firefox/ffBrowser.js +0 -404
- package/lib/server/firefox/ffConnection.js +0 -147
- package/lib/server/firefox/ffExecutionContext.js +0 -149
- package/lib/server/firefox/ffInput.js +0 -159
- package/lib/server/firefox/ffNetworkManager.js +0 -254
- package/lib/server/firefox/ffPage.js +0 -501
- package/lib/server/firefox/firefox.js +0 -106
- package/lib/server/firefox/protocol.d.js +0 -16
- package/lib/server/formData.js +0 -147
- package/lib/server/frameSelectors.js +0 -137
- package/lib/server/frames.js +0 -1555
- package/lib/server/har/harRecorder.js +0 -147
- package/lib/server/har/harTracer.js +0 -606
- package/lib/server/harBackend.js +0 -157
- package/lib/server/helper.js +0 -100
- package/lib/server/index.js +0 -61
- package/lib/server/input.js +0 -280
- package/lib/server/instrumentation.js +0 -75
- package/lib/server/javascript.js +0 -299
- package/lib/server/launchApp.js +0 -110
- package/lib/server/localUtils.js +0 -211
- package/lib/server/macEditingCommands.js +0 -143
- package/lib/server/network.js +0 -583
- package/lib/server/page.js +0 -790
- package/lib/server/pageBinding.js +0 -88
- package/lib/server/pipeTransport.js +0 -89
- package/lib/server/playwright.js +0 -81
- package/lib/server/progress.js +0 -104
- package/lib/server/protocolError.js +0 -52
- package/lib/server/recorder/chat.js +0 -161
- package/lib/server/recorder/contextRecorder.js +0 -286
- package/lib/server/recorder/recorderApp.js +0 -184
- package/lib/server/recorder/recorderCollection.js +0 -116
- package/lib/server/recorder/recorderFrontend.js +0 -16
- package/lib/server/recorder/recorderRunner.js +0 -135
- package/lib/server/recorder/recorderUtils.js +0 -100
- package/lib/server/recorder/throttledFile.js +0 -57
- package/lib/server/recorder.js +0 -360
- package/lib/server/registry/browserFetcher.js +0 -175
- package/lib/server/registry/dependencies.js +0 -371
- package/lib/server/registry/index.js +0 -1271
- package/lib/server/registry/nativeDeps.js +0 -1105
- package/lib/server/registry/oopDownloadBrowserMain.js +0 -120
- package/lib/server/screenshotter.js +0 -332
- package/lib/server/selectors.js +0 -112
- package/lib/server/socksClientCertificatesInterceptor.js +0 -321
- package/lib/server/socksInterceptor.js +0 -95
- package/lib/server/storageScript.js +0 -154
- package/lib/server/timeoutSettings.js +0 -89
- package/lib/server/trace/recorder/snapshotter.js +0 -143
- package/lib/server/trace/recorder/snapshotterInjected.js +0 -539
- package/lib/server/trace/recorder/tracing.js +0 -593
- package/lib/server/trace/test/inMemorySnapshotter.js +0 -87
- package/lib/server/trace/viewer/traceViewer.js +0 -249
- package/lib/server/transport.js +0 -183
- package/lib/server/types.js +0 -28
- package/lib/server/usKeyboardLayout.js +0 -145
- package/lib/server/utils/ascii.js +0 -44
- package/lib/server/utils/comparators.js +0 -161
- package/lib/server/utils/crypto.js +0 -216
- package/lib/server/utils/debug.js +0 -47
- package/lib/server/utils/debugLogger.js +0 -114
- package/lib/server/utils/env.js +0 -68
- package/lib/server/utils/eventsHelper.js +0 -39
- package/lib/server/utils/expectUtils.js +0 -38
- package/lib/server/utils/fileUtils.js +0 -191
- package/lib/server/utils/happyEyeballs.js +0 -207
- package/lib/server/utils/hostPlatform.js +0 -109
- package/lib/server/utils/httpServer.js +0 -218
- package/lib/server/utils/image_tools/colorUtils.js +0 -89
- package/lib/server/utils/image_tools/compare.js +0 -109
- package/lib/server/utils/image_tools/imageChannel.js +0 -78
- package/lib/server/utils/image_tools/stats.js +0 -102
- package/lib/server/utils/linuxUtils.js +0 -71
- package/lib/server/utils/network.js +0 -217
- package/lib/server/utils/nodePlatform.js +0 -148
- package/lib/server/utils/pipeTransport.js +0 -84
- package/lib/server/utils/processLauncher.js +0 -238
- package/lib/server/utils/profiler.js +0 -65
- package/lib/server/utils/socksProxy.js +0 -511
- package/lib/server/utils/spawnAsync.js +0 -41
- package/lib/server/utils/task.js +0 -51
- package/lib/server/utils/userAgent.js +0 -98
- package/lib/server/utils/wsServer.js +0 -132
- package/lib/server/utils/zipFile.js +0 -74
- package/lib/server/utils/zones.js +0 -57
- package/lib/server/webkit/protocol.d.js +0 -16
- package/lib/server/webkit/webkit.js +0 -100
- package/lib/server/webkit/wkAccessibility.js +0 -237
- package/lib/server/webkit/wkBrowser.js +0 -312
- package/lib/server/webkit/wkConnection.js +0 -149
- package/lib/server/webkit/wkExecutionContext.js +0 -153
- package/lib/server/webkit/wkInput.js +0 -181
- package/lib/server/webkit/wkInterceptableRequest.js +0 -169
- package/lib/server/webkit/wkPage.js +0 -1114
- package/lib/server/webkit/wkProvisionalPage.js +0 -83
- package/lib/server/webkit/wkWorkers.js +0 -104
- package/lib/third_party/pixelmatch.js +0 -255
- package/lib/utils/isomorphic/ariaSnapshot.js +0 -384
- package/lib/utils/isomorphic/assert.js +0 -31
- package/lib/utils/isomorphic/builtins.js +0 -90
- package/lib/utils/isomorphic/colors.js +0 -72
- package/lib/utils/isomorphic/cssParser.js +0 -246
- package/lib/utils/isomorphic/cssTokenizer.js +0 -1051
- package/lib/utils/isomorphic/headers.js +0 -53
- package/lib/utils/isomorphic/locatorGenerators.js +0 -655
- package/lib/utils/isomorphic/locatorParser.js +0 -176
- package/lib/utils/isomorphic/locatorUtils.js +0 -81
- package/lib/utils/isomorphic/manualPromise.js +0 -115
- package/lib/utils/isomorphic/mimeType.js +0 -460
- package/lib/utils/isomorphic/multimap.js +0 -81
- package/lib/utils/isomorphic/rtti.js +0 -43
- package/lib/utils/isomorphic/selectorParser.js +0 -387
- package/lib/utils/isomorphic/semaphore.js +0 -54
- package/lib/utils/isomorphic/stackTrace.js +0 -158
- package/lib/utils/isomorphic/stringUtils.js +0 -176
- package/lib/utils/isomorphic/time.js +0 -44
- package/lib/utils/isomorphic/timeoutRunner.js +0 -67
- package/lib/utils/isomorphic/traceUtils.js +0 -59
- package/lib/utils/isomorphic/types.js +0 -16
- package/lib/utils/isomorphic/urlMatch.js +0 -167
- package/lib/utils/isomorphic/utilityScriptSerializers.js +0 -248
- package/lib/utils.js +0 -101
- package/lib/utilsBundleImpl/index.js +0 -208
- package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
- package/lib/vite/recorder/assets/codeMirrorModule-DVQi6prl.js +0 -24
- package/lib/vite/recorder/assets/index-97EUAAbk.js +0 -184
- package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-DwAiTpyC.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-DkkRvn5X.js +0 -265
- package/lib/vite/traceViewer/assets/xtermModule-BoAIEibi.js +0 -9
- package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.DvtSwn6E.js +0 -2
- package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
- package/lib/vite/traceViewer/uiMode.Sdytl9wc.js +0 -5
- package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
- package/lib/zipBundle.js +0 -34
- package/lib/zipBundleImpl.js +0 -5
package/lib/server/javascript.js
DELETED
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var javascript_exports = {};
|
|
30
|
-
__export(javascript_exports, {
|
|
31
|
-
ExecutionContext: () => ExecutionContext,
|
|
32
|
-
JSHandle: () => JSHandle,
|
|
33
|
-
JavaScriptErrorInEvaluate: () => JavaScriptErrorInEvaluate,
|
|
34
|
-
evaluate: () => evaluate,
|
|
35
|
-
evaluateExpression: () => evaluateExpression,
|
|
36
|
-
isJavaScriptErrorInEvaluate: () => isJavaScriptErrorInEvaluate,
|
|
37
|
-
normalizeEvaluationExpression: () => normalizeEvaluationExpression,
|
|
38
|
-
parseEvaluationResultValue: () => parseEvaluationResultValue,
|
|
39
|
-
parseUnserializableValue: () => parseUnserializableValue,
|
|
40
|
-
serializeAsCallArgument: () => serializeAsCallArgument,
|
|
41
|
-
sparseArrayToString: () => sparseArrayToString
|
|
42
|
-
});
|
|
43
|
-
module.exports = __toCommonJS(javascript_exports);
|
|
44
|
-
var import_instrumentation = require("./instrumentation");
|
|
45
|
-
var utilityScriptSource = __toESM(require("../generated/utilityScriptSource"));
|
|
46
|
-
var import_utils = require("../utils");
|
|
47
|
-
var import_builtins = require("../utils/isomorphic/builtins");
|
|
48
|
-
var import_utilityScriptSerializers = require("../utils/isomorphic/utilityScriptSerializers");
|
|
49
|
-
var import_manualPromise = require("../utils/isomorphic/manualPromise");
|
|
50
|
-
const utilityScriptSerializers = (0, import_utilityScriptSerializers.source)((0, import_builtins.builtins)());
|
|
51
|
-
const parseEvaluationResultValue = utilityScriptSerializers.parseEvaluationResultValue;
|
|
52
|
-
const serializeAsCallArgument = utilityScriptSerializers.serializeAsCallArgument;
|
|
53
|
-
class ExecutionContext extends import_instrumentation.SdkObject {
|
|
54
|
-
constructor(parent, delegate, worldNameForTest) {
|
|
55
|
-
super(parent, "execution-context");
|
|
56
|
-
this._contextDestroyedScope = new import_manualPromise.LongStandingScope();
|
|
57
|
-
this.worldNameForTest = worldNameForTest;
|
|
58
|
-
this.delegate = delegate;
|
|
59
|
-
}
|
|
60
|
-
contextDestroyed(reason) {
|
|
61
|
-
this._contextDestroyedScope.close(new Error(reason));
|
|
62
|
-
}
|
|
63
|
-
async _raceAgainstContextDestroyed(promise) {
|
|
64
|
-
return this._contextDestroyedScope.race(promise);
|
|
65
|
-
}
|
|
66
|
-
rawEvaluateJSON(expression) {
|
|
67
|
-
return this._raceAgainstContextDestroyed(this.delegate.rawEvaluateJSON(expression));
|
|
68
|
-
}
|
|
69
|
-
rawEvaluateHandle(expression) {
|
|
70
|
-
return this._raceAgainstContextDestroyed(this.delegate.rawEvaluateHandle(this, expression));
|
|
71
|
-
}
|
|
72
|
-
async evaluateWithArguments(expression, returnByValue, values, handles) {
|
|
73
|
-
const utilityScript = await this._utilityScript();
|
|
74
|
-
return this._raceAgainstContextDestroyed(this.delegate.evaluateWithArguments(expression, returnByValue, utilityScript, values, handles));
|
|
75
|
-
}
|
|
76
|
-
getProperties(object) {
|
|
77
|
-
return this._raceAgainstContextDestroyed(this.delegate.getProperties(object));
|
|
78
|
-
}
|
|
79
|
-
releaseHandle(handle) {
|
|
80
|
-
return this.delegate.releaseHandle(handle);
|
|
81
|
-
}
|
|
82
|
-
adoptIfNeeded(handle) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
_utilityScript() {
|
|
86
|
-
if (!this._utilityScriptPromise) {
|
|
87
|
-
const source2 = `
|
|
88
|
-
(() => {
|
|
89
|
-
const module = {};
|
|
90
|
-
${utilityScriptSource.source}
|
|
91
|
-
return new (module.exports.UtilityScript())(${(0, import_utils.isUnderTest)()});
|
|
92
|
-
})();`;
|
|
93
|
-
this._utilityScriptPromise = this._raceAgainstContextDestroyed(this.delegate.rawEvaluateHandle(this, source2)).then((handle) => {
|
|
94
|
-
handle._setPreview("UtilityScript");
|
|
95
|
-
return handle;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return this._utilityScriptPromise;
|
|
99
|
-
}
|
|
100
|
-
async doSlowMo() {
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
class JSHandle extends import_instrumentation.SdkObject {
|
|
104
|
-
constructor(context, type, preview, objectId, value) {
|
|
105
|
-
super(context, "handle");
|
|
106
|
-
this.__jshandle = true;
|
|
107
|
-
this._disposed = false;
|
|
108
|
-
this._context = context;
|
|
109
|
-
this._objectId = objectId;
|
|
110
|
-
this._value = value;
|
|
111
|
-
this._objectType = type;
|
|
112
|
-
this._preview = this._objectId ? preview || `JSHandle@${this._objectType}` : String(value);
|
|
113
|
-
if (this._objectId && globalThis.leakedJSHandles)
|
|
114
|
-
globalThis.leakedJSHandles.set(this, new Error("Leaked JSHandle"));
|
|
115
|
-
}
|
|
116
|
-
async evaluate(pageFunction, arg) {
|
|
117
|
-
return evaluate(this._context, true, pageFunction, this, arg);
|
|
118
|
-
}
|
|
119
|
-
async evaluateHandle(pageFunction, arg) {
|
|
120
|
-
return evaluate(this._context, false, pageFunction, this, arg);
|
|
121
|
-
}
|
|
122
|
-
async evaluateExpression(expression, options, arg) {
|
|
123
|
-
const value = await evaluateExpression(this._context, expression, { ...options, returnByValue: true }, this, arg);
|
|
124
|
-
await this._context.doSlowMo();
|
|
125
|
-
return value;
|
|
126
|
-
}
|
|
127
|
-
async evaluateExpressionHandle(expression, options, arg) {
|
|
128
|
-
const value = await evaluateExpression(this._context, expression, { ...options, returnByValue: false }, this, arg);
|
|
129
|
-
await this._context.doSlowMo();
|
|
130
|
-
return value;
|
|
131
|
-
}
|
|
132
|
-
async getProperty(propertyName) {
|
|
133
|
-
const objectHandle = await this.evaluateHandle((object, propertyName2) => {
|
|
134
|
-
const result2 = { __proto__: null };
|
|
135
|
-
result2[propertyName2] = object[propertyName2];
|
|
136
|
-
return result2;
|
|
137
|
-
}, propertyName);
|
|
138
|
-
const properties = await objectHandle.getProperties();
|
|
139
|
-
const result = properties.get(propertyName);
|
|
140
|
-
objectHandle.dispose();
|
|
141
|
-
return result;
|
|
142
|
-
}
|
|
143
|
-
async getProperties() {
|
|
144
|
-
if (!this._objectId)
|
|
145
|
-
return /* @__PURE__ */ new Map();
|
|
146
|
-
return this._context.getProperties(this);
|
|
147
|
-
}
|
|
148
|
-
rawValue() {
|
|
149
|
-
return this._value;
|
|
150
|
-
}
|
|
151
|
-
async jsonValue() {
|
|
152
|
-
if (!this._objectId)
|
|
153
|
-
return this._value;
|
|
154
|
-
const script = `(utilityScript, ...args) => utilityScript.jsonValue(...args)`;
|
|
155
|
-
return this._context.evaluateWithArguments(script, true, [true], [this]);
|
|
156
|
-
}
|
|
157
|
-
asElement() {
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
dispose() {
|
|
161
|
-
if (this._disposed)
|
|
162
|
-
return;
|
|
163
|
-
this._disposed = true;
|
|
164
|
-
if (this._objectId) {
|
|
165
|
-
this._context.releaseHandle(this).catch((e) => {
|
|
166
|
-
});
|
|
167
|
-
if (globalThis.leakedJSHandles)
|
|
168
|
-
globalThis.leakedJSHandles.delete(this);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
toString() {
|
|
172
|
-
return this._preview;
|
|
173
|
-
}
|
|
174
|
-
_setPreviewCallback(callback) {
|
|
175
|
-
this._previewCallback = callback;
|
|
176
|
-
}
|
|
177
|
-
preview() {
|
|
178
|
-
return this._preview;
|
|
179
|
-
}
|
|
180
|
-
worldNameForTest() {
|
|
181
|
-
return this._context.worldNameForTest;
|
|
182
|
-
}
|
|
183
|
-
_setPreview(preview) {
|
|
184
|
-
this._preview = preview;
|
|
185
|
-
if (this._previewCallback)
|
|
186
|
-
this._previewCallback(preview);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
async function evaluate(context, returnByValue, pageFunction, ...args) {
|
|
190
|
-
return evaluateExpression(context, String(pageFunction), { returnByValue, isFunction: typeof pageFunction === "function" }, ...args);
|
|
191
|
-
}
|
|
192
|
-
async function evaluateExpression(context, expression, options, ...args) {
|
|
193
|
-
expression = normalizeEvaluationExpression(expression, options.isFunction);
|
|
194
|
-
const handles = [];
|
|
195
|
-
const toDispose = [];
|
|
196
|
-
const pushHandle = (handle) => {
|
|
197
|
-
handles.push(handle);
|
|
198
|
-
return handles.length - 1;
|
|
199
|
-
};
|
|
200
|
-
args = args.map((arg) => serializeAsCallArgument(arg, (handle) => {
|
|
201
|
-
if (handle instanceof JSHandle) {
|
|
202
|
-
if (!handle._objectId)
|
|
203
|
-
return { fallThrough: handle._value };
|
|
204
|
-
if (handle._disposed)
|
|
205
|
-
throw new JavaScriptErrorInEvaluate("JSHandle is disposed!");
|
|
206
|
-
const adopted = context.adoptIfNeeded(handle);
|
|
207
|
-
if (adopted === null)
|
|
208
|
-
return { h: pushHandle(Promise.resolve(handle)) };
|
|
209
|
-
toDispose.push(adopted);
|
|
210
|
-
return { h: pushHandle(adopted) };
|
|
211
|
-
}
|
|
212
|
-
return { fallThrough: handle };
|
|
213
|
-
}));
|
|
214
|
-
const utilityScriptObjects = [];
|
|
215
|
-
for (const handle of await Promise.all(handles)) {
|
|
216
|
-
if (handle._context !== context)
|
|
217
|
-
throw new JavaScriptErrorInEvaluate("JSHandles can be evaluated only in the context they were created!");
|
|
218
|
-
utilityScriptObjects.push(handle);
|
|
219
|
-
}
|
|
220
|
-
const utilityScriptValues = [options.isFunction, options.returnByValue, expression, args.length, ...args];
|
|
221
|
-
const script = `(utilityScript, ...args) => utilityScript.evaluate(...args)`;
|
|
222
|
-
try {
|
|
223
|
-
return await context.evaluateWithArguments(script, options.returnByValue || false, utilityScriptValues, utilityScriptObjects);
|
|
224
|
-
} finally {
|
|
225
|
-
toDispose.map((handlePromise) => handlePromise.then((handle) => handle.dispose()));
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
function parseUnserializableValue(unserializableValue) {
|
|
229
|
-
if (unserializableValue === "NaN")
|
|
230
|
-
return NaN;
|
|
231
|
-
if (unserializableValue === "Infinity")
|
|
232
|
-
return Infinity;
|
|
233
|
-
if (unserializableValue === "-Infinity")
|
|
234
|
-
return -Infinity;
|
|
235
|
-
if (unserializableValue === "-0")
|
|
236
|
-
return -0;
|
|
237
|
-
}
|
|
238
|
-
function normalizeEvaluationExpression(expression, isFunction) {
|
|
239
|
-
expression = expression.trim();
|
|
240
|
-
if (isFunction) {
|
|
241
|
-
try {
|
|
242
|
-
new Function("(" + expression + ")");
|
|
243
|
-
} catch (e1) {
|
|
244
|
-
if (expression.startsWith("async "))
|
|
245
|
-
expression = "async function " + expression.substring("async ".length);
|
|
246
|
-
else
|
|
247
|
-
expression = "function " + expression;
|
|
248
|
-
try {
|
|
249
|
-
new Function("(" + expression + ")");
|
|
250
|
-
} catch (e2) {
|
|
251
|
-
throw new Error("Passed function is not well-serializable!");
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (/^(async)?\s*function(\s|\()/.test(expression))
|
|
256
|
-
expression = "(" + expression + ")";
|
|
257
|
-
return expression;
|
|
258
|
-
}
|
|
259
|
-
class JavaScriptErrorInEvaluate extends Error {
|
|
260
|
-
}
|
|
261
|
-
function isJavaScriptErrorInEvaluate(error) {
|
|
262
|
-
return error instanceof JavaScriptErrorInEvaluate;
|
|
263
|
-
}
|
|
264
|
-
function sparseArrayToString(entries) {
|
|
265
|
-
const arrayEntries = [];
|
|
266
|
-
for (const { name, value } of entries) {
|
|
267
|
-
const index = +name;
|
|
268
|
-
if (isNaN(index) || index < 0)
|
|
269
|
-
continue;
|
|
270
|
-
arrayEntries.push({ index, value });
|
|
271
|
-
}
|
|
272
|
-
arrayEntries.sort((a, b) => a.index - b.index);
|
|
273
|
-
let lastIndex = -1;
|
|
274
|
-
const tokens = [];
|
|
275
|
-
for (const { index, value } of arrayEntries) {
|
|
276
|
-
const emptyItems = index - lastIndex - 1;
|
|
277
|
-
if (emptyItems === 1)
|
|
278
|
-
tokens.push(`empty`);
|
|
279
|
-
else if (emptyItems > 1)
|
|
280
|
-
tokens.push(`empty x ${emptyItems}`);
|
|
281
|
-
tokens.push(String(value));
|
|
282
|
-
lastIndex = index;
|
|
283
|
-
}
|
|
284
|
-
return "[" + tokens.join(", ") + "]";
|
|
285
|
-
}
|
|
286
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
287
|
-
0 && (module.exports = {
|
|
288
|
-
ExecutionContext,
|
|
289
|
-
JSHandle,
|
|
290
|
-
JavaScriptErrorInEvaluate,
|
|
291
|
-
evaluate,
|
|
292
|
-
evaluateExpression,
|
|
293
|
-
isJavaScriptErrorInEvaluate,
|
|
294
|
-
normalizeEvaluationExpression,
|
|
295
|
-
parseEvaluationResultValue,
|
|
296
|
-
parseUnserializableValue,
|
|
297
|
-
serializeAsCallArgument,
|
|
298
|
-
sparseArrayToString
|
|
299
|
-
});
|
package/lib/server/launchApp.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var launchApp_exports = {};
|
|
30
|
-
__export(launchApp_exports, {
|
|
31
|
-
launchApp: () => launchApp,
|
|
32
|
-
syncLocalStorageWithSettings: () => syncLocalStorageWithSettings
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(launchApp_exports);
|
|
35
|
-
var import_fs = __toESM(require("fs"));
|
|
36
|
-
var import_path = __toESM(require("path"));
|
|
37
|
-
var import_utils = require("../utils");
|
|
38
|
-
var import_instrumentation = require("./instrumentation");
|
|
39
|
-
var import_registry = require("./registry");
|
|
40
|
-
var import_registry2 = require("./registry");
|
|
41
|
-
async function launchApp(browserType, options) {
|
|
42
|
-
const args = [...options.persistentContextOptions?.args ?? []];
|
|
43
|
-
let channel = options.persistentContextOptions?.channel;
|
|
44
|
-
if (browserType.name() === "chromium") {
|
|
45
|
-
args.push(
|
|
46
|
-
"--app=data:text/html,",
|
|
47
|
-
`--window-size=${options.windowSize.width},${options.windowSize.height}`,
|
|
48
|
-
...options.windowPosition ? [`--window-position=${options.windowPosition.x},${options.windowPosition.y}`] : [],
|
|
49
|
-
"--test-type="
|
|
50
|
-
);
|
|
51
|
-
if (!channel && !options.persistentContextOptions?.executablePath)
|
|
52
|
-
channel = (0, import_registry.findChromiumChannel)(options.sdkLanguage);
|
|
53
|
-
}
|
|
54
|
-
const context = await browserType.launchPersistentContext((0, import_instrumentation.serverSideCallMetadata)(), "", {
|
|
55
|
-
ignoreDefaultArgs: ["--enable-automation"],
|
|
56
|
-
...options?.persistentContextOptions,
|
|
57
|
-
channel,
|
|
58
|
-
noDefaultViewport: options.persistentContextOptions?.noDefaultViewport ?? true,
|
|
59
|
-
acceptDownloads: options?.persistentContextOptions?.acceptDownloads ?? ((0, import_utils.isUnderTest)() ? "accept" : "internal-browser-default"),
|
|
60
|
-
colorScheme: options?.persistentContextOptions?.colorScheme ?? "no-override",
|
|
61
|
-
args
|
|
62
|
-
});
|
|
63
|
-
const [page] = context.pages();
|
|
64
|
-
if (browserType.name() === "chromium" && process.platform === "darwin") {
|
|
65
|
-
context.on("page", async (newPage) => {
|
|
66
|
-
if (newPage.mainFrame().url() === "chrome://new-tab-page/") {
|
|
67
|
-
await page.bringToFront();
|
|
68
|
-
await newPage.close((0, import_instrumentation.serverSideCallMetadata)());
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
if (browserType.name() === "chromium")
|
|
73
|
-
await installAppIcon(page);
|
|
74
|
-
return { context, page };
|
|
75
|
-
}
|
|
76
|
-
async function installAppIcon(page) {
|
|
77
|
-
const icon = await import_fs.default.promises.readFile(require.resolve("./chromium/appIcon.png"));
|
|
78
|
-
const crPage = page._delegate;
|
|
79
|
-
await crPage._mainFrameSession._client.send("Browser.setDockTile", {
|
|
80
|
-
image: icon.toString("base64")
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
async function syncLocalStorageWithSettings(page, appName) {
|
|
84
|
-
if ((0, import_utils.isUnderTest)())
|
|
85
|
-
return;
|
|
86
|
-
const settingsFile = import_path.default.join(import_registry2.registryDirectory, ".settings", `${appName}.json`);
|
|
87
|
-
await page.exposeBinding("_saveSerializedSettings", false, (_, settings2) => {
|
|
88
|
-
import_fs.default.mkdirSync(import_path.default.dirname(settingsFile), { recursive: true });
|
|
89
|
-
import_fs.default.writeFileSync(settingsFile, settings2);
|
|
90
|
-
});
|
|
91
|
-
const settings = await import_fs.default.promises.readFile(settingsFile, "utf-8").catch(() => "{}");
|
|
92
|
-
await page.addInitScript(
|
|
93
|
-
`(${String((settings2) => {
|
|
94
|
-
if (location && location.protocol === "data:")
|
|
95
|
-
return;
|
|
96
|
-
if (window.top !== window)
|
|
97
|
-
return;
|
|
98
|
-
Object.entries(settings2).map(([k, v]) => localStorage[k] = v);
|
|
99
|
-
window.saveSettings = () => {
|
|
100
|
-
window._saveSerializedSettings(JSON.stringify({ ...localStorage }));
|
|
101
|
-
};
|
|
102
|
-
})})(${settings});
|
|
103
|
-
`
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
-
0 && (module.exports = {
|
|
108
|
-
launchApp,
|
|
109
|
-
syncLocalStorageWithSettings
|
|
110
|
-
});
|
package/lib/server/localUtils.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var localUtils_exports = {};
|
|
30
|
-
__export(localUtils_exports, {
|
|
31
|
-
addStackToTracingNoReply: () => addStackToTracingNoReply,
|
|
32
|
-
harClose: () => harClose,
|
|
33
|
-
harLookup: () => harLookup,
|
|
34
|
-
harOpen: () => harOpen,
|
|
35
|
-
harUnzip: () => harUnzip,
|
|
36
|
-
traceDiscarded: () => traceDiscarded,
|
|
37
|
-
tracingStarted: () => tracingStarted,
|
|
38
|
-
zip: () => zip
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(localUtils_exports);
|
|
41
|
-
var import_fs = __toESM(require("fs"));
|
|
42
|
-
var import_os = __toESM(require("os"));
|
|
43
|
-
var import_path = __toESM(require("path"));
|
|
44
|
-
var import_crypto = require("./utils/crypto");
|
|
45
|
-
var import_harBackend = require("./harBackend");
|
|
46
|
-
var import_manualPromise = require("../utils/isomorphic/manualPromise");
|
|
47
|
-
var import_zipFile = require("./utils/zipFile");
|
|
48
|
-
var import_zipBundle = require("../zipBundle");
|
|
49
|
-
var import_traceUtils = require("../utils/isomorphic/traceUtils");
|
|
50
|
-
var import_assert = require("../utils/isomorphic/assert");
|
|
51
|
-
var import_fileUtils = require("./utils/fileUtils");
|
|
52
|
-
async function zip(stackSessions, params) {
|
|
53
|
-
const promise = new import_manualPromise.ManualPromise();
|
|
54
|
-
const zipFile = new import_zipBundle.yazl.ZipFile();
|
|
55
|
-
zipFile.on("error", (error) => promise.reject(error));
|
|
56
|
-
const addFile = (file, name) => {
|
|
57
|
-
try {
|
|
58
|
-
if (import_fs.default.statSync(file).isFile())
|
|
59
|
-
zipFile.addFile(file, name);
|
|
60
|
-
} catch (e) {
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
for (const entry of params.entries)
|
|
64
|
-
addFile(entry.value, entry.name);
|
|
65
|
-
const stackSession = params.stacksId ? stackSessions.get(params.stacksId) : void 0;
|
|
66
|
-
if (stackSession?.callStacks.length) {
|
|
67
|
-
await stackSession.writer;
|
|
68
|
-
if (process.env.PW_LIVE_TRACE_STACKS) {
|
|
69
|
-
zipFile.addFile(stackSession.file, "trace.stacks");
|
|
70
|
-
} else {
|
|
71
|
-
const buffer = Buffer.from(JSON.stringify((0, import_traceUtils.serializeClientSideCallMetadata)(stackSession.callStacks)));
|
|
72
|
-
zipFile.addBuffer(buffer, "trace.stacks");
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (params.includeSources) {
|
|
76
|
-
const sourceFiles = /* @__PURE__ */ new Set();
|
|
77
|
-
for (const { stack } of stackSession?.callStacks || []) {
|
|
78
|
-
if (!stack)
|
|
79
|
-
continue;
|
|
80
|
-
for (const { file } of stack)
|
|
81
|
-
sourceFiles.add(file);
|
|
82
|
-
}
|
|
83
|
-
for (const sourceFile of sourceFiles)
|
|
84
|
-
addFile(sourceFile, "resources/src@" + await (0, import_crypto.calculateSha1)(sourceFile) + ".txt");
|
|
85
|
-
}
|
|
86
|
-
if (params.mode === "write") {
|
|
87
|
-
await import_fs.default.promises.mkdir(import_path.default.dirname(params.zipFile), { recursive: true });
|
|
88
|
-
zipFile.end(void 0, () => {
|
|
89
|
-
zipFile.outputStream.pipe(import_fs.default.createWriteStream(params.zipFile)).on("close", () => promise.resolve()).on("error", (error) => promise.reject(error));
|
|
90
|
-
});
|
|
91
|
-
await promise;
|
|
92
|
-
await deleteStackSession(stackSessions, params.stacksId);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const tempFile = params.zipFile + ".tmp";
|
|
96
|
-
await import_fs.default.promises.rename(params.zipFile, tempFile);
|
|
97
|
-
import_zipBundle.yauzl.open(tempFile, (err, inZipFile) => {
|
|
98
|
-
if (err) {
|
|
99
|
-
promise.reject(err);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
(0, import_assert.assert)(inZipFile);
|
|
103
|
-
let pendingEntries = inZipFile.entryCount;
|
|
104
|
-
inZipFile.on("entry", (entry) => {
|
|
105
|
-
inZipFile.openReadStream(entry, (err2, readStream) => {
|
|
106
|
-
if (err2) {
|
|
107
|
-
promise.reject(err2);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
zipFile.addReadStream(readStream, entry.fileName);
|
|
111
|
-
if (--pendingEntries === 0) {
|
|
112
|
-
zipFile.end(void 0, () => {
|
|
113
|
-
zipFile.outputStream.pipe(import_fs.default.createWriteStream(params.zipFile)).on("close", () => {
|
|
114
|
-
import_fs.default.promises.unlink(tempFile).then(() => {
|
|
115
|
-
promise.resolve();
|
|
116
|
-
}).catch((error) => promise.reject(error));
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
await promise;
|
|
124
|
-
await deleteStackSession(stackSessions, params.stacksId);
|
|
125
|
-
}
|
|
126
|
-
async function deleteStackSession(stackSessions, stacksId) {
|
|
127
|
-
const session = stacksId ? stackSessions.get(stacksId) : void 0;
|
|
128
|
-
if (!session)
|
|
129
|
-
return;
|
|
130
|
-
await session.writer;
|
|
131
|
-
if (session.tmpDir)
|
|
132
|
-
await (0, import_fileUtils.removeFolders)([session.tmpDir]);
|
|
133
|
-
stackSessions.delete(stacksId);
|
|
134
|
-
}
|
|
135
|
-
async function harOpen(harBackends, params) {
|
|
136
|
-
let harBackend;
|
|
137
|
-
if (params.file.endsWith(".zip")) {
|
|
138
|
-
const zipFile = new import_zipFile.ZipFile(params.file);
|
|
139
|
-
const entryNames = await zipFile.entries();
|
|
140
|
-
const harEntryName = entryNames.find((e) => e.endsWith(".har"));
|
|
141
|
-
if (!harEntryName)
|
|
142
|
-
return { error: "Specified archive does not have a .har file" };
|
|
143
|
-
const har = await zipFile.read(harEntryName);
|
|
144
|
-
const harFile = JSON.parse(har.toString());
|
|
145
|
-
harBackend = new import_harBackend.HarBackend(harFile, null, zipFile);
|
|
146
|
-
} else {
|
|
147
|
-
const harFile = JSON.parse(await import_fs.default.promises.readFile(params.file, "utf-8"));
|
|
148
|
-
harBackend = new import_harBackend.HarBackend(harFile, import_path.default.dirname(params.file), null);
|
|
149
|
-
}
|
|
150
|
-
harBackends.set(harBackend.id, harBackend);
|
|
151
|
-
return { harId: harBackend.id };
|
|
152
|
-
}
|
|
153
|
-
async function harLookup(harBackends, params) {
|
|
154
|
-
const harBackend = harBackends.get(params.harId);
|
|
155
|
-
if (!harBackend)
|
|
156
|
-
return { action: "error", message: `Internal error: har was not opened` };
|
|
157
|
-
return await harBackend.lookup(params.url, params.method, params.headers, params.postData, params.isNavigationRequest);
|
|
158
|
-
}
|
|
159
|
-
async function harClose(harBackends, params) {
|
|
160
|
-
const harBackend = harBackends.get(params.harId);
|
|
161
|
-
if (harBackend) {
|
|
162
|
-
harBackends.delete(harBackend.id);
|
|
163
|
-
harBackend.dispose();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
async function harUnzip(params) {
|
|
167
|
-
const dir = import_path.default.dirname(params.zipFile);
|
|
168
|
-
const zipFile = new import_zipFile.ZipFile(params.zipFile);
|
|
169
|
-
for (const entry of await zipFile.entries()) {
|
|
170
|
-
const buffer = await zipFile.read(entry);
|
|
171
|
-
if (entry === "har.har")
|
|
172
|
-
await import_fs.default.promises.writeFile(params.harFile, buffer);
|
|
173
|
-
else
|
|
174
|
-
await import_fs.default.promises.writeFile(import_path.default.join(dir, entry), buffer);
|
|
175
|
-
}
|
|
176
|
-
zipFile.close();
|
|
177
|
-
await import_fs.default.promises.unlink(params.zipFile);
|
|
178
|
-
}
|
|
179
|
-
async function tracingStarted(stackSessions, params) {
|
|
180
|
-
let tmpDir = void 0;
|
|
181
|
-
if (!params.tracesDir)
|
|
182
|
-
tmpDir = await import_fs.default.promises.mkdtemp(import_path.default.join(import_os.default.tmpdir(), "playwright-tracing-"));
|
|
183
|
-
const traceStacksFile = import_path.default.join(params.tracesDir || tmpDir, params.traceName + ".stacks");
|
|
184
|
-
stackSessions.set(traceStacksFile, { callStacks: [], file: traceStacksFile, writer: Promise.resolve(), tmpDir });
|
|
185
|
-
return { stacksId: traceStacksFile };
|
|
186
|
-
}
|
|
187
|
-
async function traceDiscarded(stackSessions, params) {
|
|
188
|
-
await deleteStackSession(stackSessions, params.stacksId);
|
|
189
|
-
}
|
|
190
|
-
async function addStackToTracingNoReply(stackSessions, params) {
|
|
191
|
-
for (const session of stackSessions.values()) {
|
|
192
|
-
session.callStacks.push(params.callData);
|
|
193
|
-
if (process.env.PW_LIVE_TRACE_STACKS) {
|
|
194
|
-
session.writer = session.writer.then(() => {
|
|
195
|
-
const buffer = Buffer.from(JSON.stringify((0, import_traceUtils.serializeClientSideCallMetadata)(session.callStacks)));
|
|
196
|
-
return import_fs.default.promises.writeFile(session.file, buffer);
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
202
|
-
0 && (module.exports = {
|
|
203
|
-
addStackToTracingNoReply,
|
|
204
|
-
harClose,
|
|
205
|
-
harLookup,
|
|
206
|
-
harOpen,
|
|
207
|
-
harUnzip,
|
|
208
|
-
traceDiscarded,
|
|
209
|
-
tracingStarted,
|
|
210
|
-
zip
|
|
211
|
-
});
|