klei / ng-dependencies

Analyze javascript code using esprima and return a list of objects representing the angular module dependencies in the code.
21 stars 15 forks source link

Does not work with output of ng-classify #6

Open hans-d opened 9 years ago

hans-d commented 9 years ago
(function () {
    var App;
    App = (function () {
        function App() {
            return ['dep1', 'dep2'];
        }
        return App;
    })();
    angular.module('app', new App());
}).call(this);

breaks on https://github.com/klei/ng-dependencies/blob/master/index.js#L32

The above file is the result of ng-classify followed by coffee -> js on this

class App extends App
   constructor: ->
      return [ 'dep1', 'dep2' ]
joakimbeng commented 9 years ago

Yes, it does not work with ng-classify and I don't see a good solution for it either, I'm afraid.

My suggested workaround is using the ordinary:

angular.module('app', ['dep1', 'dep2']);

for that instead.

I can see the benefit of using ng-classify as a whole, but actually don't get it for the main app module.

If someone can figure out how to support this I'll gladly accept a PR, but for now I don't think it's worth the struggle.

blai commented 9 years ago

can ng-classify improve the output format for App? The above generated code seems a bit bulky and I have hard time seeing the reason behind it. I think an enhancement to this line (or the logic behind it) would help solve this.