A class for loading, verifying, and creating plugins. Used by DocPad for years.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
source
test-fixtures
.editorconfig
.eslintrc.js
.gitignore
.npmignore
.travis.yml
CONTRIBUTING.md
HISTORY.md
LICENSE.md
README.md
index.js
package-lock.json
package.json
test.js

README.md

@bevry/pluginloader

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
Patreon donate button Open Collective donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

A class for loading, verifying, and creating plugins. Used by DocPad for years.

Install

NPM

  • Install: npm install --save @bevry/pluginloader
  • Module: require('@bevry/pluginloader')

Editions

This package is published with the following editions:

  • @bevry/pluginloader aliases @bevry/pluginloader/index.js which uses Editions to automatically select the correct edition for the consumers environment
  • @bevry/pluginloader/source/index.js is esnext source code with require for modules
  • @bevry/pluginloader/edition-node-0.10/index.js is esnext compiled for node.js >=0.10 with require for modules

Usage

Complete API Documentation.

Basics

Create your project:

  1. mkdir my-project
  2. cd my-project

Create your plugin:

  1. mkdir myplugin

  2. cd myplugin

  3. npm init

  4. index.js to:

    module.exports = function (BasePlugin) {
        return class MyPlugin extends BasePlugin {
            constructor (...args) {
                super(...args)
                console.log('hello from my plugin')
            }
        }
    }
  5. cd ..

Create your plugin loader:

  1. mkdir myapp

  2. cd myapp

  3. npm init

  4. index.js to:

    class BasePlugin {
        constructor () {
            console.log('hello from base plugin')
        }
    }
    const PluginLoader = require('@bevry/pluginloader')
    const pluginLoader = new PluginLoader({
        BasePlugin,
        pluginPath: require('path').resolve(__dirname, '..', 'myplugin')
    })
  5. cd ..

Run the project:

  1. node myapp/index.js

Ecosystem

History

Discover the release history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

  • Benjamin Lupton

Sponsors

No sponsors yet! Will you be the first?

Patreon donate button Open Collective donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

License

Unless stated otherwise all works are:

  • Copyright © 2018+ Benjamin Lupton

and licensed under: