@angular-devkit/build-angular 0.803.17 → 0.803.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/src/angular-cli-files/models/build-options.d.ts +1 -0
- package/src/angular-cli-files/models/webpack-configs/browser.js +1 -1
- package/src/browser/action-cache.js +2 -2
- package/src/browser/index.js +4 -4
- package/src/dev-server/index.js +0 -4
- package/src/utils/process-bundle.js +33 -21
- package/src/utils/webpack-browser-config.js +1 -0
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "0.803.
|
|
3
|
+
"version": "0.803.21",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"experimental": true,
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"typings": "src/index.d.ts",
|
|
8
8
|
"builders": "builders.json",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@angular-devkit/architect": "0.803.
|
|
11
|
-
"@angular-devkit/build-optimizer": "0.803.
|
|
12
|
-
"@angular-devkit/build-webpack": "0.803.
|
|
13
|
-
"@angular-devkit/core": "8.3.
|
|
14
|
-
"@babel/core": "7.
|
|
15
|
-
"@babel/preset-env": "7.
|
|
16
|
-
"@ngtools/webpack": "8.3.
|
|
10
|
+
"@angular-devkit/architect": "0.803.21",
|
|
11
|
+
"@angular-devkit/build-optimizer": "0.803.21",
|
|
12
|
+
"@angular-devkit/build-webpack": "0.803.21",
|
|
13
|
+
"@angular-devkit/core": "8.3.21",
|
|
14
|
+
"@babel/core": "7.7.5",
|
|
15
|
+
"@babel/preset-env": "7.7.6",
|
|
16
|
+
"@ngtools/webpack": "8.3.21",
|
|
17
17
|
"ajv": "6.10.2",
|
|
18
18
|
"autoprefixer": "9.6.1",
|
|
19
19
|
"browserslist": "4.6.6",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"caniuse-lite": "1.0.30000989",
|
|
22
22
|
"circular-dependency-plugin": "5.2.0",
|
|
23
23
|
"clean-css": "4.2.1",
|
|
24
|
-
"copy-webpack-plugin": "5.
|
|
24
|
+
"copy-webpack-plugin": "5.1.1",
|
|
25
25
|
"core-js": "3.2.1",
|
|
26
26
|
"file-loader": "4.2.0",
|
|
27
27
|
"find-cache-dir": "3.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"stylus-loader": "3.0.2",
|
|
56
56
|
"tree-kill": "1.2.1",
|
|
57
57
|
"terser": "4.3.9",
|
|
58
|
-
"terser-webpack-plugin": "1.4.
|
|
58
|
+
"terser-webpack-plugin": "1.4.3",
|
|
59
59
|
"webpack": "4.39.2",
|
|
60
60
|
"webpack-dev-middleware": "3.7.2",
|
|
61
61
|
"webpack-dev-server": "3.9.0",
|
|
@@ -40,7 +40,7 @@ function getBrowserConfig(wco) {
|
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
42
|
if (!isEval && (scriptsSourceMap || stylesSourceMap)) {
|
|
43
|
-
extraPlugins.push(utils_1.getSourceMapDevTool(!!scriptsSourceMap, !!stylesSourceMap, hiddenSourceMap));
|
|
43
|
+
extraPlugins.push(utils_1.getSourceMapDevTool(!!scriptsSourceMap, !!stylesSourceMap, wco.differentialLoadingMode ? true : hiddenSourceMap));
|
|
44
44
|
}
|
|
45
45
|
const globalStylesBundleNames = utils_1.normalizeExtraEntryPoints(buildOptions.styles, 'styles')
|
|
46
46
|
.map(style => style.bundleName);
|
|
@@ -140,7 +140,7 @@ class BundleActionCache {
|
|
|
140
140
|
cacheEntry = entries[2 /* DownlevelCode */];
|
|
141
141
|
if (cacheEntry) {
|
|
142
142
|
result.downlevel = {
|
|
143
|
-
filename: action.filename.replace(
|
|
143
|
+
filename: action.filename.replace(/\-es20\d{2}/, '-es5'),
|
|
144
144
|
size: cacheEntry.size,
|
|
145
145
|
integrity: cacheEntry.integrity,
|
|
146
146
|
};
|
|
@@ -148,7 +148,7 @@ class BundleActionCache {
|
|
|
148
148
|
cacheEntry = entries[3 /* DownlevelMap */];
|
|
149
149
|
if (cacheEntry) {
|
|
150
150
|
result.downlevel.map = {
|
|
151
|
-
filename: action.filename.replace(
|
|
151
|
+
filename: action.filename.replace(/\-es20\d{2}/, '-es5') + '.map',
|
|
152
152
|
size: cacheEntry.size,
|
|
153
153
|
};
|
|
154
154
|
BundleActionCache.copyEntryContent(cacheEntry, result.downlevel.filename + '.map');
|
package/src/browser/index.js
CHANGED
|
@@ -214,7 +214,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
214
214
|
}
|
|
215
215
|
// If not optimizing then ES2015 polyfills do not need processing
|
|
216
216
|
// Unlike other module scripts, it is never downleveled
|
|
217
|
-
const es2015Polyfills = file.file.startsWith('polyfills-
|
|
217
|
+
const es2015Polyfills = file.file.startsWith('polyfills-es20');
|
|
218
218
|
if (!actionOptions.optimize && es2015Polyfills) {
|
|
219
219
|
continue;
|
|
220
220
|
}
|
|
@@ -234,7 +234,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
234
234
|
}
|
|
235
235
|
if (es5Polyfills) {
|
|
236
236
|
fs.unlinkSync(filename);
|
|
237
|
-
filename = filename.replace(
|
|
237
|
+
filename = filename.replace(/\-es20\d{2}/, '');
|
|
238
238
|
}
|
|
239
239
|
// Record the bundle processing action
|
|
240
240
|
// The runtime chunk gets special processing for lazy loaded files
|
|
@@ -256,8 +256,8 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
256
256
|
}
|
|
257
257
|
// Add the newly created ES5 bundles to the index as nomodule scripts
|
|
258
258
|
const newFilename = es5Polyfills
|
|
259
|
-
? file.file.replace(
|
|
260
|
-
: file.file.replace(
|
|
259
|
+
? file.file.replace(/\-es20\d{2}/, '')
|
|
260
|
+
: file.file.replace(/\-es20\d{2}/, '-es5');
|
|
261
261
|
noModuleFiles.push({ ...file, file: newFilename });
|
|
262
262
|
}
|
|
263
263
|
// Execute the bundle processing actions
|
package/src/dev-server/index.js
CHANGED
|
@@ -323,10 +323,6 @@ function _addLiveReload(options, browserOptions, webpackConfig, clientAddress, l
|
|
|
323
323
|
if (clientAddress.pathname) {
|
|
324
324
|
clientAddress.pathname = path.posix.join(clientAddress.pathname, 'sockjs-node');
|
|
325
325
|
sockjsPath = '&sockPath=' + clientAddress.pathname;
|
|
326
|
-
// ensure webpack-dev-server uses the correct path to connect to the reloading socket
|
|
327
|
-
if (webpackConfig.devServer) {
|
|
328
|
-
webpackConfig.devServer.sockPath = clientAddress.pathname;
|
|
329
|
-
}
|
|
330
326
|
}
|
|
331
327
|
const entryPoints = [`${webpackDevServerPath}?${url.format(clientAddress)}${sockjsPath}`];
|
|
332
328
|
if (options.hmr) {
|
|
@@ -7,13 +7,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8
8
|
* found in the LICENSE file at https://angular.io/license
|
|
9
9
|
*/
|
|
10
|
+
const core_1 = require("@babel/core");
|
|
10
11
|
const crypto_1 = require("crypto");
|
|
11
12
|
const fs = require("fs");
|
|
12
13
|
const path = require("path");
|
|
13
14
|
const source_map_1 = require("source-map");
|
|
14
15
|
const terser_1 = require("terser");
|
|
15
|
-
const typescript_1 = require("typescript");
|
|
16
|
-
const webpack_sources_1 = require("webpack-sources");
|
|
17
16
|
const mangle_options_1 = require("./mangle-options");
|
|
18
17
|
const cacache = require('cacache');
|
|
19
18
|
let cachePath;
|
|
@@ -43,7 +42,7 @@ async function process(options) {
|
|
|
43
42
|
}
|
|
44
43
|
const basePath = path.dirname(options.filename);
|
|
45
44
|
const filename = path.basename(options.filename);
|
|
46
|
-
const downlevelFilename = filename.replace(
|
|
45
|
+
const downlevelFilename = filename.replace(/\-es20\d{2}/, '-es5');
|
|
47
46
|
const downlevel = !options.optimizeOnly;
|
|
48
47
|
// if code size is larger than 1 MB, manually handle sourcemaps with newer source-map package.
|
|
49
48
|
const codeSize = Buffer.byteLength(options.code);
|
|
@@ -55,23 +54,36 @@ async function process(options) {
|
|
|
55
54
|
let downlevelMap;
|
|
56
55
|
if (downlevel) {
|
|
57
56
|
// Downlevel the bundle
|
|
58
|
-
const transformResult =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
const transformResult = await core_1.transformAsync(sourceCode, {
|
|
58
|
+
filename: options.filename,
|
|
59
|
+
inputSourceMap: manualSourceMaps ? undefined : sourceMap,
|
|
60
|
+
babelrc: false,
|
|
61
|
+
presets: [
|
|
62
|
+
[
|
|
63
|
+
require.resolve('@babel/preset-env'),
|
|
64
|
+
{
|
|
65
|
+
// modules aren't needed since the bundles use webpack's custom module loading
|
|
66
|
+
modules: false,
|
|
67
|
+
// 'transform-typeof-symbol' generates slower code
|
|
68
|
+
exclude: ['transform-typeof-symbol'],
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
],
|
|
72
|
+
minified: options.optimize,
|
|
73
|
+
// `false` ensures it is disabled and prevents large file warnings
|
|
74
|
+
compact: options.optimize || false,
|
|
75
|
+
sourceMaps: !!sourceMap,
|
|
64
76
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
if (!transformResult || !transformResult.code) {
|
|
78
|
+
throw new Error(`Unknown error occurred processing bundle for "${options.filename}".`);
|
|
79
|
+
}
|
|
80
|
+
downlevelCode = transformResult.code;
|
|
81
|
+
if (manualSourceMaps && sourceMap && transformResult.map) {
|
|
82
|
+
downlevelMap = await mergeSourcemaps(sourceMap, transformResult.map);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// undefined is needed here to normalize the property type
|
|
86
|
+
downlevelMap = transformResult.map || undefined;
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
89
|
if (options.optimize) {
|
|
@@ -244,8 +256,8 @@ async function processRuntime(options) {
|
|
|
244
256
|
}
|
|
245
257
|
// Adjust lazy loaded scripts to point to the proper variant
|
|
246
258
|
// Extra spacing is intentional to align source line positions
|
|
247
|
-
downlevelCode = downlevelCode.replace(
|
|
248
|
-
const downlevelFilePath = options.filename.replace(
|
|
259
|
+
downlevelCode = downlevelCode.replace(/"\-es20\d{2}\./, ' "-es5.');
|
|
260
|
+
const downlevelFilePath = options.filename.replace(/\-es20\d{2}/, '-es5');
|
|
249
261
|
let downlevelMap;
|
|
250
262
|
let result;
|
|
251
263
|
if (options.optimize) {
|
|
@@ -63,6 +63,7 @@ async function generateWebpackConfig(context, workspaceRoot, projectRoot, source
|
|
|
63
63
|
tsConfig,
|
|
64
64
|
tsConfigPath,
|
|
65
65
|
supportES2015,
|
|
66
|
+
differentialLoadingMode: differentialLoading && !utils_1.fullDifferential,
|
|
66
67
|
};
|
|
67
68
|
wco.buildOptions.progress = utils_1.defaultProgress(wco.buildOptions.progress);
|
|
68
69
|
const partials = webpackPartialGenerator(wco);
|