@gesslar/toolkit 3.12.3 → 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 (77) 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 -88
  5. package/src/{lib → node/lib}/FileObject.js +78 -179
  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/node/lib/VDirectoryObject.js +198 -0
  14. package/src/node/lib/VFileObject.js +61 -0
  15. package/src/{lib → node/lib}/Valid.js +11 -5
  16. package/src/lib/CappedDirectoryObject.js +0 -276
  17. package/src/types/browser/index.d.ts +0 -13
  18. package/src/types/browser/index.d.ts.map +0 -1
  19. package/src/types/browser/lib/Collection.d.ts +0 -248
  20. package/src/types/browser/lib/Collection.d.ts.map +0 -1
  21. package/src/types/browser/lib/Data.d.ts +0 -250
  22. package/src/types/browser/lib/Data.d.ts.map +0 -1
  23. package/src/types/browser/lib/Disposer.d.ts +0 -33
  24. package/src/types/browser/lib/Disposer.d.ts.map +0 -1
  25. package/src/types/browser/lib/HTML.d.ts +0 -40
  26. package/src/types/browser/lib/HTML.d.ts.map +0 -1
  27. package/src/types/browser/lib/Notify.d.ts +0 -60
  28. package/src/types/browser/lib/Notify.d.ts.map +0 -1
  29. package/src/types/browser/lib/Promised.d.ts +0 -119
  30. package/src/types/browser/lib/Promised.d.ts.map +0 -1
  31. package/src/types/browser/lib/Sass.d.ts +0 -63
  32. package/src/types/browser/lib/Sass.d.ts.map +0 -1
  33. package/src/types/browser/lib/Tantrum.d.ts +0 -52
  34. package/src/types/browser/lib/Tantrum.d.ts.map +0 -1
  35. package/src/types/browser/lib/Time.d.ts +0 -42
  36. package/src/types/browser/lib/Time.d.ts.map +0 -1
  37. package/src/types/browser/lib/TypeSpec.d.ts +0 -90
  38. package/src/types/browser/lib/TypeSpec.d.ts.map +0 -1
  39. package/src/types/browser/lib/Util.d.ts +0 -62
  40. package/src/types/browser/lib/Util.d.ts.map +0 -1
  41. package/src/types/browser/lib/Valid.d.ts +0 -33
  42. package/src/types/browser/lib/Valid.d.ts.map +0 -1
  43. package/src/types/browser/lib/vendor/dompurify.esm.d.ts +0 -29
  44. package/src/types/browser/lib/vendor/dompurify.esm.d.ts.map +0 -1
  45. package/src/types/index.d.ts +0 -20
  46. package/src/types/index.d.ts.map +0 -1
  47. package/src/types/lib/Cache.d.ts +0 -27
  48. package/src/types/lib/Cache.d.ts.map +0 -1
  49. package/src/types/lib/CappedDirectoryObject.d.ts +0 -144
  50. package/src/types/lib/CappedDirectoryObject.d.ts.map +0 -1
  51. package/src/types/lib/DirectoryObject.d.ts +0 -288
  52. package/src/types/lib/DirectoryObject.d.ts.map +0 -1
  53. package/src/types/lib/FS.d.ts +0 -188
  54. package/src/types/lib/FS.d.ts.map +0 -1
  55. package/src/types/lib/FileObject.d.ts +0 -245
  56. package/src/types/lib/FileObject.d.ts.map +0 -1
  57. package/src/types/lib/Glog.d.ts +0 -228
  58. package/src/types/lib/Glog.d.ts.map +0 -1
  59. package/src/types/lib/Logger.d.ts +0 -46
  60. package/src/types/lib/Logger.d.ts.map +0 -1
  61. package/src/types/lib/Notify.d.ts +0 -54
  62. package/src/types/lib/Notify.d.ts.map +0 -1
  63. package/src/types/lib/Sass.d.ts +0 -9
  64. package/src/types/lib/Sass.d.ts.map +0 -1
  65. package/src/types/lib/Tantrum.d.ts +0 -9
  66. package/src/types/lib/Tantrum.d.ts.map +0 -1
  67. package/src/types/lib/TempDirectoryObject.d.ts +0 -42
  68. package/src/types/lib/TempDirectoryObject.d.ts.map +0 -1
  69. package/src/types/lib/Term.d.ts +0 -127
  70. package/src/types/lib/Term.d.ts.map +0 -1
  71. package/src/types/lib/Util.d.ts +0 -100
  72. package/src/types/lib/Util.d.ts.map +0 -1
  73. package/src/types/lib/Valid.d.ts +0 -33
  74. package/src/types/lib/Valid.d.ts.map +0 -1
  75. /package/src/{lib → node/lib}/Cache.js +0 -0
  76. /package/src/{lib → node/lib}/Notify.js +0 -0
  77. /package/src/{lib → node/lib}/Term.js +0 -0
@@ -1,144 +0,0 @@
1
- /**
2
- * CappedDirectoryObject extends DirectoryObject with constraints that ensure
3
- * all operations are restricted to a specific directory tree (the "cap").
4
- *
5
- * All path operations are validated to ensure they remain within the
6
- * cap directory hierarchy for security.
7
- *
8
- * @augments DirectoryObject
9
- */
10
- export default class CappedDirectoryObject extends DirectoryObject {
11
- /**
12
- * Creates a CappedDirectoryObject from the current working directory.
13
- * This is useful when working with pnpx or other tools where you need to
14
- * cap at the project's root directory determined at runtime.
15
- *
16
- * @returns {CappedDirectoryObject} A CappedDirectoryObject capped at the current working directory
17
- * @example
18
- * // When using pnpx or similar tools
19
- * const projectRoot = CappedDirectoryObject.fromCwd()
20
- * const srcDir = projectRoot.getDirectory("src")
21
- * // srcDir is capped at the project root
22
- */
23
- static fromCwd(): CappedDirectoryObject;
24
- /**
25
- * Constructs a CappedDirectoryObject instance.
26
- *
27
- * Without a parent, the path becomes both the directory location and the cap
28
- * (virtual root). With a parent, the path is resolved relative to the parent's
29
- * cap using virtual path semantics (absolute paths treated as cap-relative).
30
- *
31
- * @param {string} [directory="."] - Directory path (becomes cap if no parent, else relative to parent's cap, defaults to current directory)
32
- * @param {CappedDirectoryObject?} [parent] - Optional parent capped directory
33
- * @throws {Sass} If parent is provided but not a CappedDirectoryObject
34
- * @throws {Sass} If the resulting path would escape the cap
35
- * @example
36
- * // Create new capped directory at current directory
37
- * const cwd = new CappedDirectoryObject()
38
- * // path: process.cwd(), cap: process.cwd()
39
- *
40
- * @example
41
- * // Create new capped directory
42
- * const cache = new CappedDirectoryObject("/home/user/.cache")
43
- * // path: /home/user/.cache, cap: /home/user/.cache
44
- *
45
- * @example
46
- * // Create subdirectory with parent
47
- * const data = new CappedDirectoryObject("data", cache)
48
- * // path: /home/user/.cache/data, cap: /home/user/.cache
49
- *
50
- * @example
51
- * // Virtual absolute path with parent
52
- * const config = new CappedDirectoryObject("/etc/config", cache)
53
- * // path: /home/user/.cache/etc/config, cap: /home/user/.cache
54
- */
55
- constructor(directory?: string, source?: any);
56
- /**
57
- * Indicates whether this directory is capped (constrained to a specific tree).
58
- * Always returns true for CappedDirectoryObject instances.
59
- *
60
- * @returns {boolean} True for all CappedDirectoryObject instances
61
- * @example
62
- * const capped = new TempDirectoryObject("myapp")
63
- * console.log(capped.isCapped) // true
64
- *
65
- * const regular = new DirectoryObject("/tmp")
66
- * console.log(regular.isCapped) // false
67
- */
68
- get isCapped(): boolean;
69
- /**
70
- * Returns the cap (root) of the capped directory tree.
71
- * For root CappedDirectoryObject instances, returns itself.
72
- * For children, returns the inherited cap from the parent chain.
73
- *
74
- * @returns {CappedDirectoryObject} The cap directory object (root of the capped tree)
75
- * @example
76
- * const temp = new TempDirectoryObject("myapp")
77
- * console.log(temp.cap === temp) // true (root is its own cap)
78
- *
79
- * const subdir = temp.getDirectory("data")
80
- * console.log(subdir.cap === temp) // true (child inherits parent's cap)
81
- */
82
- get cap(): CappedDirectoryObject;
83
- /**
84
- * Returns a plain DirectoryObject representing the actual filesystem location.
85
- * This provides an "escape hatch" from the capped environment to interact
86
- * with the real filesystem when needed.
87
- *
88
- * @returns {DirectoryObject} Uncapped directory object at the real filesystem path
89
- * @example
90
- * const temp = new TempDirectoryObject("myapp")
91
- * const subdir = temp.getDirectory("data")
92
- *
93
- * // Work within the capped environment (virtual paths)
94
- * console.log(subdir.path) // "/data" (virtual)
95
- * subdir.getFile("config.json") // Stays within cap
96
- *
97
- * // Break out to real filesystem when needed
98
- * console.log(subdir.real.path) // "/tmp/myapp-ABC123/data" (real)
99
- * subdir.real.parent // Can traverse outside the cap
100
- */
101
- get real(): DirectoryObject;
102
- /**
103
- * Returns the parent directory of this capped directory.
104
- * Returns null only if this directory is at the cap (the "root" of the capped tree).
105
- *
106
- * Note: The returned parent is a CappedDirectoryObject with the same cap.
107
- * This maintains the capping behavior throughout the directory hierarchy.
108
- *
109
- * @returns {CappedDirectoryObject|null} Parent directory or null if at cap root
110
- * @example
111
- * const capped = new TempDirectoryObject("myapp")
112
- * const subdir = capped.getDirectory("data")
113
- * console.log(subdir.parent.path) // Returns parent CappedDirectoryObject
114
- * console.log(capped.parent) // null (at cap root)
115
- */
116
- get parent(): CappedDirectoryObject | null;
117
- /**
118
- * Returns the path of the parent directory.
119
- * Returns null if this directory is at the cap root (no parent).
120
- *
121
- * @returns {string|null} The parent directory path, or null if at cap root
122
- * @example
123
- * const temp = new TempDirectoryObject("myapp")
124
- * console.log(temp.parentPath) // null (at cap root)
125
- *
126
- * const subdir = temp.getDirectory("data")
127
- * console.log(subdir.parentPath) // "/data" or similar (parent's virtual path)
128
- */
129
- get parentPath(): string | null;
130
- /**
131
- * Override read to use real filesystem path and return capped objects.
132
- *
133
- * @param {string} [pat=""] - Optional glob pattern
134
- * @returns {Promise<{files: Array<FileObject>, directories: Array}>} Directory contents
135
- */
136
- read(...arg: any[]): Promise<{
137
- files: Array<FileObject>;
138
- directories: any[];
139
- }>;
140
- #private;
141
- }
142
- import DirectoryObject from "./DirectoryObject.js";
143
- import FileObject from "./FileObject.js";
144
- //# sourceMappingURL=CappedDirectoryObject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CappedDirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/CappedDirectoryObject.js"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH;IAoEE;;;;;;;;;;;OAWG;IACH,kBAPa,qBAAqB,CASjC;IA5ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,wBAxBW,MAAM,gBAqDhB;IAkBD;;;;;;;;;;;OAWG;IACH,gBARa,OAAO,CAUnB;IAED;;;;;;;;;;;;OAYG;IACH,WARa,qBAAqB,CAUjC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,YAba,eAAe,CAe3B;IAED;;;;;;;;;;;;;OAaG;IACH,cAPa,qBAAqB,GAAC,IAAI,CAStC;IAED;;;;;;;;;;;OAWG;IACH,kBARa,MAAM,GAAC,IAAI,CAUvB;IAkCD;;;;;OAKG;IACH,qBAFa,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,WAAW,QAAO;KAAC,CAAC,CAUnE;;CA8BF;4BAvQ2B,sBAAsB;uBAC3B,iBAAiB"}
@@ -1,288 +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
- * Returns a JSON representation of the DirectoryObject.
68
- *
69
- * @returns {object} JSON representation of the DirectoryObject
70
- */
71
- toJSON(): object;
72
- /**
73
- * Custom inspect method for Node.js console.
74
- *
75
- * @returns {object} JSON representation of this object.
76
- */
77
- /**
78
- * Checks if the directory exists (async).
79
- *
80
- * @returns {Promise<boolean>} - A Promise that resolves to true or false
81
- */
82
- get exists(): Promise<boolean>;
83
- /**
84
- * Return the path as passed to the constructor.
85
- *
86
- * @returns {string} The directory path
87
- */
88
- get supplied(): string;
89
- /**
90
- * Return the resolved path
91
- *
92
- * @returns {string} The directory path
93
- */
94
- get path(): string;
95
- /**
96
- * Returns the URL of the current directory.
97
- *
98
- * @returns {URL} The directory URL
99
- */
100
- get url(): URL;
101
- /**
102
- * Returns the directory name with extension (if any) without the path.
103
- *
104
- * @returns {string} The directory name
105
- */
106
- get name(): string;
107
- /**
108
- * Returns the directory name without the path or extension.
109
- *
110
- * @returns {string} The directory name without extension
111
- */
112
- get module(): string;
113
- /**
114
- * Returns the directory extension. Will be an empty string if unavailable.
115
- *
116
- * @returns {string} The directory extension
117
- */
118
- get extension(): string;
119
- /**
120
- * Returns the platform-specific path separator.
121
- *
122
- * @returns {string} The path separator ('/' on Unix, '\\' on Windows)
123
- */
124
- get sep(): string;
125
- /**
126
- * Returns the directory path split into segments.
127
- *
128
- * @returns {Array<string>} Array of path segments
129
- * @example
130
- * const dir = new DirectoryObject('/path/to/directory')
131
- * console.log(dir.trail) // ['', 'path', 'to', 'directory']
132
- */
133
- get trail(): Array<string>;
134
- /**
135
- * Returns the parent directory of this directory.
136
- * Returns null if this directory is the root directory.
137
- * Computed lazily on first access and cached.
138
- *
139
- * @returns {DirectoryObject|null} The parent directory or null if root
140
- * @example
141
- * const dir = new DirectoryObject('/path/to/directory')
142
- * console.log(dir.parent.path) // '/path/to'
143
- *
144
- * const root = new DirectoryObject('/')
145
- * console.log(root.parent) // null
146
- */
147
- get parent(): DirectoryObject | null;
148
- /**
149
- * Returns false. Because this is a directory.
150
- *
151
- * @returns {boolean} Always false
152
- */
153
- get isFile(): boolean;
154
- /**
155
- * We're a directory!
156
- *
157
- * @returns {boolean} Always true
158
- */
159
- get isDirectory(): boolean;
160
- /**
161
- * Lists the contents of a directory, optionally filtered by a glob pattern.
162
- *
163
- * @async
164
- * @param {string} [pat=""] - Optional glob pattern to filter results (e.g., "*.txt", "test-*")
165
- * @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} Object containing arrays of files and directories
166
- * @example
167
- * const dir = new DirectoryObject("./src")
168
- * const {files, directories} = await dir.read()
169
- * console.log(files) // All files in ./src
170
- *
171
- * @example
172
- * // Filter for specific files
173
- * const {files} = await dir.read("*.js")
174
- * console.log(files) // Only .js files in ./src
175
- */
176
- read(pat?: string): Promise<{
177
- files: Array<FileObject>;
178
- directories: Array<DirectoryObject>;
179
- }>;
180
- /**
181
- * Ensures a directory exists, creating it if necessary.
182
- * Gracefully handles the case where the directory already exists.
183
- *
184
- * @async
185
- * @param {object} [options] - Options to pass to fs.mkdir (e.g., {recursive: true, mode: 0o755})
186
- * @returns {Promise<void>}
187
- * @throws {Sass} If directory creation fails for reasons other than already existing
188
- * @example
189
- * // Create directory recursively
190
- * const dir = new DirectoryObject('./build/output')
191
- * await dir.assureExists({recursive: true})
192
- */
193
- assureExists(options?: object): Promise<void>;
194
- /**
195
- * Generator that walks up the directory tree, yielding each parent directory.
196
- * Starts from the current directory and yields each parent until reaching the root.
197
- *
198
- * @returns {DirectoryObject} Generator yielding parent DirectoryObject instances
199
- * @example
200
- * const dir = new DirectoryObject('/path/to/deep/directory')
201
- * for(const parent of dir.walkUp) {
202
- * console.log(parent.path)
203
- * // /path/to/deep/directory
204
- * // /path/to/deep
205
- * // /path/to
206
- * // /path
207
- * // /
208
- * }
209
- */
210
- get walkUp(): DirectoryObject;
211
- /**
212
- * Deletes an empty directory from the filesystem.
213
- *
214
- * Recursive deletion is intentionally not supported. If you need to delete
215
- * a directory with contents, you must imperatively decide your deletion
216
- * strategy and handle it explicitly.
217
- *
218
- * @returns {Promise<void>} Resolves when directory is deleted
219
- * @throws {Sass} If the directory URL is invalid
220
- * @throws {Sass} If the directory does not exist
221
- * @throws {Error} If the directory is not empty (from fs.rmdir)
222
- * @example
223
- * const dir = new DirectoryObject('./temp/cache')
224
- * await dir.delete() // Only works if directory is empty
225
- */
226
- delete(): Promise<void>;
227
- /**
228
- * Checks if a file exists within this directory.
229
- *
230
- * @param {string} filename - The filename to check for
231
- * @returns {Promise<boolean>} True if the file exists, false otherwise
232
- */
233
- hasFile(filename: string): Promise<boolean>;
234
- /**
235
- * Checks if a subdirectory exists within this directory.
236
- *
237
- * @param {string} dirname - The directory name to check for
238
- * @returns {Promise<boolean>} True if the directory exists, false otherwise
239
- */
240
- hasDirectory(dirname: string): Promise<boolean>;
241
- /**
242
- * Creates a new DirectoryObject by extending this directory's path.
243
- *
244
- * Uses intelligent path merging that detects overlapping segments to avoid
245
- * duplication (e.g., "/projects/toolkit" + "toolkit/src" = "/projects/toolkit/src").
246
- * The temporary flag is preserved from the parent directory.
247
- *
248
- * @param {string} dir - The subdirectory path to append (can be nested like "src/lib")
249
- * @returns {DirectoryObject} A new DirectoryObject instance with the combined path
250
- * @throws {Sass} If newPath is not a string
251
- * @example
252
- * const dir = new DirectoryObject("/projects/git/toolkit")
253
- * const subDir = dir.getDirectory("src/lib")
254
- * console.log(subDir.path) // "/projects/git/toolkit/src/lib"
255
- *
256
- * @example
257
- * // Handles overlapping segments intelligently
258
- * const dir = new DirectoryObject("/projects/toolkit")
259
- * const subDir = dir.getDirectory("toolkit/src")
260
- * console.log(subDir.path) // "/projects/toolkit/src" (not /projects/toolkit/toolkit/src)
261
- */
262
- getDirectory(dir: string): DirectoryObject;
263
- /**
264
- * Creates a new FileObject by extending this directory's path.
265
- *
266
- * Uses intelligent path merging that detects overlapping segments to avoid
267
- * duplication. The resulting FileObject can be used for reading, writing,
268
- * and other file operations.
269
- *
270
- * @param {string} file - The filename to append (can include subdirectories like "src/index.js")
271
- * @returns {FileObject} A new FileObject instance with the combined path
272
- * @throws {Sass} If filename is not a string
273
- * @example
274
- * const dir = new DirectoryObject("/projects/git/toolkit")
275
- * const file = dir.getFile("package.json")
276
- * console.log(file.path) // "/projects/git/toolkit/package.json"
277
- *
278
- * @example
279
- * // Can include nested paths
280
- * const file = dir.getFile("src/index.js")
281
- * const data = await file.read()
282
- */
283
- getFile(file: string): FileObject;
284
- #private;
285
- }
286
- import FS from "./FS.js";
287
- import FileObject from "./FileObject.js";
288
- //# 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;IA+BD;;;;OAIG;IACH,UAFa,MAAM,CAclB;IAED;;;;OAIG;IAKH;;;;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;eA9jBc,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"}