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:
21
modules/@angular/upgrade/.babelrc
Normal file
21
modules/@angular/upgrade/.babelrc
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": [["transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"@angular/core": "ng.core",
|
||||
"@angular/common": "ng.common",
|
||||
"@angular/compiler": "ng.compiler",
|
||||
"@angular/platform-browser": "ng.platformBrowser",
|
||||
"@angular/platform-browser-dynamic": "ng.platformBrowserDynamic",
|
||||
"@angular/upgrade": "ng.upgrade",
|
||||
"rxjs/Subject": "Rx",
|
||||
"rxjs/observable/PromiseObservable": "Rx", // this is wrong, but this stuff has changed in rxjs
|
||||
// b.6 so we need to fix it when we update.
|
||||
"rxjs/operator/toPromise": "Rx.Observable.prototype",
|
||||
"rxjs/Observable": "Rx"
|
||||
},
|
||||
"exactGlobals": true
|
||||
}]],
|
||||
"moduleId": "@angular/upgrade"
|
||||
}
|
12
modules/@angular/upgrade/.babelrc-static
Normal file
12
modules/@angular/upgrade/.babelrc-static
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
{
|
||||
"presets": ["es2015"],
|
||||
"plugins": [["transform-es2015-modules-umd", {
|
||||
"globals": {
|
||||
"@angular/upgrade": "ng.upgrade",
|
||||
"@angular/upgrade/static": "ng.upgrade.static"
|
||||
},
|
||||
"exactGlobals": true
|
||||
}]],
|
||||
"moduleId": "@angular/upgrade/static"
|
||||
}
|
@ -6,13 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Entry point for all public APIs of the upgrade/dynamic package, allowing
|
||||
* Angular 1 and Angular 2+ to run side by side in the same application.
|
||||
*/
|
||||
export {VERSION} from './src/common/version';
|
||||
export {UpgradeAdapter, UpgradeAdapterRef} from './src/dynamic/upgrade_adapter';
|
||||
// This file is not used to build this module. It is only used during editing
|
||||
// by the TypeScript language service and during build for verification. `ngc`
|
||||
// replaces this file with production index.ts when it rewrites private symbol
|
||||
// names.
|
||||
|
||||
// This file only re-exports content of the `src` folder. Keep it that way.
|
||||
export * from './public_api';
|
||||
|
@ -2,9 +2,10 @@
|
||||
"name": "@angular/upgrade",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"description": "Angular - the library for easing update from v1 to v2",
|
||||
"main": "bundles/upgrade.umd.js",
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"main": "./bundles/upgrade.umd.js",
|
||||
"module": "./@angular/upgrade.es5.js",
|
||||
"es2015": "./@angular/upgrade.js",
|
||||
"typings": "./typings/upgrade.d.ts",
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
|
18
modules/@angular/upgrade/public_api.ts
Normal file
18
modules/@angular/upgrade/public_api.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @module
|
||||
* @description
|
||||
* Entry point for all public APIs of the upgrade/dynamic package, allowing
|
||||
* Angular 1 and Angular 2+ to run side by side in the same application.
|
||||
*/
|
||||
export {VERSION} from './src/common/version';
|
||||
export {UpgradeAdapter, UpgradeAdapterRef} from './src/dynamic/upgrade_adapter';
|
||||
|
||||
// This file only re-exports content of the `src` folder. Keep it that way.
|
@ -1,15 +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/upgrade/static.js',
|
||||
dest: '../../../dist/packages-dist/upgrade/bundles/upgrade-static.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.upgrade.static',
|
||||
globals: {'@angular/core': 'ng.core'}
|
||||
};
|
@ -1,26 +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/upgrade/index.js',
|
||||
dest: '../../../dist/packages-dist/upgrade/bundles/upgrade.umd.js',
|
||||
format: 'umd',
|
||||
moduleName: 'ng.upgrade',
|
||||
globals: {
|
||||
'@angular/core': 'ng.core',
|
||||
'@angular/common': 'ng.common',
|
||||
'@angular/compiler': 'ng.compiler',
|
||||
'@angular/platform-browser': 'ng.platformBrowser',
|
||||
'@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',
|
||||
'rxjs/Subject': 'Rx',
|
||||
'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs
|
||||
// b.6 so we need to fix it when we update.
|
||||
'rxjs/operator/toPromise': 'Rx.Observable.prototype',
|
||||
'rxjs/Observable': 'Rx',
|
||||
}
|
||||
};
|
@ -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 static.ts when it rewrites private symbol
|
||||
// names.
|
||||
|
||||
|
@ -17,22 +17,20 @@
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"target": "es5",
|
||||
"target": "es2015",
|
||||
"skipLibCheck": true,
|
||||
"lib": [ "es2015", "dom" ],
|
||||
// don't auto-discover @types/node, it results in a ///<reference in the .d.ts output
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"public_api_static.ts",
|
||||
"index.ts",
|
||||
"public_api.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"annotateForClosureCompiler": true,
|
||||
"strictMetadataEmit": true,
|
||||
"bundleIndex": "static",
|
||||
"libraryIndex": "./public_api_static",
|
||||
"importAs": "@angular/upgrade/static"
|
||||
"bundleIndex": "index",
|
||||
"importAs": "@angular/upgrade"
|
||||
}
|
||||
}
|
||||
|
22
modules/@angular/upgrade/tsconfig-static.json
Normal file
22
modules/@angular/upgrade/tsconfig-static.json
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
{
|
||||
"extends": "./tsconfig-build",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../dist/packages-dist/upgrade/static",
|
||||
"target": "es5",
|
||||
"paths": {
|
||||
"@angular/core": ["../../../dist/packages-dist/core"],
|
||||
"@angular/common": ["../../../dist/packages-dist/common"],
|
||||
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"],
|
||||
"@angular/platform-browser-dynamic": ["../../../dist/packages-dist/platform-browser-dynamic"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"public_api_static.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"bundleIndex": "static",
|
||||
"importAs": "@angular/upgrade/static"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user