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.
This commit is contained in:
Rado Kirov 2015-05-04 17:57:28 -07:00
parent f5b56c627b
commit 8e1d53b5e9
6 changed files with 20 additions and 13 deletions

View File

@ -616,8 +616,6 @@ gulp.task('bundle.js.dev', ['build.js.dev'], function() {
{ sourceMaps: true });
});
// TODO: remove redundancies with router and angular bundles
// development router build
gulp.task('router.bundle.js.dev', ['build.js.dev'], function() {
var devBundleConfig = merge(true, bundleConfig);
devBundleConfig.paths =
@ -626,8 +624,8 @@ gulp.task('router.bundle.js.dev', ['build.js.dev'], function() {
});
return bundler.bundle(
devBundleConfig,
'angular2/router',
'./dist/build/router.dev.js',
'angular2/router - angular2/angular2',
'./dist/bundle/router.dev.js',
{ sourceMaps: true });
});
@ -647,7 +645,7 @@ gulp.task('bundle.js.sfx.dev', ['build.js.dev'], function() {
'angular2/angular2_sfx',
'./dist/build/angular2.sfx.dev.js',
{ sourceMaps: true },
/* self-exectuting */ true);
/* self-executing */ true);
});
gulp.task('bundle.js.prod.deps', ['bundle.js.prod'], function() {
@ -669,14 +667,12 @@ var JS_DEV_DEPS = ['node_modules/zone.js/zone.js',
gulp.task('bundle.js.dev.deps', ['bundle.js.dev'], function() {
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']), 'angular2.dev.js')
.pipe(insert.append('\nSystem.config({"paths":{"*":"*.js","angular2/*":"angular2/*"}});\n'))
.pipe(insert.append('\nzone = zone.fork(Zone.longStackTraceZone);\n'))
.pipe(gulp.dest('dist/bundle'));
});
gulp.task('bundle.js.sfx.dev.deps', ['bundle.js.sfx.dev'], function() {
return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']),
'angular2.sfx.dev.js')
.pipe(insert.append('\nzone = zone.fork(Zone.longStackTraceZone);\n'))
.pipe(gulp.dest('dist/bundle'));
});

View File

@ -1,10 +1,16 @@
import * as angular from './angular2';
// the router should have its own SFX bundle
// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2',
// is not support by system builder.
import * as router from './router';
angular.router = router;
var _prevAngular = window.angular;
/**
* Calling noConflict will restore window.angular to its pre-angular loading state
* and return the angular module object.
* and return the angular module object.
*/
angular.noConflict = function() {
window.angular = _prevAngular;

View File

@ -10,7 +10,8 @@ export {Router} from './src/router/router';
export {RouterOutlet} from './src/router/router_outlet';
export {RouterLink} from './src/router/router_link';
export {RouteParams} from './src/router/instruction';
export {RouteConfig} from './src/router/route_config_annotation';
export * from './src/router/route_config_annotation';
export * from './src/router/route_config_decorator';
import {Router, RootRouter} from './src/router/router';
import {RouteRegistry} from './src/router/route_registry';

View File

@ -1,5 +1 @@
export {RouteConfig as RouteConfigAnnotation} from './route_config_impl';
import {makeDecorator} from 'angular2/src/util/decorators';
export var RouteConfig = makeDecorator(RouteConfig);

View File

@ -0,0 +1,3 @@
library angular2.router.route_config_decorator;
/** This file is intentionally empty, as Dart does not have decorators */

View File

@ -0,0 +1,5 @@
import {RouteConfig as RouteConfigAnnotation} from './route_config_impl';
import {makeDecorator} from 'angular2/src/util/decorators';
export var RouteConfig = makeDecorator(RouteConfigAnnotation);