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,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default filters for reducing noise in collected data
|
|
3
|
+
*/
|
|
4
|
+
import { extractHostname, extractHostnameWithPath } from './url/safeParseUrl.js';
|
|
5
|
+
/**
|
|
6
|
+
* Domains to exclude by default (common tracking/analytics)
|
|
7
|
+
* These generate high volume but are rarely useful for debugging
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_EXCLUDED_DOMAINS = [
|
|
10
|
+
// Google Analytics & Ads
|
|
11
|
+
'analytics.google.com',
|
|
12
|
+
'googletagmanager.com',
|
|
13
|
+
'googleadservices.com',
|
|
14
|
+
'doubleclick.net',
|
|
15
|
+
'google-analytics.com',
|
|
16
|
+
// Microsoft/Bing
|
|
17
|
+
'clarity.ms',
|
|
18
|
+
'bat.bing.com',
|
|
19
|
+
// Social Media Tracking
|
|
20
|
+
'facebook.com',
|
|
21
|
+
'connect.facebook.net',
|
|
22
|
+
'tiktok.com',
|
|
23
|
+
'linkedin.com',
|
|
24
|
+
'twitter.com',
|
|
25
|
+
'snapchat.com',
|
|
26
|
+
// Product Analytics
|
|
27
|
+
'mixpanel.com',
|
|
28
|
+
'segment.com',
|
|
29
|
+
'segment.io',
|
|
30
|
+
'amplitude.com',
|
|
31
|
+
'heap.io',
|
|
32
|
+
// Session Recording & Heatmaps
|
|
33
|
+
'fullstory.com',
|
|
34
|
+
'hotjar.com',
|
|
35
|
+
'logrocket.com',
|
|
36
|
+
'smartlook.com',
|
|
37
|
+
// Ad Networks & Attribution
|
|
38
|
+
'exactag.com',
|
|
39
|
+
'criteo.com',
|
|
40
|
+
'adroll.com',
|
|
41
|
+
'outbrain.com',
|
|
42
|
+
'taboola.com',
|
|
43
|
+
// Other Analytics
|
|
44
|
+
'confirmit.com',
|
|
45
|
+
'newrelic.com',
|
|
46
|
+
'datadoghq.com',
|
|
47
|
+
'sentry.io',
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* Console message types to exclude by default (Redux/React DevTools noise)
|
|
51
|
+
*/
|
|
52
|
+
export const DEFAULT_EXCLUDED_CONSOLE_TYPES = ['startGroup', 'startGroupCollapsed', 'endGroup'];
|
|
53
|
+
/**
|
|
54
|
+
* Console message patterns to exclude by default (dev server noise)
|
|
55
|
+
*/
|
|
56
|
+
export const DEFAULT_EXCLUDED_CONSOLE_PATTERNS = [
|
|
57
|
+
'webpack-dev-server',
|
|
58
|
+
'[HMR]',
|
|
59
|
+
'[WDS]',
|
|
60
|
+
'Download the React DevTools',
|
|
61
|
+
'@@redux', // Redux actions
|
|
62
|
+
'%c prev state', // Redux logger
|
|
63
|
+
'%c action', // Redux logger
|
|
64
|
+
'%c next state', // Redux logger
|
|
65
|
+
];
|
|
66
|
+
/**
|
|
67
|
+
* File patterns to skip body fetching by default (assets unlikely to be useful for debugging)
|
|
68
|
+
* These reduce data volume significantly without losing critical debugging information.
|
|
69
|
+
*/
|
|
70
|
+
export const DEFAULT_SKIP_BODY_PATTERNS = [
|
|
71
|
+
// Images
|
|
72
|
+
'*.png',
|
|
73
|
+
'*.jpg',
|
|
74
|
+
'*.jpeg',
|
|
75
|
+
'*.gif',
|
|
76
|
+
'*.svg',
|
|
77
|
+
'*.ico',
|
|
78
|
+
'*.webp',
|
|
79
|
+
'*.bmp',
|
|
80
|
+
'*.tiff',
|
|
81
|
+
// Fonts
|
|
82
|
+
'*.woff',
|
|
83
|
+
'*.woff2',
|
|
84
|
+
'*.ttf',
|
|
85
|
+
'*.eot',
|
|
86
|
+
'*.otf',
|
|
87
|
+
// Stylesheets
|
|
88
|
+
'*.css',
|
|
89
|
+
// Source maps (can be large and rarely needed)
|
|
90
|
+
'*.map',
|
|
91
|
+
'*.js.map',
|
|
92
|
+
'*.css.map',
|
|
93
|
+
// Videos
|
|
94
|
+
'*.mp4',
|
|
95
|
+
'*.webm',
|
|
96
|
+
'*.ogg',
|
|
97
|
+
'*.avi',
|
|
98
|
+
'*.mov',
|
|
99
|
+
// Audio
|
|
100
|
+
'*.mp3',
|
|
101
|
+
'*.wav',
|
|
102
|
+
'*.flac',
|
|
103
|
+
'*.aac',
|
|
104
|
+
];
|
|
105
|
+
/**
|
|
106
|
+
* MIME types to skip body fetching by default
|
|
107
|
+
* This catches resources that may not have obvious file extensions (e.g., CSS with query params)
|
|
108
|
+
*/
|
|
109
|
+
export const DEFAULT_SKIP_BODY_MIME_TYPES = [
|
|
110
|
+
'text/css',
|
|
111
|
+
'image/svg+xml',
|
|
112
|
+
'image/png',
|
|
113
|
+
'image/jpeg',
|
|
114
|
+
'image/gif',
|
|
115
|
+
'image/webp',
|
|
116
|
+
'image/avif',
|
|
117
|
+
'image/bmp',
|
|
118
|
+
'image/tiff',
|
|
119
|
+
'font/woff',
|
|
120
|
+
'font/woff2',
|
|
121
|
+
'font/ttf',
|
|
122
|
+
'font/eot',
|
|
123
|
+
'font/otf',
|
|
124
|
+
'application/font-woff',
|
|
125
|
+
'application/font-woff2',
|
|
126
|
+
'video/mp4',
|
|
127
|
+
'video/webm',
|
|
128
|
+
'audio/mpeg',
|
|
129
|
+
'audio/wav',
|
|
130
|
+
];
|
|
131
|
+
/**
|
|
132
|
+
* Check if a URL should be excluded based on domain filtering.
|
|
133
|
+
*
|
|
134
|
+
* @param url - URL to check against exclusion list
|
|
135
|
+
* @param includeAll - If true, disables all filtering
|
|
136
|
+
* @returns True if the URL's domain matches an excluded domain
|
|
137
|
+
*/
|
|
138
|
+
export function shouldExcludeDomain(url, includeAll = false) {
|
|
139
|
+
if (includeAll) {
|
|
140
|
+
return false; // Don't filter anything if --include-all flag is set
|
|
141
|
+
}
|
|
142
|
+
const hostname = extractHostname(url).toLowerCase();
|
|
143
|
+
return DEFAULT_EXCLUDED_DOMAINS.some((domain) => hostname.includes(domain.toLowerCase()));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Check if a console message should be excluded based on type and pattern filtering
|
|
147
|
+
*/
|
|
148
|
+
export function shouldExcludeConsoleMessage(text, type, includeAll = false) {
|
|
149
|
+
if (includeAll) {
|
|
150
|
+
return false; // Don't filter anything if --include-all flag is set
|
|
151
|
+
}
|
|
152
|
+
// Check if message type should be excluded (e.g., group messages)
|
|
153
|
+
if (DEFAULT_EXCLUDED_CONSOLE_TYPES.includes(type)) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
const lowerText = text.toLowerCase();
|
|
157
|
+
return DEFAULT_EXCLUDED_CONSOLE_PATTERNS.some((pattern) => lowerText.includes(pattern.toLowerCase()));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Evaluate whether a URL matches pattern rules using include-trumps-exclude logic.
|
|
161
|
+
*
|
|
162
|
+
* Provides centralized pattern matching with consistent precedence rules:
|
|
163
|
+
* 1. If URL matches includePatterns → true (even if it also matches excludePatterns)
|
|
164
|
+
* 2. If includePatterns specified but URL doesn't match → false (whitelist mode)
|
|
165
|
+
* 3. If URL matches excludePatterns → false
|
|
166
|
+
* 4. Otherwise → use defaultBehavior
|
|
167
|
+
*
|
|
168
|
+
* This function consolidates the URL parsing and wildcard matching logic that was
|
|
169
|
+
* previously duplicated across multiple filter functions.
|
|
170
|
+
*
|
|
171
|
+
* @param url - The URL to check against patterns
|
|
172
|
+
* @param config - Pattern matching configuration with include/exclude patterns
|
|
173
|
+
* @returns True if the URL should be included based on pattern rules
|
|
174
|
+
*/
|
|
175
|
+
function evaluatePatternMatch(url, config) {
|
|
176
|
+
const { includePatterns = [], excludePatterns = [], defaultBehavior = 'include' } = config;
|
|
177
|
+
// Parse URL once for all pattern checks
|
|
178
|
+
const hostname = extractHostname(url);
|
|
179
|
+
const hostnameWithPath = extractHostnameWithPath(url);
|
|
180
|
+
// Helper: check if any pattern matches hostname or hostname+path
|
|
181
|
+
const matchesAny = (patterns) => patterns.some((pattern) => matchesWildcard(hostname, pattern) || matchesWildcard(hostnameWithPath, pattern));
|
|
182
|
+
// Compute match states
|
|
183
|
+
const includeSpecified = includePatterns.length > 0;
|
|
184
|
+
const includeMatch = includeSpecified && matchesAny(includePatterns);
|
|
185
|
+
const excludeMatch = excludePatterns.length > 0 && matchesAny(excludePatterns);
|
|
186
|
+
// Decision logic: include trumps exclude, then whitelist mode, then exclude, then default
|
|
187
|
+
return includeMatch || (!includeSpecified && !excludeMatch && defaultBehavior === 'include');
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Simple wildcard pattern matcher.
|
|
191
|
+
* Supports only the * wildcard character.
|
|
192
|
+
*
|
|
193
|
+
* Examples:
|
|
194
|
+
* matchesWildcard("api.json", "*.json") → true
|
|
195
|
+
* matchesWildcard("api/users", "*api*") → true
|
|
196
|
+
* matchesWildcard("index.html", "*.js") → false
|
|
197
|
+
*
|
|
198
|
+
* @param str - The string to test
|
|
199
|
+
* @param pattern - The pattern with * wildcards
|
|
200
|
+
* @returns True if the string matches the pattern
|
|
201
|
+
*/
|
|
202
|
+
export function matchesWildcard(str, pattern) {
|
|
203
|
+
// Escape special regex characters except *
|
|
204
|
+
const regexPattern = pattern
|
|
205
|
+
.replace(/[.+?^${}()|[\]\\]/g, '\\$&') // Escape special chars
|
|
206
|
+
.replace(/\*/g, '.*'); // Replace * with .*
|
|
207
|
+
const regex = new RegExp(`^${regexPattern}$`, 'i'); // Case-insensitive
|
|
208
|
+
return regex.test(str);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Check if a URL matches any pattern in a list.
|
|
212
|
+
*
|
|
213
|
+
* Matches against both bare hostname and hostname+pathname to support:
|
|
214
|
+
* - Bare hostname patterns: `api.example.com` matches all requests to that host
|
|
215
|
+
* - Hostname wildcard patterns: `*analytics*` matches "analytics.google.com/collect"
|
|
216
|
+
* - Path patterns: `*\/api\/*` matches "example.com/api/users"
|
|
217
|
+
* - Combined patterns: `api.example.com\/users` matches specific endpoint
|
|
218
|
+
*
|
|
219
|
+
* @param url - The URL to check
|
|
220
|
+
* @param patterns - Array of wildcard patterns
|
|
221
|
+
* @returns True if URL matches any pattern
|
|
222
|
+
*/
|
|
223
|
+
/**
|
|
224
|
+
* Determine if a response body should be fetched based on URL, MIME type, and patterns.
|
|
225
|
+
*
|
|
226
|
+
* Pattern precedence (follows include-trumps-exclude rule):
|
|
227
|
+
* 1. If URL matches includePatterns → FETCH (even if it also matches excludePatterns)
|
|
228
|
+
* 2. If includePatterns specified but URL doesn't match → SKIP (whitelist mode)
|
|
229
|
+
* 3. If URL matches excludePatterns → SKIP
|
|
230
|
+
* 4. If fetchAllBodies flag is true → FETCH
|
|
231
|
+
* 5. If MIME type matches DEFAULT_SKIP_BODY_MIME_TYPES → SKIP
|
|
232
|
+
* 6. If URL matches DEFAULT_SKIP_BODY_PATTERNS → SKIP
|
|
233
|
+
* 7. Otherwise → FETCH (default behavior)
|
|
234
|
+
*
|
|
235
|
+
* @param url - The request URL
|
|
236
|
+
* @param mimeType - The response MIME type (for MIME-based skipping)
|
|
237
|
+
* @param options - Configuration options
|
|
238
|
+
* @returns True if the body should be fetched
|
|
239
|
+
*/
|
|
240
|
+
export function shouldFetchBody(url, mimeType, options = {}) {
|
|
241
|
+
const { fetchAllBodies = false, includePatterns = [], excludePatterns = [] } = options;
|
|
242
|
+
// If includePatterns specified, act as whitelist (trumps everything else)
|
|
243
|
+
if (includePatterns.length > 0) {
|
|
244
|
+
return evaluatePatternMatch(url, {
|
|
245
|
+
includePatterns,
|
|
246
|
+
defaultBehavior: 'exclude',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
// If excludePatterns specified and URL matches → skip (trumps fetchAllBodies)
|
|
250
|
+
if (excludePatterns.length > 0) {
|
|
251
|
+
const matchesExclude = evaluatePatternMatch(url, {
|
|
252
|
+
includePatterns: excludePatterns,
|
|
253
|
+
defaultBehavior: 'exclude',
|
|
254
|
+
});
|
|
255
|
+
if (matchesExclude) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// If fetchAllBodies flag is set → fetch everything
|
|
260
|
+
if (fetchAllBodies) {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
// Check MIME type against default skip list (case-insensitive)
|
|
264
|
+
if (mimeType) {
|
|
265
|
+
const normalizedMimeType = mimeType.toLowerCase().split(';')[0]?.trim() ?? ''; // Remove charset etc.
|
|
266
|
+
if (normalizedMimeType &&
|
|
267
|
+
DEFAULT_SKIP_BODY_MIME_TYPES.some((skipType) => normalizedMimeType === skipType.toLowerCase())) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
// Apply default auto-skip URL patterns
|
|
272
|
+
const matchesDefaultSkip = evaluatePatternMatch(url, {
|
|
273
|
+
includePatterns: DEFAULT_SKIP_BODY_PATTERNS,
|
|
274
|
+
defaultBehavior: 'exclude',
|
|
275
|
+
});
|
|
276
|
+
// Default: fetch the body unless it matches default skip patterns
|
|
277
|
+
return !matchesDefaultSkip;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Determine if a network request should be excluded based on URL patterns.
|
|
281
|
+
*
|
|
282
|
+
* Pattern precedence (follows include-trumps-exclude rule):
|
|
283
|
+
* 1. If URL matches includePatterns → CAPTURE (even if it also matches excludePatterns)
|
|
284
|
+
* 2. If includePatterns specified but URL doesn't match → EXCLUDE (whitelist mode)
|
|
285
|
+
* 3. If URL matches excludePatterns → EXCLUDE
|
|
286
|
+
* 4. Otherwise → CAPTURE (default behavior)
|
|
287
|
+
*
|
|
288
|
+
* Note: This function is separate from domain filtering (shouldExcludeDomain).
|
|
289
|
+
* Both filters can be applied: domain filtering happens first, then URL pattern filtering.
|
|
290
|
+
*
|
|
291
|
+
* @param url - The request URL
|
|
292
|
+
* @param options - Configuration options
|
|
293
|
+
* @returns True if the request should be excluded
|
|
294
|
+
*/
|
|
295
|
+
export function shouldExcludeUrl(url, options = {}) {
|
|
296
|
+
const { includePatterns = [], excludePatterns = [] } = options;
|
|
297
|
+
// Use unified pattern matching - invert result since we want exclusion logic
|
|
298
|
+
return !evaluatePatternMatch(url, {
|
|
299
|
+
includePatterns,
|
|
300
|
+
excludePatterns,
|
|
301
|
+
defaultBehavior: 'include',
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/utils/filters.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network data formatters for human-readable output
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* CDP Cookie type
|
|
6
|
+
*/
|
|
7
|
+
export interface Cookie {
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
domain: string;
|
|
11
|
+
path: string;
|
|
12
|
+
expires?: number;
|
|
13
|
+
httpOnly: boolean;
|
|
14
|
+
secure: boolean;
|
|
15
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Format cookies for human-readable output
|
|
19
|
+
*
|
|
20
|
+
* @param cookies - Array of CDP cookies
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatCookies(cookies: Cookie[]): void;
|
|
23
|
+
//# sourceMappingURL=network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/network.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CA6BrD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Network data formatters for human-readable output
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Format cookies for human-readable output
|
|
6
|
+
*
|
|
7
|
+
* @param cookies - Array of CDP cookies
|
|
8
|
+
*/
|
|
9
|
+
export function formatCookies(cookies) {
|
|
10
|
+
if (cookies.length === 0) {
|
|
11
|
+
console.log('No cookies found');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
console.log(`Cookies (${cookies.length}):\n`);
|
|
15
|
+
cookies.forEach((cookie, index) => {
|
|
16
|
+
console.log(`[${index + 1}] ${cookie.name}`);
|
|
17
|
+
console.log(` Value: ${cookie.value}`);
|
|
18
|
+
console.log(` Domain: ${cookie.domain}`);
|
|
19
|
+
console.log(` Path: ${cookie.path}`);
|
|
20
|
+
if (cookie.expires && cookie.expires !== -1) {
|
|
21
|
+
const expiresDate = new Date(cookie.expires * 1000);
|
|
22
|
+
console.log(` Expires: ${expiresDate.toISOString()}`);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.log(` Expires: Session`);
|
|
26
|
+
}
|
|
27
|
+
console.log(` HttpOnly: ${cookie.httpOnly ? 'Yes' : 'No'}`);
|
|
28
|
+
console.log(` Secure: ${cookie.secure ? 'Yes' : 'No'}`);
|
|
29
|
+
console.log(` SameSite: ${cookie.sameSite ?? 'None'}`);
|
|
30
|
+
if (index < cookies.length - 1) {
|
|
31
|
+
console.log('');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../src/utils/formatters/network.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAiB;IAC7C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,CAAC,MAAM,MAAM,CAAC,CAAC;IAE9C,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAChC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAEtC,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;YAC5C,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC,cAAc,WAAW,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,QAAQ,IAAI,MAAM,EAAE,CAAC,CAAC;QAExD,IAAI,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CDPTarget } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch CDP targets from Chrome's HTTP API.
|
|
4
|
+
*
|
|
5
|
+
* Uses centralized constants for host and default port to ensure consistency
|
|
6
|
+
* across all CDP target operations. This replaces duplicate HTTP endpoint logic
|
|
7
|
+
* scattered across the codebase.
|
|
8
|
+
*
|
|
9
|
+
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
10
|
+
* @returns Promise resolving to array of CDP targets, or empty array on error
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* - Uses HTTP_LOCALHOST constant for consistent host addressing
|
|
14
|
+
* - Returns empty array rather than throwing on HTTP errors for easier consumption
|
|
15
|
+
* - Network errors are silently handled - callers should validate results
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchCDPTargets(port?: number): Promise<CDPTarget[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Fetch specific CDP target by ID from Chrome's HTTP API.
|
|
20
|
+
*
|
|
21
|
+
* Convenience wrapper around fetchCDPTargets that filters for a specific target ID.
|
|
22
|
+
* Uses centralized constants and shared HTTP logic for consistency.
|
|
23
|
+
*
|
|
24
|
+
* @param targetId - Target ID to search for
|
|
25
|
+
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
26
|
+
* @returns Promise resolving to matching target, or null if not found/error
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* - Returns null rather than throwing on errors for easier consumption
|
|
30
|
+
* - Searches all targets returned by Chrome's /json/list endpoint
|
|
31
|
+
* - Uses shared fetchCDPTargets helper to avoid code duplication
|
|
32
|
+
*/
|
|
33
|
+
export declare function fetchCDPTargetById(targetId: string, port?: number): Promise<CDPTarget | null>;
|
|
34
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CAAC,IAAI,GAAE,MAAyB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAU3F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,MAAyB,GAC9B,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAG3B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DEFAULT_CDP_PORT, HTTP_LOCALHOST } from '../constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch CDP targets from Chrome's HTTP API.
|
|
4
|
+
*
|
|
5
|
+
* Uses centralized constants for host and default port to ensure consistency
|
|
6
|
+
* across all CDP target operations. This replaces duplicate HTTP endpoint logic
|
|
7
|
+
* scattered across the codebase.
|
|
8
|
+
*
|
|
9
|
+
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
10
|
+
* @returns Promise resolving to array of CDP targets, or empty array on error
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* - Uses HTTP_LOCALHOST constant for consistent host addressing
|
|
14
|
+
* - Returns empty array rather than throwing on HTTP errors for easier consumption
|
|
15
|
+
* - Network errors are silently handled - callers should validate results
|
|
16
|
+
*/
|
|
17
|
+
export async function fetchCDPTargets(port = DEFAULT_CDP_PORT) {
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch(`http://${HTTP_LOCALHOST}:${port}/json/list`);
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
return (await response.json());
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fetch specific CDP target by ID from Chrome's HTTP API.
|
|
31
|
+
*
|
|
32
|
+
* Convenience wrapper around fetchCDPTargets that filters for a specific target ID.
|
|
33
|
+
* Uses centralized constants and shared HTTP logic for consistency.
|
|
34
|
+
*
|
|
35
|
+
* @param targetId - Target ID to search for
|
|
36
|
+
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
37
|
+
* @returns Promise resolving to matching target, or null if not found/error
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* - Returns null rather than throwing on errors for easier consumption
|
|
41
|
+
* - Searches all targets returned by Chrome's /json/list endpoint
|
|
42
|
+
* - Uses shared fetchCDPTargets helper to avoid code duplication
|
|
43
|
+
*/
|
|
44
|
+
export async function fetchCDPTargetById(targetId, port = DEFAULT_CDP_PORT) {
|
|
45
|
+
const targets = await fetchCDPTargets(port);
|
|
46
|
+
return targets.find((t) => t.id === targetId) ?? null;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG/D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAe,gBAAgB;IACnE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,cAAc,IAAI,IAAI,YAAY,CAAC,CAAC;QAC3E,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAgB,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,OAAe,gBAAgB;IAE/B,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for consistent formatted output.
|
|
3
|
+
*
|
|
4
|
+
* WHY: Centralizes log formatting to avoid repetitive `console.error('[component] message')` patterns.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Log contexts for different components.
|
|
8
|
+
* Used to prefix log messages with component name.
|
|
9
|
+
*/
|
|
10
|
+
export type LogContext = 'bdg' | 'launcher' | 'daemon' | 'worker' | 'client' | 'cleanup' | 'session' | 'chrome' | 'cdp' | 'ipc';
|
|
11
|
+
/**
|
|
12
|
+
* Create a logger function for a specific context.
|
|
13
|
+
*
|
|
14
|
+
* WHY: Provides consistent log formatting with context prefix.
|
|
15
|
+
*
|
|
16
|
+
* @param context - Component context for log prefix
|
|
17
|
+
* @returns Logger function that prefixes messages with context
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const log = createLogger('cleanup');
|
|
22
|
+
* log('Removed stale daemon socket');
|
|
23
|
+
* // Output: [cleanup] Removed stale daemon socket
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function createLogger(context: LogContext): (message: string) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Log a message with a specific context (one-off usage).
|
|
29
|
+
*
|
|
30
|
+
* WHY: Convenient for single log statements without creating a logger function.
|
|
31
|
+
*
|
|
32
|
+
* @param context - Component context for log prefix
|
|
33
|
+
* @param message - Log message
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* log('cleanup', 'Removed stale daemon socket');
|
|
38
|
+
* // Output: [cleanup] Removed stale daemon socket
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function log(context: LogContext, message: string): void;
|
|
42
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,KAAK,GACL,KAAK,CAAC;AAEV;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAI3E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAE9D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for consistent formatted output.
|
|
3
|
+
*
|
|
4
|
+
* WHY: Centralizes log formatting to avoid repetitive `console.error('[component] message')` patterns.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Create a logger function for a specific context.
|
|
8
|
+
*
|
|
9
|
+
* WHY: Provides consistent log formatting with context prefix.
|
|
10
|
+
*
|
|
11
|
+
* @param context - Component context for log prefix
|
|
12
|
+
* @returns Logger function that prefixes messages with context
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const log = createLogger('cleanup');
|
|
17
|
+
* log('Removed stale daemon socket');
|
|
18
|
+
* // Output: [cleanup] Removed stale daemon socket
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export function createLogger(context) {
|
|
22
|
+
return (message) => {
|
|
23
|
+
console.error(`[${context}] ${message}`);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Log a message with a specific context (one-off usage).
|
|
28
|
+
*
|
|
29
|
+
* WHY: Convenient for single log statements without creating a logger function.
|
|
30
|
+
*
|
|
31
|
+
* @param context - Component context for log prefix
|
|
32
|
+
* @param message - Log message
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* log('cleanup', 'Removed stale daemon socket');
|
|
37
|
+
* // Output: [cleanup] Removed stale daemon socket
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export function log(context, message) {
|
|
41
|
+
console.error(`[${context}] ${message}`);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,OAAmB;IAC9C,OAAO,CAAC,OAAe,EAAE,EAAE;QACzB,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,GAAG,CAAC,OAAmB,EAAE,OAAe;IACtD,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter out undefined values from an object, returning only defined properties.
|
|
3
|
+
*
|
|
4
|
+
* This utility removes properties with undefined values from an object, which is
|
|
5
|
+
* useful for building configuration objects where undefined values should be
|
|
6
|
+
* completely omitted rather than passed as undefined. Common use cases include
|
|
7
|
+
* API payloads, configuration merging, and type-safe object construction.
|
|
8
|
+
*
|
|
9
|
+
* @param obj - Object with potentially undefined values
|
|
10
|
+
* @returns New object with only defined values, no undefined properties
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const config = filterDefined({
|
|
15
|
+
* name: 'test',
|
|
16
|
+
* value: undefined,
|
|
17
|
+
* count: 0
|
|
18
|
+
* });
|
|
19
|
+
* // Result: { name: 'test', count: 0 }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function filterDefined<T extends Record<string, unknown>>(obj: T): Record<string, unknown>;
|
|
23
|
+
//# sourceMappingURL=objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEhG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter out undefined values from an object, returning only defined properties.
|
|
3
|
+
*
|
|
4
|
+
* This utility removes properties with undefined values from an object, which is
|
|
5
|
+
* useful for building configuration objects where undefined values should be
|
|
6
|
+
* completely omitted rather than passed as undefined. Common use cases include
|
|
7
|
+
* API payloads, configuration merging, and type-safe object construction.
|
|
8
|
+
*
|
|
9
|
+
* @param obj - Object with potentially undefined values
|
|
10
|
+
* @returns New object with only defined values, no undefined properties
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const config = filterDefined({
|
|
15
|
+
* name: 'test',
|
|
16
|
+
* value: undefined,
|
|
17
|
+
* count: 0
|
|
18
|
+
* });
|
|
19
|
+
* // Result: { name: 'test', count: 0 }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function filterDefined(obj) {
|
|
23
|
+
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/utils/objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAoC,GAAM;IACrE,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;AAC5F,CAAC"}
|