@angular-devkit/build-angular 12.1.0-next.4 → 12.1.1
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 +35 -33
- package/src/app-shell/index.js +28 -8
- package/src/babel/plugins/adjust-static-class-members.d.ts +25 -0
- package/src/babel/plugins/adjust-static-class-members.js +251 -0
- package/src/babel/plugins/adjust-typescript-enums.d.ts +21 -0
- package/src/babel/plugins/adjust-typescript-enums.js +123 -0
- package/src/babel/plugins/elide-angular-metadata.d.ts +21 -0
- package/src/babel/plugins/elide-angular-metadata.js +68 -0
- package/src/babel/plugins/pure-toplevel-functions.d.ts +14 -0
- package/src/babel/plugins/pure-toplevel-functions.js +86 -0
- package/src/babel/presets/application.d.ts +1 -0
- package/src/babel/presets/application.js +24 -4
- package/src/babel/webpack-loader.js +39 -1
- package/src/browser/index.d.ts +1 -4
- package/src/browser/index.js +26 -36
- package/src/dev-server/index.d.ts +1 -1
- package/src/dev-server/index.js +31 -10
- package/src/dev-server/tests/execute-fetch.js +4 -1
- package/src/extract-i18n/index.d.ts +1 -1
- package/src/extract-i18n/index.js +37 -14
- package/src/extract-i18n/ivy-extract-loader.js +20 -1
- package/src/karma/find-tests.js +20 -1
- package/src/karma/index.js +21 -1
- package/src/karma/tests/setup.d.ts +18 -0
- package/src/karma/tests/setup.js +29 -0
- package/src/ng-packagr/index.js +21 -2
- package/src/protractor/index.js +21 -2
- package/src/sass/sass-service.d.ts +0 -3
- package/src/sass/sass-service.js +4 -5
- package/src/server/index.d.ts +1 -1
- package/src/server/index.js +20 -1
- package/src/tslint/index.js +22 -3
- package/src/typings.d.ts +6 -0
- package/src/utils/action-cache.js +21 -2
- package/src/utils/action-executor.js +21 -2
- package/src/utils/build-browser-features.js +25 -3
- package/src/utils/cache-path.js +5 -2
- package/src/utils/check-port.js +20 -1
- package/src/utils/color.js +20 -1
- package/src/utils/copy-assets.js +26 -4
- package/src/utils/copy-file.js +20 -1
- package/src/utils/delete-output-dir.js +28 -2
- package/src/utils/environment-options.d.ts +1 -0
- package/src/utils/environment-options.js +26 -2
- package/src/utils/find-up.js +20 -1
- package/src/utils/i18n-inlining.js +21 -2
- package/src/utils/i18n-options.js +23 -5
- package/src/utils/index-file/html-rewriting-stream.js +20 -1
- package/src/utils/index-file/index-html-generator.js +20 -1
- package/src/utils/index-file/inline-critical-css.js +20 -1
- package/src/utils/index-file/inline-fonts.js +27 -5
- package/src/utils/is-directory.js +20 -1
- package/src/utils/load-translations.js +26 -7
- package/src/utils/process-bundle.js +34 -12
- package/src/utils/read-tsconfig.js +20 -1
- package/src/utils/service-worker.js +21 -2
- package/src/utils/spinner.d.ts +2 -0
- package/src/utils/spinner.js +18 -2
- package/src/utils/webpack-browser-config.js +21 -2
- package/src/webpack/configs/analytics.d.ts +11 -0
- package/src/webpack/configs/analytics.js +29 -0
- package/src/webpack/configs/browser.js +0 -4
- package/src/webpack/configs/common.js +90 -31
- package/src/webpack/configs/dev-server.js +20 -1
- package/src/webpack/configs/index.d.ts +1 -0
- package/src/webpack/configs/index.js +1 -0
- package/src/webpack/configs/server.js +0 -1
- package/src/webpack/configs/stats.d.ts +2 -0
- package/src/webpack/configs/stats.js +1 -0
- package/src/webpack/configs/styles.js +28 -2
- package/src/webpack/configs/test.js +32 -3
- package/src/webpack/configs/typescript.d.ts +2 -9
- package/src/webpack/configs/typescript.js +16 -14
- package/src/webpack/plugins/any-component-style-budget-checker.js +20 -1
- package/src/webpack/plugins/builder-watch-plugin.d.ts +0 -2
- package/src/webpack/plugins/builder-watch-plugin.js +2 -7
- package/src/webpack/plugins/index.js +4 -1
- package/src/webpack/plugins/karma/karma-context.html +1 -1
- package/src/webpack/plugins/karma/karma-debug.html +1 -1
- package/src/webpack/plugins/karma/karma.js +27 -5
- package/src/webpack/plugins/postcss-cli-resources.js +21 -2
- package/src/webpack/plugins/scripts-webpack-plugin.js +20 -1
- package/src/webpack/utils/async-chunks.js +9 -5
- package/src/webpack/utils/helpers.js +20 -1
- package/src/webpack/utils/stats.d.ts +2 -3
- package/src/webpack/utils/stats.js +50 -15
|
@@ -6,10 +6,29 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.getStylesConfig = void 0;
|
|
11
|
-
const fs = require("fs");
|
|
12
|
-
const path = require("path");
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
31
|
+
const path = __importStar(require("path"));
|
|
13
32
|
const sass_service_1 = require("../../sass/sass-service");
|
|
14
33
|
const build_browser_features_1 = require("../../utils/build-browser-features");
|
|
15
34
|
const environment_options_1 = require("../../utils/environment-options");
|
|
@@ -81,6 +100,13 @@ function getStylesConfig(wco) {
|
|
|
81
100
|
}
|
|
82
101
|
catch {
|
|
83
102
|
sassImplementation = new sass_service_1.SassWorkerImplementation();
|
|
103
|
+
extraPlugins.push({
|
|
104
|
+
apply(compiler) {
|
|
105
|
+
compiler.hooks.shutdown.tap('sass-worker', () => {
|
|
106
|
+
sassImplementation === null || sassImplementation === void 0 ? void 0 : sassImplementation.close();
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
});
|
|
84
110
|
}
|
|
85
111
|
const assetNameTemplate = helpers_1.assetNameTemplateFactory(hashFormat);
|
|
86
112
|
const extraPostcssPlugins = [];
|
|
@@ -6,13 +6,33 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.getTestConfig = void 0;
|
|
11
|
-
const glob = require("glob");
|
|
12
|
-
const path = require("path");
|
|
30
|
+
const glob = __importStar(require("glob"));
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const typescript_1 = require("typescript");
|
|
13
33
|
const helpers_1 = require("../utils/helpers");
|
|
14
34
|
function getTestConfig(wco) {
|
|
15
|
-
const { buildOptions: { codeCoverage, codeCoverageExclude, main, sourceMap }, root, sourceRoot, } = wco;
|
|
35
|
+
const { buildOptions: { codeCoverage, codeCoverageExclude, main, sourceMap, webWorkerTsConfig }, root, sourceRoot, } = wco;
|
|
16
36
|
const extraRules = [];
|
|
17
37
|
const extraPlugins = [];
|
|
18
38
|
if (codeCoverage) {
|
|
@@ -38,6 +58,7 @@ function getTestConfig(wco) {
|
|
|
38
58
|
}
|
|
39
59
|
return {
|
|
40
60
|
mode: 'development',
|
|
61
|
+
target: wco.tsConfig.options.target === typescript_1.ScriptTarget.ES5 ? ['web', 'es5'] : 'web',
|
|
41
62
|
resolve: {
|
|
42
63
|
mainFields: ['es2015', 'browser', 'module', 'main'],
|
|
43
64
|
},
|
|
@@ -47,6 +68,14 @@ function getTestConfig(wco) {
|
|
|
47
68
|
},
|
|
48
69
|
module: {
|
|
49
70
|
rules: extraRules,
|
|
71
|
+
parser: webWorkerTsConfig === undefined
|
|
72
|
+
? {
|
|
73
|
+
javascript: {
|
|
74
|
+
worker: false,
|
|
75
|
+
url: false,
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
: undefined,
|
|
50
79
|
},
|
|
51
80
|
plugins: extraPlugins,
|
|
52
81
|
optimization: {
|
|
@@ -6,14 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { AngularWebpackPlugin } from '@ngtools/webpack';
|
|
9
|
+
import { Configuration } from 'webpack';
|
|
9
10
|
import { WebpackConfigOptions } from '../../utils/build-options';
|
|
10
|
-
export declare function getTypeScriptConfig(wco: WebpackConfigOptions):
|
|
11
|
-
module: {
|
|
12
|
-
rules: {
|
|
13
|
-
test: RegExp;
|
|
14
|
-
loader: string;
|
|
15
|
-
}[];
|
|
16
|
-
};
|
|
17
|
-
plugins: AngularWebpackPlugin[];
|
|
18
|
-
};
|
|
11
|
+
export declare function getTypeScriptConfig(wco: WebpackConfigOptions): Configuration;
|
|
19
12
|
export declare function getTypescriptWorkerPlugin(wco: WebpackConfigOptions, workerTsConfigPath: string): AngularWebpackPlugin;
|
|
@@ -63,20 +63,22 @@ function createIvyPlugin(wco, aot, tsconfig) {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
function getTypeScriptConfig(wco) {
|
|
66
|
-
const { buildOptions, tsConfigPath } = wco;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
const { buildOptions: { aot = false, main, polyfills }, tsConfigPath, } = wco;
|
|
67
|
+
if (main || polyfills) {
|
|
68
|
+
ensureIvy(wco);
|
|
69
|
+
return {
|
|
70
|
+
module: {
|
|
71
|
+
rules: [
|
|
72
|
+
{
|
|
73
|
+
test: /\.[jt]sx?$/,
|
|
74
|
+
loader: webpack_1.AngularWebpackLoaderPath,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
plugins: [createIvyPlugin(wco, aot, tsConfigPath)],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return {};
|
|
80
82
|
}
|
|
81
83
|
exports.getTypeScriptConfig = getTypeScriptConfig;
|
|
82
84
|
function getTypescriptWorkerPlugin(wco, workerTsConfigPath) {
|
|
@@ -6,9 +6,28 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.AnyComponentStyleBudgetChecker = void 0;
|
|
11
|
-
const path = require("path");
|
|
30
|
+
const path = __importStar(require("path"));
|
|
12
31
|
const webpack_1 = require("webpack");
|
|
13
32
|
const schema_1 = require("../../browser/schema");
|
|
14
33
|
const bundle_calculator_1 = require("../../utils/bundle-calculator");
|
|
@@ -19,8 +19,6 @@ export interface BuilderWatcherFactory {
|
|
|
19
19
|
export interface WebpackWatcher {
|
|
20
20
|
close(): void;
|
|
21
21
|
pause(): void;
|
|
22
|
-
getFileTimestamps(): Map<string, number>;
|
|
23
|
-
getContextTimestamps(): Map<string, number>;
|
|
24
22
|
getFileTimeInfoEntries(): Map<string, {
|
|
25
23
|
safeTime: number;
|
|
26
24
|
timestamp: number;
|
|
@@ -68,7 +68,8 @@ class BuilderWatchFileSystem {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
const timeInfoMap = new Map(timeInfo);
|
|
72
|
+
callback(undefined, timeInfoMap, timeInfoMap, new Set([...fileChanges, ...directoryChanges, ...missingChanges]), removals);
|
|
72
73
|
});
|
|
73
74
|
});
|
|
74
75
|
return {
|
|
@@ -76,12 +77,6 @@ class BuilderWatchFileSystem {
|
|
|
76
77
|
watcher.close();
|
|
77
78
|
},
|
|
78
79
|
pause() { },
|
|
79
|
-
getFileTimestamps() {
|
|
80
|
-
return timeInfo.toTimestamps();
|
|
81
|
-
},
|
|
82
|
-
getContextTimestamps() {
|
|
83
|
-
return timeInfo.toTimestamps();
|
|
84
|
-
},
|
|
85
80
|
getFileTimeInfoEntries() {
|
|
86
81
|
return new Map(timeInfo);
|
|
87
82
|
},
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.PostcssCliResources = exports.CommonJsUsageWarnPlugin = exports.DedupeModuleResolvePlugin = exports.RemoveHashPlugin = exports.SuppressExtractedTextChunksWebpackPlugin = exports.ScriptsWebpackPlugin = exports.AnyComponentStyleBudgetChecker = void 0;
|
|
11
14
|
// Exports the webpack plugins we use internally.
|
|
@@ -22,4 +25,4 @@ Object.defineProperty(exports, "DedupeModuleResolvePlugin", { enumerable: true,
|
|
|
22
25
|
var common_js_usage_warn_plugin_1 = require("./common-js-usage-warn-plugin");
|
|
23
26
|
Object.defineProperty(exports, "CommonJsUsageWarnPlugin", { enumerable: true, get: function () { return common_js_usage_warn_plugin_1.CommonJsUsageWarnPlugin; } });
|
|
24
27
|
var postcss_cli_resources_1 = require("./postcss-cli-resources");
|
|
25
|
-
Object.defineProperty(exports, "PostcssCliResources", { enumerable: true, get: function () { return postcss_cli_resources_1.default; } });
|
|
28
|
+
Object.defineProperty(exports, "PostcssCliResources", { enumerable: true, get: function () { return __importDefault(postcss_cli_resources_1).default; } });
|
|
@@ -9,6 +9,7 @@ Reloaded before every execution run.
|
|
|
9
9
|
<title></title>
|
|
10
10
|
<base href="/" />
|
|
11
11
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
12
|
+
<link rel="stylesheet" href="_karma_webpack_/styles.css" crossorigin="anonymous" />
|
|
12
13
|
<meta
|
|
13
14
|
name="viewport"
|
|
14
15
|
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
|
|
@@ -34,7 +35,6 @@ Reloaded before every execution run.
|
|
|
34
35
|
<script src="_karma_webpack_/polyfills.js" crossorigin="anonymous"></script>
|
|
35
36
|
<!-- Dynamically replaced with <script> tags -->
|
|
36
37
|
%SCRIPTS%
|
|
37
|
-
<script src="_karma_webpack_/styles.js" crossorigin="anonymous"></script>
|
|
38
38
|
<script src="_karma_webpack_/scripts.js" crossorigin="anonymous"></script>
|
|
39
39
|
<script src="_karma_webpack_/vendor.js" crossorigin="anonymous"></script>
|
|
40
40
|
<script src="_karma_webpack_/main.js" crossorigin="anonymous"></script>
|
|
@@ -10,6 +10,7 @@ just for immediate execution, without reporting to Karma server.
|
|
|
10
10
|
<title>Karma DEBUG RUNNER</title>
|
|
11
11
|
<base href="/" />
|
|
12
12
|
<link href="favicon.ico" rel="icon" type="image/x-icon" />
|
|
13
|
+
<link rel="stylesheet" href="_karma_webpack_/styles.css" crossorigin="anonymous" />
|
|
13
14
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
14
15
|
<meta
|
|
15
16
|
name="viewport"
|
|
@@ -36,7 +37,6 @@ just for immediate execution, without reporting to Karma server.
|
|
|
36
37
|
<script src="_karma_webpack_/polyfills.js" crossorigin="anonymous"></script>
|
|
37
38
|
<!-- Dynamically replaced with <script> tags -->
|
|
38
39
|
%SCRIPTS%
|
|
39
|
-
<script src="_karma_webpack_/styles.js" crossorigin="anonymous"></script>
|
|
40
40
|
<script src="_karma_webpack_/scripts.js" crossorigin="anonymous"></script>
|
|
41
41
|
<script src="_karma_webpack_/vendor.js" crossorigin="anonymous"></script>
|
|
42
42
|
<script src="_karma_webpack_/main.js" crossorigin="anonymous"></script>
|
|
@@ -6,10 +6,32 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
9
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
const path = require("path");
|
|
11
|
-
const glob = require("glob");
|
|
12
|
-
const
|
|
32
|
+
const path = __importStar(require("path"));
|
|
33
|
+
const glob = __importStar(require("glob"));
|
|
34
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
13
35
|
const webpackDevMiddleware = require('webpack-dev-middleware');
|
|
14
36
|
const stats_1 = require("../../utils/stats");
|
|
15
37
|
const node_1 = require("@angular-devkit/core/node");
|
|
@@ -122,7 +144,7 @@ const init = (config, emitter) => {
|
|
|
122
144
|
// Files need to be served from a custom path for Karma.
|
|
123
145
|
webpackConfig.output.path = `/${KARMA_APPLICATION_PATH}/`;
|
|
124
146
|
webpackConfig.output.publicPath = `/${KARMA_APPLICATION_PATH}/`;
|
|
125
|
-
const compiler =
|
|
147
|
+
const compiler = webpack_1.default(webpackConfig, (error, stats) => {
|
|
126
148
|
var _a;
|
|
127
149
|
if (error) {
|
|
128
150
|
throw error;
|
|
@@ -248,7 +270,7 @@ function fallbackMiddleware() {
|
|
|
248
270
|
`/${KARMA_APPLICATION_PATH}/polyfills.js`,
|
|
249
271
|
`/${KARMA_APPLICATION_PATH}/polyfills-es5.js`,
|
|
250
272
|
`/${KARMA_APPLICATION_PATH}/scripts.js`,
|
|
251
|
-
`/${KARMA_APPLICATION_PATH}/styles.
|
|
273
|
+
`/${KARMA_APPLICATION_PATH}/styles.css`,
|
|
252
274
|
`/${KARMA_APPLICATION_PATH}/vendor.js`,
|
|
253
275
|
];
|
|
254
276
|
if (request.url && alwaysServe.includes(request.url)) {
|
|
@@ -6,11 +6,30 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.postcss = void 0;
|
|
11
30
|
const loader_utils_1 = require("loader-utils");
|
|
12
|
-
const path = require("path");
|
|
13
|
-
const url = require("url");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const url = __importStar(require("url"));
|
|
14
33
|
function wrapUrl(url) {
|
|
15
34
|
let wrappedUrl;
|
|
16
35
|
const hasSingleQuotes = url.indexOf("'") >= 0;
|
|
@@ -6,10 +6,29 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.ScriptsWebpackPlugin = void 0;
|
|
11
30
|
const loader_utils_1 = require("loader-utils");
|
|
12
|
-
const path = require("path");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
13
32
|
const webpack_1 = require("webpack");
|
|
14
33
|
const Entrypoint = require('webpack/lib/Entrypoint');
|
|
15
34
|
function addDependencies(compilation, scripts) {
|
|
@@ -22,7 +22,7 @@ function markAsyncChunksNonInitial(webpackStats, extraEntryPoints) {
|
|
|
22
22
|
// **cannot** be loaded in main bundle.
|
|
23
23
|
const asyncChunkIds = extraEntryPoints
|
|
24
24
|
.filter((entryPoint) => !entryPoint.inject)
|
|
25
|
-
.flatMap((entryPoint) => entryPoints[entryPoint.bundleName].chunks);
|
|
25
|
+
.flatMap((entryPoint) => { var _a; return (_a = entryPoints[entryPoint.bundleName].chunks) === null || _a === void 0 ? void 0 : _a.filter((n) => n !== 'runtime'); });
|
|
26
26
|
// Find chunks for each ID.
|
|
27
27
|
const asyncChunks = asyncChunkIds.map((chunkId) => {
|
|
28
28
|
const chunk = chunks.find((chunk) => chunk.id === chunkId);
|
|
@@ -33,9 +33,13 @@ function markAsyncChunksNonInitial(webpackStats, extraEntryPoints) {
|
|
|
33
33
|
});
|
|
34
34
|
// A chunk is considered `initial` only if Webpack already belives it to be initial
|
|
35
35
|
// and the application developer did not mark it async via an extra entry point.
|
|
36
|
-
return chunks.map((chunk) =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
return chunks.map((chunk) => {
|
|
37
|
+
return asyncChunks.find((asyncChunk) => asyncChunk === chunk)
|
|
38
|
+
? {
|
|
39
|
+
...chunk,
|
|
40
|
+
initial: false,
|
|
41
|
+
}
|
|
42
|
+
: chunk;
|
|
43
|
+
});
|
|
40
44
|
}
|
|
41
45
|
exports.markAsyncChunksNonInitial = markAsyncChunksNonInitial;
|
|
@@ -6,10 +6,29 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.assetNameTemplateFactory = exports.getWatchOptions = exports.isPolyfillsEntry = exports.getEsVersionForFileName = exports.getSourceMapDevTool = exports.normalizeExtraEntryPoints = exports.getOutputHashFormat = void 0;
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const path = require("path");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
13
32
|
const typescript_1 = require("typescript");
|
|
14
33
|
const webpack_1 = require("webpack");
|
|
15
34
|
function getOutputHashFormat(option, length = 20) {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { WebpackLoggingCallback } from '@angular-devkit/build-webpack';
|
|
9
9
|
import { logging } from '@angular-devkit/core';
|
|
10
10
|
import { Configuration, StatsCompilation } from 'webpack';
|
|
11
|
+
import { Schema as BrowserBuilderOptions } from '../../browser/schema';
|
|
11
12
|
export declare function formatSize(size: number): string;
|
|
12
13
|
export declare type BundleStatsData = [files: string, names: string, size: number | string];
|
|
13
14
|
export declare type ChunkType = 'modern' | 'legacy' | 'unknown';
|
|
@@ -20,15 +21,13 @@ export declare function generateBundleStats(info: {
|
|
|
20
21
|
size?: number;
|
|
21
22
|
files?: string[];
|
|
22
23
|
names?: string[];
|
|
23
|
-
entry?: boolean;
|
|
24
24
|
initial?: boolean;
|
|
25
25
|
rendered?: boolean;
|
|
26
26
|
chunkType?: ChunkType;
|
|
27
27
|
}): BundleStats;
|
|
28
|
-
export declare const IGNORE_WARNINGS: RegExp[];
|
|
29
28
|
export declare function statsWarningsToString(json: StatsCompilation, statsConfig: any): string;
|
|
30
29
|
export declare function statsErrorsToString(json: StatsCompilation, statsConfig: any): string;
|
|
31
30
|
export declare function statsHasErrors(json: StatsCompilation): boolean;
|
|
32
31
|
export declare function statsHasWarnings(json: StatsCompilation): boolean;
|
|
33
|
-
export declare function createWebpackLoggingCallback(
|
|
32
|
+
export declare function createWebpackLoggingCallback(options: BrowserBuilderOptions, logger: logging.LoggerApi): WebpackLoggingCallback;
|
|
34
33
|
export declare function webpackStatsLogger(logger: logging.LoggerApi, json: StatsCompilation, config: Configuration, bundleStats?: BundleStats[]): void;
|
|
@@ -6,13 +6,37 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
9
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.webpackStatsLogger = exports.createWebpackLoggingCallback = exports.statsHasWarnings = exports.statsHasErrors = exports.statsErrorsToString = exports.statsWarningsToString = exports.
|
|
32
|
+
exports.webpackStatsLogger = exports.createWebpackLoggingCallback = exports.statsHasWarnings = exports.statsHasErrors = exports.statsErrorsToString = exports.statsWarningsToString = exports.generateBundleStats = exports.formatSize = void 0;
|
|
11
33
|
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const path = require("path");
|
|
13
|
-
const
|
|
34
|
+
const path = __importStar(require("path"));
|
|
35
|
+
const text_table_1 = __importDefault(require("text-table"));
|
|
14
36
|
const color_1 = require("../../utils/color");
|
|
15
37
|
const stats_1 = require("../configs/stats");
|
|
38
|
+
const async_chunks_1 = require("./async-chunks");
|
|
39
|
+
const helpers_1 = require("./helpers");
|
|
16
40
|
function formatSize(size) {
|
|
17
41
|
if (size <= 0) {
|
|
18
42
|
return '0 bytes';
|
|
@@ -30,7 +54,7 @@ function generateBundleStats(info) {
|
|
|
30
54
|
const size = typeof info.size === 'number' ? info.size : '-';
|
|
31
55
|
const files = (_b = (_a = info.files) === null || _a === void 0 ? void 0 : _a.filter((f) => !f.endsWith('.map')).map((f) => path.basename(f)).join(', ')) !== null && _b !== void 0 ? _b : '';
|
|
32
56
|
const names = ((_c = info.names) === null || _c === void 0 ? void 0 : _c.length) ? info.names.join(', ') : '-';
|
|
33
|
-
const initial = !!
|
|
57
|
+
const initial = !!info.initial;
|
|
34
58
|
const chunkType = info.chunkType || 'unknown';
|
|
35
59
|
return {
|
|
36
60
|
chunkType,
|
|
@@ -103,7 +127,7 @@ function generateBuildStatsTable(data, colors, showTotalSize) {
|
|
|
103
127
|
if (changedLazyChunksStats.length) {
|
|
104
128
|
bundleInfo.push(['Lazy Chunk Files', 'Names', 'Size'].map(bold), ...changedLazyChunksStats);
|
|
105
129
|
}
|
|
106
|
-
return
|
|
130
|
+
return text_table_1.default(bundleInfo, {
|
|
107
131
|
hsep: dim(' | '),
|
|
108
132
|
stringLength: (s) => color_1.removeColor(s).length,
|
|
109
133
|
align: ['l', 'l', 'r'],
|
|
@@ -113,6 +137,10 @@ function generateBuildStats(hash, time, colors) {
|
|
|
113
137
|
const w = (x) => (colors ? color_1.colors.bold.white(x) : x);
|
|
114
138
|
return `Build at: ${w(new Date().toISOString())} - Hash: ${w(hash)} - Time: ${w('' + time)}ms`;
|
|
115
139
|
}
|
|
140
|
+
// We use this cache because we can have multiple builders running in the same process,
|
|
141
|
+
// where each builder has different output path.
|
|
142
|
+
// Ideally, we should create the logging callback as a factory, but that would need a refactoring.
|
|
143
|
+
const runsCache = new Set();
|
|
116
144
|
function statsToString(json,
|
|
117
145
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
146
|
statsConfig, bundleState) {
|
|
@@ -125,8 +153,11 @@ statsConfig, bundleState) {
|
|
|
125
153
|
const changedChunksStats = bundleState !== null && bundleState !== void 0 ? bundleState : [];
|
|
126
154
|
let unchangedChunkNumber = 0;
|
|
127
155
|
if (!(bundleState === null || bundleState === void 0 ? void 0 : bundleState.length)) {
|
|
156
|
+
const isFirstRun = !runsCache.has(json.outputPath || '');
|
|
128
157
|
for (const chunk of json.chunks) {
|
|
129
|
-
|
|
158
|
+
// During first build we want to display unchanged chunks
|
|
159
|
+
// but unchanged cached chunks are always marked as not rendered.
|
|
160
|
+
if (!isFirstRun && !chunk.rendered) {
|
|
130
161
|
continue;
|
|
131
162
|
}
|
|
132
163
|
const assets = (_b = json.assets) === null || _b === void 0 ? void 0 : _b.filter((asset) => { var _a; return (_a = chunk.files) === null || _a === void 0 ? void 0 : _a.includes(asset.name); });
|
|
@@ -134,6 +165,7 @@ statsConfig, bundleState) {
|
|
|
134
165
|
changedChunksStats.push(generateBundleStats({ ...chunk, size: summedSize }));
|
|
135
166
|
}
|
|
136
167
|
unchangedChunkNumber = json.chunks.length - changedChunksStats.length;
|
|
168
|
+
runsCache.add(json.outputPath || '');
|
|
137
169
|
}
|
|
138
170
|
// Sort chunks by size in descending order
|
|
139
171
|
changedChunksStats.sort((a, b) => {
|
|
@@ -172,13 +204,6 @@ statsConfig, bundleState) {
|
|
|
172
204
|
`));
|
|
173
205
|
}
|
|
174
206
|
}
|
|
175
|
-
exports.IGNORE_WARNINGS = [
|
|
176
|
-
// Webpack 5+ has no facility to disable this warning.
|
|
177
|
-
// System.import is used in @angular/core for deprecated string-form lazy routes
|
|
178
|
-
/System.import\(\) is deprecated and will be removed soon/i,
|
|
179
|
-
// https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83
|
|
180
|
-
/Failed to parse source map from/,
|
|
181
|
-
];
|
|
182
207
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
183
208
|
function statsWarningsToString(json, statsConfig) {
|
|
184
209
|
const colors = statsConfig.colors;
|
|
@@ -255,12 +280,22 @@ function statsHasWarnings(json) {
|
|
|
255
280
|
return !!(((_a = json.warnings) === null || _a === void 0 ? void 0 : _a.length) || ((_b = json.children) === null || _b === void 0 ? void 0 : _b.some((c) => { var _a; return (_a = c.warnings) === null || _a === void 0 ? void 0 : _a.length; })));
|
|
256
281
|
}
|
|
257
282
|
exports.statsHasWarnings = statsHasWarnings;
|
|
258
|
-
function createWebpackLoggingCallback(
|
|
283
|
+
function createWebpackLoggingCallback(options, logger) {
|
|
284
|
+
const { verbose = false, scripts = [], styles = [] } = options;
|
|
285
|
+
const extraEntryPoints = [
|
|
286
|
+
...helpers_1.normalizeExtraEntryPoints(styles, 'styles'),
|
|
287
|
+
...helpers_1.normalizeExtraEntryPoints(scripts, 'scripts'),
|
|
288
|
+
];
|
|
259
289
|
return (stats, config) => {
|
|
260
290
|
if (verbose) {
|
|
261
291
|
logger.info(stats.toString(config.stats));
|
|
262
292
|
}
|
|
263
|
-
|
|
293
|
+
const rawStats = stats.toJson(stats_1.getWebpackStatsConfig(false));
|
|
294
|
+
const webpackStats = {
|
|
295
|
+
...rawStats,
|
|
296
|
+
chunks: async_chunks_1.markAsyncChunksNonInitial(rawStats, extraEntryPoints),
|
|
297
|
+
};
|
|
298
|
+
webpackStatsLogger(logger, webpackStats, config);
|
|
264
299
|
};
|
|
265
300
|
}
|
|
266
301
|
exports.createWebpackLoggingCallback = createWebpackLoggingCallback;
|