@angular-devkit/build-angular 13.2.0-next.0 → 13.2.0-rc.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 +37 -37
- 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/sass/sass-service.d.ts +3 -3
- 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 +12 -12
- 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.js +5 -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-rc.1",
|
|
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-rc.1",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1302.0-rc.1",
|
|
12
|
+
"@angular-devkit/core": "13.2.0-rc.1",
|
|
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-rc.1",
|
|
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.
|
|
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.13",
|
|
35
35
|
"glob": "7.2.0",
|
|
36
36
|
"https-proxy-agent": "5.0.0",
|
|
37
37
|
"inquirer": "8.2.0",
|
|
@@ -41,47 +41,47 @@
|
|
|
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.2",
|
|
45
45
|
"minimatch": "3.0.4",
|
|
46
46
|
"open": "8.4.0",
|
|
47
47
|
"ora": "5.4.1",
|
|
48
48
|
"parse5-html-rewriting-stream": "6.0.1",
|
|
49
|
-
"piscina": "3.
|
|
50
|
-
"postcss": "8.4.
|
|
49
|
+
"piscina": "3.2.0",
|
|
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.13"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@angular/compiler-cli": "^13.0.0 || ^13.
|
|
79
|
-
"@angular/localize": "^13.0.0 || ^13.
|
|
80
|
-
"@angular/service-worker": "^13.0.0 || ^13.
|
|
78
|
+
"@angular/compiler-cli": "^13.0.0 || ^13.2.0-next",
|
|
79
|
+
"@angular/localize": "^13.0.0 || ^13.2.0-next",
|
|
80
|
+
"@angular/service-worker": "^13.0.0 || ^13.2.0-next",
|
|
81
81
|
"karma": "^6.3.0",
|
|
82
|
-
"ng-packagr": "^13.0.0 || ^13.
|
|
82
|
+
"ng-packagr": "^13.0.0 || ^13.2.0-next",
|
|
83
83
|
"protractor": "^7.0.0",
|
|
84
|
-
"tailwindcss": "^2.0.0",
|
|
84
|
+
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
85
85
|
"typescript": ">=4.4.3 <4.6"
|
|
86
86
|
},
|
|
87
87
|
"peerDependenciesMeta": {
|
|
@@ -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": [
|
|
@@ -5,11 +5,11 @@
|
|
|
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 {
|
|
8
|
+
import { LegacyResult as CompileResult, LegacyException as Exception, LegacyOptions as Options } from 'sass';
|
|
9
9
|
/**
|
|
10
10
|
* The callback type for the `dart-sass` asynchronous render function.
|
|
11
11
|
*/
|
|
12
|
-
declare type RenderCallback = (error?:
|
|
12
|
+
declare type RenderCallback = (error?: Exception, result?: CompileResult) => void;
|
|
13
13
|
/**
|
|
14
14
|
* A Sass renderer implementation that provides an interface that can be used by Webpack's
|
|
15
15
|
* `sass-loader`. The implementation uses a Worker thread to perform the Sass rendering
|
|
@@ -37,7 +37,7 @@ export declare class SassWorkerImplementation {
|
|
|
37
37
|
* @param options The `dart-sass` options to use when rendering the stylesheet.
|
|
38
38
|
* @param callback The function to execute when the rendering is complete.
|
|
39
39
|
*/
|
|
40
|
-
render(options: Options
|
|
40
|
+
render(options: Options<'async'>, callback: RenderCallback): void;
|
|
41
41
|
/**
|
|
42
42
|
* Shutdown the Sass render worker.
|
|
43
43
|
* Executing this method will stop any pending render requests.
|
|
@@ -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;
|