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

pondgraph

v1.0.0

Published

Object trace/analysis tool

Downloads

1

Readme

Pondgraph

JS runtime inspection tool

Let's you build graphs from object interactions cross source-files and modules. The graph is assembled by parsing the output of SOS

Like dropping a pebble into a pond and observing the ripples

Usage Example

Given the following Example.js

const PondGraph = require('pondgraph')
const { EventEmitter } = require('events')
const pgraph = new PondGraph()

// The object we want to trace
const myObj = {
  a: 'hello',
  b: 3,
  greet (name) {
    console.log('hey', name)
  }
}

// Wrap your object in a tracing proxy
const proxy = pgraph.trace('My Object', myObj)
// From this point on pass the proxy-reference instead
// of the genuine object.

// Any interaction with the proxy object
// will be logged and can later be rendered as a graph.
proxy.what = 4
proxy.undefinedProp
proxy.bye = console.log.bind(null, 'bye')

// Simulate an event emitter
const emitter = new EventEmitter()
emitter.on('connect', proxy.greet)
emitter.emit('connect', 'Alex')

process.nextTick(() => {
  proxy.bye()
  console.log('Mermaid graph: ',pgraph.mermaidUrl())
})

Running the example above should produce the following output:

$ node example.js
hey Alex
bye
Mermaid graph:  https://mermaidjs.github.io/mermaid-live-editor/#/view/eyJjb2RlIjoiZ3JhcGggQlRcbnN1YmdyYXBoIE15IE9iamVjdFxuICB3aGF0XG4gIHVuZGVmaW5lZFByb3BcbiAgYnllXG4gIGdyZWV0XG5lbmRcbm4wW2V4YW1wbGUuanNdIC0tPiBmMShPYmplY3QuPGFub255bW91cz4pXG5uMltldmVudHMuanNdIC0tPiBmMyhFdmVudEVtaXR0ZXIuZW1pdClcbm4wIC0tPiBmNChwcm9jZXNzLm5leHRUaWNrKVxuZjEtLXNldC0tPndoYXRcbmYxLS1nZXQtLT51bmRlZmluZWRQcm9wXG5mMS0tc2V0LS0+YnllXG5mMS0tZ2V0LS0+Z3JlZXRcbmYzLS1pbnZva2UtLT5ncmVldFxuZjQtLWdldC0tPmJ5ZVxuZjQtLWludm9rZS0tPmJ5ZSIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0In19

If the graph below looks wonky, try the direct preview

example graph

API

const graph = new Pondgraph(opts = {})

Initializes a new graph.

  • opts.root path to resolve source-paths to, default: process.cwd()

const proxy = graph.trace(label, target)

  • label A string naming the target instance
  • target An object that you want to trace.

Initializes a and returns a new object proxy.

graph.toDot()

Generates a dot graph

graph.toMermaid()

Generates a mermaid graph.

graph.mermaidUrl(mode = 'view')

Returns an url to Mermide Live Editor

  • mode 'view' | 'edit', defaults to 'view'

License

This software is licensed as GNU GPLv3 or later.