
Security News
Deno 2.4 Brings Back deno bundle, Improves Dependency Management and Observability
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
load and cache libraries and configs using the require system for easy access
This is a small module for making library and config loading 100x easier but mostly just less verbose.
This is an example library structure
|_ index.js
|_ libRunning.js
|_ systemLib/
|_ settings.json
|_ awesome_system_module/
|_ index.js
Place this statment where ever you want to first cache your library. You can only call this once per library otherwise you will recieve an error.
// index.js
require('lib-loader').load({
// this is the directory your library files reside
libDir: './systemLib', // defaults to process.cwd()+'/lib'
// this is the key the library will be cached under
libKey: 'system', // defaults to 'lib'
});
You can access your cached libraries by using this statment. Notice I use the .system
attribute. This is determined by the value we place in libKey
.
All files and folders are required
and cached under require('lib-loader')
for easy access.
// libRunning.js
var system = require('lib-loader').system;
system.settings // equivalent to the return of require('./systemLib/settings.json')
system.awesome_system_module // equivalent to the return of require('./systemLib/awesome_system_module/index.js');
If you are like me you may have several libraries to load.
require('lib-loader').loadMany([
{ libDir: 'systemLib', libKey: 'system' },
{ libDir: 'webLib', libKey: 'web' },
{ libDir: 'systemLib2', libKey: 'system2' }
]);
Exclude files using globs checkout minimatch for what is possible.
require('lib-loader').load({
libDir: './lib',
libKey: 'lib',
exclude: [
'*.json',
'iDontWantToLoadThis.js'
]
});
Checkout the tests
directory for a real example.
FAQs
load and cache libraries and configs using the require system for easy access
The npm package lib-loader receives a total of 5 weekly downloads. As such, lib-loader popularity was classified as not popular.
We found that lib-loader 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
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.