@gesslar/toolkit 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +5 -4
  2. package/package.json +2 -2
  3. package/src/{index.js → node/index.js} +11 -10
  4. package/src/{lib → node/lib}/DirectoryObject.js +47 -56
  5. package/src/{lib → node/lib}/FileObject.js +76 -149
  6. package/src/{lib/FS.js → node/lib/FileSystem.js} +7 -7
  7. package/src/{lib → node/lib}/Glog.js +2 -2
  8. package/src/{lib → node/lib}/Logger.js +1 -1
  9. package/src/{lib → node/lib}/Sass.js +1 -1
  10. package/src/{lib → node/lib}/Tantrum.js +1 -1
  11. package/src/{lib → node/lib}/TempDirectoryObject.js +9 -9
  12. package/src/{lib → node/lib}/Util.js +1 -1
  13. package/src/{lib/CappedDirectoryObject.js → node/lib/VDirectoryObject.js} +37 -92
  14. package/src/node/lib/VFileObject.js +61 -0
  15. package/src/{lib → node/lib}/Valid.js +11 -5
  16. package/src/types/browser/index.d.ts +0 -13
  17. package/src/types/browser/index.d.ts.map +0 -1
  18. package/src/types/browser/lib/Collection.d.ts +0 -248
  19. package/src/types/browser/lib/Collection.d.ts.map +0 -1
  20. package/src/types/browser/lib/Data.d.ts +0 -250
  21. package/src/types/browser/lib/Data.d.ts.map +0 -1
  22. package/src/types/browser/lib/Disposer.d.ts +0 -33
  23. package/src/types/browser/lib/Disposer.d.ts.map +0 -1
  24. package/src/types/browser/lib/HTML.d.ts +0 -40
  25. package/src/types/browser/lib/HTML.d.ts.map +0 -1
  26. package/src/types/browser/lib/Notify.d.ts +0 -60
  27. package/src/types/browser/lib/Notify.d.ts.map +0 -1
  28. package/src/types/browser/lib/Promised.d.ts +0 -119
  29. package/src/types/browser/lib/Promised.d.ts.map +0 -1
  30. package/src/types/browser/lib/Sass.d.ts +0 -63
  31. package/src/types/browser/lib/Sass.d.ts.map +0 -1
  32. package/src/types/browser/lib/Tantrum.d.ts +0 -52
  33. package/src/types/browser/lib/Tantrum.d.ts.map +0 -1
  34. package/src/types/browser/lib/Time.d.ts +0 -42
  35. package/src/types/browser/lib/Time.d.ts.map +0 -1
  36. package/src/types/browser/lib/TypeSpec.d.ts +0 -90
  37. package/src/types/browser/lib/TypeSpec.d.ts.map +0 -1
  38. package/src/types/browser/lib/Util.d.ts +0 -62
  39. package/src/types/browser/lib/Util.d.ts.map +0 -1
  40. package/src/types/browser/lib/Valid.d.ts +0 -33
  41. package/src/types/browser/lib/Valid.d.ts.map +0 -1
  42. package/src/types/browser/lib/vendor/dompurify.esm.d.ts +0 -29
  43. package/src/types/browser/lib/vendor/dompurify.esm.d.ts.map +0 -1
  44. package/src/types/index.d.ts +0 -20
  45. package/src/types/index.d.ts.map +0 -1
  46. package/src/types/lib/Cache.d.ts +0 -27
  47. package/src/types/lib/Cache.d.ts.map +0 -1
  48. package/src/types/lib/CappedDirectoryObject.d.ts +0 -144
  49. package/src/types/lib/CappedDirectoryObject.d.ts.map +0 -1
  50. package/src/types/lib/DirectoryObject.d.ts +0 -277
  51. package/src/types/lib/DirectoryObject.d.ts.map +0 -1
  52. package/src/types/lib/FS.d.ts +0 -188
  53. package/src/types/lib/FS.d.ts.map +0 -1
  54. package/src/types/lib/FileObject.d.ts +0 -238
  55. package/src/types/lib/FileObject.d.ts.map +0 -1
  56. package/src/types/lib/Glog.d.ts +0 -228
  57. package/src/types/lib/Glog.d.ts.map +0 -1
  58. package/src/types/lib/Logger.d.ts +0 -46
  59. package/src/types/lib/Logger.d.ts.map +0 -1
  60. package/src/types/lib/Notify.d.ts +0 -54
  61. package/src/types/lib/Notify.d.ts.map +0 -1
  62. package/src/types/lib/Sass.d.ts +0 -9
  63. package/src/types/lib/Sass.d.ts.map +0 -1
  64. package/src/types/lib/Tantrum.d.ts +0 -9
  65. package/src/types/lib/Tantrum.d.ts.map +0 -1
  66. package/src/types/lib/TempDirectoryObject.d.ts +0 -42
  67. package/src/types/lib/TempDirectoryObject.d.ts.map +0 -1
  68. package/src/types/lib/Term.d.ts +0 -127
  69. package/src/types/lib/Term.d.ts.map +0 -1
  70. package/src/types/lib/Util.d.ts +0 -100
  71. package/src/types/lib/Util.d.ts.map +0 -1
  72. package/src/types/lib/Valid.d.ts +0 -33
  73. package/src/types/lib/Valid.d.ts.map +0 -1
  74. /package/src/{lib → node/lib}/Cache.js +0 -0
  75. /package/src/{lib → node/lib}/Notify.js +0 -0
  76. /package/src/{lib → node/lib}/Term.js +0 -0
@@ -1,277 +0,0 @@
1
- /**
2
- * DirectoryObject encapsulates metadata and operations for a directory,
3
- * providing immutable path resolution, existence checks, and content enumeration.
4
- *
5
- * Features:
6
- * - Immutable metadata (path, name, URL) sealed on construction
7
- * - Async existence checking and directory creation
8
- * - Pattern-based content filtering with glob support
9
- * - Path traversal via walkUp generator
10
- * - Intelligent path merging for subdirectories and files
11
- *
12
- * @property {string} supplied - The original directory path as supplied to constructor
13
- * @property {string} path - The absolute resolved directory path
14
- * @property {URL} url - The directory as a file:// URL
15
- * @property {string} name - The directory name (basename)
16
- * @property {string} module - The directory name without extension (same as name for directories)
17
- * @property {string} extension - The directory extension (typically empty string)
18
- * @property {string} sep - Platform-specific path separator ('/' or '\\')
19
- * @property {Array<string>} trail - Path segments split by separator
20
- * @property {boolean} isFile - Always false (this is a directory)
21
- * @property {boolean} isDirectory - Always true
22
- * @property {DirectoryObject|null} parent - The parent directory (null if root)
23
- * @property {Promise<boolean>} exists - Whether the directory exists (async getter)
24
- * @property {Generator<DirectoryObject>} walkUp - Generator yielding parent directories up to root
25
- *
26
- * @example
27
- * // Basic usage
28
- * const dir = new DirectoryObject("/projects/myapp")
29
- * console.log(dir.path) // "/projects/myapp"
30
- * console.log(await dir.exists) // true/false
31
- *
32
- * @example
33
- * // Read directory contents
34
- * const {files, directories} = await dir.read()
35
- * const {files: jsFiles} = await dir.read("*.js")
36
- *
37
- * @example
38
- * // Path traversal
39
- * for(const parent of dir.walkUp) {
40
- * console.log(parent.path)
41
- * }
42
- *
43
- * @example
44
- * // Working with subdirectories and files
45
- * const subDir = dir.getDirectory("src/lib")
46
- * const file = dir.getFile("package.json")
47
- */
48
- export default class DirectoryObject extends FS {
49
- /**
50
- * Creates a DirectoryObject from the current working directory.
51
- * Useful when working with pnpx or other tools where the project root
52
- * needs to be determined at runtime.
53
- *
54
- * @returns {DirectoryObject} A DirectoryObject representing the current working directory
55
- * @example
56
- * const projectRoot = DirectoryObject.fromCwd()
57
- * console.log(projectRoot.path) // process.cwd()
58
- */
59
- static fromCwd(): DirectoryObject;
60
- /**
61
- * Constructs a DirectoryObject instance.
62
- *
63
- * @param {string?} [directory="."] - The directory path or DirectoryObject (defaults to current directory)
64
- */
65
- constructor(directory?: string | null);
66
- /**
67
- * Checks if the directory exists (async).
68
- *
69
- * @returns {Promise<boolean>} - A Promise that resolves to true or false
70
- */
71
- get exists(): Promise<boolean>;
72
- /**
73
- * Return the path as passed to the constructor.
74
- *
75
- * @returns {string} The directory path
76
- */
77
- get supplied(): string;
78
- /**
79
- * Return the resolved path
80
- *
81
- * @returns {string} The directory path
82
- */
83
- get path(): string;
84
- /**
85
- * Returns the URL of the current directory.
86
- *
87
- * @returns {URL} The directory URL
88
- */
89
- get url(): URL;
90
- /**
91
- * Returns the directory name with extension (if any) without the path.
92
- *
93
- * @returns {string} The directory name
94
- */
95
- get name(): string;
96
- /**
97
- * Returns the directory name without the path or extension.
98
- *
99
- * @returns {string} The directory name without extension
100
- */
101
- get module(): string;
102
- /**
103
- * Returns the directory extension. Will be an empty string if unavailable.
104
- *
105
- * @returns {string} The directory extension
106
- */
107
- get extension(): string;
108
- /**
109
- * Returns the platform-specific path separator.
110
- *
111
- * @returns {string} The path separator ('/' on Unix, '\\' on Windows)
112
- */
113
- get sep(): string;
114
- /**
115
- * Returns the directory path split into segments.
116
- *
117
- * @returns {Array<string>} Array of path segments
118
- * @example
119
- * const dir = new DirectoryObject('/path/to/directory')
120
- * console.log(dir.trail) // ['', 'path', 'to', 'directory']
121
- */
122
- get trail(): Array<string>;
123
- /**
124
- * Returns the parent directory of this directory.
125
- * Returns null if this directory is the root directory.
126
- * Computed lazily on first access and cached.
127
- *
128
- * @returns {DirectoryObject|null} The parent directory or null if root
129
- * @example
130
- * const dir = new DirectoryObject('/path/to/directory')
131
- * console.log(dir.parent.path) // '/path/to'
132
- *
133
- * const root = new DirectoryObject('/')
134
- * console.log(root.parent) // null
135
- */
136
- get parent(): DirectoryObject | null;
137
- /**
138
- * Returns false. Because this is a directory.
139
- *
140
- * @returns {boolean} Always false
141
- */
142
- get isFile(): boolean;
143
- /**
144
- * We're a directory!
145
- *
146
- * @returns {boolean} Always true
147
- */
148
- get isDirectory(): boolean;
149
- /**
150
- * Lists the contents of a directory, optionally filtered by a glob pattern.
151
- *
152
- * @async
153
- * @param {string} [pat=""] - Optional glob pattern to filter results (e.g., "*.txt", "test-*")
154
- * @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} Object containing arrays of files and directories
155
- * @example
156
- * const dir = new DirectoryObject("./src")
157
- * const {files, directories} = await dir.read()
158
- * console.log(files) // All files in ./src
159
- *
160
- * @example
161
- * // Filter for specific files
162
- * const {files} = await dir.read("*.js")
163
- * console.log(files) // Only .js files in ./src
164
- */
165
- read(pat?: string): Promise<{
166
- files: Array<FileObject>;
167
- directories: Array<DirectoryObject>;
168
- }>;
169
- /**
170
- * Ensures a directory exists, creating it if necessary.
171
- * Gracefully handles the case where the directory already exists.
172
- *
173
- * @async
174
- * @param {object} [options] - Options to pass to fs.mkdir (e.g., {recursive: true, mode: 0o755})
175
- * @returns {Promise<void>}
176
- * @throws {Sass} If directory creation fails for reasons other than already existing
177
- * @example
178
- * // Create directory recursively
179
- * const dir = new DirectoryObject('./build/output')
180
- * await dir.assureExists({recursive: true})
181
- */
182
- assureExists(options?: object): Promise<void>;
183
- /**
184
- * Generator that walks up the directory tree, yielding each parent directory.
185
- * Starts from the current directory and yields each parent until reaching the root.
186
- *
187
- * @returns {DirectoryObject} Generator yielding parent DirectoryObject instances
188
- * @example
189
- * const dir = new DirectoryObject('/path/to/deep/directory')
190
- * for(const parent of dir.walkUp) {
191
- * console.log(parent.path)
192
- * // /path/to/deep/directory
193
- * // /path/to/deep
194
- * // /path/to
195
- * // /path
196
- * // /
197
- * }
198
- */
199
- get walkUp(): DirectoryObject;
200
- /**
201
- * Deletes an empty directory from the filesystem.
202
- *
203
- * Recursive deletion is intentionally not supported. If you need to delete
204
- * a directory with contents, you must imperatively decide your deletion
205
- * strategy and handle it explicitly.
206
- *
207
- * @returns {Promise<void>} Resolves when directory is deleted
208
- * @throws {Sass} If the directory URL is invalid
209
- * @throws {Sass} If the directory does not exist
210
- * @throws {Error} If the directory is not empty (from fs.rmdir)
211
- * @example
212
- * const dir = new DirectoryObject('./temp/cache')
213
- * await dir.delete() // Only works if directory is empty
214
- */
215
- delete(): Promise<void>;
216
- /**
217
- * Checks if a file exists within this directory.
218
- *
219
- * @param {string} filename - The filename to check for
220
- * @returns {Promise<boolean>} True if the file exists, false otherwise
221
- */
222
- hasFile(filename: string): Promise<boolean>;
223
- /**
224
- * Checks if a subdirectory exists within this directory.
225
- *
226
- * @param {string} dirname - The directory name to check for
227
- * @returns {Promise<boolean>} True if the directory exists, false otherwise
228
- */
229
- hasDirectory(dirname: string): Promise<boolean>;
230
- /**
231
- * Creates a new DirectoryObject by extending this directory's path.
232
- *
233
- * Uses intelligent path merging that detects overlapping segments to avoid
234
- * duplication (e.g., "/projects/toolkit" + "toolkit/src" = "/projects/toolkit/src").
235
- * The temporary flag is preserved from the parent directory.
236
- *
237
- * @param {string} dir - The subdirectory path to append (can be nested like "src/lib")
238
- * @returns {DirectoryObject} A new DirectoryObject instance with the combined path
239
- * @throws {Sass} If newPath is not a string
240
- * @example
241
- * const dir = new DirectoryObject("/projects/git/toolkit")
242
- * const subDir = dir.getDirectory("src/lib")
243
- * console.log(subDir.path) // "/projects/git/toolkit/src/lib"
244
- *
245
- * @example
246
- * // Handles overlapping segments intelligently
247
- * const dir = new DirectoryObject("/projects/toolkit")
248
- * const subDir = dir.getDirectory("toolkit/src")
249
- * console.log(subDir.path) // "/projects/toolkit/src" (not /projects/toolkit/toolkit/src)
250
- */
251
- getDirectory(dir: string): DirectoryObject;
252
- /**
253
- * Creates a new FileObject by extending this directory's path.
254
- *
255
- * Uses intelligent path merging that detects overlapping segments to avoid
256
- * duplication. The resulting FileObject can be used for reading, writing,
257
- * and other file operations.
258
- *
259
- * @param {string} file - The filename to append (can include subdirectories like "src/index.js")
260
- * @returns {FileObject} A new FileObject instance with the combined path
261
- * @throws {Sass} If filename is not a string
262
- * @example
263
- * const dir = new DirectoryObject("/projects/git/toolkit")
264
- * const file = dir.getFile("package.json")
265
- * console.log(file.path) // "/projects/git/toolkit/package.json"
266
- *
267
- * @example
268
- * // Can include nested paths
269
- * const file = dir.getFile("src/index.js")
270
- * const data = await file.read()
271
- */
272
- getFile(file: string): FileObject;
273
- #private;
274
- }
275
- import FS from "./FS.js";
276
- import FileObject from "./FileObject.js";
277
- //# sourceMappingURL=DirectoryObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/DirectoryObject.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH;IAmEE;;;;;;;;;OASG;IACH,kBALa,eAAe,CAO3B;IA/CD;;;;OAIG;IACH,wBAFW,MAAM,OAAC,EA8BjB;IA2BD;;;;OAIG;IACH,cAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;IAED;;;;OAIG;IACH,gBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,WAFa,GAAG,CAIf;IAED;;;;OAIG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,cAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,WAFa,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,aALa,KAAK,CAAC,MAAM,CAAC,CAOzB;IAED;;;;;;;;;;;;OAYG;IACH,cARa,eAAe,GAAC,IAAI,CAsBhC;IAED;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,mBAFa,OAAO,CAInB;IAqBD;;;;;;;;;;;;;;;OAeG;IACH,WAZW,MAAM,GACJ,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;KAAC,CAAC,CAiDpF;IAED;;;;;;;;;;;;OAYG;IACH,uBARW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAqBzB;IAyBD;;;;;;;;;;;;;;;OAeG;IACH,cAZa,eAAe,CAc3B;IAED;;;;;;;;;;;;;;OAcG;IACH,UARa,OAAO,CAAC,IAAI,CAAC,CAkBzB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAM5B;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IAUD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kBAdW,MAAM,GACJ,eAAe,CAqB3B;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAbW,MAAM,GACJ,UAAU,CAoBtB;;CACF;eA9hBc,SAAS;uBACD,iBAAiB"}
@@ -1,188 +0,0 @@
1
- /**
2
- * File system utility class for path operations and file discovery.
3
- */
4
- export default class FS {
5
- static fdTypes: readonly string[];
6
- static upperFdTypes: readonly string[];
7
- static fdType: any;
8
- /**
9
- * Fix slashes in a path
10
- *
11
- * @static
12
- * @param {string} pathName - The path to fix
13
- * @returns {string} The fixed path
14
- */
15
- static fixSlashes(pathName: string): string;
16
- /**
17
- * Convert a path to a URI
18
- *
19
- * @static
20
- * @param {string} pathName - The path to convert
21
- * @returns {string} The URI
22
- */
23
- static pathToUrl(pathName: string): string;
24
- /**
25
- * Convert a URI to a path
26
- *
27
- * @static
28
- * @param {string} pathName - The URI to convert
29
- * @returns {string} The path
30
- */
31
- static urlToPath(pathName: string): string;
32
- /**
33
- * Computes the relative path from one file or directory to another.
34
- *
35
- * If the target is outside the source (i.e., the relative path starts with
36
- * ".."), returns the absolute path to the target instead.
37
- *
38
- * @static
39
- * @param {FileObject|DirectoryObject} from - The source file or directory object
40
- * @param {FileObject|DirectoryObject} to - The target file or directory object
41
- * @returns {string} The relative path from `from` to `to`, or the absolute path if not reachable
42
- */
43
- static relativeOrAbsolutePath(from: FileObject | DirectoryObject, to: FileObject | DirectoryObject): string;
44
- /**
45
- * Merge two paths by finding overlapping segments and combining them
46
- * efficiently
47
- *
48
- * @static
49
- * @param {string} path1 - The first path
50
- * @param {string} path2 - The second path to merge with the first
51
- * @param {string} [sep] - The path separator to use (defaults to system separator)
52
- * @returns {string} The merged path
53
- */
54
- static mergeOverlappingPaths(path1: string, path2: string, sep?: string): string;
55
- /**
56
- * Resolve a path relative to another path using various strategies
57
- * Handles absolute paths, relative navigation, and overlap-based merging
58
- *
59
- * @static
60
- * @param {string} fromPath - The base path to resolve from
61
- * @param {string} toPath - The target path to resolve
62
- * @returns {string} The resolved path
63
- */
64
- static resolvePath(fromPath: string, toPath: string): string;
65
- /**
66
- * Check if a candidate path is contained within a container path.
67
- *
68
- * @static
69
- * @param {string} container - The container path to check against
70
- * @param {string} candidate - The candidate path that might be contained
71
- * @returns {boolean} True if candidate is within container, false otherwise
72
- * @throws {Sass} If container is not a non-empty string
73
- * @throws {Sass} If candidate is not a non-empty string
74
- * @example
75
- * FS.pathContains("/home/user", "/home/user/docs") // true
76
- * FS.pathContains("/home/user", "/home/other") // false
77
- */
78
- static pathContains(container: string, candidate: string): boolean;
79
- /**
80
- * Convert an absolute path to a relative path by finding overlapping segments.
81
- * Returns the relative portion of the 'to' path after the last occurrence
82
- * of the final segment from the 'from' path.
83
- *
84
- * @static
85
- * @param {string} from - The base path to calculate relative from
86
- * @param {string} to - The target path to make relative
87
- * @param {string} [sep=path.sep] - The path separator to use (defaults to system separator)
88
- * @returns {string|null} The relative path, empty string if paths are identical, or null if no overlap found
89
- * @example
90
- * FS.toRelativePath("/projects/toolkit", "/projects/toolkit/src") // "src"
91
- * FS.toRelativePath("/home/user", "/home/user") // ""
92
- * FS.toRelativePath("/projects/app", "/other/path") // null
93
- */
94
- static toRelativePath(from: string, to: string, sep?: string): string | null;
95
- /**
96
- * Find the common root path between two paths by identifying overlapping segments.
97
- * Returns the portion of 'from' that matches up to the overlap point in 'to'.
98
- *
99
- * @static
100
- * @param {string} from - The first path to compare
101
- * @param {string} to - The second path to find common root with
102
- * @param {string} [sep=path.sep] - The path separator to use (defaults to system separator)
103
- * @returns {string|null} The common root path, the original path if identical, or null if no overlap found
104
- * @throws {Sass} If from is not a non-empty string
105
- * @throws {Sass} If to is not a non-empty string
106
- * @example
107
- * FS.getCommonRootPath("/projects/toolkit/src", "/projects/toolkit/tests") // "/projects/toolkit"
108
- * FS.getCommonRootPath("/home/user", "/home/user") // "/home/user"
109
- * FS.getCommonRootPath("/projects/app", "/other/path") // null
110
- */
111
- static getCommonRootPath(from: string, to: string, sep?: string): string | null;
112
- /**
113
- * @typedef {object} PathParts
114
- * @property {string} base - The file name with extension
115
- * @property {string} dir - The directory path
116
- * @property {string} ext - The file extension (including dot)
117
- */
118
- /**
119
- * Deconstruct a file or directory name into parts.
120
- *
121
- * @static
122
- * @param {string} pathName - The file/directory name to deconstruct
123
- * @returns {PathParts} The filename parts
124
- * @throws {Sass} If not a string of more than 1 character
125
- */
126
- static pathParts(pathName: string): {
127
- /**
128
- * - The file name with extension
129
- */
130
- base: string;
131
- /**
132
- * - The directory path
133
- */
134
- dir: string;
135
- /**
136
- * - The file extension (including dot)
137
- */
138
- ext: string;
139
- };
140
- /**
141
- * Convert a virtual capped path to its real filesystem path.
142
- * For capped objects, resolves the virtual path relative to the cap's real path.
143
- * For uncapped objects, returns the path unchanged.
144
- *
145
- * @static
146
- * @param {FileObject|DirectoryObject} fileOrDirectoryObject - The file or directory object to convert
147
- * @returns {string} The real filesystem path
148
- * @throws {Sass} If parameter is not a FileObject or DirectoryObject
149
- * @example
150
- * const temp = new TempDirectoryObject("myapp")
151
- * const file = temp.getFile("/config.json")
152
- * FS.virtualToRealPath(file) // "/tmp/myapp-ABC123/config.json"
153
- *
154
- * @example
155
- * const regular = new FileObject("/home/user/file.txt")
156
- * FS.virtualToRealPath(regular) // "/home/user/file.txt"
157
- */
158
- static virtualToRealPath(fileOrDirectoryObject: FileObject | DirectoryObject): string;
159
- /**
160
- * Convert an absolute path to a relative format by removing the root component.
161
- * By default, keeps a leading separator (making it "absolute-like relative").
162
- * Use forceActuallyRelative to get a truly relative path without leading separator.
163
- *
164
- * @static
165
- * @param {string} pathToCheck - The path to convert (returned unchanged if already relative)
166
- * @param {boolean} [forceActuallyRelative=false] - If true, removes leading separator for truly relative path
167
- * @returns {string} The relative path (with or without leading separator based on forceActuallyRelative)
168
- * @example
169
- * FS.absoluteToRelative("/home/user/docs") // "/home/user/docs" (with leading /)
170
- * FS.absoluteToRelative("/home/user/docs", true) // "home/user/docs" (truly relative)
171
- * FS.absoluteToRelative("relative/path") // "relative/path" (unchanged)
172
- */
173
- static absoluteToRelative(pathToCheck: string, forceActuallyRelative?: boolean): string;
174
- /**
175
- * Compute the relative path from another file or directory to this instance.
176
- *
177
- * If the target is outside the source (i.e., the relative path starts with ".."),
178
- * returns the absolute path to this instance instead.
179
- *
180
- * @param {FileObject|DirectoryObject} fileOrDirectoryObject - The source file or directory object
181
- * @returns {string} The relative path from the source to this instance, or the absolute path if not reachable
182
- * @throws {Sass} If the parameter is not a FileObject or DirectoryObject
183
- */
184
- relativeTo(fileOrDirectoryObject: FileObject | DirectoryObject): string;
185
- }
186
- export type FileObject = import("./FileObject.js").default;
187
- export type DirectoryObject = import("./DirectoryObject.js").default;
188
- //# sourceMappingURL=FS.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../../lib/FS.js"],"names":[],"mappings":"AA0BA;;GAEG;AACH;IACE,kCAAwB;IACxB,uCAAkC;IAClC,mBAAsB;IAsBtB;;;;;;OAMG;IACH,4BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,2BAHW,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;OAMG;IACH,2BAHW,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;;;;;OAUG;IACH,oCAJW,UAAU,GAAC,eAAe,MAC1B,UAAU,GAAC,eAAe,GACxB,MAAM,CAYlB;IAED;;;;;;;;;OASG;IACH,oCALW,MAAM,SACN,MAAM,QACN,MAAM,GACJ,MAAM,CA0BlB;IAED;;;;;;;;OAQG;IACH,6BAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAmClB;IAED;;;;;;;;;;;;OAYG;IACH,+BATW,MAAM,aACN,MAAM,GACJ,OAAO,CAcnB;IAED;;;;;;;;;;;;;;OAcG;IACH,4BATW,MAAM,MACN,MAAM,QACN,MAAM,GACJ,MAAM,GAAC,IAAI,CAwBvB;IAED;;;;;;;;;;;;;;;OAeG;IACH,+BAXW,MAAM,MACN,MAAM,QACN,MAAM,GACJ,MAAM,GAAC,IAAI,CA+BvB;IAED;;;;;OAKG;IAEH;;;;;;;OAOG;IACH,2BAJW,MAAM;;;;cATH,MAAM;;;;aACN,MAAM;;;;aACN,MAAM;MAenB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,gDAZW,UAAU,GAAC,eAAe,GACxB,MAAM,CAiClB;IAED;;;;;;;;;;;;;OAaG;IACH,uCARW,MAAM,0BACN,OAAO,GACL,MAAM,CAkBlB;IA/VD;;;;;;;;;OASG;IACH,kCAJW,UAAU,GAAC,eAAe,GACxB,MAAM,CAWlB;CA8UF;yBAjXa,OAAO,iBAAiB,EAAE,OAAO;8BACjC,OAAO,sBAAsB,EAAE,OAAO"}