@gesslar/toolkit 3.20.0 → 3.22.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.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "gesslar",
6
6
  "url": "https://gesslar.dev"
7
7
  },
8
- "version": "3.20.0",
8
+ "version": "3.22.0",
9
9
  "license": "Unlicense",
10
10
  "homepage": "https://github.com/gesslar/toolkit#readme",
11
11
  "repository": {
@@ -58,7 +58,7 @@
58
58
  "yaml": "^2.8.2"
59
59
  },
60
60
  "devDependencies": {
61
- "@gesslar/uglier": "^0.6.0",
61
+ "@gesslar/uglier": "^1.0.0",
62
62
  "eslint": "^9.39.2",
63
63
  "happy-dom": "^20.1.0",
64
64
  "typescript": "^5.9.3"
@@ -9,8 +9,8 @@ import path from "node:path"
9
9
  import {URL} from "node:url"
10
10
 
11
11
  import Data from "../../browser/lib/Data.js"
12
- import FS from "./FileSystem.js"
13
12
  import FileObject from "./FileObject.js"
13
+ import FS from "./FileSystem.js"
14
14
  import Sass from "./Sass.js"
15
15
  import Valid from "./Valid.js"
16
16
  import VFileObject from "./VFileObject.js"
@@ -531,6 +531,60 @@ export default class DirectoryObject extends FS {
531
531
  return candidateDir === this.path
532
532
  }
533
533
 
534
+ /**
535
+ * Resolves an absolute virtual path from cap root and validates it stays within cap boundary.
536
+ *
537
+ * @private
538
+ * @param {string} absolutePath - Absolute virtual path starting with separator
539
+ * @returns {string} Normalized resolved virtual path
540
+ * @throws {Sass} If path would be out of bounds
541
+ */
542
+ #resolveAndValidateFromCap(absolutePath) {
543
+ const relativeFromCap = Data.chopLeft(absolutePath, this.sep)
544
+ const resolvedVirtualPath = FS.resolvePath(this.cap.path, relativeFromCap)
545
+ const normalized = FS.fixSlashes(resolvedVirtualPath)
546
+
547
+ // Validate cap boundary using real paths
548
+ const relativeFromCapForReal = normalized.startsWith(this.sep)
549
+ ? Data.chopLeft(normalized, this.sep)
550
+ : normalized
551
+ const resolvedRealPath = FS.resolvePath(
552
+ this.cap.real.path,
553
+ relativeFromCapForReal
554
+ )
555
+
556
+ if(!FS.pathContains(this.cap.real.path, resolvedRealPath)) {
557
+ throw Sass.new(`${normalized} would be out of bounds (cap: ${this.cap.path}).`)
558
+ }
559
+
560
+ return normalized
561
+ }
562
+
563
+ /**
564
+ * Validates that a resolved virtual path stays within the cap boundary.
565
+ *
566
+ * @private
567
+ * @param {string} virtualPath - Resolved virtual path
568
+ * @returns {string} Normalized virtual path
569
+ * @throws {Sass} If path would be out of bounds
570
+ */
571
+ #validateCapBoundary(virtualPath) {
572
+ const normalized = FS.fixSlashes(virtualPath)
573
+ const relativeFromCap = normalized.startsWith(this.sep)
574
+ ? Data.chopLeft(normalized, this.sep)
575
+ : normalized
576
+ const resolvedRealPath = FS.resolvePath(
577
+ this.cap.real.path,
578
+ relativeFromCap
579
+ )
580
+
581
+ if(!FS.pathContains(this.cap.real.path, resolvedRealPath)) {
582
+ throw Sass.new(`${normalized} would be out of bounds (cap: ${this.cap.path}).`)
583
+ }
584
+
585
+ return normalized
586
+ }
587
+
534
588
  /**
535
589
  * Creates a new DirectoryObject by extending this directory's path.
536
590
  *
@@ -555,11 +609,34 @@ export default class DirectoryObject extends FS {
555
609
  getDirectory(dir) {
556
610
  Valid.type(dir, "String", {allowEmpty: false})
557
611
 
612
+ // Handle VDirectoryObject with absolute virtual paths (starting with "/")
613
+ if(this.isVirtual && dir.startsWith(this.sep)) {
614
+ const normalized = this.#resolveAndValidateFromCap(dir)
615
+
616
+ return new this.constructor(normalized, this)
617
+ }
618
+
619
+ // Regular resolution
558
620
  const newPath = FS.resolvePath(this.path, dir)
559
621
 
560
- Valid.assert(this.#isLocal(newPath), `${newPath} would be out of bounds.`)
622
+ // Validate bounds
623
+ if(!this.isVirtual) {
624
+ // Regular DO: enforce local-only constraint
625
+ Valid.assert(this.#isLocal(newPath), `${newPath} would be out of bounds.`)
626
+
627
+ return new this.constructor(newPath, this)
628
+ }
629
+
630
+ // VDO relative paths: only allow nested if explicitly prefixed with ./
631
+ // This maintains security while allowing explicit relative navigation
632
+ if(dir.includes(this.sep) && !dir.startsWith(`.${this.sep}`)) {
633
+ throw Sass.new(`${dir} would be out of bounds. Use "./${dir}" for nested paths or chain getDirectory() calls.`)
634
+ }
635
+
636
+ // VDO relative paths: validate cap boundary and pass resolved path
637
+ const normalized = this.#validateCapBoundary(newPath)
561
638
 
562
- return new this.constructor(newPath, this)
639
+ return new this.constructor(normalized, this)
563
640
  }
564
641
 
565
642
  /**
@@ -569,31 +646,58 @@ export default class DirectoryObject extends FS {
569
646
  * duplication. The resulting FileObject can be used for reading, writing,
570
647
  * and other file operations.
571
648
  *
649
+ * For regular DirectoryObject: only allows direct children (local only).
650
+ * For VDirectoryObject: supports absolute virtual paths (starting with "/")
651
+ * which resolve from cap root, and relative paths from current directory.
652
+ *
572
653
  * When called on a VDirectoryObject, returns a VFileObject to maintain
573
654
  * virtual path semantics.
574
655
  *
575
- * @param {string} file - The filename to append (can include subdirectories like "src/index.js")
656
+ * @param {string} file - The filename to append
576
657
  * @returns {FileObject|VFileObject} A new FileObject (or VFileObject if virtual)
577
658
  * @throws {Sass} If filename is not a string
659
+ * @throws {Sass} If path would be out of bounds
578
660
  * @example
579
661
  * const dir = new DirectoryObject("/projects/git/toolkit")
580
662
  * const file = dir.getFile("package.json")
581
663
  * console.log(file.path) // "/projects/git/toolkit/package.json"
582
664
  *
583
665
  * @example
584
- * // Can include nested paths
585
- * const file = dir.getFile("src/index.js")
586
- * const data = await file.read()
666
+ * // VDirectoryObject with absolute virtual path
667
+ * const vdo = new TempDirectoryObject("myapp")
668
+ * const file = vdo.getFile("/config/settings.json")
669
+ * // Virtual path: /config/settings.json, Real path: {vdo.real.path}/config/settings.json
587
670
  */
588
671
  getFile(file) {
589
672
  Valid.type(file, "String", {allowEmpty: false})
590
673
 
591
- const newPath = FS.resolvePath(this.path, file)
674
+ // Handle VDirectoryObject with absolute virtual paths (starting with "/")
675
+ if(this.isVirtual && file.startsWith(this.sep)) {
676
+ const normalized = this.#resolveAndValidateFromCap(file)
592
677
 
593
- Valid.assert(this.#isLocal(newPath), `${newPath} would be out of bounds.`)
678
+ return new VFileObject(normalized, this)
679
+ }
594
680
 
595
- return this.isVirtual
596
- ? new VFileObject(file, this)
597
- : new FileObject(file, this)
681
+ // Regular resolution
682
+ const resolvedPath = FS.resolvePath(this.path, file)
683
+
684
+ // Validate bounds
685
+ if(!this.isVirtual) {
686
+ // Regular DO: enforce local-only constraint
687
+ Valid.assert(this.#isLocal(resolvedPath), `${resolvedPath} would be out of bounds.`)
688
+
689
+ return new FileObject(file, this)
690
+ }
691
+
692
+ // VDO relative paths: only allow nested if explicitly prefixed with ./
693
+ // This maintains security while allowing explicit relative navigation
694
+ if(file.includes(this.sep) && !file.startsWith(`.${this.sep}`)) {
695
+ throw Sass.new(`${file} would be out of bounds. Use "./${file}" for nested paths or chain getFile() calls.`)
696
+ }
697
+
698
+ // VDO relative paths: validate cap boundary and pass resolved path
699
+ const normalized = this.#validateCapBoundary(resolvedPath)
700
+
701
+ return new VFileObject(normalized, this)
598
702
  }
599
703
  }
@@ -79,6 +79,7 @@ class Glog {
79
79
  static stackTrace = false
80
80
  static name = ""
81
81
  static tagsAsStrings = false
82
+ static symbols = null
82
83
 
83
84
  // Instance properties (for configured loggers)
84
85
  #logLevel = 0
@@ -88,6 +89,7 @@ class Glog {
88
89
  #name = ""
89
90
  #tagsAsStrings = false
90
91
  #displayName = true
92
+ #symbols = null
91
93
  #vscodeError = null
92
94
  #vscodeWarn = null
93
95
  #vscodeInfo = null
@@ -101,6 +103,7 @@ class Glog {
101
103
  * @param {number} [options.logLevel] - Alias for debugLevel
102
104
  * @param {string} [options.prefix] - Prefix to prepend to all log messages
103
105
  * @param {object} [options.colours] - Colour configuration object
106
+ * @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
104
107
  * @param {boolean} [options.stackTrace=false] - Enable stack trace extraction
105
108
  * @param {boolean} [options.tagsAsStrings=false] - Use string tags instead of symbols
106
109
  * @param {boolean} [options.displayName=true] - Display logger name in output
@@ -135,6 +138,7 @@ class Glog {
135
138
  * @param {number} [options.logLevel] - Alias for debugLevel
136
139
  * @param {string} [options.prefix] - Prefix to prepend to all log messages
137
140
  * @param {object} [options.colours] - Colour configuration object
141
+ * @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
138
142
  * @param {boolean} [options.stackTrace] - Enable stack trace extraction
139
143
  * @param {boolean} [options.tagsAsStrings] - Use string tags instead of symbols
140
144
  * @param {boolean} [options.displayName] - Display logger name in output
@@ -145,6 +149,13 @@ class Glog {
145
149
  this.#logLevel = options.debugLevel ?? options.logLevel ?? this.#logLevel
146
150
  this.#logPrefix = options.prefix ?? this.#logPrefix
147
151
  this.#colours = options.colours ?? this.#colours
152
+
153
+ if(options.symbols) {
154
+ const base = this.#symbols ?? logSymbols
155
+
156
+ this.#symbols = Object.assign({}, base, options.symbols)
157
+ }
158
+
148
159
  this.#stackTrace = options.stackTrace ?? this.#stackTrace
149
160
  this.#tagsAsStrings = options.tagsAsStrings ?? this.#tagsAsStrings
150
161
  this.#displayName = options.displayName ?? this.#displayName
@@ -231,6 +242,23 @@ class Glog {
231
242
  return this
232
243
  }
233
244
 
245
+ /**
246
+ * Customize log level symbols for global usage
247
+ * Merges with existing symbols (can pass partial config)
248
+ * Only affects output when tagsAsStrings is false
249
+ * Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
250
+ *
251
+ * @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
252
+ * @returns {typeof Glog} The Glog class for chaining
253
+ * @example
254
+ * Glog.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
255
+ */
256
+ static withSymbols(symbols = logSymbols) {
257
+ this.symbols = Object.assign({}, this.symbols ?? logSymbols, symbols)
258
+
259
+ return this
260
+ }
261
+
234
262
  /**
235
263
  * Create a temporary scoped logger with a custom prefix for a single chain (static version)
236
264
  * The prefix replaces all formatting (name, tags) with just the prefix + message
@@ -368,6 +396,23 @@ class Glog {
368
396
  return this
369
397
  }
370
398
 
399
+ /**
400
+ * Customize log level symbols for this logger instance
401
+ * Merges with existing symbols (can pass partial config)
402
+ * Only affects output when tagsAsStrings is false
403
+ * Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
404
+ *
405
+ * @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
406
+ * @returns {Glog} This Glog instance for chaining
407
+ * @example
408
+ * logger.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
409
+ */
410
+ withSymbols(symbols = logSymbols) {
411
+ this.#symbols = Object.assign({}, this.#symbols ?? logSymbols, symbols)
412
+
413
+ return this
414
+ }
415
+
371
416
  /**
372
417
  * Disable displaying the logger name in output for this instance
373
418
  *
@@ -474,7 +519,8 @@ class Glog {
474
519
  const name = this.#name || Glog.name || "Log"
475
520
  const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
476
521
  const showName = this.#displayName
477
- const tag = useStrings ? Util.capitalize(level) : logSymbols[level]
522
+ const symbols = this.#symbols || Glog.symbols || logSymbols
523
+ const tag = useStrings ? Util.capitalize(level) : symbols[level]
478
524
  const namePrefix = showName ? `[${name}] ` : ""
479
525
 
480
526
  if(!colours) {
@@ -693,7 +739,8 @@ class Glog {
693
739
  const colours = this.colours || loggerColours
694
740
  const name = this.name || "Log"
695
741
  const useStrings = this.tagsAsStrings
696
- const tag = useStrings ? "Success" : logSymbols.success
742
+ const symbols = this.symbols || logSymbols
743
+ const tag = useStrings ? "Success" : symbols.success
697
744
  const colourCode = colours.success || "{F046}"
698
745
  const formatted = useStrings
699
746
  ? c`[${name}] ${colourCode}${tag}{/}: ${message}`
@@ -731,7 +778,8 @@ class Glog {
731
778
  const colours = this.colours || loggerColours
732
779
  const name = this.name || "Log"
733
780
  const useStrings = this.tagsAsStrings
734
- const tag = useStrings ? "Debug" : logSymbols.debug
781
+ const symbols = this.symbols || logSymbols
782
+ const tag = useStrings ? "Debug" : symbols.debug
735
783
  const colourCode = colours.debug[level] || colours.debug[0]
736
784
  const label = useStrings
737
785
  ? c`[${name}] ${colourCode}${tag}{/}: ${message}`
@@ -749,7 +797,8 @@ class Glog {
749
797
  const colours = this.colours || loggerColours
750
798
  const name = this.name || "Log"
751
799
  const useStrings = this.tagsAsStrings
752
- const tag = useStrings ? "Info" : logSymbols.info
800
+ const symbols = this.symbols || logSymbols
801
+ const tag = useStrings ? "Info" : symbols.info
753
802
  const label = useStrings
754
803
  ? c`[${name}] ${colours.info}${tag}{/}: ${message}`
755
804
  : c`[${name}] ${colours.info}${tag}{/} ${message}`
@@ -765,7 +814,8 @@ class Glog {
765
814
  static groupSuccess(message) {
766
815
  const name = this.name || "Log"
767
816
  const useStrings = this.tagsAsStrings
768
- const tag = useStrings ? "Success" : logSymbols.success
817
+ const symbols = this.symbols || logSymbols
818
+ const tag = useStrings ? "Success" : symbols.success
769
819
  const label = useStrings
770
820
  ? c`[${name}] {success}${tag}{/}: ${message}`
771
821
  : c`[${name}] {success}${tag}{/} ${message}`
@@ -822,7 +872,8 @@ class Glog {
822
872
  const name = this.#name || Glog.name || "Log"
823
873
  const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
824
874
  const showName = this.#displayName
825
- const tag = useStrings ? "Success" : logSymbols.success
875
+ const symbols = this.#symbols || Glog.symbols || logSymbols
876
+ const tag = useStrings ? "Success" : symbols.success
826
877
  const namePrefix = showName ? `[${name}] ` : ""
827
878
  const label = useStrings
828
879
  ? c`${namePrefix}{success}${tag}{/}: ${message}`
@@ -4,6 +4,7 @@
4
4
  * Extends FileObject with virtual path support and real filesystem mapping.
5
5
  */
6
6
 
7
+ import DirectoryObject from "./DirectoryObject.js"
7
8
  import FileObject from "./FileObject.js"
8
9
  import FS from "./FileSystem.js"
9
10
  import Valid from "./Valid.js"
@@ -34,20 +35,55 @@ export default class VFileObject extends FileObject {
34
35
  /**
35
36
  * Constructs a VFileObject instance.
36
37
  *
37
- * @param {string} fileName - The file path
38
- * @param {VDirectoryObject} parent - The parent virtual directory (required)
38
+ * @param {string} virtualPath - The virtual file path (already resolved, can be nested like "/path/to/file.ext")
39
+ * @param {VDirectoryObject} parent - The parent virtual directory (required, used for cap reference)
39
40
  */
40
- constructor(fileName, parent) {
41
- Valid.type(fileName, "String", {allowEmpty: false})
41
+ constructor(virtualPath, parent) {
42
+ Valid.type(virtualPath, "String", {allowEmpty: false})
42
43
  Valid.type(parent, "VDirectoryObject")
43
44
 
44
- super(fileName, parent)
45
+ // Normalize the virtual path
46
+ const normalizedVirtual = FS.fixSlashes(virtualPath)
45
47
 
46
- const parentRealPath = this.parent.real.path
47
- const resolved = FS.resolvePath(this.parent.path, fileName)
48
- const {base} = FS.pathParts(resolved)
48
+ // Extract the directory and filename from the virtual path
49
+ const {dir: virtualDir, base} = FS.pathParts(normalizedVirtual)
49
50
 
50
- this.#real = new FileObject(base, parentRealPath)
51
+ // Determine the virtual parent directory
52
+ // If virtualDir is "/" or empty or equals cap path, use the cap root
53
+ // Otherwise, construct the parent directory path relative to cap
54
+ let virtualParent
55
+ if(!virtualDir || virtualDir === "/" || virtualDir === parent.cap.path) {
56
+ virtualParent = parent.cap
57
+ } else {
58
+ // virtualDir is something like "/path/to" - we need to create a VDirectoryObject for it
59
+ // Strip leading "/" if present to make it relative to cap
60
+ const dirRelativeToCap = virtualDir.startsWith("/") ? virtualDir.slice(1) : virtualDir
61
+ // Use the VDirectoryObject constructor to create the parent directory
62
+ virtualParent = new parent.constructor(dirRelativeToCap, parent.cap)
63
+ }
64
+
65
+ // Call super with just the filename and the virtual parent
66
+ // This ensures FileObject sets up the virtual path correctly
67
+ super(base, virtualParent)
68
+
69
+ // Convert virtual path to real path
70
+ // The virtual path is relative to the cap root, so we resolve it relative to cap's real path
71
+ const capRealPath = parent.cap.real.path
72
+
73
+ // Strip leading "/" from virtual path if present to make it relative
74
+ const relativeFromCap = normalizedVirtual.startsWith("/")
75
+ ? normalizedVirtual.slice(1)
76
+ : normalizedVirtual
77
+
78
+ // Resolve the real filesystem path
79
+ const realPath = FS.resolvePath(capRealPath, relativeFromCap)
80
+
81
+ // Create FileObject with the full real path
82
+ // Extract directory and filename parts
83
+ const {dir: realDir, base: realBase} = FS.pathParts(realPath)
84
+ const realParentDir = new DirectoryObject(realDir)
85
+
86
+ this.#real = new FileObject(realBase, realParentDir)
51
87
  }
52
88
 
53
89
  get isVirtual() {
@@ -276,21 +276,27 @@ export default class DirectoryObject extends FS {
276
276
  * duplication. The resulting FileObject can be used for reading, writing,
277
277
  * and other file operations.
278
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
+ *
279
283
  * When called on a VDirectoryObject, returns a VFileObject to maintain
280
284
  * virtual path semantics.
281
285
  *
282
- * @param {string} file - The filename to append (can include subdirectories like "src/index.js")
286
+ * @param {string} file - The filename to append
283
287
  * @returns {FileObject|VFileObject} A new FileObject (or VFileObject if virtual)
284
288
  * @throws {Sass} If filename is not a string
289
+ * @throws {Sass} If path would be out of bounds
285
290
  * @example
286
291
  * const dir = new DirectoryObject("/projects/git/toolkit")
287
292
  * const file = dir.getFile("package.json")
288
293
  * console.log(file.path) // "/projects/git/toolkit/package.json"
289
294
  *
290
295
  * @example
291
- * // Can include nested paths
292
- * const file = dir.getFile("src/index.js")
293
- * const data = await file.read()
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
294
300
  */
295
301
  getFile(file: string): FileObject | VFileObject;
296
302
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../../src/node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AAe,CAc3B;IAED;;;;;;;;;;;;;;OAcG;IACH,UARa,OAAO,CAAC,IAAI,CAAC,CAkBzB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAQ5B;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IAUD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kBAdW,MAAM,GACJ,eAAe,CAqB3B;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAbW,MAAM,GACJ,UAAU,GAAC,WAAW,CAsBlC;;CACF;eA3kBc,iBAAiB;uBACT,iBAAiB;wBAGhB,kBAAkB"}
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,CA0CjH;IAED;;;;;;;;;;;;;;;;;;;OAmBG;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,CAgDjH;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,CAQ5B;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IAgED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,kBAdW,MAAM,GACJ,eAAe,CA4C3B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,cAfW,MAAM,GACJ,UAAU,GAAC,WAAW,CA6ClC;;CACF;eAlrBc,iBAAiB;uBADT,iBAAiB;wBAIhB,kBAAkB"}
@@ -30,6 +30,7 @@ declare class Glog {
30
30
  static stackTrace: boolean;
31
31
  static name: string;
32
32
  static tagsAsStrings: boolean;
33
+ static symbols: any;
33
34
  /**
34
35
  * Set the log prefix for global usage
35
36
  *
@@ -77,6 +78,18 @@ declare class Glog {
77
78
  * @returns {typeof Glog} The Glog class for chaining
78
79
  */
79
80
  static withTagsAsStrings(enabled?: boolean): typeof Glog;
81
+ /**
82
+ * Customize log level symbols for global usage
83
+ * Merges with existing symbols (can pass partial config)
84
+ * Only affects output when tagsAsStrings is false
85
+ * Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
86
+ *
87
+ * @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
88
+ * @returns {typeof Glog} The Glog class for chaining
89
+ * @example
90
+ * Glog.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
91
+ */
92
+ static withSymbols(symbols?: object): typeof Glog;
80
93
  /**
81
94
  * Create a temporary scoped logger with a custom prefix for a single chain (static version)
82
95
  * The prefix replaces all formatting (name, tags) with just the prefix + message
@@ -192,6 +205,7 @@ declare class Glog {
192
205
  * @param {number} [options.logLevel] - Alias for debugLevel
193
206
  * @param {string} [options.prefix] - Prefix to prepend to all log messages
194
207
  * @param {object} [options.colours] - Colour configuration object
208
+ * @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
195
209
  * @param {boolean} [options.stackTrace=false] - Enable stack trace extraction
196
210
  * @param {boolean} [options.tagsAsStrings=false] - Use string tags instead of symbols
197
211
  * @param {boolean} [options.displayName=true] - Display logger name in output
@@ -203,6 +217,7 @@ declare class Glog {
203
217
  logLevel?: number;
204
218
  prefix?: string;
205
219
  colours?: object;
220
+ symbols?: object;
206
221
  stackTrace?: boolean;
207
222
  tagsAsStrings?: boolean;
208
223
  displayName?: boolean;
@@ -217,6 +232,7 @@ declare class Glog {
217
232
  * @param {number} [options.logLevel] - Alias for debugLevel
218
233
  * @param {string} [options.prefix] - Prefix to prepend to all log messages
219
234
  * @param {object} [options.colours] - Colour configuration object
235
+ * @param {object} [options.symbols] - Custom log level symbols (e.g., {info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
220
236
  * @param {boolean} [options.stackTrace] - Enable stack trace extraction
221
237
  * @param {boolean} [options.tagsAsStrings] - Use string tags instead of symbols
222
238
  * @param {boolean} [options.displayName] - Display logger name in output
@@ -228,6 +244,7 @@ declare class Glog {
228
244
  logLevel?: number;
229
245
  prefix?: string;
230
246
  colours?: object;
247
+ symbols?: object;
231
248
  stackTrace?: boolean;
232
249
  tagsAsStrings?: boolean;
233
250
  displayName?: boolean;
@@ -279,6 +296,18 @@ declare class Glog {
279
296
  * @returns {Glog} This Glog instance for chaining
280
297
  */
281
298
  withTagsAsStrings(enabled?: boolean): Glog;
299
+ /**
300
+ * Customize log level symbols for this logger instance
301
+ * Merges with existing symbols (can pass partial config)
302
+ * Only affects output when tagsAsStrings is false
303
+ * Shape: {debug?: string, info?: string, warn?: string, error?: string, success?: string}
304
+ *
305
+ * @param {object} [symbols=logSymbols] - Symbol configuration object (partial or complete)
306
+ * @returns {Glog} This Glog instance for chaining
307
+ * @example
308
+ * logger.withSymbols({info: '🚒', warn: '🚨', error: '🔥', success: '💧', debug: '🧯'})
309
+ */
310
+ withSymbols(symbols?: object): Glog;
282
311
  /**
283
312
  * Disable displaying the logger name in output for this instance
284
313
  *
@@ -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;IA4E5B;;;;;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,OA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H,oBAHW,MAAM,UACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,mBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,sBAFW,MAAM,QAahB;IAED;;;;;;;;;OASG;IACH,YAPW,MAAM,QAAQ,mBACd,MAAM,GAAG,MAAM,YAEvB;QAAgC,UAAU,GAAlC,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
+ {"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,E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BAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,sBAFW,MAAM,QAchB;IAED;;;;;;;;;OASG;IACH,YAPW,MAAM,QAAQ,mBACd,MAAM,GAAG,MAAM,YAEvB;QAAgC,UAAU,GAAlC,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"}
@@ -21,10 +21,10 @@ export default class VFileObject extends FileObject {
21
21
  /**
22
22
  * Constructs a VFileObject instance.
23
23
  *
24
- * @param {string} fileName - The file path
25
- * @param {VDirectoryObject} parent - The parent virtual directory (required)
24
+ * @param {string} virtualPath - The virtual file path (already resolved, can be nested like "/path/to/file.ext")
25
+ * @param {VDirectoryObject} parent - The parent virtual directory (required, used for cap reference)
26
26
  */
27
- constructor(fileName: string, parent: VDirectoryObject);
27
+ constructor(virtualPath: string, parent: VDirectoryObject);
28
28
  get isVirtual(): boolean;
29
29
  get real(): FileObject;
30
30
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"VFileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/VFileObject.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;IAGE;;;;;OAKG;IACH,sBAHW,MAAM,UACN,gBAAgB,EAa1B;IAED,yBAEC;IAED,uBAEC;;CACF;uBArDsB,iBAAiB"}
1
+ {"version":3,"file":"VFileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/VFileObject.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;IAGE;;;;;OAKG;IACH,yBAHW,MAAM,UACN,gBAAgB,EAgD1B;IAED,yBAEC;IAED,uBAEC;;CACF;uBAxFsB,iBAAiB"}