Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build system to use core-js 3 #13981

Merged
merged 2 commits into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"circular-dependency-plugin": "5.0.2",
"clean-css": "4.2.1",
"copy-webpack-plugin": "5.0.2",
"core-js": "3.0.0",
"file-loader": "3.0.1",
"glob": "7.1.3",
"istanbul-instrumenter-loader": "3.0.1",
Expand Down Expand Up @@ -69,7 +70,6 @@
"@angular/router": "^8.0.0-beta.10",
"@angular/service-worker": "^8.0.0-beta.10",
"codelyzer": "^5.0.0",
"core-js": "^2.4.1",
"bootstrap": "^4.0.0",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* 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
*/
import 'core-js/es6/reflect';
import 'core-js/es/reflect';
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* @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
*/

// ES2015 symbol capabilities
import 'core-js/modules/es.symbol';

// ES2015 function capabilities
import 'core-js/modules/es.function.bind';
import 'core-js/modules/es.function.name';
import 'core-js/modules/es.function.has-instance';

// ES2015 object capabilities
import 'core-js/modules/es.object.create';
import 'core-js/modules/es.object.define-property';
import 'core-js/modules/es.object.define-properties';
import 'core-js/modules/es.object.get-own-property-descriptor';
import 'core-js/modules/es.object.get-prototype-of';
import 'core-js/modules/es.object.keys';
import 'core-js/modules/es.object.get-own-property-names';
import 'core-js/modules/es.object.freeze';
import 'core-js/modules/es.object.seal';
import 'core-js/modules/es.object.prevent-extensions';
import 'core-js/modules/es.object.is-frozen';
import 'core-js/modules/es.object.is-sealed';
import 'core-js/modules/es.object.is-extensible';
import 'core-js/modules/es.object.assign';
import 'core-js/modules/es.object.is';
import 'core-js/modules/es.object.set-prototype-of';
import 'core-js/modules/es.object.to-string';

// ES2015 array capabilities
import 'core-js/modules/es.array.is-array';
import 'core-js/modules/es.array.from';
import 'core-js/modules/es.array.of';
import 'core-js/modules/es.array.join';
import 'core-js/modules/es.array.slice';
import 'core-js/modules/es.array.sort';
import 'core-js/modules/es.array.for-each';
import 'core-js/modules/es.array.map';
import 'core-js/modules/es.array.filter';
import 'core-js/modules/es.array.some';
import 'core-js/modules/es.array.every';
import 'core-js/modules/es.array.reduce';
import 'core-js/modules/es.array.reduce-right';
import 'core-js/modules/es.array.index-of';
import 'core-js/modules/es.array.last-index-of';
import 'core-js/modules/es.array.copy-within';
import 'core-js/modules/es.array.fill';
import 'core-js/modules/es.array.find';
import 'core-js/modules/es.array.find-index';
import 'core-js/modules/es.array.iterator';

// ES2015 string capabilities
import 'core-js/modules/es.string.from-code-point';
import 'core-js/modules/es.string.raw';
import 'core-js/modules/es.string.trim';
import 'core-js/modules/es.string.iterator';
import 'core-js/modules/es.string.code-point-at';
import 'core-js/modules/es.string.ends-with';
import 'core-js/modules/es.string.includes';
import 'core-js/modules/es.string.repeat';
import 'core-js/modules/es.string.starts-with';
import 'core-js/modules/es.string.anchor';
import 'core-js/modules/es.string.big';
import 'core-js/modules/es.string.blink';
import 'core-js/modules/es.string.bold';
import 'core-js/modules/es.string.fixed';
import 'core-js/modules/es.string.fontcolor';
import 'core-js/modules/es.string.fontsize';
import 'core-js/modules/es.string.italics';
import 'core-js/modules/es.string.link';
import 'core-js/modules/es.string.small';
import 'core-js/modules/es.string.strike';
import 'core-js/modules/es.string.sub';
import 'core-js/modules/es.string.sup';

import 'core-js/modules/es.parse-int';
import 'core-js/modules/es.parse-float';

import 'core-js/es/number';
import 'core-js/es/math';
import 'core-js/es/date';
import 'core-js/es/regexp';

import 'core-js/modules/es.map';
import 'core-js/modules/es.weak-map';
import 'core-js/modules/es.set';
import 'core-js/modules/web.dom-collections.iterator';
import 'core-js/modules/es.promise';
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* 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
*/
import 'core-js/es7/reflect';
import 'core-js/proposals/reflect-metadata';
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
}

if (buildOptions.es5BrowserSupport) {
entryPoints['polyfills.es5'] = [path.join(__dirname, '..', 'es2015-polyfills.js')];
entryPoints['polyfills.es5'] = [path.join(__dirname, '..', 'es5-polyfills.js')];
}

if (buildOptions.polyfills) {
Expand All @@ -76,7 +76,7 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
if (buildOptions.es5BrowserSupport) {
entryPoints['polyfills.es5'] = [
...entryPoints['polyfills.es5'],
path.join(__dirname, '..', 'es2015-jit-polyfills.js'),
path.join(__dirname, '..', 'es5-jit-polyfills.js'),
];
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

clydin marked this conversation as resolved.
Show resolved Hide resolved
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@angular/platform-browser": "<%= latestVersions.Angular %>",
"@angular/platform-browser-dynamic": "<%= latestVersions.Angular %>",
"@angular/router": "<%= latestVersions.Angular %>",
"core-js": "^2.5.4",
clydin marked this conversation as resolved.
Show resolved Hide resolved
"rxjs": "<%= latestVersions.RxJs %>",
"tslib": "<%= latestVersions.TsLib %>",
"zone.js": "<%= latestVersions.ZoneJs %>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'core-js/es7/reflect';
import 'core-js/proposals/reflect-metadata';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app.module';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@angular/platform-server": "^5.0.0-rc.8",
"@angular/router": "^5.0.0-rc.8",
"@ngtools/webpack": "0.0.0",
"core-js": "^2.4.1",
"core-js": "^3.0.0",
"rxjs": "^5.5.0",
"zone.js": "^0.8.14"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'core-js/es7/reflect';
import 'core-js/proposals/reflect-metadata';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app.module';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@angular/platform-server": "^5.0.0-rc.8",
"@angular/router": "^5.0.0-rc.8",
"@ngtools/webpack": "0.0.0",
"core-js": "^2.4.1",
"core-js": "^3.0.0",
"rxjs": "^5.5.0",
"zone.js": "^0.8.14"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'core-js/es7/reflect';
import 'core-js/proposals/reflect-metadata';
import {platformDynamicServer, renderModule} from '@angular/platform-server';
import {AppModule} from './app.module';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^2.4.1",
"core-js": "^3.0.0",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy-cli/e2e/tests/build/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { expectToFail } from '../../utils/utils';
export default async function () {
await ng('build');
// files were created successfully
await expectFileToMatch('dist/test-project/polyfills.js', 'core-js/es7/reflect');
await expectFileToMatch('dist/test-project/polyfills.js', 'core-js/proposals/reflect-metadata');
await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js');
expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script>
Expand All @@ -24,7 +24,7 @@ export default async function () {
// files were created successfully
await expectFileToExist('dist/test-project/polyfills.js');
await expectFileSizeToBeUnder('dist/test-project/polyfills.js', jitPolyfillSize);
await expectToFail(() => expectFileToMatch('dist/test-project/polyfills.js', 'core-js/es7/reflect'));
await expectToFail(() => expectFileToMatch('dist/test-project/polyfills.js', 'core-js/proposals/reflect-metadata'));
await expectFileToMatch('dist/test-project/polyfills.js', 'zone.js');
expectFileToMatch('dist/test-project/index.html', oneLineTrim`
<script src="runtime.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions tests/legacy-cli/e2e/tests/packages/webpack/test-ng5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default function(skipCleaning: () => void) {
return Promise.resolve()
.then(() => createProjectFromAsset('webpack/test-app-ng5'))
.then(() => exec(normalize('node_modules/.bin/webpack-cli')))
.then(() => expectFileSizeToBeUnder('dist/app.main.js', 375000))
.then(() => expectFileSizeToBeUnder('dist/0.app.main.js', 25000))
.then(() => expectFileSizeToBeUnder('dist/1.app.main.js', 2000))
.then(() => expectFileSizeToBeUnder('dist/app.main.js', 375 * 1024))
.then(() => expectFileSizeToBeUnder('dist/0.app.main.js', 25 * 1024))
.then(() => expectFileSizeToBeUnder('dist/1.app.main.js', 2 * 1024))
// test resource urls without ./
.then(() => replaceInFile('app/app.component.ts',
'./app.component.html', 'app.component.html'))
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2484,7 +2484,12 @@ [email protected]:
serialize-javascript "^1.4.0"
webpack-log "^2.0.0"

core-js@^2.2.0, core-js@^2.4.0, core-js@^2.4.1:
[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0.tgz#a8dbfa978d29bfc263bfb66c556d0ca924c28957"
integrity sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ==

core-js@^2.2.0, core-js@^2.4.0:
version "2.5.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.7.tgz#f972608ff0cead68b841a16a932d0b183791814e"
integrity sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==
Expand Down