@stryke/path 0.23.1 → 0.24.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/CHANGELOG.md +24 -0
- package/dist/common.cjs +1 -0
- package/dist/common.d.cts +20 -0
- package/dist/common.d.cts.map +1 -0
- package/dist/common.d.mts +20 -0
- package/dist/common.d.mts.map +1 -0
- package/dist/common.mjs +2 -0
- package/dist/common.mjs.map +1 -0
- package/dist/correct-path.cjs +1 -1
- package/dist/correct-path.d.cts +8 -1
- package/dist/correct-path.d.cts.map +1 -1
- package/dist/correct-path.d.mts +8 -1
- package/dist/correct-path.d.mts.map +1 -1
- package/dist/correct-path.mjs +1 -1
- package/dist/correct-path.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/is-parent-path.cjs +1 -1
- package/dist/is-parent-path.mjs +1 -1
- package/dist/is-parent-path.mjs.map +1 -1
- package/dist/normalize.cjs +1 -1
- package/dist/normalize.d.cts +2 -2
- package/dist/normalize.d.mts +2 -2
- package/dist/normalize.mjs +1 -1
- package/package.json +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Stryke - Path
|
|
4
4
|
|
|
5
|
+
## [0.23.2](https://github.com/storm-software/stryke/releases/tag/path%400.23.2) (12/18/2025)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **path:** Resolve issue with comparing paths in `isParentPath` helper function
|
|
10
|
+
([545d053](https://github.com/storm-software/stryke/commit/545d053))
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
# Changelog for Stryke - Path
|
|
15
|
+
|
|
16
|
+
## [0.23.1](https://github.com/storm-software/stryke/releases/tag/path%400.23.1) (12/18/2025)
|
|
17
|
+
|
|
18
|
+
### Miscellaneous
|
|
19
|
+
|
|
20
|
+
- **monorepo:** Update CDN URLs for banner assets
|
|
21
|
+
([5aefe1b](https://github.com/storm-software/stryke/commit/5aefe1b))
|
|
22
|
+
|
|
23
|
+
### Updated Dependencies
|
|
24
|
+
|
|
25
|
+
- Updated **type-checks** to **v0.5.13**
|
|
26
|
+
- Updated **convert** to **v0.6.28**
|
|
27
|
+
- Updated **types** to **v0.10.27**
|
|
28
|
+
|
|
5
29
|
## [0.23.0](https://github.com/storm-software/stryke/releases/tag/path%400.23.0) (12/18/2025)
|
|
6
30
|
|
|
7
31
|
### Features
|
package/dist/common.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./slash.cjs`),t=require(`./correct-path.cjs`);function n(n){let[r=``,...i]=n.map(n=>t.correctPath(e.slash(n)));if(!r)return``;if(i.length===0)return r;let a=r.split(`/`).length;for(let e of i){let t=e.split(`/`);for(let e=0;e<a;e++)t[e]!==r.split(`/`)[e]&&(a=e);if(a===0)return``}return t.withoutTrailingSlash(r.split(`/`).slice(0,a).join(`/`))}exports.commonPath=n;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/common.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Get the common path from an array of paths
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* commonPath(['/foo/bar/baz', '/foo/bar/qux', '/foo/bar/baz/quux']);
|
|
8
|
+
* // returns '/foo/bar'
|
|
9
|
+
*
|
|
10
|
+
* commonPath(['C:/foo/bar/baz', 'C:/foo/bar/qux', 'C:/foo/bar/baz/quux']);
|
|
11
|
+
* // returns 'C:/foo/bar'
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param paths - The array of paths
|
|
15
|
+
* @returns The common path
|
|
16
|
+
*/
|
|
17
|
+
declare function commonPath(paths: string[]): string;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { commonPath };
|
|
20
|
+
//# sourceMappingURL=common.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.cts","names":[],"sources":["../src/common.ts"],"sourcesContent":[],"mappings":";;AAoCA;;;;;;;;;;;;;;iBAAgB,UAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/common.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Get the common path from an array of paths
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* commonPath(['/foo/bar/baz', '/foo/bar/qux', '/foo/bar/baz/quux']);
|
|
8
|
+
* // returns '/foo/bar'
|
|
9
|
+
*
|
|
10
|
+
* commonPath(['C:/foo/bar/baz', 'C:/foo/bar/qux', 'C:/foo/bar/baz/quux']);
|
|
11
|
+
* // returns 'C:/foo/bar'
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @param paths - The array of paths
|
|
15
|
+
* @returns The common path
|
|
16
|
+
*/
|
|
17
|
+
declare function commonPath(paths: string[]): string;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { commonPath };
|
|
20
|
+
//# sourceMappingURL=common.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.mts","names":[],"sources":["../src/common.ts"],"sourcesContent":[],"mappings":";;AAoCA;;;;;;;;;;;;;;iBAAgB,UAAA"}
|
package/dist/common.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{slash as e}from"./slash.mjs";import{correctPath as t,withoutTrailingSlash as n}from"./correct-path.mjs";function r(r){let[i=``,...a]=r.map(n=>t(e(n)));if(!i)return``;if(a.length===0)return i;let o=i.split(`/`).length;for(let e of a){let t=e.split(`/`);for(let e=0;e<o;e++)t[e]!==i.split(`/`)[e]&&(o=e);if(o===0)return``}return n(i.split(`/`).slice(0,o).join(`/`))}export{r as commonPath};
|
|
2
|
+
//# sourceMappingURL=common.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.mjs","names":[],"sources":["../src/common.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { correctPath, withoutTrailingSlash } from \"./normalize\";\nimport { slash } from \"./slash\";\n\n/**\n * Get the common path from an array of paths\n *\n * @example\n * ```ts\n * commonPath(['/foo/bar/baz', '/foo/bar/qux', '/foo/bar/baz/quux']);\n * // returns '/foo/bar'\n *\n * commonPath(['C:/foo/bar/baz', 'C:/foo/bar/qux', 'C:/foo/bar/baz/quux']);\n * // returns 'C:/foo/bar'\n * ```\n *\n * @param paths - The array of paths\n * @returns The common path\n */\nexport function commonPath(paths: string[]): string {\n const [first = \"\", ...remaining] = paths.map(path =>\n correctPath(slash(path))\n );\n if (!first) {\n return \"\";\n }\n if (remaining.length === 0) {\n return first;\n }\n\n let endOfPrefix = first.split(\"/\").length;\n for (const path of remaining) {\n const compare = path.split(\"/\");\n for (let i = 0; i < endOfPrefix; i++) {\n if (compare[i] !== first.split(\"/\")[i]) {\n endOfPrefix = i;\n }\n }\n\n if (endOfPrefix === 0) {\n return \"\";\n }\n }\n\n return withoutTrailingSlash(first.split(\"/\").slice(0, endOfPrefix).join(\"/\"));\n}\n"],"mappings":"+GAoCA,SAAgB,EAAW,EAAyB,CAClD,GAAM,CAAC,EAAQ,GAAI,GAAG,GAAa,EAAM,IAAI,GAC3C,EAAY,EAAM,EAAK,CAAC,CACzB,CACD,GAAI,CAAC,EACH,MAAO,GAET,GAAI,EAAU,SAAW,EACvB,OAAO,EAGT,IAAI,EAAc,EAAM,MAAM,IAAI,CAAC,OACnC,IAAK,IAAM,KAAQ,EAAW,CAC5B,IAAM,EAAU,EAAK,MAAM,IAAI,CAC/B,IAAK,IAAI,EAAI,EAAG,EAAI,EAAa,IAC3B,EAAQ,KAAO,EAAM,MAAM,IAAI,CAAC,KAClC,EAAc,GAIlB,GAAI,IAAgB,EAClB,MAAO,GAIX,OAAO,EAAqB,EAAM,MAAM,IAAI,CAAC,MAAM,EAAG,EAAY,CAAC,KAAK,IAAI,CAAC"}
|
package/dist/correct-path.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./cwd.cjs`),t=require(`./regex.cjs`),n=require(`./is-type.cjs`),r=require(`./slash.cjs`),i=require(`./join-paths.cjs`),a=require(`./append.cjs`);function o(e=``){return e&&r.slash(e).replace(t.DRIVE_LETTER_START_REGEX,e=>e.toUpperCase())}function s(e){if(!e||e.length===0)return`.`;e=o(e);let r=e.match(t.UNC_REGEX),i=n.isAbsolutePath(e),a=e.endsWith(`/`);return e=l(e,!i),e.length===0?i?`/`:a?`./`:`.`:(a&&(e+=`/`),t.DRIVE_LETTER_REGEX.test(e)&&(e+=`/`),r?i?`//${e}`:`//./${e}`:!e.startsWith(`/`)&&i&&!t.DRIVE_LETTER_REGEX.test(e)?`/${e}`:e)}function c(e){if(!e||e.length===0)return`.`;e=s(e);let t=!1;return e.split(`/`).reduce((e,n)=>n?.trim()?t||n.includes(`*`)?(t=!0,e):e+(e?`/${n}`:n):e,``)}function l(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function u(t,i=e.cwd()){return n.isAbsolutePath(t)?t:r.slash(l(a.appendPath(t,i),!0))}function d(t,a=e.cwd()){return!t||t.length===0?`.`:(t=n.isAbsolutePath(t)?r.slash(l(t,!0)):r.slash(l(i.joinPaths(a,t),!0)),t.startsWith(`./`)?t.slice(2):t)}function f(e){let t=s(e);return t.endsWith(`/`)?t:`${t}/`}exports.correctPath=s,exports.normalizeString=l,exports.normalizeWindowsPath=o,exports.stripStars=c,exports.toAbsolutePath=u,exports.toRelativePath=d,exports.withTrailingSlash=f;
|
|
1
|
+
const e=require(`./cwd.cjs`),t=require(`./regex.cjs`),n=require(`./is-type.cjs`),r=require(`./slash.cjs`),i=require(`./join-paths.cjs`),a=require(`./append.cjs`);function o(e=``){return e&&r.slash(e).replace(t.DRIVE_LETTER_START_REGEX,e=>e.toUpperCase())}function s(e){if(!e||e.length===0)return`.`;e=o(e);let r=e.match(t.UNC_REGEX),i=n.isAbsolutePath(e),a=e.endsWith(`/`);return e=l(e,!i),e.length===0?i?`/`:a?`./`:`.`:(a&&(e+=`/`),t.DRIVE_LETTER_REGEX.test(e)&&(e+=`/`),r?i?`//${e}`:`//./${e}`:!e.startsWith(`/`)&&i&&!t.DRIVE_LETTER_REGEX.test(e)?`/${e}`:e)}function c(e){if(!e||e.length===0)return`.`;e=s(e);let t=!1;return e.split(`/`).reduce((e,n)=>n?.trim()?t||n.includes(`*`)?(t=!0,e):e+(e?`/${n}`:n):e,``)}function l(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function u(t,i=e.cwd()){return n.isAbsolutePath(t)?t:r.slash(l(a.appendPath(t,i),!0))}function d(t,a=e.cwd()){return!t||t.length===0?`.`:(t=n.isAbsolutePath(t)?r.slash(l(t,!0)):r.slash(l(i.joinPaths(a,t),!0)),t.startsWith(`./`)?t.slice(2):t)}function f(e){let t=s(e);return t.endsWith(`/`)?t:`${t}/`}function p(e){let t=s(e);return t.endsWith(`/`)?t.slice(0,-1):t}exports.correctPath=s,exports.normalizeString=l,exports.normalizeWindowsPath=o,exports.stripStars=c,exports.toAbsolutePath=u,exports.toRelativePath=d,exports.withTrailingSlash=f,exports.withoutTrailingSlash=p;
|
package/dist/correct-path.d.cts
CHANGED
|
@@ -54,6 +54,13 @@ declare function toRelativePath(path: string, cwd?: string): string;
|
|
|
54
54
|
* @returns The modified path with a trailing slash.
|
|
55
55
|
*/
|
|
56
56
|
declare function withTrailingSlash(path: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Removes a trailing slash from a path if it has one.
|
|
59
|
+
*
|
|
60
|
+
* @param path - The path to modify.
|
|
61
|
+
* @returns The modified path without a trailing slash.
|
|
62
|
+
*/
|
|
63
|
+
declare function withoutTrailingSlash(path: string): string;
|
|
57
64
|
//#endregion
|
|
58
|
-
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
|
65
|
+
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash };
|
|
59
66
|
//# sourceMappingURL=correct-path.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correct-path.d.cts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AA8BA;AA2EA;AAeA;AAwBgB,iBA1MA,WAAA,CA0MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA
|
|
1
|
+
{"version":3,"file":"correct-path.d.cts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AA8BA;AA2EA;AAeA;AAwBgB,iBA1MA,WAAA,CA0MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAYjC;;;;;;;;;;;;;;;iBA5JgB,UAAA;;;;;;;;iBA8BA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA;;;;;;;iBAYA,oBAAA"}
|
package/dist/correct-path.d.mts
CHANGED
|
@@ -54,6 +54,13 @@ declare function toRelativePath(path: string, cwd?: string): string;
|
|
|
54
54
|
* @returns The modified path with a trailing slash.
|
|
55
55
|
*/
|
|
56
56
|
declare function withTrailingSlash(path: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Removes a trailing slash from a path if it has one.
|
|
59
|
+
*
|
|
60
|
+
* @param path - The path to modify.
|
|
61
|
+
* @returns The modified path without a trailing slash.
|
|
62
|
+
*/
|
|
63
|
+
declare function withoutTrailingSlash(path: string): string;
|
|
57
64
|
//#endregion
|
|
58
|
-
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
|
65
|
+
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash };
|
|
59
66
|
//# sourceMappingURL=correct-path.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correct-path.d.mts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AA8BA;AA2EA;AAeA;AAwBgB,iBA1MA,WAAA,CA0MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA
|
|
1
|
+
{"version":3,"file":"correct-path.d.mts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AA8BA;AA2EA;AAeA;AAwBgB,iBA1MA,WAAA,CA0MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAYjC;;;;;;;;;;;;;;;iBA5JgB,UAAA;;;;;;;;iBA8BA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA;;;;;;;iBAYA,oBAAA"}
|
package/dist/correct-path.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cwd as e}from"./cwd.mjs";import{DRIVE_LETTER_REGEX as t,DRIVE_LETTER_START_REGEX as n,UNC_REGEX as r}from"./regex.mjs";import{isAbsolutePath as i}from"./is-type.mjs";import{slash as a}from"./slash.mjs";import{joinPaths as o}from"./join-paths.mjs";import{appendPath as s}from"./append.mjs";function c(e=``){return e&&a(e).replace(n,e=>e.toUpperCase())}function l(e){if(!e||e.length===0)return`.`;e=c(e);let n=e.match(r),a=i(e),o=e.endsWith(`/`);return e=d(e,!a),e.length===0?a?`/`:o?`./`:`.`:(o&&(e+=`/`),t.test(e)&&(e+=`/`),n?a?`//${e}`:`//./${e}`:!e.startsWith(`/`)&&a&&!t.test(e)?`/${e}`:e)}function u(e){if(!e||e.length===0)return`.`;e=l(e);let t=!1;return e.split(`/`).reduce((e,n)=>n?.trim()?t||n.includes(`*`)?(t=!0,e):e+(e?`/${n}`:n):e,``)}function d(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function f(t,n=e()){return i(t)?t:a(d(s(t,n),!0))}function p(t,n=e()){return!t||t.length===0?`.`:(t=i(t)?a(d(t,!0)):a(d(o(n,t),!0)),t.startsWith(`./`)?t.slice(2):t)}function m(e){let t=l(e);return t.endsWith(`/`)?t:`${t}/`}export{l as correctPath,d as normalizeString,c as normalizeWindowsPath,u as stripStars,f as toAbsolutePath,p as toRelativePath,m as withTrailingSlash};
|
|
1
|
+
import{cwd as e}from"./cwd.mjs";import{DRIVE_LETTER_REGEX as t,DRIVE_LETTER_START_REGEX as n,UNC_REGEX as r}from"./regex.mjs";import{isAbsolutePath as i}from"./is-type.mjs";import{slash as a}from"./slash.mjs";import{joinPaths as o}from"./join-paths.mjs";import{appendPath as s}from"./append.mjs";function c(e=``){return e&&a(e).replace(n,e=>e.toUpperCase())}function l(e){if(!e||e.length===0)return`.`;e=c(e);let n=e.match(r),a=i(e),o=e.endsWith(`/`);return e=d(e,!a),e.length===0?a?`/`:o?`./`:`.`:(o&&(e+=`/`),t.test(e)&&(e+=`/`),n?a?`//${e}`:`//./${e}`:!e.startsWith(`/`)&&a&&!t.test(e)?`/${e}`:e)}function u(e){if(!e||e.length===0)return`.`;e=l(e);let t=!1;return e.split(`/`).reduce((e,n)=>n?.trim()?t||n.includes(`*`)?(t=!0,e):e+(e?`/${n}`:n):e,``)}function d(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function f(t,n=e()){return i(t)?t:a(d(s(t,n),!0))}function p(t,n=e()){return!t||t.length===0?`.`:(t=i(t)?a(d(t,!0)):a(d(o(n,t),!0)),t.startsWith(`./`)?t.slice(2):t)}function m(e){let t=l(e);return t.endsWith(`/`)?t:`${t}/`}function h(e){let t=l(e);return t.endsWith(`/`)?t.slice(0,-1):t}export{l as correctPath,d as normalizeString,c as normalizeWindowsPath,u as stripStars,f as toAbsolutePath,p as toRelativePath,m as withTrailingSlash,h as withoutTrailingSlash};
|
|
2
2
|
//# sourceMappingURL=correct-path.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correct-path.mjs","names":["char: string | null","currentDir","cwd"],"sources":["../src/correct-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { appendPath } from \"./append\";\nimport { cwd as currentDir } from \"./cwd\";\nimport { isAbsolutePath } from \"./is-type\";\nimport { joinPaths } from \"./join-paths\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\nimport { slash } from \"./slash\";\n\n// Util to normalize windows paths to posix\nexport function normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n\n return slash(input).replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\n/**\n * Corrects/normalized a file path.\n *\n * @param path - The path to correct.\n * @returns The corrected path.\n */\nexport function correctPath(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolutePath(path);\n const trailingSeparator = path.endsWith(\"/\");\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return !path.startsWith(\"/\") &&\n isPathAbsolute &&\n !DRIVE_LETTER_REGEX.test(path)\n ? `/${path}`\n : path;\n}\n\n/**\n * Remove any star tokens (*) from the end of the file path\n *\n * @example\n * stripStars(\"src/**\") // returns \"src\"\n * stripStars(\"src/*\") // returns \"src\"\n * stripStars(\"src/**\\/*\") // returns \"src\"\n * stripStars(\"src/**\\/*.txt\") // returns \"src\"\n * stripStars(\"src/**\\/file.txt\") // returns \"src\"\n * stripStars(\"src/file.txt\") // returns \"src/file.txt\"\n * stripStars(\"\") // returns \".\"\n *\n * @param path - The path to correct.\n * @returns The corrected path.\n */\nexport function stripStars(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n path = correctPath(path);\n\n let found = false;\n\n return path.split(\"/\").reduce((ret, segment) => {\n if (!segment?.trim()) {\n return ret;\n }\n\n if (found || segment.includes(\"*\")) {\n found = true;\n return ret;\n }\n\n return ret + (ret ? `/${segment}` : segment);\n }, \"\");\n}\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalize path string.\n */\nexport function normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\n/**\n * Converts a given path to an absolute path based on the current working directory.\n *\n * @param path - The path to convert to an absolute path.\n * @param cwd - The current working directory to use as the base path if the path is not absolute.\n * @returns The absolute path.\n */\nexport function toAbsolutePath(path: string, cwd = currentDir()): string {\n if (isAbsolutePath(path)) {\n return path;\n }\n\n return slash(normalizeString(appendPath(path, cwd), true));\n}\n\n/**\n * Converts a given path to a relative path based on the current working directory.\n *\n * @param path - The path to convert to a relative path.\n * @param cwd - The current working directory to use as the base path if the path is not absolute.\n * @returns The relative path.\n */\nexport function toRelativePath(path: string, cwd = currentDir()): string {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n if (isAbsolutePath(path)) {\n path = slash(normalizeString(path, true));\n } else {\n path = slash(normalizeString(joinPaths(cwd, path), true));\n }\n\n if (path.startsWith(\"./\")) {\n return path.slice(2);\n }\n\n return path;\n}\n\n/**\n * Adds a trailing slash to a path if it doesn't already have one.\n *\n * @param path - The path to modify.\n * @returns The modified path with a trailing slash.\n */\nexport function withTrailingSlash(path: string): string {\n const result = correctPath(path);\n\n return result.endsWith(\"/\") ? result : `${result}/`;\n}\n"],"mappings":"wSA8BA,SAAgB,EAAqB,EAAQ,GAAI,CAK/C,OAJK,GAIE,EAAM,EAAM,CAAC,QAAQ,EAA0B,GAAK,EAAE,aAAa,CAAC,CAS7E,SAAgB,EAAY,EAAe,CACzC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAIT,EAAO,EAAqB,EAAK,CAEjC,IAAM,EAAY,EAAK,MAAM,EAAU,CACjC,EAAiB,EAAe,EAAK,CACrC,EAAoB,EAAK,SAAS,IAAI,CA0B5C,MAvBA,GAAO,EAAgB,EAAM,CAAC,EAAe,CAEzC,EAAK,SAAW,EACd,EACK,IAEF,EAAoB,KAAO,KAGhC,IACF,GAAQ,KAEN,EAAmB,KAAK,EAAK,GAC/B,GAAQ,KAGN,EACG,EAGE,KAAK,IAFH,OAAO,IAKX,CAAC,EAAK,WAAW,IAAI,EAC1B,GACA,CAAC,EAAmB,KAAK,EAAK,CAC5B,IAAI,IACJ,GAkBN,SAAgB,EAAW,EAAe,CACxC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAGT,EAAO,EAAY,EAAK,CAExB,IAAI,EAAQ,GAEZ,OAAO,EAAK,MAAM,IAAI,CAAC,QAAQ,EAAK,IAC7B,GAAS,MAAM,CAIhB,GAAS,EAAQ,SAAS,IAAI,EAChC,EAAQ,GACD,GAGF,GAAO,EAAM,IAAI,IAAY,GAR3B,EASR,GAAG,CAUR,SAAgB,EAAgB,EAAc,EAAyB,CACrE,IAAI,EAAM,GACN,EAAoB,EACpB,EAAY,GACZ,EAAO,EACPA,EAAsB,KAC1B,IAAK,IAAI,EAAQ,EAAG,GAAS,EAAK,OAAQ,EAAE,EAAO,CACjD,GAAI,EAAQ,EAAK,OAEf,EAAO,EAAK,WACH,IAAS,IAClB,WAEA,EAAO,IAET,GAAI,IAAS,IAAK,CAChB,GAAI,MAAc,EAAQ,GAAK,IAAS,GAAG,GAEhC,IAAS,EAAG,CACrB,GACE,EAAI,OAAS,GACb,IAAsB,GACtB,EAAI,EAAI,OAAS,KAAO,KACxB,EAAI,EAAI,OAAS,KAAO,QAEpB,EAAI,OAAS,EAAG,CAClB,IAAM,EAAiB,EAAI,YAAY,IAAI,CACvC,IAAmB,IACrB,EAAM,GACN,EAAoB,IAEpB,EAAM,EAAI,MAAM,EAAG,EAAe,CAClC,EAAoB,EAAI,OAAS,EAAI,EAAI,YAAY,IAAI,EAE3D,EAAY,EACZ,EAAO,EACP,iBACS,EAAI,OAAS,EAAG,CACzB,EAAM,GACN,EAAoB,EACpB,EAAY,EACZ,EAAO,EACP,UAGA,IACF,GAAO,EAAI,OAAS,EAAI,MAAQ,KAChC,EAAoB,QAGlB,EAAI,OAAS,EACf,GAAO,IAAI,EAAK,MAAM,EAAY,EAAG,EAAM,GAE3C,EAAM,EAAK,MAAM,EAAY,EAAG,EAAM,CAExC,EAAoB,EAAQ,EAAY,EAE1C,EAAY,EACZ,EAAO,OACE,IAAS,KAAO,IAAS,GAClC,EAAE,EAEF,EAAO,GAGX,OAAO,EAUT,SAAgB,EAAe,EAAc,EAAMC,GAAY,CAAU,CAKvE,OAJI,EAAe,EAAK,CACf,EAGF,EAAM,EAAgB,EAAW,EAAMC,EAAI,CAAE,GAAK,CAAC,CAU5D,SAAgB,EAAe,EAAc,EAAMD,GAAY,CAAU,CAevE,MAdI,CAAC,GAAQ,EAAK,SAAW,EACpB,KAGT,AAGE,EAHE,EAAe,EAAK,CACf,EAAM,EAAgB,EAAM,GAAK,CAAC,CAElC,EAAM,EAAgB,EAAUC,EAAK,EAAK,CAAE,GAAK,CAAC,CAGvD,EAAK,WAAW,KAAK,CAChB,EAAK,MAAM,EAAE,CAGf,GAST,SAAgB,EAAkB,EAAsB,CACtD,IAAM,EAAS,EAAY,EAAK,CAEhC,OAAO,EAAO,SAAS,IAAI,CAAG,EAAS,GAAG,EAAO"}
|
|
1
|
+
{"version":3,"file":"correct-path.mjs","names":["char: string | null","currentDir","cwd"],"sources":["../src/correct-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { appendPath } from \"./append\";\nimport { cwd as currentDir } from \"./cwd\";\nimport { isAbsolutePath } from \"./is-type\";\nimport { joinPaths } from \"./join-paths\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\nimport { slash } from \"./slash\";\n\n// Util to normalize windows paths to posix\nexport function normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n\n return slash(input).replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\n/**\n * Corrects/normalized a file path.\n *\n * @param path - The path to correct.\n * @returns The corrected path.\n */\nexport function correctPath(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n // Normalize windows argument\n path = normalizeWindowsPath(path);\n\n const isUNCPath = path.match(UNC_REGEX);\n const isPathAbsolute = isAbsolutePath(path);\n const trailingSeparator = path.endsWith(\"/\");\n\n // Normalize the path\n path = normalizeString(path, !isPathAbsolute);\n\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n\n if (trailingSeparator) {\n path += \"/\";\n }\n if (DRIVE_LETTER_REGEX.test(path)) {\n path += \"/\";\n }\n\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n\n return !path.startsWith(\"/\") &&\n isPathAbsolute &&\n !DRIVE_LETTER_REGEX.test(path)\n ? `/${path}`\n : path;\n}\n\n/**\n * Remove any star tokens (*) from the end of the file path\n *\n * @example\n * stripStars(\"src/**\") // returns \"src\"\n * stripStars(\"src/*\") // returns \"src\"\n * stripStars(\"src/**\\/*\") // returns \"src\"\n * stripStars(\"src/**\\/*.txt\") // returns \"src\"\n * stripStars(\"src/**\\/file.txt\") // returns \"src\"\n * stripStars(\"src/file.txt\") // returns \"src/file.txt\"\n * stripStars(\"\") // returns \".\"\n *\n * @param path - The path to correct.\n * @returns The corrected path.\n */\nexport function stripStars(path?: string) {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n path = correctPath(path);\n\n let found = false;\n\n return path.split(\"/\").reduce((ret, segment) => {\n if (!segment?.trim()) {\n return ret;\n }\n\n if (found || segment.includes(\"*\")) {\n found = true;\n return ret;\n }\n\n return ret + (ret ? `/${segment}` : segment);\n }, \"\");\n}\n\n/**\n * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n *\n * @param path - The path to normalize.\n * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n * @returns the normalize path string.\n */\nexport function normalizeString(path: string, allowAboveRoot: boolean) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char: string | null = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n // casted because we know it exists thanks to the length check\n char = path[index] as string;\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) {\n // NOOP\n } else if (dots === 2) {\n if (\n res.length < 2 ||\n lastSegmentLength !== 2 ||\n res[res.length - 1] !== \".\" ||\n res[res.length - 2] !== \".\"\n ) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\n/**\n * Converts a given path to an absolute path based on the current working directory.\n *\n * @param path - The path to convert to an absolute path.\n * @param cwd - The current working directory to use as the base path if the path is not absolute.\n * @returns The absolute path.\n */\nexport function toAbsolutePath(path: string, cwd = currentDir()): string {\n if (isAbsolutePath(path)) {\n return path;\n }\n\n return slash(normalizeString(appendPath(path, cwd), true));\n}\n\n/**\n * Converts a given path to a relative path based on the current working directory.\n *\n * @param path - The path to convert to a relative path.\n * @param cwd - The current working directory to use as the base path if the path is not absolute.\n * @returns The relative path.\n */\nexport function toRelativePath(path: string, cwd = currentDir()): string {\n if (!path || path.length === 0) {\n return \".\";\n }\n\n if (isAbsolutePath(path)) {\n path = slash(normalizeString(path, true));\n } else {\n path = slash(normalizeString(joinPaths(cwd, path), true));\n }\n\n if (path.startsWith(\"./\")) {\n return path.slice(2);\n }\n\n return path;\n}\n\n/**\n * Adds a trailing slash to a path if it doesn't already have one.\n *\n * @param path - The path to modify.\n * @returns The modified path with a trailing slash.\n */\nexport function withTrailingSlash(path: string): string {\n const result = correctPath(path);\n\n return result.endsWith(\"/\") ? result : `${result}/`;\n}\n\n/**\n * Removes a trailing slash from a path if it has one.\n *\n * @param path - The path to modify.\n * @returns The modified path without a trailing slash.\n */\nexport function withoutTrailingSlash(path: string): string {\n const result = correctPath(path);\n\n return result.endsWith(\"/\") ? result.slice(0, -1) : result;\n}\n"],"mappings":"wSA8BA,SAAgB,EAAqB,EAAQ,GAAI,CAK/C,OAJK,GAIE,EAAM,EAAM,CAAC,QAAQ,EAA0B,GAAK,EAAE,aAAa,CAAC,CAS7E,SAAgB,EAAY,EAAe,CACzC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAIT,EAAO,EAAqB,EAAK,CAEjC,IAAM,EAAY,EAAK,MAAM,EAAU,CACjC,EAAiB,EAAe,EAAK,CACrC,EAAoB,EAAK,SAAS,IAAI,CA0B5C,MAvBA,GAAO,EAAgB,EAAM,CAAC,EAAe,CAEzC,EAAK,SAAW,EACd,EACK,IAEF,EAAoB,KAAO,KAGhC,IACF,GAAQ,KAEN,EAAmB,KAAK,EAAK,GAC/B,GAAQ,KAGN,EACG,EAGE,KAAK,IAFH,OAAO,IAKX,CAAC,EAAK,WAAW,IAAI,EAC1B,GACA,CAAC,EAAmB,KAAK,EAAK,CAC5B,IAAI,IACJ,GAkBN,SAAgB,EAAW,EAAe,CACxC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAGT,EAAO,EAAY,EAAK,CAExB,IAAI,EAAQ,GAEZ,OAAO,EAAK,MAAM,IAAI,CAAC,QAAQ,EAAK,IAC7B,GAAS,MAAM,CAIhB,GAAS,EAAQ,SAAS,IAAI,EAChC,EAAQ,GACD,GAGF,GAAO,EAAM,IAAI,IAAY,GAR3B,EASR,GAAG,CAUR,SAAgB,EAAgB,EAAc,EAAyB,CACrE,IAAI,EAAM,GACN,EAAoB,EACpB,EAAY,GACZ,EAAO,EACPA,EAAsB,KAC1B,IAAK,IAAI,EAAQ,EAAG,GAAS,EAAK,OAAQ,EAAE,EAAO,CACjD,GAAI,EAAQ,EAAK,OAEf,EAAO,EAAK,WACH,IAAS,IAClB,WAEA,EAAO,IAET,GAAI,IAAS,IAAK,CAChB,GAAI,MAAc,EAAQ,GAAK,IAAS,GAAG,GAEhC,IAAS,EAAG,CACrB,GACE,EAAI,OAAS,GACb,IAAsB,GACtB,EAAI,EAAI,OAAS,KAAO,KACxB,EAAI,EAAI,OAAS,KAAO,QAEpB,EAAI,OAAS,EAAG,CAClB,IAAM,EAAiB,EAAI,YAAY,IAAI,CACvC,IAAmB,IACrB,EAAM,GACN,EAAoB,IAEpB,EAAM,EAAI,MAAM,EAAG,EAAe,CAClC,EAAoB,EAAI,OAAS,EAAI,EAAI,YAAY,IAAI,EAE3D,EAAY,EACZ,EAAO,EACP,iBACS,EAAI,OAAS,EAAG,CACzB,EAAM,GACN,EAAoB,EACpB,EAAY,EACZ,EAAO,EACP,UAGA,IACF,GAAO,EAAI,OAAS,EAAI,MAAQ,KAChC,EAAoB,QAGlB,EAAI,OAAS,EACf,GAAO,IAAI,EAAK,MAAM,EAAY,EAAG,EAAM,GAE3C,EAAM,EAAK,MAAM,EAAY,EAAG,EAAM,CAExC,EAAoB,EAAQ,EAAY,EAE1C,EAAY,EACZ,EAAO,OACE,IAAS,KAAO,IAAS,GAClC,EAAE,EAEF,EAAO,GAGX,OAAO,EAUT,SAAgB,EAAe,EAAc,EAAMC,GAAY,CAAU,CAKvE,OAJI,EAAe,EAAK,CACf,EAGF,EAAM,EAAgB,EAAW,EAAMC,EAAI,CAAE,GAAK,CAAC,CAU5D,SAAgB,EAAe,EAAc,EAAMD,GAAY,CAAU,CAevE,MAdI,CAAC,GAAQ,EAAK,SAAW,EACpB,KAGT,AAGE,EAHE,EAAe,EAAK,CACf,EAAM,EAAgB,EAAM,GAAK,CAAC,CAElC,EAAM,EAAgB,EAAUC,EAAK,EAAK,CAAE,GAAK,CAAC,CAGvD,EAAK,WAAW,KAAK,CAChB,EAAK,MAAM,EAAE,CAGf,GAST,SAAgB,EAAkB,EAAsB,CACtD,IAAM,EAAS,EAAY,EAAK,CAEhC,OAAO,EAAO,SAAS,IAAI,CAAG,EAAS,GAAG,EAAO,GASnD,SAAgB,EAAqB,EAAsB,CACzD,IAAM,EAAS,EAAY,EAAK,CAEhC,OAAO,EAAO,SAAS,IAAI,CAAG,EAAO,MAAM,EAAG,GAAG,CAAG"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./cwd.cjs`),t=require(`./regex.cjs`),n=require(`./slash.cjs`),r=require(`./is-parent-path.cjs`),i=require(`./join-paths.cjs`),a=require(`./append.cjs`),o=require(`./asset-extensions.cjs`),s=require(`./correct-path.cjs`),c=require(`./
|
|
1
|
+
const e=require(`./cwd.cjs`),t=require(`./regex.cjs`),n=require(`./slash.cjs`),r=require(`./is-parent-path.cjs`),i=require(`./join-paths.cjs`),a=require(`./append.cjs`),o=require(`./asset-extensions.cjs`),s=require(`./correct-path.cjs`),c=require(`./common.cjs`),l=require(`./delimiter.cjs`),u=require(`./file-path-fns.cjs`),d=require(`./is-root-dir.cjs`),f=require(`./replace.cjs`),p=require(`./resolve-parent-path.cjs`);exports.ABSOLUTE_PATH_REGEX=t.ABSOLUTE_PATH_REGEX,exports.DEFAULT_ASSET_EXTS=o.DEFAULT_ASSET_EXTS,exports.DRIVE_LETTER_REGEX=t.DRIVE_LETTER_REGEX,exports.DRIVE_LETTER_START_REGEX=t.DRIVE_LETTER_START_REGEX,exports.FILE_EXTENSION_REGEX=t.FILE_EXTENSION_REGEX,exports.NPM_SCOPED_PACKAGE_REGEX=t.NPM_SCOPED_PACKAGE_REGEX,exports.PACKAGE_PATH_REGEX=t.PACKAGE_PATH_REGEX,exports.ROOT_FOLDER_REGEX=t.ROOT_FOLDER_REGEX,exports.UNC_REGEX=t.UNC_REGEX,exports.append=a.append,exports.appendExtension=a.appendExtension,exports.appendPath=a.appendPath,exports.basename=u.basename,exports.commonPath=c.commonPath,exports.correctPath=s.correctPath,exports.cwd=e.cwd,exports.delimiter=l.delimiter,exports.dirname=u.dirname,exports.extname=u.extname,exports.findFileDotExtension=u.findFileDotExtension,exports.findFileDotExtensionSafe=u.findFileDotExtensionSafe,exports.findFileExtension=u.findFileExtension,exports.findFileExtensionSafe=u.findFileExtensionSafe,exports.findFileName=u.findFileName,exports.findFilePath=u.findFilePath,exports.findFolderName=u.findFolderName,exports.formatSlash=n.formatSlash,exports.hasFileExtension=u.hasFileExtension,exports.hasFileName=u.hasFileName,exports.hasFilePath=u.hasFilePath,exports.hasFolderName=u.hasFolderName,exports.isParentPath=r.isParentPath,exports.isSystemRoot=d.isSystemRoot,exports.join=i.join,exports.joinPaths=i.joinPaths,exports.normalizeString=s.normalizeString,exports.normalizeWindowsPath=s.normalizeWindowsPath,exports.parsePath=u.parsePath,exports.posix=l.posix,exports.relative=u.relative,exports.relativePath=u.relativePath,exports.relativeToCurrentDir=u.relativeToCurrentDir,exports.renameFile=u.renameFile,exports.replaceExtension=f.replaceExtension,exports.replacePath=f.replacePath,exports.resolve=u.resolve,exports.resolveParentPath=p.resolveParentPath,exports.resolvePath=u.resolvePath,exports.resolvePaths=u.resolvePaths,exports.slash=n.slash,exports.stripStars=s.stripStars,exports.toAbsolutePath=s.toAbsolutePath,exports.toRelativePath=s.toRelativePath,exports.win32=l.win32,exports.withTrailingSlash=s.withTrailingSlash,exports.withoutTrailingSlash=s.withoutTrailingSlash;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppendPathOptions, append, appendExtension, appendPath } from "./append.cjs";
|
|
2
2
|
import { DEFAULT_ASSET_EXTS } from "./asset-extensions.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { commonPath } from "./common.cjs";
|
|
4
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash } from "./correct-path.cjs";
|
|
4
5
|
import { cwd } from "./cwd.cjs";
|
|
5
6
|
import { delimiter, posix, win32 } from "./delimiter.cjs";
|
|
6
7
|
import { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths } from "./file-path-fns.cjs";
|
|
@@ -11,4 +12,4 @@ import { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE
|
|
|
11
12
|
import { replaceExtension, replacePath } from "./replace.cjs";
|
|
12
13
|
import { resolveParentPath } from "./resolve-parent-path.cjs";
|
|
13
14
|
import { formatSlash, slash } from "./slash.cjs";
|
|
14
|
-
export { ABSOLUTE_PATH_REGEX, AppendPathOptions, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash };
|
|
15
|
+
export { ABSOLUTE_PATH_REGEX, AppendPathOptions, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, commonPath, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash, withoutTrailingSlash };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppendPathOptions, append, appendExtension, appendPath } from "./append.mjs";
|
|
2
2
|
import { DEFAULT_ASSET_EXTS } from "./asset-extensions.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { commonPath } from "./common.mjs";
|
|
4
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash } from "./correct-path.mjs";
|
|
4
5
|
import { cwd } from "./cwd.mjs";
|
|
5
6
|
import { delimiter, posix, win32 } from "./delimiter.mjs";
|
|
6
7
|
import { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths } from "./file-path-fns.mjs";
|
|
@@ -11,4 +12,4 @@ import { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE
|
|
|
11
12
|
import { replaceExtension, replacePath } from "./replace.mjs";
|
|
12
13
|
import { resolveParentPath } from "./resolve-parent-path.mjs";
|
|
13
14
|
import { formatSlash, slash } from "./slash.mjs";
|
|
14
|
-
export { ABSOLUTE_PATH_REGEX, AppendPathOptions, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash };
|
|
15
|
+
export { ABSOLUTE_PATH_REGEX, AppendPathOptions, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, commonPath, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash, withoutTrailingSlash };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cwd as e}from"./cwd.mjs";import{ABSOLUTE_PATH_REGEX as t,DRIVE_LETTER_REGEX as n,DRIVE_LETTER_START_REGEX as r,FILE_EXTENSION_REGEX as i,NPM_SCOPED_PACKAGE_REGEX as a,PACKAGE_PATH_REGEX as o,ROOT_FOLDER_REGEX as s,UNC_REGEX as c}from"./regex.mjs";import{formatSlash as l,slash as u}from"./slash.mjs";import{isParentPath as d}from"./is-parent-path.mjs";import{join as f,joinPaths as p}from"./join-paths.mjs";import{append as m,appendExtension as h,appendPath as g}from"./append.mjs";import{DEFAULT_ASSET_EXTS as _}from"./asset-extensions.mjs";import{correctPath as v,normalizeString as y,normalizeWindowsPath as b,stripStars as x,toAbsolutePath as S,toRelativePath as C,withTrailingSlash as w}from"./correct-path.mjs";import{delimiter as
|
|
1
|
+
import{cwd as e}from"./cwd.mjs";import{ABSOLUTE_PATH_REGEX as t,DRIVE_LETTER_REGEX as n,DRIVE_LETTER_START_REGEX as r,FILE_EXTENSION_REGEX as i,NPM_SCOPED_PACKAGE_REGEX as a,PACKAGE_PATH_REGEX as o,ROOT_FOLDER_REGEX as s,UNC_REGEX as c}from"./regex.mjs";import{formatSlash as l,slash as u}from"./slash.mjs";import{isParentPath as d}from"./is-parent-path.mjs";import{join as f,joinPaths as p}from"./join-paths.mjs";import{append as m,appendExtension as h,appendPath as g}from"./append.mjs";import{DEFAULT_ASSET_EXTS as _}from"./asset-extensions.mjs";import{correctPath as v,normalizeString as y,normalizeWindowsPath as b,stripStars as x,toAbsolutePath as S,toRelativePath as C,withTrailingSlash as w,withoutTrailingSlash as T}from"./correct-path.mjs";import{commonPath as E}from"./common.mjs";import{delimiter as D,posix as O,win32 as k}from"./delimiter.mjs";import{basename as A,dirname as j,extname as M,findFileDotExtension as N,findFileDotExtensionSafe as P,findFileExtension as F,findFileExtensionSafe as I,findFileName as L,findFilePath as R,findFolderName as z,hasFileExtension as B,hasFileName as V,hasFilePath as H,hasFolderName as U,parsePath as W,relative as G,relativePath as K,relativeToCurrentDir as q,renameFile as J,resolve as Y,resolvePath as X,resolvePaths as Z}from"./file-path-fns.mjs";import{isSystemRoot as Q}from"./is-root-dir.mjs";import{replaceExtension as $,replacePath as ee}from"./replace.mjs";import{resolveParentPath as te}from"./resolve-parent-path.mjs";export{t as ABSOLUTE_PATH_REGEX,_ as DEFAULT_ASSET_EXTS,n as DRIVE_LETTER_REGEX,r as DRIVE_LETTER_START_REGEX,i as FILE_EXTENSION_REGEX,a as NPM_SCOPED_PACKAGE_REGEX,o as PACKAGE_PATH_REGEX,s as ROOT_FOLDER_REGEX,c as UNC_REGEX,m as append,h as appendExtension,g as appendPath,A as basename,E as commonPath,v as correctPath,e as cwd,D as delimiter,j as dirname,M as extname,N as findFileDotExtension,P as findFileDotExtensionSafe,F as findFileExtension,I as findFileExtensionSafe,L as findFileName,R as findFilePath,z as findFolderName,l as formatSlash,B as hasFileExtension,V as hasFileName,H as hasFilePath,U as hasFolderName,d as isParentPath,Q as isSystemRoot,f as join,p as joinPaths,y as normalizeString,b as normalizeWindowsPath,W as parsePath,O as posix,G as relative,K as relativePath,q as relativeToCurrentDir,J as renameFile,$ as replaceExtension,ee as replacePath,Y as resolve,te as resolveParentPath,X as resolvePath,Z as resolvePaths,u as slash,x as stripStars,S as toAbsolutePath,C as toRelativePath,k as win32,w as withTrailingSlash,T as withoutTrailingSlash};
|
package/dist/is-parent-path.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./slash.cjs`);function t(t,n){let r=e.slash(t.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase(),i=e.slash(n.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase();return r!==i&&r.startsWith(`${i}/`)}exports.isParentPath=t;
|
|
1
|
+
const e=require(`./slash.cjs`);function t(t,n){let r=e.slash(t.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase(),i=e.slash(n.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase();return t!==n&&r!==i&&r.startsWith(`${i}/`)}exports.isParentPath=t;
|
package/dist/is-parent-path.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{slash as e}from"./slash.mjs";function t(t,n){let r=e(t.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase(),i=e(n.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase();return r!==i&&r.startsWith(`${i}/`)}export{t as isParentPath};
|
|
1
|
+
import{slash as e}from"./slash.mjs";function t(t,n){let r=e(t.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase(),i=e(n.replaceAll(/\\/g,`/`).replace(/\/*$/,``))?.toLowerCase();return t!==n&&r!==i&&r.startsWith(`${i}/`)}export{t as isParentPath};
|
|
2
2
|
//# sourceMappingURL=is-parent-path.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-parent-path.mjs","names":[],"sources":["../src/is-parent-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { slash } from \"./slash\";\n\n/**\n * Check if a given path is a parent of another path.\n *\n * @example\n * ```ts\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src\");\n * // returns true\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project\");\n * // returns true\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/other\");\n * // returns false\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/other\");\n * // returns false\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/index.ts\");\n * // returns false\n * ```\n *\n * @param childPath - The path to check if it is a child of the parent path.\n * @param parentPath - The path to check if it is a parent of the child path.\n * @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.\n */\nexport function isParentPath(childPath: string, parentPath: string): boolean {\n const normalizedChild = slash(\n childPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\")\n )?.toLowerCase();\n const normalizedParent = slash(\n parentPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\")\n )?.toLowerCase();\n\n return (\n normalizedChild !== normalizedParent &&\n normalizedChild.startsWith(`${normalizedParent}/`)\n );\n}\n"],"mappings":"oCAyCA,SAAgB,EAAa,EAAmB,EAA6B,CAC3E,IAAM,EAAkB,EACtB,EAAU,WAAW,MAAO,IAAI,CAAC,QAAQ,OAAQ,GAAG,CACrD,EAAE,aAAa,CACV,EAAmB,EACvB,EAAW,WAAW,MAAO,IAAI,CAAC,QAAQ,OAAQ,GAAG,CACtD,EAAE,aAAa,CAEhB,OACE,IAAoB,GACpB,EAAgB,WAAW,GAAG,EAAiB,GAAG"}
|
|
1
|
+
{"version":3,"file":"is-parent-path.mjs","names":[],"sources":["../src/is-parent-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { slash } from \"./slash\";\n\n/**\n * Check if a given path is a parent of another path.\n *\n * @example\n * ```ts\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src\");\n * // returns true\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project\");\n * // returns true\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/other\");\n * // returns false\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/other\");\n * // returns false\n * isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/index.ts\");\n * // returns false\n * ```\n *\n * @param childPath - The path to check if it is a child of the parent path.\n * @param parentPath - The path to check if it is a parent of the child path.\n * @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.\n */\nexport function isParentPath(childPath: string, parentPath: string): boolean {\n const normalizedChild = slash(\n childPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\")\n )?.toLowerCase();\n const normalizedParent = slash(\n parentPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\")\n )?.toLowerCase();\n\n return (\n childPath !== parentPath &&\n normalizedChild !== normalizedParent &&\n normalizedChild.startsWith(`${normalizedParent}/`)\n );\n}\n"],"mappings":"oCAyCA,SAAgB,EAAa,EAAmB,EAA6B,CAC3E,IAAM,EAAkB,EACtB,EAAU,WAAW,MAAO,IAAI,CAAC,QAAQ,OAAQ,GAAG,CACrD,EAAE,aAAa,CACV,EAAmB,EACvB,EAAW,WAAW,MAAO,IAAI,CAAC,QAAQ,OAAQ,GAAG,CACtD,EAAE,aAAa,CAEhB,OACE,IAAc,GACd,IAAoB,GACpB,EAAgB,WAAW,GAAG,EAAiB,GAAG"}
|
package/dist/normalize.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./correct-path.cjs`);exports.correctPath=e.correctPath,exports.normalizeString=e.normalizeString,exports.normalizeWindowsPath=e.normalizeWindowsPath,exports.stripStars=e.stripStars,exports.toAbsolutePath=e.toAbsolutePath,exports.toRelativePath=e.toRelativePath,exports.withTrailingSlash=e.withTrailingSlash;
|
|
1
|
+
const e=require(`./correct-path.cjs`);exports.correctPath=e.correctPath,exports.normalizeString=e.normalizeString,exports.normalizeWindowsPath=e.normalizeWindowsPath,exports.stripStars=e.stripStars,exports.toAbsolutePath=e.toAbsolutePath,exports.toRelativePath=e.toRelativePath,exports.withTrailingSlash=e.withTrailingSlash,exports.withoutTrailingSlash=e.withoutTrailingSlash;
|
package/dist/normalize.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash } from "./correct-path.cjs";
|
|
2
|
-
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
|
1
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash } from "./correct-path.cjs";
|
|
2
|
+
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash };
|
package/dist/normalize.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash } from "./correct-path.mjs";
|
|
2
|
-
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
|
1
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash } from "./correct-path.mjs";
|
|
2
|
+
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash, withoutTrailingSlash };
|
package/dist/normalize.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{correctPath as e,normalizeString as t,normalizeWindowsPath as n,stripStars as r,toAbsolutePath as i,toRelativePath as a,withTrailingSlash as o}from"./correct-path.mjs";export{e as correctPath,t as normalizeString,n as normalizeWindowsPath,r as stripStars,i as toAbsolutePath,a as toRelativePath,o as withTrailingSlash};
|
|
1
|
+
import{correctPath as e,normalizeString as t,normalizeWindowsPath as n,stripStars as r,toAbsolutePath as i,toRelativePath as a,withTrailingSlash as o,withoutTrailingSlash as s}from"./correct-path.mjs";export{e as correctPath,t as normalizeString,n as normalizeWindowsPath,r as stripStars,i as toAbsolutePath,a as toRelativePath,o as withTrailingSlash,s as withoutTrailingSlash};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/path",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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": {
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"require": "./dist/asset-extensions.cjs",
|
|
22
22
|
"import": "./dist/asset-extensions.mjs"
|
|
23
23
|
},
|
|
24
|
+
"./common": {
|
|
25
|
+
"require": "./dist/common.cjs",
|
|
26
|
+
"import": "./dist/common.mjs"
|
|
27
|
+
},
|
|
24
28
|
"./correct-path": {
|
|
25
29
|
"require": "./dist/correct-path.cjs",
|
|
26
30
|
"import": "./dist/correct-path.mjs"
|
|
@@ -70,12 +74,12 @@
|
|
|
70
74
|
},
|
|
71
75
|
"types": "./dist/index.d.cts",
|
|
72
76
|
"devDependencies": {
|
|
73
|
-
"@storm-software/testing-tools": "^1.119.
|
|
74
|
-
"@stryke/convert": "^0.6.
|
|
75
|
-
"@stryke/type-checks": "^0.5.
|
|
76
|
-
"@stryke/types": "^0.10.
|
|
77
|
+
"@storm-software/testing-tools": "^1.119.72",
|
|
78
|
+
"@stryke/convert": "^0.6.29",
|
|
79
|
+
"@stryke/type-checks": "^0.5.14",
|
|
80
|
+
"@stryke/types": "^0.10.28",
|
|
77
81
|
"tsdown": "^0.17.2"
|
|
78
82
|
},
|
|
79
83
|
"publishConfig": { "access": "public" },
|
|
80
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "91cfc26c66c3042fd25e7c39d65f2a9cc88fb920"
|
|
81
85
|
}
|