@angular-devkit/build-angular 14.2.0-next.1 → 14.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
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "14.2.0
|
|
3
|
+
"version": "14.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
9
|
"@ampproject/remapping": "2.2.0",
|
|
10
|
-
"@angular-devkit/architect": "0.1402.0
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1402.0
|
|
12
|
-
"@angular-devkit/core": "14.2.0
|
|
10
|
+
"@angular-devkit/architect": "0.1402.0",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1402.0",
|
|
12
|
+
"@angular-devkit/core": "14.2.0",
|
|
13
13
|
"@babel/core": "7.18.10",
|
|
14
14
|
"@babel/generator": "7.18.12",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.18.6",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"@babel/runtime": "7.18.9",
|
|
21
21
|
"@babel/template": "7.18.10",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.7",
|
|
23
|
-
"@ngtools/webpack": "14.2.0
|
|
23
|
+
"@ngtools/webpack": "14.2.0",
|
|
24
24
|
"ansi-colors": "4.1.3",
|
|
25
25
|
"babel-loader": "8.2.5",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
27
27
|
"browserslist": "^4.9.1",
|
|
28
|
-
"cacache": "16.1.
|
|
28
|
+
"cacache": "16.1.2",
|
|
29
29
|
"copy-webpack-plugin": "11.0.0",
|
|
30
30
|
"critters": "0.0.16",
|
|
31
31
|
"css-loader": "6.7.1",
|
|
32
|
-
"esbuild-wasm": "0.15.
|
|
32
|
+
"esbuild-wasm": "0.15.5",
|
|
33
33
|
"glob": "8.0.3",
|
|
34
34
|
"https-proxy-agent": "5.0.1",
|
|
35
35
|
"inquirer": "8.2.4",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"postcss": "8.4.16",
|
|
49
49
|
"postcss-import": "14.1.0",
|
|
50
50
|
"postcss-loader": "7.0.1",
|
|
51
|
-
"postcss-preset-env": "7.
|
|
51
|
+
"postcss-preset-env": "7.8.0",
|
|
52
52
|
"regenerator-runtime": "0.13.9",
|
|
53
53
|
"resolve-url-loader": "5.0.0",
|
|
54
54
|
"rxjs": "6.6.7",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"semver": "7.3.7",
|
|
58
58
|
"source-map-loader": "4.0.0",
|
|
59
59
|
"source-map-support": "0.5.21",
|
|
60
|
-
"stylus": "0.
|
|
60
|
+
"stylus": "0.59.0",
|
|
61
61
|
"stylus-loader": "7.0.0",
|
|
62
62
|
"terser": "5.14.2",
|
|
63
63
|
"text-table": "0.2.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"webpack-subresource-integrity": "5.1.0"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"esbuild": "0.15.
|
|
73
|
+
"esbuild": "0.15.5"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@angular/compiler-cli": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"ng-packagr": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
|
|
81
81
|
"protractor": "^7.0.0",
|
|
82
82
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
83
|
-
"typescript": ">=4.6.2 <4.
|
|
83
|
+
"typescript": ">=4.6.2 <4.9"
|
|
84
84
|
},
|
|
85
85
|
"peerDependenciesMeta": {
|
|
86
86
|
"@angular/localize": {
|
|
@@ -208,7 +208,7 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
|
|
208
208
|
// Create the Angular specific program that contains the Angular compiler
|
|
209
209
|
const angularProgram = new compilerCli.NgtscProgram(rootNames, compilerOptions, host);
|
|
210
210
|
const angularCompiler = angularProgram.compiler;
|
|
211
|
-
const { ignoreForDiagnostics
|
|
211
|
+
const { ignoreForDiagnostics } = angularCompiler;
|
|
212
212
|
const typeScriptProgram = angularProgram.getTsProgram();
|
|
213
213
|
const builder = typescript_1.default.createAbstractBuilder(typeScriptProgram, host);
|
|
214
214
|
await angularCompiler.analyzeAsync();
|
|
@@ -57,7 +57,7 @@ const stylesheets_1 = require("./stylesheets");
|
|
|
57
57
|
*/
|
|
58
58
|
// eslint-disable-next-line max-lines-per-function
|
|
59
59
|
async function buildEsbuildBrowser(options, context) {
|
|
60
|
-
var _a, _b, _c, _d, _e, _f
|
|
60
|
+
var _a, _b, _c, _d, _e, _f;
|
|
61
61
|
const startTime = Date.now();
|
|
62
62
|
// Only AOT is currently supported
|
|
63
63
|
if (options.aot !== true) {
|
|
@@ -86,21 +86,28 @@ async function buildEsbuildBrowser(options, context) {
|
|
|
86
86
|
}
|
|
87
87
|
// Create reverse lookup used during index HTML generation
|
|
88
88
|
const entryPointNameLookup = new Map(Object.entries(entryPoints).map(([name, filePath]) => [path.relative(workspaceRoot, filePath), name]));
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const [codeResults, styleResults] = await Promise.all([
|
|
90
|
+
// Execute esbuild to bundle the application code
|
|
91
|
+
bundleCode(workspaceRoot, entryPoints, outputNames, options, optimizationOptions, sourcemapOptions, tsconfig),
|
|
92
|
+
// Execute esbuild to bundle the global stylesheets
|
|
93
|
+
bundleGlobalStylesheets(workspaceRoot, outputNames, options, optimizationOptions, sourcemapOptions),
|
|
94
|
+
]);
|
|
91
95
|
// Log all warnings and errors generated during bundling
|
|
92
|
-
await (0, esbuild_1.logMessages)(context,
|
|
96
|
+
await (0, esbuild_1.logMessages)(context, {
|
|
97
|
+
errors: [...codeResults.errors, ...styleResults.errors],
|
|
98
|
+
warnings: [...codeResults.warnings, ...styleResults.warnings],
|
|
99
|
+
});
|
|
93
100
|
// Return if the bundling failed to generate output files or there are errors
|
|
94
|
-
if (!
|
|
101
|
+
if (!codeResults.outputFiles || codeResults.errors.length) {
|
|
95
102
|
return { success: false };
|
|
96
103
|
}
|
|
97
|
-
// Structure the bundling output files
|
|
104
|
+
// Structure the code bundling output files
|
|
98
105
|
const initialFiles = [];
|
|
99
106
|
const outputFiles = [];
|
|
100
|
-
for (const outputFile of
|
|
107
|
+
for (const outputFile of codeResults.outputFiles) {
|
|
101
108
|
// Entries in the metafile are relative to the `absWorkingDir` option which is set to the workspaceRoot
|
|
102
109
|
const relativeFilePath = path.relative(workspaceRoot, outputFile.path);
|
|
103
|
-
const entryPoint = (_c = (_b =
|
|
110
|
+
const entryPoint = (_c = (_b = codeResults.metafile) === null || _b === void 0 ? void 0 : _b.outputs[relativeFilePath]) === null || _c === void 0 ? void 0 : _c.entryPoint;
|
|
104
111
|
outputFile.path = relativeFilePath;
|
|
105
112
|
if (entryPoint) {
|
|
106
113
|
// An entryPoint value indicates an initial file
|
|
@@ -112,6 +119,13 @@ async function buildEsbuildBrowser(options, context) {
|
|
|
112
119
|
}
|
|
113
120
|
outputFiles.push(outputFile);
|
|
114
121
|
}
|
|
122
|
+
// Add global stylesheets output files
|
|
123
|
+
outputFiles.push(...styleResults.outputFiles);
|
|
124
|
+
initialFiles.push(...styleResults.initialFiles);
|
|
125
|
+
// Return if the global stylesheet bundling has errors
|
|
126
|
+
if (styleResults.errors.length) {
|
|
127
|
+
return { success: false };
|
|
128
|
+
}
|
|
115
129
|
// Create output directory if needed
|
|
116
130
|
try {
|
|
117
131
|
await fs_1.promises.mkdir(outputPath, { recursive: true });
|
|
@@ -121,56 +135,11 @@ async function buildEsbuildBrowser(options, context) {
|
|
|
121
135
|
context.logger.error('Unable to create output directory: ' + e.message);
|
|
122
136
|
return { success: false };
|
|
123
137
|
}
|
|
124
|
-
// Process global stylesheets
|
|
125
|
-
if (options.styles) {
|
|
126
|
-
// resolveGlobalStyles is temporarily reused from the Webpack builder code
|
|
127
|
-
const { entryPoints: stylesheetEntrypoints, noInjectNames } = (0, configs_1.resolveGlobalStyles)(options.styles, workspaceRoot,
|
|
128
|
-
// preserveSymlinks is always true here to allow the bundler to handle the option
|
|
129
|
-
true,
|
|
130
|
-
// skipResolution to leverage the bundler's more comprehensive resolution
|
|
131
|
-
true);
|
|
132
|
-
for (const [name, files] of Object.entries(stylesheetEntrypoints)) {
|
|
133
|
-
const virtualEntryData = files
|
|
134
|
-
.map((file) => `@import '${file.replace(/\\/g, '/')}';`)
|
|
135
|
-
.join('\n');
|
|
136
|
-
const sheetResult = await (0, stylesheets_1.bundleStylesheetText)(virtualEntryData, { virtualName: `angular:style/global;${name}`, resolvePath: workspaceRoot }, {
|
|
137
|
-
workspaceRoot,
|
|
138
|
-
optimization: !!optimizationOptions.styles.minify,
|
|
139
|
-
sourcemap: !!sourcemapOptions.styles && (sourcemapOptions.hidden ? 'external' : true),
|
|
140
|
-
outputNames: noInjectNames.includes(name) ? { media: outputNames.media } : outputNames,
|
|
141
|
-
includePaths: (_e = options.stylePreprocessorOptions) === null || _e === void 0 ? void 0 : _e.includePaths,
|
|
142
|
-
preserveSymlinks: options.preserveSymlinks,
|
|
143
|
-
externalDependencies: options.externalDependencies,
|
|
144
|
-
});
|
|
145
|
-
await (0, esbuild_1.logMessages)(context, sheetResult);
|
|
146
|
-
if (!sheetResult.path) {
|
|
147
|
-
// Failed to process the stylesheet
|
|
148
|
-
assert.ok(sheetResult.errors.length, `Global stylesheet processing for '${name}' failed with no errors.`);
|
|
149
|
-
return { success: false };
|
|
150
|
-
}
|
|
151
|
-
// The virtual stylesheets will be named `stdin` by esbuild. This must be replaced
|
|
152
|
-
// with the actual name of the global style and the leading directory separator must
|
|
153
|
-
// also be removed to make the path relative.
|
|
154
|
-
const sheetPath = sheetResult.path.replace('stdin', name);
|
|
155
|
-
outputFiles.push(createOutputFileFromText(sheetPath, sheetResult.contents));
|
|
156
|
-
if (sheetResult.map) {
|
|
157
|
-
outputFiles.push(createOutputFileFromText(sheetPath + '.map', sheetResult.map));
|
|
158
|
-
}
|
|
159
|
-
if (!noInjectNames.includes(name)) {
|
|
160
|
-
initialFiles.push({
|
|
161
|
-
file: sheetPath,
|
|
162
|
-
name,
|
|
163
|
-
extension: '.css',
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
outputFiles.push(...sheetResult.resourceFiles);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
138
|
// Generate index HTML file
|
|
170
139
|
if (options.index) {
|
|
171
140
|
const entrypoints = (0, package_chunk_sort_1.generateEntryPoints)({
|
|
172
|
-
scripts: (
|
|
173
|
-
styles: (
|
|
141
|
+
scripts: (_e = options.scripts) !== null && _e !== void 0 ? _e : [],
|
|
142
|
+
styles: (_f = options.styles) !== null && _f !== void 0 ? _f : [],
|
|
174
143
|
});
|
|
175
144
|
// Create an index HTML generator that reads from the in-memory output files
|
|
176
145
|
const indexHtmlGenerator = new index_html_generator_1.IndexHtmlGenerator({
|
|
@@ -301,4 +270,57 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
|
|
|
301
270
|
},
|
|
302
271
|
});
|
|
303
272
|
}
|
|
273
|
+
async function bundleGlobalStylesheets(workspaceRoot, outputNames, options, optimizationOptions, sourcemapOptions) {
|
|
274
|
+
var _a;
|
|
275
|
+
const outputFiles = [];
|
|
276
|
+
const initialFiles = [];
|
|
277
|
+
const errors = [];
|
|
278
|
+
const warnings = [];
|
|
279
|
+
// resolveGlobalStyles is temporarily reused from the Webpack builder code
|
|
280
|
+
const { entryPoints: stylesheetEntrypoints, noInjectNames } = (0, configs_1.resolveGlobalStyles)(options.styles || [], workspaceRoot,
|
|
281
|
+
// preserveSymlinks is always true here to allow the bundler to handle the option
|
|
282
|
+
true,
|
|
283
|
+
// skipResolution to leverage the bundler's more comprehensive resolution
|
|
284
|
+
true);
|
|
285
|
+
for (const [name, files] of Object.entries(stylesheetEntrypoints)) {
|
|
286
|
+
const virtualEntryData = files
|
|
287
|
+
.map((file) => `@import '${file.replace(/\\/g, '/')}';`)
|
|
288
|
+
.join('\n');
|
|
289
|
+
const sheetResult = await (0, stylesheets_1.bundleStylesheetText)(virtualEntryData, { virtualName: `angular:style/global;${name}`, resolvePath: workspaceRoot }, {
|
|
290
|
+
workspaceRoot,
|
|
291
|
+
optimization: !!optimizationOptions.styles.minify,
|
|
292
|
+
sourcemap: !!sourcemapOptions.styles && (sourcemapOptions.hidden ? 'external' : true),
|
|
293
|
+
outputNames: noInjectNames.includes(name) ? { media: outputNames.media } : outputNames,
|
|
294
|
+
includePaths: (_a = options.stylePreprocessorOptions) === null || _a === void 0 ? void 0 : _a.includePaths,
|
|
295
|
+
preserveSymlinks: options.preserveSymlinks,
|
|
296
|
+
externalDependencies: options.externalDependencies,
|
|
297
|
+
});
|
|
298
|
+
errors.push(...sheetResult.errors);
|
|
299
|
+
warnings.push(...sheetResult.warnings);
|
|
300
|
+
if (!sheetResult.path) {
|
|
301
|
+
// Failed to process the stylesheet
|
|
302
|
+
assert.ok(sheetResult.errors.length, `Global stylesheet processing for '${name}' failed with no errors.`);
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
// The virtual stylesheets will be named `stdin` by esbuild. This must be replaced
|
|
306
|
+
// with the actual name of the global style and the leading directory separator must
|
|
307
|
+
// also be removed to make the path relative.
|
|
308
|
+
const sheetPath = sheetResult.path.replace('stdin', name);
|
|
309
|
+
let sheetContents = sheetResult.contents;
|
|
310
|
+
if (sheetResult.map) {
|
|
311
|
+
outputFiles.push(createOutputFileFromText(sheetPath + '.map', sheetResult.map));
|
|
312
|
+
sheetContents = sheetContents.replace('sourceMappingURL=stdin.css.map', `sourceMappingURL=${name}.css.map`);
|
|
313
|
+
}
|
|
314
|
+
outputFiles.push(createOutputFileFromText(sheetPath, sheetContents));
|
|
315
|
+
if (!noInjectNames.includes(name)) {
|
|
316
|
+
initialFiles.push({
|
|
317
|
+
file: sheetPath,
|
|
318
|
+
name,
|
|
319
|
+
extension: '.css',
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
outputFiles.push(...sheetResult.resourceFiles);
|
|
323
|
+
}
|
|
324
|
+
return { outputFiles, initialFiles, errors, warnings };
|
|
325
|
+
}
|
|
304
326
|
exports.default = (0, architect_1.createBuilder)(buildEsbuildBrowser);
|
|
@@ -37,11 +37,9 @@ function createSassPlugin(options) {
|
|
|
37
37
|
name: 'angular-sass',
|
|
38
38
|
setup(build) {
|
|
39
39
|
let sass;
|
|
40
|
-
build.
|
|
41
|
-
// Lazily load Sass
|
|
42
|
-
sass = await Promise.resolve().then(() => __importStar(require('sass')));
|
|
43
|
-
});
|
|
44
|
-
build.onLoad({ filter: /\.s[ac]ss$/ }, (args) => {
|
|
40
|
+
build.onLoad({ filter: /\.s[ac]ss$/ }, async (args) => {
|
|
41
|
+
// Lazily load Sass when a Sass file is found
|
|
42
|
+
sass !== null && sass !== void 0 ? sass : (sass = await Promise.resolve().then(() => __importStar(require('sass'))));
|
|
45
43
|
try {
|
|
46
44
|
const warnings = [];
|
|
47
45
|
// Use sync version as async version is slower.
|
|
@@ -61,7 +59,7 @@ function createSassPlugin(options) {
|
|
|
61
59
|
});
|
|
62
60
|
return {
|
|
63
61
|
loader: 'css',
|
|
64
|
-
contents: `${css}\n${sourceMapToUrlComment(sourceMap)}
|
|
62
|
+
contents: sourceMap ? `${css}\n${sourceMapToUrlComment(sourceMap)}` : css,
|
|
65
63
|
watchFiles: loadedUrls.map((url) => (0, url_1.fileURLToPath)(url)),
|
|
66
64
|
warnings,
|
|
67
65
|
};
|
|
@@ -87,9 +85,6 @@ function createSassPlugin(options) {
|
|
|
87
85
|
}
|
|
88
86
|
exports.createSassPlugin = createSassPlugin;
|
|
89
87
|
function sourceMapToUrlComment(sourceMap) {
|
|
90
|
-
if (!sourceMap) {
|
|
91
|
-
return '';
|
|
92
|
-
}
|
|
93
88
|
const urlSourceMap = Buffer.from(JSON.stringify(sourceMap), 'utf-8').toString('base64');
|
|
94
89
|
return `/*# sourceMappingURL=data:application/json;charset=utf-8;base64,${urlSourceMap} */`;
|
|
95
90
|
}
|
|
@@ -131,7 +131,7 @@ function default_1(options) {
|
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
const value = decl.value;
|
|
134
|
-
const urlRegex = /url(?:\(\s*['"]?)(.*?)(
|
|
134
|
+
const urlRegex = /url(?:\(\s*(['"]?))(.*?)(?:\1\s*\))/g;
|
|
135
135
|
const segments = [];
|
|
136
136
|
let match;
|
|
137
137
|
let lastIndex = 0;
|
|
@@ -139,9 +139,8 @@ function default_1(options) {
|
|
|
139
139
|
// We want to load it relative to the file that imports
|
|
140
140
|
const inputFile = decl.source && decl.source.input.file;
|
|
141
141
|
const context = (inputFile && path.dirname(inputFile)) || loader.context;
|
|
142
|
-
// eslint-disable-next-line no-cond-assign
|
|
143
142
|
while ((match = urlRegex.exec(value))) {
|
|
144
|
-
const originalUrl = match[
|
|
143
|
+
const originalUrl = match[2];
|
|
145
144
|
let processedUrl;
|
|
146
145
|
try {
|
|
147
146
|
processedUrl = await process(originalUrl, context, resourceCache);
|