Sample Chrome Debug Protocol proxy used to extend vscode-js-debug
Перейти к файлу
Raymond Zhao 2cf1191915
chore: migrate to npm (#12)
2024-10-30 10:09:56 -07:00
src chore: update deps 2021-10-19 15:01:12 -07:00
.gitignore Initial commit 2020-02-11 02:09:52 +00:00
.npmignore chore: prep for publish 2020-02-11 08:41:17 -08:00
CODE_OF_CONDUCT.md chore: update deps 2021-10-19 15:01:12 -07:00
LICENSE Initial LICENSE commit 2020-02-10 18:09:56 -08:00
README.md chore: update deps 2021-10-19 15:01:12 -07:00
SECURITY.md chore: update deps 2021-10-19 15:01:12 -07:00
demo.js fix: remove need for hardcoding inspect uri 2020-02-27 10:26:12 -08:00
example.dot init 2020-02-10 20:33:04 -08:00
example.png init 2020-02-10 20:33:04 -08:00
package-lock.json chore: migrate to npm (#12) 2024-10-30 10:09:56 -07:00
package.json chore: migrate to npm (#12) 2024-10-30 10:09:56 -07:00
tsconfig.json init 2020-02-10 20:33:04 -08:00

README.md

vscode-cdp-proxy

Sample Chrome Debug Protocol proxy used to extend vscode-js-debug with custom targets. This can be used to allow js-debug to work with esoteric targets, like WebAssembly-compiled and frameworks like React Native. Say you're building a React Native debugger. The general flow would work like so:

  1. You have a React Native extension, which allows users to start debugging via a command or a launch config.

  2. When a session starts, you start a CDP proxy, like the one in this repo. Say it starts listening on localhost:3000

  3. Then, you call vscode.debug.startDebugger with a configuration like:

    {
      "type": "pwa-chrome",
      "request": "attach",
      "address": "localhost",  // <- host your proxy is running on
      "port": 3000,            // <- port your proxy is running on
    }
    
  4. The debugger will then connect to the proxy like it would any other CDP-enabled target.

  5. Finally, you translate between CDP and the protocol used to debug your target application. In the case of React Native, this is might be a minimal rewrite of some CDP behavior. In the case of more advanced WebAssembly targets, you might translate into something entirely new.

Using this Package

Parts of this package are exported from js-debug. We may publish these parts as nicely packaged bits for reuse here and in the extension, but that's not done right now.

Check out demo.js for an example of a server.