@stryke/path 0.24.3 → 0.25.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 CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  # Changelog for Stryke - Path
4
4
 
5
+ ## [0.24.4](https://github.com/storm-software/stryke/releases/tag/path%400.24.4) (01/16/2026)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **path:** Resolve issue with missing slash in `stripStars` result
10
+ ([04b17455](https://github.com/storm-software/stryke/commit/04b17455))
11
+
12
+ ### Updated Dependencies
13
+
14
+ - Updated **type-checks** to **v0.5.18**
15
+ - Updated **convert** to **v0.6.33**
16
+ - Updated **types** to **v0.10.32**
17
+
18
+ ## [0.24.3](https://github.com/storm-software/stryke/releases/tag/path%400.24.3) (01/15/2026)
19
+
20
+ ### Updated Dependencies
21
+
22
+ - Updated **type-checks** to **v0.5.17**
23
+ - Updated **convert** to **v0.6.32**
24
+ - Updated **types** to **v0.10.31**
25
+
5
26
  ## [0.24.2](https://github.com/storm-software/stryke/releases/tag/path%400.24.2) (01/13/2026)
6
27
 
7
28
  ### Updated Dependencies
@@ -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}/`}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;
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.startsWith(`/`)?`/`:``}${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;
@@ -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;AAYjC;;;;;;;;;;;;;;;iBA5JgB,UAAA;;;;;;;;iBA8BA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA;;;;;;;iBAYA,oBAAA"}
1
+ {"version":3,"file":"correct-path.d.cts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AAgCA;AA2EA;AAeA;AAwBgB,iBA5MA,WAAA,CA4MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAYjC;;;;;;;;;;;;;;;iBA9JgB,UAAA;;;;;;;;iBAgCA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA;;;;;;;iBAYA,oBAAA"}
@@ -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;AAYjC;;;;;;;;;;;;;;;iBA5JgB,UAAA;;;;;;;;iBA8BA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA;;;;;;;iBAYA,oBAAA"}
1
+ {"version":3,"file":"correct-path.d.mts","names":[],"sources":["../src/correct-path.ts"],"sourcesContent":[],"mappings":";iBA8BgB,oBAAA;AAAhB;AAcA;AA0DA;AAgCA;AA2EA;AAeA;AAwBgB,iBA5MA,WAAA,CA4MiB,IAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAYjC;;;;;;;;;;;;;;;iBA9JgB,UAAA;;;;;;;;iBAgCA,eAAA;;;;;;;;iBA2EA,cAAA;;;;;;;;iBAeA,cAAA;;;;;;;iBAwBA,iBAAA;;;;;;;iBAYA,oBAAA"}
@@ -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}/`}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};
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.startsWith(`/`)?`/`:``}${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\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":"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"}
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.startsWith(\"/\") ? \"/\" : \"\"}${path\n .split(\"/\")\n .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":"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"}
@@ -0,0 +1 @@
1
+ const e=require(`./type-checks/src/is-set-string.cjs`);function t(t,n={}){if(!e.isSetString(t))throw TypeError(`A string was not provided as a glob pattern.`);let r=String(t),i=``,a=!1,o;for(let e=0,t=r.length;e<t;e++){o=r[e];let t=r[e-1],s=r[e+1],c=1;switch(o){case`/`:case`$`:case`^`:case`+`:case`.`:case`(`:case`)`:case`=`:case`!`:case`|`:i+=`\\${o}`;break;case`?`:n.extended!==!1&&(i+=`.`);break;case`[`:case`]`:n.extended!==!1&&(i+=o);break;case`{`:n.extended!==!1&&(a=!0,i+=`(`);break;case`}`:n.extended!==!1&&(a=!1,i+=`)`);break;case`,`:a&&(i+=`|`),i+=`\\${o}`;break;case`*`:for(c=1;r[e+1]===`*`;)c++,e++;n.globstar===!1?i+=`.*`:c>1&&(t===`/`||t===void 0)&&(s===`/`||s===void 0)?(i+=`((?:[^/]*(?:/|$))*)?`,e++):i+=`([^/]*)`;break;case void 0:default:i+=o}}let s=e.isSetString(n.flags)?n.flags:``;return(!s||!~s.indexOf(`g`))&&(i=`^${i}$`),new RegExp(i,s)}exports.globToRegex=t;
@@ -0,0 +1,50 @@
1
+ //#region src/glob-to-regex.d.ts
2
+ /**
3
+ * Options for the `globToRegex` function.
4
+ */
5
+ interface GlobToRegexOptions {
6
+ /**
7
+ * Enables extended globbing features such as `?`, `+`, `@`, and `!`.
8
+ *
9
+ * @defaultValue true
10
+ */
11
+ extended?: boolean;
12
+ /**
13
+ * Enables globstar support (`**`).
14
+ *
15
+ * @defaultValue true
16
+ */
17
+ globstar?: boolean;
18
+ /**
19
+ * Flags to use for the generated regular expression.
20
+ */
21
+ flags?: string;
22
+ }
23
+ /**
24
+ * Converts a glob pattern to a regular expression.
25
+ *
26
+ * @see https://mergify.com/blog/origin-and-evolution-of-the-globstar
27
+ * @see https://en.wikipedia.org/wiki/Glob_(programming)
28
+ *
29
+ * @remarks
30
+ * This function converts a glob pattern (like `*.{js,ts}` or `**\/src/**`) into a regular expression
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import { globToRegex } from "@stryke/path/glob-to-regex";
35
+ *
36
+ * const test1 = globToRegex("*.{js,ts}");
37
+ * console.log(test1); // Output: /^([^/]*)\.(js|ts)$/
38
+ *
39
+ * const test2 = globToRegex("**\/src/**");
40
+ * console.log(test2); // Output: /^((?:[^/]*(?:\/|$))*)?\/src\/((?:[^/]*(?:\/|$))*)?$/
41
+ * ```
42
+ *
43
+ * @param glob - The glob pattern to convert.
44
+ * @param options - The options for the conversion.
45
+ * @returns The converted regular expression.
46
+ */
47
+ declare function globToRegex(glob: string, options?: GlobToRegexOptions): RegExp;
48
+ //#endregion
49
+ export { GlobToRegexOptions, globToRegex };
50
+ //# sourceMappingURL=glob-to-regex.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob-to-regex.d.cts","names":[],"sources":["../src/glob-to-regex.ts"],"sourcesContent":[],"mappings":";;AAuBA;AA6CA;UA7CiB,kBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6CD,WAAA,yBAEL,qBACR"}
@@ -0,0 +1,50 @@
1
+ //#region src/glob-to-regex.d.ts
2
+ /**
3
+ * Options for the `globToRegex` function.
4
+ */
5
+ interface GlobToRegexOptions {
6
+ /**
7
+ * Enables extended globbing features such as `?`, `+`, `@`, and `!`.
8
+ *
9
+ * @defaultValue true
10
+ */
11
+ extended?: boolean;
12
+ /**
13
+ * Enables globstar support (`**`).
14
+ *
15
+ * @defaultValue true
16
+ */
17
+ globstar?: boolean;
18
+ /**
19
+ * Flags to use for the generated regular expression.
20
+ */
21
+ flags?: string;
22
+ }
23
+ /**
24
+ * Converts a glob pattern to a regular expression.
25
+ *
26
+ * @see https://mergify.com/blog/origin-and-evolution-of-the-globstar
27
+ * @see https://en.wikipedia.org/wiki/Glob_(programming)
28
+ *
29
+ * @remarks
30
+ * This function converts a glob pattern (like `*.{js,ts}` or `**\/src/**`) into a regular expression
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import { globToRegex } from "@stryke/path/glob-to-regex";
35
+ *
36
+ * const test1 = globToRegex("*.{js,ts}");
37
+ * console.log(test1); // Output: /^([^/]*)\.(js|ts)$/
38
+ *
39
+ * const test2 = globToRegex("**\/src/**");
40
+ * console.log(test2); // Output: /^((?:[^/]*(?:\/|$))*)?\/src\/((?:[^/]*(?:\/|$))*)?$/
41
+ * ```
42
+ *
43
+ * @param glob - The glob pattern to convert.
44
+ * @param options - The options for the conversion.
45
+ * @returns The converted regular expression.
46
+ */
47
+ declare function globToRegex(glob: string, options?: GlobToRegexOptions): RegExp;
48
+ //#endregion
49
+ export { GlobToRegexOptions, globToRegex };
50
+ //# sourceMappingURL=glob-to-regex.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob-to-regex.d.mts","names":[],"sources":["../src/glob-to-regex.ts"],"sourcesContent":[],"mappings":";;AAuBA;AA6CA;UA7CiB,kBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6CD,WAAA,yBAEL,qBACR"}
@@ -0,0 +1,2 @@
1
+ import{isSetString as e}from"./type-checks/src/is-set-string.mjs";function t(t,n={}){if(!e(t))throw TypeError(`A string was not provided as a glob pattern.`);let r=String(t),i=``,a=!1,o;for(let e=0,t=r.length;e<t;e++){o=r[e];let t=r[e-1],s=r[e+1],c=1;switch(o){case`/`:case`$`:case`^`:case`+`:case`.`:case`(`:case`)`:case`=`:case`!`:case`|`:i+=`\\${o}`;break;case`?`:n.extended!==!1&&(i+=`.`);break;case`[`:case`]`:n.extended!==!1&&(i+=o);break;case`{`:n.extended!==!1&&(a=!0,i+=`(`);break;case`}`:n.extended!==!1&&(a=!1,i+=`)`);break;case`,`:a&&(i+=`|`),i+=`\\${o}`;break;case`*`:for(c=1;r[e+1]===`*`;)c++,e++;n.globstar===!1?i+=`.*`:c>1&&(t===`/`||t===void 0)&&(s===`/`||s===void 0)?(i+=`((?:[^/]*(?:/|$))*)?`,e++):i+=`([^/]*)`;break;case void 0:default:i+=o}}let s=e(n.flags)?n.flags:``;return(!s||!~s.indexOf(`g`))&&(i=`^${i}$`),new RegExp(i,s)}export{t as globToRegex};
2
+ //# sourceMappingURL=glob-to-regex.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob-to-regex.mjs","names":["char: string | undefined"],"sources":["../src/glob-to-regex.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\n\n/**\n * Options for the `globToRegex` function.\n */\nexport interface GlobToRegexOptions {\n /**\n * Enables extended globbing features such as `?`, `+`, `@`, and `!`.\n *\n * @defaultValue true\n */\n extended?: boolean;\n\n /**\n * Enables globstar support (`**`).\n *\n * @defaultValue true\n */\n globstar?: boolean;\n\n /**\n * Flags to use for the generated regular expression.\n */\n flags?: string;\n}\n\n/**\n * Converts a glob pattern to a regular expression.\n *\n * @see https://mergify.com/blog/origin-and-evolution-of-the-globstar\n * @see https://en.wikipedia.org/wiki/Glob_(programming)\n *\n * @remarks\n * This function converts a glob pattern (like `*.{js,ts}` or `**\\/src/**`) into a regular expression\n *\n * @example\n * ```ts\n * import { globToRegex } from \"@stryke/path/glob-to-regex\";\n *\n * const test1 = globToRegex(\"*.{js,ts}\");\n * console.log(test1); // Output: /^([^/]*)\\.(js|ts)$/\n *\n * const test2 = globToRegex(\"**\\/src/**\");\n * console.log(test2); // Output: /^((?:[^/]*(?:\\/|$))*)?\\/src\\/((?:[^/]*(?:\\/|$))*)?$/\n * ```\n *\n * @param glob - The glob pattern to convert.\n * @param options - The options for the conversion.\n * @returns The converted regular expression.\n */\nexport function globToRegex(\n glob: string,\n options: GlobToRegexOptions = {}\n): RegExp {\n if (!isSetString(glob)) {\n throw new TypeError(\"A string was not provided as a glob pattern.\");\n }\n\n const str = String(glob);\n let regex = \"\";\n\n let inGroup = false;\n let char: string | undefined;\n for (let i = 0, len = str.length; i < len; i++) {\n char = str[i];\n\n const prevChar = str[i - 1];\n const nextChar = str[i + 1];\n let starCount = 1;\n\n switch (char) {\n case \"/\":\n case \"$\":\n case \"^\":\n case \"+\":\n case \".\":\n case \"(\":\n case \")\":\n case \"=\":\n case \"!\":\n case \"|\":\n regex += `\\\\${char}`;\n break;\n\n case \"?\":\n if (options.extended !== false) {\n regex += \".\";\n }\n break;\n\n case \"[\":\n case \"]\":\n if (options.extended !== false) {\n regex += char;\n }\n break;\n\n case \"{\":\n if (options.extended !== false) {\n inGroup = true;\n regex += \"(\";\n }\n break;\n\n case \"}\":\n if (options.extended !== false) {\n inGroup = false;\n regex += \")\";\n }\n break;\n\n case \",\":\n if (inGroup) {\n regex += \"|\";\n }\n regex += `\\\\${char}`;\n break;\n\n case \"*\":\n starCount = 1;\n while (str[i + 1] === \"*\") {\n starCount++;\n i++;\n }\n\n if (options.globstar === false) {\n regex += \".*\";\n } else {\n const isGlobstar =\n starCount > 1 &&\n (prevChar === \"/\" || prevChar === undefined) &&\n (nextChar === \"/\" || nextChar === undefined);\n\n if (isGlobstar) {\n regex += \"((?:[^/]*(?:\\/|$))*)?\";\n i++;\n } else {\n regex += \"([^/]*)\";\n }\n }\n break;\n\n case undefined:\n default:\n regex += char;\n }\n }\n\n const flags = isSetString(options.flags) ? options.flags : \"\";\n if (!flags || !~flags.indexOf(\"g\")) {\n regex = `^${regex}$`;\n }\n\n return new RegExp(regex, flags);\n}\n"],"mappings":"kEAoEA,SAAgB,EACd,EACA,EAA8B,EAAE,CACxB,CACR,GAAI,CAAC,EAAY,EAAK,CACpB,MAAU,UAAU,+CAA+C,CAGrE,IAAM,EAAM,OAAO,EAAK,CACpB,EAAQ,GAER,EAAU,GACVA,EACJ,IAAK,IAAI,EAAI,EAAG,EAAM,EAAI,OAAQ,EAAI,EAAK,IAAK,CAC9C,EAAO,EAAI,GAEX,IAAM,EAAW,EAAI,EAAI,GACnB,EAAW,EAAI,EAAI,GACrB,EAAY,EAEhB,OAAQ,EAAR,CACE,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACH,GAAS,KAAK,IACd,MAEF,IAAK,IACC,EAAQ,WAAa,KACvB,GAAS,KAEX,MAEF,IAAK,IACL,IAAK,IACC,EAAQ,WAAa,KACvB,GAAS,GAEX,MAEF,IAAK,IACC,EAAQ,WAAa,KACvB,EAAU,GACV,GAAS,KAEX,MAEF,IAAK,IACC,EAAQ,WAAa,KACvB,EAAU,GACV,GAAS,KAEX,MAEF,IAAK,IACC,IACF,GAAS,KAEX,GAAS,KAAK,IACd,MAEF,IAAK,IAEH,IADA,EAAY,EACL,EAAI,EAAI,KAAO,KACpB,IACA,IAGE,EAAQ,WAAa,GACvB,GAAS,KAGP,EAAY,IACX,IAAa,KAAO,IAAa,IAAA,MACjC,IAAa,KAAO,IAAa,IAAA,KAGlC,GAAS,uBACT,KAEA,GAAS,UAGb,MAEF,KAAK,IAAA,GACL,QACE,GAAS,GAIf,IAAM,EAAQ,EAAY,EAAQ,MAAM,CAAG,EAAQ,MAAQ,GAK3D,OAJI,CAAC,GAAS,CAAC,CAAC,EAAM,QAAQ,IAAI,IAChC,EAAQ,IAAI,EAAM,IAGb,IAAI,OAAO,EAAO,EAAM"}
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(`./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;
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(`./glob-to-regex.cjs`),f=require(`./is-root-dir.cjs`),p=require(`./replace.cjs`),m=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.globToRegex=d.globToRegex,exports.hasFileExtension=u.hasFileExtension,exports.hasFileName=u.hasFileName,exports.hasFilePath=u.hasFilePath,exports.hasFolderName=u.hasFolderName,exports.isParentPath=r.isParentPath,exports.isSystemRoot=f.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=p.replaceExtension,exports.replacePath=p.replacePath,exports.resolve=u.resolve,exports.resolveParentPath=m.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
@@ -5,6 +5,7 @@ import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsol
5
5
  import { cwd } from "./cwd.cjs";
6
6
  import { delimiter, posix, win32 } from "./delimiter.cjs";
7
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";
8
+ import { GlobToRegexOptions, globToRegex } from "./glob-to-regex.cjs";
8
9
  import { isParentPath } from "./is-parent-path.cjs";
9
10
  import { isSystemRoot } from "./is-root-dir.cjs";
10
11
  import { join, joinPaths } from "./join-paths.cjs";
@@ -12,4 +13,4 @@ import { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE
12
13
  import { replaceExtension, replacePath } from "./replace.cjs";
13
14
  import { resolveParentPath } from "./resolve-parent-path.cjs";
14
15
  import { formatSlash, slash } from "./slash.cjs";
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 };
16
+ export { ABSOLUTE_PATH_REGEX, AppendPathOptions, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, GlobToRegexOptions, 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, globToRegex, 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
@@ -5,6 +5,7 @@ import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsol
5
5
  import { cwd } from "./cwd.mjs";
6
6
  import { delimiter, posix, win32 } from "./delimiter.mjs";
7
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";
8
+ import { GlobToRegexOptions, globToRegex } from "./glob-to-regex.mjs";
8
9
  import { isParentPath } from "./is-parent-path.mjs";
9
10
  import { isSystemRoot } from "./is-root-dir.mjs";
10
11
  import { join, joinPaths } from "./join-paths.mjs";
@@ -12,4 +13,4 @@ import { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE
12
13
  import { replaceExtension, replacePath } from "./replace.mjs";
13
14
  import { resolveParentPath } from "./resolve-parent-path.mjs";
14
15
  import { formatSlash, slash } from "./slash.mjs";
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 };
16
+ export { ABSOLUTE_PATH_REGEX, AppendPathOptions, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, GlobToRegexOptions, 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, globToRegex, 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,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};
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{globToRegex as Q}from"./glob-to-regex.mjs";import{isSystemRoot as $}from"./is-root-dir.mjs";import{replaceExtension as ee,replacePath as te}from"./replace.mjs";import{resolveParentPath as ne}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,Q as globToRegex,B as hasFileExtension,V as hasFileName,H as hasFilePath,U as hasFolderName,d as isParentPath,$ 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,ee as replaceExtension,te as replacePath,Y as resolve,ne 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/path",
3
- "version": "0.24.3",
3
+ "version": "0.25.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": {
@@ -39,6 +39,10 @@
39
39
  "import": "./dist/file-path-fns.mjs"
40
40
  },
41
41
  "./find": { "require": "./dist/find.cjs", "import": "./dist/find.mjs" },
42
+ "./glob-to-regex": {
43
+ "require": "./dist/glob-to-regex.cjs",
44
+ "import": "./dist/glob-to-regex.mjs"
45
+ },
42
46
  "./is-parent-path": {
43
47
  "require": "./dist/is-parent-path.cjs",
44
48
  "import": "./dist/is-parent-path.mjs"
@@ -75,11 +79,11 @@
75
79
  "types": "./dist/index.d.cts",
76
80
  "devDependencies": {
77
81
  "@storm-software/testing-tools": "^1.119.74",
78
- "@stryke/convert": "^0.6.32",
79
- "@stryke/type-checks": "^0.5.17",
80
- "@stryke/types": "^0.10.31",
82
+ "@stryke/convert": "^0.6.33",
83
+ "@stryke/type-checks": "^0.5.18",
84
+ "@stryke/types": "^0.10.32",
81
85
  "tsdown": "^0.17.2"
82
86
  },
83
87
  "publishConfig": { "access": "public" },
84
- "gitHead": "ea722ff737bfe75d31084e879303a61fc748758e"
88
+ "gitHead": "d7628ea6fec405e8ba9926647a055820bbc4ee87"
85
89
  }