@angular-devkit/build-angular 17.2.0-next.0 → 17.2.0-next.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 +19 -20
- package/src/builders/application/build-action.js +0 -4
- package/src/builders/application/execute-build.js +8 -15
- package/src/builders/application/index.js +19 -3
- package/src/builders/application/options.d.ts +3 -0
- package/src/builders/application/options.js +13 -2
- package/src/builders/application/setup-bundling.js +2 -2
- package/src/builders/extract-i18n/application-extraction.js +3 -1
- package/src/tools/babel/plugins/elide-angular-metadata.d.ts +1 -1
- package/src/tools/babel/plugins/elide-angular-metadata.js +38 -30
- package/src/tools/babel/plugins/pure-toplevel-functions.d.ts +1 -1
- package/src/tools/babel/plugins/pure-toplevel-functions.js +3 -4
- package/src/tools/esbuild/application-code-bundle.js +2 -2
- package/src/tools/esbuild/budget-stats.js +5 -0
- package/src/tools/esbuild/bundler-context.js +9 -1
- package/src/tools/esbuild/bundler-execution-result.d.ts +2 -0
- package/src/tools/esbuild/bundler-execution-result.js +6 -0
- package/src/tools/esbuild/compiler-plugin-options.js +2 -1
- package/src/tools/esbuild/global-scripts.js +3 -4
- package/src/tools/esbuild/global-styles.js +2 -1
- package/src/tools/esbuild/stylesheets/bundle-options.d.ts +2 -0
- package/src/tools/esbuild/stylesheets/bundle-options.js +1 -0
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.d.ts +7 -0
- package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +24 -8
- package/src/tools/esbuild/utils.d.ts +5 -8
- package/src/tools/esbuild/utils.js +64 -31
- package/src/tools/webpack/utils/stats.d.ts +1 -0
- package/src/tools/webpack/utils/stats.js +98 -47
- package/src/utils/environment-options.d.ts +1 -0
- package/src/utils/environment-options.js +3 -1
- package/src/utils/load-proxy-config.js +3 -3
- package/src/utils/postcss-configuration.d.ts +11 -0
- package/src/utils/postcss-configuration.js +77 -0
|
@@ -0,0 +1,77 @@
|
|
|
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.loadPostcssConfiguration = void 0;
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const postcssConfigurationFiles = ['postcss.config.json', '.postcssrc.json'];
|
|
14
|
+
async function generateSearchDirectories(roots) {
|
|
15
|
+
return await Promise.all(roots.map((root) => (0, promises_1.readdir)(root, { withFileTypes: true }).then((entries) => ({
|
|
16
|
+
root,
|
|
17
|
+
files: new Set(entries.filter((entry) => entry.isFile()).map((entry) => entry.name)),
|
|
18
|
+
}))));
|
|
19
|
+
}
|
|
20
|
+
function findFile(searchDirectories, potentialFiles) {
|
|
21
|
+
for (const { root, files } of searchDirectories) {
|
|
22
|
+
for (const potential of potentialFiles) {
|
|
23
|
+
if (files.has(potential)) {
|
|
24
|
+
return (0, node_path_1.join)(root, potential);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
async function readPostcssConfiguration(configurationFile) {
|
|
31
|
+
const data = await (0, promises_1.readFile)(configurationFile, 'utf-8');
|
|
32
|
+
const config = JSON.parse(data);
|
|
33
|
+
return config;
|
|
34
|
+
}
|
|
35
|
+
async function loadPostcssConfiguration(workspaceRoot, projectRoot) {
|
|
36
|
+
// A configuration file can exist in the project or workspace root
|
|
37
|
+
const searchDirectories = await generateSearchDirectories([projectRoot, workspaceRoot]);
|
|
38
|
+
const configPath = findFile(searchDirectories, postcssConfigurationFiles);
|
|
39
|
+
if (!configPath) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const raw = await readPostcssConfiguration(configPath);
|
|
43
|
+
// If no plugins are defined, consider it equivalent to no configuration
|
|
44
|
+
if (!raw.plugins || typeof raw.plugins !== 'object') {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
// Normalize plugin array form
|
|
48
|
+
if (Array.isArray(raw.plugins)) {
|
|
49
|
+
if (raw.plugins.length < 1) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const config = { plugins: [] };
|
|
53
|
+
for (const element of raw.plugins) {
|
|
54
|
+
if (typeof element === 'string') {
|
|
55
|
+
config.plugins.push([element]);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
config.plugins.push(element);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return config;
|
|
62
|
+
}
|
|
63
|
+
// Normalize plugin object map form
|
|
64
|
+
const entries = Object.entries(raw.plugins);
|
|
65
|
+
if (entries.length < 1) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
const config = { plugins: [] };
|
|
69
|
+
for (const [name, options] of entries) {
|
|
70
|
+
if (!options || typeof options !== 'object') {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
config.plugins.push([name, options]);
|
|
74
|
+
}
|
|
75
|
+
return config;
|
|
76
|
+
}
|
|
77
|
+
exports.loadPostcssConfiguration = loadPostcssConfiguration;
|