
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
amdine is a dependency resolution for nodeJs.
Import dependencies based on path (require("../whatever")
, import a from './foo'
) is a bad idea, cause is difficult mock.
Also, some people don't like classes on javascript.
This library try to solve doing resolution based on name, with AMD flavour (not in deep).
import amdine from 'amdine';
// import all your modules that use amdine
amdine.init();
define
function is the core. Use it to define modules.
define = (factory: Function) => void;
define = (name: string, factoryOrValue: Function) => void;
define = (dependencies: string[], factory: Function) => void;
define = (name: string, dependencies: string[], factory: Function) => void;
Examples:
define('my-object', function(){ return {} as myModule });
define('my-object', {value: 'hello'});
define('my-number', 42);
define('logger', function () {
return { log: console.log };
});
define('my-task', ['logger'], function (logger) {
logger.log('hello in task');
});
define('state', function () {
function createState(){
const state = {};
function setState(newState) {
state = newState;
}
return [state, setState];
}
return createState;
});
define('my-mod', ['state', 'logger'], function (createState, logger) {
const [ state, setState ] = createState;
logger.log(state);
});
For more examples look examples folder
Following last example:
const state = admine.get('state');
state; // [state, setState]
FAQs
amdine is a dependency resolution for nodeJs.
The npm package amdine receives a total of 1 weekly downloads. As such, amdine popularity was classified as not popular.
We found that amdine 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.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.