browser-debugger-cli 0.0.1-alpha.0 → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +167 -52
- package/dist/__testfixtures__/cdpMessages.d.ts +43 -0
- package/dist/__testfixtures__/cdpMessages.d.ts.map +1 -0
- package/dist/__testfixtures__/cdpMessages.js +118 -0
- package/dist/__testfixtures__/cdpMessages.js.map +1 -0
- package/dist/__testfixtures__/connectionTargets.d.ts +21 -0
- package/dist/__testfixtures__/connectionTargets.d.ts.map +1 -0
- package/dist/__testfixtures__/connectionTargets.js +59 -0
- package/dist/__testfixtures__/connectionTargets.js.map +1 -0
- package/dist/__tests__/integration/session-files.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/session-files.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/session-files.integration.test.js +66 -0
- package/dist/__tests__/integration/session-files.integration.test.js.map +1 -0
- package/dist/__testutils__/FakeClock.d.ts +67 -0
- package/dist/__testutils__/FakeClock.d.ts.map +1 -0
- package/dist/__testutils__/FakeClock.js +132 -0
- package/dist/__testutils__/FakeClock.js.map +1 -0
- package/dist/__testutils__/FakeWebSocket.d.ts +106 -0
- package/dist/__testutils__/FakeWebSocket.d.ts.map +1 -0
- package/dist/__testutils__/FakeWebSocket.js +213 -0
- package/dist/__testutils__/FakeWebSocket.js.map +1 -0
- package/dist/__testutils__/assertions.d.ts +33 -0
- package/dist/__testutils__/assertions.d.ts.map +1 -0
- package/dist/__testutils__/assertions.js +57 -0
- package/dist/__testutils__/assertions.js.map +1 -0
- package/dist/__testutils__/index.d.ts +15 -0
- package/dist/__testutils__/index.d.ts.map +1 -0
- package/dist/__testutils__/index.js +15 -0
- package/dist/__testutils__/index.js.map +1 -0
- package/dist/__testutils__/testClock.d.ts +28 -0
- package/dist/__testutils__/testClock.d.ts.map +1 -0
- package/dist/__testutils__/testClock.js +81 -0
- package/dist/__testutils__/testClock.js.map +1 -0
- package/dist/__testutils__/testFixtures.d.ts +15 -0
- package/dist/__testutils__/testFixtures.d.ts.map +1 -0
- package/dist/__testutils__/testFixtures.js +23 -0
- package/dist/__testutils__/testFixtures.js.map +1 -0
- package/dist/__testutils__/testProcess.d.ts +46 -0
- package/dist/__testutils__/testProcess.d.ts.map +1 -0
- package/dist/__testutils__/testProcess.js +77 -0
- package/dist/__testutils__/testProcess.js.map +1 -0
- package/dist/cli/collectors/dom.d.ts +8 -0
- package/dist/cli/collectors/dom.d.ts.map +1 -0
- package/dist/cli/collectors/dom.js +361 -0
- package/dist/cli/collectors/dom.js.map +1 -0
- package/dist/cli/collectors/helpers/domCache.d.ts +40 -0
- package/dist/cli/collectors/helpers/domCache.d.ts.map +1 -0
- package/dist/cli/collectors/helpers/domCache.js +79 -0
- package/dist/cli/collectors/helpers/domCache.js.map +1 -0
- package/dist/cli/collectors/helpers/domQuery.d.ts +45 -0
- package/dist/cli/collectors/helpers/domQuery.d.ts.map +1 -0
- package/dist/cli/collectors/helpers/domQuery.js +100 -0
- package/dist/cli/collectors/helpers/domQuery.js.map +1 -0
- package/dist/cli/collectors/helpers/selectorParser.d.ts +20 -0
- package/dist/cli/collectors/helpers/selectorParser.d.ts.map +1 -0
- package/dist/cli/collectors/helpers/selectorParser.js +20 -0
- package/dist/cli/collectors/helpers/selectorParser.js.map +1 -0
- package/dist/cli/commands/__tests__/cdp.contract.test.d.ts +24 -0
- package/dist/cli/commands/__tests__/cdp.contract.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cdp.contract.test.js +467 -0
- package/dist/cli/commands/__tests__/cdp.contract.test.js.map +1 -0
- package/dist/cli/commands/__tests__/ipcTest.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/ipcTest.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/ipcTest.test.js +37 -0
- package/dist/cli/commands/__tests__/ipcTest.test.js.map +1 -0
- package/dist/cli/commands/cdp.d.ts +8 -0
- package/dist/cli/commands/cdp.d.ts.map +1 -0
- package/dist/cli/commands/cdp.js +45 -0
- package/dist/cli/commands/cdp.js.map +1 -0
- package/dist/cli/commands/cleanup.d.ts +8 -0
- package/dist/cli/commands/cleanup.d.ts.map +1 -0
- package/dist/cli/commands/cleanup.js +130 -0
- package/dist/cli/commands/cleanup.js.map +1 -0
- package/dist/cli/commands/console.d.ts +8 -0
- package/dist/cli/commands/console.d.ts.map +1 -0
- package/dist/cli/commands/console.js +97 -0
- package/dist/cli/commands/console.js.map +1 -0
- package/dist/cli/commands/details.d.ts +8 -0
- package/dist/cli/commands/details.d.ts.map +1 -0
- package/dist/cli/commands/details.js +68 -0
- package/dist/cli/commands/details.js.map +1 -0
- package/dist/cli/commands/dom/helpers/domCache.d.ts +36 -0
- package/dist/cli/commands/dom/helpers/domCache.d.ts.map +1 -0
- package/dist/cli/commands/dom/helpers/domCache.js +65 -0
- package/dist/cli/commands/dom/helpers/domCache.js.map +1 -0
- package/dist/cli/commands/dom/helpers/domQuery.d.ts +48 -0
- package/dist/cli/commands/dom/helpers/domQuery.d.ts.map +1 -0
- package/dist/cli/commands/dom/helpers/domQuery.js +104 -0
- package/dist/cli/commands/dom/helpers/domQuery.js.map +1 -0
- package/dist/cli/commands/dom/helpers/errorHandler.d.ts +45 -0
- package/dist/cli/commands/dom/helpers/errorHandler.d.ts.map +1 -0
- package/dist/cli/commands/dom/helpers/errorHandler.js +70 -0
- package/dist/cli/commands/dom/helpers/errorHandler.js.map +1 -0
- package/dist/cli/commands/dom/helpers/evalHelpers.d.ts +52 -0
- package/dist/cli/commands/dom/helpers/evalHelpers.d.ts.map +1 -0
- package/dist/cli/commands/dom/helpers/evalHelpers.js +75 -0
- package/dist/cli/commands/dom/helpers/evalHelpers.js.map +1 -0
- package/dist/cli/commands/dom/helpers/optionsBuilder.d.ts +35 -0
- package/dist/cli/commands/dom/helpers/optionsBuilder.d.ts.map +1 -0
- package/dist/cli/commands/dom/helpers/optionsBuilder.js +51 -0
- package/dist/cli/commands/dom/helpers/optionsBuilder.js.map +1 -0
- package/dist/cli/commands/dom/helpers/selectorParser.d.ts +20 -0
- package/dist/cli/commands/dom/helpers/selectorParser.d.ts.map +1 -0
- package/dist/cli/commands/dom/helpers/selectorParser.js +20 -0
- package/dist/cli/commands/dom/helpers/selectorParser.js.map +1 -0
- package/dist/cli/commands/dom/index.d.ts +8 -0
- package/dist/cli/commands/dom/index.d.ts.map +1 -0
- package/dist/cli/commands/dom/index.js +257 -0
- package/dist/cli/commands/dom/index.js.map +1 -0
- package/dist/cli/commands/ipcTest.d.ts +23 -0
- package/dist/cli/commands/ipcTest.d.ts.map +1 -0
- package/dist/cli/commands/ipcTest.js +181 -0
- package/dist/cli/commands/ipcTest.js.map +1 -0
- package/dist/cli/commands/network.d.ts +8 -0
- package/dist/cli/commands/network.d.ts.map +1 -0
- package/dist/cli/commands/network.js +40 -0
- package/dist/cli/commands/network.js.map +1 -0
- package/dist/cli/commands/peek.d.ts +8 -0
- package/dist/cli/commands/peek.d.ts.map +1 -0
- package/dist/cli/commands/peek.js +109 -0
- package/dist/cli/commands/peek.js.map +1 -0
- package/dist/cli/commands/query.d.ts +9 -0
- package/dist/cli/commands/query.d.ts.map +1 -0
- package/dist/cli/commands/query.js +127 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/start.d.ts +9 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +78 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +9 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +84 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +8 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +146 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/formatters/detailsFormatter.d.ts +10 -0
- package/dist/cli/formatters/detailsFormatter.d.ts.map +1 -0
- package/dist/cli/formatters/detailsFormatter.js +63 -0
- package/dist/cli/formatters/detailsFormatter.js.map +1 -0
- package/dist/cli/formatters/previewFormatter.d.ts +27 -0
- package/dist/cli/formatters/previewFormatter.d.ts.map +1 -0
- package/dist/cli/formatters/previewFormatter.js +160 -0
- package/dist/cli/formatters/previewFormatter.js.map +1 -0
- package/dist/cli/formatters/statusFormatter.d.ts +34 -0
- package/dist/cli/formatters/statusFormatter.d.ts.map +1 -0
- package/dist/cli/formatters/statusFormatter.js +108 -0
- package/dist/cli/formatters/statusFormatter.js.map +1 -0
- package/dist/cli/handlers/ChromeBootstrap.d.ts +24 -0
- package/dist/cli/handlers/ChromeBootstrap.d.ts.map +1 -0
- package/dist/cli/handlers/ChromeBootstrap.js +50 -0
- package/dist/cli/handlers/ChromeBootstrap.js.map +1 -0
- package/dist/cli/handlers/CommandRunner.d.ts +60 -0
- package/dist/cli/handlers/CommandRunner.d.ts.map +1 -0
- package/dist/cli/handlers/CommandRunner.js +81 -0
- package/dist/cli/handlers/CommandRunner.js.map +1 -0
- package/dist/cli/handlers/OutputBuilder.d.ts +60 -0
- package/dist/cli/handlers/OutputBuilder.d.ts.map +1 -0
- package/dist/cli/handlers/OutputBuilder.js +138 -0
- package/dist/cli/handlers/OutputBuilder.js.map +1 -0
- package/dist/cli/handlers/OutputWriter.d.ts +15 -0
- package/dist/cli/handlers/OutputWriter.d.ts.map +1 -0
- package/dist/cli/handlers/OutputWriter.js +34 -0
- package/dist/cli/handlers/OutputWriter.js.map +1 -0
- package/dist/cli/handlers/PreviewWriter.d.ts +52 -0
- package/dist/cli/handlers/PreviewWriter.d.ts.map +1 -0
- package/dist/cli/handlers/PreviewWriter.js +119 -0
- package/dist/cli/handlers/PreviewWriter.js.map +1 -0
- package/dist/cli/handlers/SessionLock.d.ts +16 -0
- package/dist/cli/handlers/SessionLock.d.ts.map +1 -0
- package/dist/cli/handlers/SessionLock.js +38 -0
- package/dist/cli/handlers/SessionLock.js.map +1 -0
- package/dist/cli/handlers/SessionLoop.d.ts +19 -0
- package/dist/cli/handlers/SessionLoop.d.ts.map +1 -0
- package/dist/cli/handlers/SessionLoop.js +47 -0
- package/dist/cli/handlers/SessionLoop.js.map +1 -0
- package/dist/cli/handlers/ShutdownController.d.ts +38 -0
- package/dist/cli/handlers/ShutdownController.d.ts.map +1 -0
- package/dist/cli/handlers/ShutdownController.js +83 -0
- package/dist/cli/handlers/ShutdownController.js.map +1 -0
- package/dist/cli/handlers/SignalHandler.d.ts +35 -0
- package/dist/cli/handlers/SignalHandler.d.ts.map +1 -0
- package/dist/cli/handlers/SignalHandler.js +81 -0
- package/dist/cli/handlers/SignalHandler.js.map +1 -0
- package/dist/cli/handlers/TargetSetup.d.ts +42 -0
- package/dist/cli/handlers/TargetSetup.d.ts.map +1 -0
- package/dist/cli/handlers/TargetSetup.js +87 -0
- package/dist/cli/handlers/TargetSetup.js.map +1 -0
- package/dist/cli/handlers/commonOptions.d.ts +54 -0
- package/dist/cli/handlers/commonOptions.d.ts.map +1 -0
- package/dist/cli/handlers/commonOptions.js +64 -0
- package/dist/cli/handlers/commonOptions.js.map +1 -0
- package/dist/cli/handlers/daemonSessionController.d.ts +23 -0
- package/dist/cli/handlers/daemonSessionController.d.ts.map +1 -0
- package/dist/cli/handlers/daemonSessionController.js +108 -0
- package/dist/cli/handlers/daemonSessionController.js.map +1 -0
- package/dist/cli/handlers/sessionController.d.ts +21 -0
- package/dist/cli/handlers/sessionController.d.ts.map +1 -0
- package/dist/cli/handlers/sessionController.js +55 -0
- package/dist/cli/handlers/sessionController.js.map +1 -0
- package/dist/cli/registry.d.ts +11 -0
- package/dist/cli/registry.d.ts.map +1 -0
- package/dist/cli/registry.js +46 -0
- package/dist/cli/registry.js.map +1 -0
- package/dist/collectors/__tests__/network.contract.test.d.ts +28 -0
- package/dist/collectors/__tests__/network.contract.test.d.ts.map +1 -0
- package/dist/collectors/__tests__/network.contract.test.js +525 -0
- package/dist/collectors/__tests__/network.contract.test.js.map +1 -0
- package/dist/collectors/console.d.ts +5 -3
- package/dist/collectors/console.d.ts.map +1 -1
- package/dist/collectors/console.js +48 -26
- package/dist/collectors/console.js.map +1 -1
- package/dist/collectors/dom.d.ts +2 -2
- package/dist/collectors/dom.d.ts.map +1 -1
- package/dist/collectors/dom.js +23 -12
- package/dist/collectors/dom.js.map +1 -1
- package/dist/collectors/network.d.ts +18 -4
- package/dist/collectors/network.d.ts.map +1 -1
- package/dist/collectors/network.js +111 -34
- package/dist/collectors/network.js.map +1 -1
- package/dist/connection/__tests__/cdp.contract.test.d.ts +16 -0
- package/dist/connection/__tests__/cdp.contract.test.d.ts.map +1 -0
- package/dist/connection/__tests__/cdp.contract.test.js +378 -0
- package/dist/connection/__tests__/cdp.contract.test.js.map +1 -0
- package/dist/connection/__tests__/finder.contract.test.d.ts +2 -0
- package/dist/connection/__tests__/finder.contract.test.d.ts.map +1 -0
- package/dist/connection/__tests__/finder.contract.test.js +239 -0
- package/dist/connection/__tests__/finder.contract.test.js.map +1 -0
- package/dist/connection/__tests__/tabs.contract.test.d.ts +2 -0
- package/dist/connection/__tests__/tabs.contract.test.d.ts.map +1 -0
- package/dist/connection/__tests__/tabs.contract.test.js +137 -0
- package/dist/connection/__tests__/tabs.contract.test.js.map +1 -0
- package/dist/connection/cdp.d.ts +165 -16
- package/dist/connection/cdp.d.ts.map +1 -1
- package/dist/connection/cdp.js +342 -122
- package/dist/connection/cdp.js.map +1 -1
- package/dist/connection/finder.d.ts +5 -4
- package/dist/connection/finder.d.ts.map +1 -1
- package/dist/connection/finder.js +10 -16
- package/dist/connection/finder.js.map +1 -1
- package/dist/connection/launcher.d.ts +18 -11
- package/dist/connection/launcher.d.ts.map +1 -1
- package/dist/connection/launcher.js +148 -82
- package/dist/connection/launcher.js.map +1 -1
- package/dist/connection/tabs.d.ts +47 -14
- package/dist/connection/tabs.d.ts.map +1 -1
- package/dist/connection/tabs.js +493 -132
- package/dist/connection/tabs.js.map +1 -1
- package/dist/constants.d.ts +209 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +232 -0
- package/dist/constants.js.map +1 -0
- package/dist/daemon/__tests__/ipcServer.contract.test.d.ts +23 -0
- package/dist/daemon/__tests__/ipcServer.contract.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/ipcServer.contract.test.js +401 -0
- package/dist/daemon/__tests__/ipcServer.contract.test.js.map +1 -0
- package/dist/daemon/__tests__/launcher.unit.test.d.ts +8 -0
- package/dist/daemon/__tests__/launcher.unit.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/launcher.unit.test.js +20 -0
- package/dist/daemon/__tests__/launcher.unit.test.js.map +1 -0
- package/dist/daemon/ipcServer.d.ts +83 -0
- package/dist/daemon/ipcServer.d.ts.map +1 -0
- package/dist/daemon/ipcServer.js +670 -0
- package/dist/daemon/ipcServer.js.map +1 -0
- package/dist/daemon/launcher.d.ts +31 -0
- package/dist/daemon/launcher.d.ts.map +1 -0
- package/dist/daemon/launcher.js +137 -0
- package/dist/daemon/launcher.js.map +1 -0
- package/dist/daemon/startSession.d.ts +51 -0
- package/dist/daemon/startSession.d.ts.map +1 -0
- package/dist/daemon/startSession.js +149 -0
- package/dist/daemon/startSession.js.map +1 -0
- package/dist/daemon/worker.d.ts +18 -0
- package/dist/daemon/worker.d.ts.map +1 -0
- package/dist/daemon/worker.js +623 -0
- package/dist/daemon/worker.js.map +1 -0
- package/dist/daemon/workerIpc.d.ts +33 -0
- package/dist/daemon/workerIpc.d.ts.map +1 -0
- package/dist/daemon/workerIpc.js +8 -0
- package/dist/daemon/workerIpc.js.map +1 -0
- package/dist/daemon.d.ts +10 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +32 -0
- package/dist/daemon.js.map +1 -0
- package/dist/index.js +41 -420
- package/dist/index.js.map +1 -1
- package/dist/ipc/__tests__/client.contract.test.d.ts +23 -0
- package/dist/ipc/__tests__/client.contract.test.d.ts.map +1 -0
- package/dist/ipc/__tests__/client.contract.test.js +466 -0
- package/dist/ipc/__tests__/client.contract.test.js.map +1 -0
- package/dist/ipc/client.d.ts +109 -0
- package/dist/ipc/client.d.ts.map +1 -0
- package/dist/ipc/client.js +220 -0
- package/dist/ipc/client.js.map +1 -0
- package/dist/ipc/commands.d.ts +208 -0
- package/dist/ipc/commands.d.ts.map +1 -0
- package/dist/ipc/commands.js +69 -0
- package/dist/ipc/commands.js.map +1 -0
- package/dist/ipc/responseValidator.d.ts +40 -0
- package/dist/ipc/responseValidator.d.ts.map +1 -0
- package/dist/ipc/responseValidator.js +28 -0
- package/dist/ipc/responseValidator.js.map +1 -0
- package/dist/ipc/types.d.ts +193 -0
- package/dist/ipc/types.d.ts.map +1 -0
- package/dist/ipc/types.js +21 -0
- package/dist/ipc/types.js.map +1 -0
- package/dist/session/BdgSession.d.ts +71 -4
- package/dist/session/BdgSession.d.ts.map +1 -1
- package/dist/session/BdgSession.js +173 -75
- package/dist/session/BdgSession.js.map +1 -1
- package/dist/session/chrome.d.ts +46 -0
- package/dist/session/chrome.d.ts.map +1 -0
- package/dist/session/chrome.js +92 -0
- package/dist/session/chrome.js.map +1 -0
- package/dist/session/cleanup.d.ts +45 -0
- package/dist/session/cleanup.d.ts.map +1 -0
- package/dist/session/cleanup.js +230 -0
- package/dist/session/cleanup.js.map +1 -0
- package/dist/session/index.d.ts +15 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +23 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/lock.d.ts +57 -0
- package/dist/session/lock.d.ts.map +1 -0
- package/dist/session/lock.js +154 -0
- package/dist/session/lock.js.map +1 -0
- package/dist/session/metadata.d.ts +59 -0
- package/dist/session/metadata.d.ts.map +1 -0
- package/dist/session/metadata.js +71 -0
- package/dist/session/metadata.js.map +1 -0
- package/dist/session/output.d.ts +18 -0
- package/dist/session/output.d.ts.map +1 -0
- package/dist/session/output.js +24 -0
- package/dist/session/output.js.map +1 -0
- package/dist/session/paths.d.ts +73 -0
- package/dist/session/paths.d.ts.map +1 -0
- package/dist/session/paths.js +84 -0
- package/dist/session/paths.js.map +1 -0
- package/dist/session/pid.d.ts +40 -0
- package/dist/session/pid.d.ts.map +1 -0
- package/dist/session/pid.js +73 -0
- package/dist/session/pid.js.map +1 -0
- package/dist/session/process.d.ts +45 -0
- package/dist/session/process.d.ts.map +1 -0
- package/dist/session/process.js +88 -0
- package/dist/session/process.js.map +1 -0
- package/dist/types.d.ts +114 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/__tests__/filters.unit.test.d.ts +2 -0
- package/dist/utils/__tests__/filters.unit.test.d.ts.map +1 -0
- package/dist/utils/__tests__/filters.unit.test.js +239 -0
- package/dist/utils/__tests__/filters.unit.test.js.map +1 -0
- package/dist/utils/__tests__/session.contract.test.d.ts +2 -0
- package/dist/utils/__tests__/session.contract.test.d.ts.map +1 -0
- package/dist/utils/__tests__/session.contract.test.js +234 -0
- package/dist/utils/__tests__/session.contract.test.js.map +1 -0
- package/dist/utils/atomicFile.d.ts +38 -0
- package/dist/utils/atomicFile.d.ts.map +1 -0
- package/dist/utils/atomicFile.js +71 -0
- package/dist/utils/atomicFile.js.map +1 -0
- package/dist/utils/cdpHandlers.d.ts +31 -0
- package/dist/utils/cdpHandlers.d.ts.map +1 -0
- package/dist/utils/cdpHandlers.js +38 -0
- package/dist/utils/cdpHandlers.js.map +1 -0
- package/dist/utils/chromeDiagnostics.d.ts +28 -0
- package/dist/utils/chromeDiagnostics.d.ts.map +1 -0
- package/dist/utils/chromeDiagnostics.js +88 -0
- package/dist/utils/chromeDiagnostics.js.map +1 -0
- package/dist/utils/errors.d.ts +82 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +88 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/exitCodes.d.ts +32 -0
- package/dist/utils/exitCodes.d.ts.map +1 -0
- package/dist/utils/exitCodes.js +36 -0
- package/dist/utils/exitCodes.js.map +1 -0
- package/dist/utils/filters.d.ts +108 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +304 -0
- package/dist/utils/filters.js.map +1 -0
- package/dist/utils/formatters/network.d.ts +23 -0
- package/dist/utils/formatters/network.d.ts.map +1 -0
- package/dist/utils/formatters/network.js +35 -0
- package/dist/utils/formatters/network.js.map +1 -0
- package/dist/utils/http.d.ts +34 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +48 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/logger.d.ts +42 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +43 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/objects.d.ts +23 -0
- package/dist/utils/objects.d.ts.map +1 -0
- package/dist/utils/objects.js +25 -0
- package/dist/utils/objects.js.map +1 -0
- package/dist/utils/url/safeParseUrl.d.ts +63 -0
- package/dist/utils/url/safeParseUrl.d.ts.map +1 -0
- package/dist/utils/url/safeParseUrl.js +84 -0
- package/dist/utils/url/safeParseUrl.js.map +1 -0
- package/dist/utils/url.d.ts +63 -1
- package/dist/utils/url.d.ts.map +1 -1
- package/dist/utils/url.js +152 -2
- package/dist/utils/url.js.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/version.d.ts +3 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +27 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +57 -10
- package/dist/utils/pageLoad.d.ts +0 -21
- package/dist/utils/pageLoad.d.ts.map +0 -1
- package/dist/utils/pageLoad.js +0 -85
- package/dist/utils/pageLoad.js.map +0 -1
- package/dist/utils/session.d.ts +0 -104
- package/dist/utils/session.d.ts.map +0 -1
- package/dist/utils/session.js +0 -244
- package/dist/utils/session.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle command errors with consistent formatting
|
|
3
|
+
*
|
|
4
|
+
* Outputs error message in JSON or human-readable format and exits with error code.
|
|
5
|
+
* This function never returns - it always calls process.exit().
|
|
6
|
+
*
|
|
7
|
+
* @param error - Error object or message
|
|
8
|
+
* @param json - Whether to output JSON format
|
|
9
|
+
* @param exitCode - Exit code to use (defaults to UNHANDLED_EXCEPTION)
|
|
10
|
+
* @throws never This function always exits the process
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* try {
|
|
15
|
+
* await someOperation();
|
|
16
|
+
* } catch (error) {
|
|
17
|
+
* handleCommandError(error, options.json);
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function handleCommandError(error: unknown, json: boolean, exitCode?: number): never;
|
|
22
|
+
/**
|
|
23
|
+
* Handle command errors with additional context
|
|
24
|
+
*
|
|
25
|
+
* Similar to handleCommandError but allows adding suggestion or note metadata
|
|
26
|
+
* to JSON error output for better user guidance.
|
|
27
|
+
*
|
|
28
|
+
* @param error - Error object or message
|
|
29
|
+
* @param json - Whether to output JSON format
|
|
30
|
+
* @param metadata - Additional context (suggestion, note, etc.)
|
|
31
|
+
* @param exitCode - Exit code to use (defaults to UNHANDLED_EXCEPTION)
|
|
32
|
+
* @throws never This function always exits the process
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* handleCommandErrorWithContext(
|
|
37
|
+
* 'Session not found',
|
|
38
|
+
* options.json,
|
|
39
|
+
* { suggestion: 'Start a session with: bdg <url>' },
|
|
40
|
+
* EXIT_CODES.RESOURCE_NOT_FOUND
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function handleCommandErrorWithContext(error: unknown, json: boolean, metadata: Record<string, string>, exitCode?: number): never;
|
|
45
|
+
//# sourceMappingURL=errorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/errorHandler.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,EACb,QAAQ,GAAE,MAAuC,GAChD,KAAK,CAQP;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,QAAQ,GAAE,MAAuC,GAChD,KAAK,CAYP"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { OutputBuilder } from '../../../handlers/OutputBuilder.js';
|
|
2
|
+
import { getErrorMessage } from '../../../../utils/errors.js';
|
|
3
|
+
import { EXIT_CODES } from '../../../../utils/exitCodes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handle command errors with consistent formatting
|
|
6
|
+
*
|
|
7
|
+
* Outputs error message in JSON or human-readable format and exits with error code.
|
|
8
|
+
* This function never returns - it always calls process.exit().
|
|
9
|
+
*
|
|
10
|
+
* @param error - Error object or message
|
|
11
|
+
* @param json - Whether to output JSON format
|
|
12
|
+
* @param exitCode - Exit code to use (defaults to UNHANDLED_EXCEPTION)
|
|
13
|
+
* @throws never This function always exits the process
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* try {
|
|
18
|
+
* await someOperation();
|
|
19
|
+
* } catch (error) {
|
|
20
|
+
* handleCommandError(error, options.json);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function handleCommandError(error, json, exitCode = EXIT_CODES.UNHANDLED_EXCEPTION) {
|
|
25
|
+
const errorMsg = getErrorMessage(error);
|
|
26
|
+
if (json) {
|
|
27
|
+
console.log(JSON.stringify(OutputBuilder.buildJsonError(errorMsg), null, 2));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.error(`Error: ${errorMsg}`);
|
|
31
|
+
}
|
|
32
|
+
process.exit(exitCode);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Handle command errors with additional context
|
|
36
|
+
*
|
|
37
|
+
* Similar to handleCommandError but allows adding suggestion or note metadata
|
|
38
|
+
* to JSON error output for better user guidance.
|
|
39
|
+
*
|
|
40
|
+
* @param error - Error object or message
|
|
41
|
+
* @param json - Whether to output JSON format
|
|
42
|
+
* @param metadata - Additional context (suggestion, note, etc.)
|
|
43
|
+
* @param exitCode - Exit code to use (defaults to UNHANDLED_EXCEPTION)
|
|
44
|
+
* @throws never This function always exits the process
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* handleCommandErrorWithContext(
|
|
49
|
+
* 'Session not found',
|
|
50
|
+
* options.json,
|
|
51
|
+
* { suggestion: 'Start a session with: bdg <url>' },
|
|
52
|
+
* EXIT_CODES.RESOURCE_NOT_FOUND
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export function handleCommandErrorWithContext(error, json, metadata, exitCode = EXIT_CODES.UNHANDLED_EXCEPTION) {
|
|
57
|
+
const errorMsg = getErrorMessage(error);
|
|
58
|
+
if (json) {
|
|
59
|
+
console.log(JSON.stringify(OutputBuilder.buildJsonError(errorMsg, metadata), null, 2));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.error(`Error: ${errorMsg}`);
|
|
63
|
+
// Output metadata as additional help text
|
|
64
|
+
for (const value of Object.values(metadata)) {
|
|
65
|
+
console.error(`${value}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
process.exit(exitCode);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=errorHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandler.js","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAc,EACd,IAAa,EACb,WAAmB,UAAU,CAAC,mBAAmB;IAEjD,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAAc,EACd,IAAa,EACb,QAAgC,EAChC,WAAmB,UAAU,CAAC,mBAAmB;IAEjD,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACzF,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC;QACpC,0CAA0C;QAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CDPConnection } from '../../../../connection/cdp.js';
|
|
2
|
+
import { type SessionMetadata } from '../../../../session/metadata.js';
|
|
3
|
+
/**
|
|
4
|
+
* CDP Runtime.evaluate result
|
|
5
|
+
*/
|
|
6
|
+
interface RuntimeEvaluateResult {
|
|
7
|
+
exceptionDetails?: {
|
|
8
|
+
exception?: {
|
|
9
|
+
description?: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
result?: {
|
|
13
|
+
value?: unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validate that an active session is running
|
|
18
|
+
*
|
|
19
|
+
* @param json - Whether to output JSON format
|
|
20
|
+
* @returns PID of running session
|
|
21
|
+
* @throws never Exits process if no active session found
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateActiveSession(json: boolean): number;
|
|
24
|
+
/**
|
|
25
|
+
* Get session metadata with validation
|
|
26
|
+
*
|
|
27
|
+
* @param json - Whether to output JSON format
|
|
28
|
+
* @returns Session metadata including targetId and webSocketDebuggerUrl
|
|
29
|
+
* @throws never Exits process if metadata is invalid or missing required fields
|
|
30
|
+
*/
|
|
31
|
+
export declare function getValidatedSessionMetadata(json: boolean): SessionMetadata;
|
|
32
|
+
/**
|
|
33
|
+
* Verify that the CDP target still exists
|
|
34
|
+
*
|
|
35
|
+
* @param metadata - Session metadata containing targetId
|
|
36
|
+
* @param port - CDP port number
|
|
37
|
+
* @param json - Whether to output JSON format
|
|
38
|
+
* @throws Error When CDP response is invalid
|
|
39
|
+
* @throws never Exits process if target not found
|
|
40
|
+
*/
|
|
41
|
+
export declare function verifyTargetExists(metadata: SessionMetadata, port: number, json: boolean): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Execute JavaScript in browser context via CDP
|
|
44
|
+
*
|
|
45
|
+
* @param cdp - CDP connection instance
|
|
46
|
+
* @param script - JavaScript expression to execute
|
|
47
|
+
* @returns Execution result
|
|
48
|
+
* @throws Error When script execution throws exception
|
|
49
|
+
*/
|
|
50
|
+
export declare function executeScript(cdp: CDPConnection, script: string): Promise<RuntimeEvaluateResult>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=evalHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evalHelpers.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/evalHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAclF;;GAEG;AACH,UAAU,qBAAqB;IAC7B,gBAAgB,CAAC,EAAE;QACjB,SAAS,CAAC,EAAE;YACV,WAAW,CAAC,EAAE,MAAM,CAAC;SACtB,CAAC;KACH,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAW3D;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,CAa1E;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,qBAAqB,CAAC,CAehC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { readSessionMetadata } from '../../../../session/metadata.js';
|
|
2
|
+
import { readPid } from '../../../../session/pid.js';
|
|
3
|
+
import { isProcessAlive } from '../../../../session/process.js';
|
|
4
|
+
import { EXIT_CODES } from '../../../../utils/exitCodes.js';
|
|
5
|
+
import { handleCommandErrorWithContext } from './errorHandler.js';
|
|
6
|
+
/**
|
|
7
|
+
* Validate that an active session is running
|
|
8
|
+
*
|
|
9
|
+
* @param json - Whether to output JSON format
|
|
10
|
+
* @returns PID of running session
|
|
11
|
+
* @throws never Exits process if no active session found
|
|
12
|
+
*/
|
|
13
|
+
export function validateActiveSession(json) {
|
|
14
|
+
const pid = readPid();
|
|
15
|
+
if (!pid || !isProcessAlive(pid)) {
|
|
16
|
+
handleCommandErrorWithContext('No active session running', json, { suggestion: 'Start a session with: bdg <url>' }, EXIT_CODES.RESOURCE_NOT_FOUND);
|
|
17
|
+
}
|
|
18
|
+
return pid;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get session metadata with validation
|
|
22
|
+
*
|
|
23
|
+
* @param json - Whether to output JSON format
|
|
24
|
+
* @returns Session metadata including targetId and webSocketDebuggerUrl
|
|
25
|
+
* @throws never Exits process if metadata is invalid or missing required fields
|
|
26
|
+
*/
|
|
27
|
+
export function getValidatedSessionMetadata(json) {
|
|
28
|
+
const metadata = readSessionMetadata();
|
|
29
|
+
if (!metadata?.targetId || !metadata.webSocketDebuggerUrl) {
|
|
30
|
+
handleCommandErrorWithContext('No target information in session metadata', json, { note: 'Session may have been started with an older version' }, EXIT_CODES.SESSION_FILE_ERROR);
|
|
31
|
+
}
|
|
32
|
+
return metadata;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Verify that the CDP target still exists
|
|
36
|
+
*
|
|
37
|
+
* @param metadata - Session metadata containing targetId
|
|
38
|
+
* @param port - CDP port number
|
|
39
|
+
* @param json - Whether to output JSON format
|
|
40
|
+
* @throws Error When CDP response is invalid
|
|
41
|
+
* @throws never Exits process if target not found
|
|
42
|
+
*/
|
|
43
|
+
export async function verifyTargetExists(metadata, port, json) {
|
|
44
|
+
const response = await fetch(`http://127.0.0.1:${port}/json/list`);
|
|
45
|
+
const targetsData = await response.json();
|
|
46
|
+
if (!Array.isArray(targetsData)) {
|
|
47
|
+
throw new Error('Invalid response from CDP');
|
|
48
|
+
}
|
|
49
|
+
const target = targetsData.find((t) => t.id === metadata.targetId);
|
|
50
|
+
if (!target) {
|
|
51
|
+
handleCommandErrorWithContext('Session target not found (tab may have been closed)', json, { suggestion: 'Start a new session with: bdg <url>' }, EXIT_CODES.RESOURCE_NOT_FOUND);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Execute JavaScript in browser context via CDP
|
|
56
|
+
*
|
|
57
|
+
* @param cdp - CDP connection instance
|
|
58
|
+
* @param script - JavaScript expression to execute
|
|
59
|
+
* @returns Execution result
|
|
60
|
+
* @throws Error When script execution throws exception
|
|
61
|
+
*/
|
|
62
|
+
export async function executeScript(cdp, script) {
|
|
63
|
+
const result = (await cdp.send('Runtime.evaluate', {
|
|
64
|
+
expression: script,
|
|
65
|
+
returnByValue: true,
|
|
66
|
+
awaitPromise: true,
|
|
67
|
+
}));
|
|
68
|
+
// Check for execution exceptions
|
|
69
|
+
if (result.exceptionDetails) {
|
|
70
|
+
const errorMsg = result.exceptionDetails.exception?.description ?? 'Unknown error executing script';
|
|
71
|
+
throw new Error(errorMsg);
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=evalHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evalHelpers.js","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/evalHelpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAwB,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAuBlE;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAa;IACjD,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,6BAA6B,CAC3B,2BAA2B,EAC3B,IAAI,EACJ,EAAE,UAAU,EAAE,iCAAiC,EAAE,EACjD,UAAU,CAAC,kBAAkB,CAC9B,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAa;IACvD,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IAEvC,IAAI,CAAC,QAAQ,EAAE,QAAQ,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC;QAC1D,6BAA6B,CAC3B,2CAA2C,EAC3C,IAAI,EACJ,EAAE,IAAI,EAAE,qDAAqD,EAAE,EAC/D,UAAU,CAAC,kBAAkB,CAC9B,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAyB,EACzB,IAAY,EACZ,IAAa;IAEb,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,oBAAoB,IAAI,YAAY,CAAC,CAAC;IACnE,MAAM,WAAW,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,MAAM,GAAI,WAA2B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEpF,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,6BAA6B,CAC3B,qDAAqD,EACrD,IAAI,EACJ,EAAE,UAAU,EAAE,qCAAqC,EAAE,EACrD,UAAU,CAAC,kBAAkB,CAC9B,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAkB,EAClB,MAAc;IAEd,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE;QACjD,UAAU,EAAE,MAAM;QAClB,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,IAAI;KACnB,CAAC,CAA0B,CAAC;IAE7B,iCAAiC;IACjC,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,MAAM,QAAQ,GACZ,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,IAAI,gCAAgC,CAAC;QACrF,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base interface for IPC options that accept selector, index, or nodeId
|
|
3
|
+
*/
|
|
4
|
+
export interface SelectorBasedOptions {
|
|
5
|
+
selector?: string;
|
|
6
|
+
index?: number;
|
|
7
|
+
nodeId?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Build IPC request options from selector/index argument
|
|
11
|
+
*
|
|
12
|
+
* Handles three input methods:
|
|
13
|
+
* 1. Direct nodeId (advanced users) - sets nodeId field
|
|
14
|
+
* 2. Index from previous query - looks up nodeId from cache, sets index field
|
|
15
|
+
* 3. CSS selector - sets selector field
|
|
16
|
+
*
|
|
17
|
+
* @param selectorOrIndex - CSS selector string or numeric index
|
|
18
|
+
* @param nodeId - Optional direct nodeId (overrides selectorOrIndex)
|
|
19
|
+
* @returns Options object with selector, index, or nodeId set
|
|
20
|
+
* @throws Error When index is used but no cached element found at that index
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Direct nodeId (advanced)
|
|
25
|
+
* buildSelectorOptions('.error', 123) // → { nodeId: 123 }
|
|
26
|
+
*
|
|
27
|
+
* // Index from cache
|
|
28
|
+
* buildSelectorOptions('2', undefined) // → { index: 2 } (if cache has index 2)
|
|
29
|
+
*
|
|
30
|
+
* // CSS selector
|
|
31
|
+
* buildSelectorOptions('.error', undefined) // → { selector: '.error' }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildSelectorOptions<T extends SelectorBasedOptions>(selectorOrIndex: string, nodeId: number | undefined): T;
|
|
35
|
+
//# sourceMappingURL=optionsBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionsBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/optionsBuilder.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,oBAAoB,EACjE,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,CAAC,CA2BH"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getNodeIdByIndex } from './domCache.js';
|
|
2
|
+
import { parseSelectorOrIndex } from './selectorParser.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build IPC request options from selector/index argument
|
|
5
|
+
*
|
|
6
|
+
* Handles three input methods:
|
|
7
|
+
* 1. Direct nodeId (advanced users) - sets nodeId field
|
|
8
|
+
* 2. Index from previous query - looks up nodeId from cache, sets index field
|
|
9
|
+
* 3. CSS selector - sets selector field
|
|
10
|
+
*
|
|
11
|
+
* @param selectorOrIndex - CSS selector string or numeric index
|
|
12
|
+
* @param nodeId - Optional direct nodeId (overrides selectorOrIndex)
|
|
13
|
+
* @returns Options object with selector, index, or nodeId set
|
|
14
|
+
* @throws Error When index is used but no cached element found at that index
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Direct nodeId (advanced)
|
|
19
|
+
* buildSelectorOptions('.error', 123) // → { nodeId: 123 }
|
|
20
|
+
*
|
|
21
|
+
* // Index from cache
|
|
22
|
+
* buildSelectorOptions('2', undefined) // → { index: 2 } (if cache has index 2)
|
|
23
|
+
*
|
|
24
|
+
* // CSS selector
|
|
25
|
+
* buildSelectorOptions('.error', undefined) // → { selector: '.error' }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function buildSelectorOptions(selectorOrIndex, nodeId) {
|
|
29
|
+
const options = {};
|
|
30
|
+
// Direct nodeId takes precedence (advanced users)
|
|
31
|
+
if (nodeId !== undefined) {
|
|
32
|
+
options.nodeId = nodeId;
|
|
33
|
+
return options;
|
|
34
|
+
}
|
|
35
|
+
// Parse as selector or index
|
|
36
|
+
const parsed = parseSelectorOrIndex(selectorOrIndex);
|
|
37
|
+
if (parsed.type === 'index') {
|
|
38
|
+
// Look up nodeId from cache
|
|
39
|
+
const cachedNodeId = getNodeIdByIndex(parsed.value);
|
|
40
|
+
if (!cachedNodeId) {
|
|
41
|
+
throw new Error(`No cached element at index ${parsed.value}. Run 'bdg dom query <selector>' first.`);
|
|
42
|
+
}
|
|
43
|
+
options.index = parsed.value;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// Use selector directly
|
|
47
|
+
options.selector = parsed.value;
|
|
48
|
+
}
|
|
49
|
+
return options;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=optionsBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optionsBuilder.js","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/optionsBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAW3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,oBAAoB,CAClC,eAAuB,EACvB,MAA0B;IAE1B,MAAM,OAAO,GAAG,EAAO,CAAC;IAExB,kDAAkD;IAClD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;QACxB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,6BAA6B;IAC7B,MAAM,MAAM,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC;IAErD,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,4BAA4B;QAC5B,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,KAAe,CAAC,CAAC;QAC9D,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,8BAA8B,MAAM,CAAC,KAAK,yCAAyC,CACpF,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,KAAe,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,wBAAwB;QACxB,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,KAAe,CAAC;IAC5C,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of parsing a selector or index argument
|
|
3
|
+
*/
|
|
4
|
+
export interface ParsedSelector {
|
|
5
|
+
type: 'selector' | 'index';
|
|
6
|
+
value: string | number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parse argument as either CSS selector or index
|
|
10
|
+
*
|
|
11
|
+
* @param arg - Argument to parse (e.g., ".error" or "1")
|
|
12
|
+
* @returns Parsed result indicating type and value
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* parseSelectorOrIndex(".error") // \{ type: 'selector', value: '.error' \}
|
|
16
|
+
* parseSelectorOrIndex("1") // \{ type: 'index', value: 1 \}
|
|
17
|
+
* parseSelectorOrIndex("42") // \{ type: 'index', value: 42 \}
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseSelectorOrIndex(arg: string): ParsedSelector;
|
|
20
|
+
//# sourceMappingURL=selectorParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectorParser.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/selectorParser.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAQhE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse argument as either CSS selector or index
|
|
3
|
+
*
|
|
4
|
+
* @param arg - Argument to parse (e.g., ".error" or "1")
|
|
5
|
+
* @returns Parsed result indicating type and value
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* parseSelectorOrIndex(".error") // \{ type: 'selector', value: '.error' \}
|
|
9
|
+
* parseSelectorOrIndex("1") // \{ type: 'index', value: 1 \}
|
|
10
|
+
* parseSelectorOrIndex("42") // \{ type: 'index', value: 42 \}
|
|
11
|
+
*/
|
|
12
|
+
export function parseSelectorOrIndex(arg) {
|
|
13
|
+
// If arg is a positive integer, treat as index
|
|
14
|
+
if (/^\d+$/.test(arg)) {
|
|
15
|
+
return { type: 'index', value: parseInt(arg, 10) };
|
|
16
|
+
}
|
|
17
|
+
// Otherwise treat as CSS selector
|
|
18
|
+
return { type: 'selector', value: arg };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=selectorParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectorParser.js","sourceRoot":"","sources":["../../../../../src/cli/commands/dom/helpers/selectorParser.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,+CAA+C;IAC/C,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC;IACrD,CAAC;IAED,kCAAkC;IAClC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/dom/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqSzC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmD1D"}
|