I have LinkedIn's blessing to work full-time for 2 weeks on building a node.js addon[1] for remote Chrome Devtools debugging. Since I've never built an addon, this is a rather ambitious task for my first addon, and nearly everyone in the community would benefit from this, I thought I'd solicit interest in working with me on it, either directly via pull requests or indirectly by giving advice on building node.js addons.
Per Pavel Feldman of the Chrome Devtools team, it's possible, with possibly some limited support from Chrome to decouple some APIs if necessary. For me personally, the inability to use the native Chrome debugger has always been a little frustrating, and this is my attempt to do what I can to resolve it. Any non-trivial contributions will receive Contributor permissions to accelerate collaboration.
Pavel has also graciously provided me with the following high-level overview of where to start:
There is not much info available. These are the rough hints for you (use
cs.chromium.org to navigate Blink source). Then we could chat over VC / hangouts / Skype.
[Compile]
InspectorController is a container for remote debugging protocol agents. We have one for the Page (InspectorController.cpp) and we have one for the workers (WorkerInspectorController.cpp that has limited functionality). Given that Node is more like a worker (pure JS execution environment), take a look at that file for the list of agents to compile in your module (InspectorDebuggerAgent, InspectorConsoleAgent, InspectorProfileAgent, etc.). So you would need to compile all of them.
These agents would pull ScriptDebugServer.cpp, ScriptProfiler.cpp, Script* etc. These are wrappers around v8, should compile against v8.h. Some of them (ScriptProfiler) and most of the agents will reference Node and that's what we need to fix. In fact, most of them will pull Page, Document, Node for no good reason and that's what we need to fix upstream, in Blink.
You would also need to generate InspectorBackendDispatcher and InspectorFrontend from devtools/protocol.json. First one will parse incoming JSON messages and will dispatch them on controller's agents, second will generate typed API for agents to send messages back. Some tweaking would be necessary here as well since currently we generate a giant dispatch and giant front-end instead of per-domain files. Having them per-domain would let you only take what you really need.
[Wire]
Lets assume it all compiled. Now you need to instantiate this controller and call dispatchMessageFromFrontend on it with every message from the front-end. Front-end will issue them using web socket transport, so you need to have a server web socket as a part of your Node module that would accept connection and do the right thing to the messages (call dispatchMessageFromFrontend). And for the way back, your m_frontendChannel would need to send info back using that web socket.
[Debugging]
After compiling and wiring, console will start working. But you also need to make things work while on breakpoint. For that, you would need to implement runMessageLoopOnPause in your version of WorkerScriptDebugServer.
As I mentioned, it is quite some work both downstream (in the Node module) and upstream (to remove poor Blink dependencies from agents). But it might be worth it.
Regards
Pavel
// End Quote