perf: distrubute smaller bundled code and include es2015 bundle
TypeScript compiler will now build to ES2015 code and modules. Babili is used to minify ES2015 code, providing an initial optimization that we couldn't previously get just from Uglify. Uses Babel to convert ES2015 to UMD/ES5 code, and Uglify to minimize the output.
This commit is contained in:
38
modules/@angular/router/.babelrc
Normal file
38
modules/@angular/router/.babelrc
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": [["transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"@angular/core": "ng.core",
|
||||
"@angular/common": "ng.common",
|
||||
"@angular/platform-browser": "ng.platformBrowser",
|
||||
"@angular/router": "ng.router",
|
||||
|
||||
"rxjs/BehaviorSubject": "Rx",
|
||||
"rxjs/Observable": "Rx",
|
||||
"rxjs/Subject": "Rx",
|
||||
"rxjs/Subscription": "Rx",
|
||||
"rxjs/util/EmptyError": "Rx",
|
||||
|
||||
"rxjs/observable/from": "Rx.Observable",
|
||||
"rxjs/observable/fromPromise": "Rx.Observable",
|
||||
"rxjs/observable/forkJoin": "Rx.Observable",
|
||||
"rxjs/observable/of": "Rx.Observable",
|
||||
|
||||
"rxjs/operator/toPromise": "Rx.Observable.prototype",
|
||||
"rxjs/operator/map": "Rx.Observable.prototype",
|
||||
"rxjs/operator/mergeAll": "Rx.Observable.prototype",
|
||||
"rxjs/operator/concatAll": "Rx.Observable.prototype",
|
||||
"rxjs/operator/mergeMap": "Rx.Observable.prototype",
|
||||
"rxjs/operator/reduce": "Rx.Observable.prototype",
|
||||
"rxjs/operator/every": "Rx.Observable.prototype",
|
||||
"rxjs/operator/first": "Rx.Observable.prototype",
|
||||
"rxjs/operator/catch": "Rx.Observable.prototype",
|
||||
"rxjs/operator/last": "Rx.Observable.prototype",
|
||||
"rxjs/operator/filter": "Rx.Observable.prototype",
|
||||
"rxjs/operator/concatMap": "Rx.Observable.prototype"
|
||||
},
|
||||
"exactGlobals": true
|
||||
}]],
|
||||
"moduleId": "@angular/router"
|
||||
}
|
16
modules/@angular/router/.babelrc-testing
Normal file
16
modules/@angular/router/.babelrc-testing
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": [["transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"@angular/core": "ng.core",
|
||||
"@angular/common": "ng.common",
|
||||
"@angular/common/testing": "ng.common.testing",
|
||||
"@angular/platform-browser": "ng.platformBrowser",
|
||||
"@angular/router": "ng.router",
|
||||
"@angular/router/testing": "ng.router.testing"
|
||||
},
|
||||
"exactGlobals": true
|
||||
}]],
|
||||
"moduleId": "@angular/router/testing"
|
||||
}
|
15
modules/@angular/router/.babelrc-upgrade
Normal file
15
modules/@angular/router/.babelrc-upgrade
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": [["transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"@angular/core": "ng.core",
|
||||
"@angular/common": "ng.common",
|
||||
"@angular/router": "ng.router",
|
||||
"@angular/router/upgrade": "ng.router.upgrade",
|
||||
"@angular/upgrade/static": "ng.upgrade.static"
|
||||
},
|
||||
"exactGlobals": true
|
||||
}]],
|
||||
"moduleId": "@angular/router/upgrade"
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
// This file is not used to build this module. It is only used during editing
|
||||
// by the TypeScript language serivce and during build for verifcation. `ngc`
|
||||
// by the TypeScript language service and during build for verification. `ngc`
|
||||
// replaces this file with production index.ts when it rewrites private symbol
|
||||
// names.
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
"name": "@angular/router",
|
||||
"version": "0.0.0-ROUTERPLACEHOLDER",
|
||||
"description": "Angular - the routing library",
|
||||
"main": "bundles/router.umd.js",
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"main": "./bundles/router.umd.js",
|
||||
"module": "./@angular/router.es5.js",
|
||||
"es2015": "./@angular/router.js",
|
||||
"typings": "./typings/router.d.ts",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"router"
|
||||
|
@ -1,21 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/router/testing/index.js',
|
||||
dest: '../../../dist/packages-dist/router/bundles/router-testing.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.router.testing',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/common': 'ng.common',
|
||||
'@angular/common/testing': 'ng.common.testing',
|
||||
'@angular/platform-browser': 'ng.platformBrowser',
|
||||
'@angular/router': 'ng.router'
|
||||
}
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/router/upgrade.js',
|
||||
dest: '../../../dist/packages-dist/router/bundles/router-upgrade.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.router.upgrade',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/common': 'ng.common',
|
||||
'@angular/router': 'ng.router',
|
||||
'@angular/upgrade/static': 'ng.upgrade.static'
|
||||
}
|
||||
};
|
@ -1,44 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export default {
|
||||
entry: '../../../dist/packages-dist/router/index.js',
|
||||
dest: '../../../dist/packages-dist/router/bundles/router.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.router',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/common': 'ng.common',
|
||||
'@angular/platform-browser': 'ng.platformBrowser',
|
||||
|
||||
'rxjs/BehaviorSubject': 'Rx',
|
||||
'rxjs/Observable': 'Rx',
|
||||
'rxjs/Subject': 'Rx',
|
||||
'rxjs/Subscription': 'Rx',
|
||||
'rxjs/util/EmptyError': 'Rx',
|
||||
|
||||
'rxjs/observable/from': 'Rx.Observable',
|
||||
'rxjs/observable/fromPromise': 'Rx.Observable',
|
||||
'rxjs/observable/forkJoin': 'Rx.Observable',
|
||||
'rxjs/observable/of': 'Rx.Observable',
|
||||
|
||||
'rxjs/operator/toPromise': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/map': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/mergeAll': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/concatAll': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/mergeMap': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/reduce': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/every': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/first': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/catch': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/last': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/filter': 'Rx.Observable.prototype',
|
||||
'rxjs/operator/concatMap': 'Rx.Observable.prototype'
|
||||
},
|
||||
plugins: []
|
||||
};
|
@ -8,6 +8,5 @@
|
||||
|
||||
|
||||
|
||||
export {ROUTES as ɵROUTES} from './router_config_loader';
|
||||
export {ROUTER_PROVIDERS as ɵROUTER_PROVIDERS} from './router_module';
|
||||
export {flatten as ɵflatten} from './utils/collection';
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {Location, LocationStrategy} from '@angular/common';
|
||||
import {MockLocationStrategy, SpyLocation} from '@angular/common/testing';
|
||||
import {Compiler, Injectable, Injector, ModuleWithProviders, NgModule, NgModuleFactory, NgModuleFactoryLoader, Optional} from '@angular/core';
|
||||
import {NoPreloading, PreloadingStrategy, Route, Router, RouterModule, RouterOutletMap, Routes, UrlHandlingStrategy, UrlSerializer, provideRoutes, ɵROUTER_PROVIDERS as ROUTER_PROVIDERS, ɵROUTES as ROUTES, ɵflatten as flatten} from '@angular/router';
|
||||
import {NoPreloading, PreloadingStrategy, ROUTES, Route, Router, RouterModule, RouterOutletMap, Routes, UrlHandlingStrategy, UrlSerializer, provideRoutes, ɵROUTER_PROVIDERS as ROUTER_PROVIDERS, ɵflatten as flatten} from '@angular/router';
|
||||
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"lib": ["es2015", "dom"],
|
||||
"target": "es5",
|
||||
"target": "es2015",
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"files": [
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig-build",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../dist/packages-dist/router",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig-build",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../dist/packages-dist/router/upgrade",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"],
|
||||
|
Reference in New Issue
Block a user