@stryke/path 0.22.11 → 0.22.13
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 +16 -0
- package/dist/append.cjs +1 -1
- package/dist/append.d.cts +38 -2
- package/dist/append.d.cts.map +1 -0
- package/dist/append.d.mts +38 -2
- package/dist/append.d.mts.map +1 -0
- package/dist/append.mjs +2 -1
- package/dist/append.mjs.map +1 -0
- package/dist/asset-extensions.cjs +1 -1
- package/dist/asset-extensions.d.cts +11 -2
- package/dist/asset-extensions.d.cts.map +1 -0
- package/dist/asset-extensions.d.mts +11 -2
- package/dist/asset-extensions.d.mts.map +1 -0
- package/dist/asset-extensions.mjs +2 -1
- package/dist/asset-extensions.mjs.map +1 -0
- package/dist/correct-path.cjs +1 -1
- package/dist/correct-path.d.cts +59 -2
- package/dist/correct-path.d.cts.map +1 -0
- package/dist/correct-path.d.mts +59 -2
- package/dist/correct-path.d.mts.map +1 -0
- package/dist/correct-path.mjs +2 -1
- package/dist/correct-path.mjs.map +1 -0
- package/dist/cwd.cjs +1 -1
- package/dist/cwd.d.cts +13 -2
- package/dist/cwd.d.cts.map +1 -0
- package/dist/cwd.d.mts +13 -2
- package/dist/cwd.d.mts.map +1 -0
- package/dist/cwd.mjs +2 -1
- package/dist/cwd.mjs.map +1 -0
- package/dist/delimiter.cjs +1 -1
- package/dist/delimiter.d.cts +22 -2
- package/dist/delimiter.d.cts.map +1 -0
- package/dist/delimiter.d.mts +22 -2
- package/dist/delimiter.d.mts.map +1 -0
- package/dist/delimiter.mjs +2 -1
- package/dist/delimiter.mjs.map +1 -0
- package/dist/file-path-fns.cjs +1 -1
- package/dist/file-path-fns.d.cts +218 -2
- package/dist/file-path-fns.d.cts.map +1 -0
- package/dist/file-path-fns.d.mts +218 -2
- package/dist/file-path-fns.d.mts.map +1 -0
- package/dist/file-path-fns.mjs +2 -1
- package/dist/file-path-fns.mjs.map +1 -0
- package/dist/find.cjs +1 -1
- package/dist/find.d.cts +1 -1
- package/dist/find.d.mts +1 -1
- package/dist/find.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.mts +13 -13
- package/dist/index.mjs +1 -1
- package/dist/is-parent-path.cjs +1 -1
- package/dist/is-parent-path.d.cts +26 -2
- package/dist/is-parent-path.d.cts.map +1 -0
- package/dist/is-parent-path.d.mts +26 -2
- package/dist/is-parent-path.d.mts.map +1 -0
- package/dist/is-parent-path.mjs +2 -1
- package/dist/is-parent-path.mjs.map +1 -0
- package/dist/is-root-dir.cjs +1 -1
- package/dist/is-root-dir.d.cts +11 -2
- package/dist/is-root-dir.d.cts.map +1 -0
- package/dist/is-root-dir.d.mts +11 -2
- package/dist/is-root-dir.d.mts.map +1 -0
- package/dist/is-root-dir.mjs +2 -1
- package/dist/is-root-dir.mjs.map +1 -0
- package/dist/is-type.cjs +1 -1
- package/dist/is-type.mjs +2 -1
- package/dist/is-type.mjs.map +1 -0
- package/dist/join-paths.cjs +1 -1
- package/dist/join-paths.d.cts +13 -2
- package/dist/join-paths.d.cts.map +1 -0
- package/dist/join-paths.d.mts +13 -2
- package/dist/join-paths.d.mts.map +1 -0
- package/dist/join-paths.mjs +2 -1
- package/dist/join-paths.mjs.map +1 -0
- package/dist/join.cjs +1 -1
- package/dist/join.d.cts +1 -1
- package/dist/join.d.mts +1 -1
- package/dist/join.mjs +1 -1
- package/dist/normalize.cjs +1 -1
- package/dist/normalize.d.cts +1 -1
- package/dist/normalize.d.mts +1 -1
- package/dist/normalize.mjs +1 -1
- package/dist/regex.cjs +1 -1
- package/dist/regex.d.cts +12 -2
- package/dist/regex.d.cts.map +1 -0
- package/dist/regex.d.mts +12 -2
- package/dist/regex.d.mts.map +1 -0
- package/dist/regex.mjs +2 -1
- package/dist/regex.mjs.map +1 -0
- package/dist/replace.cjs +1 -1
- package/dist/replace.d.cts +34 -2
- package/dist/replace.d.cts.map +1 -0
- package/dist/replace.d.mts +34 -2
- package/dist/replace.d.mts.map +1 -0
- package/dist/replace.mjs +2 -1
- package/dist/replace.mjs.map +1 -0
- package/dist/resolve-parent-path.cjs +1 -1
- package/dist/resolve-parent-path.d.cts +12 -2
- package/dist/resolve-parent-path.d.cts.map +1 -0
- package/dist/resolve-parent-path.d.mts +12 -2
- package/dist/resolve-parent-path.d.mts.map +1 -0
- package/dist/resolve-parent-path.mjs +2 -1
- package/dist/resolve-parent-path.mjs.map +1 -0
- package/dist/slash.cjs +1 -1
- package/dist/slash.d.cts +18 -2
- package/dist/slash.d.cts.map +1 -0
- package/dist/slash.d.mts +18 -2
- package/dist/slash.d.mts.map +1 -0
- package/dist/slash.mjs +2 -1
- package/dist/slash.mjs.map +1 -0
- package/dist/type-checks/src/is-empty.cjs +1 -0
- package/dist/type-checks/src/is-empty.mjs +2 -0
- package/dist/type-checks/src/is-empty.mjs.map +1 -0
- package/dist/type-checks/src/is-null.cjs +1 -0
- package/dist/type-checks/src/is-null.mjs +2 -0
- package/dist/type-checks/src/is-null.mjs.map +1 -0
- package/dist/type-checks/src/is-set-string.cjs +1 -0
- package/dist/type-checks/src/is-set-string.mjs +2 -0
- package/dist/type-checks/src/is-set-string.mjs.map +1 -0
- package/dist/type-checks/src/is-set.cjs +1 -0
- package/dist/type-checks/src/is-set.mjs +2 -0
- package/dist/type-checks/src/is-set.mjs.map +1 -0
- package/dist/type-checks/src/is-string.cjs +1 -0
- package/dist/type-checks/src/is-string.mjs +2 -0
- package/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/type-checks/src/is-undefined.cjs +1 -0
- package/dist/type-checks/src/is-undefined.mjs +2 -0
- package/dist/type-checks/src/is-undefined.mjs.map +1 -0
- package/dist/types/src/base.cjs +1 -0
- package/dist/types/src/base.mjs +2 -0
- package/dist/types/src/base.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/append-BWRdnlxE.cjs +0 -1
- package/dist/append-DfRQvWY6.d.cts +0 -38
- package/dist/append-DfRQvWY6.d.cts.map +0 -1
- package/dist/append-tFFvRN-V.d.mts +0 -38
- package/dist/append-tFFvRN-V.d.mts.map +0 -1
- package/dist/append-xQ5toDGS.mjs +0 -2
- package/dist/append-xQ5toDGS.mjs.map +0 -1
- package/dist/asset-extensions-BFW_s97B.mjs +0 -2
- package/dist/asset-extensions-BFW_s97B.mjs.map +0 -1
- package/dist/asset-extensions-D-_39huh.d.cts +0 -11
- package/dist/asset-extensions-D-_39huh.d.cts.map +0 -1
- package/dist/asset-extensions-DNMkK37t.cjs +0 -1
- package/dist/asset-extensions-DlN384ac.d.mts +0 -11
- package/dist/asset-extensions-DlN384ac.d.mts.map +0 -1
- package/dist/correct-path-B0Y_kOkW.cjs +0 -1
- package/dist/correct-path-CwHhpk6I.d.cts +0 -59
- package/dist/correct-path-CwHhpk6I.d.cts.map +0 -1
- package/dist/correct-path-DmaZHNUF.mjs +0 -2
- package/dist/correct-path-DmaZHNUF.mjs.map +0 -1
- package/dist/correct-path-LC5QqYV-.d.mts +0 -59
- package/dist/correct-path-LC5QqYV-.d.mts.map +0 -1
- package/dist/cwd-Bt4NcS-v.d.cts +0 -13
- package/dist/cwd-Bt4NcS-v.d.cts.map +0 -1
- package/dist/cwd-D66SsPHE.cjs +0 -1
- package/dist/cwd-Dx53cgUn.d.mts +0 -13
- package/dist/cwd-Dx53cgUn.d.mts.map +0 -1
- package/dist/cwd-DxrPG9WB.mjs +0 -2
- package/dist/cwd-DxrPG9WB.mjs.map +0 -1
- package/dist/delimiter-B3nWo9Xn.mjs +0 -2
- package/dist/delimiter-B3nWo9Xn.mjs.map +0 -1
- package/dist/delimiter-BwyCEwu9.d.cts +0 -22
- package/dist/delimiter-BwyCEwu9.d.cts.map +0 -1
- package/dist/delimiter-DuDX7fvN.d.mts +0 -22
- package/dist/delimiter-DuDX7fvN.d.mts.map +0 -1
- package/dist/delimiter-IA9U4fxC.cjs +0 -1
- package/dist/file-path-fns-B9hKjfA-.cjs +0 -1
- package/dist/file-path-fns-BKbfZRTB.d.mts +0 -218
- package/dist/file-path-fns-BKbfZRTB.d.mts.map +0 -1
- package/dist/file-path-fns-CTLJP4j9.d.cts +0 -218
- package/dist/file-path-fns-CTLJP4j9.d.cts.map +0 -1
- package/dist/file-path-fns-MRI3PV8K.mjs +0 -2
- package/dist/file-path-fns-MRI3PV8K.mjs.map +0 -1
- package/dist/is-parent-path-B1EPPZ08.d.cts +0 -26
- package/dist/is-parent-path-B1EPPZ08.d.cts.map +0 -1
- package/dist/is-parent-path-BW6CsB2o.d.mts +0 -26
- package/dist/is-parent-path-BW6CsB2o.d.mts.map +0 -1
- package/dist/is-parent-path-C0Azmjnd.mjs +0 -2
- package/dist/is-parent-path-C0Azmjnd.mjs.map +0 -1
- package/dist/is-parent-path-ChIi6oAO.cjs +0 -1
- package/dist/is-root-dir-BzQKuwi2.cjs +0 -1
- package/dist/is-root-dir-CQA1qNI-.d.mts +0 -11
- package/dist/is-root-dir-CQA1qNI-.d.mts.map +0 -1
- package/dist/is-root-dir-DI5qcnLw.mjs +0 -2
- package/dist/is-root-dir-DI5qcnLw.mjs.map +0 -1
- package/dist/is-root-dir-DnWZlIgB.d.cts +0 -11
- package/dist/is-root-dir-DnWZlIgB.d.cts.map +0 -1
- package/dist/join-paths-BLjJ0GmK.mjs +0 -2
- package/dist/join-paths-BLjJ0GmK.mjs.map +0 -1
- package/dist/join-paths-Bklwf_Bh.d.mts +0 -13
- package/dist/join-paths-Bklwf_Bh.d.mts.map +0 -1
- package/dist/join-paths-DBTcCEw0.d.cts +0 -13
- package/dist/join-paths-DBTcCEw0.d.cts.map +0 -1
- package/dist/join-paths-hCBPtGlC.cjs +0 -1
- package/dist/regex-BEjSq2wo.cjs +0 -1
- package/dist/regex-DHvK8l1E.d.cts +0 -12
- package/dist/regex-DHvK8l1E.d.cts.map +0 -1
- package/dist/regex-fq9t8ABF.d.mts +0 -12
- package/dist/regex-fq9t8ABF.d.mts.map +0 -1
- package/dist/regex-hMUNHeGK.mjs +0 -2
- package/dist/regex-hMUNHeGK.mjs.map +0 -1
- package/dist/replace-0nP9MPWp.d.cts +0 -34
- package/dist/replace-0nP9MPWp.d.cts.map +0 -1
- package/dist/replace-C570sho0.cjs +0 -1
- package/dist/replace-C9dh7bEG.mjs +0 -2
- package/dist/replace-C9dh7bEG.mjs.map +0 -1
- package/dist/replace-fEEM12P3.d.mts +0 -34
- package/dist/replace-fEEM12P3.d.mts.map +0 -1
- package/dist/resolve-parent-path-5B4YvR_k.mjs +0 -2
- package/dist/resolve-parent-path-5B4YvR_k.mjs.map +0 -1
- package/dist/resolve-parent-path-D5uwbjqj.d.mts +0 -12
- package/dist/resolve-parent-path-D5uwbjqj.d.mts.map +0 -1
- package/dist/resolve-parent-path-DIrSH2oN.cjs +0 -1
- package/dist/resolve-parent-path-oZQZf2nw.d.cts +0 -12
- package/dist/resolve-parent-path-oZQZf2nw.d.cts.map +0 -1
- package/dist/slash-C7xRDucF.mjs +0 -2
- package/dist/slash-C7xRDucF.mjs.map +0 -1
- package/dist/slash-CuA7ERRf.d.mts +0 -18
- package/dist/slash-CuA7ERRf.d.mts.map +0 -1
- package/dist/slash-DPd6cWOz.d.cts +0 -18
- package/dist/slash-DPd6cWOz.d.cts.map +0 -1
- package/dist/slash-DhzW1Om-.cjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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 T,posix as E,win32 as D}from"./delimiter.mjs";import{basename as O,dirname as k,extname as A,findFileDotExtension as j,findFileDotExtensionSafe as M,findFileExtension as N,findFileExtensionSafe as P,findFileName as F,findFilePath as I,findFolderName as L,hasFileExtension as R,hasFileName as z,hasFilePath as B,hasFolderName as V,parsePath as H,relative as U,relativePath as W,relativeToCurrentDir as G,renameFile as K,resolve as q,resolvePath as J,resolvePaths as Y}from"./file-path-fns.mjs";import{isSystemRoot as X}from"./is-root-dir.mjs";import{replaceExtension as Z,replacePath as Q}from"./replace.mjs";import{resolveParentPath as $}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,O as basename,v as correctPath,e as cwd,T as delimiter,k as dirname,A as extname,j as findFileDotExtension,M as findFileDotExtensionSafe,N as findFileExtension,P as findFileExtensionSafe,F as findFileName,I as findFilePath,L as findFolderName,l as formatSlash,R as hasFileExtension,z as hasFileName,B as hasFilePath,V as hasFolderName,d as isParentPath,X as isSystemRoot,f as join,p as joinPaths,y as normalizeString,b as normalizeWindowsPath,H as parsePath,E as posix,U as relative,W as relativePath,G as relativeToCurrentDir,K as renameFile,Z as replaceExtension,Q as replacePath,q as resolve,$ as resolveParentPath,J as resolvePath,Y as resolvePaths,u as slash,x as stripStars,S as toAbsolutePath,C as toRelativePath,D as win32,w as withTrailingSlash};
|
package/dist/is-parent-path.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./slash.cjs`);function t(t,n){let r=e.slash(t.replace(/\\/g,`/`).replace(/\/$/,``)),i=e.slash(n.replace(/\\/g,`/`).replace(/\/$/,``));return r!==i&&r.startsWith(`${i}/`)}exports.isParentPath=t;
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/is-parent-path.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if a given path is a parent of another path.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
|
|
8
|
+
* // returns true
|
|
9
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project");
|
|
10
|
+
* // returns true
|
|
11
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
|
|
12
|
+
* // returns false
|
|
13
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/other");
|
|
14
|
+
* // returns false
|
|
15
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
|
|
16
|
+
* // returns false
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param childPath - The path to check if it is a child of the parent path.
|
|
20
|
+
* @param parentPath - The path to check if it is a parent of the child path.
|
|
21
|
+
* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
|
|
22
|
+
*/
|
|
23
|
+
declare function isParentPath(childPath: string, parentPath: string): boolean;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { isParentPath };
|
|
26
|
+
//# sourceMappingURL=is-parent-path.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-parent-path.d.cts","names":[],"sources":["../src/is-parent-path.ts"],"sourcesContent":[],"mappings":";;AAyCA;;;;;;;;;;;;;;;;;;;;iBAAgB,YAAA"}
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/is-parent-path.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if a given path is a parent of another path.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
|
|
8
|
+
* // returns true
|
|
9
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project");
|
|
10
|
+
* // returns true
|
|
11
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
|
|
12
|
+
* // returns false
|
|
13
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/other");
|
|
14
|
+
* // returns false
|
|
15
|
+
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
|
|
16
|
+
* // returns false
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param childPath - The path to check if it is a child of the parent path.
|
|
20
|
+
* @param parentPath - The path to check if it is a parent of the child path.
|
|
21
|
+
* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
|
|
22
|
+
*/
|
|
23
|
+
declare function isParentPath(childPath: string, parentPath: string): boolean;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { isParentPath };
|
|
26
|
+
//# sourceMappingURL=is-parent-path.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-parent-path.d.mts","names":[],"sources":["../src/is-parent-path.ts"],"sourcesContent":[],"mappings":";;AAyCA;;;;;;;;;;;;;;;;;;;;iBAAgB,YAAA"}
|
package/dist/is-parent-path.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{slash as e}from"./slash.mjs";function t(t,n){let r=e(t.replace(/\\/g,`/`).replace(/\/$/,``)),i=e(n.replace(/\\/g,`/`).replace(/\/$/,``));return r!==i&&r.startsWith(`${i}/`)}export{t as isParentPath};
|
|
2
|
+
//# sourceMappingURL=is-parent-path.mjs.map
|
|
@@ -0,0 +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.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\")\n );\n const normalizedParent = slash(\n parentPath.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\")\n );\n\n return (\n normalizedChild !== normalizedParent &&\n normalizedChild.startsWith(`${normalizedParent}/`)\n );\n}\n"],"mappings":"oCAyCA,SAAgB,EAAa,EAAmB,EAA6B,CAC3E,IAAM,EAAkB,EACtB,EAAU,QAAQ,MAAO,IAAI,CAAC,QAAQ,MAAO,GAAG,CACjD,CACK,EAAmB,EACvB,EAAW,QAAQ,MAAO,IAAI,CAAC,QAAQ,MAAO,GAAG,CAClD,CAED,OACE,IAAoB,GACpB,EAAgB,WAAW,GAAG,EAAiB,GAAG"}
|
package/dist/is-root-dir.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){return e===`/`||e===`c:\\`||e===`C:\\`}exports.isSystemRoot=e;
|
package/dist/is-root-dir.d.cts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/is-root-dir.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if the directory is the current system's root directory.
|
|
4
|
+
*
|
|
5
|
+
* @param dir - The directory to check.
|
|
6
|
+
* @returns Returns true if the directory is the root directory.
|
|
7
|
+
*/
|
|
8
|
+
declare function isSystemRoot(dir: string): boolean;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isSystemRoot };
|
|
11
|
+
//# sourceMappingURL=is-root-dir.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-root-dir.d.cts","names":[],"sources":["../src/is-root-dir.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;iBAAgB,YAAA"}
|
package/dist/is-root-dir.d.mts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/is-root-dir.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if the directory is the current system's root directory.
|
|
4
|
+
*
|
|
5
|
+
* @param dir - The directory to check.
|
|
6
|
+
* @returns Returns true if the directory is the root directory.
|
|
7
|
+
*/
|
|
8
|
+
declare function isSystemRoot(dir: string): boolean;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isSystemRoot };
|
|
11
|
+
//# sourceMappingURL=is-root-dir.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-root-dir.d.mts","names":[],"sources":["../src/is-root-dir.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;iBAAgB,YAAA"}
|
package/dist/is-root-dir.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){return e===`/`||e===`c:\\`||e===`C:\\`}export{e as isSystemRoot};
|
|
2
|
+
//# sourceMappingURL=is-root-dir.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-root-dir.mjs","names":[],"sources":["../src/is-root-dir.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\n/**\n * Check if the directory is the current system's root directory.\n *\n * @param dir - The directory to check.\n * @returns Returns true if the directory is the root directory.\n */\nexport function isSystemRoot(dir: string): boolean {\n return Boolean(dir === \"/\" || dir === \"c:\\\\\" || dir === \"C:\\\\\");\n}\n"],"mappings":"AAwBA,SAAgB,EAAa,EAAsB,CACjD,OAAe,IAAQ,KAAO,IAAQ,QAAU,IAAQ"}
|
package/dist/is-type.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./slash
|
|
1
|
+
const e=require(`./regex.cjs`),t=require(`./slash.cjs`);function n(n){return e.ABSOLUTE_PATH_REGEX.test(t.slash(n))}function r(e){return n(e)}function i(e){return!n(e)}function a(e){return i(e)}function o(n){return e.NPM_SCOPED_PACKAGE_REGEX.test(t.slash(n))}function s(e){return o(e)}exports.isAbsolute=r,exports.isAbsolutePath=n,exports.isNpmScopedPackage=s,exports.isNpmScopedPackagePath=o,exports.isRelative=a,exports.isRelativePath=i;
|
package/dist/is-type.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ABSOLUTE_PATH_REGEX as e,NPM_SCOPED_PACKAGE_REGEX as t}from"./regex.mjs";import{slash as n}from"./slash.mjs";function r(t){return e.test(n(t))}function i(e){return r(e)}function a(e){return!r(e)}function o(e){return a(e)}function s(e){return t.test(n(e))}function c(e){return s(e)}export{i as isAbsolute,r as isAbsolutePath,c as isNpmScopedPackage,s as isNpmScopedPackagePath,o as isRelative,a as isRelativePath};
|
|
2
|
+
//# sourceMappingURL=is-type.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-type.mjs","names":[],"sources":["../src/is-type.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 { ABSOLUTE_PATH_REGEX, NPM_SCOPED_PACKAGE_REGEX } from \"./regex\";\nimport { slash } from \"./slash\";\n\n/**\n * Check if the path is an absolute path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolutePath(path: string): boolean {\n return ABSOLUTE_PATH_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is an absolute path.\n *\n * @remarks\n * This is an alias for {@link isAbsolutePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is an absolute path\n */\nexport function isAbsolute(path: string): boolean {\n return isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelativePath(path: string): boolean {\n return !isAbsolutePath(path);\n}\n\n/**\n * Check if the path is a relative path.\n *\n * @remarks\n * This is an alias for {@link isRelativePath}.\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a relative path\n */\nexport function isRelative(path: string): boolean {\n return isRelativePath(path);\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackage}.\n *\n * @example\n * ```ts\n * isNpmScopedPackage(\"@stryke/path\"); // returns true\n * isNpmScopedPackage(\"lodash\"); // returns false\n * isNpmNamespacePackage(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackagePath(path: string): boolean {\n return NPM_SCOPED_PACKAGE_REGEX.test(slash(path));\n}\n\n/**\n * Check if the path is a npm package path.\n *\n * @remarks\n * This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackagePath}.\n *\n * @example\n * ```ts\n * isNpmScopedPackagePath(\"@stryke/path\"); // returns true\n * isNpmScopedPackagePath(\"lodash\"); // returns false\n * isNpmScopedPackagePath(\"./src/index.ts\"); // returns false\n * ```\n *\n * @param path - The path to check\n * @returns An indicator specifying if the path is a npm package path\n */\nexport function isNpmScopedPackage(path: string): boolean {\n return isNpmScopedPackagePath(path);\n}\n"],"mappings":"oHA2BA,SAAgB,EAAe,EAAuB,CACpD,OAAO,EAAoB,KAAK,EAAM,EAAK,CAAC,CAY9C,SAAgB,EAAW,EAAuB,CAChD,OAAO,EAAe,EAAK,CAS7B,SAAgB,EAAe,EAAuB,CACpD,MAAO,CAAC,EAAe,EAAK,CAY9B,SAAgB,EAAW,EAAuB,CAChD,OAAO,EAAe,EAAK,CAmB7B,SAAgB,EAAuB,EAAuB,CAC5D,OAAO,EAAyB,KAAK,EAAM,EAAK,CAAC,CAmBnD,SAAgB,EAAmB,EAAuB,CACxD,OAAO,EAAuB,EAAK"}
|
package/dist/join-paths.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./regex.cjs`),t=require(`./is-type.cjs`);function n(t=``){return t&&t.replace(/\\/g,`/`).replace(e.DRIVE_LETTER_START_REGEX,e=>e.toUpperCase())}function r(r){if(!r||r.length===0)return`.`;r=n(r);let i=r.match(e.UNC_REGEX),a=t.isAbsolute(r),s=r[r.length-1]===`/`;return r=o(r,!a),r.length===0?a?`/`:s?`./`:`.`:(s&&(r+=`/`),e.DRIVE_LETTER_REGEX.test(r)&&(r+=`/`),i?a?`//${r}`:`//./${r}`:a&&!t.isAbsolute(r)?`/${r}`:r)}function i(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return r(t)}const a=i;function o(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}exports.join=a,exports.joinPaths=i;
|
package/dist/join-paths.d.cts
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/join-paths.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Joins all given path segments together using the platform-specific separator as a delimiter.
|
|
4
|
+
* The resulting path is normalized to remove any redundant or unnecessary segments.
|
|
5
|
+
*
|
|
6
|
+
* @param segments - The path segments to join.
|
|
7
|
+
* @returns The joined and normalized path string.
|
|
8
|
+
*/
|
|
9
|
+
declare function joinPaths(...segments: string[]): string;
|
|
10
|
+
declare const join: typeof joinPaths;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { join, joinPaths };
|
|
13
|
+
//# sourceMappingURL=join-paths.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-paths.d.cts","names":[],"sources":["../src/join-paths.ts"],"sourcesContent":[],"mappings":";;AAgFA;AAwBA;;;;;iBAxBgB,SAAA;cAwBH,aAAI"}
|
package/dist/join-paths.d.mts
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/join-paths.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Joins all given path segments together using the platform-specific separator as a delimiter.
|
|
4
|
+
* The resulting path is normalized to remove any redundant or unnecessary segments.
|
|
5
|
+
*
|
|
6
|
+
* @param segments - The path segments to join.
|
|
7
|
+
* @returns The joined and normalized path string.
|
|
8
|
+
*/
|
|
9
|
+
declare function joinPaths(...segments: string[]): string;
|
|
10
|
+
declare const join: typeof joinPaths;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { join, joinPaths };
|
|
13
|
+
//# sourceMappingURL=join-paths.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-paths.d.mts","names":[],"sources":["../src/join-paths.ts"],"sourcesContent":[],"mappings":";;AAgFA;AAwBA;;;;;iBAxBgB,SAAA;cAwBH,aAAI"}
|
package/dist/join-paths.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{DRIVE_LETTER_REGEX as e,DRIVE_LETTER_START_REGEX as t,UNC_REGEX as n}from"./regex.mjs";import{isAbsolute as r}from"./is-type.mjs";function i(e=``){return e&&e.replace(/\\/g,`/`).replace(t,e=>e.toUpperCase())}function a(t){if(!t||t.length===0)return`.`;t=i(t);let a=t.match(n),o=r(t),s=t[t.length-1]===`/`;return t=c(t,!o),t.length===0?o?`/`:s?`./`:`.`:(s&&(t+=`/`),e.test(t)&&(t+=`/`),a?o?`//${t}`:`//./${t}`:o&&!r(t)?`/${t}`:t)}function o(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return a(t)}const s=o;function c(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}export{s as join,o as joinPaths};
|
|
2
|
+
//# sourceMappingURL=join-paths.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-paths.mjs","names":["char: string | null"],"sources":["../src/join-paths.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 { isAbsolute } from \"./is-type\";\nimport {\n DRIVE_LETTER_REGEX,\n DRIVE_LETTER_START_REGEX,\n UNC_REGEX\n} from \"./regex\";\n\n// Util to normalize windows paths to posix\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input\n .replace(/\\\\/g, \"/\")\n .replace(DRIVE_LETTER_START_REGEX, r => r.toUpperCase());\n}\n\nfunction correctPaths(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 = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\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 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 isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n\n/**\n * Joins all given path segments together using the platform-specific separator as a delimiter.\n * The resulting path is normalized to remove any redundant or unnecessary segments.\n *\n * @param segments - The path segments to join.\n * @returns The joined and normalized path string.\n */\nexport function joinPaths(...segments: string[]): string {\n let path = \"\";\n\n for (const seg of segments) {\n if (!seg) {\n continue;\n }\n if (path.length > 0) {\n const pathTrailing = path[path.length - 1] === \"/\";\n const segLeading = seg[0] === \"/\";\n const both = pathTrailing && segLeading;\n if (both) {\n path += seg.slice(1);\n } else {\n path += pathTrailing || segLeading ? seg : `/${seg}`;\n }\n } else {\n path += seg;\n }\n }\n\n return correctPaths(path);\n}\n\nexport const join = joinPaths;\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 normalized path string.\n */\nfunction 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"],"mappings":"yIA0BA,SAAS,EAAqB,EAAQ,GAAI,CAIxC,OAHK,GAGE,EACJ,QAAQ,MAAO,IAAI,CACnB,QAAQ,EAA0B,GAAK,EAAE,aAAa,CAAC,CAG5D,SAAS,EAAa,EAAe,CACnC,GAAI,CAAC,GAAQ,EAAK,SAAW,EAC3B,MAAO,IAIT,EAAO,EAAqB,EAAK,CAEjC,IAAM,EAAY,EAAK,MAAM,EAAU,CACjC,EAAiB,EAAW,EAAK,CACjC,EAAoB,EAAK,EAAK,OAAS,KAAO,IAyBpD,MAtBA,GAAO,EAAgB,EAAM,CAAC,EAAe,CAEzC,EAAK,SAAW,EACd,EACK,IAEF,EAAoB,KAAO,KAEhC,IACF,GAAQ,KAEN,EAAmB,KAAK,EAAK,GAC/B,GAAQ,KAGN,EACG,EAGE,KAAK,IAFH,OAAO,IAKX,GAAkB,CAAC,EAAW,EAAK,CAAG,IAAI,IAAS,GAU5D,SAAgB,EAAU,GAAG,EAA4B,CACvD,IAAI,EAAO,GAEX,IAAK,IAAM,KAAO,EACX,KAGL,GAAI,EAAK,OAAS,EAAG,CACnB,IAAM,EAAe,EAAK,EAAK,OAAS,KAAO,IACzC,EAAa,EAAI,KAAO,IACjB,GAAgB,EAE3B,GAAQ,EAAI,MAAM,EAAE,CAEpB,GAAQ,GAAgB,EAAa,EAAM,IAAI,SAGjD,GAAQ,EAIZ,OAAO,EAAa,EAAK,CAG3B,MAAa,EAAO,EASpB,SAAS,EAAgB,EAAc,EAAyB,CAC9D,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"}
|
package/dist/join.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./join-paths
|
|
1
|
+
const e=require(`./join-paths.cjs`);exports.join=e.join,exports.joinPaths=e.joinPaths;
|
package/dist/join.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join, joinPaths } from "./join-paths.cjs";
|
|
2
2
|
export { join, joinPaths };
|
package/dist/join.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join, joinPaths } from "./join-paths.mjs";
|
|
2
2
|
export { join, joinPaths };
|
package/dist/join.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{join as e,joinPaths as t}from"./join-paths.mjs";export{e as join,t as joinPaths};
|
package/dist/normalize.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./correct-path
|
|
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;
|
package/dist/normalize.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash } from "./correct-path.cjs";
|
|
2
2
|
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
package/dist/normalize.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash } from "./correct-path.mjs";
|
|
2
2
|
export { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash };
|
package/dist/normalize.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
package/dist/regex.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e
|
|
1
|
+
const e=/^[A-Z]:\//i,t=/^[A-Z]:$/i,n=/^[/\\]{2}/,r=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i,i=/^\/([A-Z]:)?$/i,a=/\.[0-9a-z]+$/i,o=/^@\w+\/.*$/,s=/^(?:@[\w-]+\/)?[\w-]+$/;exports.ABSOLUTE_PATH_REGEX=r,exports.DRIVE_LETTER_REGEX=t,exports.DRIVE_LETTER_START_REGEX=e,exports.FILE_EXTENSION_REGEX=a,exports.NPM_SCOPED_PACKAGE_REGEX=s,exports.PACKAGE_PATH_REGEX=o,exports.ROOT_FOLDER_REGEX=i,exports.UNC_REGEX=n;
|
package/dist/regex.d.cts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/regex.d.ts
|
|
2
|
+
declare const DRIVE_LETTER_START_REGEX: RegExp;
|
|
3
|
+
declare const DRIVE_LETTER_REGEX: RegExp;
|
|
4
|
+
declare const UNC_REGEX: RegExp;
|
|
5
|
+
declare const ABSOLUTE_PATH_REGEX: RegExp;
|
|
6
|
+
declare const ROOT_FOLDER_REGEX: RegExp;
|
|
7
|
+
declare const FILE_EXTENSION_REGEX: RegExp;
|
|
8
|
+
declare const PACKAGE_PATH_REGEX: RegExp;
|
|
9
|
+
declare const NPM_SCOPED_PACKAGE_REGEX: RegExp;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX };
|
|
12
|
+
//# sourceMappingURL=regex.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.d.cts","names":[],"sources":["../src/regex.ts"],"sourcesContent":[],"mappings":";cAkBa,0BAAwB;AAAxB,cACA,kBADuC,EACrB,MADM;AACxB,cAEA,SAFgC,EAEvB,MAFS;AAElB,cAEA,mBAFuB,EAEJ,MAFI;AAEvB,cAGA,iBAHmB,EAGF,MAF2B;AAE5C,cAEA,oBAFiB,EAEG,MAFgB;AAEpC,cAEA,kBAFoB,EAEF,MAFoB;AAEtC,cACA,wBADiC,EACT,MADS"}
|
package/dist/regex.d.mts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/regex.d.ts
|
|
2
|
+
declare const DRIVE_LETTER_START_REGEX: RegExp;
|
|
3
|
+
declare const DRIVE_LETTER_REGEX: RegExp;
|
|
4
|
+
declare const UNC_REGEX: RegExp;
|
|
5
|
+
declare const ABSOLUTE_PATH_REGEX: RegExp;
|
|
6
|
+
declare const ROOT_FOLDER_REGEX: RegExp;
|
|
7
|
+
declare const FILE_EXTENSION_REGEX: RegExp;
|
|
8
|
+
declare const PACKAGE_PATH_REGEX: RegExp;
|
|
9
|
+
declare const NPM_SCOPED_PACKAGE_REGEX: RegExp;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX };
|
|
12
|
+
//# sourceMappingURL=regex.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.d.mts","names":[],"sources":["../src/regex.ts"],"sourcesContent":[],"mappings":";cAkBa,0BAAwB;AAAxB,cACA,kBADuC,EACrB,MADM;AACxB,cAEA,SAFgC,EAEvB,MAFS;AAElB,cAEA,mBAFuB,EAEJ,MAFI;AAEvB,cAGA,iBAHmB,EAGF,MAF2B;AAE5C,cAEA,oBAFiB,EAEG,MAFgB;AAEpC,cAEA,kBAFoB,EAEF,MAFoB;AAEtC,cACA,wBADiC,EACT,MADS"}
|
package/dist/regex.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const e=/^[A-Z]:\//i,t=/^[A-Z]:$/i,n=/^[/\\]{2}/,r=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i,i=/^\/([A-Z]:)?$/i,a=/\.[0-9a-z]+$/i,o=/^@\w+\/.*$/,s=/^(?:@[\w-]+\/)?[\w-]+$/;export{r as ABSOLUTE_PATH_REGEX,t as DRIVE_LETTER_REGEX,e as DRIVE_LETTER_START_REGEX,a as FILE_EXTENSION_REGEX,s as NPM_SCOPED_PACKAGE_REGEX,o as PACKAGE_PATH_REGEX,i as ROOT_FOLDER_REGEX,n as UNC_REGEX};
|
|
2
|
+
//# sourceMappingURL=regex.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regex.mjs","names":[],"sources":["../src/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\nexport const DRIVE_LETTER_START_REGEX = /^[A-Z]:\\//i;\nexport const DRIVE_LETTER_REGEX = /^[A-Z]:$/i;\n\nexport const UNC_REGEX = /^[/\\\\]{2}/;\n\nexport const ABSOLUTE_PATH_REGEX =\n /^[/\\\\](?![/\\\\])|^[/\\\\]{2}(?!\\.)|^~[/\\\\]|^[A-Z]:[/\\\\]/i;\n\nexport const ROOT_FOLDER_REGEX = /^\\/([A-Z]:)?$/i;\n\nexport const FILE_EXTENSION_REGEX = /\\.[0-9a-z]+$/i;\n\nexport const PACKAGE_PATH_REGEX = /^@\\w+\\/.*$/;\nexport const NPM_SCOPED_PACKAGE_REGEX = /^(?:@[\\w-]+\\/)?[\\w-]+$/;\n"],"mappings":"AAkBA,MAAa,EAA2B,aAC3B,EAAqB,YAErB,EAAY,YAEZ,EACX,wDAEW,EAAoB,iBAEpB,EAAuB,gBAEvB,EAAqB,aACrB,EAA2B"}
|
package/dist/replace.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./cwd.cjs`),t=require(`./slash.cjs`),n=require(`./is-parent-path.cjs`),r=require(`./file-path-fns.cjs`);function i(r,i=e.cwd()){return n.isParentPath(r,i)?t.slash(r).replace(t.slash(i),``).replace(/^\//,``):r}function a(e,t=``){return e.replace(!t||t.includes(`.`)?r.findFileDotExtensionSafe(e):r.findFileExtensionSafe(e),t)}exports.replaceExtension=a,exports.replacePath=i;
|
package/dist/replace.d.cts
CHANGED
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/replace.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Replace the base path from the beginning of the given path.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* replacePath("/home/user/project/src/index.ts", "/home/user/project");
|
|
8
|
+
* // returns "src/index.ts"
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @param childPath - The child path to replace the {@link parentPath} substring from
|
|
12
|
+
* @param parentPath - The parent path to remove from the {@link childPath} parameter
|
|
13
|
+
* @returns The {@link childPath} with the {@link parentPath} path removed
|
|
14
|
+
*/
|
|
15
|
+
declare function replacePath(childPath: string, parentPath?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Replace the extension of a given path with the provided value.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* replaceExtension("/home/user/project/src/index.ts", ".js");
|
|
22
|
+
* // returns "/home/user/project/src/index.js"
|
|
23
|
+
* replaceExtension("/home/user/project/src/index.ts");
|
|
24
|
+
* // returns "/home/user/project/src/index"
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param path - The path that will have its current extension replaced
|
|
28
|
+
* @param replacement - The value (or an empty string) to replace the current extension with
|
|
29
|
+
* @returns The path with the replaced extension
|
|
30
|
+
*/
|
|
31
|
+
declare function replaceExtension(path: string, replacement?: string): string;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { replaceExtension, replacePath };
|
|
34
|
+
//# sourceMappingURL=replace.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace.d.cts","names":[],"sources":["../src/replace.ts"],"sourcesContent":[],"mappings":";;AAuCA;AAwBA;;;;;;;;;;;iBAxBgB,WAAA;;;;;;;;;;;;;;;;iBAwBA,gBAAA"}
|
package/dist/replace.d.mts
CHANGED
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/replace.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Replace the base path from the beginning of the given path.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* replacePath("/home/user/project/src/index.ts", "/home/user/project");
|
|
8
|
+
* // returns "src/index.ts"
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @param childPath - The child path to replace the {@link parentPath} substring from
|
|
12
|
+
* @param parentPath - The parent path to remove from the {@link childPath} parameter
|
|
13
|
+
* @returns The {@link childPath} with the {@link parentPath} path removed
|
|
14
|
+
*/
|
|
15
|
+
declare function replacePath(childPath: string, parentPath?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Replace the extension of a given path with the provided value.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* replaceExtension("/home/user/project/src/index.ts", ".js");
|
|
22
|
+
* // returns "/home/user/project/src/index.js"
|
|
23
|
+
* replaceExtension("/home/user/project/src/index.ts");
|
|
24
|
+
* // returns "/home/user/project/src/index"
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @param path - The path that will have its current extension replaced
|
|
28
|
+
* @param replacement - The value (or an empty string) to replace the current extension with
|
|
29
|
+
* @returns The path with the replaced extension
|
|
30
|
+
*/
|
|
31
|
+
declare function replaceExtension(path: string, replacement?: string): string;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { replaceExtension, replacePath };
|
|
34
|
+
//# sourceMappingURL=replace.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace.d.mts","names":[],"sources":["../src/replace.ts"],"sourcesContent":[],"mappings":";;AAuCA;AAwBA;;;;;;;;;;;iBAxBgB,WAAA;;;;;;;;;;;;;;;;iBAwBA,gBAAA"}
|
package/dist/replace.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{cwd as e}from"./cwd.mjs";import{slash as t}from"./slash.mjs";import{isParentPath as n}from"./is-parent-path.mjs";import{findFileDotExtensionSafe as r,findFileExtensionSafe as i}from"./file-path-fns.mjs";function a(r,i=e()){return n(r,i)?t(r).replace(t(i),``).replace(/^\//,``):r}function o(e,t=``){return e.replace(!t||t.includes(`.`)?r(e):i(e),t)}export{o as replaceExtension,a as replacePath};
|
|
2
|
+
//# sourceMappingURL=replace.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace.mjs","names":[],"sources":["../src/replace.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 { cwd } from \"./cwd\";\nimport {\n findFileDotExtensionSafe,\n findFileExtensionSafe\n} from \"./file-path-fns\";\nimport { isParentPath } from \"./is-parent-path\";\nimport { slash } from \"./slash\";\n\n/**\n * Replace the base path from the beginning of the given path.\n *\n * @example\n * ```ts\n * replacePath(\"/home/user/project/src/index.ts\", \"/home/user/project\");\n * // returns \"src/index.ts\"\n * ```\n *\n * @param childPath - The child path to replace the {@link parentPath} substring from\n * @param parentPath - The parent path to remove from the {@link childPath} parameter\n * @returns The {@link childPath} with the {@link parentPath} path removed\n */\nexport function replacePath(\n childPath: string,\n parentPath: string = cwd()\n): string {\n return isParentPath(childPath, parentPath)\n ? slash(childPath).replace(slash(parentPath), \"\").replace(/^\\//, \"\")\n : childPath;\n}\n\n/**\n * Replace the extension of a given path with the provided value.\n *\n * @example\n * ```ts\n * replaceExtension(\"/home/user/project/src/index.ts\", \".js\");\n * // returns \"/home/user/project/src/index.js\"\n * replaceExtension(\"/home/user/project/src/index.ts\");\n * // returns \"/home/user/project/src/index\"\n * ```\n *\n * @param path - The path that will have its current extension replaced\n * @param replacement - The value (or an empty string) to replace the current extension with\n * @returns The path with the replaced extension\n */\nexport function replaceExtension(path: string, replacement = \"\"): string {\n return path.replace(\n !replacement || replacement.includes(\".\")\n ? findFileDotExtensionSafe(path)\n : findFileExtensionSafe(path),\n replacement\n );\n}\n"],"mappings":"kNAuCA,SAAgB,EACd,EACA,EAAqB,GAAK,CAClB,CACR,OAAO,EAAa,EAAW,EAAW,CACtC,EAAM,EAAU,CAAC,QAAQ,EAAM,EAAW,CAAE,GAAG,CAAC,QAAQ,MAAO,GAAG,CAClE,EAkBN,SAAgB,EAAiB,EAAc,EAAc,GAAY,CACvE,OAAO,EAAK,QACV,CAAC,GAAe,EAAY,SAAS,IAAI,CACrC,EAAyB,EAAK,CAC9B,EAAsB,EAAK,CAC/B,EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./join-paths.cjs`),t=(t,n=1)=>{let r=t.replaceAll(/\/+$/g,``);for(let t=0;t<n;t++)r=e.joinPaths(r,`..`);return r};exports.resolveParentPath=t;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/resolve-parent-path.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the parent path of the provided path.
|
|
4
|
+
*
|
|
5
|
+
* @param path - The path to resolve.
|
|
6
|
+
* @param count - The number of parent directories to traverse.
|
|
7
|
+
* @returns The parent path of the provided path.
|
|
8
|
+
*/
|
|
9
|
+
declare const resolveParentPath: (path: string, count?: number) => string;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { resolveParentPath };
|
|
12
|
+
//# sourceMappingURL=resolve-parent-path.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-parent-path.d.cts","names":[],"sources":["../src/resolve-parent-path.ts"],"sourcesContent":[],"mappings":";;AA2BA;;;;;;cAAa"}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/resolve-parent-path.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the parent path of the provided path.
|
|
4
|
+
*
|
|
5
|
+
* @param path - The path to resolve.
|
|
6
|
+
* @param count - The number of parent directories to traverse.
|
|
7
|
+
* @returns The parent path of the provided path.
|
|
8
|
+
*/
|
|
9
|
+
declare const resolveParentPath: (path: string, count?: number) => string;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { resolveParentPath };
|
|
12
|
+
//# sourceMappingURL=resolve-parent-path.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-parent-path.d.mts","names":[],"sources":["../src/resolve-parent-path.ts"],"sourcesContent":[],"mappings":";;AA2BA;;;;;;cAAa"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{joinPaths as e}from"./join-paths.mjs";const t=(t,n=1)=>{let r=t.replaceAll(/\/+$/g,``);for(let t=0;t<n;t++)r=e(r,`..`);return r};export{t as resolveParentPath};
|
|
2
|
+
//# sourceMappingURL=resolve-parent-path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-parent-path.mjs","names":[],"sources":["../src/resolve-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 { joinPaths } from \"./join-paths\";\n\n/**\n * Resolve the parent path of the provided path.\n *\n * @param path - The path to resolve.\n * @param count - The number of parent directories to traverse.\n * @returns The parent path of the provided path.\n */\nexport const resolveParentPath = (path: string, count: number = 1): string => {\n let parentPath = path.replaceAll(/\\/+$/g, \"\");\n for (let i = 0; i < count; i++) {\n parentPath = joinPaths(parentPath, \"..\");\n }\n return parentPath;\n};\n"],"mappings":"6CA2BA,MAAa,GAAqB,EAAc,EAAgB,IAAc,CAC5E,IAAI,EAAa,EAAK,WAAW,QAAS,GAAG,CAC7C,IAAK,IAAI,EAAI,EAAG,EAAI,EAAO,IACzB,EAAa,EAAU,EAAY,KAAK,CAE1C,OAAO"}
|
package/dist/slash.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./is-type.cjs`);function t(e){return e.startsWith(`\\\\?\\`)?e:e.replace(/\\/g,`/`)}function n(n){let r=t(n);return e.isAbsolutePath(r)?r.replace(/\/+$/g,``):r.replace(/^\.\//g,``).replace(/\/+$/g,``)}exports.formatSlash=n,exports.slash=t;
|
package/dist/slash.d.cts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/slash.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Replace backslash to slash
|
|
4
|
+
*
|
|
5
|
+
* @param path - The string to replace
|
|
6
|
+
* @returns The string with replaced backslashes
|
|
7
|
+
*/
|
|
8
|
+
declare function slash(path: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Replace backslash to slash and remove unneeded leading and trailing slashes
|
|
11
|
+
*
|
|
12
|
+
* @param path - The string to replace
|
|
13
|
+
* @returns The string with replaced backslashes
|
|
14
|
+
*/
|
|
15
|
+
declare function formatSlash(path: string): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { formatSlash, slash };
|
|
18
|
+
//# sourceMappingURL=slash.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash.d.cts","names":[],"sources":["../src/slash.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAcA;;;;iBAdgB,KAAA;;;;;;;iBAcA,WAAA"}
|
package/dist/slash.d.mts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/slash.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Replace backslash to slash
|
|
4
|
+
*
|
|
5
|
+
* @param path - The string to replace
|
|
6
|
+
* @returns The string with replaced backslashes
|
|
7
|
+
*/
|
|
8
|
+
declare function slash(path: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Replace backslash to slash and remove unneeded leading and trailing slashes
|
|
11
|
+
*
|
|
12
|
+
* @param path - The string to replace
|
|
13
|
+
* @returns The string with replaced backslashes
|
|
14
|
+
*/
|
|
15
|
+
declare function formatSlash(path: string): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { formatSlash, slash };
|
|
18
|
+
//# sourceMappingURL=slash.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash.d.mts","names":[],"sources":["../src/slash.ts"],"sourcesContent":[],"mappings":";;AA0BA;AAcA;;;;iBAdgB,KAAA;;;;;;;iBAcA,WAAA"}
|
package/dist/slash.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isAbsolutePath as e}from"./is-type.mjs";function t(e){return e.startsWith(`\\\\?\\`)?e:e.replace(/\\/g,`/`)}function n(n){let r=t(n);return e(r)?r.replace(/\/+$/g,``):r.replace(/^\.\//g,``).replace(/\/+$/g,``)}export{n as formatSlash,t as slash};
|
|
2
|
+
//# sourceMappingURL=slash.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash.mjs","names":[],"sources":["../src/slash.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 { isAbsolutePath } from \"./is-type\";\n\n/**\n * Replace backslash to slash\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function slash(path: string) {\n if (path.startsWith(\"\\\\\\\\?\\\\\")) {\n return path;\n }\n\n return path.replace(/\\\\/g, \"/\");\n}\n\n/**\n * Replace backslash to slash and remove unneeded leading and trailing slashes\n *\n * @param path - The string to replace\n * @returns The string with replaced backslashes\n */\nexport function formatSlash(path: string) {\n const formatted = slash(path);\n\n return isAbsolutePath(formatted)\n ? formatted.replace(/\\/+$/g, \"\")\n : formatted.replace(/^\\.\\//g, \"\").replace(/\\/+$/g, \"\");\n}\n"],"mappings":"+CA0BA,SAAgB,EAAM,EAAc,CAKlC,OAJI,EAAK,WAAW,UAAU,CACrB,EAGF,EAAK,QAAQ,MAAO,IAAI,CASjC,SAAgB,EAAY,EAAc,CACxC,IAAM,EAAY,EAAM,EAAK,CAE7B,OAAO,EAAe,EAAU,CAC5B,EAAU,QAAQ,QAAS,GAAG,CAC9B,EAAU,QAAQ,SAAU,GAAG,CAAC,QAAQ,QAAS,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./is-null.cjs`),t=require(`./is-undefined.cjs`),n=n=>{try{return t.isUndefined(n)||e.isNull(n)}catch{return!1}};exports.isEmpty=n;
|