@modern-js/runtime-utils 2.60.4 → 2.60.5-alpha.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/dist/cjs/url.js CHANGED
@@ -22,11 +22,11 @@ __export(url_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(url_exports);
24
24
  function normalizePathname(pathname) {
25
- if (pathname === "/") {
26
- return pathname;
27
- } else {
28
- return pathname.replace(/\/+$/, "");
25
+ const normalized = "/" + pathname.replace(/^\/+|\/+$/g, "");
26
+ if (normalized === "/") {
27
+ return normalized;
29
28
  }
29
+ return normalized;
30
30
  }
31
31
  // Annotate the CommonJS export names for ESM import in node:
32
32
  0 && (module.exports = {
package/dist/esm/url.js CHANGED
@@ -1,9 +1,9 @@
1
1
  function normalizePathname(pathname) {
2
- if (pathname === "/") {
3
- return pathname;
4
- } else {
5
- return pathname.replace(/\/+$/, "");
2
+ var normalized = "/" + pathname.replace(/^\/+|\/+$/g, "");
3
+ if (normalized === "/") {
4
+ return normalized;
6
5
  }
6
+ return normalized;
7
7
  }
8
8
  export {
9
9
  normalizePathname
@@ -1,9 +1,9 @@
1
1
  function normalizePathname(pathname) {
2
- if (pathname === "/") {
3
- return pathname;
4
- } else {
5
- return pathname.replace(/\/+$/, "");
2
+ const normalized = "/" + pathname.replace(/^\/+|\/+$/g, "");
3
+ if (normalized === "/") {
4
+ return normalized;
6
5
  }
6
+ return normalized;
7
7
  }
8
8
  export {
9
9
  normalizePathname
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.60.4",
18
+ "version": "2.60.5-alpha.0",
19
19
  "_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
20
20
  "exports": {
21
21
  "./router": {
@@ -154,8 +154,8 @@
154
154
  "react": "^18.2.0",
155
155
  "react-dom": "^18.2.0",
156
156
  "typescript": "^5",
157
- "@scripts/build": "2.60.4",
158
157
  "@modern-js/types": "2.60.4",
158
+ "@scripts/build": "2.60.4",
159
159
  "@scripts/jest-config": "2.60.4"
160
160
  },
161
161
  "sideEffects": false,