
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
dbgr is a lightweight debugger function that pauses your script, and watches the current file for any changes and only re-runs the specific code that's passed in to it.
If you like this project, please star it & follow me to see what other cool projects I'm working on! ❤️
You can set breakpoints in Node.js via debugger statements, but it could be a hassle to set up and can really slow down your script.
When you're debugging something heavy with slow-startup (eg. server, headless Chrome, etc), you want to use something simple & light to debug.
npm i -D dbgr
import dbgr from 'dbgr'
// Some async process
(async () => {
// ...
await dbgr((resume) => {
console.log('The debugger has started');
// Write code here and hit save to
// automatically re-run this function
// Call resume() and save to resume the debugger
// ↓ The eval below is necessary for this to work
}, _ => eval(_))
})();
Upon invoking dbgr, it detects the file path of the caller by using V8 stack trace API via callsites. It then watches the file for changes using fs.watch. When a change is detected, it parses the source code using acorn to extract the specific function passed into dbgr. It then passes it into the _ => eval(_) to run in the original context.
Yes. While the AST parser acorn is designed for ES parsing, TS files can be loosely parsed via acorn-loose, and the content inside the dbgr hook has the types stripped via esbuild for it to be "safely" eval()'d by the JavaScript runtime.
FAQs
Lightweight debugger for Node.js
The npm package dbgr receives a total of 12 weekly downloads. As such, dbgr popularity was classified as not popular.
We found that dbgr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.