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

node-alice

v1.2.0

Published

Get a visualization of the call stack during the lifetime of a request.

Downloads

20

Readme

Node Alice

Down the rabbit hole...

A tool which renders a visualization of the call stack during the entire lifetime of a request. Showing all parent<->child relationships following any nesting. Basically it shows every line of code executed during the request, and by what.

Any parent file it does not recognise (or running in a new tick) will be placed at the top level (i.e. Express/React/react-router/Promises etc) for now.

alt tag

Alice defaults to just showing the file name to give the user the option to show/hide that files executed code.

alt tag

With Chrome Extension (much more fluid experience)

Setup

1. npm install -g node-alice
2. // install chrome extension at https://chrome.google.com/webstore/detail/node-alice/bhllciafajoolibfgpoknippnclemole/
3. node-alice <your-entry-file>.js --with-ext --port:<some-free-port>

Without --port it will default to 8080. Any custom port set here must also be added into the Chrome Extension 'options' section.

Usage

1. // open your app in the browser
2. // Click the Chrome Extension

You can immediately run a new request in the browser and the extension data will update when you open the Extension. Allowing for a much less clunky experience.

Without the Chrome Extension

Setup

1. npm install -g node-alice
2. node-alice <entry-file>.js

Usage

1. // open your app in the browser
2. // turn the app off via <ctrl+c>
3. open alice-analyser.html

Features:

  • Toggle all file contents open/closed
  • Filter by any file name
  • Toggle filtered file name open/closed

FAQ

Why would I use this tool?

To help understand and learn (and perhaps debug) exactly what runs and from where with your application. Easily find any deep nesting and how often it is called. You can observe the code which is being run at run-time.

What is the benefit over other server-side debuggers?

Of course tools like iron-node and node debug can show you similar information, but Alice requires no code statements or additional/multiple clicking and produces an easy to read and follow tree in 1 click.

Does it work if my app uses Babel?

As its storing exactly what code is executed, if you use a transpiler (e.g. Babel) it will show the post-compiled code.

If you used babel-node CLI you must define a .babelrc or "babel": {} block in your package.json in order for node-alice to run. Without the correct presets and plugins your app wont work.

This is because node-alice uses a require-hook and babel checks up the tree for .babelrc (not down), so will not have any presets/plugins set for it. Help can be found https://babeljs.io/docs/usage/babelrc/.

Some code seems to repeat, why?

Any use of iterations may print repetitive code, as it represents exactly what is run.

Can I use it with Webpack?

Can be used with Webpack but only if the Node CLI command is run against the entry js file (ideally with the Chrome Extension).

Bugs/feedback

Please feel free to create an issue or email me to let me know about any bugs you discover. I would appreciate any help. Thanks

Comming Soon:

  • Stats section (longest call stack, number of new ticks, worse offender).
  • Add whitelist to recognise common parents (e.g. React/react-router/Express/Node/Promises)