@gesslar/toolkit 3.22.1 β†’ 3.23.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 +98 -200
  10. package/src/node/lib/FileObject.js +26 -44
  11. package/src/node/lib/FileSystem.js +9 -39
  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 -50
  24. package/types/node/lib/DirectoryObject.d.ts.map +1 -1
  25. package/types/node/lib/FileObject.d.ts +2 -10
  26. package/types/node/lib/FileObject.d.ts.map +1 -1
  27. package/types/node/lib/FileSystem.d.ts +13 -16
  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
@@ -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
@@ -93,15 +111,15 @@ export default class DirectoryObject extends FS {
93
111
  */
94
112
  get name(): string;
95
113
  /**
96
- * Returns the directory name without the path or extension.
114
+ * Returns the directory name without extension.
97
115
  *
98
116
  * @returns {string} The directory name without extension
99
117
  */
100
118
  get module(): string;
101
119
  /**
102
- * Returns the directory extension. Will be an empty string if unavailable.
120
+ * Returns the directory extension (if any).
103
121
  *
104
- * @returns {string} The directory extension
122
+ * @returns {string} The directory extension including the dot (e.g., '.git')
105
123
  */
106
124
  get extension(): string;
107
125
  /**
@@ -143,11 +161,10 @@ export default class DirectoryObject extends FS {
143
161
  * Lists the contents of a directory, optionally filtered by a glob pattern.
144
162
  *
145
163
  * Returns FileObject and DirectoryObject instances for regular directories.
146
- * Returns VFileObject and VDirectoryObject instances when called on virtual directories.
147
164
  *
148
165
  * @async
149
166
  * @param {string} [pat=""] - Optional glob pattern to filter results (e.g., "*.txt", "test-*")
150
- * @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
151
168
  * @example
152
169
  * const dir = new DirectoryObject("./src")
153
170
  * const {files, directories} = await dir.read()
@@ -159,19 +176,18 @@ export default class DirectoryObject extends FS {
159
176
  * console.log(files) // Only .js files in ./src
160
177
  */
161
178
  read(pat?: string): Promise<{
162
- files: Array<FileObject | VFileObject>;
163
- directories: Array<DirectoryObject | VDirectoryObject>;
179
+ files: Array<FileObject>;
180
+ directories: Array<DirectoryObject>;
164
181
  }>;
165
182
  /**
166
183
  * Recursively searches directory tree for files and directories matching a glob pattern.
167
184
  * Unlike read(), this method searches recursively through subdirectories.
168
185
  *
169
186
  * Returns FileObject and DirectoryObject instances for regular directories.
170
- * Returns VFileObject and VDirectoryObject instances when called on virtual directories.
171
187
  *
172
188
  * @async
173
189
  * @param {string} [pat=""] - Glob pattern to filter results
174
- * @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
175
191
  * @throws {Sass} If an entry is neither a file nor directory
176
192
  * @example
177
193
  * const dir = new DirectoryObject("./src")
@@ -183,8 +199,8 @@ export default class DirectoryObject extends FS {
183
199
  * const {files} = await dir.glob("**\/package.json")
184
200
  */
185
201
  glob(pat?: string): Promise<{
186
- files: Array<FileObject | VFileObject>;
187
- directories: Array<DirectoryObject | VDirectoryObject>;
202
+ files: Array<FileObject | FileObject>;
203
+ directories: Array<DirectoryObject>;
188
204
  }>;
189
205
  /**
190
206
  * Ensures a directory exists, creating it if necessary.
@@ -250,58 +266,85 @@ export default class DirectoryObject extends FS {
250
266
  /**
251
267
  * Creates a new DirectoryObject by extending this directory's path.
252
268
  *
253
- * Uses intelligent path merging that detects overlapping segments to avoid
254
- * duplication (e.g., "/projects/toolkit" + "toolkit/src" = "/projects/toolkit/src").
255
- * 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.
256
271
  *
257
- * @param {string} dir - The subdirectory path to append (can be nested like "src/lib")
258
- * @returns {DirectoryObject} A new DirectoryObject instance with the combined path
259
- * @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.
260
274
  * @example
261
275
  * const dir = new DirectoryObject("/projects/git/toolkit")
262
- * const subDir = dir.getDirectory("src/lib")
276
+ * const subDir = dir.addDirectory("src/lib")
263
277
  * console.log(subDir.path) // "/projects/git/toolkit/src/lib"
264
- *
265
- * @example
266
- * // Handles overlapping segments intelligently
267
- * const dir = new DirectoryObject("/projects/toolkit")
268
- * const subDir = dir.getDirectory("toolkit/src")
269
- * console.log(subDir.path) // "/projects/toolkit/src" (not /projects/toolkit/toolkit/src)
270
278
  */
271
- getDirectory(dir: string): DirectoryObject;
279
+ getDirectory(newPath: string): DirectoryObject;
272
280
  /**
273
281
  * Creates a new FileObject by extending this directory's path.
274
282
  *
275
- * Uses intelligent path merging that detects overlapping segments to avoid
276
- * duplication. The resulting FileObject can be used for reading, writing,
277
- * and other file operations.
278
- *
279
- * For regular DirectoryObject: only allows direct children (local only).
280
- * For VDirectoryObject: supports absolute virtual paths (starting with "/")
281
- * which resolve from cap root, and relative paths from current directory.
282
- *
283
- * When called on a VDirectoryObject, returns a VFileObject to maintain
284
- * virtual path semantics.
283
+ * Uses overlapping path segment detection to intelligently combine paths.
285
284
  *
286
- * @param {string} file - The filename to append
287
- * @returns {FileObject|VFileObject} A new FileObject (or VFileObject if virtual)
288
- * @throws {Sass} If filename is not a string
289
- * @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.
290
287
  * @example
291
288
  * const dir = new DirectoryObject("/projects/git/toolkit")
292
- * const file = dir.getFile("package.json")
289
+ * const file = dir.addFile("package.json")
293
290
  * console.log(file.path) // "/projects/git/toolkit/package.json"
294
- *
295
- * @example
296
- * // VDirectoryObject with absolute virtual path
297
- * const vdo = new TempDirectoryObject("myapp")
298
- * const file = vdo.getFile("/config/settings.json")
299
- * // Virtual path: /config/settings.json, Real path: {vdo.real.path}/config/settings.json
300
291
  */
301
- getFile(file: string): FileObject | VFileObject;
292
+ getFile(filename: string): FileObject;
302
293
  #private;
303
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
+ };
304
348
  import FS from "./FileSystem.js";
305
349
  import FileObject from "./FileObject.js";
306
- import VFileObject from "./VFileObject.js";
307
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;IA2DE;;;;;;;;;OASG;IACH,kBALa,eAAe,CAO3B;IA3CD;;;;OAIG;IACH,uBAFW,MAAM,OAAC,EA0BjB;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,mBAFa,OAAO,CAInB;IAmBD;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAZW,MAAM,GACJ,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,GAAC,WAAW,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC,eAAe,GAAC,gBAAgB,CAAC,CAAA;KAAC,CAAC,C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e,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"}
@@ -22,16 +22,6 @@ export default class FileObject extends FS {
22
22
  static dataLoaderConfig: {
23
23
  [key: string]: Array<typeof JSON5 | typeof YAML>;
24
24
  };
25
- /**
26
- * Strip root from absolute path to make it relative.
27
- * Used for virtual filesystem path resolution.
28
- *
29
- * @private
30
- * @static
31
- * @param {string} pathName - The path to convert
32
- * @returns {string} Path with root stripped, or original if already relative
33
- */
34
- private static "__#private@#absoluteToRelative";
35
25
  /**
36
26
  * Constructs a FileObject instance.
37
27
  *
@@ -221,4 +211,6 @@ export default class FileObject extends FS {
221
211
  }
222
212
  import FS from "./FileSystem.js";
223
213
  import DirectoryObject from "./DirectoryObject.js";
214
+ import JSON5 from "json5";
215
+ import YAML from "yaml";
224
216
  //# 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,GAA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BAAiB;4BADJ,sBAAsB"}
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;;;;;OAKG;IACH,uBAHW,MAAM,WACN,eAAe,GAAC,MAAM,GAAC,IAAI,EA+DrC;IAWD;;;;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;;;;OAIG;IACH,kBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,WAFa,OAAO,CAAC,OAAO,CAAC,CAU5B;IAED;;;;OAIG;IACH,YAFa,OAAO,CAAC,OAAO,CAAC,CAU5B;IAiBD;;;;OAIG;IACH,QAFa,OAAO,CAAC,MAAM,OAAC,CAAC,CAU5B;IAED;;;;;OAKG;IACH,YAFa,OAAO,CAAC,IAAI,OAAC,CAAC,CAU1B;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAS3B;IAED;;;;;;;;;;;OAWG;IACH,cARa,OAAO,CAAC,MAAM,CAAC,CAe3B;IAED;;;;;;;;;;;OAWG;IACH,eARW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAiBzB;IAED;;;;;;;;;;;;;;;OAeG;IACH,kBAXW,WAAW,GAAC,IAAI,GAAC,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAwBzB;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAXW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAiC5B;IAED;;;;OAIG;IACH,UAFa,OAAO,CAAC,MAAM,CAAC,CAS3B;IAED;;;;;;;;;OASG;IACH,UAPa,OAAO,CAAC,IAAI,CAAC,CAczB;;CACF;eA5dc,iBAAiB;4BADJ,sBAAsB;kBAPhC,OAAO;iBAER,MAAM"}
@@ -126,6 +126,8 @@ export default class FileSystem {
126
126
  * @property {string} base - The file name with extension
127
127
  * @property {string} dir - The directory path
128
128
  * @property {string} ext - The file extension (including dot)
129
+ * @property {string} root - The root of the path
130
+ * @property {string} name - The file name without extension
129
131
  */
130
132
  /**
131
133
  * Deconstruct a file or directory name into parts.
@@ -148,26 +150,21 @@ export default class FileSystem {
148
150
  * - The file extension (including dot)
149
151
  */
150
152
  ext: string;
153
+ /**
154
+ * - The root of the path
155
+ */
156
+ root: string;
157
+ /**
158
+ * - The file name without extension
159
+ */
160
+ name: string;
151
161
  };
152
162
  /**
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.
163
+ * Returns the current working directory as a string.
156
164
  *
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"
165
+ * @returns {string} The current working directory
169
166
  */
170
- static virtualToRealPath(fileOrDirectoryObject: FileObject | DirectoryObject): string;
167
+ static get cwd(): string;
171
168
  /**
172
169
  * Compute the relative path from another file or directory to this instance.
173
170
  *
@@ -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;IAtVD;;;;;;;;;OASG;IACH,kCAJW,UAAU,GAAC,eAAe,GACxB,MAAM,CAWlB;CAqUF;yBAxWa,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;;;;;;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;;;;;;;OAOG;IAEH;;;;;;;OAOG;IACH,2BAJW,MAAM;;;;cAXH,MAAM;;;;aACN,MAAM;;;;aACN,MAAM;;;;cACN,MAAM;;;;cACN,MAAM;MAenB;IAED;;;;OAIG;IACH,kBAFa,MAAM,CAIlB;IAvTD;;;;;;;;;OASG;IACH,kCAJW,UAAU,GAAC,eAAe,GACxB,MAAM,CAWlB;CAsSF;yBAzUa,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,aACV,OA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AK,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
- }