Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hemera-plugin

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hemera-plugin

This is a plugin helper for hemera

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
4.9K
increased by5.01%
Maintainers
1
Weekly downloads
 
Created
Source

Hemera-plugin package

npm styled with prettier

hemera-plugin is a plugin helper for Hemera.

Usage

hemera-plugin can do some things for you:

  • Check the bare-minimum version of Hemera
  • Provide consistent interface to register plugins even when the api is changed
  • Pass metadata to intialize your plugin with correct dependencies, default options and name.

Example:

const hp = require('hemera-plugin')

module.exports = hp(function (hemera, opts, next) {
  next()
})

If you need to set a bare-minimum version of Hemera for your plugin, just add the semver range that you need:

const hp = require('hemera-plugin')

module.exports = hp(function (hemera, opts, next) {
  next()
}, '0.x')

You can check here how to define a semver range.

Async / Await

const hp = require('hemera-plugin')

module.exports = hp(async function (hemera, opts) {
  // your plugin code
}, '0.x')

You can also pass some metadata that will be handled by Hemera, such as the dependencies, default options and the name of your plugin.

const hp = require('hemera-plugin')

function plugin (hemera, opts, next) {
  // your plugin code
  next()
}

module.exports = hp(plugin, {
  hemera: '0.x', // bare-minimum version of Hemera
  name: 'my-plugin', // name of your plugin, will be used e.g for logging purposes
  dependencies: ['plugin2'], // won't be checked until you use `hemera.checkPluginDependencies(plugin)`
  options: { host: 'localhost', port: 8003 } // default options for your plugin
})

Credits

fastify-plugin

FAQs

Package last updated on 11 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc