@angular-devkit/build-angular 13.2.0-next.1 → 13.2.0
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 +34 -34
- package/src/babel/webpack-loader.js +2 -1
- package/src/builders/browser/index.d.ts +5 -0
- package/src/builders/browser/index.js +9 -1
- package/src/builders/browser/schema.d.ts +8 -2
- package/src/builders/browser/schema.js +9 -7
- package/src/builders/browser/schema.json +6 -0
- package/src/builders/dev-server/index.js +8 -3
- package/src/builders/extract-i18n/index.js +3 -0
- package/src/builders/karma/index.js +3 -0
- package/src/builders/ng-packagr/index.js +3 -0
- package/src/builders/server/index.js +3 -0
- package/src/builders/server/schema.d.ts +8 -2
- package/src/builders/server/schema.js +9 -7
- package/src/builders/server/schema.json +6 -0
- package/src/utils/build-options.d.ts +2 -2
- package/src/utils/i18n-inlining.js +0 -14
- package/src/utils/i18n-options.d.ts +2 -2
- package/src/utils/i18n-options.js +40 -13
- package/src/utils/index-file/inline-fonts.js +2 -2
- package/src/utils/normalize-cache.d.ts +4 -0
- package/src/utils/normalize-cache.js +4 -1
- package/src/utils/package-version.d.ts +8 -0
- package/src/utils/package-version.js +11 -0
- package/src/utils/purge-cache.d.ts +10 -0
- package/src/utils/purge-cache.js +41 -0
- package/src/webpack/configs/common.js +11 -10
- package/src/webpack/configs/dev-server.js +26 -14
- package/src/webpack/configs/styles.js +6 -6
- package/src/webpack/plugins/any-component-style-budget-checker.js +4 -0
- package/src/webpack/plugins/javascript-optimizer-plugin.d.ts +14 -6
- package/src/webpack/plugins/javascript-optimizer-plugin.js +5 -4
- package/src/webpack/plugins/javascript-optimizer-worker.d.ts +45 -37
- package/src/webpack/plugins/javascript-optimizer-worker.js +10 -2
- package/src/webpack/plugins/karma/karma.js +2 -2
- package/src/webpack/utils/helpers.d.ts +1 -1
- package/src/webpack/utils/helpers.js +4 -4
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "13.2.0
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"typings": "src/index.d.ts",
|
|
7
7
|
"builders": "builders.json",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@ampproject/remapping": "1.
|
|
10
|
-
"@angular-devkit/architect": "0.1302.0
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1302.0
|
|
12
|
-
"@angular-devkit/core": "13.2.0
|
|
13
|
-
"@babel/core": "7.16.
|
|
14
|
-
"@babel/generator": "7.16.
|
|
15
|
-
"@babel/helper-annotate-as-pure": "7.16.
|
|
16
|
-
"@babel/plugin-proposal-async-generator-functions": "7.16.
|
|
17
|
-
"@babel/plugin-transform-async-to-generator": "7.16.
|
|
18
|
-
"@babel/plugin-transform-runtime": "7.16.
|
|
19
|
-
"@babel/preset-env": "7.16.
|
|
20
|
-
"@babel/runtime": "7.16.
|
|
21
|
-
"@babel/template": "7.16.
|
|
9
|
+
"@ampproject/remapping": "1.1.1",
|
|
10
|
+
"@angular-devkit/architect": "0.1302.0",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1302.0",
|
|
12
|
+
"@angular-devkit/core": "13.2.0",
|
|
13
|
+
"@babel/core": "7.16.12",
|
|
14
|
+
"@babel/generator": "7.16.8",
|
|
15
|
+
"@babel/helper-annotate-as-pure": "7.16.7",
|
|
16
|
+
"@babel/plugin-proposal-async-generator-functions": "7.16.8",
|
|
17
|
+
"@babel/plugin-transform-async-to-generator": "7.16.8",
|
|
18
|
+
"@babel/plugin-transform-runtime": "7.16.10",
|
|
19
|
+
"@babel/preset-env": "7.16.11",
|
|
20
|
+
"@babel/runtime": "7.16.7",
|
|
21
|
+
"@babel/template": "7.16.7",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.6",
|
|
23
|
-
"@ngtools/webpack": "13.2.0
|
|
23
|
+
"@ngtools/webpack": "13.2.0",
|
|
24
24
|
"ansi-colors": "4.1.1",
|
|
25
25
|
"babel-loader": "8.2.3",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
27
27
|
"browserslist": "^4.9.1",
|
|
28
28
|
"cacache": "15.3.0",
|
|
29
29
|
"circular-dependency-plugin": "5.2.2",
|
|
30
|
-
"copy-webpack-plugin": "10.1
|
|
31
|
-
"core-js": "3.
|
|
32
|
-
"critters": "0.0.
|
|
30
|
+
"copy-webpack-plugin": "10.2.1",
|
|
31
|
+
"core-js": "3.20.3",
|
|
32
|
+
"critters": "0.0.16",
|
|
33
33
|
"css-loader": "6.5.1",
|
|
34
|
-
"esbuild-wasm": "0.14.
|
|
34
|
+
"esbuild-wasm": "0.14.14",
|
|
35
35
|
"glob": "7.2.0",
|
|
36
36
|
"https-proxy-agent": "5.0.0",
|
|
37
37
|
"inquirer": "8.2.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"less-loader": "10.2.0",
|
|
42
42
|
"license-webpack-plugin": "4.0.0",
|
|
43
43
|
"loader-utils": "3.2.0",
|
|
44
|
-
"mini-css-extract-plugin": "2.
|
|
44
|
+
"mini-css-extract-plugin": "2.5.3",
|
|
45
45
|
"minimatch": "3.0.4",
|
|
46
46
|
"open": "8.4.0",
|
|
47
47
|
"ora": "5.4.1",
|
|
@@ -50,36 +50,36 @@
|
|
|
50
50
|
"postcss": "8.4.5",
|
|
51
51
|
"postcss-import": "14.0.2",
|
|
52
52
|
"postcss-loader": "6.2.1",
|
|
53
|
-
"postcss-preset-env": "
|
|
53
|
+
"postcss-preset-env": "7.2.3",
|
|
54
54
|
"regenerator-runtime": "0.13.9",
|
|
55
|
-
"resolve-url-loader": "
|
|
55
|
+
"resolve-url-loader": "5.0.0",
|
|
56
56
|
"rxjs": "6.6.7",
|
|
57
|
-
"sass": "1.
|
|
57
|
+
"sass": "1.49.0",
|
|
58
58
|
"sass-loader": "12.4.0",
|
|
59
59
|
"semver": "7.3.5",
|
|
60
|
-
"source-map-loader": "3.0.
|
|
60
|
+
"source-map-loader": "3.0.1",
|
|
61
61
|
"source-map-support": "0.5.21",
|
|
62
|
-
"stylus": "0.
|
|
62
|
+
"stylus": "0.56.0",
|
|
63
63
|
"stylus-loader": "6.2.0",
|
|
64
64
|
"terser": "5.10.0",
|
|
65
65
|
"text-table": "0.2.0",
|
|
66
66
|
"tree-kill": "1.2.2",
|
|
67
67
|
"tslib": "2.3.1",
|
|
68
|
-
"webpack": "5.
|
|
69
|
-
"webpack-dev-middleware": "5.
|
|
70
|
-
"webpack-dev-server": "4.
|
|
68
|
+
"webpack": "5.67.0",
|
|
69
|
+
"webpack-dev-middleware": "5.3.0",
|
|
70
|
+
"webpack-dev-server": "4.7.3",
|
|
71
71
|
"webpack-merge": "5.8.0",
|
|
72
|
-
"webpack-subresource-integrity": "5.
|
|
72
|
+
"webpack-subresource-integrity": "5.1.0"
|
|
73
73
|
},
|
|
74
74
|
"optionalDependencies": {
|
|
75
|
-
"esbuild": "0.14.
|
|
75
|
+
"esbuild": "0.14.14"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@angular/compiler-cli": "^13.0.0
|
|
79
|
-
"@angular/localize": "^13.0.0
|
|
80
|
-
"@angular/service-worker": "^13.0.0
|
|
78
|
+
"@angular/compiler-cli": "^13.0.0",
|
|
79
|
+
"@angular/localize": "^13.0.0",
|
|
80
|
+
"@angular/service-worker": "^13.0.0",
|
|
81
81
|
"karma": "^6.3.0",
|
|
82
|
-
"ng-packagr": "^13.0.0
|
|
82
|
+
"ng-packagr": "^13.0.0",
|
|
83
83
|
"protractor": "^7.0.0",
|
|
84
84
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
85
85
|
"typescript": ">=4.4.3 <4.6"
|
|
@@ -14,6 +14,7 @@ const remapping_1 = __importDefault(require("@ampproject/remapping"));
|
|
|
14
14
|
const babel_loader_1 = require("babel-loader");
|
|
15
15
|
const typescript_1 = require("typescript");
|
|
16
16
|
const load_esm_1 = require("../utils/load-esm");
|
|
17
|
+
const package_version_1 = require("../utils/package-version");
|
|
17
18
|
/**
|
|
18
19
|
* Cached instance of the compiler-cli linker's needsLinking function.
|
|
19
20
|
*/
|
|
@@ -151,7 +152,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
|
|
|
151
152
|
...baseOptions,
|
|
152
153
|
...rawOptions,
|
|
153
154
|
cacheIdentifier: JSON.stringify({
|
|
154
|
-
buildAngular:
|
|
155
|
+
buildAngular: package_version_1.VERSION,
|
|
155
156
|
customOptions,
|
|
156
157
|
baseOptions,
|
|
157
158
|
rawOptions,
|
|
@@ -24,6 +24,11 @@ export declare type BrowserBuilderOutput = json.JsonObject & BuilderOutput & {
|
|
|
24
24
|
*/
|
|
25
25
|
outputPath: string;
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Maximum time in milliseconds for single build/rebuild
|
|
29
|
+
* This accounts for CI variability.
|
|
30
|
+
*/
|
|
31
|
+
export declare const BUILD_TIMEOUT = 30000;
|
|
27
32
|
/**
|
|
28
33
|
* @experimental Direct usage of this function is considered experimental.
|
|
29
34
|
*/
|
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.buildWebpackBrowser = void 0;
|
|
29
|
+
exports.buildWebpackBrowser = exports.BUILD_TIMEOUT = void 0;
|
|
30
30
|
const architect_1 = require("@angular-devkit/architect");
|
|
31
31
|
const build_webpack_1 = require("@angular-devkit/build-webpack");
|
|
32
32
|
const core_1 = require("@angular-devkit/core");
|
|
@@ -44,6 +44,7 @@ const index_html_generator_1 = require("../../utils/index-file/index-html-genera
|
|
|
44
44
|
const normalize_cache_1 = require("../../utils/normalize-cache");
|
|
45
45
|
const output_paths_1 = require("../../utils/output-paths");
|
|
46
46
|
const package_chunk_sort_1 = require("../../utils/package-chunk-sort");
|
|
47
|
+
const purge_cache_1 = require("../../utils/purge-cache");
|
|
47
48
|
const service_worker_1 = require("../../utils/service-worker");
|
|
48
49
|
const spinner_1 = require("../../utils/spinner");
|
|
49
50
|
const supported_browsers_1 = require("../../utils/supported-browsers");
|
|
@@ -53,6 +54,11 @@ const configs_1 = require("../../webpack/configs");
|
|
|
53
54
|
const async_chunks_1 = require("../../webpack/utils/async-chunks");
|
|
54
55
|
const helpers_1 = require("../../webpack/utils/helpers");
|
|
55
56
|
const stats_1 = require("../../webpack/utils/stats");
|
|
57
|
+
/**
|
|
58
|
+
* Maximum time in milliseconds for single build/rebuild
|
|
59
|
+
* This accounts for CI variability.
|
|
60
|
+
*/
|
|
61
|
+
exports.BUILD_TIMEOUT = 30000;
|
|
56
62
|
async function initialize(options, context, webpackConfigurationTransform) {
|
|
57
63
|
var _a, _b;
|
|
58
64
|
const originalOutputPath = options.outputPath;
|
|
@@ -98,6 +104,8 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
98
104
|
return (0, rxjs_1.from)(context.getProjectMetadata(projectName)).pipe((0, operators_1.switchMap)(async (projectMetadata) => {
|
|
99
105
|
var _a;
|
|
100
106
|
const sysProjectRoot = (0, core_1.getSystemPath)((0, core_1.resolve)((0, core_1.normalize)(context.workspaceRoot), (0, core_1.normalize)((_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '')));
|
|
107
|
+
// Purge old build disk cache.
|
|
108
|
+
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
|
101
109
|
checkInternetExplorerSupport(sysProjectRoot, context.logger);
|
|
102
110
|
return {
|
|
103
111
|
...(await initialize(options, context, transforms.webpackConfiguration)),
|
|
@@ -53,10 +53,14 @@ export interface Schema {
|
|
|
53
53
|
* Replace compilation source files with other compilation source files in the build.
|
|
54
54
|
*/
|
|
55
55
|
fileReplacements?: FileReplacement[];
|
|
56
|
+
/**
|
|
57
|
+
* How to handle duplicate translations for i18n.
|
|
58
|
+
*/
|
|
59
|
+
i18nDuplicateTranslation?: I18NTranslation;
|
|
56
60
|
/**
|
|
57
61
|
* How to handle missing translations for i18n.
|
|
58
62
|
*/
|
|
59
|
-
i18nMissingTranslation?:
|
|
63
|
+
i18nMissingTranslation?: I18NTranslation;
|
|
60
64
|
/**
|
|
61
65
|
* Configures the generation of the application's HTML index.
|
|
62
66
|
*/
|
|
@@ -266,9 +270,11 @@ export interface FileReplacement {
|
|
|
266
270
|
with?: string;
|
|
267
271
|
}
|
|
268
272
|
/**
|
|
273
|
+
* How to handle duplicate translations for i18n.
|
|
274
|
+
*
|
|
269
275
|
* How to handle missing translations for i18n.
|
|
270
276
|
*/
|
|
271
|
-
export declare enum
|
|
277
|
+
export declare enum I18NTranslation {
|
|
272
278
|
Error = "error",
|
|
273
279
|
Ignore = "ignore",
|
|
274
280
|
Warning = "warning"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
|
3
3
|
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.OutputHashing = exports.InlineStyleLanguage = exports.
|
|
5
|
+
exports.OutputHashing = exports.InlineStyleLanguage = exports.I18NTranslation = exports.CrossOrigin = exports.Type = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* The type of budget.
|
|
8
8
|
*/
|
|
@@ -26,14 +26,16 @@ var CrossOrigin;
|
|
|
26
26
|
CrossOrigin["UseCredentials"] = "use-credentials";
|
|
27
27
|
})(CrossOrigin = exports.CrossOrigin || (exports.CrossOrigin = {}));
|
|
28
28
|
/**
|
|
29
|
+
* How to handle duplicate translations for i18n.
|
|
30
|
+
*
|
|
29
31
|
* How to handle missing translations for i18n.
|
|
30
32
|
*/
|
|
31
|
-
var
|
|
32
|
-
(function (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})(
|
|
33
|
+
var I18NTranslation;
|
|
34
|
+
(function (I18NTranslation) {
|
|
35
|
+
I18NTranslation["Error"] = "error";
|
|
36
|
+
I18NTranslation["Ignore"] = "ignore";
|
|
37
|
+
I18NTranslation["Warning"] = "warning";
|
|
38
|
+
})(I18NTranslation = exports.I18NTranslation || (exports.I18NTranslation = {}));
|
|
37
39
|
/**
|
|
38
40
|
* The stylesheet language to use for the application's inline component styles.
|
|
39
41
|
*/
|
|
@@ -220,6 +220,12 @@
|
|
|
220
220
|
"enum": ["warning", "error", "ignore"],
|
|
221
221
|
"default": "warning"
|
|
222
222
|
},
|
|
223
|
+
"i18nDuplicateTranslation": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"description": "How to handle duplicate translations for i18n.",
|
|
226
|
+
"enum": ["warning", "error", "ignore"],
|
|
227
|
+
"default": "warning"
|
|
228
|
+
},
|
|
223
229
|
"localize": {
|
|
224
230
|
"description": "Translate the bundles in one or more locales.",
|
|
225
231
|
"oneOf": [
|
|
@@ -41,6 +41,7 @@ const i18n_options_1 = require("../../utils/i18n-options");
|
|
|
41
41
|
const load_translations_1 = require("../../utils/load-translations");
|
|
42
42
|
const normalize_cache_1 = require("../../utils/normalize-cache");
|
|
43
43
|
const package_chunk_sort_1 = require("../../utils/package-chunk-sort");
|
|
44
|
+
const purge_cache_1 = require("../../utils/purge-cache");
|
|
44
45
|
const version_1 = require("../../utils/version");
|
|
45
46
|
const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
|
|
46
47
|
const webpack_diagnostics_1 = require("../../utils/webpack-diagnostics");
|
|
@@ -69,6 +70,8 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
69
70
|
if (!projectName) {
|
|
70
71
|
throw new Error('The builder requires a target.');
|
|
71
72
|
}
|
|
73
|
+
// Purge old build disk cache.
|
|
74
|
+
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
|
72
75
|
options.port = await (0, check_port_1.checkPort)((_b = options.port) !== null && _b !== void 0 ? _b : 4200, options.host || 'localhost');
|
|
73
76
|
if (options.hmr) {
|
|
74
77
|
logger.warn(core_1.tags.stripIndents `NOTICE: Hot Module Replacement (HMR) is enabled for the dev server.
|
|
@@ -192,11 +195,12 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
192
195
|
}).pipe((0, operators_1.concatMap)(async (buildEvent, index) => {
|
|
193
196
|
var _a, _b;
|
|
194
197
|
// Resolve serve address.
|
|
198
|
+
const publicPath = (_b = (_a = webpackConfig.devServer) === null || _a === void 0 ? void 0 : _a.devMiddleware) === null || _b === void 0 ? void 0 : _b.publicPath;
|
|
195
199
|
const serverAddress = url.format({
|
|
196
200
|
protocol: options.ssl ? 'https' : 'http',
|
|
197
201
|
hostname: options.host === '0.0.0.0' ? 'localhost' : options.host,
|
|
198
202
|
port: buildEvent.port,
|
|
199
|
-
pathname:
|
|
203
|
+
pathname: typeof publicPath === 'string' ? publicPath : undefined,
|
|
200
204
|
});
|
|
201
205
|
if (index === 0) {
|
|
202
206
|
logger.info('\n' +
|
|
@@ -286,6 +290,7 @@ async function setupLocalize(locale, i18n, browserOptions, webpackConfig, cacheO
|
|
|
286
290
|
webpackConfig.plugins.push({
|
|
287
291
|
apply: (compiler) => {
|
|
288
292
|
compiler.hooks.thisCompilation.tap('build-angular', (compilation) => {
|
|
293
|
+
var _a;
|
|
289
294
|
if (i18n.shouldInline && i18nLoaderOptions.translation === undefined) {
|
|
290
295
|
// Reload translations
|
|
291
296
|
(0, i18n_options_1.loadTranslations)(locale, localeDescription, context.workspaceRoot, loader, {
|
|
@@ -295,8 +300,8 @@ async function setupLocalize(locale, i18n, browserOptions, webpackConfig, cacheO
|
|
|
295
300
|
error(message) {
|
|
296
301
|
(0, webpack_diagnostics_1.addError)(compilation, message);
|
|
297
302
|
},
|
|
298
|
-
});
|
|
299
|
-
i18nLoaderOptions.translation = localeDescription.translation;
|
|
303
|
+
}, undefined, browserOptions.i18nDuplicateTranslation);
|
|
304
|
+
i18nLoaderOptions.translation = (_a = localeDescription.translation) !== null && _a !== void 0 ? _a : {};
|
|
300
305
|
}
|
|
301
306
|
compilation.hooks.finishModules.tap('build-angular', () => {
|
|
302
307
|
// After loaders are finished, clear out the now unneeded translations
|
|
@@ -37,6 +37,7 @@ const path = __importStar(require("path"));
|
|
|
37
37
|
const webpack_1 = __importDefault(require("webpack"));
|
|
38
38
|
const i18n_options_1 = require("../../utils/i18n-options");
|
|
39
39
|
const load_esm_1 = require("../../utils/load-esm");
|
|
40
|
+
const purge_cache_1 = require("../../utils/purge-cache");
|
|
40
41
|
const version_1 = require("../../utils/version");
|
|
41
42
|
const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
|
|
42
43
|
const configs_1 = require("../../webpack/configs");
|
|
@@ -119,6 +120,8 @@ async function execute(options, context, transforms) {
|
|
|
119
120
|
var _a;
|
|
120
121
|
// Check Angular version.
|
|
121
122
|
(0, version_1.assertCompatibleAngularVersion)(context.workspaceRoot);
|
|
123
|
+
// Purge old build disk cache.
|
|
124
|
+
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
|
122
125
|
const browserTarget = (0, architect_1.targetFromTargetString)(options.browserTarget);
|
|
123
126
|
const browserOptions = await context.validateOptions(await context.getTargetOptions(browserTarget), await context.getBuilderNameForTarget(browserTarget));
|
|
124
127
|
const format = normalizeFormatOption(options);
|
|
@@ -32,6 +32,7 @@ const core_1 = require("@angular-devkit/core");
|
|
|
32
32
|
const path_1 = require("path");
|
|
33
33
|
const rxjs_1 = require("rxjs");
|
|
34
34
|
const operators_1 = require("rxjs/operators");
|
|
35
|
+
const purge_cache_1 = require("../../utils/purge-cache");
|
|
35
36
|
const version_1 = require("../../utils/version");
|
|
36
37
|
const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
|
|
37
38
|
const configs_1 = require("../../webpack/configs");
|
|
@@ -39,6 +40,8 @@ const single_test_transform_1 = require("../../webpack/plugins/single-test-trans
|
|
|
39
40
|
const schema_1 = require("../browser/schema");
|
|
40
41
|
const find_tests_1 = require("./find-tests");
|
|
41
42
|
async function initialize(options, context, webpackConfigurationTransformer) {
|
|
43
|
+
// Purge old build disk cache.
|
|
44
|
+
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
|
42
45
|
const { config } = await (0, webpack_browser_config_1.generateBrowserWebpackConfigFromContext)(
|
|
43
46
|
// only two properties are missing:
|
|
44
47
|
// * `outputPath` which is fixed for tests
|
|
@@ -32,12 +32,15 @@ const path_1 = require("path");
|
|
|
32
32
|
const rxjs_1 = require("rxjs");
|
|
33
33
|
const operators_1 = require("rxjs/operators");
|
|
34
34
|
const normalize_cache_1 = require("../../utils/normalize-cache");
|
|
35
|
+
const purge_cache_1 = require("../../utils/purge-cache");
|
|
35
36
|
/**
|
|
36
37
|
* @experimental Direct usage of this function is considered experimental.
|
|
37
38
|
*/
|
|
38
39
|
function execute(options, context) {
|
|
39
40
|
return (0, rxjs_1.from)((async () => {
|
|
40
41
|
var _a;
|
|
42
|
+
// Purge old build disk cache.
|
|
43
|
+
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
|
41
44
|
const root = context.workspaceRoot;
|
|
42
45
|
const packager = (await Promise.resolve().then(() => __importStar(require('ng-packagr')))).ngPackagr();
|
|
43
46
|
packager.forProject((0, path_1.resolve)(root, options.project));
|
|
@@ -37,6 +37,7 @@ const typescript_1 = require("typescript");
|
|
|
37
37
|
const utils_1 = require("../../utils");
|
|
38
38
|
const i18n_inlining_1 = require("../../utils/i18n-inlining");
|
|
39
39
|
const output_paths_1 = require("../../utils/output-paths");
|
|
40
|
+
const purge_cache_1 = require("../../utils/purge-cache");
|
|
40
41
|
const version_1 = require("../../utils/version");
|
|
41
42
|
const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
|
|
42
43
|
const configs_1 = require("../../webpack/configs");
|
|
@@ -103,6 +104,8 @@ function execute(options, context, transforms = {}) {
|
|
|
103
104
|
exports.execute = execute;
|
|
104
105
|
exports.default = (0, architect_1.createBuilder)(execute);
|
|
105
106
|
async function initialize(options, context, webpackConfigurationTransform) {
|
|
107
|
+
// Purge old build disk cache.
|
|
108
|
+
await (0, purge_cache_1.purgeStaleBuildCache)(context);
|
|
106
109
|
const originalOutputPath = options.outputPath;
|
|
107
110
|
const { config, i18n, target } = await (0, webpack_browser_config_1.generateI18nBrowserWebpackConfigFromContext)({
|
|
108
111
|
...options,
|
|
@@ -28,10 +28,14 @@ export interface Schema {
|
|
|
28
28
|
* Replace compilation source files with other compilation source files in the build.
|
|
29
29
|
*/
|
|
30
30
|
fileReplacements?: FileReplacement[];
|
|
31
|
+
/**
|
|
32
|
+
* How to handle duplicate translations for i18n.
|
|
33
|
+
*/
|
|
34
|
+
i18nDuplicateTranslation?: I18NTranslation;
|
|
31
35
|
/**
|
|
32
36
|
* How to handle missing translations for i18n.
|
|
33
37
|
*/
|
|
34
|
-
i18nMissingTranslation?:
|
|
38
|
+
i18nMissingTranslation?: I18NTranslation;
|
|
35
39
|
/**
|
|
36
40
|
* The stylesheet language to use for the application's inline component styles.
|
|
37
41
|
*/
|
|
@@ -128,9 +132,11 @@ export interface FileReplacement {
|
|
|
128
132
|
with?: string;
|
|
129
133
|
}
|
|
130
134
|
/**
|
|
135
|
+
* How to handle duplicate translations for i18n.
|
|
136
|
+
*
|
|
131
137
|
* How to handle missing translations for i18n.
|
|
132
138
|
*/
|
|
133
|
-
export declare enum
|
|
139
|
+
export declare enum I18NTranslation {
|
|
134
140
|
Error = "error",
|
|
135
141
|
Ignore = "ignore",
|
|
136
142
|
Warning = "warning"
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
|
|
3
3
|
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.OutputHashing = exports.InlineStyleLanguage = exports.
|
|
5
|
+
exports.OutputHashing = exports.InlineStyleLanguage = exports.I18NTranslation = exports.BundleDependenciesEnum = void 0;
|
|
6
6
|
var BundleDependenciesEnum;
|
|
7
7
|
(function (BundleDependenciesEnum) {
|
|
8
8
|
BundleDependenciesEnum["All"] = "all";
|
|
9
9
|
BundleDependenciesEnum["None"] = "none";
|
|
10
10
|
})(BundleDependenciesEnum = exports.BundleDependenciesEnum || (exports.BundleDependenciesEnum = {}));
|
|
11
11
|
/**
|
|
12
|
+
* How to handle duplicate translations for i18n.
|
|
13
|
+
*
|
|
12
14
|
* How to handle missing translations for i18n.
|
|
13
15
|
*/
|
|
14
|
-
var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})(
|
|
16
|
+
var I18NTranslation;
|
|
17
|
+
(function (I18NTranslation) {
|
|
18
|
+
I18NTranslation["Error"] = "error";
|
|
19
|
+
I18NTranslation["Ignore"] = "ignore";
|
|
20
|
+
I18NTranslation["Warning"] = "warning";
|
|
21
|
+
})(I18NTranslation = exports.I18NTranslation || (exports.I18NTranslation = {}));
|
|
20
22
|
/**
|
|
21
23
|
* The stylesheet language to use for the application's inline component styles.
|
|
22
24
|
*/
|
|
@@ -133,6 +133,12 @@
|
|
|
133
133
|
"enum": ["warning", "error", "ignore"],
|
|
134
134
|
"default": "warning"
|
|
135
135
|
},
|
|
136
|
+
"i18nDuplicateTranslation": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"description": "How to handle duplicate translations for i18n.",
|
|
139
|
+
"enum": ["warning", "error", "ignore"],
|
|
140
|
+
"default": "warning"
|
|
141
|
+
},
|
|
136
142
|
"localize": {
|
|
137
143
|
"description": "Translate the bundles in one or more locales.",
|
|
138
144
|
"oneOf": [
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { logging } from '@angular-devkit/core';
|
|
9
9
|
import type { ParsedConfiguration } from '@angular/compiler-cli';
|
|
10
|
-
import { AssetPatternClass, Budget, CrossOrigin, ExtraEntryPoint,
|
|
10
|
+
import { AssetPatternClass, Budget, CrossOrigin, ExtraEntryPoint, I18NTranslation, IndexUnion, InlineStyleLanguage, Localize, SourceMapClass } from '../builders/browser/schema';
|
|
11
11
|
import { Schema as DevServerSchema } from '../builders/dev-server/schema';
|
|
12
12
|
import { NormalizedCachedOptions } from './normalize-cache';
|
|
13
13
|
import { NormalizedFileReplacement } from './normalize-file-replacements';
|
|
@@ -26,7 +26,7 @@ export interface BuildOptions {
|
|
|
26
26
|
verbose?: boolean;
|
|
27
27
|
progress?: boolean;
|
|
28
28
|
localize?: Localize;
|
|
29
|
-
i18nMissingTranslation?:
|
|
29
|
+
i18nMissingTranslation?: I18NTranslation;
|
|
30
30
|
bundleDependencies?: boolean;
|
|
31
31
|
externalDependencies?: string[];
|
|
32
32
|
watch?: boolean;
|
|
@@ -51,24 +51,10 @@ function emittedFilesToInlineOptions(emittedFiles, scriptsEntryPointName, emitte
|
|
|
51
51
|
setLocale: emittedFile.name === 'main' || emittedFile.name === 'vendor',
|
|
52
52
|
};
|
|
53
53
|
originalFiles.push(originalPath);
|
|
54
|
-
// Remove temporary original file as the content has now been read
|
|
55
|
-
try {
|
|
56
|
-
fs.unlinkSync(originalPath);
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
context.logger.debug(`Unable to delete i18n temporary file [${originalPath}]: ${e.toString()}`);
|
|
60
|
-
}
|
|
61
54
|
try {
|
|
62
55
|
const originalMapPath = originalPath + '.map';
|
|
63
56
|
action.map = fs.readFileSync(originalMapPath, 'utf8');
|
|
64
57
|
originalFiles.push(originalMapPath);
|
|
65
|
-
// Remove temporary original map file as the content has now been read
|
|
66
|
-
try {
|
|
67
|
-
fs.unlinkSync(originalMapPath);
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
context.logger.debug(`Unable to delete i18n temporary file [${originalMapPath}]: ${e.toString()}`);
|
|
71
|
-
}
|
|
72
58
|
}
|
|
73
59
|
catch (err) {
|
|
74
60
|
if (err.code !== 'ENOENT') {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
9
|
import { json } from '@angular-devkit/core';
|
|
10
|
-
import { Schema as BrowserBuilderSchema } from '../builders/browser/schema';
|
|
10
|
+
import { Schema as BrowserBuilderSchema, I18NTranslation } from '../builders/browser/schema';
|
|
11
11
|
import { Schema as ServerBuilderSchema } from '../builders/server/schema';
|
|
12
12
|
import { TranslationLoader } from './load-translations';
|
|
13
13
|
export interface LocaleDescription {
|
|
@@ -36,4 +36,4 @@ export declare function configureI18nBuild<T extends BrowserBuilderSchema | Serv
|
|
|
36
36
|
export declare function loadTranslations(locale: string, desc: LocaleDescription, workspaceRoot: string, loader: TranslationLoader, logger: {
|
|
37
37
|
warn: (message: string) => void;
|
|
38
38
|
error: (message: string) => void;
|
|
39
|
-
}, usedFormats?: Set<string
|
|
39
|
+
}, usedFormats?: Set<string>, duplicateTranslation?: I18NTranslation): void;
|
|
@@ -16,6 +16,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
16
16
|
const module_1 = __importDefault(require("module"));
|
|
17
17
|
const os_1 = __importDefault(require("os"));
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const schema_1 = require("../builders/browser/schema");
|
|
19
20
|
const read_tsconfig_1 = require("../utils/read-tsconfig");
|
|
20
21
|
const load_translations_1 = require("./load-translations");
|
|
21
22
|
/**
|
|
@@ -166,7 +167,7 @@ async function configureI18nBuild(context, options) {
|
|
|
166
167
|
error(message) {
|
|
167
168
|
throw new Error(message);
|
|
168
169
|
},
|
|
169
|
-
}, usedFormats);
|
|
170
|
+
}, usedFormats, buildOptions.i18nDuplicateTranslation);
|
|
170
171
|
if (usedFormats.size > 1 && tsConfig.options.enableI18nLegacyMessageIdFormat !== false) {
|
|
171
172
|
// This limitation is only for legacy message id support (defaults to true as of 9.0)
|
|
172
173
|
throw new Error('Localization currently only supports using one type of translation file format for the entire application.');
|
|
@@ -176,12 +177,11 @@ async function configureI18nBuild(context, options) {
|
|
|
176
177
|
if (i18n.shouldInline) {
|
|
177
178
|
const tempPath = fs_1.default.mkdtempSync(path_1.default.join(fs_1.default.realpathSync(os_1.default.tmpdir()), 'angular-cli-i18n-'));
|
|
178
179
|
buildOptions.outputPath = tempPath;
|
|
179
|
-
|
|
180
|
-
process.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
catch { }
|
|
180
|
+
process.on('exit', () => deleteTempDirectory(tempPath));
|
|
181
|
+
process.once('SIGINT', () => {
|
|
182
|
+
deleteTempDirectory(tempPath);
|
|
183
|
+
// Needed due to `ora` as otherwise process will not terminate.
|
|
184
|
+
process.kill(process.pid, 'SIGINT');
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
return { buildOptions, i18n };
|
|
@@ -201,7 +201,22 @@ function findLocaleDataPath(locale, resolver) {
|
|
|
201
201
|
return null;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
/** Remove temporary directory used for i18n processing. */
|
|
205
|
+
function deleteTempDirectory(tempPath) {
|
|
206
|
+
// The below should be removed and replaced with just `rmSync` when support for Node.Js 12 is removed.
|
|
207
|
+
const { rmSync, rmdirSync } = fs_1.default;
|
|
208
|
+
try {
|
|
209
|
+
if (rmSync) {
|
|
210
|
+
rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
rmdirSync(tempPath, { recursive: true, maxRetries: 3 });
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch { }
|
|
217
|
+
}
|
|
218
|
+
function loadTranslations(locale, desc, workspaceRoot, loader, logger, usedFormats, duplicateTranslation) {
|
|
219
|
+
let translations = undefined;
|
|
205
220
|
for (const file of desc.files) {
|
|
206
221
|
const loadResult = loader(path_1.default.join(workspaceRoot, file.path));
|
|
207
222
|
for (const diagnostics of loadResult.diagnostics.messages) {
|
|
@@ -218,19 +233,31 @@ function loadTranslations(locale, desc, workspaceRoot, loader, logger, usedForma
|
|
|
218
233
|
usedFormats === null || usedFormats === void 0 ? void 0 : usedFormats.add(loadResult.format);
|
|
219
234
|
file.format = loadResult.format;
|
|
220
235
|
file.integrity = loadResult.integrity;
|
|
221
|
-
if (
|
|
236
|
+
if (translations) {
|
|
222
237
|
// Merge translations
|
|
223
238
|
for (const [id, message] of Object.entries(loadResult.translations)) {
|
|
224
|
-
if (
|
|
225
|
-
|
|
239
|
+
if (translations[id] !== undefined) {
|
|
240
|
+
const duplicateTranslationMessage = `[${file.path}]: Duplicate translations for message '${id}' when merging.`;
|
|
241
|
+
switch (duplicateTranslation) {
|
|
242
|
+
case schema_1.I18NTranslation.Ignore:
|
|
243
|
+
break;
|
|
244
|
+
case schema_1.I18NTranslation.Error:
|
|
245
|
+
logger.error(`ERROR ${duplicateTranslationMessage}`);
|
|
246
|
+
break;
|
|
247
|
+
case schema_1.I18NTranslation.Warning:
|
|
248
|
+
default:
|
|
249
|
+
logger.warn(`WARNING ${duplicateTranslationMessage}`);
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
226
252
|
}
|
|
227
|
-
|
|
253
|
+
translations[id] = message;
|
|
228
254
|
}
|
|
229
255
|
}
|
|
230
256
|
else {
|
|
231
257
|
// First or only translation file
|
|
232
|
-
|
|
258
|
+
translations = loadResult.translations;
|
|
233
259
|
}
|
|
234
260
|
}
|
|
261
|
+
desc.translation = translations;
|
|
235
262
|
}
|
|
236
263
|
exports.loadTranslations = loadTranslations;
|
|
@@ -36,8 +36,8 @@ const https = __importStar(require("https"));
|
|
|
36
36
|
const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
|
|
37
37
|
const path_1 = require("path");
|
|
38
38
|
const url_1 = require("url");
|
|
39
|
+
const package_version_1 = require("../package-version");
|
|
39
40
|
const html_rewriting_stream_1 = require("./html-rewriting-stream");
|
|
40
|
-
const packageVersion = require('../../../package.json').version;
|
|
41
41
|
const SUPPORTED_PROVIDERS = {
|
|
42
42
|
'fonts.googleapis.com': {
|
|
43
43
|
preconnectUrl: 'https://fonts.gstatic.com',
|
|
@@ -146,7 +146,7 @@ class InlineFontsProcessor {
|
|
|
146
146
|
}
|
|
147
147
|
async getResponse(url) {
|
|
148
148
|
var _a;
|
|
149
|
-
const key = `${
|
|
149
|
+
const key = `${package_version_1.VERSION}|${url}`;
|
|
150
150
|
if (this.cachePath) {
|
|
151
151
|
const entry = await cacache.get.info(this.cachePath, key);
|
|
152
152
|
if (entry) {
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { json } from '@angular-devkit/core';
|
|
9
9
|
export interface NormalizedCachedOptions {
|
|
10
|
+
/** Whether disk cache is enabled. */
|
|
10
11
|
enabled: boolean;
|
|
12
|
+
/** Disk cache path. Example: `/.angular/cache/v12.0.0`. */
|
|
11
13
|
path: string;
|
|
14
|
+
/** Disk cache base path. Example: `/.angular/cache`. */
|
|
15
|
+
basePath: string;
|
|
12
16
|
}
|
|
13
17
|
export declare function normalizeCacheOptions(metadata: json.JsonObject, worspaceRoot: string): NormalizedCachedOptions;
|
|
@@ -11,6 +11,7 @@ exports.normalizeCacheOptions = void 0;
|
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const environment_options_1 = require("./environment-options");
|
|
14
|
+
const package_version_1 = require("./package-version");
|
|
14
15
|
function normalizeCacheOptions(metadata, worspaceRoot) {
|
|
15
16
|
var _a;
|
|
16
17
|
const cacheMetadata = core_1.json.isJsonObject(metadata.cli) && core_1.json.isJsonObject(metadata.cli.cache)
|
|
@@ -32,9 +33,11 @@ function normalizeCacheOptions(metadata, worspaceRoot) {
|
|
|
32
33
|
break;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
const cacheBasePath = (0, path_1.resolve)(worspaceRoot, path);
|
|
35
37
|
return {
|
|
36
38
|
enabled: cacheEnabled,
|
|
37
|
-
|
|
39
|
+
basePath: cacheBasePath,
|
|
40
|
+
path: (0, path_1.join)(cacheBasePath, package_version_1.VERSION),
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
exports.normalizeCacheOptions = normalizeCacheOptions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.VERSION = void 0;
|
|
11
|
+
exports.VERSION = require('../../package.json').version;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
|
+
/** Delete stale cache directories used by previous versions of build-angular. */
|
|
10
|
+
export declare function purgeStaleBuildCache(context: BuilderContext): Promise<void>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.purgeStaleBuildCache = void 0;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const normalize_cache_1 = require("./normalize-cache");
|
|
14
|
+
/** Delete stale cache directories used by previous versions of build-angular. */
|
|
15
|
+
async function purgeStaleBuildCache(context) {
|
|
16
|
+
var _a;
|
|
17
|
+
const projectName = (_a = context.target) === null || _a === void 0 ? void 0 : _a.project;
|
|
18
|
+
if (!projectName) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const metadata = await context.getProjectMetadata(projectName);
|
|
22
|
+
const { basePath, path, enabled } = (0, normalize_cache_1.normalizeCacheOptions)(metadata, context.workspaceRoot);
|
|
23
|
+
if (!enabled || !(0, fs_1.existsSync)(basePath)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// The below should be removed and replaced with just `rm` when support for Node.Js 12 is removed.
|
|
27
|
+
const { rm, rmdir } = fs_1.promises;
|
|
28
|
+
const entriesToDelete = (await fs_1.promises.readdir(basePath, { withFileTypes: true }))
|
|
29
|
+
.filter((d) => (0, path_1.join)(basePath, d.name) !== path && d.isDirectory())
|
|
30
|
+
.map((d) => {
|
|
31
|
+
const subPath = (0, path_1.join)(basePath, d.name);
|
|
32
|
+
try {
|
|
33
|
+
return rm
|
|
34
|
+
? rm(subPath, { force: true, recursive: true, maxRetries: 3 })
|
|
35
|
+
: rmdir(subPath, { recursive: true, maxRetries: 3 });
|
|
36
|
+
}
|
|
37
|
+
catch { }
|
|
38
|
+
});
|
|
39
|
+
await Promise.all(entriesToDelete);
|
|
40
|
+
}
|
|
41
|
+
exports.purgeStaleBuildCache = purgeStaleBuildCache;
|
|
@@ -81,7 +81,7 @@ async function getCommonConfig(wco) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
if (!buildOptions.aot) {
|
|
84
|
-
const jitPolyfills = 'core-js/proposals/reflect-metadata';
|
|
84
|
+
const jitPolyfills = require.resolve('core-js/proposals/reflect-metadata');
|
|
85
85
|
if (entryPoints['polyfills']) {
|
|
86
86
|
entryPoints['polyfills'].push(jitPolyfills);
|
|
87
87
|
}
|
|
@@ -198,7 +198,8 @@ async function getCommonConfig(wco) {
|
|
|
198
198
|
define: buildOptions.aot ? GLOBAL_DEFS_FOR_TERSER_WITH_AOT : GLOBAL_DEFS_FOR_TERSER,
|
|
199
199
|
sourcemap: scriptsSourceMap,
|
|
200
200
|
target: scriptTarget,
|
|
201
|
-
|
|
201
|
+
keepIdentifierNames: !environment_options_1.allowMangle || isPlatformServer,
|
|
202
|
+
keepNames: isPlatformServer,
|
|
202
203
|
removeLicenses: buildOptions.extractLicenses,
|
|
203
204
|
advanced: buildOptions.buildOptimizer,
|
|
204
205
|
}));
|
|
@@ -271,14 +272,14 @@ async function getCommonConfig(wco) {
|
|
|
271
272
|
module: {
|
|
272
273
|
// Show an error for missing exports instead of a warning.
|
|
273
274
|
strictExportPresence: true,
|
|
274
|
-
parser:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
275
|
+
parser: {
|
|
276
|
+
javascript: {
|
|
277
|
+
// Disable auto URL asset module creation. This doesn't effect `new Worker(new URL(...))`
|
|
278
|
+
// https://webpack.js.org/guides/asset-modules/#url-assets
|
|
279
|
+
url: false,
|
|
280
|
+
worker: !!webWorkerTsConfig,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
282
283
|
rules: [
|
|
283
284
|
{
|
|
284
285
|
test: /\.?(svg|html)$/,
|
|
@@ -58,7 +58,6 @@ async function getDevServerConfig(wco) {
|
|
|
58
58
|
},
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
const webSocketPath = path_1.posix.join(servePath, 'ws');
|
|
62
61
|
return {
|
|
63
62
|
plugins: extraPlugins,
|
|
64
63
|
module: {
|
|
@@ -82,11 +81,6 @@ async function getDevServerConfig(wco) {
|
|
|
82
81
|
},
|
|
83
82
|
],
|
|
84
83
|
},
|
|
85
|
-
webSocketServer: {
|
|
86
|
-
options: {
|
|
87
|
-
path: webSocketPath,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
84
|
compress: false,
|
|
91
85
|
static: false,
|
|
92
86
|
server: getServerConfig(root, wco.buildOptions),
|
|
@@ -98,14 +92,7 @@ async function getDevServerConfig(wco) {
|
|
|
98
92
|
liveReload,
|
|
99
93
|
hot: hmr && !liveReload ? 'only' : hmr,
|
|
100
94
|
proxy: await addProxyConfig(root, proxyConfig),
|
|
101
|
-
|
|
102
|
-
logging: 'info',
|
|
103
|
-
webSocketURL: getPublicHostOptions(wco.buildOptions, webSocketPath),
|
|
104
|
-
overlay: {
|
|
105
|
-
errors: true,
|
|
106
|
-
warnings: false,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
95
|
+
...getWebSocketSettings(wco.buildOptions, servePath),
|
|
109
96
|
},
|
|
110
97
|
};
|
|
111
98
|
}
|
|
@@ -271,6 +258,31 @@ function getAllowedHostsConfig(options) {
|
|
|
271
258
|
}
|
|
272
259
|
return undefined;
|
|
273
260
|
}
|
|
261
|
+
function getWebSocketSettings(options, servePath) {
|
|
262
|
+
const { hmr, liveReload } = options;
|
|
263
|
+
if (!hmr && !liveReload) {
|
|
264
|
+
return {
|
|
265
|
+
webSocketServer: false,
|
|
266
|
+
client: undefined,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const webSocketPath = path_1.posix.join(servePath, 'ws');
|
|
270
|
+
return {
|
|
271
|
+
webSocketServer: {
|
|
272
|
+
options: {
|
|
273
|
+
path: webSocketPath,
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
client: {
|
|
277
|
+
logging: 'info',
|
|
278
|
+
webSocketURL: getPublicHostOptions(options, webSocketPath),
|
|
279
|
+
overlay: {
|
|
280
|
+
errors: true,
|
|
281
|
+
warnings: false,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
}
|
|
274
286
|
function getPublicHostOptions(options, webSocketPath) {
|
|
275
287
|
let publicHost = options.publicHost;
|
|
276
288
|
if (publicHost) {
|
|
@@ -25,9 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
__setModuleDefault(result, mod);
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
28
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
32
|
exports.getStylesConfig = void 0;
|
|
30
33
|
const fs = __importStar(require("fs"));
|
|
34
|
+
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
31
35
|
const path = __importStar(require("path"));
|
|
32
36
|
const sass_service_1 = require("../../sass/sass-service");
|
|
33
37
|
const plugins_1 = require("../plugins");
|
|
@@ -70,7 +74,6 @@ function resolveGlobalStyles(styleEntrypoints, root, preserveSymlinks) {
|
|
|
70
74
|
// eslint-disable-next-line max-lines-per-function
|
|
71
75
|
function getStylesConfig(wco) {
|
|
72
76
|
var _a, _b, _c;
|
|
73
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
74
77
|
const postcssImports = require('postcss-import');
|
|
75
78
|
const postcssPresetEnv = require('postcss-preset-env');
|
|
76
79
|
const { root, buildOptions } = wco;
|
|
@@ -129,9 +132,6 @@ function getStylesConfig(wco) {
|
|
|
129
132
|
` To enable Tailwind CSS, please install the 'tailwindcss' package.`);
|
|
130
133
|
}
|
|
131
134
|
if (tailwindPackagePath) {
|
|
132
|
-
if (process.env['TAILWIND_MODE'] === undefined) {
|
|
133
|
-
process.env['TAILWIND_MODE'] = buildOptions.watch ? 'watch' : 'build';
|
|
134
|
-
}
|
|
135
135
|
extraPostcssPlugins.push(require(tailwindPackagePath)({ config: tailwindConfigPath }));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
@@ -191,7 +191,7 @@ function getStylesConfig(wco) {
|
|
|
191
191
|
// for component css.
|
|
192
192
|
!buildOptions.sourceMap.hidden);
|
|
193
193
|
// extract global css from js files into own css file.
|
|
194
|
-
extraPlugins.push(new
|
|
194
|
+
extraPlugins.push(new mini_css_extract_plugin_1.default({ filename: `[name]${hashFormat.extract}.css` }));
|
|
195
195
|
if (!buildOptions.hmr) {
|
|
196
196
|
// don't remove `.js` files for `.css` when we are using HMR these contain HMR accept codes.
|
|
197
197
|
// suppress empty .js files in css only entry points.
|
|
@@ -210,7 +210,7 @@ function getStylesConfig(wco) {
|
|
|
210
210
|
];
|
|
211
211
|
const globalStyleLoaders = [
|
|
212
212
|
{
|
|
213
|
-
loader:
|
|
213
|
+
loader: mini_css_extract_plugin_1.default.loader,
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
loader: require.resolve('css-loader'),
|
|
@@ -47,6 +47,10 @@ class AnyComponentStyleBudgetChecker {
|
|
|
47
47
|
name: PLUGIN_NAME,
|
|
48
48
|
stage: webpack_1.Compilation.PROCESS_ASSETS_STAGE_ANALYSE,
|
|
49
49
|
}, () => {
|
|
50
|
+
// No budgets.
|
|
51
|
+
if (this.budgets.length === 0) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
50
54
|
// In AOT compilations component styles get processed in child compilations.
|
|
51
55
|
if (!compilation.compiler.parentCompilation) {
|
|
52
56
|
return;
|
|
@@ -13,10 +13,10 @@ import type { Compiler } from 'webpack';
|
|
|
13
13
|
export interface JavaScriptOptimizerOptions {
|
|
14
14
|
/**
|
|
15
15
|
* Enables advanced optimizations in the underlying JavaScript optimizers.
|
|
16
|
-
* This currently increases the `terser` passes to
|
|
16
|
+
* This currently increases the `terser` passes to 2 and enables the `pure_getters`
|
|
17
17
|
* option for `terser`.
|
|
18
18
|
*/
|
|
19
|
-
advanced
|
|
19
|
+
advanced?: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* An object record of string keys that will be replaced with their respective values when found
|
|
22
22
|
* within the code during optimization.
|
|
@@ -27,7 +27,7 @@ export interface JavaScriptOptimizerOptions {
|
|
|
27
27
|
* The output sourcemap will be a full sourcemap containing the merge of the input sourcemap and
|
|
28
28
|
* all intermediate sourcemaps.
|
|
29
29
|
*/
|
|
30
|
-
sourcemap
|
|
30
|
+
sourcemap?: boolean;
|
|
31
31
|
/**
|
|
32
32
|
* The ECMAScript version that should be used when generating output code.
|
|
33
33
|
* The optimizer will not adjust the output code with features present in newer
|
|
@@ -37,12 +37,20 @@ export interface JavaScriptOptimizerOptions {
|
|
|
37
37
|
/**
|
|
38
38
|
* Enables the retention of identifier names and ensures that function and class names are
|
|
39
39
|
* present in the output code.
|
|
40
|
+
*
|
|
41
|
+
* **Note**: in some cases symbols are still renamed to avoid collisions.
|
|
42
|
+
*/
|
|
43
|
+
keepIdentifierNames: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Enables the retention of original name of classes and functions.
|
|
46
|
+
*
|
|
47
|
+
* **Note**: this causes increase of bundle size as it causes dead-code elimination to not work fully.
|
|
40
48
|
*/
|
|
41
49
|
keepNames: boolean;
|
|
42
50
|
/**
|
|
43
51
|
* Enables the removal of all license comments from the output code.
|
|
44
52
|
*/
|
|
45
|
-
removeLicenses
|
|
53
|
+
removeLicenses?: boolean;
|
|
46
54
|
}
|
|
47
55
|
/**
|
|
48
56
|
* A Webpack plugin that provides JavaScript optimization capabilities.
|
|
@@ -53,7 +61,7 @@ export interface JavaScriptOptimizerOptions {
|
|
|
53
61
|
* optimizations not yet implemented by `esbuild`.
|
|
54
62
|
*/
|
|
55
63
|
export declare class JavaScriptOptimizerPlugin {
|
|
56
|
-
options:
|
|
57
|
-
constructor(options
|
|
64
|
+
options: JavaScriptOptimizerOptions;
|
|
65
|
+
constructor(options: JavaScriptOptimizerOptions);
|
|
58
66
|
apply(compiler: Compiler): void;
|
|
59
67
|
}
|
|
@@ -32,7 +32,7 @@ const PLUGIN_NAME = 'angular-javascript-optimizer';
|
|
|
32
32
|
* optimizations not yet implemented by `esbuild`.
|
|
33
33
|
*/
|
|
34
34
|
class JavaScriptOptimizerPlugin {
|
|
35
|
-
constructor(options
|
|
35
|
+
constructor(options) {
|
|
36
36
|
this.options = options;
|
|
37
37
|
}
|
|
38
38
|
apply(compiler) {
|
|
@@ -91,11 +91,11 @@ class JavaScriptOptimizerPlugin {
|
|
|
91
91
|
if (this.options.target <= typescript_1.ScriptTarget.ES5) {
|
|
92
92
|
target = 5;
|
|
93
93
|
}
|
|
94
|
-
else if (this.options.target
|
|
95
|
-
target =
|
|
94
|
+
else if (this.options.target === typescript_1.ScriptTarget.ESNext) {
|
|
95
|
+
target = 'next';
|
|
96
96
|
}
|
|
97
97
|
else {
|
|
98
|
-
target =
|
|
98
|
+
target = Number(typescript_1.ScriptTarget[this.options.target].slice(2));
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
// Setup the options used by all worker tasks
|
|
@@ -103,6 +103,7 @@ class JavaScriptOptimizerPlugin {
|
|
|
103
103
|
sourcemap: this.options.sourcemap,
|
|
104
104
|
define,
|
|
105
105
|
keepNames: this.options.keepNames,
|
|
106
|
+
keepIdentifierNames: this.options.keepIdentifierNames,
|
|
106
107
|
target,
|
|
107
108
|
removeLicenses: this.options.removeLicenses,
|
|
108
109
|
advanced: this.options.advanced,
|
|
@@ -5,6 +5,50 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* The options to use when optimizing.
|
|
10
|
+
*/
|
|
11
|
+
export interface OptimizeRequestOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Controls advanced optimizations.
|
|
14
|
+
* Currently these are only terser related:
|
|
15
|
+
* * terser compress passes are set to 2
|
|
16
|
+
* * terser pure_getters option is enabled
|
|
17
|
+
*/
|
|
18
|
+
advanced?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the string tokens that should be replaced with a defined value.
|
|
21
|
+
*/
|
|
22
|
+
define?: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Controls whether class, function, and variable names should be left intact
|
|
25
|
+
* throughout the output code.
|
|
26
|
+
*/
|
|
27
|
+
keepIdentifierNames: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Controls whether to retain the original name of classes and functions.
|
|
30
|
+
*/
|
|
31
|
+
keepNames: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Controls whether license text is removed from the output code.
|
|
34
|
+
* Within the CLI, this option is linked to the license extraction functionality.
|
|
35
|
+
*/
|
|
36
|
+
removeLicenses?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Controls whether source maps should be generated.
|
|
39
|
+
*/
|
|
40
|
+
sourcemap?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Specifies the target ECMAScript version for the output code.
|
|
43
|
+
*/
|
|
44
|
+
target: 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 'next';
|
|
45
|
+
/**
|
|
46
|
+
* Controls whether esbuild should only use the WASM-variant instead of trying to
|
|
47
|
+
* use the native variant. Some platforms may not support the native-variant and
|
|
48
|
+
* this option allows one support test to be conducted prior to all the workers starting.
|
|
49
|
+
*/
|
|
50
|
+
alwaysUseWasm: boolean;
|
|
51
|
+
}
|
|
8
52
|
/**
|
|
9
53
|
* A request to optimize JavaScript using the supplied options.
|
|
10
54
|
*/
|
|
@@ -12,43 +56,7 @@ interface OptimizeRequest {
|
|
|
12
56
|
/**
|
|
13
57
|
* The options to use when optimizing.
|
|
14
58
|
*/
|
|
15
|
-
options:
|
|
16
|
-
/**
|
|
17
|
-
* Controls advanced optimizations.
|
|
18
|
-
* Currently these are only terser related:
|
|
19
|
-
* * terser compress passes are set to 2
|
|
20
|
-
* * terser pure_getters option is enabled
|
|
21
|
-
*/
|
|
22
|
-
advanced: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Specifies the string tokens that should be replaced with a defined value.
|
|
25
|
-
*/
|
|
26
|
-
define?: Record<string, string>;
|
|
27
|
-
/**
|
|
28
|
-
* Controls whether class, function, and variable names should be left intact
|
|
29
|
-
* throughout the output code.
|
|
30
|
-
*/
|
|
31
|
-
keepNames: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Controls whether license text is removed from the output code.
|
|
34
|
-
* Within the CLI, this option is linked to the license extraction functionality.
|
|
35
|
-
*/
|
|
36
|
-
removeLicenses: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Controls whether source maps should be generated.
|
|
39
|
-
*/
|
|
40
|
-
sourcemap: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Specifies the target ECMAScript version for the output code.
|
|
43
|
-
*/
|
|
44
|
-
target: 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020;
|
|
45
|
-
/**
|
|
46
|
-
* Controls whether esbuild should only use the WASM-variant instead of trying to
|
|
47
|
-
* use the native variant. Some platforms may not support the native-variant and
|
|
48
|
-
* this option allows one support test to be conducted prior to all the workers starting.
|
|
49
|
-
*/
|
|
50
|
-
alwaysUseWasm: boolean;
|
|
51
|
-
};
|
|
59
|
+
options: OptimizeRequestOptions;
|
|
52
60
|
/**
|
|
53
61
|
* The JavaScript asset to optimize.
|
|
54
62
|
*/
|
|
@@ -26,7 +26,9 @@ async function default_1({ asset, options }) {
|
|
|
26
26
|
// esbuild is used as a first pass
|
|
27
27
|
const esbuildResult = await optimizeWithEsbuild(asset.code, asset.name, options);
|
|
28
28
|
// terser is used as a second pass
|
|
29
|
-
const terserResult = await optimizeWithTerser(asset.name, esbuildResult.code, options.sourcemap,
|
|
29
|
+
const terserResult = await optimizeWithTerser(asset.name, esbuildResult.code, options.sourcemap,
|
|
30
|
+
// Terser only supports up to ES2020.
|
|
31
|
+
options.target === 'next' ? 2020 : options.target, options.advanced);
|
|
30
32
|
// Merge intermediate sourcemaps with input sourcemap if enabled
|
|
31
33
|
let fullSourcemap;
|
|
32
34
|
if (options.sourcemap) {
|
|
@@ -61,7 +63,7 @@ async function optimizeWithEsbuild(content, name, options) {
|
|
|
61
63
|
let result;
|
|
62
64
|
try {
|
|
63
65
|
result = await esbuild.transform(content, {
|
|
64
|
-
minifyIdentifiers: !options.
|
|
66
|
+
minifyIdentifiers: !options.keepIdentifierNames,
|
|
65
67
|
minifySyntax: true,
|
|
66
68
|
// NOTE: Disabling whitespace ensures unused pure annotations are kept
|
|
67
69
|
minifyWhitespace: false,
|
|
@@ -70,6 +72,10 @@ async function optimizeWithEsbuild(content, name, options) {
|
|
|
70
72
|
sourcefile: name,
|
|
71
73
|
sourcemap: options.sourcemap && 'external',
|
|
72
74
|
define: options.define,
|
|
75
|
+
// This option should always be disabled for browser builds as we don't rely on `.name`
|
|
76
|
+
// and causes deadcode to be retained which makes `NG_BUILD_MANGLE` unusable to investigate tree-shaking issues.
|
|
77
|
+
// We enable `keepNames` only for server builds as Domino relies on `.name`.
|
|
78
|
+
// Once we no longer rely on Domino for SSR we should be able to remove this.
|
|
73
79
|
keepNames: options.keepNames,
|
|
74
80
|
target: `es${options.target}`,
|
|
75
81
|
});
|
|
@@ -113,6 +119,8 @@ async function optimizeWithTerser(name, code, sourcemaps, target, advanced) {
|
|
|
113
119
|
ecma: target,
|
|
114
120
|
// esbuild in the first pass is used to minify identifiers instead of mangle here
|
|
115
121
|
mangle: false,
|
|
122
|
+
// esbuild in the first pass is used to minify function names
|
|
123
|
+
keep_fnames: true,
|
|
116
124
|
format: {
|
|
117
125
|
// ASCII output is enabled here as well to prevent terser from converting back to UTF-8
|
|
118
126
|
ascii_only: true,
|
|
@@ -32,7 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
const path = __importStar(require("path"));
|
|
33
33
|
const glob = __importStar(require("glob"));
|
|
34
34
|
const webpack_1 = __importDefault(require("webpack"));
|
|
35
|
-
const
|
|
35
|
+
const webpack_dev_middleware_1 = __importDefault(require("webpack-dev-middleware"));
|
|
36
36
|
const stats_1 = require("../../utils/stats");
|
|
37
37
|
const node_1 = require("@angular-devkit/core/node");
|
|
38
38
|
const index_1 = require("../../../utils/index");
|
|
@@ -172,7 +172,7 @@ const init = (config, emitter) => {
|
|
|
172
172
|
}
|
|
173
173
|
unblock();
|
|
174
174
|
});
|
|
175
|
-
webpackMiddleware =
|
|
175
|
+
webpackMiddleware = (0, webpack_dev_middleware_1.default)(compiler, webpackMiddlewareConfig);
|
|
176
176
|
emitter.on('exit', (done) => {
|
|
177
177
|
webpackMiddleware.close();
|
|
178
178
|
done();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import type { ObjectPattern } from 'copy-webpack-plugin
|
|
8
|
+
import type { ObjectPattern } from 'copy-webpack-plugin';
|
|
9
9
|
import { ScriptTarget } from 'typescript';
|
|
10
10
|
import type { Configuration, WebpackOptionsNormalized } from 'webpack';
|
|
11
11
|
import { AssetPatternClass, ExtraEntryPoint, ExtraEntryPointClass } from '../../builders/browser/schema';
|
|
@@ -35,18 +35,19 @@ const fs_1 = require("fs");
|
|
|
35
35
|
const glob_1 = __importDefault(require("glob"));
|
|
36
36
|
const path = __importStar(require("path"));
|
|
37
37
|
const typescript_1 = require("typescript");
|
|
38
|
+
const package_version_1 = require("../../utils/package-version");
|
|
38
39
|
function getOutputHashFormat(option, length = 20) {
|
|
39
40
|
const hashFormats = {
|
|
40
41
|
none: { chunk: '', extract: '', file: '', script: '' },
|
|
41
42
|
media: { chunk: '', extract: '', file: `.[hash:${length}]`, script: '' },
|
|
42
43
|
bundles: {
|
|
43
|
-
chunk: `.[
|
|
44
|
+
chunk: `.[contenthash:${length}]`,
|
|
44
45
|
extract: `.[contenthash:${length}]`,
|
|
45
46
|
file: '',
|
|
46
47
|
script: `.[hash:${length}]`,
|
|
47
48
|
},
|
|
48
49
|
all: {
|
|
49
|
-
chunk: `.[
|
|
50
|
+
chunk: `.[contenthash:${length}]`,
|
|
50
51
|
extract: `.[contenthash:${length}]`,
|
|
51
52
|
file: `.[hash:${length}]`,
|
|
52
53
|
script: `.[hash:${length}]`,
|
|
@@ -113,7 +114,6 @@ exports.getInstrumentationExcludedPaths = getInstrumentationExcludedPaths;
|
|
|
113
114
|
function getCacheSettings(wco, angularVersion) {
|
|
114
115
|
const { enabled, path: cacheDirectory } = wco.buildOptions.cache;
|
|
115
116
|
if (enabled) {
|
|
116
|
-
const packageVersion = require('../../../package.json').version;
|
|
117
117
|
return {
|
|
118
118
|
type: 'filesystem',
|
|
119
119
|
profile: wco.buildOptions.verbose,
|
|
@@ -124,7 +124,7 @@ function getCacheSettings(wco, angularVersion) {
|
|
|
124
124
|
// None of which are "named".
|
|
125
125
|
name: (0, crypto_1.createHash)('sha1')
|
|
126
126
|
.update(angularVersion)
|
|
127
|
-
.update(
|
|
127
|
+
.update(package_version_1.VERSION)
|
|
128
128
|
.update(wco.projectRoot)
|
|
129
129
|
.update(JSON.stringify(wco.tsConfig))
|
|
130
130
|
.update(JSON.stringify({
|