Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
angular-extender
Advanced tools
Extend AngularJS applications by injecting module dependencies at build time
Extend AngularJS applications by injecting module dependencies at build time (using static code transformations).
For example transforms this:
angular.module('moduleName', ['dependency']);
into that
angular.module('moduleName', ['dependency', 'additionalDependency']);
Nowadays having a project using Grunt (or any other similar tool) for workflow automation and asset management is not uncommon. So the idea with this small library is to provide a way to implement a simple plugin system for AngularJS applications using only static code transformations. This has two main advantages (compared to extending the module with dynamic tricks):
The main use case for such a system is when you have an AngularJS based application and you want to allow third party modules (plugins) to exend you core app without hardcoding those new dependencies.
var angularExtend = require('angular-extend');
var src = "angular.module('moduleName', ['aModule']);";
var res = angularExtend(src, {moduleName: ['aPlugin']});
/*
res.out will be:
angular.module('moduleName', ['aModule', "aPlugin"]);
res.changed is a boolean and will tell if any extension was applied at all.
*/
A grunt plugin using this library will be soon available at https://github.com/mariocasciaro/grunt-angular-extender
The transformation will work only if you follow the convention of delaring modules like
angular.module(<string>, [<strings>]);
Using variables or functions to define the module name, will fail.
Thanks to olov and his project ng-annotate for the inspiration he gave me to build this little tool.
FAQs
Extend AngularJS applications by injecting module dependencies at build time
We found that angular-extender 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
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.