@modern-js/runtime-utils 2.47.1 → 2.48.1

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.
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var url_exports = {};
20
+ __export(url_exports, {
21
+ normalizePathname: () => normalizePathname
22
+ });
23
+ module.exports = __toCommonJS(url_exports);
24
+ function normalizePathname(pathname) {
25
+ if (pathname === "/") {
26
+ return pathname;
27
+ } else {
28
+ return pathname.replace(/\/+$/, "");
29
+ }
30
+ }
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ normalizePathname
34
+ });
@@ -0,0 +1,10 @@
1
+ function normalizePathname(pathname) {
2
+ if (pathname === "/") {
3
+ return pathname;
4
+ } else {
5
+ return pathname.replace(/\/+$/, "");
6
+ }
7
+ }
8
+ export {
9
+ normalizePathname
10
+ };
@@ -0,0 +1,10 @@
1
+ function normalizePathname(pathname) {
2
+ if (pathname === "/") {
3
+ return pathname;
4
+ } else {
5
+ return pathname.replace(/\/+$/, "");
6
+ }
7
+ }
8
+ export {
9
+ normalizePathname
10
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * we use `pathname.replace(/\/+$/, '')` to remove the '/' with end.
3
+ *
4
+ * examples:
5
+ *
6
+ * pathname1: '/api', pathname2: '/api/',
7
+ * pathname1 as same as pathname2
8
+ *
9
+ * pathname3: '/', the nomalizeResult also as '/'
10
+ */
11
+ export declare function normalizePathname(pathname: string): string;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.47.1",
18
+ "version": "2.48.1",
19
19
  "_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
20
20
  "exports": {
21
21
  "./router": {
@@ -62,6 +62,11 @@
62
62
  "types": "./dist/types/node/fileReader.d.ts",
63
63
  "require": "./dist/cjs/node/fileReader.js",
64
64
  "default": "./dist/esm/node/fileReader.js"
65
+ },
66
+ "./url": {
67
+ "types": "./dist/types/url.d.ts",
68
+ "require": "./dist/cjs/url.js",
69
+ "default": "./dist/esm/url.js"
65
70
  }
66
71
  },
67
72
  "publishConfig": {
@@ -97,6 +102,9 @@
97
102
  ],
98
103
  "fileReader": [
99
104
  "./dist/types/node/fileReader.d.ts"
105
+ ],
106
+ "url": [
107
+ "./dist/types/url.d.ts"
100
108
  ]
101
109
  }
102
110
  },
@@ -106,7 +114,7 @@
106
114
  "react-router-dom": "6.22.0",
107
115
  "@remix-run/router": "1.15.0",
108
116
  "@swc/helpers": "0.5.3",
109
- "@modern-js/utils": "2.47.1"
117
+ "@modern-js/utils": "2.48.1"
110
118
  },
111
119
  "peerDependencies": {
112
120
  "react": ">=17.0.0",
@@ -129,9 +137,9 @@
129
137
  "jest": "^29",
130
138
  "typescript": "^5",
131
139
  "@types/serialize-javascript": "^5.0.1",
132
- "@modern-js/types": "2.47.1",
133
- "@scripts/build": "2.47.1",
134
- "@scripts/jest-config": "2.47.1"
140
+ "@modern-js/types": "2.48.1",
141
+ "@scripts/build": "2.48.1",
142
+ "@scripts/jest-config": "2.48.1"
135
143
  },
136
144
  "sideEffects": false,
137
145
  "scripts": {