README
@bevry/pluginloader
A class for loading, verifying, and creating plugins. Used by DocPad for years.
Usage
Basics
Create your project:
mkdir my-projectcd my-project
Create your plugin:
mkdir myplugincd mypluginnpm initindex.jsto:module.exports = function (BasePlugin) { return class MyPlugin extends BasePlugin { constructor(...args) { super(...args) console.log('hello from my plugin') } } }cd ..
Create your plugin loader:
mkdir myappcd myappnpm initindex.jsto:import PluginLoader from '@bevry/pluginloader' class BasePlugin { constructor() { console.log('hello from base plugin') } } const pluginLoader = new PluginLoader({ BasePlugin, pluginPath: require('path').resolve(__dirname, '..', 'myplugin'), })cd ..
Run the project:
node myapp/index.js
Ecosystem
- pluginclerk a project for fetching compatible plugins from the npm registry
- docpad-baseplugin the BasePlugin class that DocPad uses
- docpad-plugintester testing helpers for DocPad plugins
Install
- Install:
npm install --save @bevry/pluginloader - Import:
import pkg from ('@bevry/pluginloader') - Require:
const pkg = require('@bevry/pluginloader').default
Editions
This package is published with the following editions:
@bevry/pluginloader/source/index.tsis TypeScript source code with Import for modules@bevry/pluginloaderaliases@bevry/pluginloader/edition-esnext/index.js@bevry/pluginloader/edition-esnext/index.jsis TypeScript compiled against ESNext for Node.js 10 || 12 || 13 || 14 with Require for modules@bevry/pluginloader/edition-node-esm/index.jsis TypeScript compiled against ESNext for Node.js with Import for modules
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:
Sponsors
No sponsors yet! Will you be the first?
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: