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

diagnostics_channel

v1.1.0

Published

Exposes a polyfill for the Node.js module diagnostics_channel

Downloads

2,725,565

Readme

diagnostics_channel-polyfill

Exposes a polyfill for the Node.js module diagnostics_channel.

As of now, the Node.js module diagnostics_channel is only available in Node ^14.17.0 || >=15.1.0. This aim to allow using the same API on older versions of Node.

Install

npm i diagnostics_channel

Usage

Refer to the official documentation: https://nodejs.org/api/diagnostics_channel.html

Notes

  • This module and the one included in Node core do NOT share the same channels, they live independently.
  • Since WeakReference is not available, channels will NOT be garbage collected when no reference is held in user-land. An additional function is provided to do manual cleanup if needed: dc.deleteChannel(). This should not be needed in a typical scenario. Only use this method if you know why you are doing it.
const dc = require('diagnostics_channel');

const a = dc.channel('test');
const b = dc.channel('test');

// channel is memoized
console.log(a === b); // true

dc.deleteChannel('test');

const c = dc.channel('test');

// memoized channel was deleted and a new instance was memoized
console.log(a === c); // false
  • Since ERR_INVALID_ARG_TYPE is not available, a simplfied copy of this error is included.
  • Since triggerUncaughtException() is not available, if an exception is thrown in a subscriber, the polyfill will instead simply re-throw the error inside a process.nextTick(), which has a similar behavior except when the process crashes because of that exception: the crash message will point to this polyfill instead of where the error was created (ie: in the subscriber).