shfs 0.1.2 → 0.1.4
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/{fs-D1tzq9TG.d.mts → fs-CKSi_43x.d.mts} +1 -1
- package/dist/fs.d.mts +1 -1
- package/dist/fs.mjs +2 -7
- package/dist/fs.mjs.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +677 -182
- package/dist/index.mjs.map +1 -1
- package/dist/util/path.d.mts +5 -0
- package/dist/util/path.mjs +12 -0
- package/dist/util/path.mjs.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/util/path.ts
|
|
2
|
+
const TRAILING_SLASH_REGEX = /\/+$/;
|
|
3
|
+
const MULTIPLE_SLASH_REGEX = /\/+/g;
|
|
4
|
+
function normalizePath(path) {
|
|
5
|
+
if (path === "" || path === "/") return "/";
|
|
6
|
+
const normalized = path.replace(TRAILING_SLASH_REGEX, "").replace(MULTIPLE_SLASH_REGEX, "/");
|
|
7
|
+
return normalized.startsWith("/") ? normalized : `/${normalized}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { normalizePath };
|
|
12
|
+
//# sourceMappingURL=path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.mjs","names":[],"sources":["../../src/util/path.ts"],"sourcesContent":["const TRAILING_SLASH_REGEX = /\\/+$/;\nconst MULTIPLE_SLASH_REGEX = /\\/+/g;\n\nexport function normalizePath(path: string): string {\n\tif (path === '' || path === '/') {\n\t\treturn '/';\n\t}\n\tconst normalized = path\n\t\t.replace(TRAILING_SLASH_REGEX, '')\n\t\t.replace(MULTIPLE_SLASH_REGEX, '/');\n\treturn normalized.startsWith('/') ? normalized : `/${normalized}`;\n}\n"],"mappings":";AAAA,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAE7B,SAAgB,cAAc,MAAsB;AACnD,KAAI,SAAS,MAAM,SAAS,IAC3B,QAAO;CAER,MAAM,aAAa,KACjB,QAAQ,sBAAsB,GAAG,CACjC,QAAQ,sBAAsB,IAAI;AACpC,QAAO,WAAW,WAAW,IAAI,GAAG,aAAa,IAAI"}
|
package/package.json
CHANGED
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
"./fs": {
|
|
21
21
|
"import": "./dist/fs.mjs",
|
|
22
22
|
"types": "./dist/fs.d.mts"
|
|
23
|
+
},
|
|
24
|
+
"./util/path": {
|
|
25
|
+
"import": "./dist/util/path.mjs",
|
|
26
|
+
"types": "./dist/util/path.d.mts"
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
"files": [
|
|
@@ -50,5 +54,5 @@
|
|
|
50
54
|
},
|
|
51
55
|
"type": "module",
|
|
52
56
|
"types": "./dist/index.d.mts",
|
|
53
|
-
"version": "0.1.
|
|
57
|
+
"version": "0.1.4"
|
|
54
58
|
}
|