node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป



jigsaw is a plugin loader for extensible node.js projects.


loading + unloading plugins

var PluginLoader = require('jigsaw');

var myPluginLoader = new PluginLoader('/path/to/plugin/directory');

// give each plugin access to some API methods
	someMethodForPluginsToUse: ...,
	someOtherMethodForPluginsToUse: ...,
	someVariableForPluginsToUse: ...,


// some time later

plugins look like this

function enable(api) {
	// perform initialization here
	// 'api' is the object that was passed to loadAll(...) in the first code sample

function disable() {
	// perform cleanup (if you have to do any) here


// plugins should be valid node modules
module.exports = {
	enable: enable,    // required โ€“ called when your plugin is loaded
	disable: disable,  // optional โ€“ if provided, called when your plugin is unloaded
	name: 'MyPlugin',  // optional โ€“ if not provided, defaults to name of file containing plugin code


jigsaw is made available under the MIT License. See LICENSE for details.