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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pluggers

v3.0.2

Published

A convenient plugin manager library

Readme

Pluggers

npm CircleCI Codecov

A convenient plugin manager library.

pluggers is designed to make modular projects easier to create. recursive-install is recommended for making plugins truly independent.

Warning: there are breaking changes for those who are upgrading from pre-v3 to v3.

Features & Plans

  • [x] Synchronous or Asynchronous plugin loading
  • [x] Flexible access between plugins
  • [x] Priority-based load order (explicit or automatic)

Installation

Use the package manager npm to install pluggers.

npm install --save pluggers

Usage

./plugin1.js

// ./plugin1.js
const Plugger = require("pluggers").default;

const plugin = new Plugger("plugin1");

plugin.pluginCallbacks.init = () => {
  const test = "Hello World!";
  return test;
};

module.exports = plugin;

./plugin2.js

// ./plugin2.js
const Plugger = require("pluggers").default;

// Error will be thrown if the plugin is using a used name ("plugin1") when loaded
const plugin = new Plugger("plugin2");

// Error will be thrown if a plugin named "plugin1" is not loaded
plugin.requirePlugin({ name: "plugin1" });

plugin.pluginCallbacks.init = (plugins) => {
  const { plugin1 } = plugins;
  console.log(plugin1);
};

module.exports = plugin;

./master.js

// ./master.js
const Plugger = require("pluggers").default;

// Create instance
const master = new Plugger("master");

// Add plugins
master.addPlugin(require("./plugin1"));
master.addPlugin(require("./plugin2"));

master.initAll().then(() => {
  console.log("Complete!");
});

The above codes will print "Hello World!" and then "Complete!" if master.js is executed.

API

Check out this documentation page.

How Priorities Work

There are 3 types of priorities that can be used, in order of the load order:

  • Positive priority, which is from 0 to Infinity.
    Plugins with positive number priorities will be initialized with the order from the lowest number (0) to the highest number (Infinity).

  • Undefined priority
    Plugins with undefined priorities will be initialized after plugins with positive number priorities with the order of which plugin gets loaded with addPlugin() first.

  • Negative priority, which is from -Infinity to -1.
    Negative priorities work like how negative indexes work in Python (ex: a plugin with the priority of -1 will be initialized last, -2 will be initialized second last, etc). Plugins with negative priorities will be processed after plugins with positive number priorities and undefined priorities, with the order from the lowest number (-Infinity) to the highest number (-1), and will be initialized according to their respective priorities.

All types of priorities are stackable, for example:

...
loader.addPlugin(plugin1, { priority: 1 }); // this will be initialized first
loader.addPlugin(plugin2, { priority: 1 }); // this will be initialized after 'plugin1'. Note that its priority is the same as 'plugin1'

loader.initAll();

Because of their nature, plugins with negative priorities will be processed differently:

...
loader.addPlugin(plugin1, { priority: 1 }); // this will be initialized first
loader.addPlugin(plugin2, { priority: 1 });

loader.addPlugin(plugin3, { priority: -2 }) // this will be initialized after 'plugin1', before 'plugin2'
loader.addPlugin(plugin4, { priority: -1 }) // this will be initialized after 'plugin2'

loader.initAll(); // Load order: 'plugin1', 'plugin3', 'plugin2', 'plugin4'

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT