@angular/build 21.0.0 → 21.0.2
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 +4 -4
- package/src/builders/application/options.js +3 -1
- package/src/builders/application/options.js.map +1 -1
- package/src/builders/dev-server/vite/index.js +1 -3
- package/src/builders/dev-server/vite/index.js.map +1 -1
- package/src/builders/dev-server/vite/server.js +1 -6
- package/src/builders/dev-server/vite/server.js.map +1 -1
- package/src/builders/unit-test/options.d.ts +2 -2
- package/src/builders/unit-test/options.js +3 -2
- package/src/builders/unit-test/options.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/browser-provider.js +16 -9
- package/src/builders/unit-test/runners/vitest/browser-provider.js.map +1 -1
- package/src/builders/unit-test/runners/vitest/plugins.js +55 -25
- package/src/builders/unit-test/runners/vitest/plugins.js.map +1 -1
- package/src/builders/unit-test/test-discovery.d.ts +10 -0
- package/src/builders/unit-test/test-discovery.js +28 -5
- package/src/builders/unit-test/test-discovery.js.map +1 -1
- package/src/private.d.ts +1 -0
- package/src/private.js +3 -1
- package/src/private.js.map +1 -1
- package/src/tools/angular/angular-host.d.ts +1 -1
- package/src/tools/angular/compilation/angular-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/aot-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/hmr-candidates.d.ts +1 -1
- package/src/tools/angular/compilation/jit-compilation.d.ts +1 -1
- package/src/tools/angular/compilation/noop-compilation.d.ts +1 -1
- package/src/tools/vite/middlewares/assets-middleware.js +1 -1
- package/src/tools/vite/middlewares/assets-middleware.js.map +1 -1
- package/src/tools/vite/middlewares/ssr-middleware.js +2 -6
- package/src/tools/vite/middlewares/ssr-middleware.js.map +1 -1
- package/src/tools/vite/plugins/ssr-ssl-plugin.js +10 -0
- package/src/tools/vite/plugins/ssr-ssl-plugin.js.map +1 -1
- package/src/utils/check-port.js +1 -1
- package/src/utils/check-port.js.map +1 -1
- package/src/utils/normalize-cache.js +1 -1
- package/src/utils/project-metadata.js +1 -1
- package/src/utils/project-metadata.js.map +1 -1
- package/src/utils/server-rendering/launch-server.js +1 -3
- package/src/utils/server-rendering/launch-server.js.map +1 -1
- package/src/utils/server-rendering/manifest.js +1 -1
- package/src/utils/server-rendering/manifest.js.map +1 -1
- package/src/utils/server-rendering/prerender.js +7 -16
- package/src/utils/server-rendering/prerender.js.map +1 -1
- package/src/utils/url.d.ts +74 -1
- package/src/utils/url.js +111 -7
- package/src/utils/url.js.map +1 -1
package/src/utils/url.js
CHANGED
|
@@ -7,12 +7,116 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
exports.stripTrailingSlash = stripTrailingSlash;
|
|
11
|
+
exports.stripLeadingSlash = stripLeadingSlash;
|
|
12
|
+
exports.addLeadingSlash = addLeadingSlash;
|
|
13
|
+
exports.addTrailingSlash = addTrailingSlash;
|
|
14
|
+
exports.joinUrlParts = joinUrlParts;
|
|
15
|
+
/**
|
|
16
|
+
* Removes the trailing slash from a URL if it exists.
|
|
17
|
+
*
|
|
18
|
+
* @param url - The URL string from which to remove the trailing slash.
|
|
19
|
+
* @returns The URL string without a trailing slash.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```js
|
|
23
|
+
* stripTrailingSlash('path/'); // 'path'
|
|
24
|
+
* stripTrailingSlash('/path'); // '/path'
|
|
25
|
+
* stripTrailingSlash('/'); // '/'
|
|
26
|
+
* stripTrailingSlash(''); // ''
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
function stripTrailingSlash(url) {
|
|
30
|
+
// Check if the last character of the URL is a slash
|
|
31
|
+
return url.length > 1 && url.at(-1) === '/' ? url.slice(0, -1) : url;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Removes the leading slash from a URL if it exists.
|
|
35
|
+
*
|
|
36
|
+
* @param url - The URL string from which to remove the leading slash.
|
|
37
|
+
* @returns The URL string without a leading slash.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```js
|
|
41
|
+
* stripLeadingSlash('/path'); // 'path'
|
|
42
|
+
* stripLeadingSlash('/path/'); // 'path/'
|
|
43
|
+
* stripLeadingSlash('/'); // '/'
|
|
44
|
+
* stripLeadingSlash(''); // ''
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
function stripLeadingSlash(url) {
|
|
48
|
+
// Check if the first character of the URL is a slash
|
|
49
|
+
return url.length > 1 && url[0] === '/' ? url.slice(1) : url;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Adds a leading slash to a URL if it does not already have one.
|
|
53
|
+
*
|
|
54
|
+
* @param url - The URL string to which the leading slash will be added.
|
|
55
|
+
* @returns The URL string with a leading slash.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```js
|
|
59
|
+
* addLeadingSlash('path'); // '/path'
|
|
60
|
+
* addLeadingSlash('/path'); // '/path'
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
function addLeadingSlash(url) {
|
|
64
|
+
// Check if the URL already starts with a slash
|
|
65
|
+
return url[0] === '/' ? url : `/${url}`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Adds a trailing slash to a URL if it does not already have one.
|
|
69
|
+
*
|
|
70
|
+
* @param url - The URL string to which the trailing slash will be added.
|
|
71
|
+
* @returns The URL string with a trailing slash.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```js
|
|
75
|
+
* addTrailingSlash('path'); // 'path/'
|
|
76
|
+
* addTrailingSlash('path/'); // 'path/'
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
function addTrailingSlash(url) {
|
|
80
|
+
// Check if the URL already end with a slash
|
|
81
|
+
return url.at(-1) === '/' ? url : `${url}/`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Joins URL parts into a single URL string.
|
|
85
|
+
*
|
|
86
|
+
* This function takes multiple URL segments, normalizes them by removing leading
|
|
87
|
+
* and trailing slashes where appropriate, and then joins them into a single URL.
|
|
88
|
+
*
|
|
89
|
+
* @param parts - The parts of the URL to join. Each part can be a string with or without slashes.
|
|
90
|
+
* @returns The joined URL string, with normalized slashes.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```js
|
|
94
|
+
* joinUrlParts('path/', '/to/resource'); // '/path/to/resource'
|
|
95
|
+
* joinUrlParts('/path/', 'to/resource'); // '/path/to/resource'
|
|
96
|
+
* joinUrlParts('http://localhost/path/', 'to/resource'); // 'http://localhost/path/to/resource'
|
|
97
|
+
* joinUrlParts('', ''); // '/'
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
function joinUrlParts(...parts) {
|
|
101
|
+
const normalizeParts = [];
|
|
102
|
+
for (const part of parts) {
|
|
103
|
+
if (part === '') {
|
|
104
|
+
// Skip any empty parts
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
let normalizedPart = part;
|
|
108
|
+
if (part[0] === '/') {
|
|
109
|
+
normalizedPart = normalizedPart.slice(1);
|
|
110
|
+
}
|
|
111
|
+
if (part.at(-1) === '/') {
|
|
112
|
+
normalizedPart = normalizedPart.slice(0, -1);
|
|
113
|
+
}
|
|
114
|
+
if (normalizedPart !== '') {
|
|
115
|
+
normalizeParts.push(normalizedPart);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const protocolMatch = normalizeParts.length && /^https?:\/\//.test(normalizeParts[0]);
|
|
119
|
+
const joinedParts = normalizeParts.join('/');
|
|
120
|
+
return protocolMatch ? joinedParts : addLeadingSlash(joinedParts);
|
|
17
121
|
}
|
|
18
122
|
//# sourceMappingURL=url.js.map
|
package/src/utils/url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["url.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["url.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAgBH,gDAGC;AAgBD,8CAGC;AAcD,0CAGC;AAcD,4CAGC;AAmBD,oCAwBC;AAjHD;;;;;;;;;;;;;GAaG;AACH,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,oDAAoD;IACpD,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACvE,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,qDAAqD;IACrD,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,+CAA+C;IAC/C,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,4CAA4C;IAC5C,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;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