browser-debugger-cli 0.0.1-alpha.0 → 0.1.0-alpha.0
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 +166 -51
- 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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kumak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Browser Debugger CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/szymdzum/browser-debugger-cli/pulls)
|
|
4
|
+
[](https://github.com/szymdzum/browser-debugger-cli/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/szymdzum/browser-debugger-cli/actions/workflows/security.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/browser-debugger-cli)
|
|
7
|
+
|
|
8
|
+
DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port. Stream DOM, network, and console data straight to stdout. Pipe it, grep it, feed it to agents for full context debugging.
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
6
11
|
|
|
@@ -11,75 +16,185 @@ npm install -g browser-debugger-cli
|
|
|
11
16
|
## Quick Start
|
|
12
17
|
|
|
13
18
|
```bash
|
|
14
|
-
#
|
|
15
|
-
bdg
|
|
16
|
-
|
|
17
|
-
#
|
|
19
|
+
# Start session (opens example.com in Chrome)
|
|
20
|
+
bdg example.com
|
|
21
|
+
|
|
22
|
+
# Daemon starts in background, Chrome opens
|
|
23
|
+
# Session is active - you can now run commands
|
|
24
|
+
|
|
25
|
+
# Check session status
|
|
26
|
+
bdg status
|
|
27
|
+
# Status: Active
|
|
28
|
+
# Worker PID: 12345
|
|
29
|
+
# Chrome PID: 67890
|
|
30
|
+
# Target: http://example.com
|
|
31
|
+
|
|
32
|
+
# Preview collected data
|
|
33
|
+
bdg peek --last 5
|
|
34
|
+
# NETWORK [0] GET http://example.com/ (200)
|
|
35
|
+
# NETWORK [1] GET http://example.com/style.css (200)
|
|
36
|
+
# ...
|
|
37
|
+
|
|
38
|
+
# Execute raw CDP commands
|
|
39
|
+
bdg cdp Runtime.evaluate --params '{"expression":"document.title","returnByValue":true}'
|
|
40
|
+
# { "result": { "type": "string", "value": "Example Domain" } }
|
|
41
|
+
|
|
42
|
+
# Stop session
|
|
43
|
+
bdg stop
|
|
18
44
|
```
|
|
19
45
|
|
|
20
|
-
|
|
46
|
+
## Philosophy
|
|
47
|
+
|
|
48
|
+
There's no good CLI for Chrome DevTools Protocol. MCP servers work (most of the time) but are token-heavy and monolithic. Puppeteer is for automation, not inspection. Lighthouse is single-purpose.
|
|
49
|
+
|
|
50
|
+
`bdg` takes the Unix approach: small, composable commands that pipe with `jq` and `grep` tools models already know—without the token overhead.
|
|
51
|
+
|
|
52
|
+
**Why CLI over protocol servers?**
|
|
53
|
+
- **Token efficiency**: CDP is in the model's training data. A skill doc with usage
|
|
54
|
+
patterns? ~3k tokens. MCP server definitions? 5-10k before you invoke anything.
|
|
55
|
+
- **Composability**: Pipe commands together. Each does one thing well.
|
|
56
|
+
- **Transparent errors**: See exactly what failed. No protocol layers hiding the
|
|
57
|
+
issue.
|
|
58
|
+
- **Real-time evolution**: Update usage patterns anytime. No server redeployment
|
|
59
|
+
needed.
|
|
60
|
+
|
|
61
|
+
The vision: Terminal-native browser debugging that's as composable as `curl` and `jq`.
|
|
21
62
|
|
|
22
|
-
|
|
63
|
+
## Available Commands
|
|
23
64
|
|
|
24
|
-
|
|
65
|
+
### Raw CDP Access
|
|
66
|
+
|
|
67
|
+
Full Chrome DevTools Protocol access via `bdg cdp` command – **any CDP method works**:
|
|
25
68
|
|
|
26
69
|
```bash
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
70
|
+
# Get all cookies (raw CDP)
|
|
71
|
+
bdg cdp Network.getCookies
|
|
72
|
+
# {
|
|
73
|
+
# "cookies": [
|
|
74
|
+
# {
|
|
75
|
+
# "name": "session_id",
|
|
76
|
+
# "value": "1234567890abcdef",
|
|
77
|
+
# "domain": "example.com",
|
|
78
|
+
# "httpOnly": true,
|
|
79
|
+
# "secure": true,
|
|
80
|
+
# "sameSite": "Strict"
|
|
81
|
+
# }
|
|
82
|
+
# ]
|
|
83
|
+
# }
|
|
84
|
+
|
|
85
|
+
# Evaluate JavaScript
|
|
86
|
+
bdg cdp Runtime.evaluate --params '{"expression":"document.title","returnByValue":true}'
|
|
87
|
+
# {
|
|
88
|
+
# "result": {
|
|
89
|
+
# "type": "string",
|
|
90
|
+
# "value": "Example Domain"
|
|
91
|
+
# }
|
|
92
|
+
# }
|
|
93
|
+
|
|
94
|
+
# Get browser version
|
|
95
|
+
bdg cdp Browser.getVersion
|
|
96
|
+
# {
|
|
97
|
+
# "protocolVersion": "1.3",
|
|
98
|
+
# "product": "Chrome/142.0.7444.60",
|
|
99
|
+
# "jsVersion": "14.2.231.14"
|
|
100
|
+
# }
|
|
101
|
+
|
|
102
|
+
# Pipe to jq for filtering
|
|
103
|
+
bdg cdp Network.getCookies | jq '.cookies[] | select(.name == "session_id") | .value'
|
|
104
|
+
# "1234567890abcdef"
|
|
39
105
|
```
|
|
40
106
|
|
|
41
|
-
|
|
107
|
+
**60+ domains, 300+ methods** from the [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) are available.
|
|
42
108
|
|
|
43
|
-
|
|
109
|
+
### Session Management
|
|
44
110
|
|
|
45
111
|
```bash
|
|
46
|
-
#
|
|
47
|
-
bdg
|
|
112
|
+
# Check if session is active
|
|
113
|
+
bdg status
|
|
114
|
+
# Status: Active
|
|
115
|
+
# Worker PID: 12345
|
|
116
|
+
# Chrome PID: 67890
|
|
117
|
+
# Target: http://example.com
|
|
118
|
+
|
|
119
|
+
# Stop session
|
|
120
|
+
bdg stop
|
|
121
|
+
|
|
122
|
+
# Clean up stale sessions
|
|
123
|
+
bdg cleanup
|
|
124
|
+
bdg cleanup --force # Force cleanup even if session appears active
|
|
125
|
+
```
|
|
48
126
|
|
|
49
|
-
|
|
50
|
-
bdg dom localhost:3000
|
|
51
|
-
bdg network localhost:3000
|
|
52
|
-
bdg console localhost:3000
|
|
127
|
+
### Live Data Inspection
|
|
53
128
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
bdg
|
|
129
|
+
```bash
|
|
130
|
+
# Preview collected data without stopping
|
|
131
|
+
bdg peek
|
|
132
|
+
bdg peek --last 10 # Show last 10 items
|
|
133
|
+
bdg peek --network # Only network requests
|
|
134
|
+
bdg peek --console # Only console logs
|
|
135
|
+
bdg peek --follow # Live updates every second
|
|
136
|
+
bdg peek --json # JSON output
|
|
137
|
+
|
|
138
|
+
# Get detailed information
|
|
139
|
+
bdg details network <requestId> # Full request/response with bodies
|
|
140
|
+
bdg details console <index> # Full console message with args
|
|
57
141
|
```
|
|
58
142
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
143
|
+
### DOM Inspection
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Query DOM elements
|
|
147
|
+
bdg dom query "document.title"
|
|
148
|
+
bdg dom query ".error-message"
|
|
149
|
+
|
|
150
|
+
# Get element by selector or index
|
|
151
|
+
bdg dom get ".main-content"
|
|
152
|
+
bdg dom get 0 # Get first element from cache
|
|
153
|
+
|
|
154
|
+
# Evaluate JavaScript
|
|
155
|
+
bdg dom eval "window.location.href"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Network & Console Commands
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Inspect network state
|
|
162
|
+
bdg network
|
|
163
|
+
|
|
164
|
+
# Query console logs
|
|
165
|
+
bdg console
|
|
166
|
+
bdg console --json
|
|
72
167
|
```
|
|
73
168
|
|
|
74
|
-
##
|
|
169
|
+
## Technical Overview
|
|
170
|
+
|
|
171
|
+
`bdg` runs a daemon that maintains a WebSocket connection to Chrome's debugging port.
|
|
172
|
+
When you run commands like `bdg network` or `bdg console`, they communicate with the
|
|
173
|
+
daemon via IPC, which forwards [Chrome DevTools
|
|
174
|
+
Protocol](https://chromedevtools.github.io/devtools-protocol/) commands and streams
|
|
175
|
+
responses back.
|
|
176
|
+
|
|
177
|
+
**Architecture:**
|
|
178
|
+
- **Daemon** – Background process managing Chrome connection lifecycle
|
|
179
|
+
- **IPC** – Unix sockets for CLI ↔ daemon communication
|
|
180
|
+
- **WebSocket** – Direct connection to Chrome's `--remote-debugging-port`
|
|
181
|
+
- **CDP** – Native Chrome DevTools Protocol for all browser inspection
|
|
182
|
+
|
|
183
|
+
**Benefits:**
|
|
184
|
+
- Sessions persist across commands (Chrome stays open)
|
|
185
|
+
- Live queries without stopping collection
|
|
186
|
+
- No intermediate files data flows from Chrome to stdout
|
|
187
|
+
- Real CDP with full protocol access
|
|
75
188
|
|
|
76
|
-
|
|
189
|
+
## Contributing
|
|
77
190
|
|
|
78
|
-
|
|
191
|
+
Contributions welcome! But honestly, I'd just be happy if you give it a try.
|
|
79
192
|
|
|
80
|
-
|
|
81
|
-
-
|
|
193
|
+
Let me know how you use it
|
|
194
|
+
([discussions](https://github.com/szymdzum/browser-debugger-cli/discussions)), let me
|
|
195
|
+
know what's broken
|
|
196
|
+
([issues](https://github.com/szymdzum/browser-debugger-cli/issues/new)).
|
|
82
197
|
|
|
83
198
|
## License
|
|
84
199
|
|
|
85
|
-
MIT
|
|
200
|
+
MIT – see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cdpMessages - Sample CDP protocol messages for tests
|
|
3
|
+
*
|
|
4
|
+
* Provides realistic CDP message fixtures to keep tests concise and readable.
|
|
5
|
+
*/
|
|
6
|
+
import type { CDPMessage } from '@/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Sample CDP request message
|
|
9
|
+
*/
|
|
10
|
+
export declare const CDP_REQUEST: CDPMessage;
|
|
11
|
+
/**
|
|
12
|
+
* Sample CDP response message (success)
|
|
13
|
+
*/
|
|
14
|
+
export declare const CDP_RESPONSE_SUCCESS: CDPMessage;
|
|
15
|
+
/**
|
|
16
|
+
* Sample CDP error response
|
|
17
|
+
*/
|
|
18
|
+
export declare const CDP_RESPONSE_ERROR: CDPMessage;
|
|
19
|
+
/**
|
|
20
|
+
* Sample CDP event notification (no id)
|
|
21
|
+
*/
|
|
22
|
+
export declare const CDP_EVENT_NOTIFICATION: CDPMessage;
|
|
23
|
+
/**
|
|
24
|
+
* Sample CDP event with session ID
|
|
25
|
+
*/
|
|
26
|
+
export declare const CDP_EVENT_WITH_SESSION: CDPMessage;
|
|
27
|
+
/**
|
|
28
|
+
* Factory: Create a request message with custom ID
|
|
29
|
+
*/
|
|
30
|
+
export declare function createRequest(id: number, method: string, params?: unknown): CDPMessage;
|
|
31
|
+
/**
|
|
32
|
+
* Factory: Create a success response
|
|
33
|
+
*/
|
|
34
|
+
export declare function createResponse(id: number, result: unknown): CDPMessage;
|
|
35
|
+
/**
|
|
36
|
+
* Factory: Create an error response
|
|
37
|
+
*/
|
|
38
|
+
export declare function createErrorResponse(id: number, message: string, code?: number): CDPMessage;
|
|
39
|
+
/**
|
|
40
|
+
* Factory: Create an event notification
|
|
41
|
+
*/
|
|
42
|
+
export declare function createEvent(method: string, params: unknown, sessionId?: string): CDPMessage;
|
|
43
|
+
//# sourceMappingURL=cdpMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdpMessages.d.ts","sourceRoot":"","sources":["../../src/__testfixtures__/cdpMessages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,UAIzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAclC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAMhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,UAYpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,UAYpC,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAMtF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,UAAU,CAKtE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,SAAS,GAAG,UAAU,CAQ1F;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAS3F"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cdpMessages - Sample CDP protocol messages for tests
|
|
3
|
+
*
|
|
4
|
+
* Provides realistic CDP message fixtures to keep tests concise and readable.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Sample CDP request message
|
|
8
|
+
*/
|
|
9
|
+
export const CDP_REQUEST = {
|
|
10
|
+
id: 1,
|
|
11
|
+
method: 'Target.getTargets',
|
|
12
|
+
params: {},
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Sample CDP response message (success)
|
|
16
|
+
*/
|
|
17
|
+
export const CDP_RESPONSE_SUCCESS = {
|
|
18
|
+
id: 1,
|
|
19
|
+
result: {
|
|
20
|
+
targetInfos: [
|
|
21
|
+
{
|
|
22
|
+
targetId: 't1',
|
|
23
|
+
type: 'page',
|
|
24
|
+
title: 'Test Page',
|
|
25
|
+
url: 'http://localhost:3000',
|
|
26
|
+
attached: false,
|
|
27
|
+
canAccessOpener: false,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Sample CDP error response
|
|
34
|
+
*/
|
|
35
|
+
export const CDP_RESPONSE_ERROR = {
|
|
36
|
+
id: 1,
|
|
37
|
+
error: {
|
|
38
|
+
code: -32601,
|
|
39
|
+
message: 'Method not found',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Sample CDP event notification (no id)
|
|
44
|
+
*/
|
|
45
|
+
export const CDP_EVENT_NOTIFICATION = {
|
|
46
|
+
method: 'Target.targetCreated',
|
|
47
|
+
params: {
|
|
48
|
+
targetInfo: {
|
|
49
|
+
targetId: 't2',
|
|
50
|
+
type: 'page',
|
|
51
|
+
title: 'New Page',
|
|
52
|
+
url: 'http://localhost:4000',
|
|
53
|
+
attached: false,
|
|
54
|
+
canAccessOpener: false,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Sample CDP event with session ID
|
|
60
|
+
*/
|
|
61
|
+
export const CDP_EVENT_WITH_SESSION = {
|
|
62
|
+
method: 'Page.frameNavigated',
|
|
63
|
+
params: {
|
|
64
|
+
frame: {
|
|
65
|
+
id: 'frame-1',
|
|
66
|
+
loaderId: 'loader-1',
|
|
67
|
+
url: 'http://localhost:3000/page',
|
|
68
|
+
securityOrigin: 'http://localhost:3000',
|
|
69
|
+
mimeType: 'text/html',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
sessionId: 'session-abc123',
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Factory: Create a request message with custom ID
|
|
76
|
+
*/
|
|
77
|
+
export function createRequest(id, method, params) {
|
|
78
|
+
return {
|
|
79
|
+
id,
|
|
80
|
+
method,
|
|
81
|
+
params: params ?? {},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Factory: Create a success response
|
|
86
|
+
*/
|
|
87
|
+
export function createResponse(id, result) {
|
|
88
|
+
return {
|
|
89
|
+
id,
|
|
90
|
+
result,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Factory: Create an error response
|
|
95
|
+
*/
|
|
96
|
+
export function createErrorResponse(id, message, code = -32603) {
|
|
97
|
+
return {
|
|
98
|
+
id,
|
|
99
|
+
error: {
|
|
100
|
+
code,
|
|
101
|
+
message,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Factory: Create an event notification
|
|
107
|
+
*/
|
|
108
|
+
export function createEvent(method, params, sessionId) {
|
|
109
|
+
const event = {
|
|
110
|
+
method,
|
|
111
|
+
params: params ?? {},
|
|
112
|
+
};
|
|
113
|
+
if (sessionId) {
|
|
114
|
+
event.sessionId = sessionId;
|
|
115
|
+
}
|
|
116
|
+
return event;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=cdpMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdpMessages.js","sourceRoot":"","sources":["../../src/__testfixtures__/cdpMessages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAe;IACrC,EAAE,EAAE,CAAC;IACL,MAAM,EAAE,mBAAmB;IAC3B,MAAM,EAAE,EAAE;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAe;IAC9C,EAAE,EAAE,CAAC;IACL,MAAM,EAAE;QACN,WAAW,EAAE;YACX;gBACE,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,WAAW;gBAClB,GAAG,EAAE,uBAAuB;gBAC5B,QAAQ,EAAE,KAAK;gBACf,eAAe,EAAE,KAAK;aACvB;SACF;KACF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAe;IAC5C,EAAE,EAAE,CAAC;IACL,KAAK,EAAE;QACL,IAAI,EAAE,CAAC,KAAK;QACZ,OAAO,EAAE,kBAAkB;KAC5B;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAe;IAChD,MAAM,EAAE,sBAAsB;IAC9B,MAAM,EAAE;QACN,UAAU,EAAE;YACV,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,UAAU;YACjB,GAAG,EAAE,uBAAuB;YAC5B,QAAQ,EAAE,KAAK;YACf,eAAe,EAAE,KAAK;SACvB;KACF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAe;IAChD,MAAM,EAAE,qBAAqB;IAC7B,MAAM,EAAE;QACN,KAAK,EAAE;YACL,EAAE,EAAE,SAAS;YACb,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,4BAA4B;YACjC,cAAc,EAAE,uBAAuB;YACvC,QAAQ,EAAE,WAAW;SACtB;KACF;IACD,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAAU,EAAE,MAAc,EAAE,MAAgB;IACxE,OAAO;QACL,EAAE;QACF,MAAM;QACN,MAAM,EAAG,MAAkC,IAAI,EAAE;KAClD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU,EAAE,MAAe;IACxD,OAAO;QACL,EAAE;QACF,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAU,EAAE,OAAe,EAAE,IAAI,GAAG,CAAC,KAAK;IAC5E,OAAO;QACL,EAAE;QACF,KAAK,EAAE;YACL,IAAI;YACJ,OAAO;SACR;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,MAAe,EAAE,SAAkB;IAC7E,MAAM,KAAK,GAAe;QACxB,MAAM;QACN,MAAM,EAAG,MAAkC,IAAI,EAAE;KAClD,CAAC;IACF,IAAI,SAAS,EAAE,CAAC;QACd,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IAC9B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CDPTarget } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a mock CDPTarget with default values and optional overrides.
|
|
4
|
+
*
|
|
5
|
+
* Provides consistent test data across connection module tests while allowing
|
|
6
|
+
* customization for specific test scenarios.
|
|
7
|
+
*
|
|
8
|
+
* @param overrides - Partial CDPTarget properties to override defaults
|
|
9
|
+
* @returns Complete CDPTarget object for testing
|
|
10
|
+
*/
|
|
11
|
+
export declare const createMockTarget: (overrides?: Partial<CDPTarget>) => CDPTarget;
|
|
12
|
+
/**
|
|
13
|
+
* Standard list of mock targets for testing target discovery and matching.
|
|
14
|
+
*
|
|
15
|
+
* Includes common test scenarios:
|
|
16
|
+
* - Different URLs on same host (localhost:3000, localhost:3000/about)
|
|
17
|
+
* - Different hosts (example.com)
|
|
18
|
+
* - Different target types (page, background_page, service_worker)
|
|
19
|
+
*/
|
|
20
|
+
export declare const mockTargetList: CDPTarget[];
|
|
21
|
+
//# sourceMappingURL=connectionTargets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionTargets.d.ts","sourceRoot":"","sources":["../../src/__testfixtures__/connectionTargets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAW,OAAO,CAAC,SAAS,CAAM,KAAG,SAOpE,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,EAgCrC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a mock CDPTarget with default values and optional overrides.
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent test data across connection module tests while allowing
|
|
5
|
+
* customization for specific test scenarios.
|
|
6
|
+
*
|
|
7
|
+
* @param overrides - Partial CDPTarget properties to override defaults
|
|
8
|
+
* @returns Complete CDPTarget object for testing
|
|
9
|
+
*/
|
|
10
|
+
export const createMockTarget = (overrides = {}) => ({
|
|
11
|
+
id: 'target-123',
|
|
12
|
+
type: 'page',
|
|
13
|
+
url: 'http://localhost:3000',
|
|
14
|
+
title: 'Test Page',
|
|
15
|
+
webSocketDebuggerUrl: 'ws://127.0.0.1:9222/devtools/page/target-123',
|
|
16
|
+
...overrides,
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Standard list of mock targets for testing target discovery and matching.
|
|
20
|
+
*
|
|
21
|
+
* Includes common test scenarios:
|
|
22
|
+
* - Different URLs on same host (localhost:3000, localhost:3000/about)
|
|
23
|
+
* - Different hosts (example.com)
|
|
24
|
+
* - Different target types (page, background_page, service_worker)
|
|
25
|
+
*/
|
|
26
|
+
export const mockTargetList = [
|
|
27
|
+
createMockTarget({
|
|
28
|
+
id: 'target-1',
|
|
29
|
+
url: 'http://localhost:3000',
|
|
30
|
+
title: 'Home Page',
|
|
31
|
+
}),
|
|
32
|
+
createMockTarget({
|
|
33
|
+
id: 'target-2',
|
|
34
|
+
url: 'http://localhost:3000/about',
|
|
35
|
+
title: 'About Page',
|
|
36
|
+
webSocketDebuggerUrl: 'ws://127.0.0.1:9222/devtools/page/target-2',
|
|
37
|
+
}),
|
|
38
|
+
createMockTarget({
|
|
39
|
+
id: 'target-3',
|
|
40
|
+
url: 'http://example.com',
|
|
41
|
+
title: 'Example Site',
|
|
42
|
+
webSocketDebuggerUrl: 'ws://127.0.0.1:9222/devtools/page/target-3',
|
|
43
|
+
}),
|
|
44
|
+
createMockTarget({
|
|
45
|
+
id: 'target-4',
|
|
46
|
+
type: 'background_page',
|
|
47
|
+
url: 'chrome-extension://abcdef/background.html',
|
|
48
|
+
title: 'Extension Background',
|
|
49
|
+
webSocketDebuggerUrl: 'ws://127.0.0.1:9222/devtools/page/target-4',
|
|
50
|
+
}),
|
|
51
|
+
createMockTarget({
|
|
52
|
+
id: 'target-5',
|
|
53
|
+
type: 'service_worker',
|
|
54
|
+
url: 'https://app.example.com/sw.js',
|
|
55
|
+
title: 'Service Worker',
|
|
56
|
+
webSocketDebuggerUrl: 'ws://127.0.0.1:9222/devtools/page/target-5',
|
|
57
|
+
}),
|
|
58
|
+
];
|
|
59
|
+
//# sourceMappingURL=connectionTargets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionTargets.js","sourceRoot":"","sources":["../../src/__testfixtures__/connectionTargets.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,YAAgC,EAAE,EAAa,EAAE,CAAC,CAAC;IAClF,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,uBAAuB;IAC5B,KAAK,EAAE,WAAW;IAClB,oBAAoB,EAAE,8CAA8C;IACpE,GAAG,SAAS;CACb,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,gBAAgB,CAAC;QACf,EAAE,EAAE,UAAU;QACd,GAAG,EAAE,uBAAuB;QAC5B,KAAK,EAAE,WAAW;KACnB,CAAC;IACF,gBAAgB,CAAC;QACf,EAAE,EAAE,UAAU;QACd,GAAG,EAAE,6BAA6B;QAClC,KAAK,EAAE,YAAY;QACnB,oBAAoB,EAAE,4CAA4C;KACnE,CAAC;IACF,gBAAgB,CAAC;QACf,EAAE,EAAE,UAAU;QACd,GAAG,EAAE,oBAAoB;QACzB,KAAK,EAAE,cAAc;QACrB,oBAAoB,EAAE,4CAA4C;KACnE,CAAC;IACF,gBAAgB,CAAC;QACf,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,iBAAiB;QACvB,GAAG,EAAE,2CAA2C;QAChD,KAAK,EAAE,sBAAsB;QAC7B,oBAAoB,EAAE,4CAA4C;KACnE,CAAC;IACF,gBAAgB,CAAC;QACf,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,gBAAgB;QACtB,GAAG,EAAE,+BAA+B;QACpC,KAAK,EAAE,gBAAgB;QACvB,oBAAoB,EAAE,4CAA4C;KACnE,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-files.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/session-files.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import { describe, it, beforeEach, afterEach } from 'node:test';
|
|
6
|
+
/**
|
|
7
|
+
* Integration tests for session file operations using real filesystem
|
|
8
|
+
*
|
|
9
|
+
* These tests verify that atomic write patterns work correctly with actual
|
|
10
|
+
* file I/O, catching issues that in-memory fakes can't detect (permissions,
|
|
11
|
+
* platform quirks, race conditions).
|
|
12
|
+
*/
|
|
13
|
+
void describe('Session Files Integration Tests', () => {
|
|
14
|
+
let tmpDir;
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
// Create temporary directory for each test
|
|
17
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'bdg-test-'));
|
|
18
|
+
});
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
// ⚠️ CRITICAL: Clean up temp directory, even if test fails
|
|
21
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
22
|
+
});
|
|
23
|
+
void describe('Atomic Writes', () => {
|
|
24
|
+
void it('should prevent partial reads during writes (tmp file + rename pattern)', () => {
|
|
25
|
+
const filePath = path.join(tmpDir, 'test.txt');
|
|
26
|
+
const tmpPath = filePath + '.tmp';
|
|
27
|
+
const testData = 'complete data';
|
|
28
|
+
// Write to temp file first
|
|
29
|
+
fs.writeFileSync(tmpPath, testData, 'utf-8');
|
|
30
|
+
// At this point, final file doesn't exist yet
|
|
31
|
+
assert.equal(fs.existsSync(filePath), false, 'Final file should not exist before rename');
|
|
32
|
+
// Rename tmp to final (atomic operation on most filesystems)
|
|
33
|
+
fs.renameSync(tmpPath, filePath);
|
|
34
|
+
// Now read the final file
|
|
35
|
+
const readData = fs.readFileSync(filePath, 'utf-8');
|
|
36
|
+
assert.equal(readData, testData, 'Should read complete data');
|
|
37
|
+
// Tmp file should be gone
|
|
38
|
+
assert.equal(fs.existsSync(tmpPath), false, 'Temp file should be removed after rename');
|
|
39
|
+
});
|
|
40
|
+
void it('should handle exclusive file creation (wx flag)', () => {
|
|
41
|
+
const lockPath = path.join(tmpDir, 'session.lock');
|
|
42
|
+
// First write with wx should succeed
|
|
43
|
+
fs.writeFileSync(lockPath, '12345', { flag: 'wx' });
|
|
44
|
+
assert.equal(fs.existsSync(lockPath), true, 'Lock file should be created');
|
|
45
|
+
// Second write with wx should fail with EEXIST
|
|
46
|
+
assert.throws(() => fs.writeFileSync(lockPath, '67890', { flag: 'wx' }), (err) => {
|
|
47
|
+
return err instanceof Error && 'code' in err && err.code === 'EEXIST';
|
|
48
|
+
}, 'Should throw EEXIST when file already exists with wx flag');
|
|
49
|
+
// Original content should be unchanged
|
|
50
|
+
const content = fs.readFileSync(lockPath, 'utf-8');
|
|
51
|
+
assert.equal(content, '12345', 'Original content should be preserved');
|
|
52
|
+
});
|
|
53
|
+
void it('should verify temp directory cleanup happens even on assertion failure', () => {
|
|
54
|
+
// This test verifies our afterEach cleanup works
|
|
55
|
+
const testFile = path.join(tmpDir, 'verify-cleanup.txt');
|
|
56
|
+
fs.writeFileSync(testFile, 'test data');
|
|
57
|
+
assert.equal(fs.existsSync(testFile), true, 'File should exist during test');
|
|
58
|
+
// Store tmpDir path to verify it's cleaned up after test
|
|
59
|
+
const dirToCheck = tmpDir;
|
|
60
|
+
// Note: afterEach will run even if this test fails, cleaning up tmpDir
|
|
61
|
+
// We can't directly verify cleanup here, but this documents the pattern
|
|
62
|
+
assert.ok(dirToCheck.includes('bdg-test-'), 'Temp dir should have bdg-test prefix');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=session-files.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-files.integration.test.js","sourceRoot":"","sources":["../../../src/__tests__/integration/session-files.integration.test.ts"],"names":[],"mappings":"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"}
|