
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
evented-require
Advanced tools
Require modules and receive events.
var EventedRequire = require('evented-require');
var basedir = process.cwd(); // or __dirname, etc
var loader = new EventedRequire(basedir);
var foo = loader.require('./foo'); // requires relative to basedir
var expect = loader.require('expect'); // requires from node_modules
loader.on('before', function(moduleName) {
// emitted with the moduleName before that module is required
});
loader.on('success', function(moduleName, result) {
// emitted with the moduleName and the result of the require when a module is successfully required
});
loader.on('failure', function(moduleName, error) {
// emitted with the moduleName and the error of the require when a module fails to load
});
// loads a series of module in order, filtering out duplicate entries
loader.requireAll([
'./foo.js',
'./bar.js'
]);
new EventedRequire(basedir)Constructs a new EventEmitter instance. Requires made using this instance will be relative to the basedir given.
instance.require(moduleName)Instance method for requiring modules relative to the basedir of the instance. Emits events for before, success, and/or failure depending on the outcome of the require. Returns the result of the require if successful.
instance.requireAll(moduleNames)Instance method for requiring an array of modules in order. Removes duplicates in the array before requiring them. Emits the same events as instance.require for each module. Doesn't return anything.
instance.on('before', function(moduleName) {})Emits the before event before a module is required. Provides the module name to the callback.
instance.on('success', function(moduleName, module) {})Emits the success event after a module is required successfully. Provides the module name and the result of the require to the callback.
instance.on('failure', function(moduleName, error) {})Emits the failure event after a module fails to load. Provides the module name and the error to the callback.
MIT
FAQs
Require modules and receive events.
The npm package evented-require receives a total of 2 weekly downloads. As such, evented-require popularity was classified as not popular.
We found that evented-require demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.