@smoothdeploy/playwright-core 1.58.4 → 1.60.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 -4070
- package/browsers.json +16 -14
- package/cli.js +4 -1
- package/index.js +1 -1
- package/lib/bootstrap.js +77 -0
- package/lib/coreBundle.js +70057 -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/deviceDescriptorsSource.json +137 -137
- package/lib/server/electron/loader.js +99 -13
- package/lib/serverRegistry.js +7343 -0
- package/lib/serverRegistry.js.LICENSE +354 -0
- package/lib/tools/cli-client/channelSessions.js +141 -0
- package/lib/tools/cli-client/cli.js +6 -0
- package/lib/tools/cli-client/help.json +679 -0
- package/lib/tools/cli-client/minimist.js +128 -0
- package/lib/tools/cli-client/output.js +343 -0
- package/lib/tools/cli-client/program.js +380 -0
- package/lib/tools/cli-client/registry.js +176 -0
- package/lib/tools/cli-client/session.js +265 -0
- package/lib/tools/cli-client/skill/SKILL.md +388 -0
- package/lib/tools/cli-client/skill/references/element-attributes.md +23 -0
- package/lib/tools/cli-client/skill/references/playwright-tests.md +39 -0
- package/lib/tools/cli-client/skill/references/request-mocking.md +87 -0
- package/lib/tools/cli-client/skill/references/running-code.md +241 -0
- package/lib/tools/cli-client/skill/references/session-management.md +225 -0
- package/lib/tools/cli-client/skill/references/spec-driven-testing.md +305 -0
- package/lib/tools/cli-client/skill/references/storage-state.md +275 -0
- package/lib/tools/cli-client/skill/references/test-generation.md +134 -0
- package/lib/tools/cli-client/skill/references/tracing.md +139 -0
- package/lib/tools/cli-client/skill/references/video-recording.md +143 -0
- package/lib/tools/dashboard/appIcon.png +0 -0
- package/lib/tools/trace/SKILL.md +171 -0
- package/lib/{server/utils/profiler.js → tools/utils/extension.js} +42 -29
- package/lib/tools/utils/socketConnection.js +108 -0
- package/lib/utilsBundle.js +85377 -68
- package/lib/utilsBundle.js.LICENSE +2002 -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-BY2S1tHT.css +1 -0
- package/lib/vite/dashboard/assets/index-DpEq2p62.js +52 -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 -70
- package/lib/vite/htmlReport/report.css +1 -0
- package/lib/vite/htmlReport/report.js +72 -0
- package/lib/vite/recorder/assets/{codeMirrorModule-SGmxtuwi.js → codeMirrorModule-DyIpd_mA.js} +20 -20
- package/lib/vite/recorder/assets/index-4ZiSSCmn.css +1 -0
- package/lib/vite/recorder/assets/index-5q9Mg4LR.js +195 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/{codeMirrorModule-BOUrQdmH.js → codeMirrorModule-DZq9EItR.js} +20 -20
- package/lib/vite/traceViewer/assets/defaultSettingsView-D4EpQvB-.js +262 -0
- package/lib/vite/traceViewer/assets/urlMatch-BYQrIQwR.js +1 -0
- package/lib/vite/traceViewer/defaultSettingsView.BDKsFU3c.css +1 -0
- package/lib/vite/traceViewer/{index.BVu7tZDe.css → index.CzXZzn5A.css} +1 -1
- package/lib/vite/traceViewer/index.html +5 -4
- package/lib/vite/traceViewer/index.uj4g7lWX.js +2 -0
- package/lib/vite/traceViewer/snapshot.html +4 -15
- package/lib/vite/traceViewer/snapshot.v8KI4P3m.js +2 -0
- package/lib/vite/traceViewer/sw.bundle.js +4 -4
- package/lib/vite/traceViewer/uiMode.B1W9rAxj.js +6 -0
- package/lib/vite/traceViewer/uiMode.html +4 -3
- package/package.json +4 -14
- package/types/protocol.d.ts +1084 -343
- package/types/types.d.ts +6035 -4360
- package/lib/androidServerImpl.js +0 -65
- package/lib/browserServerImpl.js +0 -120
- package/lib/cli/driver.js +0 -97
- package/lib/cli/program.js +0 -589
- package/lib/cli/programWithTestStub.js +0 -74
- package/lib/client/android.js +0 -361
- package/lib/client/api.js +0 -137
- package/lib/client/artifact.js +0 -79
- package/lib/client/browser.js +0 -161
- package/lib/client/browserContext.js +0 -582
- package/lib/client/browserType.js +0 -185
- package/lib/client/cdpSession.js +0 -51
- package/lib/client/channelOwner.js +0 -195
- package/lib/client/clientHelper.js +0 -64
- package/lib/client/clientInstrumentation.js +0 -65
- 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 -58
- 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 -138
- 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 -103
- package/lib/client/fetch.js +0 -368
- package/lib/client/fileChooser.js +0 -46
- package/lib/client/fileUtils.js +0 -34
- package/lib/client/frame.js +0 -409
- package/lib/client/harRouter.js +0 -87
- package/lib/client/input.js +0 -84
- package/lib/client/jsHandle.js +0 -109
- package/lib/client/jsonPipe.js +0 -39
- package/lib/client/localUtils.js +0 -60
- package/lib/client/locator.js +0 -369
- package/lib/client/network.js +0 -747
- package/lib/client/page.js +0 -745
- package/lib/client/pageAgent.js +0 -64
- package/lib/client/platform.js +0 -77
- package/lib/client/playwright.js +0 -71
- package/lib/client/selectors.js +0 -55
- package/lib/client/stream.js +0 -39
- package/lib/client/timeoutSettings.js +0 -79
- package/lib/client/tracing.js +0 -119
- 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 -93
- package/lib/client/worker.js +0 -85
- package/lib/client/writableStream.js +0 -39
- package/lib/generated/bindingsControllerSource.js +0 -28
- package/lib/generated/clockSource.js +0 -28
- package/lib/generated/injectedScriptSource.js +0 -28
- package/lib/generated/pollingRecorderSource.js +0 -28
- package/lib/generated/storageScriptSource.js +0 -28
- package/lib/generated/utilityScriptSource.js +0 -28
- package/lib/generated/webSocketMockSource.js +0 -336
- package/lib/inProcessFactory.js +0 -60
- package/lib/inprocess.js +0 -3
- package/lib/mcpBundle.js +0 -84
- package/lib/mcpBundleImpl/index.js +0 -147
- package/lib/outofprocess.js +0 -76
- package/lib/protocol/serializers.js +0 -197
- package/lib/protocol/validator.js +0 -3023
- package/lib/protocol/validatorPrimitives.js +0 -193
- package/lib/remote/playwrightConnection.js +0 -129
- package/lib/remote/playwrightServer.js +0 -334
- package/lib/server/agent/actionRunner.js +0 -335
- package/lib/server/agent/actions.js +0 -128
- package/lib/server/agent/codegen.js +0 -111
- package/lib/server/agent/context.js +0 -150
- package/lib/server/agent/expectTools.js +0 -156
- package/lib/server/agent/pageAgent.js +0 -204
- package/lib/server/agent/performTools.js +0 -262
- package/lib/server/agent/tool.js +0 -109
- package/lib/server/android/android.js +0 -465
- package/lib/server/android/backendAdb.js +0 -177
- package/lib/server/artifact.js +0 -127
- package/lib/server/bidi/bidiBrowser.js +0 -549
- package/lib/server/bidi/bidiChromium.js +0 -149
- package/lib/server/bidi/bidiConnection.js +0 -213
- package/lib/server/bidi/bidiDeserializer.js +0 -116
- package/lib/server/bidi/bidiExecutionContext.js +0 -267
- package/lib/server/bidi/bidiFirefox.js +0 -128
- package/lib/server/bidi/bidiInput.js +0 -146
- package/lib/server/bidi/bidiNetworkManager.js +0 -383
- package/lib/server/bidi/bidiOverCdp.js +0 -102
- package/lib/server/bidi/bidiPage.js +0 -583
- 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/bidiKeyboard.js +0 -256
- package/lib/server/bidi/third_party/bidiProtocol.js +0 -24
- package/lib/server/bidi/third_party/bidiProtocolCore.js +0 -180
- package/lib/server/bidi/third_party/bidiProtocolPermissions.js +0 -42
- 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 -149
- package/lib/server/browserContext.js +0 -700
- package/lib/server/browserType.js +0 -336
- package/lib/server/callLog.js +0 -82
- package/lib/server/chromium/chromium.js +0 -397
- package/lib/server/chromium/chromiumSwitches.js +0 -104
- package/lib/server/chromium/crBrowser.js +0 -520
- package/lib/server/chromium/crConnection.js +0 -197
- package/lib/server/chromium/crCoverage.js +0 -235
- package/lib/server/chromium/crDevTools.js +0 -111
- package/lib/server/chromium/crDragDrop.js +0 -131
- package/lib/server/chromium/crExecutionContext.js +0 -146
- package/lib/server/chromium/crInput.js +0 -187
- package/lib/server/chromium/crNetworkManager.js +0 -707
- package/lib/server/chromium/crPage.js +0 -1001
- package/lib/server/chromium/crPdf.js +0 -121
- package/lib/server/chromium/crProtocolHelper.js +0 -145
- package/lib/server/chromium/crServiceWorker.js +0 -136
- package/lib/server/chromium/defaultFontFamilies.js +0 -162
- package/lib/server/chromium/protocol.d.js +0 -16
- package/lib/server/clock.js +0 -149
- package/lib/server/codegen/csharp.js +0 -327
- package/lib/server/codegen/java.js +0 -274
- package/lib/server/codegen/javascript.js +0 -247
- package/lib/server/codegen/jsonl.js +0 -52
- package/lib/server/codegen/language.js +0 -133
- package/lib/server/codegen/languages.js +0 -68
- package/lib/server/codegen/python.js +0 -279
- package/lib/server/codegen/types.js +0 -16
- package/lib/server/console.js +0 -57
- package/lib/server/cookieStore.js +0 -206
- package/lib/server/debugController.js +0 -181
- package/lib/server/debugger.js +0 -119
- package/lib/server/dialog.js +0 -116
- package/lib/server/dispatchers/androidDispatcher.js +0 -325
- package/lib/server/dispatchers/artifactDispatcher.js +0 -118
- package/lib/server/dispatchers/browserContextDispatcher.js +0 -384
- package/lib/server/dispatchers/browserDispatcher.js +0 -118
- package/lib/server/dispatchers/browserTypeDispatcher.js +0 -64
- package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -44
- package/lib/server/dispatchers/debugControllerDispatcher.js +0 -78
- package/lib/server/dispatchers/dialogDispatcher.js +0 -47
- package/lib/server/dispatchers/dispatcher.js +0 -364
- package/lib/server/dispatchers/electronDispatcher.js +0 -89
- package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -181
- package/lib/server/dispatchers/frameDispatcher.js +0 -227
- package/lib/server/dispatchers/jsHandleDispatcher.js +0 -85
- package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -58
- package/lib/server/dispatchers/localUtilsDispatcher.js +0 -149
- package/lib/server/dispatchers/networkDispatchers.js +0 -213
- package/lib/server/dispatchers/pageAgentDispatcher.js +0 -96
- package/lib/server/dispatchers/pageDispatcher.js +0 -393
- package/lib/server/dispatchers/playwrightDispatcher.js +0 -108
- package/lib/server/dispatchers/streamDispatcher.js +0 -67
- package/lib/server/dispatchers/tracingDispatcher.js +0 -68
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -165
- package/lib/server/dispatchers/writableStreamDispatcher.js +0 -79
- package/lib/server/dom.js +0 -815
- package/lib/server/download.js +0 -70
- package/lib/server/electron/electron.js +0 -273
- package/lib/server/errors.js +0 -69
- package/lib/server/fetch.js +0 -621
- package/lib/server/fileChooser.js +0 -43
- package/lib/server/fileUploadUtils.js +0 -84
- package/lib/server/firefox/ffBrowser.js +0 -418
- package/lib/server/firefox/ffConnection.js +0 -142
- package/lib/server/firefox/ffExecutionContext.js +0 -150
- package/lib/server/firefox/ffInput.js +0 -159
- package/lib/server/firefox/ffNetworkManager.js +0 -256
- package/lib/server/firefox/ffPage.js +0 -497
- package/lib/server/firefox/firefox.js +0 -114
- package/lib/server/firefox/protocol.d.js +0 -16
- package/lib/server/formData.js +0 -147
- package/lib/server/frameSelectors.js +0 -160
- package/lib/server/frames.js +0 -1471
- package/lib/server/har/harRecorder.js +0 -147
- package/lib/server/har/harTracer.js +0 -607
- package/lib/server/harBackend.js +0 -157
- package/lib/server/helper.js +0 -96
- package/lib/server/index.js +0 -58
- package/lib/server/input.js +0 -277
- package/lib/server/instrumentation.js +0 -72
- package/lib/server/javascript.js +0 -291
- package/lib/server/launchApp.js +0 -128
- package/lib/server/localUtils.js +0 -214
- package/lib/server/macEditingCommands.js +0 -143
- package/lib/server/network.js +0 -667
- package/lib/server/page.js +0 -830
- package/lib/server/pipeTransport.js +0 -89
- package/lib/server/playwright.js +0 -69
- package/lib/server/progress.js +0 -132
- package/lib/server/protocolError.js +0 -52
- package/lib/server/recorder/chat.js +0 -161
- package/lib/server/recorder/recorderApp.js +0 -366
- package/lib/server/recorder/recorderRunner.js +0 -138
- package/lib/server/recorder/recorderSignalProcessor.js +0 -83
- package/lib/server/recorder/recorderUtils.js +0 -157
- package/lib/server/recorder/throttledFile.js +0 -57
- package/lib/server/recorder.js +0 -554
- package/lib/server/registry/browserFetcher.js +0 -177
- package/lib/server/registry/dependencies.js +0 -371
- package/lib/server/registry/index.js +0 -1422
- package/lib/server/registry/nativeDeps.js +0 -1280
- package/lib/server/registry/oopDownloadBrowserMain.js +0 -127
- package/lib/server/screencast.js +0 -190
- package/lib/server/screenshotCompositor.js +0 -153
- package/lib/server/screenshotter.js +0 -333
- package/lib/server/selectors.js +0 -112
- package/lib/server/socksClientCertificatesInterceptor.js +0 -383
- package/lib/server/socksInterceptor.js +0 -95
- package/lib/server/trace/recorder/snapshotter.js +0 -147
- package/lib/server/trace/recorder/snapshotterInjected.js +0 -561
- package/lib/server/trace/recorder/tracing.js +0 -604
- package/lib/server/trace/viewer/traceParser.js +0 -72
- package/lib/server/trace/viewer/traceViewer.js +0 -245
- package/lib/server/transport.js +0 -181
- 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 -139
- package/lib/server/utils/crypto.js +0 -216
- package/lib/server/utils/debug.js +0 -42
- package/lib/server/utils/debugLogger.js +0 -122
- package/lib/server/utils/env.js +0 -73
- package/lib/server/utils/eventsHelper.js +0 -39
- package/lib/server/utils/expectUtils.js +0 -123
- package/lib/server/utils/fileUtils.js +0 -191
- package/lib/server/utils/happyEyeballs.js +0 -207
- package/lib/server/utils/hostPlatform.js +0 -138
- package/lib/server/utils/httpServer.js +0 -203
- package/lib/server/utils/imageUtils.js +0 -141
- 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 -242
- package/lib/server/utils/nodePlatform.js +0 -154
- package/lib/server/utils/pipeTransport.js +0 -84
- package/lib/server/utils/processLauncher.js +0 -241
- 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 -121
- package/lib/server/utils/zipFile.js +0 -74
- package/lib/server/utils/zones.js +0 -57
- package/lib/server/videoRecorder.js +0 -124
- package/lib/server/webkit/protocol.d.js +0 -16
- package/lib/server/webkit/webkit.js +0 -108
- package/lib/server/webkit/wkBrowser.js +0 -335
- package/lib/server/webkit/wkConnection.js +0 -144
- package/lib/server/webkit/wkExecutionContext.js +0 -154
- package/lib/server/webkit/wkInput.js +0 -181
- package/lib/server/webkit/wkInterceptableRequest.js +0 -197
- package/lib/server/webkit/wkPage.js +0 -1159
- package/lib/server/webkit/wkProvisionalPage.js +0 -83
- package/lib/server/webkit/wkWorkers.js +0 -105
- package/lib/third_party/pixelmatch.js +0 -255
- package/lib/utils/isomorphic/ariaSnapshot.js +0 -455
- package/lib/utils/isomorphic/assert.js +0 -31
- package/lib/utils/isomorphic/colors.js +0 -72
- package/lib/utils/isomorphic/cssParser.js +0 -245
- package/lib/utils/isomorphic/cssTokenizer.js +0 -1051
- package/lib/utils/isomorphic/headers.js +0 -53
- package/lib/utils/isomorphic/locatorGenerators.js +0 -689
- package/lib/utils/isomorphic/locatorParser.js +0 -176
- package/lib/utils/isomorphic/locatorUtils.js +0 -81
- package/lib/utils/isomorphic/lruCache.js +0 -51
- package/lib/utils/isomorphic/manualPromise.js +0 -114
- package/lib/utils/isomorphic/mimeType.js +0 -459
- package/lib/utils/isomorphic/multimap.js +0 -80
- package/lib/utils/isomorphic/protocolFormatter.js +0 -81
- package/lib/utils/isomorphic/protocolMetainfo.js +0 -330
- package/lib/utils/isomorphic/rtti.js +0 -43
- package/lib/utils/isomorphic/selectorParser.js +0 -386
- package/lib/utils/isomorphic/semaphore.js +0 -54
- package/lib/utils/isomorphic/stackTrace.js +0 -158
- package/lib/utils/isomorphic/stringUtils.js +0 -204
- package/lib/utils/isomorphic/time.js +0 -49
- package/lib/utils/isomorphic/timeoutRunner.js +0 -66
- package/lib/utils/isomorphic/trace/entries.js +0 -16
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +0 -499
- package/lib/utils/isomorphic/trace/snapshotServer.js +0 -120
- package/lib/utils/isomorphic/trace/snapshotStorage.js +0 -89
- package/lib/utils/isomorphic/trace/traceLoader.js +0 -131
- package/lib/utils/isomorphic/trace/traceModel.js +0 -365
- package/lib/utils/isomorphic/trace/traceModernizer.js +0 -400
- package/lib/utils/isomorphic/trace/versions/traceV3.js +0 -16
- package/lib/utils/isomorphic/trace/versions/traceV4.js +0 -16
- package/lib/utils/isomorphic/trace/versions/traceV5.js +0 -16
- package/lib/utils/isomorphic/trace/versions/traceV6.js +0 -16
- package/lib/utils/isomorphic/trace/versions/traceV7.js +0 -16
- package/lib/utils/isomorphic/trace/versions/traceV8.js +0 -16
- package/lib/utils/isomorphic/traceUtils.js +0 -58
- package/lib/utils/isomorphic/types.js +0 -16
- package/lib/utils/isomorphic/urlMatch.js +0 -190
- package/lib/utils/isomorphic/utilityScriptSerializers.js +0 -251
- package/lib/utils/isomorphic/yaml.js +0 -84
- package/lib/utils.js +0 -111
- package/lib/utilsBundleImpl/index.js +0 -218
- package/lib/vite/recorder/assets/index-BSjZa4pk.css +0 -1
- package/lib/vite/recorder/assets/index-xK8wYVpV.js +0 -195
- package/lib/vite/traceViewer/assets/defaultSettingsView-k0nPICvc.js +0 -266
- package/lib/vite/traceViewer/defaultSettingsView.7ch9cixO.css +0 -1
- package/lib/vite/traceViewer/index.CVz8LATg.js +0 -2
- package/lib/vite/traceViewer/uiMode.C7uDu3VD.js +0 -5
- package/lib/zipBundle.js +0 -34
- package/lib/zipBundleImpl.js +0 -5
- /package/lib/{utilsBundleImpl/xdg-open → xdg-open} +0 -0
|
@@ -1,333 +0,0 @@
|
|
|
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 screenshotter_exports = {};
|
|
20
|
-
__export(screenshotter_exports, {
|
|
21
|
-
Screenshotter: () => Screenshotter,
|
|
22
|
-
validateScreenshotOptions: () => validateScreenshotOptions
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(screenshotter_exports);
|
|
25
|
-
var import_helper = require("./helper");
|
|
26
|
-
var import_utils = require("../utils");
|
|
27
|
-
var import_multimap = require("../utils/isomorphic/multimap");
|
|
28
|
-
function inPagePrepareForScreenshots(screenshotStyle, hideCaret, disableAnimations, syncAnimations) {
|
|
29
|
-
if (syncAnimations) {
|
|
30
|
-
const style = document.createElement("style");
|
|
31
|
-
style.textContent = "body {}";
|
|
32
|
-
document.head.appendChild(style);
|
|
33
|
-
document.documentElement.getBoundingClientRect();
|
|
34
|
-
style.remove();
|
|
35
|
-
}
|
|
36
|
-
if (!screenshotStyle && !hideCaret && !disableAnimations)
|
|
37
|
-
return;
|
|
38
|
-
const collectRoots = (root, roots2 = []) => {
|
|
39
|
-
roots2.push(root);
|
|
40
|
-
const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
|
|
41
|
-
do {
|
|
42
|
-
const node = walker.currentNode;
|
|
43
|
-
const shadowRoot = node instanceof Element ? node.shadowRoot : null;
|
|
44
|
-
if (shadowRoot)
|
|
45
|
-
collectRoots(shadowRoot, roots2);
|
|
46
|
-
} while (walker.nextNode());
|
|
47
|
-
return roots2;
|
|
48
|
-
};
|
|
49
|
-
const roots = collectRoots(document);
|
|
50
|
-
const cleanupCallbacks = [];
|
|
51
|
-
if (screenshotStyle) {
|
|
52
|
-
for (const root of roots) {
|
|
53
|
-
const styleTag = document.createElement("style");
|
|
54
|
-
styleTag.textContent = screenshotStyle;
|
|
55
|
-
if (root === document)
|
|
56
|
-
document.documentElement.append(styleTag);
|
|
57
|
-
else
|
|
58
|
-
root.append(styleTag);
|
|
59
|
-
cleanupCallbacks.push(() => {
|
|
60
|
-
styleTag.remove();
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (hideCaret) {
|
|
65
|
-
const elements = /* @__PURE__ */ new Map();
|
|
66
|
-
for (const root of roots) {
|
|
67
|
-
root.querySelectorAll("input,textarea,[contenteditable]").forEach((element) => {
|
|
68
|
-
elements.set(element, {
|
|
69
|
-
value: element.style.getPropertyValue("caret-color"),
|
|
70
|
-
priority: element.style.getPropertyPriority("caret-color")
|
|
71
|
-
});
|
|
72
|
-
element.style.setProperty("caret-color", "transparent", "important");
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
cleanupCallbacks.push(() => {
|
|
76
|
-
for (const [element, value] of elements)
|
|
77
|
-
element.style.setProperty("caret-color", value.value, value.priority);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (disableAnimations) {
|
|
81
|
-
const infiniteAnimationsToResume = /* @__PURE__ */ new Set();
|
|
82
|
-
const handleAnimations = (root) => {
|
|
83
|
-
for (const animation of root.getAnimations()) {
|
|
84
|
-
if (!animation.effect || animation.playbackRate === 0 || infiniteAnimationsToResume.has(animation))
|
|
85
|
-
continue;
|
|
86
|
-
const endTime = animation.effect.getComputedTiming().endTime;
|
|
87
|
-
if (Number.isFinite(endTime)) {
|
|
88
|
-
try {
|
|
89
|
-
animation.finish();
|
|
90
|
-
} catch (e) {
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
try {
|
|
94
|
-
animation.cancel();
|
|
95
|
-
infiniteAnimationsToResume.add(animation);
|
|
96
|
-
} catch (e) {
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
for (const root of roots) {
|
|
102
|
-
const handleRootAnimations = handleAnimations.bind(null, root);
|
|
103
|
-
handleRootAnimations();
|
|
104
|
-
root.addEventListener("transitionrun", handleRootAnimations);
|
|
105
|
-
root.addEventListener("animationstart", handleRootAnimations);
|
|
106
|
-
cleanupCallbacks.push(() => {
|
|
107
|
-
root.removeEventListener("transitionrun", handleRootAnimations);
|
|
108
|
-
root.removeEventListener("animationstart", handleRootAnimations);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
cleanupCallbacks.push(() => {
|
|
112
|
-
for (const animation of infiniteAnimationsToResume) {
|
|
113
|
-
try {
|
|
114
|
-
animation.play();
|
|
115
|
-
} catch (e) {
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
window.__pwCleanupScreenshot = () => {
|
|
121
|
-
for (const cleanupCallback of cleanupCallbacks)
|
|
122
|
-
cleanupCallback();
|
|
123
|
-
delete window.__pwCleanupScreenshot;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
class Screenshotter {
|
|
127
|
-
constructor(page) {
|
|
128
|
-
this._queue = new TaskQueue();
|
|
129
|
-
this._page = page;
|
|
130
|
-
this._queue = new TaskQueue();
|
|
131
|
-
}
|
|
132
|
-
async _originalViewportSize(progress) {
|
|
133
|
-
let viewportSize = this._page.emulatedSize()?.viewport;
|
|
134
|
-
if (!viewportSize)
|
|
135
|
-
viewportSize = await this._page.mainFrame().waitForFunctionValueInUtility(progress, () => ({ width: window.innerWidth, height: window.innerHeight }));
|
|
136
|
-
return viewportSize;
|
|
137
|
-
}
|
|
138
|
-
async _fullPageSize(progress) {
|
|
139
|
-
const fullPageSize = await this._page.mainFrame().waitForFunctionValueInUtility(progress, () => {
|
|
140
|
-
if (!document.body || !document.documentElement)
|
|
141
|
-
return null;
|
|
142
|
-
return {
|
|
143
|
-
width: Math.max(
|
|
144
|
-
document.body.scrollWidth,
|
|
145
|
-
document.documentElement.scrollWidth,
|
|
146
|
-
document.body.offsetWidth,
|
|
147
|
-
document.documentElement.offsetWidth,
|
|
148
|
-
document.body.clientWidth,
|
|
149
|
-
document.documentElement.clientWidth
|
|
150
|
-
),
|
|
151
|
-
height: Math.max(
|
|
152
|
-
document.body.scrollHeight,
|
|
153
|
-
document.documentElement.scrollHeight,
|
|
154
|
-
document.body.offsetHeight,
|
|
155
|
-
document.documentElement.offsetHeight,
|
|
156
|
-
document.body.clientHeight,
|
|
157
|
-
document.documentElement.clientHeight
|
|
158
|
-
)
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
return fullPageSize;
|
|
162
|
-
}
|
|
163
|
-
async screenshotPage(progress, options) {
|
|
164
|
-
const format = validateScreenshotOptions(options);
|
|
165
|
-
return this._queue.postTask(async () => {
|
|
166
|
-
progress.log("taking page screenshot");
|
|
167
|
-
const viewportSize = await this._originalViewportSize(progress);
|
|
168
|
-
await this._preparePageForScreenshot(progress, this._page.mainFrame(), options.style, options.caret !== "initial", options.animations === "disabled");
|
|
169
|
-
try {
|
|
170
|
-
if (options.fullPage) {
|
|
171
|
-
const fullPageSize = await this._fullPageSize(progress);
|
|
172
|
-
let documentRect = { x: 0, y: 0, width: fullPageSize.width, height: fullPageSize.height };
|
|
173
|
-
const fitsViewport = fullPageSize.width <= viewportSize.width && fullPageSize.height <= viewportSize.height;
|
|
174
|
-
if (options.clip)
|
|
175
|
-
documentRect = trimClipToSize(options.clip, documentRect);
|
|
176
|
-
return await this._screenshot(progress, format, documentRect, void 0, fitsViewport, options);
|
|
177
|
-
}
|
|
178
|
-
const viewportRect = options.clip ? trimClipToSize(options.clip, viewportSize) : { x: 0, y: 0, ...viewportSize };
|
|
179
|
-
return await this._screenshot(progress, format, void 0, viewportRect, true, options);
|
|
180
|
-
} finally {
|
|
181
|
-
await this._restorePageAfterScreenshot();
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
async screenshotElement(progress, handle, options) {
|
|
186
|
-
const format = validateScreenshotOptions(options);
|
|
187
|
-
return this._queue.postTask(async () => {
|
|
188
|
-
progress.log("taking element screenshot");
|
|
189
|
-
const viewportSize = await this._originalViewportSize(progress);
|
|
190
|
-
await this._preparePageForScreenshot(progress, handle._frame, options.style, options.caret !== "initial", options.animations === "disabled");
|
|
191
|
-
try {
|
|
192
|
-
await handle._waitAndScrollIntoViewIfNeeded(
|
|
193
|
-
progress,
|
|
194
|
-
true
|
|
195
|
-
/* waitForVisible */
|
|
196
|
-
);
|
|
197
|
-
const boundingBox = await progress.race(handle.boundingBox());
|
|
198
|
-
(0, import_utils.assert)(boundingBox, "Node is either not visible or not an HTMLElement");
|
|
199
|
-
(0, import_utils.assert)(boundingBox.width !== 0, "Node has 0 width.");
|
|
200
|
-
(0, import_utils.assert)(boundingBox.height !== 0, "Node has 0 height.");
|
|
201
|
-
const fitsViewport = boundingBox.width <= viewportSize.width && boundingBox.height <= viewportSize.height;
|
|
202
|
-
const scrollOffset = await this._page.mainFrame().waitForFunctionValueInUtility(progress, () => ({ x: window.scrollX, y: window.scrollY }));
|
|
203
|
-
const documentRect = { ...boundingBox };
|
|
204
|
-
documentRect.x += scrollOffset.x;
|
|
205
|
-
documentRect.y += scrollOffset.y;
|
|
206
|
-
return await this._screenshot(progress, format, import_helper.helper.enclosingIntRect(documentRect), void 0, fitsViewport, options);
|
|
207
|
-
} finally {
|
|
208
|
-
await this._restorePageAfterScreenshot();
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
async _preparePageForScreenshot(progress, frame, screenshotStyle, hideCaret, disableAnimations) {
|
|
213
|
-
if (disableAnimations)
|
|
214
|
-
progress.log(" disabled all CSS animations");
|
|
215
|
-
const syncAnimations = this._page.delegate.shouldToggleStyleSheetToSyncAnimations();
|
|
216
|
-
await progress.race(this._page.safeNonStallingEvaluateInAllFrames("(" + inPagePrepareForScreenshots.toString() + `)(${JSON.stringify(screenshotStyle)}, ${hideCaret}, ${disableAnimations}, ${syncAnimations})`, "utility"));
|
|
217
|
-
try {
|
|
218
|
-
if (!process.env.PW_TEST_SCREENSHOT_NO_FONTS_READY) {
|
|
219
|
-
progress.log("waiting for fonts to load...");
|
|
220
|
-
await progress.race(frame.nonStallingEvaluateInExistingContext("document.fonts.ready", "utility").catch(() => {
|
|
221
|
-
}));
|
|
222
|
-
progress.log("fonts loaded");
|
|
223
|
-
}
|
|
224
|
-
} catch (error) {
|
|
225
|
-
await this._restorePageAfterScreenshot();
|
|
226
|
-
throw error;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
async _restorePageAfterScreenshot() {
|
|
230
|
-
await this._page.safeNonStallingEvaluateInAllFrames("window.__pwCleanupScreenshot && window.__pwCleanupScreenshot()", "utility");
|
|
231
|
-
}
|
|
232
|
-
async _maskElements(progress, options) {
|
|
233
|
-
if (!options.mask || !options.mask.length)
|
|
234
|
-
return () => Promise.resolve();
|
|
235
|
-
const framesToParsedSelectors = new import_multimap.MultiMap();
|
|
236
|
-
await progress.race(Promise.all((options.mask || []).map(async ({ frame, selector }) => {
|
|
237
|
-
const pair = await frame.selectors.resolveFrameForSelector(selector);
|
|
238
|
-
if (pair)
|
|
239
|
-
framesToParsedSelectors.set(pair.frame, pair.info.parsed);
|
|
240
|
-
})));
|
|
241
|
-
const frames = [...framesToParsedSelectors.keys()];
|
|
242
|
-
const cleanup = async () => {
|
|
243
|
-
await Promise.all(frames.map((frame) => frame.hideHighlight()));
|
|
244
|
-
};
|
|
245
|
-
try {
|
|
246
|
-
const promises = frames.map((frame) => frame.maskSelectors(framesToParsedSelectors.get(frame), options.maskColor || "#F0F"));
|
|
247
|
-
await progress.race(Promise.all(promises));
|
|
248
|
-
return cleanup;
|
|
249
|
-
} catch (error) {
|
|
250
|
-
cleanup().catch(() => {
|
|
251
|
-
});
|
|
252
|
-
throw error;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
async _screenshot(progress, format, documentRect, viewportRect, fitsViewport, options) {
|
|
256
|
-
if (options.__testHookBeforeScreenshot)
|
|
257
|
-
await progress.race(options.__testHookBeforeScreenshot());
|
|
258
|
-
const shouldSetDefaultBackground = options.omitBackground && format === "png";
|
|
259
|
-
if (shouldSetDefaultBackground)
|
|
260
|
-
await progress.race(this._page.delegate.setBackgroundColor({ r: 0, g: 0, b: 0, a: 0 }));
|
|
261
|
-
const cleanupHighlight = await this._maskElements(progress, options);
|
|
262
|
-
try {
|
|
263
|
-
const quality = format === "jpeg" ? options.quality ?? 80 : void 0;
|
|
264
|
-
const buffer = await this._page.delegate.takeScreenshot(progress, format, documentRect, viewportRect, quality, fitsViewport, options.scale || "device");
|
|
265
|
-
await cleanupHighlight();
|
|
266
|
-
if (shouldSetDefaultBackground)
|
|
267
|
-
await this._page.delegate.setBackgroundColor();
|
|
268
|
-
if (options.__testHookAfterScreenshot)
|
|
269
|
-
await progress.race(options.__testHookAfterScreenshot());
|
|
270
|
-
return buffer;
|
|
271
|
-
} catch (error) {
|
|
272
|
-
cleanupHighlight().catch(() => {
|
|
273
|
-
});
|
|
274
|
-
if (shouldSetDefaultBackground)
|
|
275
|
-
this._page.delegate.setBackgroundColor().catch(() => {
|
|
276
|
-
});
|
|
277
|
-
throw error;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
class TaskQueue {
|
|
282
|
-
constructor() {
|
|
283
|
-
this._chain = Promise.resolve();
|
|
284
|
-
}
|
|
285
|
-
postTask(task) {
|
|
286
|
-
const result = this._chain.then(task);
|
|
287
|
-
this._chain = result.catch(() => {
|
|
288
|
-
});
|
|
289
|
-
return result;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function trimClipToSize(clip, size) {
|
|
293
|
-
const p1 = {
|
|
294
|
-
x: Math.max(0, Math.min(clip.x, size.width)),
|
|
295
|
-
y: Math.max(0, Math.min(clip.y, size.height))
|
|
296
|
-
};
|
|
297
|
-
const p2 = {
|
|
298
|
-
x: Math.max(0, Math.min(clip.x + clip.width, size.width)),
|
|
299
|
-
y: Math.max(0, Math.min(clip.y + clip.height, size.height))
|
|
300
|
-
};
|
|
301
|
-
const result = { x: p1.x, y: p1.y, width: p2.x - p1.x, height: p2.y - p1.y };
|
|
302
|
-
(0, import_utils.assert)(result.width && result.height, "Clipped area is either empty or outside the resulting image");
|
|
303
|
-
return result;
|
|
304
|
-
}
|
|
305
|
-
function validateScreenshotOptions(options) {
|
|
306
|
-
let format = null;
|
|
307
|
-
if (options.type) {
|
|
308
|
-
(0, import_utils.assert)(options.type === "png" || options.type === "jpeg", "Unknown options.type value: " + options.type);
|
|
309
|
-
format = options.type;
|
|
310
|
-
}
|
|
311
|
-
if (!format)
|
|
312
|
-
format = "png";
|
|
313
|
-
if (options.quality !== void 0) {
|
|
314
|
-
(0, import_utils.assert)(format === "jpeg", "options.quality is unsupported for the " + format + " screenshots");
|
|
315
|
-
(0, import_utils.assert)(typeof options.quality === "number", "Expected options.quality to be a number but found " + typeof options.quality);
|
|
316
|
-
(0, import_utils.assert)(Number.isInteger(options.quality), "Expected options.quality to be an integer");
|
|
317
|
-
(0, import_utils.assert)(options.quality >= 0 && options.quality <= 100, "Expected options.quality to be between 0 and 100 (inclusive), got " + options.quality);
|
|
318
|
-
}
|
|
319
|
-
if (options.clip) {
|
|
320
|
-
(0, import_utils.assert)(typeof options.clip.x === "number", "Expected options.clip.x to be a number but found " + typeof options.clip.x);
|
|
321
|
-
(0, import_utils.assert)(typeof options.clip.y === "number", "Expected options.clip.y to be a number but found " + typeof options.clip.y);
|
|
322
|
-
(0, import_utils.assert)(typeof options.clip.width === "number", "Expected options.clip.width to be a number but found " + typeof options.clip.width);
|
|
323
|
-
(0, import_utils.assert)(typeof options.clip.height === "number", "Expected options.clip.height to be a number but found " + typeof options.clip.height);
|
|
324
|
-
(0, import_utils.assert)(options.clip.width !== 0, "Expected options.clip.width not to be 0.");
|
|
325
|
-
(0, import_utils.assert)(options.clip.height !== 0, "Expected options.clip.height not to be 0.");
|
|
326
|
-
}
|
|
327
|
-
return format;
|
|
328
|
-
}
|
|
329
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
330
|
-
0 && (module.exports = {
|
|
331
|
-
Screenshotter,
|
|
332
|
-
validateScreenshotOptions
|
|
333
|
-
});
|
package/lib/server/selectors.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
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 selectors_exports = {};
|
|
20
|
-
__export(selectors_exports, {
|
|
21
|
-
Selectors: () => Selectors
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(selectors_exports);
|
|
24
|
-
var import_crypto = require("./utils/crypto");
|
|
25
|
-
var import_selectorParser = require("../utils/isomorphic/selectorParser");
|
|
26
|
-
class Selectors {
|
|
27
|
-
constructor(engines, testIdAttributeName) {
|
|
28
|
-
this.guid = `selectors@${(0, import_crypto.createGuid)()}`;
|
|
29
|
-
this._builtinEngines = /* @__PURE__ */ new Set([
|
|
30
|
-
"css",
|
|
31
|
-
"css:light",
|
|
32
|
-
"xpath",
|
|
33
|
-
"xpath:light",
|
|
34
|
-
"_react",
|
|
35
|
-
"_vue",
|
|
36
|
-
"text",
|
|
37
|
-
"text:light",
|
|
38
|
-
"id",
|
|
39
|
-
"id:light",
|
|
40
|
-
"data-testid",
|
|
41
|
-
"data-testid:light",
|
|
42
|
-
"data-test-id",
|
|
43
|
-
"data-test-id:light",
|
|
44
|
-
"data-test",
|
|
45
|
-
"data-test:light",
|
|
46
|
-
"nth",
|
|
47
|
-
"visible",
|
|
48
|
-
"internal:control",
|
|
49
|
-
"internal:has",
|
|
50
|
-
"internal:has-not",
|
|
51
|
-
"internal:has-text",
|
|
52
|
-
"internal:has-not-text",
|
|
53
|
-
"internal:and",
|
|
54
|
-
"internal:or",
|
|
55
|
-
"internal:chain",
|
|
56
|
-
"role",
|
|
57
|
-
"internal:attr",
|
|
58
|
-
"internal:label",
|
|
59
|
-
"internal:text",
|
|
60
|
-
"internal:role",
|
|
61
|
-
"internal:testid",
|
|
62
|
-
"internal:describe",
|
|
63
|
-
"aria-ref"
|
|
64
|
-
]);
|
|
65
|
-
this._builtinEnginesInMainWorld = /* @__PURE__ */ new Set([
|
|
66
|
-
"_react",
|
|
67
|
-
"_vue"
|
|
68
|
-
]);
|
|
69
|
-
this._engines = /* @__PURE__ */ new Map();
|
|
70
|
-
this._testIdAttributeName = testIdAttributeName ?? "data-testid";
|
|
71
|
-
for (const engine of engines)
|
|
72
|
-
this.register(engine);
|
|
73
|
-
}
|
|
74
|
-
register(engine) {
|
|
75
|
-
if (!engine.name.match(/^[a-zA-Z_0-9-]+$/))
|
|
76
|
-
throw new Error("Selector engine name may only contain [a-zA-Z0-9_] characters");
|
|
77
|
-
if (this._builtinEngines.has(engine.name) || engine.name === "zs" || engine.name === "zs:light")
|
|
78
|
-
throw new Error(`"${engine.name}" is a predefined selector engine`);
|
|
79
|
-
if (this._engines.has(engine.name))
|
|
80
|
-
throw new Error(`"${engine.name}" selector engine has been already registered`);
|
|
81
|
-
this._engines.set(engine.name, engine);
|
|
82
|
-
}
|
|
83
|
-
testIdAttributeName() {
|
|
84
|
-
return this._testIdAttributeName;
|
|
85
|
-
}
|
|
86
|
-
setTestIdAttributeName(testIdAttributeName) {
|
|
87
|
-
this._testIdAttributeName = testIdAttributeName;
|
|
88
|
-
}
|
|
89
|
-
parseSelector(selector, strict) {
|
|
90
|
-
const parsed = typeof selector === "string" ? (0, import_selectorParser.parseSelector)(selector) : selector;
|
|
91
|
-
let needsMainWorld = false;
|
|
92
|
-
(0, import_selectorParser.visitAllSelectorParts)(parsed, (part) => {
|
|
93
|
-
const name = part.name;
|
|
94
|
-
const custom = this._engines.get(name);
|
|
95
|
-
if (!custom && !this._builtinEngines.has(name))
|
|
96
|
-
throw new import_selectorParser.InvalidSelectorError(`Unknown engine "${name}" while parsing selector ${(0, import_selectorParser.stringifySelector)(parsed)}`);
|
|
97
|
-
if (custom && !custom.contentScript)
|
|
98
|
-
needsMainWorld = true;
|
|
99
|
-
if (this._builtinEnginesInMainWorld.has(name))
|
|
100
|
-
needsMainWorld = true;
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
parsed,
|
|
104
|
-
world: needsMainWorld ? "main" : "utility",
|
|
105
|
-
strict
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
-
0 && (module.exports = {
|
|
111
|
-
Selectors
|
|
112
|
-
});
|