@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,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var httpServer_exports = {};
|
|
30
|
+
__export(httpServer_exports, {
|
|
31
|
+
HttpServer: () => HttpServer
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(httpServer_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_utilsBundle = require("../../utilsBundle");
|
|
37
|
+
var import_crypto = require("./crypto");
|
|
38
|
+
var import_assert = require("../../utils/isomorphic/assert");
|
|
39
|
+
var import_manualPromise = require("../../utils/isomorphic/manualPromise");
|
|
40
|
+
var import_network = require("./network");
|
|
41
|
+
class HttpServer {
|
|
42
|
+
constructor() {
|
|
43
|
+
this._urlPrefixPrecise = "";
|
|
44
|
+
this._urlPrefixHumanReadable = "";
|
|
45
|
+
this._port = 0;
|
|
46
|
+
this._started = false;
|
|
47
|
+
this._routes = [];
|
|
48
|
+
this._server = (0, import_network.createHttpServer)(this._onRequest.bind(this));
|
|
49
|
+
}
|
|
50
|
+
server() {
|
|
51
|
+
return this._server;
|
|
52
|
+
}
|
|
53
|
+
routePrefix(prefix, handler) {
|
|
54
|
+
this._routes.push({ prefix, handler });
|
|
55
|
+
}
|
|
56
|
+
routePath(path2, handler) {
|
|
57
|
+
this._routes.push({ exact: path2, handler });
|
|
58
|
+
}
|
|
59
|
+
port() {
|
|
60
|
+
return this._port;
|
|
61
|
+
}
|
|
62
|
+
async _tryStart(port, host) {
|
|
63
|
+
const errorPromise = new import_manualPromise.ManualPromise();
|
|
64
|
+
const errorListener = (error) => errorPromise.reject(error);
|
|
65
|
+
this._server.on("error", errorListener);
|
|
66
|
+
try {
|
|
67
|
+
this._server.listen(port, host);
|
|
68
|
+
await Promise.race([
|
|
69
|
+
new Promise((cb) => this._server.once("listening", cb)),
|
|
70
|
+
errorPromise
|
|
71
|
+
]);
|
|
72
|
+
} finally {
|
|
73
|
+
this._server.removeListener("error", errorListener);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
createWebSocket(transport, guid) {
|
|
77
|
+
(0, import_assert.assert)(!this._wsGuid, "can only create one main websocket transport per server");
|
|
78
|
+
this._wsGuid = guid || (0, import_crypto.createGuid)();
|
|
79
|
+
const wss = new import_utilsBundle.wsServer({ server: this._server, path: "/" + this._wsGuid });
|
|
80
|
+
wss.on("connection", (ws) => {
|
|
81
|
+
transport.onconnect();
|
|
82
|
+
transport.sendEvent = (method, params) => ws.send(JSON.stringify({ method, params }));
|
|
83
|
+
transport.close = () => ws.close();
|
|
84
|
+
ws.on("message", async (message) => {
|
|
85
|
+
const { id, method, params } = JSON.parse(String(message));
|
|
86
|
+
try {
|
|
87
|
+
const result = await transport.dispatch(method, params);
|
|
88
|
+
ws.send(JSON.stringify({ id, result }));
|
|
89
|
+
} catch (e) {
|
|
90
|
+
ws.send(JSON.stringify({ id, error: String(e) }));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
ws.on("close", () => transport.onclose());
|
|
94
|
+
ws.on("error", () => transport.onclose());
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
wsGuid() {
|
|
98
|
+
return this._wsGuid;
|
|
99
|
+
}
|
|
100
|
+
async start(options = {}) {
|
|
101
|
+
(0, import_assert.assert)(!this._started, "server already started");
|
|
102
|
+
this._started = true;
|
|
103
|
+
const host = options.host || "localhost";
|
|
104
|
+
if (options.preferredPort) {
|
|
105
|
+
try {
|
|
106
|
+
await this._tryStart(options.preferredPort, host);
|
|
107
|
+
} catch (e) {
|
|
108
|
+
if (!e || !e.message || !e.message.includes("EADDRINUSE"))
|
|
109
|
+
throw e;
|
|
110
|
+
await this._tryStart(void 0, host);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
await this._tryStart(options.port, host);
|
|
114
|
+
}
|
|
115
|
+
const address = this._server.address();
|
|
116
|
+
(0, import_assert.assert)(address, "Could not bind server socket");
|
|
117
|
+
if (typeof address === "string") {
|
|
118
|
+
this._urlPrefixPrecise = address;
|
|
119
|
+
this._urlPrefixHumanReadable = address;
|
|
120
|
+
} else {
|
|
121
|
+
this._port = address.port;
|
|
122
|
+
const resolvedHost = address.family === "IPv4" ? address.address : `[${address.address}]`;
|
|
123
|
+
this._urlPrefixPrecise = `http://${resolvedHost}:${address.port}`;
|
|
124
|
+
this._urlPrefixHumanReadable = `http://${host}:${address.port}`;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async stop() {
|
|
128
|
+
await new Promise((cb) => this._server.close(cb));
|
|
129
|
+
}
|
|
130
|
+
urlPrefix(purpose) {
|
|
131
|
+
return purpose === "human-readable" ? this._urlPrefixHumanReadable : this._urlPrefixPrecise;
|
|
132
|
+
}
|
|
133
|
+
serveFile(request, response, absoluteFilePath, headers) {
|
|
134
|
+
try {
|
|
135
|
+
for (const [name, value] of Object.entries(headers || {}))
|
|
136
|
+
response.setHeader(name, value);
|
|
137
|
+
if (request.headers.range)
|
|
138
|
+
this._serveRangeFile(request, response, absoluteFilePath);
|
|
139
|
+
else
|
|
140
|
+
this._serveFile(response, absoluteFilePath);
|
|
141
|
+
return true;
|
|
142
|
+
} catch (e) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
_serveFile(response, absoluteFilePath) {
|
|
147
|
+
const content = import_fs.default.readFileSync(absoluteFilePath);
|
|
148
|
+
response.statusCode = 200;
|
|
149
|
+
const contentType = import_utilsBundle.mime.getType(import_path.default.extname(absoluteFilePath)) || "application/octet-stream";
|
|
150
|
+
response.setHeader("Content-Type", contentType);
|
|
151
|
+
response.setHeader("Content-Length", content.byteLength);
|
|
152
|
+
response.end(content);
|
|
153
|
+
}
|
|
154
|
+
_serveRangeFile(request, response, absoluteFilePath) {
|
|
155
|
+
const range = request.headers.range;
|
|
156
|
+
if (!range || !range.startsWith("bytes=") || range.includes(", ") || [...range].filter((char) => char === "-").length !== 1) {
|
|
157
|
+
response.statusCode = 400;
|
|
158
|
+
return response.end("Bad request");
|
|
159
|
+
}
|
|
160
|
+
const [startStr, endStr] = range.replace(/bytes=/, "").split("-");
|
|
161
|
+
let start;
|
|
162
|
+
let end;
|
|
163
|
+
const size = import_fs.default.statSync(absoluteFilePath).size;
|
|
164
|
+
if (startStr !== "" && endStr === "") {
|
|
165
|
+
start = +startStr;
|
|
166
|
+
end = size - 1;
|
|
167
|
+
} else if (startStr === "" && endStr !== "") {
|
|
168
|
+
start = size - +endStr;
|
|
169
|
+
end = size - 1;
|
|
170
|
+
} else {
|
|
171
|
+
start = +startStr;
|
|
172
|
+
end = +endStr;
|
|
173
|
+
}
|
|
174
|
+
if (Number.isNaN(start) || Number.isNaN(end) || start >= size || end >= size || start > end) {
|
|
175
|
+
response.writeHead(416, {
|
|
176
|
+
"Content-Range": `bytes */${size}`
|
|
177
|
+
});
|
|
178
|
+
return response.end();
|
|
179
|
+
}
|
|
180
|
+
response.writeHead(206, {
|
|
181
|
+
"Content-Range": `bytes ${start}-${end}/${size}`,
|
|
182
|
+
"Accept-Ranges": "bytes",
|
|
183
|
+
"Content-Length": end - start + 1,
|
|
184
|
+
"Content-Type": import_utilsBundle.mime.getType(import_path.default.extname(absoluteFilePath))
|
|
185
|
+
});
|
|
186
|
+
const readable = import_fs.default.createReadStream(absoluteFilePath, { start, end });
|
|
187
|
+
readable.pipe(response);
|
|
188
|
+
}
|
|
189
|
+
_onRequest(request, response) {
|
|
190
|
+
if (request.method === "OPTIONS") {
|
|
191
|
+
response.writeHead(200);
|
|
192
|
+
response.end();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
request.on("error", () => response.end());
|
|
196
|
+
try {
|
|
197
|
+
if (!request.url) {
|
|
198
|
+
response.end();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const url = new URL("http://localhost" + request.url);
|
|
202
|
+
for (const route of this._routes) {
|
|
203
|
+
if (route.exact && url.pathname === route.exact && route.handler(request, response))
|
|
204
|
+
return;
|
|
205
|
+
if (route.prefix && url.pathname.startsWith(route.prefix) && route.handler(request, response))
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
response.statusCode = 404;
|
|
209
|
+
response.end();
|
|
210
|
+
} catch (e) {
|
|
211
|
+
response.end();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
216
|
+
0 && (module.exports = {
|
|
217
|
+
HttpServer
|
|
218
|
+
});
|
|
@@ -0,0 +1,141 @@
|
|
|
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 imageUtils_exports = {};
|
|
20
|
+
__export(imageUtils_exports, {
|
|
21
|
+
padImageToSize: () => padImageToSize,
|
|
22
|
+
scaleImageToSize: () => scaleImageToSize
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(imageUtils_exports);
|
|
25
|
+
function padImageToSize(image, size) {
|
|
26
|
+
if (image.width === size.width && image.height === size.height)
|
|
27
|
+
return image;
|
|
28
|
+
const buffer = new Uint8Array(size.width * size.height * 4);
|
|
29
|
+
for (let y = 0; y < size.height; y++) {
|
|
30
|
+
for (let x = 0; x < size.width; x++) {
|
|
31
|
+
const to = (y * size.width + x) * 4;
|
|
32
|
+
if (y < image.height && x < image.width) {
|
|
33
|
+
const from = (y * image.width + x) * 4;
|
|
34
|
+
buffer[to] = image.data[from];
|
|
35
|
+
buffer[to + 1] = image.data[from + 1];
|
|
36
|
+
buffer[to + 2] = image.data[from + 2];
|
|
37
|
+
buffer[to + 3] = image.data[from + 3];
|
|
38
|
+
} else {
|
|
39
|
+
buffer[to] = 0;
|
|
40
|
+
buffer[to + 1] = 0;
|
|
41
|
+
buffer[to + 2] = 0;
|
|
42
|
+
buffer[to + 3] = 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { data: Buffer.from(buffer), width: size.width, height: size.height };
|
|
47
|
+
}
|
|
48
|
+
function scaleImageToSize(image, size) {
|
|
49
|
+
const { data: src, width: w1, height: h1 } = image;
|
|
50
|
+
const w2 = Math.max(1, Math.floor(size.width));
|
|
51
|
+
const h2 = Math.max(1, Math.floor(size.height));
|
|
52
|
+
if (w1 === w2 && h1 === h2)
|
|
53
|
+
return image;
|
|
54
|
+
if (w1 <= 0 || h1 <= 0)
|
|
55
|
+
throw new Error("Invalid input image");
|
|
56
|
+
if (size.width <= 0 || size.height <= 0 || !isFinite(size.width) || !isFinite(size.height))
|
|
57
|
+
throw new Error("Invalid output dimensions");
|
|
58
|
+
const clamp = (v, lo, hi) => v < lo ? lo : v > hi ? hi : v;
|
|
59
|
+
const weights = (t, o) => {
|
|
60
|
+
const t2 = t * t, t3 = t2 * t;
|
|
61
|
+
o[0] = -0.5 * t + 1 * t2 - 0.5 * t3;
|
|
62
|
+
o[1] = 1 - 2.5 * t2 + 1.5 * t3;
|
|
63
|
+
o[2] = 0.5 * t + 2 * t2 - 1.5 * t3;
|
|
64
|
+
o[3] = -0.5 * t2 + 0.5 * t3;
|
|
65
|
+
};
|
|
66
|
+
const srcRowStride = w1 * 4;
|
|
67
|
+
const dstRowStride = w2 * 4;
|
|
68
|
+
const xOff = new Int32Array(w2 * 4);
|
|
69
|
+
const xW = new Float32Array(w2 * 4);
|
|
70
|
+
const wx = new Float32Array(4);
|
|
71
|
+
const xScale = w1 / w2;
|
|
72
|
+
for (let x = 0; x < w2; x++) {
|
|
73
|
+
const sx = (x + 0.5) * xScale - 0.5;
|
|
74
|
+
const sxi = Math.floor(sx);
|
|
75
|
+
const t = sx - sxi;
|
|
76
|
+
weights(t, wx);
|
|
77
|
+
const b = x * 4;
|
|
78
|
+
const i0 = clamp(sxi - 1, 0, w1 - 1);
|
|
79
|
+
const i1 = clamp(sxi + 0, 0, w1 - 1);
|
|
80
|
+
const i2 = clamp(sxi + 1, 0, w1 - 1);
|
|
81
|
+
const i3 = clamp(sxi + 2, 0, w1 - 1);
|
|
82
|
+
xOff[b + 0] = i0 << 2;
|
|
83
|
+
xOff[b + 1] = i1 << 2;
|
|
84
|
+
xOff[b + 2] = i2 << 2;
|
|
85
|
+
xOff[b + 3] = i3 << 2;
|
|
86
|
+
xW[b + 0] = wx[0];
|
|
87
|
+
xW[b + 1] = wx[1];
|
|
88
|
+
xW[b + 2] = wx[2];
|
|
89
|
+
xW[b + 3] = wx[3];
|
|
90
|
+
}
|
|
91
|
+
const yRow = new Int32Array(h2 * 4);
|
|
92
|
+
const yW = new Float32Array(h2 * 4);
|
|
93
|
+
const wy = new Float32Array(4);
|
|
94
|
+
const yScale = h1 / h2;
|
|
95
|
+
for (let y = 0; y < h2; y++) {
|
|
96
|
+
const sy = (y + 0.5) * yScale - 0.5;
|
|
97
|
+
const syi = Math.floor(sy);
|
|
98
|
+
const t = sy - syi;
|
|
99
|
+
weights(t, wy);
|
|
100
|
+
const b = y * 4;
|
|
101
|
+
const j0 = clamp(syi - 1, 0, h1 - 1);
|
|
102
|
+
const j1 = clamp(syi + 0, 0, h1 - 1);
|
|
103
|
+
const j2 = clamp(syi + 1, 0, h1 - 1);
|
|
104
|
+
const j3 = clamp(syi + 2, 0, h1 - 1);
|
|
105
|
+
yRow[b + 0] = j0 * srcRowStride;
|
|
106
|
+
yRow[b + 1] = j1 * srcRowStride;
|
|
107
|
+
yRow[b + 2] = j2 * srcRowStride;
|
|
108
|
+
yRow[b + 3] = j3 * srcRowStride;
|
|
109
|
+
yW[b + 0] = wy[0];
|
|
110
|
+
yW[b + 1] = wy[1];
|
|
111
|
+
yW[b + 2] = wy[2];
|
|
112
|
+
yW[b + 3] = wy[3];
|
|
113
|
+
}
|
|
114
|
+
const dst = new Uint8Array(w2 * h2 * 4);
|
|
115
|
+
for (let y = 0; y < h2; y++) {
|
|
116
|
+
const yb = y * 4;
|
|
117
|
+
const rb0 = yRow[yb + 0], rb1 = yRow[yb + 1], rb2 = yRow[yb + 2], rb3 = yRow[yb + 3];
|
|
118
|
+
const wy0 = yW[yb + 0], wy1 = yW[yb + 1], wy2 = yW[yb + 2], wy3 = yW[yb + 3];
|
|
119
|
+
const dstBase = y * dstRowStride;
|
|
120
|
+
for (let x = 0; x < w2; x++) {
|
|
121
|
+
const xb = x * 4;
|
|
122
|
+
const xo0 = xOff[xb + 0], xo1 = xOff[xb + 1], xo2 = xOff[xb + 2], xo3 = xOff[xb + 3];
|
|
123
|
+
const wx0 = xW[xb + 0], wx1 = xW[xb + 1], wx2 = xW[xb + 2], wx3 = xW[xb + 3];
|
|
124
|
+
const di = dstBase + (x << 2);
|
|
125
|
+
for (let c = 0; c < 4; c++) {
|
|
126
|
+
const r0 = src[rb0 + xo0 + c] * wx0 + src[rb0 + xo1 + c] * wx1 + src[rb0 + xo2 + c] * wx2 + src[rb0 + xo3 + c] * wx3;
|
|
127
|
+
const r1 = src[rb1 + xo0 + c] * wx0 + src[rb1 + xo1 + c] * wx1 + src[rb1 + xo2 + c] * wx2 + src[rb1 + xo3 + c] * wx3;
|
|
128
|
+
const r2 = src[rb2 + xo0 + c] * wx0 + src[rb2 + xo1 + c] * wx1 + src[rb2 + xo2 + c] * wx2 + src[rb2 + xo3 + c] * wx3;
|
|
129
|
+
const r3 = src[rb3 + xo0 + c] * wx0 + src[rb3 + xo1 + c] * wx1 + src[rb3 + xo2 + c] * wx2 + src[rb3 + xo3 + c] * wx3;
|
|
130
|
+
const v = r0 * wy0 + r1 * wy1 + r2 * wy2 + r3 * wy3;
|
|
131
|
+
dst[di + c] = v < 0 ? 0 : v > 255 ? 255 : v | 0;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { data: Buffer.from(dst.buffer), width: w2, height: h2 };
|
|
136
|
+
}
|
|
137
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
138
|
+
0 && (module.exports = {
|
|
139
|
+
padImageToSize,
|
|
140
|
+
scaleImageToSize
|
|
141
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
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 colorUtils_exports = {};
|
|
20
|
+
__export(colorUtils_exports, {
|
|
21
|
+
blendWithWhite: () => blendWithWhite,
|
|
22
|
+
colorDeltaE94: () => colorDeltaE94,
|
|
23
|
+
rgb2gray: () => rgb2gray,
|
|
24
|
+
srgb2xyz: () => srgb2xyz,
|
|
25
|
+
xyz2lab: () => xyz2lab
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(colorUtils_exports);
|
|
28
|
+
function blendWithWhite(c, a) {
|
|
29
|
+
return 255 + (c - 255) * a;
|
|
30
|
+
}
|
|
31
|
+
function rgb2gray(r, g, b) {
|
|
32
|
+
return 77 * r + 150 * g + 29 * b + 128 >> 8;
|
|
33
|
+
}
|
|
34
|
+
function colorDeltaE94(rgb1, rgb2) {
|
|
35
|
+
const [l1, a1, b1] = xyz2lab(srgb2xyz(rgb1));
|
|
36
|
+
const [l2, a2, b2] = xyz2lab(srgb2xyz(rgb2));
|
|
37
|
+
const deltaL = l1 - l2;
|
|
38
|
+
const deltaA = a1 - a2;
|
|
39
|
+
const deltaB = b1 - b2;
|
|
40
|
+
const c1 = Math.sqrt(a1 ** 2 + b1 ** 2);
|
|
41
|
+
const c2 = Math.sqrt(a2 ** 2 + b2 ** 2);
|
|
42
|
+
const deltaC = c1 - c2;
|
|
43
|
+
let deltaH = deltaA ** 2 + deltaB ** 2 - deltaC ** 2;
|
|
44
|
+
deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);
|
|
45
|
+
const k1 = 0.045;
|
|
46
|
+
const k2 = 0.015;
|
|
47
|
+
const kL = 1;
|
|
48
|
+
const kC = 1;
|
|
49
|
+
const kH = 1;
|
|
50
|
+
const sC = 1 + k1 * c1;
|
|
51
|
+
const sH = 1 + k2 * c1;
|
|
52
|
+
const sL = 1;
|
|
53
|
+
return Math.sqrt((deltaL / sL / kL) ** 2 + (deltaC / sC / kC) ** 2 + (deltaH / sH / kH) ** 2);
|
|
54
|
+
}
|
|
55
|
+
function srgb2xyz(rgb) {
|
|
56
|
+
let r = rgb[0] / 255;
|
|
57
|
+
let g = rgb[1] / 255;
|
|
58
|
+
let b = rgb[2] / 255;
|
|
59
|
+
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
|
60
|
+
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
|
61
|
+
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
|
62
|
+
return [
|
|
63
|
+
r * 0.4124 + g * 0.3576 + b * 0.1805,
|
|
64
|
+
r * 0.2126 + g * 0.7152 + b * 0.0722,
|
|
65
|
+
r * 0.0193 + g * 0.1192 + b * 0.9505
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
const sigma_pow2 = 6 * 6 / 29 / 29;
|
|
69
|
+
const sigma_pow3 = 6 * 6 * 6 / 29 / 29 / 29;
|
|
70
|
+
function xyz2lab(xyz) {
|
|
71
|
+
const x = xyz[0] / 0.950489;
|
|
72
|
+
const y = xyz[1];
|
|
73
|
+
const z = xyz[2] / 1.08884;
|
|
74
|
+
const fx = x > sigma_pow3 ? x ** (1 / 3) : x / 3 / sigma_pow2 + 4 / 29;
|
|
75
|
+
const fy = y > sigma_pow3 ? y ** (1 / 3) : y / 3 / sigma_pow2 + 4 / 29;
|
|
76
|
+
const fz = z > sigma_pow3 ? z ** (1 / 3) : z / 3 / sigma_pow2 + 4 / 29;
|
|
77
|
+
const l = 116 * fy - 16;
|
|
78
|
+
const a = 500 * (fx - fy);
|
|
79
|
+
const b = 200 * (fy - fz);
|
|
80
|
+
return [l, a, b];
|
|
81
|
+
}
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
blendWithWhite,
|
|
85
|
+
colorDeltaE94,
|
|
86
|
+
rgb2gray,
|
|
87
|
+
srgb2xyz,
|
|
88
|
+
xyz2lab
|
|
89
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
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 compare_exports = {};
|
|
20
|
+
__export(compare_exports, {
|
|
21
|
+
compare: () => compare
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(compare_exports);
|
|
24
|
+
var import_colorUtils = require("./colorUtils");
|
|
25
|
+
var import_imageChannel = require("./imageChannel");
|
|
26
|
+
var import_stats = require("./stats");
|
|
27
|
+
const SSIM_WINDOW_RADIUS = 15;
|
|
28
|
+
const VARIANCE_WINDOW_RADIUS = 1;
|
|
29
|
+
function drawPixel(width, data, x, y, r, g, b) {
|
|
30
|
+
const idx = (y * width + x) * 4;
|
|
31
|
+
data[idx + 0] = r;
|
|
32
|
+
data[idx + 1] = g;
|
|
33
|
+
data[idx + 2] = b;
|
|
34
|
+
data[idx + 3] = 255;
|
|
35
|
+
}
|
|
36
|
+
function compare(actual, expected, diff, width, height, options = {}) {
|
|
37
|
+
const {
|
|
38
|
+
maxColorDeltaE94 = 1
|
|
39
|
+
} = options;
|
|
40
|
+
const paddingSize = Math.max(VARIANCE_WINDOW_RADIUS, SSIM_WINDOW_RADIUS);
|
|
41
|
+
const paddingColorEven = [255, 0, 255];
|
|
42
|
+
const paddingColorOdd = [0, 255, 0];
|
|
43
|
+
const [r1, g1, b1] = import_imageChannel.ImageChannel.intoRGB(width, height, expected, {
|
|
44
|
+
paddingSize,
|
|
45
|
+
paddingColorEven,
|
|
46
|
+
paddingColorOdd
|
|
47
|
+
});
|
|
48
|
+
const [r2, g2, b2] = import_imageChannel.ImageChannel.intoRGB(width, height, actual, {
|
|
49
|
+
paddingSize,
|
|
50
|
+
paddingColorEven,
|
|
51
|
+
paddingColorOdd
|
|
52
|
+
});
|
|
53
|
+
const noop = (x, y) => {
|
|
54
|
+
};
|
|
55
|
+
const drawRedPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 0, 0) : noop;
|
|
56
|
+
const drawYellowPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 255, 0) : noop;
|
|
57
|
+
const drawGrayPixel = diff ? (x, y) => {
|
|
58
|
+
const gray = (0, import_colorUtils.rgb2gray)(r1.get(x, y), g1.get(x, y), b1.get(x, y));
|
|
59
|
+
const value = (0, import_colorUtils.blendWithWhite)(gray, 0.1);
|
|
60
|
+
drawPixel(width, diff, x - paddingSize, y - paddingSize, value, value, value);
|
|
61
|
+
} : noop;
|
|
62
|
+
let fastR, fastG, fastB;
|
|
63
|
+
let diffCount = 0;
|
|
64
|
+
for (let y = paddingSize; y < r1.height - paddingSize; ++y) {
|
|
65
|
+
for (let x = paddingSize; x < r1.width - paddingSize; ++x) {
|
|
66
|
+
if (r1.get(x, y) === r2.get(x, y) && g1.get(x, y) === g2.get(x, y) && b1.get(x, y) === b2.get(x, y)) {
|
|
67
|
+
drawGrayPixel(x, y);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const delta = (0, import_colorUtils.colorDeltaE94)(
|
|
71
|
+
[r1.get(x, y), g1.get(x, y), b1.get(x, y)],
|
|
72
|
+
[r2.get(x, y), g2.get(x, y), b2.get(x, y)]
|
|
73
|
+
);
|
|
74
|
+
if (delta <= maxColorDeltaE94) {
|
|
75
|
+
drawGrayPixel(x, y);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (!fastR || !fastG || !fastB) {
|
|
79
|
+
fastR = new import_stats.FastStats(r1, r2);
|
|
80
|
+
fastG = new import_stats.FastStats(g1, g2);
|
|
81
|
+
fastB = new import_stats.FastStats(b1, b2);
|
|
82
|
+
}
|
|
83
|
+
const [varX1, varY1] = r1.boundXY(x - VARIANCE_WINDOW_RADIUS, y - VARIANCE_WINDOW_RADIUS);
|
|
84
|
+
const [varX2, varY2] = r1.boundXY(x + VARIANCE_WINDOW_RADIUS, y + VARIANCE_WINDOW_RADIUS);
|
|
85
|
+
const var1 = fastR.varianceC1(varX1, varY1, varX2, varY2) + fastG.varianceC1(varX1, varY1, varX2, varY2) + fastB.varianceC1(varX1, varY1, varX2, varY2);
|
|
86
|
+
const var2 = fastR.varianceC2(varX1, varY1, varX2, varY2) + fastG.varianceC2(varX1, varY1, varX2, varY2) + fastB.varianceC2(varX1, varY1, varX2, varY2);
|
|
87
|
+
if (var1 === 0 || var2 === 0) {
|
|
88
|
+
drawRedPixel(x, y);
|
|
89
|
+
++diffCount;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const [ssimX1, ssimY1] = r1.boundXY(x - SSIM_WINDOW_RADIUS, y - SSIM_WINDOW_RADIUS);
|
|
93
|
+
const [ssimX2, ssimY2] = r1.boundXY(x + SSIM_WINDOW_RADIUS, y + SSIM_WINDOW_RADIUS);
|
|
94
|
+
const ssimRGB = ((0, import_stats.ssim)(fastR, ssimX1, ssimY1, ssimX2, ssimY2) + (0, import_stats.ssim)(fastG, ssimX1, ssimY1, ssimX2, ssimY2) + (0, import_stats.ssim)(fastB, ssimX1, ssimY1, ssimX2, ssimY2)) / 3;
|
|
95
|
+
const isAntialiased = ssimRGB >= 0.99;
|
|
96
|
+
if (isAntialiased) {
|
|
97
|
+
drawYellowPixel(x, y);
|
|
98
|
+
} else {
|
|
99
|
+
drawRedPixel(x, y);
|
|
100
|
+
++diffCount;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return diffCount;
|
|
105
|
+
}
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
compare
|
|
109
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
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 imageChannel_exports = {};
|
|
20
|
+
__export(imageChannel_exports, {
|
|
21
|
+
ImageChannel: () => ImageChannel
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(imageChannel_exports);
|
|
24
|
+
var import_colorUtils = require("./colorUtils");
|
|
25
|
+
class ImageChannel {
|
|
26
|
+
static intoRGB(width, height, data, options = {}) {
|
|
27
|
+
const {
|
|
28
|
+
paddingSize = 0,
|
|
29
|
+
paddingColorOdd = [255, 0, 255],
|
|
30
|
+
paddingColorEven = [0, 255, 0]
|
|
31
|
+
} = options;
|
|
32
|
+
const newWidth = width + 2 * paddingSize;
|
|
33
|
+
const newHeight = height + 2 * paddingSize;
|
|
34
|
+
const r = new Uint8Array(newWidth * newHeight);
|
|
35
|
+
const g = new Uint8Array(newWidth * newHeight);
|
|
36
|
+
const b = new Uint8Array(newWidth * newHeight);
|
|
37
|
+
for (let y = 0; y < newHeight; ++y) {
|
|
38
|
+
for (let x = 0; x < newWidth; ++x) {
|
|
39
|
+
const index = y * newWidth + x;
|
|
40
|
+
if (y >= paddingSize && y < newHeight - paddingSize && x >= paddingSize && x < newWidth - paddingSize) {
|
|
41
|
+
const offset = ((y - paddingSize) * width + (x - paddingSize)) * 4;
|
|
42
|
+
const alpha = data[offset + 3] === 255 ? 1 : data[offset + 3] / 255;
|
|
43
|
+
r[index] = (0, import_colorUtils.blendWithWhite)(data[offset], alpha);
|
|
44
|
+
g[index] = (0, import_colorUtils.blendWithWhite)(data[offset + 1], alpha);
|
|
45
|
+
b[index] = (0, import_colorUtils.blendWithWhite)(data[offset + 2], alpha);
|
|
46
|
+
} else {
|
|
47
|
+
const color = (y + x) % 2 === 0 ? paddingColorEven : paddingColorOdd;
|
|
48
|
+
r[index] = color[0];
|
|
49
|
+
g[index] = color[1];
|
|
50
|
+
b[index] = color[2];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [
|
|
55
|
+
new ImageChannel(newWidth, newHeight, r),
|
|
56
|
+
new ImageChannel(newWidth, newHeight, g),
|
|
57
|
+
new ImageChannel(newWidth, newHeight, b)
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
constructor(width, height, data) {
|
|
61
|
+
this.data = data;
|
|
62
|
+
this.width = width;
|
|
63
|
+
this.height = height;
|
|
64
|
+
}
|
|
65
|
+
get(x, y) {
|
|
66
|
+
return this.data[y * this.width + x];
|
|
67
|
+
}
|
|
68
|
+
boundXY(x, y) {
|
|
69
|
+
return [
|
|
70
|
+
Math.min(Math.max(x, 0), this.width - 1),
|
|
71
|
+
Math.min(Math.max(y, 0), this.height - 1)
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
ImageChannel
|
|
78
|
+
});
|