Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
use-plugin
Advanced tools
There is annotated source code for this module.
For use in framework modules to provide a plugin mechanism for extensions. While a simple require in calling code is a good start, this plugin provides some convenience abstractions over vanilla requires so that you can offer a more user-friendly interface.
See the seneca module for an example of practical usage.
// myframework.js
module.exports = function() {
var use = require('use-plugin')({prefix:'foo',module:module})
return {
use: function( plugin_name ) {
var plugin_properties == use(plugin_name)
// call the init function to init the plugin
plugin_properties.init()
}
}
}
// callingcode.js
var fm = require('myframework')
// this will try to load:
// 'bar', 'foo-bar', './foo', './foo-bar'
// against the framework module, and then the callingcode module
// nice error messages are thrown if there are problems
fm.use('bar')
The module provides a builder function that you call with your desired options. In particular, you should always set your module, as above.
The builder function returns a plugin loader function that you can use inside your framework. Calling the loader function returns an object with properties that describe the plugin.
In particular, the point of this module is to resolve (via require), the init function of the plugin, so that you can call it in your framework.
See the annotated source code for full details.
If you're using this module, feel free to contact me on twitter if you have any questions! :) @rjrodger
Current Version: 0.1.4
Tested on: node 0.10.26
FAQs
Generic plugin loader functionality for Node.js frameworks.
The npm package use-plugin receives a total of 7,124 weekly downloads. As such, use-plugin popularity was classified as popular.
We found that use-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.