Skip to content

Commit 8e1d53b

Browse files
committed
feat(router): adds the router to the self-executing bundle.
Due to limitation of system build, the router cannot have its own sfx bundle. Fixes an issue with RouteConfig decorator by moving it into its own file.
1 parent f5b56c6 commit 8e1d53b

File tree

6 files changed

+20
-13
lines changed

6 files changed

+20
-13
lines changed

gulpfile.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,6 @@ gulp.task('bundle.js.dev', ['build.js.dev'], function() {
616616
{ sourceMaps: true });
617617
});
618618

619-
// TODO: remove redundancies with router and angular bundles
620-
// development router build
621619
gulp.task('router.bundle.js.dev', ['build.js.dev'], function() {
622620
var devBundleConfig = merge(true, bundleConfig);
623621
devBundleConfig.paths =
@@ -626,8 +624,8 @@ gulp.task('router.bundle.js.dev', ['build.js.dev'], function() {
626624
});
627625
return bundler.bundle(
628626
devBundleConfig,
629-
'angular2/router',
630-
'./dist/build/router.dev.js',
627+
'angular2/router - angular2/angular2',
628+
'./dist/bundle/router.dev.js',
631629
{ sourceMaps: true });
632630
});
633631

@@ -647,7 +645,7 @@ gulp.task('bundle.js.sfx.dev', ['build.js.dev'], function() {
647645
'angular2/angular2_sfx',
648646
'./dist/build/angular2.sfx.dev.js',
649647
{ sourceMaps: true },
650-
/* self-exectuting */ true);
648+
/* self-executing */ true);
651649
});
652650

653651
gulp.task('bundle.js.prod.deps', ['bundle.js.prod'], function() {
@@ -669,14 +667,12 @@ var JS_DEV_DEPS = ['node_modules/zone.js/zone.js',
669667
gulp.task('bundle.js.dev.deps', ['bundle.js.dev'], function() {
670668
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']), 'angular2.dev.js')
671669
.pipe(insert.append('\nSystem.config({"paths":{"*":"*.js","angular2/*":"angular2/*"}});\n'))
672-
.pipe(insert.append('\nzone = zone.fork(Zone.longStackTraceZone);\n'))
673670
.pipe(gulp.dest('dist/bundle'));
674671
});
675672

676673
gulp.task('bundle.js.sfx.dev.deps', ['bundle.js.sfx.dev'], function() {
677674
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']),
678675
'angular2.sfx.dev.js')
679-
.pipe(insert.append('\nzone = zone.fork(Zone.longStackTraceZone);\n'))
680676
.pipe(gulp.dest('dist/bundle'));
681677
});
682678

modules/angular2/angular2_sfx.es6

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import * as angular from './angular2';
2+
// the router should have its own SFX bundle
3+
// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2',
4+
// is not support by system builder.
5+
import * as router from './router';
6+
7+
angular.router = router;
28

39
var _prevAngular = window.angular;
410

511
/**
612
* Calling noConflict will restore window.angular to its pre-angular loading state
7-
* and return the angular module object.
13+
* and return the angular module object.
814
*/
915
angular.noConflict = function() {
1016
window.angular = _prevAngular;

modules/angular2/router.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export {Router} from './src/router/router';
1010
export {RouterOutlet} from './src/router/router_outlet';
1111
export {RouterLink} from './src/router/router_link';
1212
export {RouteParams} from './src/router/instruction';
13-
export {RouteConfig} from './src/router/route_config_annotation';
13+
export * from './src/router/route_config_annotation';
14+
export * from './src/router/route_config_decorator';
1415

1516
import {Router, RootRouter} from './src/router/router';
1617
import {RouteRegistry} from './src/router/route_registry';
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
export {RouteConfig as RouteConfigAnnotation} from './route_config_impl';
2-
3-
import {makeDecorator} from 'angular2/src/util/decorators';
4-
5-
export var RouteConfig = makeDecorator(RouteConfig);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
library angular2.router.route_config_decorator;
2+
3+
/** This file is intentionally empty, as Dart does not have decorators */
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {RouteConfig as RouteConfigAnnotation} from './route_config_impl';
2+
import {makeDecorator} from 'angular2/src/util/decorators';
3+
4+
export var RouteConfig = makeDecorator(RouteConfigAnnotation);
5+

0 commit comments

Comments
 (0)