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:
Jason Aden
2017-01-27 17:39:48 -08:00
committed by Igor Minar
parent 738d93caf7
commit de795ea233
175 changed files with 2515 additions and 1246 deletions
@@ -0,0 +1,13 @@
{
"presets": ["es2015"],
"plugins": [["transform-es2015-modules-umd", {
"globals": {
"@angular/core": "ng.core",
"@angular/common": "ng.common",
"@angular/platform-browser": "ng.platformBrowser"
},
"exactGlobals": true
}]],
"moduleId": "@angular/platform-browser"
}
@@ -0,0 +1,14 @@
{
"presets": ["es2015"],
"plugins": [["transform-es2015-modules-umd", {
"globals": {
"@angular/core": "ng.core",
"@angular/common": "ng.common",
"@angular/platform-browser": "ng.platformBrowser",
"@angular/platform-browser/testing": "ng.platformBrowser.testing"
},
"exactGlobals": true
}]],
"moduleId": "@angular/platform-browser/testing"
}
+6 -7
View File
@@ -6,10 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of the platform-browser package.
*/
export * from './src/platform-browser';
// This file only reexports content of the `src` folder. Keep it that way.
// 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.
export * from './public_api';
@@ -2,9 +2,10 @@
"name": "@angular/platform-browser",
"version": "0.0.0-PLACEHOLDER",
"description": "Angular - library for using Angular in a web browser",
"main": "bundles/platform-browser.umd.js",
"module": "index.js",
"typings": "index.d.ts",
"main": "./bundles/platform-browser.umd.js",
"module": "./@angular/platform-browser.es5.js",
"es2015": "./@angular/platform-browser.js",
"typings": "./typings/platform-browser.d.ts",
"author": "angular",
"license": "MIT",
"peerDependencies": {
@@ -0,0 +1,15 @@
/**
* @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 platform-browser package.
*/
export * from './src/platform-browser';
// This file only reexports content of the `src` folder. Keep it that way.
@@ -1,19 +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/platform-browser/testing/index.js',
dest: '../../../dist/packages-dist/platform-browser/bundles/platform-browser-testing.umd.js',
format: 'umd',
moduleName: 'ng.platformBrowser.testing',
globals: {
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
'@angular/platform-browser': 'ng.platformBrowser'
}
};
@@ -1,18 +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/platform-browser/index.js',
dest: '../../../dist/packages-dist/platform-browser/bundles/platform-browser.umd.js',
format: 'umd',
moduleName: 'ng.platformBrowser',
globals: {
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
}
};
@@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {APP_ID, ComponentRenderTypeV2, Inject, Injectable, RenderComponentType, Renderer, RendererFactoryV2, RendererV2, RootRenderer, ViewEncapsulation, ɵAnimationKeyframe as AnimationKeyframe, ɵAnimationPlayer as AnimationPlayer, ɵAnimationStyles as AnimationStyles, ɵDirectRenderer as DirectRenderer, ɵNoOpAnimationPlayer as NoOpAnimationPlayer, ɵRenderDebugInfo as RenderDebugInfo} from '@angular/core';
import {APP_ID, Inject, Injectable, RenderComponentType, Renderer, RendererFactoryV2, RendererTypeV2, RendererV2, RootRenderer, ViewEncapsulation, ɵAnimationKeyframe as AnimationKeyframe, ɵAnimationPlayer as AnimationPlayer, ɵAnimationStyles as AnimationStyles, ɵDirectRenderer as DirectRenderer, ɵNoOpAnimationPlayer as NoOpAnimationPlayer, ɵRenderDebugInfo as RenderDebugInfo} from '@angular/core';
import {isPresent, stringify} from '../facade/lang';
@@ -77,9 +77,14 @@ export class WebAnimationsPlayer implements AnimationPlayer {
});
if (missingStyleProps.length) {
for (let i = 1; i < keyframes.length; i++) {
const self = this;
// tslint:disable-next-line
for (var i = 1; i < keyframes.length; i++) {
let kf = keyframes[i];
missingStyleProps.forEach(prop => { kf[prop] = _computeStyle(this.element, prop); });
// tslint:disable-next-line
missingStyleProps.forEach(function(prop) {
kf[prop] = _computeStyle(self.element, prop);
});
}
}
}
@@ -14,19 +14,21 @@
"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": [
"index.ts",
"public_api.ts",
"../../../node_modules/@types/hammerjs/index.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true
"strictMetadataEmit": true,
"bundleIndex": "index",
"importAs": "@angular/platform-browser"
}
}
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig-build",
"compilerOptions": {
"outDir": "../../../dist/packages-dist/platform-browser",
"paths": {
"@angular/core": ["../../../dist/packages-dist/core"],
"@angular/core/testing": ["../../../dist/packages-dist/core/testing"],