@browsermation/browser-engine 0.0.12 → 0.0.16
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/dist/node_modules/playwright/LICENSE +202 -0
- package/dist/node_modules/playwright/NOTICE +5 -0
- package/dist/node_modules/playwright/README.md +168 -0
- package/dist/node_modules/playwright/ThirdPartyNotices.txt +6197 -0
- package/dist/node_modules/playwright/cli.js +19 -0
- package/dist/node_modules/playwright/index.d.ts +17 -0
- package/dist/node_modules/playwright/index.js +17 -0
- package/dist/node_modules/playwright/index.mjs +18 -0
- package/dist/node_modules/playwright/jsx-runtime.js +42 -0
- package/dist/node_modules/playwright/jsx-runtime.mjs +21 -0
- package/dist/node_modules/playwright/lib/agents/copilot-setup-steps.yml +34 -0
- package/dist/node_modules/playwright/lib/agents/generateAgents.js +395 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-coverage.prompt.md +31 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-generate.prompt.md +8 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-generator.agent.md +88 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-heal.prompt.md +6 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-healer.agent.md +55 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-plan.prompt.md +9 -0
- package/dist/node_modules/playwright/lib/agents/playwright-test-planner.agent.md +72 -0
- package/dist/node_modules/playwright/lib/common/config.js +280 -0
- package/dist/node_modules/playwright/lib/common/configLoader.js +344 -0
- package/dist/node_modules/playwright/lib/common/esmLoaderHost.js +102 -0
- package/dist/node_modules/playwright/lib/common/expectBundle.js +43 -0
- package/dist/node_modules/playwright/lib/common/expectBundleImpl.js +407 -0
- package/dist/node_modules/playwright/lib/common/fixtures.js +302 -0
- package/dist/node_modules/playwright/lib/common/globals.js +58 -0
- package/dist/node_modules/playwright/lib/common/ipc.js +60 -0
- package/dist/node_modules/playwright/lib/common/poolBuilder.js +85 -0
- package/dist/node_modules/playwright/lib/common/process.js +104 -0
- package/dist/node_modules/playwright/lib/common/suiteUtils.js +140 -0
- package/dist/node_modules/playwright/lib/common/test.js +321 -0
- package/dist/node_modules/playwright/lib/common/testLoader.js +101 -0
- package/dist/node_modules/playwright/lib/common/testType.js +298 -0
- package/dist/node_modules/playwright/lib/common/validators.js +68 -0
- package/dist/node_modules/playwright/lib/fsWatcher.js +67 -0
- package/dist/node_modules/playwright/lib/index.js +682 -0
- package/dist/node_modules/playwright/lib/internalsForTest.js +42 -0
- package/dist/node_modules/playwright/lib/isomorphic/events.js +77 -0
- package/dist/node_modules/playwright/lib/isomorphic/folders.js +30 -0
- package/dist/node_modules/playwright/lib/isomorphic/stringInternPool.js +69 -0
- package/dist/node_modules/playwright/lib/isomorphic/teleReceiver.js +508 -0
- package/dist/node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js +137 -0
- package/dist/node_modules/playwright/lib/isomorphic/testServerConnection.js +225 -0
- package/dist/node_modules/playwright/lib/isomorphic/testServerInterface.js +16 -0
- package/dist/node_modules/playwright/lib/isomorphic/testTree.js +334 -0
- package/dist/node_modules/playwright/lib/isomorphic/types.d.js +16 -0
- package/dist/node_modules/playwright/lib/loader/loaderMain.js +59 -0
- package/dist/node_modules/playwright/lib/matchers/expect.js +324 -0
- package/dist/node_modules/playwright/lib/matchers/matcherHint.js +87 -0
- package/dist/node_modules/playwright/lib/matchers/matchers.js +382 -0
- package/dist/node_modules/playwright/lib/matchers/toBeTruthy.js +73 -0
- package/dist/node_modules/playwright/lib/matchers/toEqual.js +99 -0
- package/dist/node_modules/playwright/lib/matchers/toHaveURL.js +102 -0
- package/dist/node_modules/playwright/lib/matchers/toMatchAriaSnapshot.js +159 -0
- package/dist/node_modules/playwright/lib/matchers/toMatchSnapshot.js +341 -0
- package/dist/node_modules/playwright/lib/matchers/toMatchText.js +99 -0
- package/dist/node_modules/playwright/lib/mcp/browser/actions.d.js +16 -0
- package/dist/node_modules/playwright/lib/mcp/browser/browserContextFactory.js +296 -0
- package/dist/node_modules/playwright/lib/mcp/browser/browserServerBackend.js +76 -0
- package/dist/node_modules/playwright/lib/mcp/browser/codegen.js +66 -0
- package/dist/node_modules/playwright/lib/mcp/browser/config.js +368 -0
- package/dist/node_modules/playwright/lib/mcp/browser/context.js +267 -0
- package/dist/node_modules/playwright/lib/mcp/browser/response.js +237 -0
- package/dist/node_modules/playwright/lib/mcp/browser/sessionLog.js +160 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tab.js +292 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/common.js +63 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/console.js +44 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/dialogs.js +60 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/evaluate.js +69 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/files.js +58 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/form.js +73 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/install.js +69 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/keyboard.js +84 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/mouse.js +107 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/navigate.js +62 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/network.js +54 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/pdf.js +59 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/runCode.js +75 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/screenshot.js +106 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/snapshot.js +181 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/tabs.js +67 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/tool.js +49 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/tracing.js +74 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/utils.js +89 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/verify.js +153 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools/wait.js +63 -0
- package/dist/node_modules/playwright/lib/mcp/browser/tools.js +82 -0
- package/dist/node_modules/playwright/lib/mcp/browser/watchdog.js +44 -0
- package/dist/node_modules/playwright/lib/mcp/config.d.js +16 -0
- package/dist/node_modules/playwright/lib/mcp/extension/cdpRelay.js +351 -0
- package/dist/node_modules/playwright/lib/mcp/extension/extensionContextFactory.js +75 -0
- package/dist/node_modules/playwright/lib/mcp/extension/protocol.js +28 -0
- package/dist/node_modules/playwright/lib/mcp/index.js +61 -0
- package/dist/node_modules/playwright/lib/mcp/log.js +35 -0
- package/dist/node_modules/playwright/lib/mcp/program.js +116 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/bundle.js +81 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/exports.js +30 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/http.js +187 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/inProcessTransport.js +71 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/proxyBackend.js +128 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/server.js +198 -0
- package/dist/node_modules/playwright/lib/mcp/sdk/tool.js +47 -0
- package/dist/node_modules/playwright/lib/mcp/test/browserBackend.js +108 -0
- package/dist/node_modules/playwright/lib/mcp/test/generatorTools.js +122 -0
- package/dist/node_modules/playwright/lib/mcp/test/plannerTools.js +144 -0
- package/dist/node_modules/playwright/lib/mcp/test/seed.js +82 -0
- package/dist/node_modules/playwright/lib/mcp/test/streams.js +44 -0
- package/dist/node_modules/playwright/lib/mcp/test/testBackend.js +99 -0
- package/dist/node_modules/playwright/lib/mcp/test/testContext.js +279 -0
- package/dist/node_modules/playwright/lib/mcp/test/testTool.js +30 -0
- package/dist/node_modules/playwright/lib/mcp/test/testTools.js +106 -0
- package/dist/node_modules/playwright/lib/mcpBundleImpl.js +41 -0
- package/dist/node_modules/playwright/lib/plugins/gitCommitInfoPlugin.js +198 -0
- package/dist/node_modules/playwright/lib/plugins/index.js +28 -0
- package/dist/node_modules/playwright/lib/plugins/webServerPlugin.js +237 -0
- package/dist/node_modules/playwright/lib/program.js +403 -0
- package/dist/node_modules/playwright/lib/reporters/base.js +609 -0
- package/dist/node_modules/playwright/lib/reporters/blob.js +135 -0
- package/dist/node_modules/playwright/lib/reporters/dot.js +82 -0
- package/dist/node_modules/playwright/lib/reporters/empty.js +32 -0
- package/dist/node_modules/playwright/lib/reporters/github.js +128 -0
- package/dist/node_modules/playwright/lib/reporters/html.js +623 -0
- package/dist/node_modules/playwright/lib/reporters/internalReporter.js +132 -0
- package/dist/node_modules/playwright/lib/reporters/json.js +254 -0
- package/dist/node_modules/playwright/lib/reporters/junit.js +232 -0
- package/dist/node_modules/playwright/lib/reporters/line.js +113 -0
- package/dist/node_modules/playwright/lib/reporters/list.js +231 -0
- package/dist/node_modules/playwright/lib/reporters/listModeReporter.js +69 -0
- package/dist/node_modules/playwright/lib/reporters/markdown.js +144 -0
- package/dist/node_modules/playwright/lib/reporters/merge.js +541 -0
- package/dist/node_modules/playwright/lib/reporters/multiplexer.js +104 -0
- package/dist/node_modules/playwright/lib/reporters/reporterV2.js +102 -0
- package/dist/node_modules/playwright/lib/reporters/teleEmitter.js +299 -0
- package/dist/node_modules/playwright/lib/reporters/versions/blobV1.js +16 -0
- package/dist/node_modules/playwright/lib/runner/dispatcher.js +515 -0
- package/dist/node_modules/playwright/lib/runner/failureTracker.js +72 -0
- package/dist/node_modules/playwright/lib/runner/lastRun.js +77 -0
- package/dist/node_modules/playwright/lib/runner/loadUtils.js +334 -0
- package/dist/node_modules/playwright/lib/runner/loaderHost.js +89 -0
- package/dist/node_modules/playwright/lib/runner/processHost.js +161 -0
- package/dist/node_modules/playwright/lib/runner/projectUtils.js +241 -0
- package/dist/node_modules/playwright/lib/runner/rebase.js +189 -0
- package/dist/node_modules/playwright/lib/runner/reporters.js +138 -0
- package/dist/node_modules/playwright/lib/runner/sigIntWatcher.js +96 -0
- package/dist/node_modules/playwright/lib/runner/taskRunner.js +127 -0
- package/dist/node_modules/playwright/lib/runner/tasks.js +410 -0
- package/dist/node_modules/playwright/lib/runner/testGroups.js +117 -0
- package/dist/node_modules/playwright/lib/runner/testRunner.js +389 -0
- package/dist/node_modules/playwright/lib/runner/testServer.js +269 -0
- package/dist/node_modules/playwright/lib/runner/uiModeReporter.js +30 -0
- package/dist/node_modules/playwright/lib/runner/vcs.js +72 -0
- package/dist/node_modules/playwright/lib/runner/watchMode.js +395 -0
- package/dist/node_modules/playwright/lib/runner/workerHost.js +98 -0
- package/dist/node_modules/playwright/lib/third_party/pirates.js +62 -0
- package/dist/node_modules/playwright/lib/third_party/tsconfig-loader.js +103 -0
- package/dist/node_modules/playwright/lib/transform/babelBundle.js +43 -0
- package/dist/node_modules/playwright/lib/transform/babelBundleImpl.js +461 -0
- package/dist/node_modules/playwright/lib/transform/compilationCache.js +272 -0
- package/dist/node_modules/playwright/lib/transform/esmLoader.js +104 -0
- package/dist/node_modules/playwright/lib/transform/portTransport.js +67 -0
- package/dist/node_modules/playwright/lib/transform/transform.js +293 -0
- package/dist/node_modules/playwright/lib/util.js +403 -0
- package/dist/node_modules/playwright/lib/utilsBundle.js +43 -0
- package/dist/node_modules/playwright/lib/utilsBundleImpl.js +100 -0
- package/dist/node_modules/playwright/lib/worker/fixtureRunner.js +258 -0
- package/dist/node_modules/playwright/lib/worker/testInfo.js +516 -0
- package/dist/node_modules/playwright/lib/worker/testTracing.js +345 -0
- package/dist/node_modules/playwright/lib/worker/timeoutManager.js +174 -0
- package/dist/node_modules/playwright/lib/worker/util.js +31 -0
- package/dist/node_modules/playwright/lib/worker/workerMain.js +529 -0
- package/dist/node_modules/playwright/package.json +72 -0
- package/dist/node_modules/playwright/test.d.ts +18 -0
- package/dist/node_modules/playwright/test.js +24 -0
- package/dist/node_modules/playwright/test.mjs +33 -0
- package/dist/node_modules/playwright/types/test.d.ts +10253 -0
- package/dist/node_modules/playwright/types/testReporter.d.ts +821 -0
- package/dist/node_modules/playwright-core/LICENSE +202 -0
- package/dist/node_modules/playwright-core/NOTICE +5 -0
- package/dist/node_modules/playwright-core/README.md +3 -0
- package/dist/node_modules/playwright-core/ThirdPartyNotices.txt +1161 -0
- package/dist/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/dist/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/dist/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/dist/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/dist/node_modules/playwright-core/browsers.json +80 -0
- package/dist/node_modules/playwright-core/cli.js +18 -0
- package/dist/node_modules/playwright-core/index.d.ts +17 -0
- package/dist/node_modules/playwright-core/index.js +32 -0
- package/dist/node_modules/playwright-core/index.mjs +28 -0
- package/dist/node_modules/playwright-core/lib/androidServerImpl.js +65 -0
- package/dist/node_modules/playwright-core/lib/browserServerImpl.js +120 -0
- package/dist/node_modules/playwright-core/lib/cli/driver.js +97 -0
- package/dist/node_modules/playwright-core/lib/cli/program.js +590 -0
- package/dist/node_modules/playwright-core/lib/cli/programWithTestStub.js +74 -0
- package/dist/node_modules/playwright-core/lib/client/android.js +361 -0
- package/dist/node_modules/playwright-core/lib/client/api.js +134 -0
- package/dist/node_modules/playwright-core/lib/client/artifact.js +79 -0
- package/dist/node_modules/playwright-core/lib/client/browser.js +163 -0
- package/dist/node_modules/playwright-core/lib/client/browserContext.js +547 -0
- package/dist/node_modules/playwright-core/lib/client/browserType.js +184 -0
- package/dist/node_modules/playwright-core/lib/client/cdpSession.js +51 -0
- package/dist/node_modules/playwright-core/lib/client/channelOwner.js +194 -0
- package/dist/node_modules/playwright-core/lib/client/clientHelper.js +64 -0
- package/dist/node_modules/playwright-core/lib/client/clientInstrumentation.js +55 -0
- package/dist/node_modules/playwright-core/lib/client/clientStackTrace.js +69 -0
- package/dist/node_modules/playwright-core/lib/client/clock.js +68 -0
- package/dist/node_modules/playwright-core/lib/client/connection.js +314 -0
- package/dist/node_modules/playwright-core/lib/client/consoleMessage.js +58 -0
- package/dist/node_modules/playwright-core/lib/client/coverage.js +44 -0
- package/dist/node_modules/playwright-core/lib/client/dialog.js +56 -0
- package/dist/node_modules/playwright-core/lib/client/download.js +62 -0
- package/dist/node_modules/playwright-core/lib/client/electron.js +138 -0
- package/dist/node_modules/playwright-core/lib/client/elementHandle.js +281 -0
- package/dist/node_modules/playwright-core/lib/client/errors.js +77 -0
- package/dist/node_modules/playwright-core/lib/client/eventEmitter.js +314 -0
- package/dist/node_modules/playwright-core/lib/client/events.js +100 -0
- package/dist/node_modules/playwright-core/lib/client/fetch.js +369 -0
- package/dist/node_modules/playwright-core/lib/client/fileChooser.js +46 -0
- package/dist/node_modules/playwright-core/lib/client/fileUtils.js +34 -0
- package/dist/node_modules/playwright-core/lib/client/frame.js +408 -0
- package/dist/node_modules/playwright-core/lib/client/harRouter.js +87 -0
- package/dist/node_modules/playwright-core/lib/client/input.js +84 -0
- package/dist/node_modules/playwright-core/lib/client/jsHandle.js +109 -0
- package/dist/node_modules/playwright-core/lib/client/jsonPipe.js +39 -0
- package/dist/node_modules/playwright-core/lib/client/localUtils.js +60 -0
- package/dist/node_modules/playwright-core/lib/client/locator.js +369 -0
- package/dist/node_modules/playwright-core/lib/client/network.js +747 -0
- package/dist/node_modules/playwright-core/lib/client/page.js +718 -0
- package/dist/node_modules/playwright-core/lib/client/platform.js +74 -0
- package/dist/node_modules/playwright-core/lib/client/playwright.js +71 -0
- package/dist/node_modules/playwright-core/lib/client/selectors.js +55 -0
- package/dist/node_modules/playwright-core/lib/client/stream.js +39 -0
- package/dist/node_modules/playwright-core/lib/client/timeoutSettings.js +79 -0
- package/dist/node_modules/playwright-core/lib/client/tracing.js +119 -0
- package/dist/node_modules/playwright-core/lib/client/types.js +28 -0
- package/dist/node_modules/playwright-core/lib/client/video.js +59 -0
- package/dist/node_modules/playwright-core/lib/client/waiter.js +142 -0
- package/dist/node_modules/playwright-core/lib/client/webError.js +39 -0
- package/dist/node_modules/playwright-core/lib/client/webSocket.js +93 -0
- package/dist/node_modules/playwright-core/lib/client/worker.js +85 -0
- package/dist/node_modules/playwright-core/lib/client/writableStream.js +39 -0
- package/dist/node_modules/playwright-core/lib/generated/bindingsControllerSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/clockSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/injectedScriptSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/pollingRecorderSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/storageScriptSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/utilityScriptSource.js +28 -0
- package/dist/node_modules/playwright-core/lib/generated/webSocketMockSource.js +336 -0
- package/dist/node_modules/playwright-core/lib/inProcessFactory.js +60 -0
- package/dist/node_modules/playwright-core/lib/inprocess.js +3 -0
- package/dist/node_modules/playwright-core/lib/outofprocess.js +76 -0
- package/dist/node_modules/playwright-core/lib/protocol/serializers.js +192 -0
- package/dist/node_modules/playwright-core/lib/protocol/validator.js +2890 -0
- package/dist/node_modules/playwright-core/lib/protocol/validatorPrimitives.js +193 -0
- package/dist/node_modules/playwright-core/lib/remote/playwrightConnection.js +129 -0
- package/dist/node_modules/playwright-core/lib/remote/playwrightServer.js +335 -0
- package/dist/node_modules/playwright-core/lib/server/android/android.js +465 -0
- package/dist/node_modules/playwright-core/lib/server/android/backendAdb.js +177 -0
- package/dist/node_modules/playwright-core/lib/server/artifact.js +127 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js +505 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiChromium.js +153 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiConnection.js +212 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js +221 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js +130 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiInput.js +146 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js +383 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiOverCdp.js +102 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiPage.js +572 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/bidiPdf.js +106 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiDeserializer.js +98 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- package/dist/node_modules/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
- package/dist/node_modules/playwright-core/lib/server/browser.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/browserContext.js +695 -0
- package/dist/node_modules/playwright-core/lib/server/browserType.js +328 -0
- package/dist/node_modules/playwright-core/lib/server/callLog.js +82 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/chromium.js +402 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js +104 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crBrowser.js +510 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crConnection.js +202 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crCoverage.js +235 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crDevTools.js +113 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crDragDrop.js +131 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js +146 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crInput.js +187 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js +666 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crPage.js +1069 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crPdf.js +121 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js +145 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js +136 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/protocol.d.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/chromium/videoRecorder.js +115 -0
- package/dist/node_modules/playwright-core/lib/server/clock.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/csharp.js +327 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/java.js +274 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/javascript.js +270 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/jsonl.js +52 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/language.js +132 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/languages.js +68 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/python.js +279 -0
- package/dist/node_modules/playwright-core/lib/server/codegen/types.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/console.js +57 -0
- package/dist/node_modules/playwright-core/lib/server/cookieStore.js +206 -0
- package/dist/node_modules/playwright-core/lib/server/debugController.js +191 -0
- package/dist/node_modules/playwright-core/lib/server/debugger.js +119 -0
- package/dist/node_modules/playwright-core/lib/server/deviceDescriptors.js +39 -0
- package/dist/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +1779 -0
- package/dist/node_modules/playwright-core/lib/server/dialog.js +116 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js +325 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +381 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/browserDispatcher.js +118 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +64 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/dialogDispatcher.js +47 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js +371 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js +89 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js +227 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/networkDispatchers.js +213 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/pageDispatcher.js +389 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +108 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/streamDispatcher.js +67 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/tracingDispatcher.js +68 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/webSocketRouteDispatcher.js +165 -0
- package/dist/node_modules/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
- package/dist/node_modules/playwright-core/lib/server/dom.js +806 -0
- package/dist/node_modules/playwright-core/lib/server/download.js +70 -0
- package/dist/node_modules/playwright-core/lib/server/electron/electron.js +270 -0
- package/dist/node_modules/playwright-core/lib/server/electron/loader.js +29 -0
- package/dist/node_modules/playwright-core/lib/server/errors.js +69 -0
- package/dist/node_modules/playwright-core/lib/server/fetch.js +621 -0
- package/dist/node_modules/playwright-core/lib/server/fileChooser.js +43 -0
- package/dist/node_modules/playwright-core/lib/server/fileUploadUtils.js +84 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffBrowser.js +428 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffConnection.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js +150 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffInput.js +159 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js +256 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/ffPage.js +500 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/firefox.js +116 -0
- package/dist/node_modules/playwright-core/lib/server/firefox/protocol.d.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/formData.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/frameSelectors.js +154 -0
- package/dist/node_modules/playwright-core/lib/server/frames.js +1455 -0
- package/dist/node_modules/playwright-core/lib/server/har/harRecorder.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/har/harTracer.js +607 -0
- package/dist/node_modules/playwright-core/lib/server/harBackend.js +157 -0
- package/dist/node_modules/playwright-core/lib/server/helper.js +96 -0
- package/dist/node_modules/playwright-core/lib/server/index.js +58 -0
- package/dist/node_modules/playwright-core/lib/server/input.js +277 -0
- package/dist/node_modules/playwright-core/lib/server/instrumentation.js +69 -0
- package/dist/node_modules/playwright-core/lib/server/javascript.js +291 -0
- package/dist/node_modules/playwright-core/lib/server/launchApp.js +128 -0
- package/dist/node_modules/playwright-core/lib/server/localUtils.js +214 -0
- package/dist/node_modules/playwright-core/lib/server/macEditingCommands.js +143 -0
- package/dist/node_modules/playwright-core/lib/server/network.js +629 -0
- package/dist/node_modules/playwright-core/lib/server/page.js +886 -0
- package/dist/node_modules/playwright-core/lib/server/pipeTransport.js +89 -0
- package/dist/node_modules/playwright-core/lib/server/playwright.js +69 -0
- package/dist/node_modules/playwright-core/lib/server/progress.js +112 -0
- package/dist/node_modules/playwright-core/lib/server/protocolError.js +52 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/chat.js +161 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderApp.js +387 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderRunner.js +138 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/recorderUtils.js +157 -0
- package/dist/node_modules/playwright-core/lib/server/recorder/throttledFile.js +57 -0
- package/dist/node_modules/playwright-core/lib/server/recorder.js +499 -0
- package/dist/node_modules/playwright-core/lib/server/registry/browserFetcher.js +175 -0
- package/dist/node_modules/playwright-core/lib/server/registry/dependencies.js +371 -0
- package/dist/node_modules/playwright-core/lib/server/registry/index.js +1399 -0
- package/dist/node_modules/playwright-core/lib/server/registry/nativeDeps.js +1280 -0
- package/dist/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +124 -0
- package/dist/node_modules/playwright-core/lib/server/screenshotter.js +333 -0
- package/dist/node_modules/playwright-core/lib/server/selectors.js +112 -0
- package/dist/node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js +383 -0
- package/dist/node_modules/playwright-core/lib/server/socksInterceptor.js +95 -0
- package/dist/node_modules/playwright-core/lib/server/trace/recorder/snapshotter.js +147 -0
- package/dist/node_modules/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +541 -0
- package/dist/node_modules/playwright-core/lib/server/trace/recorder/tracing.js +604 -0
- package/dist/node_modules/playwright-core/lib/server/trace/test/inMemorySnapshotter.js +87 -0
- package/dist/node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js +241 -0
- package/dist/node_modules/playwright-core/lib/server/transport.js +181 -0
- package/dist/node_modules/playwright-core/lib/server/types.js +28 -0
- package/dist/node_modules/playwright-core/lib/server/usKeyboardLayout.js +145 -0
- package/dist/node_modules/playwright-core/lib/server/utils/ascii.js +44 -0
- package/dist/node_modules/playwright-core/lib/server/utils/comparators.js +139 -0
- package/dist/node_modules/playwright-core/lib/server/utils/crypto.js +216 -0
- package/dist/node_modules/playwright-core/lib/server/utils/debug.js +42 -0
- package/dist/node_modules/playwright-core/lib/server/utils/debugLogger.js +122 -0
- package/dist/node_modules/playwright-core/lib/server/utils/env.js +73 -0
- package/dist/node_modules/playwright-core/lib/server/utils/eventsHelper.js +39 -0
- package/dist/node_modules/playwright-core/lib/server/utils/expectUtils.js +38 -0
- package/dist/node_modules/playwright-core/lib/server/utils/fileUtils.js +191 -0
- package/dist/node_modules/playwright-core/lib/server/utils/happyEyeballs.js +207 -0
- package/dist/node_modules/playwright-core/lib/server/utils/hostPlatform.js +123 -0
- package/dist/node_modules/playwright-core/lib/server/utils/httpServer.js +218 -0
- package/dist/node_modules/playwright-core/lib/server/utils/imageUtils.js +141 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/compare.js +109 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/dist/node_modules/playwright-core/lib/server/utils/image_tools/stats.js +102 -0
- package/dist/node_modules/playwright-core/lib/server/utils/linuxUtils.js +71 -0
- package/dist/node_modules/playwright-core/lib/server/utils/network.js +233 -0
- package/dist/node_modules/playwright-core/lib/server/utils/nodePlatform.js +148 -0
- package/dist/node_modules/playwright-core/lib/server/utils/pipeTransport.js +84 -0
- package/dist/node_modules/playwright-core/lib/server/utils/processLauncher.js +241 -0
- package/dist/node_modules/playwright-core/lib/server/utils/profiler.js +65 -0
- package/dist/node_modules/playwright-core/lib/server/utils/socksProxy.js +511 -0
- package/dist/node_modules/playwright-core/lib/server/utils/spawnAsync.js +41 -0
- package/dist/node_modules/playwright-core/lib/server/utils/task.js +51 -0
- package/dist/node_modules/playwright-core/lib/server/utils/userAgent.js +98 -0
- package/dist/node_modules/playwright-core/lib/server/utils/wsServer.js +121 -0
- package/dist/node_modules/playwright-core/lib/server/utils/zipFile.js +74 -0
- package/dist/node_modules/playwright-core/lib/server/utils/zones.js +57 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/protocol.d.js +16 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/webkit.js +110 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkBrowser.js +339 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkConnection.js +149 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkExecutionContext.js +154 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkInput.js +181 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkInterceptableRequest.js +169 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkPage.js +1130 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/dist/node_modules/playwright-core/lib/server/webkit/wkWorkers.js +105 -0
- package/dist/node_modules/playwright-core/lib/third_party/pixelmatch.js +255 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/ariaSnapshot.js +397 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/assert.js +31 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/colors.js +72 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/cssParser.js +245 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/headers.js +53 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/locatorGenerators.js +689 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/locatorParser.js +176 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/manualPromise.js +114 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/mimeType.js +459 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/multimap.js +80 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/protocolFormatter.js +81 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/protocolMetainfo.js +322 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/rtti.js +43 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/selectorParser.js +386 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/semaphore.js +54 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/stackTrace.js +158 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/stringUtils.js +155 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/time.js +49 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/traceUtils.js +58 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/types.js +16 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/urlMatch.js +190 -0
- package/dist/node_modules/playwright-core/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/dist/node_modules/playwright-core/lib/utils.js +109 -0
- package/dist/node_modules/playwright-core/lib/utilsBundle.js +112 -0
- package/dist/node_modules/playwright-core/lib/utilsBundleImpl/index.js +218 -0
- package/dist/node_modules/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
- package/dist/node_modules/playwright-core/lib/vite/htmlReport/index.html +84 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-BoWUGj0J.js +25 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/index-DJqDAOZp.js +193 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/assets/index-Ri0uHF7I.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/dist/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-Bucv2d7q.js +25 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-BEpdCv1S.js +266 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.ConWv5KN.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/index.BxQ34UMZ.js +2 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/index.C4Y3Aw8n.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/index.html +43 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +21 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BWTwXl41.js +5 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +17 -0
- package/dist/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- package/dist/node_modules/playwright-core/lib/zipBundle.js +34 -0
- package/dist/node_modules/playwright-core/lib/zipBundleImpl.js +5 -0
- package/dist/node_modules/playwright-core/package.json +42 -0
- package/dist/node_modules/playwright-core/types/protocol.d.ts +23245 -0
- package/dist/node_modules/playwright-core/types/structs.d.ts +45 -0
- package/dist/node_modules/playwright-core/types/types.d.ts +22856 -0
- package/dist/server.obf.js +1 -1
- package/package.json +11 -12
|
@@ -0,0 +1,386 @@
|
|
|
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 selectorParser_exports = {};
|
|
20
|
+
__export(selectorParser_exports, {
|
|
21
|
+
InvalidSelectorError: () => import_cssParser2.InvalidSelectorError,
|
|
22
|
+
customCSSNames: () => customCSSNames,
|
|
23
|
+
isInvalidSelectorError: () => import_cssParser2.isInvalidSelectorError,
|
|
24
|
+
parseAttributeSelector: () => parseAttributeSelector,
|
|
25
|
+
parseSelector: () => parseSelector,
|
|
26
|
+
splitSelectorByFrame: () => splitSelectorByFrame,
|
|
27
|
+
stringifySelector: () => stringifySelector,
|
|
28
|
+
visitAllSelectorParts: () => visitAllSelectorParts
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(selectorParser_exports);
|
|
31
|
+
var import_cssParser = require("./cssParser");
|
|
32
|
+
var import_cssParser2 = require("./cssParser");
|
|
33
|
+
const kNestedSelectorNames = /* @__PURE__ */ new Set(["internal:has", "internal:has-not", "internal:and", "internal:or", "internal:chain", "left-of", "right-of", "above", "below", "near"]);
|
|
34
|
+
const kNestedSelectorNamesWithDistance = /* @__PURE__ */ new Set(["left-of", "right-of", "above", "below", "near"]);
|
|
35
|
+
const customCSSNames = /* @__PURE__ */ new Set(["not", "is", "where", "has", "scope", "light", "visible", "text", "text-matches", "text-is", "has-text", "above", "below", "right-of", "left-of", "near", "nth-match"]);
|
|
36
|
+
function parseSelector(selector) {
|
|
37
|
+
const parsedStrings = parseSelectorString(selector);
|
|
38
|
+
const parts = [];
|
|
39
|
+
for (const part of parsedStrings.parts) {
|
|
40
|
+
if (part.name === "css" || part.name === "css:light") {
|
|
41
|
+
if (part.name === "css:light")
|
|
42
|
+
part.body = ":light(" + part.body + ")";
|
|
43
|
+
const parsedCSS = (0, import_cssParser.parseCSS)(part.body, customCSSNames);
|
|
44
|
+
parts.push({
|
|
45
|
+
name: "css",
|
|
46
|
+
body: parsedCSS.selector,
|
|
47
|
+
source: part.body
|
|
48
|
+
});
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (kNestedSelectorNames.has(part.name)) {
|
|
52
|
+
let innerSelector;
|
|
53
|
+
let distance;
|
|
54
|
+
try {
|
|
55
|
+
const unescaped = JSON.parse("[" + part.body + "]");
|
|
56
|
+
if (!Array.isArray(unescaped) || unescaped.length < 1 || unescaped.length > 2 || typeof unescaped[0] !== "string")
|
|
57
|
+
throw new import_cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
|
|
58
|
+
innerSelector = unescaped[0];
|
|
59
|
+
if (unescaped.length === 2) {
|
|
60
|
+
if (typeof unescaped[1] !== "number" || !kNestedSelectorNamesWithDistance.has(part.name))
|
|
61
|
+
throw new import_cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
|
|
62
|
+
distance = unescaped[1];
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
throw new import_cssParser.InvalidSelectorError(`Malformed selector: ${part.name}=` + part.body);
|
|
66
|
+
}
|
|
67
|
+
const nested = { name: part.name, source: part.body, body: { parsed: parseSelector(innerSelector), distance } };
|
|
68
|
+
const lastFrame = [...nested.body.parsed.parts].reverse().find((part2) => part2.name === "internal:control" && part2.body === "enter-frame");
|
|
69
|
+
const lastFrameIndex = lastFrame ? nested.body.parsed.parts.indexOf(lastFrame) : -1;
|
|
70
|
+
if (lastFrameIndex !== -1 && selectorPartsEqual(nested.body.parsed.parts.slice(0, lastFrameIndex + 1), parts.slice(0, lastFrameIndex + 1)))
|
|
71
|
+
nested.body.parsed.parts.splice(0, lastFrameIndex + 1);
|
|
72
|
+
parts.push(nested);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
parts.push({ ...part, source: part.body });
|
|
76
|
+
}
|
|
77
|
+
if (kNestedSelectorNames.has(parts[0].name))
|
|
78
|
+
throw new import_cssParser.InvalidSelectorError(`"${parts[0].name}" selector cannot be first`);
|
|
79
|
+
return {
|
|
80
|
+
capture: parsedStrings.capture,
|
|
81
|
+
parts
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function splitSelectorByFrame(selectorText) {
|
|
85
|
+
const selector = parseSelector(selectorText);
|
|
86
|
+
const result = [];
|
|
87
|
+
let chunk = {
|
|
88
|
+
parts: []
|
|
89
|
+
};
|
|
90
|
+
let chunkStartIndex = 0;
|
|
91
|
+
for (let i = 0; i < selector.parts.length; ++i) {
|
|
92
|
+
const part = selector.parts[i];
|
|
93
|
+
if (part.name === "internal:control" && part.body === "enter-frame") {
|
|
94
|
+
if (!chunk.parts.length)
|
|
95
|
+
throw new import_cssParser.InvalidSelectorError("Selector cannot start with entering frame, select the iframe first");
|
|
96
|
+
result.push(chunk);
|
|
97
|
+
chunk = { parts: [] };
|
|
98
|
+
chunkStartIndex = i + 1;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (selector.capture === i)
|
|
102
|
+
chunk.capture = i - chunkStartIndex;
|
|
103
|
+
chunk.parts.push(part);
|
|
104
|
+
}
|
|
105
|
+
if (!chunk.parts.length)
|
|
106
|
+
throw new import_cssParser.InvalidSelectorError(`Selector cannot end with entering frame, while parsing selector ${selectorText}`);
|
|
107
|
+
result.push(chunk);
|
|
108
|
+
if (typeof selector.capture === "number" && typeof result[result.length - 1].capture !== "number")
|
|
109
|
+
throw new import_cssParser.InvalidSelectorError(`Can not capture the selector before diving into the frame. Only use * after the last frame has been selected`);
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
function selectorPartsEqual(list1, list2) {
|
|
113
|
+
return stringifySelector({ parts: list1 }) === stringifySelector({ parts: list2 });
|
|
114
|
+
}
|
|
115
|
+
function stringifySelector(selector, forceEngineName) {
|
|
116
|
+
if (typeof selector === "string")
|
|
117
|
+
return selector;
|
|
118
|
+
return selector.parts.map((p, i) => {
|
|
119
|
+
let includeEngine = true;
|
|
120
|
+
if (!forceEngineName && i !== selector.capture) {
|
|
121
|
+
if (p.name === "css")
|
|
122
|
+
includeEngine = false;
|
|
123
|
+
else if (p.name === "xpath" && p.source.startsWith("//") || p.source.startsWith(".."))
|
|
124
|
+
includeEngine = false;
|
|
125
|
+
}
|
|
126
|
+
const prefix = includeEngine ? p.name + "=" : "";
|
|
127
|
+
return `${i === selector.capture ? "*" : ""}${prefix}${p.source}`;
|
|
128
|
+
}).join(" >> ");
|
|
129
|
+
}
|
|
130
|
+
function visitAllSelectorParts(selector, visitor) {
|
|
131
|
+
const visit = (selector2, nested) => {
|
|
132
|
+
for (const part of selector2.parts) {
|
|
133
|
+
visitor(part, nested);
|
|
134
|
+
if (kNestedSelectorNames.has(part.name))
|
|
135
|
+
visit(part.body.parsed, true);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
visit(selector, false);
|
|
139
|
+
}
|
|
140
|
+
function parseSelectorString(selector) {
|
|
141
|
+
let index = 0;
|
|
142
|
+
let quote;
|
|
143
|
+
let start = 0;
|
|
144
|
+
const result = { parts: [] };
|
|
145
|
+
const append = () => {
|
|
146
|
+
const part = selector.substring(start, index).trim();
|
|
147
|
+
const eqIndex = part.indexOf("=");
|
|
148
|
+
let name;
|
|
149
|
+
let body;
|
|
150
|
+
if (eqIndex !== -1 && part.substring(0, eqIndex).trim().match(/^[a-zA-Z_0-9-+:*]+$/)) {
|
|
151
|
+
name = part.substring(0, eqIndex).trim();
|
|
152
|
+
body = part.substring(eqIndex + 1);
|
|
153
|
+
} else if (part.length > 1 && part[0] === '"' && part[part.length - 1] === '"') {
|
|
154
|
+
name = "text";
|
|
155
|
+
body = part;
|
|
156
|
+
} else if (part.length > 1 && part[0] === "'" && part[part.length - 1] === "'") {
|
|
157
|
+
name = "text";
|
|
158
|
+
body = part;
|
|
159
|
+
} else if (/^\(*\/\//.test(part) || part.startsWith("..")) {
|
|
160
|
+
name = "xpath";
|
|
161
|
+
body = part;
|
|
162
|
+
} else {
|
|
163
|
+
name = "css";
|
|
164
|
+
body = part;
|
|
165
|
+
}
|
|
166
|
+
let capture = false;
|
|
167
|
+
if (name[0] === "*") {
|
|
168
|
+
capture = true;
|
|
169
|
+
name = name.substring(1);
|
|
170
|
+
}
|
|
171
|
+
result.parts.push({ name, body });
|
|
172
|
+
if (capture) {
|
|
173
|
+
if (result.capture !== void 0)
|
|
174
|
+
throw new import_cssParser.InvalidSelectorError(`Only one of the selectors can capture using * modifier`);
|
|
175
|
+
result.capture = result.parts.length - 1;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
if (!selector.includes(">>")) {
|
|
179
|
+
index = selector.length;
|
|
180
|
+
append();
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
const shouldIgnoreTextSelectorQuote = () => {
|
|
184
|
+
const prefix = selector.substring(start, index);
|
|
185
|
+
const match = prefix.match(/^\s*text\s*=(.*)$/);
|
|
186
|
+
return !!match && !!match[1];
|
|
187
|
+
};
|
|
188
|
+
while (index < selector.length) {
|
|
189
|
+
const c = selector[index];
|
|
190
|
+
if (c === "\\" && index + 1 < selector.length) {
|
|
191
|
+
index += 2;
|
|
192
|
+
} else if (c === quote) {
|
|
193
|
+
quote = void 0;
|
|
194
|
+
index++;
|
|
195
|
+
} else if (!quote && (c === '"' || c === "'" || c === "`") && !shouldIgnoreTextSelectorQuote()) {
|
|
196
|
+
quote = c;
|
|
197
|
+
index++;
|
|
198
|
+
} else if (!quote && c === ">" && selector[index + 1] === ">") {
|
|
199
|
+
append();
|
|
200
|
+
index += 2;
|
|
201
|
+
start = index;
|
|
202
|
+
} else {
|
|
203
|
+
index++;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
append();
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
function parseAttributeSelector(selector, allowUnquotedStrings) {
|
|
210
|
+
let wp = 0;
|
|
211
|
+
let EOL = selector.length === 0;
|
|
212
|
+
const next = () => selector[wp] || "";
|
|
213
|
+
const eat1 = () => {
|
|
214
|
+
const result2 = next();
|
|
215
|
+
++wp;
|
|
216
|
+
EOL = wp >= selector.length;
|
|
217
|
+
return result2;
|
|
218
|
+
};
|
|
219
|
+
const syntaxError = (stage) => {
|
|
220
|
+
if (EOL)
|
|
221
|
+
throw new import_cssParser.InvalidSelectorError(`Unexpected end of selector while parsing selector \`${selector}\``);
|
|
222
|
+
throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - unexpected symbol "${next()}" at position ${wp}` + (stage ? " during " + stage : ""));
|
|
223
|
+
};
|
|
224
|
+
function skipSpaces() {
|
|
225
|
+
while (!EOL && /\s/.test(next()))
|
|
226
|
+
eat1();
|
|
227
|
+
}
|
|
228
|
+
function isCSSNameChar(char) {
|
|
229
|
+
return char >= "\x80" || char >= "0" && char <= "9" || char >= "A" && char <= "Z" || char >= "a" && char <= "z" || char >= "0" && char <= "9" || char === "_" || char === "-";
|
|
230
|
+
}
|
|
231
|
+
function readIdentifier() {
|
|
232
|
+
let result2 = "";
|
|
233
|
+
skipSpaces();
|
|
234
|
+
while (!EOL && isCSSNameChar(next()))
|
|
235
|
+
result2 += eat1();
|
|
236
|
+
return result2;
|
|
237
|
+
}
|
|
238
|
+
function readQuotedString(quote) {
|
|
239
|
+
let result2 = eat1();
|
|
240
|
+
if (result2 !== quote)
|
|
241
|
+
syntaxError("parsing quoted string");
|
|
242
|
+
while (!EOL && next() !== quote) {
|
|
243
|
+
if (next() === "\\")
|
|
244
|
+
eat1();
|
|
245
|
+
result2 += eat1();
|
|
246
|
+
}
|
|
247
|
+
if (next() !== quote)
|
|
248
|
+
syntaxError("parsing quoted string");
|
|
249
|
+
result2 += eat1();
|
|
250
|
+
return result2;
|
|
251
|
+
}
|
|
252
|
+
function readRegularExpression() {
|
|
253
|
+
if (eat1() !== "/")
|
|
254
|
+
syntaxError("parsing regular expression");
|
|
255
|
+
let source = "";
|
|
256
|
+
let inClass = false;
|
|
257
|
+
while (!EOL) {
|
|
258
|
+
if (next() === "\\") {
|
|
259
|
+
source += eat1();
|
|
260
|
+
if (EOL)
|
|
261
|
+
syntaxError("parsing regular expression");
|
|
262
|
+
} else if (inClass && next() === "]") {
|
|
263
|
+
inClass = false;
|
|
264
|
+
} else if (!inClass && next() === "[") {
|
|
265
|
+
inClass = true;
|
|
266
|
+
} else if (!inClass && next() === "/") {
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
source += eat1();
|
|
270
|
+
}
|
|
271
|
+
if (eat1() !== "/")
|
|
272
|
+
syntaxError("parsing regular expression");
|
|
273
|
+
let flags = "";
|
|
274
|
+
while (!EOL && next().match(/[dgimsuy]/))
|
|
275
|
+
flags += eat1();
|
|
276
|
+
try {
|
|
277
|
+
return new RegExp(source, flags);
|
|
278
|
+
} catch (e) {
|
|
279
|
+
throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\`: ${e.message}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function readAttributeToken() {
|
|
283
|
+
let token = "";
|
|
284
|
+
skipSpaces();
|
|
285
|
+
if (next() === `'` || next() === `"`)
|
|
286
|
+
token = readQuotedString(next()).slice(1, -1);
|
|
287
|
+
else
|
|
288
|
+
token = readIdentifier();
|
|
289
|
+
if (!token)
|
|
290
|
+
syntaxError("parsing property path");
|
|
291
|
+
return token;
|
|
292
|
+
}
|
|
293
|
+
function readOperator() {
|
|
294
|
+
skipSpaces();
|
|
295
|
+
let op = "";
|
|
296
|
+
if (!EOL)
|
|
297
|
+
op += eat1();
|
|
298
|
+
if (!EOL && op !== "=")
|
|
299
|
+
op += eat1();
|
|
300
|
+
if (!["=", "*=", "^=", "$=", "|=", "~="].includes(op))
|
|
301
|
+
syntaxError("parsing operator");
|
|
302
|
+
return op;
|
|
303
|
+
}
|
|
304
|
+
function readAttribute() {
|
|
305
|
+
eat1();
|
|
306
|
+
const jsonPath = [];
|
|
307
|
+
jsonPath.push(readAttributeToken());
|
|
308
|
+
skipSpaces();
|
|
309
|
+
while (next() === ".") {
|
|
310
|
+
eat1();
|
|
311
|
+
jsonPath.push(readAttributeToken());
|
|
312
|
+
skipSpaces();
|
|
313
|
+
}
|
|
314
|
+
if (next() === "]") {
|
|
315
|
+
eat1();
|
|
316
|
+
return { name: jsonPath.join("."), jsonPath, op: "<truthy>", value: null, caseSensitive: false };
|
|
317
|
+
}
|
|
318
|
+
const operator = readOperator();
|
|
319
|
+
let value = void 0;
|
|
320
|
+
let caseSensitive = true;
|
|
321
|
+
skipSpaces();
|
|
322
|
+
if (next() === "/") {
|
|
323
|
+
if (operator !== "=")
|
|
324
|
+
throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - cannot use ${operator} in attribute with regular expression`);
|
|
325
|
+
value = readRegularExpression();
|
|
326
|
+
} else if (next() === `'` || next() === `"`) {
|
|
327
|
+
value = readQuotedString(next()).slice(1, -1);
|
|
328
|
+
skipSpaces();
|
|
329
|
+
if (next() === "i" || next() === "I") {
|
|
330
|
+
caseSensitive = false;
|
|
331
|
+
eat1();
|
|
332
|
+
} else if (next() === "s" || next() === "S") {
|
|
333
|
+
caseSensitive = true;
|
|
334
|
+
eat1();
|
|
335
|
+
}
|
|
336
|
+
} else {
|
|
337
|
+
value = "";
|
|
338
|
+
while (!EOL && (isCSSNameChar(next()) || next() === "+" || next() === "."))
|
|
339
|
+
value += eat1();
|
|
340
|
+
if (value === "true") {
|
|
341
|
+
value = true;
|
|
342
|
+
} else if (value === "false") {
|
|
343
|
+
value = false;
|
|
344
|
+
} else {
|
|
345
|
+
if (!allowUnquotedStrings) {
|
|
346
|
+
value = +value;
|
|
347
|
+
if (Number.isNaN(value))
|
|
348
|
+
syntaxError("parsing attribute value");
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
skipSpaces();
|
|
353
|
+
if (next() !== "]")
|
|
354
|
+
syntaxError("parsing attribute value");
|
|
355
|
+
eat1();
|
|
356
|
+
if (operator !== "=" && typeof value !== "string")
|
|
357
|
+
throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - cannot use ${operator} in attribute with non-string matching value - ${value}`);
|
|
358
|
+
return { name: jsonPath.join("."), jsonPath, op: operator, value, caseSensitive };
|
|
359
|
+
}
|
|
360
|
+
const result = {
|
|
361
|
+
name: "",
|
|
362
|
+
attributes: []
|
|
363
|
+
};
|
|
364
|
+
result.name = readIdentifier();
|
|
365
|
+
skipSpaces();
|
|
366
|
+
while (next() === "[") {
|
|
367
|
+
result.attributes.push(readAttribute());
|
|
368
|
+
skipSpaces();
|
|
369
|
+
}
|
|
370
|
+
if (!EOL)
|
|
371
|
+
syntaxError(void 0);
|
|
372
|
+
if (!result.name && !result.attributes.length)
|
|
373
|
+
throw new import_cssParser.InvalidSelectorError(`Error while parsing selector \`${selector}\` - selector cannot be empty`);
|
|
374
|
+
return result;
|
|
375
|
+
}
|
|
376
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
377
|
+
0 && (module.exports = {
|
|
378
|
+
InvalidSelectorError,
|
|
379
|
+
customCSSNames,
|
|
380
|
+
isInvalidSelectorError,
|
|
381
|
+
parseAttributeSelector,
|
|
382
|
+
parseSelector,
|
|
383
|
+
splitSelectorByFrame,
|
|
384
|
+
stringifySelector,
|
|
385
|
+
visitAllSelectorParts
|
|
386
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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 semaphore_exports = {};
|
|
20
|
+
__export(semaphore_exports, {
|
|
21
|
+
Semaphore: () => Semaphore
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(semaphore_exports);
|
|
24
|
+
var import_manualPromise = require("./manualPromise");
|
|
25
|
+
class Semaphore {
|
|
26
|
+
constructor(max) {
|
|
27
|
+
this._acquired = 0;
|
|
28
|
+
this._queue = [];
|
|
29
|
+
this._max = max;
|
|
30
|
+
}
|
|
31
|
+
setMax(max) {
|
|
32
|
+
this._max = max;
|
|
33
|
+
}
|
|
34
|
+
acquire() {
|
|
35
|
+
const lock = new import_manualPromise.ManualPromise();
|
|
36
|
+
this._queue.push(lock);
|
|
37
|
+
this._flush();
|
|
38
|
+
return lock;
|
|
39
|
+
}
|
|
40
|
+
release() {
|
|
41
|
+
--this._acquired;
|
|
42
|
+
this._flush();
|
|
43
|
+
}
|
|
44
|
+
_flush() {
|
|
45
|
+
while (this._acquired < this._max && this._queue.length) {
|
|
46
|
+
++this._acquired;
|
|
47
|
+
this._queue.shift().resolve();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
Semaphore
|
|
54
|
+
});
|
|
@@ -0,0 +1,158 @@
|
|
|
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 stackTrace_exports = {};
|
|
20
|
+
__export(stackTrace_exports, {
|
|
21
|
+
captureRawStack: () => captureRawStack,
|
|
22
|
+
parseErrorStack: () => parseErrorStack,
|
|
23
|
+
parseStackFrame: () => parseStackFrame,
|
|
24
|
+
rewriteErrorMessage: () => rewriteErrorMessage,
|
|
25
|
+
splitErrorMessage: () => splitErrorMessage,
|
|
26
|
+
stringifyStackFrames: () => stringifyStackFrames
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(stackTrace_exports);
|
|
29
|
+
function captureRawStack() {
|
|
30
|
+
const stackTraceLimit = Error.stackTraceLimit;
|
|
31
|
+
Error.stackTraceLimit = 50;
|
|
32
|
+
const error = new Error();
|
|
33
|
+
const stack = error.stack || "";
|
|
34
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
35
|
+
return stack.split("\n");
|
|
36
|
+
}
|
|
37
|
+
function parseStackFrame(text, pathSeparator, showInternalStackFrames) {
|
|
38
|
+
const match = text && text.match(re);
|
|
39
|
+
if (!match)
|
|
40
|
+
return null;
|
|
41
|
+
let fname = match[2];
|
|
42
|
+
let file = match[7];
|
|
43
|
+
if (!file)
|
|
44
|
+
return null;
|
|
45
|
+
if (!showInternalStackFrames && (file.startsWith("internal") || file.startsWith("node:")))
|
|
46
|
+
return null;
|
|
47
|
+
const line = match[8];
|
|
48
|
+
const column = match[9];
|
|
49
|
+
const closeParen = match[11] === ")";
|
|
50
|
+
const frame = {
|
|
51
|
+
file: "",
|
|
52
|
+
line: 0,
|
|
53
|
+
column: 0
|
|
54
|
+
};
|
|
55
|
+
if (line)
|
|
56
|
+
frame.line = Number(line);
|
|
57
|
+
if (column)
|
|
58
|
+
frame.column = Number(column);
|
|
59
|
+
if (closeParen && file) {
|
|
60
|
+
let closes = 0;
|
|
61
|
+
for (let i = file.length - 1; i > 0; i--) {
|
|
62
|
+
if (file.charAt(i) === ")") {
|
|
63
|
+
closes++;
|
|
64
|
+
} else if (file.charAt(i) === "(" && file.charAt(i - 1) === " ") {
|
|
65
|
+
closes--;
|
|
66
|
+
if (closes === -1 && file.charAt(i - 1) === " ") {
|
|
67
|
+
const before = file.slice(0, i - 1);
|
|
68
|
+
const after = file.slice(i + 1);
|
|
69
|
+
file = after;
|
|
70
|
+
fname += ` (${before}`;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (fname) {
|
|
77
|
+
const methodMatch = fname.match(methodRe);
|
|
78
|
+
if (methodMatch)
|
|
79
|
+
fname = methodMatch[1];
|
|
80
|
+
}
|
|
81
|
+
if (file) {
|
|
82
|
+
if (file.startsWith("file://"))
|
|
83
|
+
file = fileURLToPath(file, pathSeparator);
|
|
84
|
+
frame.file = file;
|
|
85
|
+
}
|
|
86
|
+
if (fname)
|
|
87
|
+
frame.function = fname;
|
|
88
|
+
return frame;
|
|
89
|
+
}
|
|
90
|
+
function rewriteErrorMessage(e, newMessage) {
|
|
91
|
+
const lines = (e.stack?.split("\n") || []).filter((l) => l.startsWith(" at "));
|
|
92
|
+
e.message = newMessage;
|
|
93
|
+
const errorTitle = `${e.name}: ${e.message}`;
|
|
94
|
+
if (lines.length)
|
|
95
|
+
e.stack = `${errorTitle}
|
|
96
|
+
${lines.join("\n")}`;
|
|
97
|
+
return e;
|
|
98
|
+
}
|
|
99
|
+
function stringifyStackFrames(frames) {
|
|
100
|
+
const stackLines = [];
|
|
101
|
+
for (const frame of frames) {
|
|
102
|
+
if (frame.function)
|
|
103
|
+
stackLines.push(` at ${frame.function} (${frame.file}:${frame.line}:${frame.column})`);
|
|
104
|
+
else
|
|
105
|
+
stackLines.push(` at ${frame.file}:${frame.line}:${frame.column}`);
|
|
106
|
+
}
|
|
107
|
+
return stackLines;
|
|
108
|
+
}
|
|
109
|
+
function splitErrorMessage(message) {
|
|
110
|
+
const separationIdx = message.indexOf(":");
|
|
111
|
+
return {
|
|
112
|
+
name: separationIdx !== -1 ? message.slice(0, separationIdx) : "",
|
|
113
|
+
message: separationIdx !== -1 && separationIdx + 2 <= message.length ? message.substring(separationIdx + 2) : message
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function parseErrorStack(stack, pathSeparator, showInternalStackFrames = false) {
|
|
117
|
+
const lines = stack.split("\n");
|
|
118
|
+
let firstStackLine = lines.findIndex((line) => line.startsWith(" at "));
|
|
119
|
+
if (firstStackLine === -1)
|
|
120
|
+
firstStackLine = lines.length;
|
|
121
|
+
const message = lines.slice(0, firstStackLine).join("\n");
|
|
122
|
+
const stackLines = lines.slice(firstStackLine);
|
|
123
|
+
let location;
|
|
124
|
+
for (const line of stackLines) {
|
|
125
|
+
const frame = parseStackFrame(line, pathSeparator, showInternalStackFrames);
|
|
126
|
+
if (!frame || !frame.file)
|
|
127
|
+
continue;
|
|
128
|
+
if (belongsToNodeModules(frame.file, pathSeparator))
|
|
129
|
+
continue;
|
|
130
|
+
location = { file: frame.file, column: frame.column || 0, line: frame.line || 0 };
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return { message, stackLines, location };
|
|
134
|
+
}
|
|
135
|
+
function belongsToNodeModules(file, pathSeparator) {
|
|
136
|
+
return file.includes(`${pathSeparator}node_modules${pathSeparator}`);
|
|
137
|
+
}
|
|
138
|
+
const re = new RegExp(
|
|
139
|
+
"^(?:\\s*at )?(?:(new) )?(?:(.*?) \\()?(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?(?:(.+?):(\\d+):(\\d+)|(native))(\\)?)$"
|
|
140
|
+
);
|
|
141
|
+
const methodRe = /^(.*?) \[as (.*?)\]$/;
|
|
142
|
+
function fileURLToPath(fileUrl, pathSeparator) {
|
|
143
|
+
if (!fileUrl.startsWith("file://"))
|
|
144
|
+
return fileUrl;
|
|
145
|
+
let path = decodeURIComponent(fileUrl.slice(7));
|
|
146
|
+
if (path.startsWith("/") && /^[a-zA-Z]:/.test(path.slice(1)))
|
|
147
|
+
path = path.slice(1);
|
|
148
|
+
return path.replace(/\//g, pathSeparator);
|
|
149
|
+
}
|
|
150
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
151
|
+
0 && (module.exports = {
|
|
152
|
+
captureRawStack,
|
|
153
|
+
parseErrorStack,
|
|
154
|
+
parseStackFrame,
|
|
155
|
+
rewriteErrorMessage,
|
|
156
|
+
splitErrorMessage,
|
|
157
|
+
stringifyStackFrames
|
|
158
|
+
});
|