gitmyhub

devtool

JavaScript ★ 3.7k updated 8y ago

[OBSOLETE] runs Node.js programs through Chromium DevTools

Devtool is a command-line tool that runs Node.js programs inside the Chrome DevTools debugger interface, the same debugging panel built into Chrome that web developers use to step through JavaScript in a browser. The tool wraps Electron (a framework that packages Chromium and Node together) to bridge the gap: you point it at a Node.js script, and instead of running silently in the terminal, the script opens in a full DevTools window where you can set breakpoints, inspect variables, profile CPU and memory usage, and interact with the program live.

The practical use case is debugging or profiling Node.js code that would otherwise be hard to trace. For example, you can run a build script through devtool, add CPU profiling calls around the slow sections, and see a visual flame chart of where time is being spent. You can also set an initial breakpoint with a flag so the program pauses at the very first line, giving you time to set further breakpoints before any code runs.

When run without an entry file, devtool opens a REPL (an interactive prompt) backed by Node, but displayed in the browser-like console panel. You can require local modules from this REPL using paths relative to your current directory. You can also pipe JavaScript into devtool from another tool and have it execute in that environment.

An interesting side effect of running inside Chromium is that Node code gains access to browser APIs like Canvas and WebGL alongside its normal file system and network capabilities. The README shows an example that fetches a Google Street View panorama and writes a PNG image to standard output, mixing a Node file-writing pattern with browser-side image APIs.

The project is marked obsolete. Much of its original purpose, debugging Node.js with Chrome DevTools, was later built directly into Node itself. The repository is kept for reference but is no longer actively maintained.