npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pDebug

v1.0.0

Published

Programmable pure Javascript bindings for the V8 Debugger

Downloads

2

Readme

Programmable Debugger for NodeJS/V8

Ever wanted to fully control/program the debugging process? Now you can using this module to connect and talk to the V8 debugger underyling your running NodeJS code!

To see the protocol check out: [http://code.google.com/p/v8/wiki/DebuggerProtocol]

Start your program like this:

% node --debug-brk MyScript.js

In another window run a script like this:

var pDebug = require('./index.js').pDebug
    , debug = new pDebug({ eventHandler: function(event) { console.log('Event'); console.log(event); } })
;

debug.connect(function() { 
    var msg = { command: 'continue' };
    debug.send(msg, function(req, resp) {
            console.log('REQ: ');
            console.log(req);

            console.log('RES: ');
            console.log(resp);
    });
});

Looking at the V8 Debugger protocol above you can interact with the V8 debugger progammatically, just create message Ojbects that look just like what is documented on the V8 Debugger page and send them off & your callback will get executed when V8 responds.

You can/should also provide an 'eventHandler' to the construtor to handle events that tend to pop up - like 'afterCompile' and breakpoints.

Your NodeJS process running remotely? No problem!

new pDebug({host: 'some.other.host'});

Your NodeJS process running on some other port? No problem!

% node --debug-brk=9999 MyScript.js

new pDebug({port: 9999});

API

Constructor

Accepts an optional object containing host (default: 'localhost'), port (default 5858), eventHandler function callback.

The eventHandler callback will get called with one paramter - the event received.

connect

When you are ready to connect to a NodeJS/V8 debugger instance, call this.

One paramter is a function callback to be exercised after the connection is established - now you can start sending/receiving messages

send

Send a request to the V8 debugger. The various messages (and their responses) and their paramters are documented in that first link above.

Accepts up to 3 paramters:

object: This is the request object and is required. pDebug will handle sequence numbers for you so do not worry about that

callback: This function will get called back with the V8 response. The paramter list for this function is (request, response) where 'request' is your original request and 'response' is the V8 response. 'this' for this callback can optionally be set by the next paramter, otherwise 'this' is the pDebug object.

thisp: An optional object paramter, if provided 'this' in your response callback will be thisp, otherwise 'this' in the callback is your pDebug object.

disconnect

Disconnect from the V8 debugger