@gesslar/toolkit 3.22.2 β†’ 3.24.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 (41) hide show
  1. package/README.md +2 -5
  2. package/package.json +10 -4
  3. package/src/browser/lib/Data.js +16 -2
  4. package/src/browser/lib/OObject.js +196 -0
  5. package/src/browser/lib/Promised.js +4 -2
  6. package/src/browser/lib/Time.js +4 -2
  7. package/src/browser/lib/TypeSpec.js +24 -5
  8. package/src/node/index.js +0 -3
  9. package/src/node/lib/DirectoryObject.js +100 -212
  10. package/src/node/lib/FileObject.js +71 -44
  11. package/src/node/lib/FileSystem.js +11 -48
  12. package/src/node/lib/Glog.js +2 -12
  13. package/src/node/lib/Valid.js +8 -1
  14. package/types/browser/lib/Data.d.ts +26 -4
  15. package/types/browser/lib/Data.d.ts.map +1 -1
  16. package/types/browser/lib/OObject.d.ts +127 -0
  17. package/types/browser/lib/OObject.d.ts.map +1 -0
  18. package/types/browser/lib/Promised.d.ts.map +1 -1
  19. package/types/browser/lib/Time.d.ts.map +1 -1
  20. package/types/browser/lib/TypeSpec.d.ts +42 -6
  21. package/types/browser/lib/TypeSpec.d.ts.map +1 -1
  22. package/types/node/index.d.ts +0 -3
  23. package/types/node/lib/DirectoryObject.d.ts +93 -51
  24. package/types/node/lib/DirectoryObject.d.ts.map +1 -1
  25. package/types/node/lib/FileObject.d.ts +12 -7
  26. package/types/node/lib/FileObject.d.ts.map +1 -1
  27. package/types/node/lib/FileSystem.d.ts +16 -23
  28. package/types/node/lib/FileSystem.d.ts.map +1 -1
  29. package/types/node/lib/Glog.d.ts +0 -7
  30. package/types/node/lib/Glog.d.ts.map +1 -1
  31. package/types/node/lib/Valid.d.ts +17 -2
  32. package/types/node/lib/Valid.d.ts.map +1 -1
  33. package/src/node/lib/TempDirectoryObject.js +0 -165
  34. package/src/node/lib/VDirectoryObject.js +0 -198
  35. package/src/node/lib/VFileObject.js +0 -110
  36. package/types/node/lib/TempDirectoryObject.d.ts +0 -42
  37. package/types/node/lib/TempDirectoryObject.d.ts.map +0 -1
  38. package/types/node/lib/VDirectoryObject.d.ts +0 -132
  39. package/types/node/lib/VDirectoryObject.d.ts.map +0 -1
  40. package/types/node/lib/VFileObject.d.ts +0 -33
  41. package/types/node/lib/VFileObject.d.ts.map +0 -1
@@ -13,9 +13,6 @@ export { default as FileObject } from "./lib/FileObject.js";
13
13
  export { default as FileSystem } from "./lib/FileSystem.js";
14
14
  export { default as Glog } from "./lib/Glog.js";
15
15
  export { default as Notify } from "./lib/Notify.js";
16
- export { default as TempDirectoryObject } from "./lib/TempDirectoryObject.js";
17
16
  export { default as Term } from "./lib/Term.js";
18
- export { default as VFileObject } from "./lib/VFileObject.js";
19
- export { default as VDirectoryObject } from "./lib/VDirectoryObject.js";
20
17
  export { default as Disposer, Disposer as DisposerClass } from "../browser/lib/Disposer.js";
21
18
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,24 @@
1
1
  /**
2
- * DirectoryObject encapsulates metadata and operations for a directory,
2
+ * @typedef {object} GeneratorType
3
+ * @property {function(): {value: DirectoryObject, done: boolean}} next
4
+ * @property {function(): GeneratorType} [Symbol.iterator]
5
+ */
6
+ /**
7
+ * @typedef {object} DirectoryMeta
8
+ *
9
+ * @property {boolean} isDirectory - Always true for directories
10
+ * @property {string|null} extension - The directory extension (if any)
11
+ * @property {string|null} module - The directory name without extension
12
+ * @property {string|null} name - The directory name
13
+ * @property {DirectoryObject|undefined} parent - The parent DirectoryObject
14
+ * @property {string|null} parentPath - The parent directory path
15
+ * @property {string|null} path - The absolute directory path
16
+ * @property {string|null} sep - Path separator
17
+ * @property {string|null} supplied - User-supplied path
18
+ * @property {Array<string>|null} trail - Path segments
19
+ * @property {URL|null} url - The directory URL
20
+ */
21
+ /** * DirectoryObject encapsulates metadata and operations for a directory,
3
22
  * providing immutable path resolution, existence checks, and content enumeration.
4
23
  *
5
24
  * Features:
@@ -20,7 +39,6 @@
20
39
  * @property {boolean} isDirectory - Always true
21
40
  * @property {DirectoryObject|null} parent - The parent directory (null if root)
22
41
  * @property {Promise<boolean>} exists - Whether the directory exists (async getter)
23
- * @property {Generator<DirectoryObject>} walkUp - Generator yielding parent directories up to root
24
42
  *
25
43
  * @example
26
44
  * // Basic usage
@@ -60,7 +78,6 @@ export default class DirectoryObject extends FS {
60
78
  * Constructs a DirectoryObject instance.
61
79
  *
62
80
  * @param {string?} [supplied="."] - The directory path (defaults to current directory)
63
- * @param {DirectoryObject?} [parent] - Optional parent directory (ignored by DirectoryObject, used by subclasses)
64
81
  */
65
82
  constructor(supplied?: string | null);
66
83
  /**
@@ -94,15 +111,15 @@ export default class DirectoryObject extends FS {
94
111
  */
95
112
  get name(): string;
96
113
  /**
97
- * Returns the directory name without the path or extension.
114
+ * Returns the directory name without extension.
98
115
  *
99
116
  * @returns {string} The directory name without extension
100
117
  */
101
118
  get module(): string;
102
119
  /**
103
- * Returns the directory extension. Will be an empty string if unavailable.
120
+ * Returns the directory extension (if any).
104
121
  *
105
- * @returns {string} The directory extension
122
+ * @returns {string} The directory extension including the dot (e.g., '.git')
106
123
  */
107
124
  get extension(): string;
108
125
  /**
@@ -144,11 +161,10 @@ export default class DirectoryObject extends FS {
144
161
  * Lists the contents of a directory, optionally filtered by a glob pattern.
145
162
  *
146
163
  * Returns FileObject and DirectoryObject instances for regular directories.
147
- * Returns VFileObject and VDirectoryObject instances when called on virtual directories.
148
164
  *
149
165
  * @async
150
166
  * @param {string} [pat=""] - Optional glob pattern to filter results (e.g., "*.txt", "test-*")
151
- * @returns {Promise<{files: Array<FileObject|VFileObject>, directories: Array<DirectoryObject|VDirectoryObject>}>} Object containing arrays of files and directories
167
+ * @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} Object containing arrays of files and directories
152
168
  * @example
153
169
  * const dir = new DirectoryObject("./src")
154
170
  * const {files, directories} = await dir.read()
@@ -160,19 +176,18 @@ export default class DirectoryObject extends FS {
160
176
  * console.log(files) // Only .js files in ./src
161
177
  */
162
178
  read(pat?: string): Promise<{
163
- files: Array<FileObject | VFileObject>;
164
- directories: Array<DirectoryObject | VDirectoryObject>;
179
+ files: Array<FileObject>;
180
+ directories: Array<DirectoryObject>;
165
181
  }>;
166
182
  /**
167
183
  * Recursively searches directory tree for files and directories matching a glob pattern.
168
184
  * Unlike read(), this method searches recursively through subdirectories.
169
185
  *
170
186
  * Returns FileObject and DirectoryObject instances for regular directories.
171
- * Returns VFileObject and VDirectoryObject instances when called on virtual directories.
172
187
  *
173
188
  * @async
174
189
  * @param {string} [pat=""] - Glob pattern to filter results
175
- * @returns {Promise<{files: Array<FileObject|VFileObject>, directories: Array<DirectoryObject|VDirectoryObject>}>} Object containing arrays of matching files and directories
190
+ * @returns {Promise<{files: Array<FileObject|FileObject>, directories: Array<DirectoryObject>}>} Object containing arrays of matching files and directories
176
191
  * @throws {Sass} If an entry is neither a file nor directory
177
192
  * @example
178
193
  * const dir = new DirectoryObject("./src")
@@ -184,8 +199,8 @@ export default class DirectoryObject extends FS {
184
199
  * const {files} = await dir.glob("**\/package.json")
185
200
  */
186
201
  glob(pat?: string): Promise<{
187
- files: Array<FileObject | VFileObject>;
188
- directories: Array<DirectoryObject | VDirectoryObject>;
202
+ files: Array<FileObject | FileObject>;
203
+ directories: Array<DirectoryObject>;
189
204
  }>;
190
205
  /**
191
206
  * Ensures a directory exists, creating it if necessary.
@@ -251,58 +266,85 @@ export default class DirectoryObject extends FS {
251
266
  /**
252
267
  * Creates a new DirectoryObject by extending this directory's path.
253
268
  *
254
- * Uses intelligent path merging that detects overlapping segments to avoid
255
- * duplication (e.g., "/projects/toolkit" + "toolkit/src" = "/projects/toolkit/src").
256
- * The temporary flag is preserved from the parent directory.
269
+ * Uses overlapping path segment detection to intelligently combine paths.
270
+ * Preserves the temporary flag from the current directory.
257
271
  *
258
- * @param {string} dir - The subdirectory path to append (can be nested like "src/lib")
259
- * @returns {DirectoryObject} A new DirectoryObject instance with the combined path
260
- * @throws {Sass} If newPath is not a string
272
+ * @param {string} newPath - The path to append to this directory's path.
273
+ * @returns {DirectoryObject} A new DirectoryObject with the extended path.
261
274
  * @example
262
275
  * const dir = new DirectoryObject("/projects/git/toolkit")
263
- * const subDir = dir.getDirectory("src/lib")
276
+ * const subDir = dir.addDirectory("src/lib")
264
277
  * console.log(subDir.path) // "/projects/git/toolkit/src/lib"
265
- *
266
- * @example
267
- * // Handles overlapping segments intelligently
268
- * const dir = new DirectoryObject("/projects/toolkit")
269
- * const subDir = dir.getDirectory("toolkit/src")
270
- * console.log(subDir.path) // "/projects/toolkit/src" (not /projects/toolkit/toolkit/src)
271
278
  */
272
- getDirectory(dir: string): DirectoryObject;
279
+ getDirectory(newPath: string): DirectoryObject;
273
280
  /**
274
281
  * Creates a new FileObject by extending this directory's path.
275
282
  *
276
- * Uses intelligent path merging that detects overlapping segments to avoid
277
- * duplication. The resulting FileObject can be used for reading, writing,
278
- * and other file operations.
279
- *
280
- * For regular DirectoryObject: only allows direct children (local only).
281
- * For VDirectoryObject: supports absolute virtual paths (starting with "/")
282
- * which resolve from cap root, and relative paths from current directory.
283
- *
284
- * When called on a VDirectoryObject, returns a VFileObject to maintain
285
- * virtual path semantics.
283
+ * Uses overlapping path segment detection to intelligently combine paths.
286
284
  *
287
- * @param {string} file - The filename to append
288
- * @returns {FileObject|VFileObject} A new FileObject (or VFileObject if virtual)
289
- * @throws {Sass} If filename is not a string
290
- * @throws {Sass} If path would be out of bounds
285
+ * @param {string} filename - The filename to append to this directory's path.
286
+ * @returns {FileObject} A new FileObject with the extended path.
291
287
  * @example
292
288
  * const dir = new DirectoryObject("/projects/git/toolkit")
293
- * const file = dir.getFile("package.json")
289
+ * const file = dir.addFile("package.json")
294
290
  * console.log(file.path) // "/projects/git/toolkit/package.json"
295
- *
296
- * @example
297
- * // VDirectoryObject with absolute virtual path
298
- * const vdo = new TempDirectoryObject("myapp")
299
- * const file = vdo.getFile("/config/settings.json")
300
- * // Virtual path: /config/settings.json, Real path: {vdo.real.path}/config/settings.json
301
291
  */
302
- getFile(file: string): FileObject | VFileObject;
292
+ getFile(filename: string): FileObject;
303
293
  #private;
304
294
  }
295
+ export type GeneratorType = {
296
+ next: () => {
297
+ value: DirectoryObject;
298
+ done: boolean;
299
+ };
300
+ iterator?: () => GeneratorType;
301
+ };
302
+ export type DirectoryMeta = {
303
+ /**
304
+ * - Always true for directories
305
+ */
306
+ isDirectory: boolean;
307
+ /**
308
+ * - The directory extension (if any)
309
+ */
310
+ extension: string | null;
311
+ /**
312
+ * - The directory name without extension
313
+ */
314
+ module: string | null;
315
+ /**
316
+ * - The directory name
317
+ */
318
+ name: string | null;
319
+ /**
320
+ * - The parent DirectoryObject
321
+ */
322
+ parent: DirectoryObject | undefined;
323
+ /**
324
+ * - The parent directory path
325
+ */
326
+ parentPath: string | null;
327
+ /**
328
+ * - The absolute directory path
329
+ */
330
+ path: string | null;
331
+ /**
332
+ * - Path separator
333
+ */
334
+ sep: string | null;
335
+ /**
336
+ * - User-supplied path
337
+ */
338
+ supplied: string | null;
339
+ /**
340
+ * - Path segments
341
+ */
342
+ trail: Array<string> | null;
343
+ /**
344
+ * - The directory URL
345
+ */
346
+ url: URL | null;
347
+ };
305
348
  import FS from "./FileSystem.js";
306
349
  import FileObject from "./FileObject.js";
307
- import VFileObject from "./VFileObject.js";
308
350
  //# sourceMappingURL=DirectoryObject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/DirectoryObject.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH;IA4DE;;;;;;;;;OASG;IACH,kBALa,eAAe,CAO3B;IA5CD;;;;;OAKG;IACH,uBAHW,MAAM,OAAC,EA2BjB;IA2BD;;;;OAIG;IACH,cAFa,OAAO,CAAC,OAAO,CAAC,CAI5B;IAED;;;;OAIG;IACH,gBAFa,MAAM,CAIlB;IAED;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ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,cAfW,MAAM,GACJ,UAAU,GAAC,WAAW,CAoClC;;CACF;eA7rBc,iBAAiB;uBADT,iBAAiB;wBAIhB,kBAAkB"}
1
+ {"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/DirectoryObject.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IAuDE;;;;;;;;;OASG;IACH,kBALa,eAAe,CAO3B;IA7CD;;;;OAIG;IACH,uBAFW,MAAM,OAAC,EA4BjB;IAyBD;;;;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,mBAFa,OAAO,CAInB;IAmBD;;;;;;;;;;;;;;;;;OAiBG;IACH,WAZW,MAAM,GACJ,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;KAAC,CAAC,CAwCpF;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAZW,MAAM,GACJ,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,GAAC,UAAU,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;KAAC,CAAC,CA2C/F;IAED;;;;;;;;;;;;OAYG;IACH,uBARW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAuBzB;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;IAED;;;;;;;;;;;;OAYG;IACH,sBAPW,MAAM,GACJ,eAAe,CA6B3B;IAED;;;;;;;;;;;OAWG;IACH,kBAPW,MAAM,GACJ,UAAU,CA6BtB;;CACF;;UAvkBa,MAAY;QAAC,KAAK,EAAE,eAAe,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAC;eACnD,MAAY,aAAa;;;;;;iBAMzB,OAAO;;;;eACP,MAAM,GAAC,IAAI;;;;YACX,MAAM,GAAC,IAAI;;;;UACX,MAAM,GAAC,IAAI;;;;YACX,eAAe,GAAC,SAAS;;;;gBACzB,MAAM,GAAC,IAAI;;;;UACX,MAAM,GAAC,IAAI;;;;SACX,MAAM,GAAC,IAAI;;;;cACX,MAAM,GAAC,IAAI;;;;WACX,KAAK,CAAC,MAAM,CAAC,GAAC,IAAI;;;;SAClB,GAAG,GAAC,IAAI;;eAvBP,iBAAiB;uBADT,iBAAiB"}
@@ -23,15 +23,18 @@ export default class FileObject extends FS {
23
23
  [key: string]: Array<typeof JSON5 | typeof YAML>;
24
24
  };
25
25
  /**
26
- * Strip root from absolute path to make it relative.
27
- * Used for virtual filesystem path resolution.
26
+ * Creates a FileObject representing the current working file (the file
27
+ * that called this method). Parses the stack trace to determine the
28
+ * caller's file path.
28
29
  *
29
- * @private
30
- * @static
31
- * @param {string} pathName - The path to convert
32
- * @returns {string} Path with root stripped, or original if already relative
30
+ * @returns {FileObject} A new FileObject instance for the calling file
31
+ * @throws {Sass} If unable to determine caller file from stack trace
32
+ * @example
33
+ * // In /home/user/project/src/app.js:
34
+ * const thisFile = FileObject.fromCwf()
35
+ * console.log(thisFile.path) // /home/user/project/src/app.js
33
36
  */
34
- private static "__#private@#absoluteToRelative";
37
+ static fromCwf(): FileObject;
35
38
  /**
36
39
  * Constructs a FileObject instance.
37
40
  *
@@ -221,4 +224,6 @@ export default class FileObject extends FS {
221
224
  }
222
225
  import FS from "./FileSystem.js";
223
226
  import DirectoryObject from "./DirectoryObject.js";
227
+ import JSON5 from "json5";
228
+ import YAML from "yaml";
224
229
  //# sourceMappingURL=FileObject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/FileObject.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;GAaG;AAEH;IACE;;;;;OAKG;IACH,yBAFU;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,IAAI,CAAC,CAAA;KAAC,CAO1D;IA0BF;;;;;;;;OAQG;IACH,gDAOC;IAED;;;;;OAKG;IACH,uBAHW,MAAM,WACN,eAAe,GAAC,MAAM,GAAC,IAAI,EA6DrC;IAaD;;;;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;IACD;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;;;;;;;;;;;OAcG;IACH,cAFa,eAAe,CAI3B;IAED;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,sBAAsB;kBAPhC,OAAO;iBAER,MAAM"}
@@ -22,13 +22,15 @@ export default class FileSystem {
22
22
  */
23
23
  static pathToUrl(pathName: string): string;
24
24
  /**
25
- * Convert a URI to a path
25
+ * Convert a file URL to a path.
26
26
  *
27
27
  * @static
28
- * @param {string} pathName - The URI to convert
29
- * @returns {string} The path
28
+ * @param {string} fileUrl - The file URL to convert (e.g., import.meta.url)
29
+ * @returns {string} The file path
30
+ * @example
31
+ * const currentFile = FileSystem.urlToPath(import.meta.url)
30
32
  */
31
- static urlToPath(pathName: string): string;
33
+ static urlToPath(fileUrl: string): string;
32
34
  /**
33
35
  * Computes the relative path from one file or directory to another.
34
36
  *
@@ -126,6 +128,8 @@ export default class FileSystem {
126
128
  * @property {string} base - The file name with extension
127
129
  * @property {string} dir - The directory path
128
130
  * @property {string} ext - The file extension (including dot)
131
+ * @property {string} root - The root of the path
132
+ * @property {string} name - The file name without extension
129
133
  */
130
134
  /**
131
135
  * Deconstruct a file or directory name into parts.
@@ -148,26 +152,15 @@ export default class FileSystem {
148
152
  * - The file extension (including dot)
149
153
  */
150
154
  ext: string;
155
+ /**
156
+ * - The root of the path
157
+ */
158
+ root: string;
159
+ /**
160
+ * - The file name without extension
161
+ */
162
+ name: string;
151
163
  };
152
- /**
153
- * Convert a virtual capped path to its real filesystem path.
154
- * For capped objects, resolves the virtual path relative to the cap's real path.
155
- * For uncapped objects, returns the path unchanged.
156
- *
157
- * @static
158
- * @param {FileObject|DirectoryObject} fileOrDirectoryObject - The file or directory object to convert
159
- * @returns {string} The real filesystem path
160
- * @throws {Sass} If parameter is not a FileObject or DirectoryObject
161
- * @example
162
- * const temp = new TempDirectoryObject("myapp")
163
- * const file = temp.getFile("/config.json")
164
- * FS.virtualToRealPath(file) // "/tmp/myapp-ABC123/config.json"
165
- *
166
- * @example
167
- * const regular = new FileObject("/home/user/file.txt")
168
- * FS.virtualToRealPath(regular) // "/home/user/file.txt"
169
- */
170
- static virtualToRealPath(fileOrDirectoryObject: FileObject | DirectoryObject): string;
171
164
  /**
172
165
  * Returns the current working directory as a string.
173
166
  *
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../src/node/lib/FileSystem.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,gCAJW,UAAU,GAAC,eAAe,MAC1B,UAAU,GAAC,eAAe,GACxB,MAAM,CAYlB;IAED;;;;;;;;;;OAUG;IACH,oCAJW,MAAM,MACN,MAAM,GACJ,MAAM,CAQlB;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;;;;OAIG;IACH,kBAFa,MAAM,CAIlB;IA/VD;;;;;;;;;OASG;IACH,kCAJW,UAAU,GAAC,eAAe,GACxB,MAAM,CAWlB;CA8UF;yBAjXa,OAAO,iBAAiB,EAAE,OAAO;8BACjC,OAAO,sBAAsB,EAAE,OAAO"}
1
+ {"version":3,"file":"FileSystem.d.ts","sourceRoot":"","sources":["../../../src/node/lib/FileSystem.js"],"names":[],"mappings":"AA2BA;;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;;;;;;;;OAQG;IACH,0BALW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;;;;;;OAUG;IACH,gCAJW,UAAU,GAAC,eAAe,MAC1B,UAAU,GAAC,eAAe,GACxB,MAAM,CAYlB;IAED;;;;;;;;;;OAUG;IACH,oCAJW,MAAM,MACN,MAAM,GACJ,MAAM,CAQlB;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;;;;;;;OAOG;IAEH;;;;;;;OAOG;IACH,2BAJW,MAAM;;;;cAXH,MAAM;;;;aACN,MAAM;;;;aACN,MAAM;;;;cACN,MAAM;;;;cACN,MAAM;MAenB;IAED;;;;OAIG;IACH,kBAFa,MAAM,CAIlB;IAzTD;;;;;;;;;OASG;IACH,kCAJW,UAAU,GAAC,eAAe,GACxB,MAAM,CAWlB;CAwSF;yBA3Ua,OAAO,iBAAiB,EAAE,OAAO;8BACjC,OAAO,sBAAsB,EAAE,OAAO"}
@@ -348,13 +348,6 @@ declare class Glog {
348
348
  * @returns {boolean} return.stackTrace - Stack trace enabled
349
349
  */
350
350
  get options(): object;
351
- /**
352
- * Extract file and function information from stack trace
353
- *
354
- * @private
355
- * @returns {string} Caller tag
356
- */
357
- private extractFileFunction;
358
351
  /**
359
352
  * Create a new debug function with a specific tag
360
353
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Glog.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Glog.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;GAUG;AACH,4BARU,MAAM,CAqBf;AAED;;;;;;;;;GASG;AACH,yBAPU,MAAM,CAaf;;;AAYD;IAEE,wBAAmB;IACnB,yBAAqB;IACrB,oBAAqB;IACrB,2BAAyB;IACzB,oBAAgB;IAChB,8BAA4B;IAC5B,oBAAqB;IAsFrB;;;;;OAKG;IACH,4BAHW,MAAM,GACJ,OAAO,IAAI,CAMvB;IAED;;;;;OAKG;IACH,0BAHW,MAAM,GACJ,OAAO,IAAI,CAMvB;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,OAAO,IAAI,CAMvB;IAED;;;;;;;;;;OAUG;IACH,6BAHW,MAAM,GACJ,OAAO,IAAI,CAMvB;IAED;;;;;OAKG;IACH,gCAHW,OAAO,GACL,OAAO,IAAI,CAMvB;IAED;;;;;OAKG;IACH,mCAHW,OAAO,GACL,OAAO,IAAI,CAMvB;IAED;;;;;;;;;;OAUG;IACH,6BALW,MAAM,GACJ,OAAO,IAAI,CAQvB;IAED;;;;;;;;;OASG;IACH,mBANW,MAAM,GACJ,MAAM,CAyClB;IAID;;;;;OAKG;IACH,wBAHW,MAAM,GACJ,IAAI,CAIhB;IA+UD;;;;;OAKG;IACH,wBAFc,OAAO,EAAA,QAsBpB;IA4BD;;;;;OAKG;IACH,0BAHW,KAAK,CAAC,MAAM,CAAC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AAlC,KAAK,CAAC,MAAM,CAAC;QACK,UAAU,GAA5B,OAAO;QACW,aAAa,GAA/B,OAAO;KACjB,QAkBA;IA4CD;;;;OAIG;IACH,mBAEC;IAED;;;;;;;;;;;;;OAaG;IACH,WAXa,MAAM,CAuBlB;;CA6BF"}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Options for type validation methods.
3
+ *
4
+ * @typedef {object} TypeValidationOptions
5
+ * @property {boolean} [allowEmpty=true] - Whether empty values are allowed
6
+ */
1
7
  /**
2
8
  * Validation utility class providing type checking and assertion methods.
3
9
  */
@@ -8,9 +14,9 @@ export default class Valid {
8
14
  *
9
15
  * @param {unknown} value - The value to validate
10
16
  * @param {string} type - The expected type in the form of "object", "object[]", "object|object[]"
11
- * @param {object} [options] - Additional options for validation.
17
+ * @param {TypeValidationOptions} [options] - Additional options for validation.
12
18
  */
13
- static type(value: unknown, type: string, options?: object): void;
19
+ static type(value: unknown, type: string, options?: TypeValidationOptions): void;
14
20
  /**
15
21
  * Asserts a condition
16
22
  *
@@ -32,4 +38,13 @@ export default class Valid {
32
38
  */
33
39
  static prototypePollutionProtection(keys: Array<string>): void;
34
40
  }
41
+ /**
42
+ * Options for type validation methods.
43
+ */
44
+ export type TypeValidationOptions = {
45
+ /**
46
+ * - Whether empty values are allowed
47
+ */
48
+ allowEmpty?: boolean;
49
+ };
35
50
  //# sourceMappingURL=Valid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Valid.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Valid.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,+CAAmE;IAEnE;;;;;;OAMG;IACH,mBAJW,OAAO,QACP,MAAM,YACN,MAAM,QAYhB;IAED;;;;;;;;OAQG;IACH,yBANW,OAAO,WACP,MAAM,QAEN,MAAM,QAkBhB;IAED;;;;;;;;OAQG;IACH,0CAHW,KAAK,CAAC,MAAM,CAAC,QAYvB;CACF"}
1
+ {"version":3,"file":"Valid.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Valid.js"],"names":[],"mappings":"AAWA;;;;;GAKG;AAEH;;GAEG;AACH;IACE,+CAAmE;IAEnE;;;;;;OAMG;IACH,mBAJW,OAAO,QACP,MAAM,YACN,qBAAqB,QAY/B;IAED;;;;;;;;OAQG;IACH,yBANW,OAAO,WACP,MAAM,QAEN,MAAM,QAkBhB;IAED;;;;;;;;OAQG;IACH,0CAHW,KAAK,CAAC,MAAM,CAAC,QAYvB;CACF;;;;;;;;iBAzEa,OAAO"}
@@ -1,165 +0,0 @@
1
- /**
2
- * @file TempDirectoryObject.js
3
- * @description Class representing a temporary directory that is constrained
4
- * to the OS's temporary directory tree.
5
- */
6
-
7
- import fs, {mkdirSync, mkdtempSync} from "node:fs"
8
- import os from "node:os"
9
- import path from "node:path"
10
-
11
- import Data from "../../browser/lib/Data.js"
12
- import VDirectoryObject from "./VDirectoryObject.js"
13
- import DirectoryObject from "./DirectoryObject.js"
14
- import FileSystem from "./FileSystem.js"
15
- import Sass from "./Sass.js"
16
- import Valid from "./Valid.js"
17
-
18
- /**
19
- * TempDirectoryObject extends VDirectoryObject with the cap set to
20
- * the OS's temporary directory. Temporary directories are created
21
- * synchronously during construction and exist immediately.
22
- *
23
- * All path operations are validated to ensure they remain within the temp
24
- * directory hierarchy for security.
25
- *
26
- * @augments VDirectoryObject
27
- */
28
- export default class TempDirectoryObject extends VDirectoryObject {
29
- #tmpReal
30
- #tmpCap
31
-
32
- /**
33
- * Constructs a TempDirectoryObject instance and creates the directory.
34
- *
35
- * The directory is created synchronously during construction, so it will
36
- * exist immediately after the constructor returns.
37
- *
38
- * If no name is provided, uses the OS temp directory directly. If a name
39
- * is provided without a parent, creates a new directory with a unique suffix.
40
- * If a parent is provided, creates a subdirectory within that parent.
41
- *
42
- * @param {string?} [directory] - Base name for the temp directory (if empty/null, uses OS temp dir)
43
- * @param {TempDirectoryObject?} [parent] - Optional parent temporary directory
44
- * @throws {Sass} If name is absolute
45
- * @throws {Sass} If name is empty (when parent is provided)
46
- * @throws {Sass} If name contains path separators
47
- * @throws {Sass} If parent is provided but not a temporary directory
48
- * @throws {Sass} If parent's lineage does not trace back to the OS temp directory
49
- * @throws {Sass} If directory creation fails
50
- * @example
51
- * // Create with unique name
52
- * const temp = new TempDirectoryObject("myapp")
53
- * console.log(temp.path) // "/"
54
- * console.log(temp.real.path) // "/tmp/myapp-ABC123"
55
- */
56
- constructor(directory, source=null) {
57
- Valid.type(source, "Null|TempDirectoryObject")
58
-
59
- directory ||= "temp"
60
- directory = Data.append(directory, source ? "" : "-")
61
-
62
- const parentRealPath = source?.real.path ?? os.tmpdir()
63
-
64
- if(source && path.isAbsolute(directory)) {
65
- const {root} = FileSystem.pathParts(directory)
66
-
67
- directory = Data.chopLeft(directory, root)
68
- }
69
-
70
- let realTempDirectoryPath, toSuper
71
-
72
- if(source) {
73
- toSuper = `/${directory}`
74
- realTempDirectoryPath =
75
- FileSystem.mergeOverlappingPaths(parentRealPath, directory)
76
- if(!fs.existsSync(realTempDirectoryPath))
77
- mkdirSync(realTempDirectoryPath)
78
- } else {
79
- realTempDirectoryPath =
80
- mkdtempSync(FileSystem.mergeOverlappingPaths(os.tmpdir(), directory))
81
- toSuper = path.resolve(path.sep)
82
- }
83
-
84
- super(toSuper, source)
85
-
86
- this.#tmpReal = new DirectoryObject(realTempDirectoryPath)
87
- this.#tmpCap = source?.cap ?? this
88
- }
89
-
90
- get isTemporary() {
91
- return true
92
- }
93
-
94
- /**
95
- * Returns a plain DirectoryObject representing the actual filesystem location.
96
- * This provides an "escape hatch" from the capped environment to interact
97
- * with the real filesystem when needed.
98
- *
99
- * @returns {DirectoryObject} Uncapped directory object at the real filesystem path
100
- * @example
101
- * const temp = new TempDirectoryObject("myapp")
102
- * const subdir = temp.getDirectory("data")
103
- *
104
- * // Work within the capped environment (virtual paths)
105
- * console.log(subdir.path) // "/data" (virtual)
106
- * subdir.getFile("config.json") // Stays within cap
107
- *
108
- * // Break out to real filesystem when needed
109
- * console.log(subdir.real.path) // "/tmp/myapp-ABC123/data" (real)
110
- * subdir.real.parent // Can traverse outside the cap
111
- */
112
- get real() {
113
- return this.#tmpReal
114
- }
115
-
116
- get cap() {
117
- return this.#tmpCap
118
- }
119
-
120
- /**
121
- * Recursively removes a temporary directory and all its contents.
122
- *
123
- * This method will delete all files and subdirectories within this directory,
124
- * then delete the directory itself. It only works on directories explicitly
125
- * marked as temporary for safety.
126
- *
127
- * @async
128
- * @returns {Promise<void>}
129
- * @throws {Sass} If the directory is not marked as temporary
130
- * @throws {Sass} If the directory deletion fails
131
- * @example
132
- * const tempDir = new TempDirectoryObject("my-temp")
133
- * await tempDir.assureExists()
134
- * // ... use the directory ...
135
- * await tempDir.remove() // Recursively deletes everything
136
- */
137
- async remove() {
138
- await this.#recurseDelete(this.real)
139
- }
140
-
141
- async #recurseDelete(directory) {
142
- const {files, directories} = await directory.read()
143
-
144
- // files first
145
- for(const file of files)
146
- await file.delete()
147
-
148
- // now dir-ty dirs
149
- for(const dir of directories)
150
- await this.#recurseDelete(dir)
151
-
152
- // byebyebyeeee πŸ•ΊπŸΎ
153
- await directory.delete()
154
- }
155
-
156
- /**
157
- * TempDirectoryObject does not support fromCwd() since it is specifically
158
- * designed to work within the OS temporary directory tree.
159
- *
160
- * @throws {Sass} Always throws an error
161
- */
162
- static fromCwd() {
163
- throw Sass.new("TempDirectoryObject.fromCwd() is not supported.")
164
- }
165
- }