@angular/build 20.1.2 → 20.1.3
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "20.1.
|
|
3
|
+
"version": "20.1.3",
|
|
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.2001.
|
|
26
|
+
"@angular-devkit/architect": "0.2001.3",
|
|
27
27
|
"@babel/core": "7.27.7",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.27.3",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.7",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"semver": "7.7.2",
|
|
47
47
|
"source-map-support": "0.5.21",
|
|
48
48
|
"tinyglobby": "0.2.14",
|
|
49
|
-
"vite": "7.0.
|
|
49
|
+
"vite": "7.0.6",
|
|
50
50
|
"watchpack": "2.4.4"
|
|
51
51
|
},
|
|
52
52
|
"optionalDependencies": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@angular/platform-browser": "^20.0.0",
|
|
61
61
|
"@angular/platform-server": "^20.0.0",
|
|
62
62
|
"@angular/service-worker": "^20.0.0",
|
|
63
|
-
"@angular/ssr": "^20.1.
|
|
63
|
+
"@angular/ssr": "^20.1.3",
|
|
64
64
|
"karma": "^6.4.0",
|
|
65
65
|
"less": "^4.2.0",
|
|
66
66
|
"ng-packagr": "^20.0.0",
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.createAngularAssetsMiddleware = createAngularAssetsMiddleware;
|
|
11
11
|
const mrmime_1 = require("mrmime");
|
|
12
|
+
const node_crypto_1 = require("node:crypto");
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
12
14
|
const node_path_1 = require("node:path");
|
|
13
15
|
const utils_1 = require("../utils");
|
|
16
|
+
const JS_TS_REGEXP = /\.[cm]?[tj]sx?$/;
|
|
14
17
|
function createAngularAssetsMiddleware(server, assets, outputFiles, componentStyles, encapsulateStyle) {
|
|
15
18
|
return function angularAssetsMiddleware(req, res, next) {
|
|
16
19
|
if (req.url === undefined || res.writableEnded) {
|
|
@@ -24,14 +27,27 @@ function createAngularAssetsMiddleware(server, assets, outputFiles, componentSty
|
|
|
24
27
|
// Rewrite all build assets to a vite raw fs URL
|
|
25
28
|
const asset = assets.get(pathname);
|
|
26
29
|
if (asset) {
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
// This is a workaround to serve JS and TS files without Vite transformations.
|
|
31
|
+
if (JS_TS_REGEXP.test(extension)) {
|
|
32
|
+
const contents = (0, node_fs_1.readFileSync)(asset.source);
|
|
33
|
+
const etag = `W/${(0, node_crypto_1.createHash)('sha256').update(contents).digest('hex')}`;
|
|
34
|
+
if (checkAndHandleEtag(req, res, etag)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const mimeType = (0, mrmime_1.lookup)(extension);
|
|
38
|
+
if (mimeType) {
|
|
39
|
+
res.setHeader('Content-Type', mimeType);
|
|
40
|
+
}
|
|
41
|
+
res.setHeader('ETag', etag);
|
|
42
|
+
res.setHeader('Cache-Control', 'no-cache');
|
|
43
|
+
res.end(contents);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// The encoding needs to match what happens in the vite static middleware.
|
|
47
|
+
// ref: https://github.com/vitejs/vite/blob/d4f13bd81468961c8c926438e815ab6b1c82735e/packages/vite/src/node/server/middlewares/static.ts#L163
|
|
48
|
+
req.url = `${server.config.base}@fs/${encodeURI(asset.source)}`;
|
|
49
|
+
next();
|
|
50
|
+
}
|
|
35
51
|
return;
|
|
36
52
|
}
|
|
37
53
|
// HTML fallbacking
|
|
@@ -78,11 +94,8 @@ function createAngularAssetsMiddleware(server, assets, outputFiles, componentSty
|
|
|
78
94
|
else {
|
|
79
95
|
componentStyle.used.add(componentId);
|
|
80
96
|
}
|
|
81
|
-
// Report if there are no changes to avoid reprocessing
|
|
82
97
|
const etag = `W/"${outputFile.contents.byteLength}-${outputFile.hash}-${componentId}"`;
|
|
83
|
-
if (req
|
|
84
|
-
res.statusCode = 304;
|
|
85
|
-
res.end();
|
|
98
|
+
if (checkAndHandleEtag(req, res, etag)) {
|
|
86
99
|
return;
|
|
87
100
|
}
|
|
88
101
|
// Shim the stylesheet if a component ID is provided
|
|
@@ -105,11 +118,8 @@ function createAngularAssetsMiddleware(server, assets, outputFiles, componentSty
|
|
|
105
118
|
return;
|
|
106
119
|
}
|
|
107
120
|
}
|
|
108
|
-
// Avoid resending the content if it has not changed since last request
|
|
109
121
|
const etag = `W/"${outputFile.contents.byteLength}-${outputFile.hash}"`;
|
|
110
|
-
if (req
|
|
111
|
-
res.statusCode = 304;
|
|
112
|
-
res.end();
|
|
122
|
+
if (checkAndHandleEtag(req, res, etag)) {
|
|
113
123
|
return;
|
|
114
124
|
}
|
|
115
125
|
const mimeType = (0, mrmime_1.lookup)(extension);
|
|
@@ -152,3 +162,11 @@ function createAngularAssetsMiddleware(server, assets, outputFiles, componentSty
|
|
|
152
162
|
next();
|
|
153
163
|
};
|
|
154
164
|
}
|
|
165
|
+
function checkAndHandleEtag(req, res, etag) {
|
|
166
|
+
if (req.headers['if-none-match'] === etag) {
|
|
167
|
+
res.statusCode = 304;
|
|
168
|
+
res.end();
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = normalizeCacheOptions;
|
|
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 = '20.1.
|
|
13
|
+
const VERSION = '20.1.3';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|