@angular/build 18.0.6 → 18.0.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/package.json +2 -2
- package/src/tools/esbuild/budget-stats.js +2 -4
- package/src/tools/esbuild/utils.d.ts +1 -0
- package/src/tools/esbuild/utils.js +9 -4
- package/src/tools/vite/angular-memory-plugin.js +29 -1
- package/src/utils/environment-options.js +1 -1
- package/src/utils/normalize-cache.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.7",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"builders": "builders.json",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ampproject/remapping": "2.3.0",
|
|
26
|
-
"@angular-devkit/architect": "0.1800.
|
|
26
|
+
"@angular-devkit/architect": "0.1800.7",
|
|
27
27
|
"@babel/core": "7.24.5",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.22.5",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.5",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.generateBudgetStats = void 0;
|
|
11
|
-
const
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
12
|
/**
|
|
13
13
|
* Generates a bundle budget calculator compatible stats object that provides
|
|
14
14
|
* the necessary information for the Webpack-based bundle budget code to
|
|
@@ -35,9 +35,7 @@ function generateBudgetStats(metafile, initialFiles) {
|
|
|
35
35
|
let name = initialRecord?.name;
|
|
36
36
|
if (name === undefined && entry.entryPoint) {
|
|
37
37
|
// For non-initial lazy modules, convert the entry point file into a Webpack compatible name
|
|
38
|
-
name = (0,
|
|
39
|
-
.replace(/\.[cm]?[jt]s$/, '')
|
|
40
|
-
.replace(/[\\/.]/g, '-');
|
|
38
|
+
name = (0, utils_1.getEntryPointName)(entry.entryPoint);
|
|
41
39
|
}
|
|
42
40
|
stats.chunks.push({
|
|
43
41
|
files: [file],
|
|
@@ -47,3 +47,4 @@ export declare function logMessages(logger: BuilderContext['logger'], executionR
|
|
|
47
47
|
* @returns true, when the application is considered as zoneless.
|
|
48
48
|
*/
|
|
49
49
|
export declare function isZonelessApp(polyfills: string[] | undefined): boolean;
|
|
50
|
+
export declare function getEntryPointName(entryPoint: string): string;
|
|
@@ -10,7 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.isZonelessApp = exports.logMessages = exports.createJsonBuildManifest = exports.getSupportedNodeTargets = exports.transformSupportedBrowsersToTargets = exports.convertOutputFile = exports.createOutputFileFromData = exports.createOutputFileFromText = exports.emitFilesToDisk = exports.writeResultFiles = exports.getFeatureSupport = exports.withNoProgress = exports.withSpinner = exports.calculateEstimatedTransferSizes = exports.logBuildStats = void 0;
|
|
13
|
+
exports.getEntryPointName = exports.isZonelessApp = exports.logMessages = exports.createJsonBuildManifest = exports.getSupportedNodeTargets = exports.transformSupportedBrowsersToTargets = exports.convertOutputFile = exports.createOutputFileFromData = exports.createOutputFileFromText = exports.emitFilesToDisk = exports.writeResultFiles = exports.getFeatureSupport = exports.withNoProgress = exports.withSpinner = exports.calculateEstimatedTransferSizes = exports.logBuildStats = void 0;
|
|
14
14
|
const esbuild_1 = require("esbuild");
|
|
15
15
|
const node_crypto_1 = require("node:crypto");
|
|
16
16
|
const node_fs_1 = require("node:fs");
|
|
@@ -49,9 +49,7 @@ function logBuildStats(metafile, initial, budgetFailures, colors, changedFiles,
|
|
|
49
49
|
}
|
|
50
50
|
let name = initial.get(file)?.name;
|
|
51
51
|
if (name === undefined && output.entryPoint) {
|
|
52
|
-
name = (
|
|
53
|
-
.replace(/\.[cm]?[jt]s$/, '')
|
|
54
|
-
.replace(/[\\/.]/g, '-');
|
|
52
|
+
name = getEntryPointName(output.entryPoint);
|
|
55
53
|
}
|
|
56
54
|
const stat = {
|
|
57
55
|
initial: initial.has(file),
|
|
@@ -390,3 +388,10 @@ function isZonelessApp(polyfills) {
|
|
|
390
388
|
return !polyfills?.some((p) => p === 'zone.js' || /\.[mc]?[jt]s$/.test(p));
|
|
391
389
|
}
|
|
392
390
|
exports.isZonelessApp = isZonelessApp;
|
|
391
|
+
function getEntryPointName(entryPoint) {
|
|
392
|
+
return (0, node_path_1.basename)(entryPoint)
|
|
393
|
+
.replace(/(.*:)/, '') // global:bundle.css -> bundle.css
|
|
394
|
+
.replace(/\.[cm]?[jt]s$/, '')
|
|
395
|
+
.replace(/[\\/.]/g, '-');
|
|
396
|
+
}
|
|
397
|
+
exports.getEntryPointName = getEntryPointName;
|
|
@@ -89,6 +89,7 @@ function createAngularMemoryPlugin(options) {
|
|
|
89
89
|
// The base of the URL is unused but required to parse the URL.
|
|
90
90
|
const pathname = pathnameWithoutBasePath(req.url, server.config.base);
|
|
91
91
|
const extension = (0, node_path_1.extname)(pathname);
|
|
92
|
+
const pathnameHasTrailingSlash = pathname[pathname.length - 1] === '/';
|
|
92
93
|
// Rewrite all build assets to a vite raw fs URL
|
|
93
94
|
const assetSourcePath = assets.get(pathname);
|
|
94
95
|
if (assetSourcePath !== undefined) {
|
|
@@ -105,7 +106,7 @@ function createAngularMemoryPlugin(options) {
|
|
|
105
106
|
// HTML fallbacking
|
|
106
107
|
// This matches what happens in the vite html fallback middleware.
|
|
107
108
|
// ref: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/middlewares/htmlFallback.ts#L9
|
|
108
|
-
const htmlAssetSourcePath =
|
|
109
|
+
const htmlAssetSourcePath = pathnameHasTrailingSlash
|
|
109
110
|
? // Trailing slash check for `index.html`.
|
|
110
111
|
assets.get(pathname + 'index.html')
|
|
111
112
|
: // Non-trailing slash check for fallback `.html`
|
|
@@ -133,6 +134,17 @@ function createAngularMemoryPlugin(options) {
|
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
137
|
+
// If the path has no trailing slash and it matches a servable directory redirect to the same path with slash.
|
|
138
|
+
// This matches the default express static behaviour.
|
|
139
|
+
// See: https://github.com/expressjs/serve-static/blob/89fc94567fae632718a2157206c52654680e9d01/index.js#L182
|
|
140
|
+
if (!pathnameHasTrailingSlash) {
|
|
141
|
+
for (const assetPath of assets.keys()) {
|
|
142
|
+
if (pathname === assetPath.substring(0, assetPath.lastIndexOf('/'))) {
|
|
143
|
+
redirect(res, req.url + '/');
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
136
148
|
next();
|
|
137
149
|
});
|
|
138
150
|
if (extensionMiddleware?.length) {
|
|
@@ -266,3 +278,19 @@ function lookupMimeTypeFromRequest(url) {
|
|
|
266
278
|
}
|
|
267
279
|
return extension && (0, mrmime_1.lookup)(extension);
|
|
268
280
|
}
|
|
281
|
+
function redirect(res, location) {
|
|
282
|
+
res.statusCode = 301;
|
|
283
|
+
res.setHeader('Content-Type', 'text/html');
|
|
284
|
+
res.setHeader('Location', location);
|
|
285
|
+
res.end(`
|
|
286
|
+
<!DOCTYPE html>
|
|
287
|
+
<html lang="en">
|
|
288
|
+
<head>
|
|
289
|
+
<meta charset="utf-8">
|
|
290
|
+
<title>Redirecting</title>
|
|
291
|
+
</head>
|
|
292
|
+
<body>
|
|
293
|
+
<pre>Redirecting to <a href="${location}">${location}</a></pre>
|
|
294
|
+
</body>
|
|
295
|
+
</html>`);
|
|
296
|
+
}
|
|
@@ -69,7 +69,7 @@ exports.allowMinify = debugOptimize.minify;
|
|
|
69
69
|
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
|
70
70
|
exports.maxWorkers = isPresent(maxWorkersVariable)
|
|
71
71
|
? +maxWorkersVariable
|
|
72
|
-
: Math.min(4, (0, node_os_1.availableParallelism)());
|
|
72
|
+
: Math.min(4, Math.max((0, node_os_1.availableParallelism)() - 1, 1));
|
|
73
73
|
const parallelTsVariable = process.env['NG_BUILD_PARALLEL_TS'];
|
|
74
74
|
exports.useParallelTs = !isPresent(parallelTsVariable) || !isDisabled(parallelTsVariable);
|
|
75
75
|
const debugPerfVariable = process.env['NG_BUILD_DEBUG_PERF'];
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = void 0;
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
12
|
/** Version placeholder is replaced during the build process with actual package version */
|
|
13
|
-
const VERSION = '18.0.
|
|
13
|
+
const VERSION = '18.0.7';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|