christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
915 stars 211 forks source link

Export the module names for various modules #345

Closed mgol closed 7 years ago

mgol commented 8 years ago

Fix #326

mgol commented 8 years ago

The whole module import examples:

CommonJS:

const uiRouterExtras = require('ui-router-extras');
angular.module('myModule', [uiRouterExtras]);

ES6 (when used with Webpack etc.):

import uiRouterExtras from 'ui-router-extras';
angular.module('myModule', [uiRouterExtras]);

I've also added exports for separate nodules, example:

import uiRouterExtrasTransition from 'ui-router-extras/modules/transition';
angular.module('myModule', [v]);
mgol commented 8 years ago

Remaining issues:

  1. It'd be good to test it somehow.
  2. Currently the dependencies lists are duplicated, they need to be provided both in the original files as module names and in the ./modules/*.js files in the form of require-ing everything that's required (no pun intended).

WDYT?

christopherthielen commented 8 years ago

Thanks for the PR!

I think these exports belong in the individual source files like src/dsr.js. Then, the angular module name will also be included into the bundled files too (which go onto the CDNs, etc)

Here's what I'm talking about: https://github.com/christopherthielen/ui-router-extras/compare/export_module_names?expand=1

The downside is that without the commonjs modules/* from your PR, we don't get the automaticrequire()ing of the dependent modules like ui-router-core. I'd love to convert to a commonjs + webpack build, but at this point in ui-router-extras lifespan I'm wary of changing things up much.

mgol commented 8 years ago

We could check if we're in a CommonJS environment and require dependencies then. Something like: https://github.com/krispo/angular-nvd3/blob/v1.0.9/src/angular-nvd3.js#L7-L11

mgol commented 8 years ago

@christopherthielen What do you think about my proposal?

christopherthielen commented 8 years ago

@mgol that sounds like a reasonable approach. Want to update your PR?

mgol commented 8 years ago

Sure! Just not today. :)

mgol commented 7 years ago

I assume this PR is no longer needed since the whole repository is EOL'd.