@stryke/path 0.6.0 → 0.7.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/index.cjs +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/replace.cjs +10 -0
- package/dist/replace.d.ts +14 -0
- package/dist/replace.mjs +1 -0
- package/dist/slash.cjs +1 -1
- package/dist/slash.d.ts +2 -2
- package/dist/slash.mjs +1 -1
- package/package.json +15 -1
package/dist/index.cjs
CHANGED
|
@@ -124,6 +124,17 @@ Object.keys(_regex).forEach(function (key) {
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
|
+
var _replace = require("./replace.cjs");
|
|
128
|
+
Object.keys(_replace).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (key in exports && exports[key] === _replace[key]) return;
|
|
131
|
+
Object.defineProperty(exports, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _replace[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
127
138
|
var _resolve = require("./resolve.cjs");
|
|
128
139
|
Object.keys(_resolve).forEach(function (key) {
|
|
129
140
|
if (key === "default" || key === "__esModule") return;
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./asset-extensions";export*from"./correct-path";export*from"./delimiter";export*from"./exists";export*from"./file-path-fns";export*from"./get-parent-path";export*from"./get-workspace-root";export*from"./is-file";export*from"./is-root-dir";export*from"./join-paths";export*from"./regex";export*from"./resolve";export*from"./slash";
|
|
1
|
+
export*from"./asset-extensions";export*from"./correct-path";export*from"./delimiter";export*from"./exists";export*from"./file-path-fns";export*from"./get-parent-path";export*from"./get-workspace-root";export*from"./is-file";export*from"./is-root-dir";export*from"./join-paths";export*from"./regex";export*from"./replace";export*from"./resolve";export*from"./slash";
|
package/dist/replace.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.replacePath = replacePath;
|
|
7
|
+
var _slash = require("./slash.cjs");
|
|
8
|
+
function replacePath(e, t = process.cwd()) {
|
|
9
|
+
return (0, _slash.slash)(e).replace((0, _slash.slash)(t), "").replace(/^\//, "");
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace the base path from the beginning of the given path.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* replacePath("/home/user/project/src/index.ts", "/home/user/project");
|
|
7
|
+
* // returns "src/index.ts"
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @param path - The path string to replace a substring from
|
|
11
|
+
* @param base - The base path to remove from the beginning of the {@link path}
|
|
12
|
+
* @returns The {@link path} with the {@link base} path removed
|
|
13
|
+
*/
|
|
14
|
+
export declare function replacePath(path: string, base?: string): string;
|
package/dist/replace.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{slash as r}from"./slash";export function replacePath(e,t=process.cwd()){return r(e).replace(r(t),"").replace(/^\//,"")}
|
package/dist/slash.cjs
CHANGED
package/dist/slash.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Replace backslash to slash
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
4
|
+
* @param path - The string to replace
|
|
5
5
|
* @returns The string with replaced backslashes
|
|
6
6
|
*/
|
|
7
|
-
export declare function slash(
|
|
7
|
+
export declare function slash(path: string): string;
|
package/dist/slash.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function slash(r){return r.replace(/\\/g,"/")}
|
|
1
|
+
export function slash(r){return r.startsWith("\\\\?\\")?r:r.replace(/\\/g,"/")}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/path",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing various utilities that expand the functionality of NodeJs's built-in `path` module",
|
|
6
6
|
"repository": {
|
|
@@ -77,6 +77,20 @@
|
|
|
77
77
|
"default": "./dist/resolve.mjs"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
+
"./replace": {
|
|
81
|
+
"import": {
|
|
82
|
+
"types": "./dist/replace.d.ts",
|
|
83
|
+
"default": "./dist/replace.mjs"
|
|
84
|
+
},
|
|
85
|
+
"require": {
|
|
86
|
+
"types": "./dist/replace.d.ts",
|
|
87
|
+
"default": "./dist/replace.cjs"
|
|
88
|
+
},
|
|
89
|
+
"default": {
|
|
90
|
+
"types": "./dist/replace.d.ts",
|
|
91
|
+
"default": "./dist/replace.mjs"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
80
94
|
"./regex": {
|
|
81
95
|
"import": { "types": "./dist/regex.d.ts", "default": "./dist/regex.mjs" },
|
|
82
96
|
"require": {
|