JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20546
  • Score
    100M100P100Q128352F
  • License MIT

Package Exports

  • ng-dependencies

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng-dependencies) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#ng-dependencies

Analyze javascript code using esprima and return a list of objects representing the module dependencies in the code.

This is based on gulp-angular-filesort. I extracted the module dependency code because I need to find a way to dynamically generate a root angular module that depends on a list of angular modules as Bower packages.

Usage

var fs = require('fs');
var ngDeps = require('ng-dependencies');

var deps = ngDeps(fs.readFileSync('./someNgModule.js'));

console.log(deps);

If the content of ./someNgModle.js is as following:

angular.module('test', ['one']).run(function () {
  // run some logic
});
angular.module('another', []);
angular.module('another').Controller('Ctrl', ['$scope', function ($scope) {
  // some controller logic
}]);
angular.module('useThis').run(function () {
  // ...
});

This will output:

[
  {
    uses: ['one', 'useThis']
  },
  {
    name: 'test',
    uses: ['one']
  },
  {
    name: 'another',
    uses: []
  }
]