@nx/angular-rspack 22.4.0-canary.20260114-45f2ae3 → 22.4.0-canary.20260116-323554b

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index-html-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/index-html-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAQtE,MAAM,WAAW,sBAAuB,SAAQ,yBAAyB;IACvE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,qBAAa,eACX,SAAQ,kBACR,YAAW,oBAAoB;aAWD,OAAO,EAAE,sBAAsB;IAT7D,OAAO,CAAC,YAAY,CAA0B;IAC9C,IAAI,WAAW,IAAI,WAAW,CAM7B;gBAE6B,OAAO,EAAE,sBAAsB;IAI7D,KAAK,CAAC,QAAQ,EAAE,QAAQ;IAoET,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAM9B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBjE,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAgBtD"}
1
+ {"version":3,"file":"index-html-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/index-html-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAYtE,MAAM,WAAW,sBAAuB,SAAQ,yBAAyB;IACvE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,qBAAa,eACX,SAAQ,kBACR,YAAW,oBAAoB;aAWD,OAAO,EAAE,sBAAsB;IAT7D,OAAO,CAAC,YAAY,CAA0B;IAC9C,IAAI,WAAW,IAAI,WAAW,CAM7B;gBAE6B,OAAO,EAAE,sBAAsB;IAI7D,KAAK,CAAC,QAAQ,EAAE,QAAQ;IAoET,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAM9B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBjE,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAyBtD"}
@@ -8,7 +8,7 @@ const add_event_dispatch_contract_1 = require("../utils/index-file/add-event-dis
8
8
  const misc_helpers_1 = require("../utils/misc-helpers");
9
9
  const i18n_1 = require("../utils/i18n");
10
10
  const rspack_diagnostics_1 = require("../utils/rspack-diagnostics");
11
- const url_join_1 = require("../utils/url-join");
11
+ const url_1 = require("../utils/url");
12
12
  const get_index_output_file_1 = require("../utils/index-file/get-index-output-file");
13
13
  const PLUGIN_NAME = 'IndexHtmlPlugin';
14
14
  class IndexHtmlPlugin extends private_1.IndexHtmlGenerator {
@@ -99,9 +99,14 @@ class IndexHtmlPlugin extends private_1.IndexHtmlGenerator {
99
99
  return undefined;
100
100
  }
101
101
  const baseHrefSuffix = localeData.baseHref ?? localeData.subPath + '/';
102
- return baseHrefSuffix !== ''
103
- ? (0, url_join_1.urlJoin)(this.options.baseHref || '', baseHrefSuffix)
104
- : undefined;
102
+ let joinedBaseHref;
103
+ if (baseHrefSuffix !== '') {
104
+ joinedBaseHref = (0, url_1.addTrailingSlash)((0, url_1.joinUrlParts)(this.options.baseHref || '', baseHrefSuffix));
105
+ if (this.options.baseHref && this.options.baseHref[0] !== '/') {
106
+ joinedBaseHref = (0, url_1.stripLeadingSlash)(joinedBaseHref);
107
+ }
108
+ }
109
+ return joinedBaseHref;
105
110
  }
106
111
  }
107
112
  exports.IndexHtmlPlugin = IndexHtmlPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"get-locale-base-href.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/get-locale-base-href.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAepB"}
1
+ {"version":3,"file":"get-locale-base-href.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/get-locale-base-href.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAwBpB"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getLocaleBaseHref = getLocaleBaseHref;
4
- const url_join_1 = require("./url-join");
4
+ const url_1 = require("./url");
5
5
  function getLocaleBaseHref(i18n, locale, baseHref) {
6
6
  if (i18n.flatOutput) {
7
7
  return undefined;
@@ -11,7 +11,12 @@ function getLocaleBaseHref(i18n, locale, baseHref) {
11
11
  return undefined;
12
12
  }
13
13
  const baseHrefSuffix = localeData.baseHref ?? localeData.subPath + '/';
14
- return baseHrefSuffix !== ''
15
- ? (0, url_join_1.urlJoin)(baseHref || '', baseHrefSuffix)
16
- : undefined;
14
+ let joinedBaseHref;
15
+ if (baseHrefSuffix !== '') {
16
+ joinedBaseHref = (0, url_1.addTrailingSlash)((0, url_1.joinUrlParts)(baseHref || '', baseHrefSuffix));
17
+ if (baseHref && baseHref[0] !== '/') {
18
+ joinedBaseHref = (0, url_1.stripLeadingSlash)(joinedBaseHref);
19
+ }
20
+ }
21
+ return joinedBaseHref;
17
22
  }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ /**
9
+ * Removes the leading slash from a URL if it exists.
10
+ *
11
+ * @param url - The URL string from which to remove the leading slash.
12
+ * @returns The URL string without a leading slash.
13
+ *
14
+ * @example
15
+ * ```js
16
+ * stripLeadingSlash('/path'); // 'path'
17
+ * stripLeadingSlash('/path/'); // 'path/'
18
+ * stripLeadingSlash('/'); // '/'
19
+ * stripLeadingSlash(''); // ''
20
+ * ```
21
+ */
22
+ export declare function stripLeadingSlash(url: string): string;
23
+ /**
24
+ * Adds a leading slash to a URL if it does not already have one.
25
+ *
26
+ * @param url - The URL string to which the leading slash will be added.
27
+ * @returns The URL string with a leading slash.
28
+ *
29
+ * @example
30
+ * ```js
31
+ * addLeadingSlash('path'); // '/path'
32
+ * addLeadingSlash('/path'); // '/path'
33
+ * ```
34
+ */
35
+ export declare function addLeadingSlash(url: string): string;
36
+ /**
37
+ * Adds a trailing slash to a URL if it does not already have one.
38
+ *
39
+ * @param url - The URL string to which the trailing slash will be added.
40
+ * @returns The URL string with a trailing slash.
41
+ *
42
+ * @example
43
+ * ```js
44
+ * addTrailingSlash('path'); // 'path/'
45
+ * addTrailingSlash('path/'); // 'path/'
46
+ * ```
47
+ */
48
+ export declare function addTrailingSlash(url: string): string;
49
+ /**
50
+ * Joins URL parts into a single URL string.
51
+ *
52
+ * This function takes multiple URL segments, normalizes them by removing leading
53
+ * and trailing slashes where appropriate, and then joins them into a single URL.
54
+ *
55
+ * @param parts - The parts of the URL to join. Each part can be a string with or without slashes.
56
+ * @returns The joined URL string, with normalized slashes.
57
+ *
58
+ * @example
59
+ * ```js
60
+ * joinUrlParts('path/', '/to/resource'); // '/path/to/resource'
61
+ * joinUrlParts('/path/', 'to/resource'); // '/path/to/resource'
62
+ * joinUrlParts('http://localhost/path/', 'to/resource'); // 'http://localhost/path/to/resource'
63
+ * joinUrlParts('', ''); // '/'
64
+ * ```
65
+ */
66
+ export declare function joinUrlParts(...parts: string[]): string;
67
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/url.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAyBvD"}
@@ -0,0 +1,102 @@
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.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.stripLeadingSlash = stripLeadingSlash;
11
+ exports.addLeadingSlash = addLeadingSlash;
12
+ exports.addTrailingSlash = addTrailingSlash;
13
+ exports.joinUrlParts = joinUrlParts;
14
+ /**
15
+ * Removes the leading slash from a URL if it exists.
16
+ *
17
+ * @param url - The URL string from which to remove the leading slash.
18
+ * @returns The URL string without a leading slash.
19
+ *
20
+ * @example
21
+ * ```js
22
+ * stripLeadingSlash('/path'); // 'path'
23
+ * stripLeadingSlash('/path/'); // 'path/'
24
+ * stripLeadingSlash('/'); // '/'
25
+ * stripLeadingSlash(''); // ''
26
+ * ```
27
+ */
28
+ function stripLeadingSlash(url) {
29
+ // Check if the first character of the URL is a slash
30
+ return url.length > 1 && url[0] === '/' ? url.slice(1) : url;
31
+ }
32
+ /**
33
+ * Adds a leading slash to a URL if it does not already have one.
34
+ *
35
+ * @param url - The URL string to which the leading slash will be added.
36
+ * @returns The URL string with a leading slash.
37
+ *
38
+ * @example
39
+ * ```js
40
+ * addLeadingSlash('path'); // '/path'
41
+ * addLeadingSlash('/path'); // '/path'
42
+ * ```
43
+ */
44
+ function addLeadingSlash(url) {
45
+ // Check if the URL already starts with a slash
46
+ return url[0] === '/' ? url : `/${url}`;
47
+ }
48
+ /**
49
+ * Adds a trailing slash to a URL if it does not already have one.
50
+ *
51
+ * @param url - The URL string to which the trailing slash will be added.
52
+ * @returns The URL string with a trailing slash.
53
+ *
54
+ * @example
55
+ * ```js
56
+ * addTrailingSlash('path'); // 'path/'
57
+ * addTrailingSlash('path/'); // 'path/'
58
+ * ```
59
+ */
60
+ function addTrailingSlash(url) {
61
+ // Check if the URL already end with a slash
62
+ return url.at(-1) === '/' ? url : `${url}/`;
63
+ }
64
+ /**
65
+ * Joins URL parts into a single URL string.
66
+ *
67
+ * This function takes multiple URL segments, normalizes them by removing leading
68
+ * and trailing slashes where appropriate, and then joins them into a single URL.
69
+ *
70
+ * @param parts - The parts of the URL to join. Each part can be a string with or without slashes.
71
+ * @returns The joined URL string, with normalized slashes.
72
+ *
73
+ * @example
74
+ * ```js
75
+ * joinUrlParts('path/', '/to/resource'); // '/path/to/resource'
76
+ * joinUrlParts('/path/', 'to/resource'); // '/path/to/resource'
77
+ * joinUrlParts('http://localhost/path/', 'to/resource'); // 'http://localhost/path/to/resource'
78
+ * joinUrlParts('', ''); // '/'
79
+ * ```
80
+ */
81
+ function joinUrlParts(...parts) {
82
+ const normalizeParts = [];
83
+ for (const part of parts) {
84
+ if (part === '') {
85
+ // Skip any empty parts
86
+ continue;
87
+ }
88
+ let normalizedPart = part;
89
+ if (part[0] === '/') {
90
+ normalizedPart = normalizedPart.slice(1);
91
+ }
92
+ if (part.at(-1) === '/') {
93
+ normalizedPart = normalizedPart.slice(0, -1);
94
+ }
95
+ if (normalizedPart !== '') {
96
+ normalizeParts.push(normalizedPart);
97
+ }
98
+ }
99
+ const protocolMatch = normalizeParts.length && /^https?:\/\//.test(normalizeParts[0]);
100
+ const joinedParts = normalizeParts.join('/');
101
+ return protocolMatch ? joinedParts : addLeadingSlash(joinedParts);
102
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular-rspack",
3
- "version": "22.4.0-canary.20260114-45f2ae3",
3
+ "version": "22.4.0-canary.20260116-323554b",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -48,8 +48,8 @@
48
48
  "@ampproject/remapping": "2.3.0",
49
49
  "@babel/core": "7.28.3",
50
50
  "@discoveryjs/json-ext": "0.6.3",
51
- "@nx/angular-rspack-compiler": "22.4.0-canary.20260114-45f2ae3",
52
- "@nx/devkit": "22.4.0-canary.20260114-45f2ae3",
51
+ "@nx/angular-rspack-compiler": "22.4.0-canary.20260116-323554b",
52
+ "@nx/devkit": "22.4.0-canary.20260116-323554b",
53
53
  "ansi-colors": "4.1.3",
54
54
  "autoprefixer": "10.4.21",
55
55
  "deepmerge": "^4.3.1",
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- export declare function urlJoin(...parts: string[]): string;
9
- //# sourceMappingURL=url-join.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"url-join.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/url-join.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAOlD"}
@@ -1,17 +0,0 @@
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.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.urlJoin = urlJoin;
11
- function urlJoin(...parts) {
12
- const [p, ...rest] = parts;
13
- // Remove trailing slash from first part
14
- // Join all parts with `/`
15
- // Dedupe double slashes from path names
16
- return p.replace(/\/$/, '') + ('/' + rest.join('/')).replace(/\/\/+/g, '/');
17
- }