What an interesting approach to have a way to interconnect modules between 
each other in an easy way.

Is Browserify in the picture?

BTW, I've been working on having a similar model using RequireJS, described 
on my "Large AngularJS application" post series specifically the one where 
I talk about the components 
<http://leog.me/log/large-angularjs-app-components> of an architecture I 
came up with.

Regards.

On Wednesday, January 14, 2015 at 12:51:20 AM UTC-2, Ben Clinkinbeard wrote:
>
> Summary
>
> Change the publish script to support idiomatic CommonJS usage when 
> installed from npm.
>
> Motivation
>
> Now that the Angular modules are available on npm, supporting proper 
> CommonJS use via require() is the next logical step. This use case is 
> widely expected by developers using npm for dependency management.
>
>
> Without this change, developers still have to use a script tag to include 
> Angular modules from within the node_modules folder. This is extremely 
> uncommon with npm packages, and does nothing to enable Browserify and 
> webpack support.
>
> Compatibility Risk
>
> Little to no risk as only the publish shell script needs to be changed.
>
> Ongoing Technical Constraints
>
> There should be virtually no ongoing maintenance needed since it's just a 
> publish script.
>
> Plans for Implementation
>
> Simple changes to the publish script will be made to remove the main field 
> from the package.json files and generate an index.js file for each package 
> so that it is used when requiring by name. The index.js file will require() 
> the standard built file and export a value(s) appropriate for the module.
>
>
> The core angular module will export the angular object.
>
>
> The supporting modules will export their module name (ngAnimate, ngRoute, 
> etc.) with the exception of angular-mocks, which exports 3 values: ngMock, 
> ngMockE2E, ngAnimateMock
>
>
> This would enable code akin to the following:
>
>
> var angular = require('angular');
>
> angular.module('app', [
>
> require('angular-animate'),
>
> require('angular-route'),
>
> require('angular-mocks').ngMock
>
> ]);
>
> Prior Art
> The overwhelming expectation, when a developer installs a package from 
> npm, is that they can then use require('package-name') to load it. This 
> change will bring Angular in line with the rest of the npm ecosystem.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to