@angular-devkit/build-angular 14.0.0-next.4 → 14.0.0-next.7
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/README.md +10 -10
- package/package.json +24 -25
- package/src/babel/plugins/pure-toplevel-functions.js +5 -1
- package/src/babel/presets/application.js +5 -1
- package/src/builders/app-shell/index.js +5 -1
- package/src/builders/app-shell/schema.d.ts +2 -2
- package/src/builders/app-shell/schema.json +2 -2
- package/src/builders/browser/index.js +5 -1
- package/src/builders/browser/schema.d.ts +0 -1
- package/src/builders/browser/schema.json +2 -3
- package/src/builders/dev-server/index.js +5 -1
- package/src/builders/dev-server/schema.d.ts +1 -1
- package/src/builders/dev-server/schema.json +1 -1
- package/src/builders/extract-i18n/index.js +5 -1
- package/src/builders/extract-i18n/ivy-extract-loader.js +5 -1
- package/src/builders/karma/find-tests.js +5 -1
- package/src/builders/karma/index.js +5 -1
- package/src/builders/ng-packagr/index.js +5 -1
- package/src/builders/protractor/index.js +5 -1
- package/src/builders/server/index.js +5 -1
- package/src/builders/server/schema.json +1 -2
- package/src/index.js +5 -1
- package/src/typings.d.ts +0 -4
- package/src/utils/check-port.js +8 -4
- package/src/utils/color.js +5 -1
- package/src/utils/copy-assets.js +5 -1
- package/src/utils/delete-output-dir.js +6 -9
- package/src/utils/environment-options.d.ts +0 -1
- package/src/utils/environment-options.js +1 -13
- package/src/utils/i18n-inlining.js +5 -1
- package/src/utils/i18n-options.js +1 -8
- package/src/utils/index-file/html-rewriting-stream.js +5 -1
- package/src/utils/index-file/index-html-generator.js +5 -1
- package/src/utils/index-file/inline-critical-css.js +5 -1
- package/src/utils/index-file/inline-fonts.js +5 -1
- package/src/utils/index.js +5 -1
- package/src/utils/load-translations.js +5 -1
- package/src/utils/normalize-cache.js +0 -4
- package/src/utils/process-bundle.js +6 -2
- package/src/utils/purge-cache.js +3 -8
- package/src/utils/read-tsconfig.js +5 -1
- package/src/utils/service-worker.js +5 -1
- package/src/utils/webpack-browser-config.js +5 -1
- package/src/webpack/configs/analytics.js +1 -4
- package/src/webpack/configs/common.js +9 -12
- package/src/webpack/configs/dev-server.js +6 -2
- package/src/webpack/configs/index.js +5 -1
- package/src/webpack/configs/styles.js +14 -21
- package/src/webpack/plugins/analytics.d.ts +1 -2
- package/src/webpack/plugins/analytics.js +1 -3
- package/src/webpack/plugins/any-component-style-budget-checker.js +5 -1
- package/src/webpack/plugins/common-js-usage-warn-plugin.js +2 -2
- package/src/webpack/plugins/css-optimizer-plugin.js +7 -3
- package/src/webpack/plugins/esbuild-executor.d.ts +2 -2
- package/src/webpack/plugins/esbuild-executor.js +11 -17
- package/src/webpack/plugins/javascript-optimizer-plugin.js +8 -4
- package/src/webpack/plugins/json-stats-plugin.js +5 -1
- package/src/webpack/plugins/karma/karma.js +5 -1
- package/src/webpack/plugins/named-chunks-plugin.js +5 -0
- package/src/webpack/plugins/postcss-cli-resources.js +7 -3
- package/src/webpack/plugins/scripts-webpack-plugin.js +5 -1
- package/src/webpack/plugins/transfer-size-plugin.js +3 -2
- package/src/webpack/utils/helpers.js +5 -1
- package/src/webpack/utils/stats.js +5 -1
- package/esbuild-check.js +0 -16
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
package/src/utils/index.js
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = void 0;
|
|
11
11
|
const core_1 = require("@angular-devkit/core");
|
|
12
12
|
const path_1 = require("path");
|
|
13
|
-
const environment_options_1 = require("./environment-options");
|
|
14
13
|
const package_version_1 = require("./package-version");
|
|
15
14
|
function normalizeCacheOptions(metadata, worspaceRoot) {
|
|
16
15
|
var _a;
|
|
@@ -20,9 +19,6 @@ function normalizeCacheOptions(metadata, worspaceRoot) {
|
|
|
20
19
|
const { enabled = true, environment = 'local', path = '.angular/cache' } = cacheMetadata;
|
|
21
20
|
const isCI = process.env['CI'] === '1' || ((_a = process.env['CI']) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
|
|
22
21
|
let cacheEnabled = enabled;
|
|
23
|
-
if (environment_options_1.cachingDisabled !== null) {
|
|
24
|
-
cacheEnabled = !environment_options_1.cachingDisabled;
|
|
25
|
-
}
|
|
26
22
|
if (cacheEnabled) {
|
|
27
23
|
switch (environment) {
|
|
28
24
|
case 'ci':
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -125,7 +129,7 @@ async function inlineLocales(options) {
|
|
|
125
129
|
// Same errors will contain the full content of the file as the error message
|
|
126
130
|
// Which makes it hard to find the actual error message.
|
|
127
131
|
const index = error.message.indexOf(')\n');
|
|
128
|
-
const msg = index !== -1 ? error.message.
|
|
132
|
+
const msg = index !== -1 ? error.message.slice(0, index + 1) : error.message;
|
|
129
133
|
throw new Error(`${msg}\nAn error occurred inlining file "${options.filename}"`);
|
|
130
134
|
}
|
|
131
135
|
}
|
package/src/utils/purge-cache.js
CHANGED
|
@@ -23,18 +23,13 @@ async function purgeStaleBuildCache(context) {
|
|
|
23
23
|
if (!enabled || !(0, fs_1.existsSync)(basePath)) {
|
|
24
24
|
return;
|
|
25
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
26
|
const entriesToDelete = (await fs_1.promises.readdir(basePath, { withFileTypes: true }))
|
|
29
27
|
.filter((d) => (0, path_1.join)(basePath, d.name) !== path && d.isDirectory())
|
|
30
28
|
.map((d) => {
|
|
31
29
|
const subPath = (0, path_1.join)(basePath, d.name);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
: rmdir(subPath, { recursive: true, maxRetries: 3 });
|
|
36
|
-
}
|
|
37
|
-
catch { }
|
|
30
|
+
return fs_1.promises
|
|
31
|
+
.rm(subPath, { force: true, recursive: true, maxRetries: 3 })
|
|
32
|
+
.catch(() => void 0);
|
|
38
33
|
});
|
|
39
34
|
await Promise.all(entriesToDelete);
|
|
40
35
|
}
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.getAnalyticsConfig = void 0;
|
|
11
11
|
const analytics_1 = require("../plugins/analytics");
|
|
12
12
|
function getAnalyticsConfig(wco, context) {
|
|
13
|
-
var _a;
|
|
14
13
|
if (!context.analytics) {
|
|
15
14
|
return {};
|
|
16
15
|
}
|
|
@@ -22,9 +21,7 @@ function getAnalyticsConfig(wco, context) {
|
|
|
22
21
|
}
|
|
23
22
|
// The category is the builder name if it's an angular builder.
|
|
24
23
|
return {
|
|
25
|
-
plugins: [
|
|
26
|
-
new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category, (_a = wco.buildOptions.aot) !== null && _a !== void 0 ? _a : false),
|
|
27
|
-
],
|
|
24
|
+
plugins: [new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category)],
|
|
28
25
|
};
|
|
29
26
|
}
|
|
30
27
|
exports.getAnalyticsConfig = getAnalyticsConfig;
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -80,15 +84,6 @@ async function getCommonConfig(wco) {
|
|
|
80
84
|
entryPoints['polyfills'] = [projectPolyfills];
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
|
-
if (!buildOptions.aot) {
|
|
84
|
-
const jitPolyfills = require.resolve('core-js/proposals/reflect-metadata');
|
|
85
|
-
if (entryPoints['polyfills']) {
|
|
86
|
-
entryPoints['polyfills'].push(jitPolyfills);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
entryPoints['polyfills'] = [jitPolyfills];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
87
|
}
|
|
93
88
|
if (allowedCommonJsDependencies) {
|
|
94
89
|
// When this is not defined it means the builder doesn't support showing common js usages.
|
|
@@ -179,7 +174,9 @@ async function getCommonConfig(wco) {
|
|
|
179
174
|
test: tsConfig.options.allowJs ? /\.[cm]?[tj]sx?$/ : /\.[cm]?tsx?$/,
|
|
180
175
|
loader: webpack_1.AngularWebpackLoaderPath,
|
|
181
176
|
// The below are known paths that are not part of the TypeScript compilation even when allowJs is enabled.
|
|
182
|
-
exclude: [
|
|
177
|
+
exclude: [
|
|
178
|
+
/[\\/]node_modules[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/,
|
|
179
|
+
],
|
|
183
180
|
});
|
|
184
181
|
extraPlugins.push((0, typescript_2.createIvyPlugin)(wco, aot, tsConfigPath));
|
|
185
182
|
}
|
|
@@ -293,7 +290,7 @@ async function getCommonConfig(wco) {
|
|
|
293
290
|
// The below is needed due to a bug in `@babel/runtime`. See: https://github.com/babel/babel/issues/12824
|
|
294
291
|
resolve: { fullySpecified: false },
|
|
295
292
|
exclude: [
|
|
296
|
-
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
|
|
293
|
+
/[\\/]node_modules[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
|
|
297
294
|
],
|
|
298
295
|
use: [
|
|
299
296
|
{
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -114,7 +118,7 @@ function buildServePath(options, logger) {
|
|
|
114
118
|
servePath = defaultPath || '';
|
|
115
119
|
}
|
|
116
120
|
if (servePath.endsWith('/')) {
|
|
117
|
-
servePath = servePath.
|
|
121
|
+
servePath = servePath.slice(0, -1);
|
|
118
122
|
}
|
|
119
123
|
if (!servePath.startsWith('/')) {
|
|
120
124
|
servePath = `/${servePath}`;
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -94,16 +98,14 @@ function getStylesConfig(wco) {
|
|
|
94
98
|
wco.logger.warn('Stylus usage is deprecated and will be removed in a future major version. ' +
|
|
95
99
|
'To opt-out of the deprecated behaviour, please migrate to another stylesheet language.');
|
|
96
100
|
}
|
|
97
|
-
const sassImplementation =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
}
|
|
101
|
+
const sassImplementation = new sass_service_1.SassWorkerImplementation();
|
|
102
|
+
extraPlugins.push({
|
|
103
|
+
apply(compiler) {
|
|
104
|
+
compiler.hooks.shutdown.tap('sass-worker', () => {
|
|
105
|
+
sassImplementation.close();
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
});
|
|
107
109
|
const assetNameTemplate = (0, helpers_1.assetNameTemplateFactory)(hashFormat);
|
|
108
110
|
const extraPostcssPlugins = [];
|
|
109
111
|
// Attempt to setup Tailwind CSS
|
|
@@ -151,7 +153,7 @@ function getStylesConfig(wco) {
|
|
|
151
153
|
: undefined,
|
|
152
154
|
plugins: [
|
|
153
155
|
postcssImports({
|
|
154
|
-
resolve: (url) => (url.startsWith('~') ? url.
|
|
156
|
+
resolve: (url) => (url.startsWith('~') ? url.slice(1) : url),
|
|
155
157
|
load: (filename) => {
|
|
156
158
|
return new Promise((resolve, reject) => {
|
|
157
159
|
loader.fs.readFile(filename, (err, data) => {
|
|
@@ -371,12 +373,3 @@ function getStylesConfig(wco) {
|
|
|
371
373
|
};
|
|
372
374
|
}
|
|
373
375
|
exports.getStylesConfig = getStylesConfig;
|
|
374
|
-
function getSassImplementation() {
|
|
375
|
-
const { webcontainer } = process.versions;
|
|
376
|
-
// When `webcontainer` is a truthy it means that we are running in a StackBlitz webcontainer.
|
|
377
|
-
// `SassWorkerImplementation` uses `receiveMessageOnPort` Node.js `worker_thread` API to ensure sync behavior which is ~2x faster.
|
|
378
|
-
// However, it is non trivial to support this in a webcontainer and while slower we choose to use `dart-sass`
|
|
379
|
-
// which in Webpack uses the slower async path.
|
|
380
|
-
// We should periodically check with StackBlitz folks (Mark Whitfeld / Dominic Elm) to determine if this workaround is still needed.
|
|
381
|
-
return webcontainer ? require('sass') : new sass_service_1.SassWorkerImplementation();
|
|
382
|
-
}
|
|
@@ -40,10 +40,9 @@ export declare class NgBuildAnalyticsPlugin {
|
|
|
40
40
|
protected _projectRoot: string;
|
|
41
41
|
protected _analytics: analytics.Analytics;
|
|
42
42
|
protected _category: string;
|
|
43
|
-
private aotEnabled;
|
|
44
43
|
protected _built: boolean;
|
|
45
44
|
protected _stats: AnalyticsBuildStats;
|
|
46
|
-
constructor(_projectRoot: string, _analytics: analytics.Analytics, _category: string
|
|
45
|
+
constructor(_projectRoot: string, _analytics: analytics.Analytics, _category: string);
|
|
47
46
|
protected _reset(): void;
|
|
48
47
|
protected _getMetrics(stats: Stats): (string | number)[];
|
|
49
48
|
protected _getDimensions(): (string | number | boolean)[];
|
|
@@ -73,11 +73,10 @@ class AnalyticsBuildStats {
|
|
|
73
73
|
* Analytics plugin that reports the analytics we want from the CLI.
|
|
74
74
|
*/
|
|
75
75
|
class NgBuildAnalyticsPlugin {
|
|
76
|
-
constructor(_projectRoot, _analytics, _category
|
|
76
|
+
constructor(_projectRoot, _analytics, _category) {
|
|
77
77
|
this._projectRoot = _projectRoot;
|
|
78
78
|
this._analytics = _analytics;
|
|
79
79
|
this._category = _category;
|
|
80
|
-
this.aotEnabled = aotEnabled;
|
|
81
80
|
this._built = false;
|
|
82
81
|
this._stats = new AnalyticsBuildStats();
|
|
83
82
|
}
|
|
@@ -108,7 +107,6 @@ class NgBuildAnalyticsPlugin {
|
|
|
108
107
|
// Adding commas before and after so the regex are easier to define filters.
|
|
109
108
|
dimensions[core_1.analytics.NgCliAnalyticsDimensions.BuildErrors] = `,${this._stats.errors.join()},`;
|
|
110
109
|
}
|
|
111
|
-
dimensions[core_1.analytics.NgCliAnalyticsDimensions.AotEnabled] = this.aotEnabled;
|
|
112
110
|
return dimensions;
|
|
113
111
|
}
|
|
114
112
|
_reportBuildMetrics(stats) {
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -22,7 +22,7 @@ class CommonJsUsageWarnPlugin {
|
|
|
22
22
|
apply(compiler) {
|
|
23
23
|
compiler.hooks.compilation.tap('CommonJsUsageWarnPlugin', (compilation) => {
|
|
24
24
|
compilation.hooks.finishModules.tap('CommonJsUsageWarnPlugin', (modules) => {
|
|
25
|
-
var _a
|
|
25
|
+
var _a;
|
|
26
26
|
const mainEntry = compilation.entries.get('main');
|
|
27
27
|
if (!mainEntry) {
|
|
28
28
|
return;
|
|
@@ -65,7 +65,7 @@ class CommonJsUsageWarnPlugin {
|
|
|
65
65
|
// And if the issuer request is not from 'webpack-dev-server', as 'webpack-dev-server'
|
|
66
66
|
// will require CommonJS libraries for live reloading such as 'sockjs-node'.
|
|
67
67
|
if (mainIssuer && mainModules.has(mainIssuer)) {
|
|
68
|
-
const warning = `${
|
|
68
|
+
const warning = `${issuer === null || issuer === void 0 ? void 0 : issuer.userRequest} depends on '${rawRequest}'. ` +
|
|
69
69
|
'CommonJS or AMD dependencies can cause optimization bailouts.\n' +
|
|
70
70
|
'For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies';
|
|
71
71
|
// Avoid showing the same warning multiple times when in 'watch' mode.
|
|
@@ -52,9 +52,10 @@ class CssOptimizerPlugin {
|
|
|
52
52
|
const cachedOutput = await cacheItem.getPromise();
|
|
53
53
|
if (cachedOutput) {
|
|
54
54
|
await this.addWarnings(compilation, cachedOutput.warnings);
|
|
55
|
-
compilation.updateAsset(name, cachedOutput.source, {
|
|
55
|
+
compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
|
|
56
|
+
...assetInfo,
|
|
56
57
|
minimized: true,
|
|
57
|
-
});
|
|
58
|
+
}));
|
|
58
59
|
continue;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -65,7 +66,10 @@ class CssOptimizerPlugin {
|
|
|
65
66
|
const optimizedAsset = map
|
|
66
67
|
? new SourceMapSource(code, name, map)
|
|
67
68
|
: new OriginalSource(code, name);
|
|
68
|
-
compilation.updateAsset(name, optimizedAsset,
|
|
69
|
+
compilation.updateAsset(name, optimizedAsset, (assetInfo) => ({
|
|
70
|
+
...assetInfo,
|
|
71
|
+
minimized: true,
|
|
72
|
+
}));
|
|
69
73
|
await (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.storePromise({
|
|
70
74
|
source: optimizedAsset,
|
|
71
75
|
warnings,
|
|
@@ -28,9 +28,9 @@ export declare class EsbuildExecutor implements Pick<typeof import('esbuild'), '
|
|
|
28
28
|
/**
|
|
29
29
|
* Determines whether the native variant of esbuild can be used on the current platform.
|
|
30
30
|
*
|
|
31
|
-
* @returns
|
|
31
|
+
* @returns A promise which resolves to `true`, if the native variant of esbuild is support or `false`, if the WASM variant is required.
|
|
32
32
|
*/
|
|
33
|
-
static hasNativeSupport(): boolean
|
|
33
|
+
static hasNativeSupport(): Promise<boolean>;
|
|
34
34
|
/**
|
|
35
35
|
* Initializes the esbuild transform and format messages functions.
|
|
36
36
|
*
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -27,8 +31,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
31
|
};
|
|
28
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
33
|
exports.EsbuildExecutor = void 0;
|
|
30
|
-
const child_process_1 = require("child_process");
|
|
31
|
-
const path = __importStar(require("path"));
|
|
32
34
|
/**
|
|
33
35
|
* Provides the ability to execute esbuild regardless of the current platform's support
|
|
34
36
|
* for using the native variant of esbuild. The native variant will be preferred (assuming
|
|
@@ -53,22 +55,14 @@ class EsbuildExecutor {
|
|
|
53
55
|
/**
|
|
54
56
|
* Determines whether the native variant of esbuild can be used on the current platform.
|
|
55
57
|
*
|
|
56
|
-
* @returns
|
|
58
|
+
* @returns A promise which resolves to `true`, if the native variant of esbuild is support or `false`, if the WASM variant is required.
|
|
57
59
|
*/
|
|
58
|
-
static hasNativeSupport() {
|
|
60
|
+
static async hasNativeSupport() {
|
|
59
61
|
// Try to use native variant to ensure it is functional for the platform.
|
|
60
|
-
// Spawning a separate esbuild check process is used to determine if the native
|
|
61
|
-
// variant is viable. If check fails, the WASM variant is initialized instead.
|
|
62
|
-
// Attempting to call one of the native esbuild functions is not a viable test
|
|
63
|
-
// currently since esbuild spawn errors are currently not propagated through the
|
|
64
|
-
// call stack for the esbuild function. If this limitation is removed in the future
|
|
65
|
-
// then the separate process spawn check can be removed in favor of a direct function
|
|
66
|
-
// call check.
|
|
67
62
|
try {
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return status === 0 && error === undefined;
|
|
63
|
+
const { formatMessages } = await Promise.resolve().then(() => __importStar(require('esbuild')));
|
|
64
|
+
await formatMessages([], { kind: 'error' });
|
|
65
|
+
return true;
|
|
72
66
|
}
|
|
73
67
|
catch {
|
|
74
68
|
return false;
|
|
@@ -84,7 +78,7 @@ class EsbuildExecutor {
|
|
|
84
78
|
return;
|
|
85
79
|
}
|
|
86
80
|
// If the WASM variant was preferred at class construction or native is not supported, use WASM
|
|
87
|
-
if (this.alwaysUseWasm || !EsbuildExecutor.hasNativeSupport()) {
|
|
81
|
+
if (this.alwaysUseWasm || !(await EsbuildExecutor.hasNativeSupport())) {
|
|
88
82
|
await this.useWasm();
|
|
89
83
|
this.initialized = true;
|
|
90
84
|
return;
|
|
@@ -61,9 +61,10 @@ class JavaScriptOptimizerPlugin {
|
|
|
61
61
|
cacheItem = cache.getItemCache(name, eTag);
|
|
62
62
|
const cachedOutput = await cacheItem.getPromise();
|
|
63
63
|
if (cachedOutput) {
|
|
64
|
-
compilation.updateAsset(name, cachedOutput.source, {
|
|
64
|
+
compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
|
|
65
|
+
...assetInfo,
|
|
65
66
|
minimized: true,
|
|
66
|
-
});
|
|
67
|
+
}));
|
|
67
68
|
continue;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -110,7 +111,7 @@ class JavaScriptOptimizerPlugin {
|
|
|
110
111
|
// Perform a single native esbuild support check.
|
|
111
112
|
// This removes the need for each worker to perform the check which would
|
|
112
113
|
// otherwise require spawning a separate process per worker.
|
|
113
|
-
alwaysUseWasm: !esbuild_executor_1.EsbuildExecutor.hasNativeSupport(),
|
|
114
|
+
alwaysUseWasm: !(await esbuild_executor_1.EsbuildExecutor.hasNativeSupport()),
|
|
114
115
|
};
|
|
115
116
|
// Sort scripts so larger scripts start first - worker pool uses a FIFO queue
|
|
116
117
|
scriptsToOptimize.sort((a, b) => a.code.length - b.code.length);
|
|
@@ -137,7 +138,10 @@ class JavaScriptOptimizerPlugin {
|
|
|
137
138
|
const optimizedAsset = map
|
|
138
139
|
? new SourceMapSource(code, name, map)
|
|
139
140
|
: new OriginalSource(code, name);
|
|
140
|
-
compilation.updateAsset(name, optimizedAsset,
|
|
141
|
+
compilation.updateAsset(name, optimizedAsset, (assetInfo) => ({
|
|
142
|
+
...assetInfo,
|
|
143
|
+
minimized: true,
|
|
144
|
+
}));
|
|
141
145
|
return cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.storePromise({
|
|
142
146
|
source: optimizedAsset,
|
|
143
147
|
});
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -24,6 +24,11 @@ class NamedChunksPlugin {
|
|
|
24
24
|
if (chunk.name) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
+
if ([...chunk.files.values()].every((f) => f.endsWith('.css'))) {
|
|
28
|
+
// If all chunk files are CSS files skip.
|
|
29
|
+
// This happens when using `import('./styles.css')` in a lazy loaded module.
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
27
32
|
const name = this.generateName(chunk);
|
|
28
33
|
if (name) {
|
|
29
34
|
chunk.name = name;
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -66,7 +70,7 @@ function default_1(options) {
|
|
|
66
70
|
// If starts with a caret, remove and return remainder
|
|
67
71
|
// this supports bypassing asset processing
|
|
68
72
|
if (inputUrl.startsWith('^')) {
|
|
69
|
-
return inputUrl.
|
|
73
|
+
return inputUrl.slice(1);
|
|
70
74
|
}
|
|
71
75
|
const cacheKey = path.resolve(context, inputUrl);
|
|
72
76
|
const cachedUrl = resourceCache.get(cacheKey);
|
|
@@ -74,7 +78,7 @@ function default_1(options) {
|
|
|
74
78
|
return cachedUrl;
|
|
75
79
|
}
|
|
76
80
|
if (inputUrl.startsWith('~')) {
|
|
77
|
-
inputUrl = inputUrl.
|
|
81
|
+
inputUrl = inputUrl.slice(1);
|
|
78
82
|
}
|
|
79
83
|
const { pathname, hash, search } = url.parse(inputUrl.replace(/\\/g, '/'));
|
|
80
84
|
const resolver = (file, base) => new Promise((resolve, reject) => {
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
12
16
|
}) : (function(o, m, k, k2) {
|
|
13
17
|
if (k2 === undefined) k2 = k;
|
|
14
18
|
o[k2] = m[k];
|
|
@@ -31,9 +31,10 @@ class TransferSizePlugin {
|
|
|
31
31
|
}
|
|
32
32
|
actions.push(brotliCompressAsync(scriptAsset.source.source())
|
|
33
33
|
.then((result) => {
|
|
34
|
-
compilation.updateAsset(assetName, (s) => s, {
|
|
34
|
+
compilation.updateAsset(assetName, (s) => s, (assetInfo) => ({
|
|
35
|
+
...assetInfo,
|
|
35
36
|
estimatedTransferSize: result.length,
|
|
36
|
-
});
|
|
37
|
+
}));
|
|
37
38
|
})
|
|
38
39
|
.catch((error) => {
|
|
39
40
|
compilation.warnings.push(new compilation.compiler.webpack.WebpackError(`Unable to calculate estimated transfer size for '${assetName}'. Reason: ${error.message}`));
|