@stryke/path 0.22.10 → 0.22.12
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/file-path-fns.d.cts
CHANGED
|
@@ -1,2 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/file-path-fns.d.ts
|
|
2
|
+
interface FindFileNameOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Require the file extension to be present in the file name.
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
requireExtension?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Return the file extension as part of the full file name result.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue true
|
|
13
|
+
*/
|
|
14
|
+
withExtension?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Find the file name from a file path.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const fileName = findFileName("C:\\Users\\user\\Documents\\file.txt");
|
|
22
|
+
* // fileName = "file.txt"
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param filePath - The file path to process
|
|
26
|
+
* @param options - Options to control the file name extraction
|
|
27
|
+
* @returns The file name
|
|
28
|
+
*/
|
|
29
|
+
declare function findFileName(filePath: string, options?: FindFileNameOptions): string;
|
|
30
|
+
/**
|
|
31
|
+
* Find the full file path's directories from a file path.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* The functionality of this method is similar to the {@link path.dirname} function in Node's path module.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const folderPath = findFilePath("C:\\Users\\user\\Documents\\file.txt");
|
|
39
|
+
* // folderPath = "C:\\Users\\user\\Documents"
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param filePath - The file path to process
|
|
43
|
+
* @param options - Options to control the file name extraction
|
|
44
|
+
* @returns The full file path's directories
|
|
45
|
+
*/
|
|
46
|
+
declare function findFilePath(filePath: string, options?: FindFileNameOptions): string;
|
|
47
|
+
declare const dirname: typeof findFilePath;
|
|
48
|
+
/**
|
|
49
|
+
* Find the top most folder containing the file from a file path.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The functionality of this method is similar to the {@link path.basename} function in Node's path module.
|
|
53
|
+
* If you're looking for the full path of the folder (for example: `C:\\Users\\user\\Documents` instead of just `Documents`) containing the file, use {@link findFilePath} instead.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const folderPath = findFolderName("C:\\Users\\user\\Documents\\file.txt");
|
|
57
|
+
* // folderPath = "Documents"
|
|
58
|
+
*
|
|
59
|
+
* @param filePath - The file path to process
|
|
60
|
+
* @param options - Options to control the file name extraction
|
|
61
|
+
* @returns The folder containing the file
|
|
62
|
+
*/
|
|
63
|
+
declare function findFolderName(filePath: string, options?: FindFileNameOptions): string;
|
|
64
|
+
declare const basename: typeof findFolderName;
|
|
65
|
+
/**
|
|
66
|
+
* Find the file extension from a file path.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* The functionality of this method is similar to the {@link path.extname} function in Node's path module.
|
|
70
|
+
* The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
71
|
+
*
|
|
72
|
+
* The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* findFileExtension("C:\\Users\\user\\Documents\\file.config.ts");
|
|
77
|
+
* // Returns "ts"
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param filePath - The file path to process
|
|
81
|
+
* @returns The file extension or undefined if no extension is found
|
|
82
|
+
*/
|
|
83
|
+
declare function findFileExtension(filePath: string): string | undefined;
|
|
84
|
+
declare const extname: typeof findFileExtension;
|
|
85
|
+
/**
|
|
86
|
+
* Find the file extension including the `"."` character prefix from a file path.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
90
|
+
*
|
|
91
|
+
* The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.
|
|
92
|
+
*
|
|
93
|
+
* @param filePath - The file path to process
|
|
94
|
+
* @returns The file extension (including the `"."` prefix) or undefined if no extension is found
|
|
95
|
+
*/
|
|
96
|
+
declare function findFileDotExtension(filePath: string): string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Find the file extension from a file path or an empty string.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
102
|
+
*
|
|
103
|
+
* The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.
|
|
104
|
+
*
|
|
105
|
+
* @param filePath - The file path to process
|
|
106
|
+
* @returns The file extension or an empty string if no extension is found
|
|
107
|
+
*/
|
|
108
|
+
declare function findFileExtensionSafe(filePath: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* Find the file extension including the `"."` character prefix from a file path or an empty string.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
114
|
+
*
|
|
115
|
+
* The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.
|
|
116
|
+
*
|
|
117
|
+
* @param filePath - The file path to process
|
|
118
|
+
* @returns The file extension (including the `"."` prefix) or an empty string if no extension is found
|
|
119
|
+
*/
|
|
120
|
+
declare function findFileDotExtensionSafe(filePath: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* Check if a file path has a file name.
|
|
123
|
+
*
|
|
124
|
+
* @param filePath - The file path to process
|
|
125
|
+
* @returns An indicator specifying if the file path has a file name
|
|
126
|
+
*/
|
|
127
|
+
declare function hasFileName(filePath: string): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Check if a file path has a file path.
|
|
130
|
+
*
|
|
131
|
+
* @param filePath - The file path to process
|
|
132
|
+
* @returns An indicator specifying if the file path has a file path
|
|
133
|
+
*/
|
|
134
|
+
declare function hasFilePath(filePath: string): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Check if a file path has a folder name.
|
|
137
|
+
*
|
|
138
|
+
* @param filePath - The file path to process
|
|
139
|
+
* @returns An indicator specifying if the file path has a folder name
|
|
140
|
+
*/
|
|
141
|
+
declare function hasFolderName(filePath: string): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Check if a file path has a file extension.
|
|
144
|
+
*
|
|
145
|
+
* @param filePath - The file path to process
|
|
146
|
+
* @returns An indicator specifying if the file path has a file extension
|
|
147
|
+
*/
|
|
148
|
+
declare function hasFileExtension(filePath: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Resolve the file path to an absolute path.
|
|
151
|
+
*
|
|
152
|
+
* @param path - The path to resolve
|
|
153
|
+
* @param cwd - The current working directory
|
|
154
|
+
* @returns The resolved path
|
|
155
|
+
*/
|
|
156
|
+
declare function resolvePath(path: string, cwd?: string): string;
|
|
157
|
+
declare function resolve(...paths: string[]): string;
|
|
158
|
+
/**
|
|
159
|
+
* Resolve the file path to an absolute path.
|
|
160
|
+
*
|
|
161
|
+
* @param paths - The paths to resolve
|
|
162
|
+
* @returns The resolved path
|
|
163
|
+
*/
|
|
164
|
+
declare function resolvePaths(...paths: string[]): string;
|
|
165
|
+
/**
|
|
166
|
+
* Get the relative path from one file to another.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* This function is similar to the `path.relative` function in Node's path module.
|
|
170
|
+
*
|
|
171
|
+
* @param from - The base path to start from
|
|
172
|
+
* @param to - The target path to resolve relative to the base path
|
|
173
|
+
* @returns The relative path from the base path to the target path
|
|
174
|
+
*/
|
|
175
|
+
declare function relative(from: string, to: string): string;
|
|
176
|
+
/**
|
|
177
|
+
* Get the relative path from one file to another.
|
|
178
|
+
*
|
|
179
|
+
* @remarks
|
|
180
|
+
* This function wraps the `path.relative` function in Node's path module.
|
|
181
|
+
*
|
|
182
|
+
* @param from - The base path to start from
|
|
183
|
+
* @param to - The target path to resolve relative to the base path
|
|
184
|
+
* @param withEndSlash - Whether to include a trailing slash at the end of the path
|
|
185
|
+
* @returns The relative path from the base path to the target path
|
|
186
|
+
*/
|
|
187
|
+
declare function relativePath(from: string, to: string, withEndSlash?: boolean): string;
|
|
188
|
+
/**
|
|
189
|
+
* Find the file path relative to the workspace root path.
|
|
190
|
+
*
|
|
191
|
+
* @param filePath - The file path to process
|
|
192
|
+
* @returns The resolved file path
|
|
193
|
+
*/
|
|
194
|
+
declare function relativeToCurrentDir(filePath: string): string;
|
|
195
|
+
/**
|
|
196
|
+
* Check if the path is a relative path.
|
|
197
|
+
*
|
|
198
|
+
* @param path - The path to check
|
|
199
|
+
* @returns An indicator specifying if the path is a relative path
|
|
200
|
+
*/
|
|
201
|
+
declare function parsePath(path: string): {
|
|
202
|
+
root: string;
|
|
203
|
+
dir: string;
|
|
204
|
+
base: string;
|
|
205
|
+
ext: string;
|
|
206
|
+
name: string;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Rename the file name with a new name.
|
|
210
|
+
*
|
|
211
|
+
* @param filePath - The current file path being processed
|
|
212
|
+
* @param newFileName - The updated file name being processed
|
|
213
|
+
* @returns The modified or unmodified file path.
|
|
214
|
+
*/
|
|
215
|
+
declare function renameFile(filePath: string, newFileName: string): string;
|
|
216
|
+
//#endregion
|
|
217
|
+
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
|
218
|
+
//# sourceMappingURL=file-path-fns.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-path-fns.d.cts","names":[],"sources":["../src/file-path-fns.ts"],"sourcesContent":[],"mappings":";UA0BiB,mBAAA;EAAA;AA6BjB;AAuCA;AAcA;AAiBA;EAyBa,gBAAyB,CAAA,EAAA,OAAjB;EAoBL;AAYhB;AAaA;AAiBA;AAeA;EAYgB,aAAA,CAAW,EAAA,OAAA;AAU3B;AAUA;AAUA;AAWA;AAoCA;AA0CA;AAgBA;AAsCA;AAaA;AAUA;AAgCA;;;;iBA5ZgB,YAAA,6BAEL;;;;;;;;;;;;;;;;;iBAqCK,YAAA,6BAEL;cAYE,gBAAO;;;;;;;;;;;;;;;;iBAiBJ,cAAA,6BAEJ;cAuBC,iBAAQ;;;;;;;;;;;;;;;;;;;iBAoBL,iBAAA;cAYH,gBAAO;;;;;;;;;;;;iBAaJ,oBAAA;;;;;;;;;;;;iBAiBA,qBAAA;;;;;;;;;;;;iBAeA,wBAAA;;;;;;;iBAYA,WAAA;;;;;;;iBAUA,WAAA;;;;;;;iBAUA,aAAA;;;;;;;iBAUA,gBAAA;;;;;;;;iBAWA,WAAA;iBAoCA,OAAA;;;;;;;iBA0CA,YAAA;;;;;;;;;;;iBAgBA,QAAA;;;;;;;;;;;;iBAsCA,YAAA;;;;;;;iBAaA,oBAAA;;;;;;;iBAUA,SAAA;;;;;;;;;;;;;;iBAgCA,UAAA"}
|
package/dist/file-path-fns.d.mts
CHANGED
|
@@ -1,2 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/file-path-fns.d.ts
|
|
2
|
+
interface FindFileNameOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Require the file extension to be present in the file name.
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
requireExtension?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Return the file extension as part of the full file name result.
|
|
11
|
+
*
|
|
12
|
+
* @defaultValue true
|
|
13
|
+
*/
|
|
14
|
+
withExtension?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Find the file name from a file path.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const fileName = findFileName("C:\\Users\\user\\Documents\\file.txt");
|
|
22
|
+
* // fileName = "file.txt"
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param filePath - The file path to process
|
|
26
|
+
* @param options - Options to control the file name extraction
|
|
27
|
+
* @returns The file name
|
|
28
|
+
*/
|
|
29
|
+
declare function findFileName(filePath: string, options?: FindFileNameOptions): string;
|
|
30
|
+
/**
|
|
31
|
+
* Find the full file path's directories from a file path.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* The functionality of this method is similar to the {@link path.dirname} function in Node's path module.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const folderPath = findFilePath("C:\\Users\\user\\Documents\\file.txt");
|
|
39
|
+
* // folderPath = "C:\\Users\\user\\Documents"
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param filePath - The file path to process
|
|
43
|
+
* @param options - Options to control the file name extraction
|
|
44
|
+
* @returns The full file path's directories
|
|
45
|
+
*/
|
|
46
|
+
declare function findFilePath(filePath: string, options?: FindFileNameOptions): string;
|
|
47
|
+
declare const dirname: typeof findFilePath;
|
|
48
|
+
/**
|
|
49
|
+
* Find the top most folder containing the file from a file path.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The functionality of this method is similar to the {@link path.basename} function in Node's path module.
|
|
53
|
+
* If you're looking for the full path of the folder (for example: `C:\\Users\\user\\Documents` instead of just `Documents`) containing the file, use {@link findFilePath} instead.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const folderPath = findFolderName("C:\\Users\\user\\Documents\\file.txt");
|
|
57
|
+
* // folderPath = "Documents"
|
|
58
|
+
*
|
|
59
|
+
* @param filePath - The file path to process
|
|
60
|
+
* @param options - Options to control the file name extraction
|
|
61
|
+
* @returns The folder containing the file
|
|
62
|
+
*/
|
|
63
|
+
declare function findFolderName(filePath: string, options?: FindFileNameOptions): string;
|
|
64
|
+
declare const basename: typeof findFolderName;
|
|
65
|
+
/**
|
|
66
|
+
* Find the file extension from a file path.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* The functionality of this method is similar to the {@link path.extname} function in Node's path module.
|
|
70
|
+
* The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
71
|
+
*
|
|
72
|
+
* The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* findFileExtension("C:\\Users\\user\\Documents\\file.config.ts");
|
|
77
|
+
* // Returns "ts"
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param filePath - The file path to process
|
|
81
|
+
* @returns The file extension or undefined if no extension is found
|
|
82
|
+
*/
|
|
83
|
+
declare function findFileExtension(filePath: string): string | undefined;
|
|
84
|
+
declare const extname: typeof findFileExtension;
|
|
85
|
+
/**
|
|
86
|
+
* Find the file extension including the `"."` character prefix from a file path.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
90
|
+
*
|
|
91
|
+
* The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.
|
|
92
|
+
*
|
|
93
|
+
* @param filePath - The file path to process
|
|
94
|
+
* @returns The file extension (including the `"."` prefix) or undefined if no extension is found
|
|
95
|
+
*/
|
|
96
|
+
declare function findFileDotExtension(filePath: string): string | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Find the file extension from a file path or an empty string.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
102
|
+
*
|
|
103
|
+
* The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.
|
|
104
|
+
*
|
|
105
|
+
* @param filePath - The file path to process
|
|
106
|
+
* @returns The file extension or an empty string if no extension is found
|
|
107
|
+
*/
|
|
108
|
+
declare function findFileExtensionSafe(filePath: string): string;
|
|
109
|
+
/**
|
|
110
|
+
* Find the file extension including the `"."` character prefix from a file path or an empty string.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.
|
|
114
|
+
*
|
|
115
|
+
* The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.
|
|
116
|
+
*
|
|
117
|
+
* @param filePath - The file path to process
|
|
118
|
+
* @returns The file extension (including the `"."` prefix) or an empty string if no extension is found
|
|
119
|
+
*/
|
|
120
|
+
declare function findFileDotExtensionSafe(filePath: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* Check if a file path has a file name.
|
|
123
|
+
*
|
|
124
|
+
* @param filePath - The file path to process
|
|
125
|
+
* @returns An indicator specifying if the file path has a file name
|
|
126
|
+
*/
|
|
127
|
+
declare function hasFileName(filePath: string): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Check if a file path has a file path.
|
|
130
|
+
*
|
|
131
|
+
* @param filePath - The file path to process
|
|
132
|
+
* @returns An indicator specifying if the file path has a file path
|
|
133
|
+
*/
|
|
134
|
+
declare function hasFilePath(filePath: string): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Check if a file path has a folder name.
|
|
137
|
+
*
|
|
138
|
+
* @param filePath - The file path to process
|
|
139
|
+
* @returns An indicator specifying if the file path has a folder name
|
|
140
|
+
*/
|
|
141
|
+
declare function hasFolderName(filePath: string): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Check if a file path has a file extension.
|
|
144
|
+
*
|
|
145
|
+
* @param filePath - The file path to process
|
|
146
|
+
* @returns An indicator specifying if the file path has a file extension
|
|
147
|
+
*/
|
|
148
|
+
declare function hasFileExtension(filePath: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Resolve the file path to an absolute path.
|
|
151
|
+
*
|
|
152
|
+
* @param path - The path to resolve
|
|
153
|
+
* @param cwd - The current working directory
|
|
154
|
+
* @returns The resolved path
|
|
155
|
+
*/
|
|
156
|
+
declare function resolvePath(path: string, cwd?: string): string;
|
|
157
|
+
declare function resolve(...paths: string[]): string;
|
|
158
|
+
/**
|
|
159
|
+
* Resolve the file path to an absolute path.
|
|
160
|
+
*
|
|
161
|
+
* @param paths - The paths to resolve
|
|
162
|
+
* @returns The resolved path
|
|
163
|
+
*/
|
|
164
|
+
declare function resolvePaths(...paths: string[]): string;
|
|
165
|
+
/**
|
|
166
|
+
* Get the relative path from one file to another.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* This function is similar to the `path.relative` function in Node's path module.
|
|
170
|
+
*
|
|
171
|
+
* @param from - The base path to start from
|
|
172
|
+
* @param to - The target path to resolve relative to the base path
|
|
173
|
+
* @returns The relative path from the base path to the target path
|
|
174
|
+
*/
|
|
175
|
+
declare function relative(from: string, to: string): string;
|
|
176
|
+
/**
|
|
177
|
+
* Get the relative path from one file to another.
|
|
178
|
+
*
|
|
179
|
+
* @remarks
|
|
180
|
+
* This function wraps the `path.relative` function in Node's path module.
|
|
181
|
+
*
|
|
182
|
+
* @param from - The base path to start from
|
|
183
|
+
* @param to - The target path to resolve relative to the base path
|
|
184
|
+
* @param withEndSlash - Whether to include a trailing slash at the end of the path
|
|
185
|
+
* @returns The relative path from the base path to the target path
|
|
186
|
+
*/
|
|
187
|
+
declare function relativePath(from: string, to: string, withEndSlash?: boolean): string;
|
|
188
|
+
/**
|
|
189
|
+
* Find the file path relative to the workspace root path.
|
|
190
|
+
*
|
|
191
|
+
* @param filePath - The file path to process
|
|
192
|
+
* @returns The resolved file path
|
|
193
|
+
*/
|
|
194
|
+
declare function relativeToCurrentDir(filePath: string): string;
|
|
195
|
+
/**
|
|
196
|
+
* Check if the path is a relative path.
|
|
197
|
+
*
|
|
198
|
+
* @param path - The path to check
|
|
199
|
+
* @returns An indicator specifying if the path is a relative path
|
|
200
|
+
*/
|
|
201
|
+
declare function parsePath(path: string): {
|
|
202
|
+
root: string;
|
|
203
|
+
dir: string;
|
|
204
|
+
base: string;
|
|
205
|
+
ext: string;
|
|
206
|
+
name: string;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Rename the file name with a new name.
|
|
210
|
+
*
|
|
211
|
+
* @param filePath - The current file path being processed
|
|
212
|
+
* @param newFileName - The updated file name being processed
|
|
213
|
+
* @returns The modified or unmodified file path.
|
|
214
|
+
*/
|
|
215
|
+
declare function renameFile(filePath: string, newFileName: string): string;
|
|
216
|
+
//#endregion
|
|
217
|
+
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
|
218
|
+
//# sourceMappingURL=file-path-fns.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-path-fns.d.mts","names":[],"sources":["../src/file-path-fns.ts"],"sourcesContent":[],"mappings":";UA0BiB,mBAAA;EAAA;AA6BjB;AAuCA;AAcA;AAiBA;EAyBa,gBAAyB,CAAA,EAAA,OAAjB;EAoBL;AAYhB;AAaA;AAiBA;AAeA;EAYgB,aAAA,CAAW,EAAA,OAAA;AAU3B;AAUA;AAUA;AAWA;AAoCA;AA0CA;AAgBA;AAsCA;AAaA;AAUA;AAgCA;;;;iBA5ZgB,YAAA,6BAEL;;;;;;;;;;;;;;;;;iBAqCK,YAAA,6BAEL;cAYE,gBAAO;;;;;;;;;;;;;;;;iBAiBJ,cAAA,6BAEJ;cAuBC,iBAAQ;;;;;;;;;;;;;;;;;;;iBAoBL,iBAAA;cAYH,gBAAO;;;;;;;;;;;;iBAaJ,oBAAA;;;;;;;;;;;;iBAiBA,qBAAA;;;;;;;;;;;;iBAeA,wBAAA;;;;;;;iBAYA,WAAA;;;;;;;iBAUA,WAAA;;;;;;;iBAUA,aAAA;;;;;;;iBAUA,gBAAA;;;;;;;;iBAWA,WAAA;iBAoCA,OAAA;;;;;;;iBA0CA,YAAA;;;;;;;;;;;iBAgBA,QAAA;;;;;;;;;;;;iBAsCA,YAAA;;;;;;;iBAaA,oBAAA;;;;;;;iBAUA,SAAA;;;;;;;;;;;;;;iBAgCA,UAAA"}
|
package/dist/file-path-fns.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{cwd as e}from"./cwd.mjs";import{FILE_EXTENSION_REGEX as t,ROOT_FOLDER_REGEX as n}from"./regex.mjs";import{isAbsolute as r,isAbsolutePath as i}from"./is-type.mjs";import{joinPaths as a}from"./join-paths.mjs";import{normalizeString as o,normalizeWindowsPath as s}from"./correct-path.mjs";import{isSetString as c}from"./type-checks/src/is-set-string.mjs";import{EMPTY_STRING as l}from"./types/src/base.mjs";function u(e,t={}){let{requireExtension:n=!1,withExtension:r=!0}=t,i=s(e)?.split(e?.includes(`\\`)?`\\`:`/`)?.pop()??``;return n===!0&&!i.includes(`.`)?l:r===!1&&i.includes(`.`)?i.replace(`.${h(i)??``}`,``)||l:i}function d(e,t={}){let n=s(e),r=n.replace(u(n,{requireExtension:!1,...t}),``);return r===`/`?r:r.replace(/\/$/,``)}const f=d;function p(e,t){let n=d(e,t).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return r??l}const m=p;function h(e){if(e.endsWith(`.`)||e.endsWith(`/`))return;let n=t.exec(s(e));return n&&n.length>0&&c(n[0])?n[0].replace(`.`,``):void 0}const g=h;function _(e){let t=h(e);return t?`.${t}`:void 0}function v(e){return h(e)??l}function y(e){let t=h(e);return t?`.${t}`:``}function b(e){return!!u(e)}function x(e){return!!d(e)}function S(e){return!!p(e)}function C(e){return!!h(e)}function w(t,n=e()){let r=s(t).split(`/`),c=``,l=!1;for(let e=r.length-1;e>=-1&&!l;e--){let t=e>=0?r[e]:n;!t||t.length===0||(c=a(t,c),l=i(t))}return c=o(c,!l),l&&!i(c)?`/${c}`:c.length>0?c:`.`}function T(...t){t=t.map(e=>s(e));let n=``,i=!1;for(let a=t.length-1;a>=-1&&!i;a--){let o=a>=0?t[a]:e();!o||o.length===0||(n=`${o}/${n}`,i=r(o))}return n=o(n,!i),i&&!r(n)?`/${n}`:n.length>0?n:`.`}function E(...e){return w(a(...e.map(e=>s(e))))}function D(e,t){let r=T(e).replace(n,`$1`).split(`/`),i=T(t).replace(n,`$1`).split(`/`);if(i[0][1]===`:`&&r[0][1]===`:`&&r[0]!==i[0])return i.join(`/`);let a=[...r];for(let e of a){if(i[0]!==e)break;r.shift(),i.shift()}return[...r.map(()=>`..`),...i].join(`/`)}function O(e,t,n=!1){return D(n===!0?e:e.replace(/\/$/,``),n===!0?t:t.replace(/\/$/,``))}function k(t){return O(t,e())}function A(e){let t=/^[/\\]|^[a-z]:[/\\]/i.exec(e)?.[0]?.replace(/\\/g,`/`)||``,n=s(e),r=n.replace(/\/$/,``).split(`/`).slice(0,-1);r.length===1&&/^[A-Z]:$/i.test(r[0])&&(r[0]+=`/`);let a=p(n),o=r.join(`/`)||(i(e)?`/`:`.`),c=v(e);return{root:t,dir:o,base:a,ext:c,name:a.slice(0,a.length-c.length)}}function j(e,t){let n=A(e);return a(n.dir,t.includes(`.`)?t:t+n.ext)}export{m as basename,f as dirname,g as extname,_ as findFileDotExtension,y as findFileDotExtensionSafe,h as findFileExtension,v as findFileExtensionSafe,u as findFileName,d as findFilePath,p as findFolderName,C as hasFileExtension,b as hasFileName,x as hasFilePath,S as hasFolderName,A as parsePath,D as relative,O as relativePath,k as relativeToCurrentDir,j as renameFile,T as resolve,w as resolvePath,E as resolvePaths};
|
|
2
|
+
//# sourceMappingURL=file-path-fns.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-path-fns.mjs","names":["currentDir","path","cwd"],"sources":["../src/file-path-fns.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\";\nimport { EMPTY_STRING } from \"@stryke/types/base\";\nimport { normalizeString, normalizeWindowsPath } from \"./correct-path\";\nimport { cwd as currentDir } from \"./cwd\";\nimport { isAbsolute, isAbsolutePath } from \"./is-type\";\nimport { joinPaths } from \"./join-paths\";\nimport { FILE_EXTENSION_REGEX, ROOT_FOLDER_REGEX } from \"./regex\";\n\nexport interface FindFileNameOptions {\n /**\n * Require the file extension to be present in the file name.\n *\n * @defaultValue false\n */\n requireExtension?: boolean;\n\n /**\n * Return the file extension as part of the full file name result.\n *\n * @defaultValue true\n */\n withExtension?: boolean;\n}\n\n/**\n * Find the file name from a file path.\n *\n * @example\n * ```ts\n * const fileName = findFileName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // fileName = \"file.txt\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The file name\n */\nexport function findFileName(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const { requireExtension = false, withExtension = true } = options;\n const result =\n normalizeWindowsPath(filePath)\n ?.split(filePath?.includes(\"\\\\\") ? \"\\\\\" : \"/\")\n ?.pop() ?? \"\";\n\n if (requireExtension === true && !result.includes(\".\")) {\n return EMPTY_STRING;\n }\n\n if (withExtension === false && result.includes(\".\")) {\n return (\n result.replace(`.${findFileExtension(result) ?? \"\"}`, \"\") || EMPTY_STRING\n );\n }\n\n return result;\n}\n\n/**\n * Find the full file path's directories from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.dirname} function in Node's path module.\n *\n * @example\n * ```ts\n * const folderPath = findFilePath(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"C:\\\\Users\\\\user\\\\Documents\"\n * ```\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The full file path's directories\n */\nexport function findFilePath(\n filePath: string,\n options: FindFileNameOptions = {}\n): string {\n const normalizedPath = normalizeWindowsPath(filePath);\n\n const result = normalizedPath.replace(\n findFileName(normalizedPath, { requireExtension: false, ...options }),\n \"\"\n );\n\n return result === \"/\" ? result : result.replace(/\\/$/, \"\");\n}\n\nexport const dirname = findFilePath;\n\n/**\n * Find the top most folder containing the file from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.basename} function in Node's path module.\n * If you're looking for the full path of the folder (for example: `C:\\\\Users\\\\user\\\\Documents` instead of just `Documents`) containing the file, use {@link findFilePath} instead.\n *\n * @example\n * const folderPath = findFolderName(\"C:\\\\Users\\\\user\\\\Documents\\\\file.txt\");\n * // folderPath = \"Documents\"\n *\n * @param filePath - The file path to process\n * @param options - Options to control the file name extraction\n * @returns The folder containing the file\n */\nexport function findFolderName(\n filePath: string,\n options?: FindFileNameOptions\n): string {\n const segments = findFilePath(filePath, options).split(\"/\");\n\n let lastSegment = \"\";\n for (let i = segments.length - 1; i >= 0; i--) {\n const val = segments[i];\n if (val) {\n lastSegment = val;\n break;\n }\n }\n\n // if (\n // folderPath.lastIndexOf(\"\\\\\") === folderPath.length - 1 ||\n // folderPath.lastIndexOf(\"/\") === folderPath.length - 1\n // ) {\n // folderPath = folderPath.slice(0, Math.max(0, folderPath.length - 1));\n // }\n\n return lastSegment ?? EMPTY_STRING;\n}\n\nexport const basename = findFolderName;\n\n/**\n * Find the file extension from a file path.\n *\n * @remarks\n * The functionality of this method is similar to the {@link path.extname} function in Node's path module.\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @example\n * ```ts\n * findFileExtension(\"C:\\\\Users\\\\user\\\\Documents\\\\file.config.ts\");\n * // Returns \"ts\"\n * ```\n *\n * @param filePath - The file path to process\n * @returns The file extension or undefined if no extension is found\n */\nexport function findFileExtension(filePath: string): string | undefined {\n if (filePath.endsWith(\".\") || filePath.endsWith(\"/\")) {\n return undefined;\n }\n\n const match = FILE_EXTENSION_REGEX.exec(normalizeWindowsPath(filePath));\n\n return match && match.length > 0 && isSetString(match[0])\n ? match[0].replace(\".\", \"\")\n : undefined;\n}\n\nexport const extname = findFileExtension;\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @returns The file extension (including the `\".\"` prefix) or undefined if no extension is found\n */\nexport function findFileDotExtension(filePath: string): string | undefined {\n const ext = findFileExtension(filePath);\n\n return ext ? `.${ext}` : undefined;\n}\n\n/**\n * Find the file extension from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will not** include the dot, for example `txt` or `js` instead of `.txt` or `.js`.\n *\n * @param filePath - The file path to process\n * @returns The file extension or an empty string if no extension is found\n */\nexport function findFileExtensionSafe(filePath: string): string {\n return findFileExtension(filePath) ?? EMPTY_STRING;\n}\n\n/**\n * Find the file extension including the `\".\"` character prefix from a file path or an empty string.\n *\n * @remarks\n * The file extension is the part of the file name that comes after (and including) the last dot (`.`) in the file name. If the file name does not contain a dot, or if it ends with a dot, this function will return `undefined`.\n *\n * The returned extension **will** include the dot, for example `.txt` or `.js` instead of `txt` or `js`.\n *\n * @param filePath - The file path to process\n * @returns The file extension (including the `\".\"` prefix) or an empty string if no extension is found\n */\nexport function findFileDotExtensionSafe(filePath: string): string {\n const ext = findFileExtension(filePath);\n\n return ext ? `.${ext}` : \"\";\n}\n\n/**\n * Check if a file path has a file name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file name\n */\nexport function hasFileName(filePath: string): boolean {\n return Boolean(findFileName(filePath));\n}\n\n/**\n * Check if a file path has a file path.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file path\n */\nexport function hasFilePath(filePath: string): boolean {\n return Boolean(findFilePath(filePath));\n}\n\n/**\n * Check if a file path has a folder name.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a folder name\n */\nexport function hasFolderName(filePath: string): boolean {\n return Boolean(findFolderName(filePath));\n}\n\n/**\n * Check if a file path has a file extension.\n *\n * @param filePath - The file path to process\n * @returns An indicator specifying if the file path has a file extension\n */\nexport function hasFileExtension(filePath: string): boolean {\n return Boolean(findFileExtension(filePath));\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param path - The path to resolve\n * @param cwd - The current working directory\n * @returns The resolved path\n */\nexport function resolvePath(path: string, cwd = currentDir()) {\n // Normalize windows arguments\n const paths = normalizeWindowsPath(path).split(\"/\");\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : cwd;\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = joinPaths(path, resolvedPath);\n resolvedAbsolute = isAbsolutePath(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\nexport function resolve(...paths: string[]) {\n // Normalize windows arguments\n paths = paths.map(argument => normalizeWindowsPath(argument));\n\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n\n for (\n let index = paths.length - 1;\n index >= -1 && !resolvedAbsolute;\n index--\n ) {\n const path = index >= 0 ? paths[index] : currentDir();\n\n // Skip empty entries\n if (!path || path.length === 0) {\n continue;\n }\n\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = isAbsolute(path);\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute && !isAbsolute(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n}\n\n/**\n * Resolve the file path to an absolute path.\n *\n * @param paths - The paths to resolve\n * @returns The resolved path\n */\nexport function resolvePaths(...paths: string[]) {\n return resolvePath(\n joinPaths(...paths.map(path => normalizeWindowsPath(path)))\n );\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function is similar to the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @returns The relative path from the base path to the target path\n */\nexport function relative(from: string, to: string) {\n // we cast these because `split` will always be at least one string\n const _from = resolve(from).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n const _to = resolve(to).replace(ROOT_FOLDER_REGEX, \"$1\").split(\"/\") as [\n string,\n ...string[]\n ];\n\n // Different windows drive letters\n if (_to[0][1] === \":\" && _from[0][1] === \":\" && _from[0] !== _to[0]) {\n return _to.join(\"/\");\n }\n\n const _fromCopy = [..._from];\n for (const segment of _fromCopy) {\n if (_to[0] !== segment) {\n break;\n }\n _from.shift();\n _to.shift();\n }\n return [..._from.map(() => \"..\"), ..._to].join(\"/\");\n}\n\n/**\n * Get the relative path from one file to another.\n *\n * @remarks\n * This function wraps the `path.relative` function in Node's path module.\n *\n * @param from - The base path to start from\n * @param to - The target path to resolve relative to the base path\n * @param withEndSlash - Whether to include a trailing slash at the end of the path\n * @returns The relative path from the base path to the target path\n */\nexport function relativePath(from: string, to: string, withEndSlash = false) {\n return relative(\n withEndSlash !== true ? from.replace(/\\/$/, \"\") : from,\n withEndSlash !== true ? to.replace(/\\/$/, \"\") : to\n );\n}\n\n/**\n * Find the file path relative to the workspace root path.\n *\n * @param filePath - The file path to process\n * @returns The resolved file path\n */\nexport function relativeToCurrentDir(filePath: string) {\n return relativePath(filePath, currentDir());\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 parsePath(path: string) {\n // The root of the path such as '/' or 'c:\\'\n const root =\n /^[/\\\\]|^[a-z]:[/\\\\]/i.exec(path)?.[0]?.replace(/\\\\/g, \"/\") || \"\";\n\n const normalizedPath = normalizeWindowsPath(path);\n\n const segments = normalizedPath.replace(/\\/$/, \"\").split(\"/\").slice(0, -1);\n if (segments.length === 1 && /^[A-Z]:$/i.test(segments[0] as string)) {\n segments[0] += \"/\";\n }\n\n const base = findFolderName(normalizedPath);\n const dir = segments.join(\"/\") || (isAbsolutePath(path) ? \"/\" : \".\");\n const ext = findFileExtensionSafe(path);\n\n return {\n root,\n dir,\n base,\n ext,\n name: base.slice(0, base.length - ext.length)\n };\n}\n\n/**\n * Rename the file name with a new name.\n *\n * @param filePath - The current file path being processed\n * @param newFileName - The updated file name being processed\n * @returns The modified or unmodified file path.\n */\nexport function renameFile(filePath: string, newFileName: string): string {\n const file = parsePath(filePath);\n\n return joinPaths(\n file.dir,\n newFileName.includes(\".\") ? newFileName : newFileName + file.ext\n );\n}\n"],"mappings":"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"}
|
package/dist/find.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./file-path-fns
|
|
1
|
+
const e=require(`./file-path-fns.cjs`);exports.basename=e.basename,exports.dirname=e.dirname,exports.extname=e.extname,exports.findFileDotExtension=e.findFileDotExtension,exports.findFileDotExtensionSafe=e.findFileDotExtensionSafe,exports.findFileExtension=e.findFileExtension,exports.findFileExtensionSafe=e.findFileExtensionSafe,exports.findFileName=e.findFileName,exports.findFilePath=e.findFilePath,exports.findFolderName=e.findFolderName,exports.hasFileExtension=e.hasFileExtension,exports.hasFileName=e.hasFileName,exports.hasFilePath=e.hasFilePath,exports.hasFolderName=e.hasFolderName,exports.parsePath=e.parsePath,exports.relative=e.relative,exports.relativePath=e.relativePath,exports.relativeToCurrentDir=e.relativeToCurrentDir,exports.renameFile=e.renameFile,exports.resolve=e.resolve,exports.resolvePath=e.resolvePath,exports.resolvePaths=e.resolvePaths;
|
package/dist/find.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
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";
|
|
2
2
|
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
package/dist/find.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
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";
|
|
2
2
|
export { FindFileNameOptions, basename, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, hasFileExtension, hasFileName, hasFilePath, hasFolderName, parsePath, relative, relativePath, relativeToCurrentDir, renameFile, resolve, resolvePath, resolvePaths };
|
package/dist/find.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{basename as e,dirname as t,extname as n,findFileDotExtension as r,findFileDotExtensionSafe as i,findFileExtension as a,findFileExtensionSafe as o,findFileName as s,findFilePath as c,findFolderName as l,hasFileExtension as u,hasFileName as d,hasFilePath as f,hasFolderName as p,parsePath as m,relative as h,relativePath as g,relativeToCurrentDir as _,renameFile as v,resolve as y,resolvePath as b,resolvePaths as x}from"./file-path-fns.mjs";export{e as basename,t as dirname,n as extname,r as findFileDotExtension,i as findFileDotExtensionSafe,a as findFileExtension,o as findFileExtensionSafe,s as findFileName,c as findFilePath,l as findFolderName,u as hasFileExtension,d as hasFileName,f as hasFilePath,p as hasFolderName,m as parsePath,h as relative,g as relativePath,_ as relativeToCurrentDir,v as renameFile,y as resolve,b as resolvePath,x as resolvePaths};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./cwd
|
|
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(`./delimiter.cjs`),l=require(`./file-path-fns.cjs`),u=require(`./is-root-dir.cjs`),d=require(`./replace.cjs`),f=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=l.basename,exports.correctPath=s.correctPath,exports.cwd=e.cwd,exports.delimiter=c.delimiter,exports.dirname=l.dirname,exports.extname=l.extname,exports.findFileDotExtension=l.findFileDotExtension,exports.findFileDotExtensionSafe=l.findFileDotExtensionSafe,exports.findFileExtension=l.findFileExtension,exports.findFileExtensionSafe=l.findFileExtensionSafe,exports.findFileName=l.findFileName,exports.findFilePath=l.findFilePath,exports.findFolderName=l.findFolderName,exports.formatSlash=n.formatSlash,exports.hasFileExtension=l.hasFileExtension,exports.hasFileName=l.hasFileName,exports.hasFilePath=l.hasFilePath,exports.hasFolderName=l.hasFolderName,exports.isParentPath=r.isParentPath,exports.isSystemRoot=u.isSystemRoot,exports.join=i.join,exports.joinPaths=i.joinPaths,exports.normalizeString=s.normalizeString,exports.normalizeWindowsPath=s.normalizeWindowsPath,exports.parsePath=l.parsePath,exports.posix=c.posix,exports.relative=l.relative,exports.relativePath=l.relativePath,exports.relativeToCurrentDir=l.relativeToCurrentDir,exports.renameFile=l.renameFile,exports.replaceExtension=d.replaceExtension,exports.replacePath=d.replacePath,exports.resolve=l.resolve,exports.resolveParentPath=f.resolveParentPath,exports.resolvePath=l.resolvePath,exports.resolvePaths=l.resolvePaths,exports.slash=n.slash,exports.stripStars=s.stripStars,exports.toAbsolutePath=s.toAbsolutePath,exports.toRelativePath=s.toRelativePath,exports.win32=c.win32,exports.withTrailingSlash=s.withTrailingSlash;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { append, appendExtension, appendPath } from "./append.cjs";
|
|
2
|
+
import { DEFAULT_ASSET_EXTS } from "./asset-extensions.cjs";
|
|
3
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash } from "./correct-path.cjs";
|
|
4
|
+
import { cwd } from "./cwd.cjs";
|
|
5
|
+
import { delimiter, posix, win32 } from "./delimiter.cjs";
|
|
6
|
+
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";
|
|
7
|
+
import { isParentPath } from "./is-parent-path.cjs";
|
|
8
|
+
import { isSystemRoot } from "./is-root-dir.cjs";
|
|
9
|
+
import { join, joinPaths } from "./join-paths.cjs";
|
|
10
|
+
import { 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 } from "./regex.cjs";
|
|
11
|
+
import { replaceExtension, replacePath } from "./replace.cjs";
|
|
12
|
+
import { resolveParentPath } from "./resolve-parent-path.cjs";
|
|
13
|
+
import { formatSlash, slash } from "./slash.cjs";
|
|
14
14
|
export { ABSOLUTE_PATH_REGEX, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { append, appendExtension, appendPath } from "./append.mjs";
|
|
2
|
+
import { DEFAULT_ASSET_EXTS } from "./asset-extensions.mjs";
|
|
3
|
+
import { correctPath, normalizeString, normalizeWindowsPath, stripStars, toAbsolutePath, toRelativePath, withTrailingSlash } from "./correct-path.mjs";
|
|
4
|
+
import { cwd } from "./cwd.mjs";
|
|
5
|
+
import { delimiter, posix, win32 } from "./delimiter.mjs";
|
|
6
|
+
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";
|
|
7
|
+
import { isParentPath } from "./is-parent-path.mjs";
|
|
8
|
+
import { isSystemRoot } from "./is-root-dir.mjs";
|
|
9
|
+
import { join, joinPaths } from "./join-paths.mjs";
|
|
10
|
+
import { 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 } from "./regex.mjs";
|
|
11
|
+
import { replaceExtension, replacePath } from "./replace.mjs";
|
|
12
|
+
import { resolveParentPath } from "./resolve-parent-path.mjs";
|
|
13
|
+
import { formatSlash, slash } from "./slash.mjs";
|
|
14
14
|
export { ABSOLUTE_PATH_REGEX, DEFAULT_ASSET_EXTS, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FindFileNameOptions, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX, append, appendExtension, appendPath, basename, correctPath, cwd, delimiter, dirname, extname, findFileDotExtension, findFileDotExtensionSafe, findFileExtension, findFileExtensionSafe, findFileName, findFilePath, findFolderName, formatSlash, hasFileExtension, hasFileName, hasFilePath, hasFolderName, isParentPath, isSystemRoot, join, joinPaths, normalizeString, normalizeWindowsPath, parsePath, posix, relative, relativePath, relativeToCurrentDir, renameFile, replaceExtension, replacePath, resolve, resolveParentPath, resolvePath, resolvePaths, slash, stripStars, toAbsolutePath, toRelativePath, win32, withTrailingSlash };
|