@gesslar/toolkit 3.17.0 → 3.20.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.
@@ -7,7 +7,7 @@
7
7
  * 1. Simple function call: Glog(data)
8
8
  * 2. With levels: Glog(2, "debug message")
9
9
  * 3. Configured instance: new Glog(options)
10
- * 4. Fluent setup: Glog.create().withName("App").withColors()
10
+ * 4. Fluent setup: Glog.create().withName("App").withColours()
11
11
  * 5. Traditional logger: logger.debug("message", level)
12
12
  */
13
13
 
@@ -16,9 +16,18 @@ import c from "@gesslar/colours"
16
16
  import Data from "../../browser/lib/Data.js"
17
17
  import Term from "./Term.js"
18
18
  import Util from "../../browser/lib/Util.js"
19
- // ErrorStackParser will be dynamically imported when needed
20
19
 
21
- // Enhanced color system using @gesslar/colours
20
+ /**
21
+ * Default colour configuration for logger output using @gesslar/colours format
22
+ *
23
+ * @type {object}
24
+ * @property {string[]} debug - Array of 5 colour codes for debug levels 0-4
25
+ * @property {string} info - Colour code for info messages
26
+ * @property {string} warn - Colour code for warning messages
27
+ * @property {string} error - Colour code for error messages
28
+ * @property {string} success - Colour code for success messages
29
+ * @property {string} reset - Colour reset code
30
+ */
22
31
  export const loggerColours = {
23
32
  debug: [
24
33
  "{F019}", // Debug level 0: Dark blue
@@ -34,7 +43,16 @@ export const loggerColours = {
34
43
  reset: "{/}", // Reset
35
44
  }
36
45
 
37
- // Symbol alternatives for tags
46
+ /**
47
+ * Symbol characters used for log level tags when colours are disabled or tagsAsStrings is false
48
+ *
49
+ * @type {object}
50
+ * @property {string} debug - Symbol for debug messages
51
+ * @property {string} info - Symbol for info messages
52
+ * @property {string} warn - Symbol for warning messages
53
+ * @property {string} error - Symbol for error messages
54
+ * @property {string} success - Symbol for success messages
55
+ */
38
56
  export const logSymbols = {
39
57
  debug: "?",
40
58
  info: "i",
@@ -43,7 +61,7 @@ export const logSymbols = {
43
61
  success: "✓"
44
62
  }
45
63
 
46
- // Set up convenient aliases for common log colors
64
+ // Set up convenient aliases for common log colours
47
65
  c.alias.set("debug", "{F033}")
48
66
  c.alias.set("info", "{F036}")
49
67
  c.alias.set("warn", "{F214}")
@@ -57,7 +75,7 @@ class Glog {
57
75
  // Static properties (for global usage)
58
76
  static logLevel = 0
59
77
  static logPrefix = ""
60
- static colors = null
78
+ static colours = null
61
79
  static stackTrace = false
62
80
  static name = ""
63
81
  static tagsAsStrings = false
@@ -65,7 +83,7 @@ class Glog {
65
83
  // Instance properties (for configured loggers)
66
84
  #logLevel = 0
67
85
  #logPrefix = ""
68
- #colors = null
86
+ #colours = null
69
87
  #stackTrace = false
70
88
  #name = ""
71
89
  #tagsAsStrings = false
@@ -74,6 +92,20 @@ class Glog {
74
92
  #vscodeWarn = null
75
93
  #vscodeInfo = null
76
94
 
95
+ /**
96
+ * Create a new Glog logger instance with optional configuration
97
+ *
98
+ * @param {object} [options={}] - Configuration options
99
+ * @param {string} [options.name] - Logger name to display in output
100
+ * @param {number} [options.debugLevel] - Debug verbosity level (0-5, default: 0)
101
+ * @param {number} [options.logLevel] - Alias for debugLevel
102
+ * @param {string} [options.prefix] - Prefix to prepend to all log messages
103
+ * @param {object} [options.colours] - Colour configuration object
104
+ * @param {boolean} [options.stackTrace=false] - Enable stack trace extraction
105
+ * @param {boolean} [options.tagsAsStrings=false] - Use string tags instead of symbols
106
+ * @param {boolean} [options.displayName=true] - Display logger name in output
107
+ * @param {string} [options.env] - Environment mode ("extension" for VSCode integration)
108
+ */
77
109
  constructor(options = {}) {
78
110
  this.setOptions(options)
79
111
  this.constructor.name = "Glog"
@@ -94,11 +126,25 @@ class Glog {
94
126
 
95
127
  // === CONFIGURATION METHODS ===
96
128
 
129
+ /**
130
+ * Set configuration options for this logger instance
131
+ *
132
+ * @param {object} options - Configuration options
133
+ * @param {string} [options.name] - Logger name to display in output
134
+ * @param {number} [options.debugLevel] - Debug verbosity level (0-5)
135
+ * @param {number} [options.logLevel] - Alias for debugLevel
136
+ * @param {string} [options.prefix] - Prefix to prepend to all log messages
137
+ * @param {object} [options.colours] - Colour configuration object
138
+ * @param {boolean} [options.stackTrace] - Enable stack trace extraction
139
+ * @param {boolean} [options.tagsAsStrings] - Use string tags instead of symbols
140
+ * @param {boolean} [options.displayName] - Display logger name in output
141
+ * @returns {Glog} This Glog instance for chaining
142
+ */
97
143
  setOptions(options) {
98
144
  this.#name = options.name ?? this.#name
99
145
  this.#logLevel = options.debugLevel ?? options.logLevel ?? this.#logLevel
100
146
  this.#logPrefix = options.prefix ?? this.#logPrefix
101
- this.#colors = options.colors ?? this.#colors
147
+ this.#colours = options.colours ?? this.#colours
102
148
  this.#stackTrace = options.stackTrace ?? this.#stackTrace
103
149
  this.#tagsAsStrings = options.tagsAsStrings ?? this.#tagsAsStrings
104
150
  this.#displayName = options.displayName ?? this.#displayName
@@ -145,18 +191,18 @@ class Glog {
145
191
  }
146
192
 
147
193
  /**
148
- * Enable colors for global usage
149
- * Merges with existing color configuration (can pass partial config)
194
+ * Enable colours for global usage
195
+ * Merges with existing colour configuration (can pass partial config)
150
196
  * Shape: {debug?: string[], info?: string, warn?: string, error?: string, reset?: string}
151
- * - debug: Array of 5 color codes [level0, level1, level2, level3, level4]
152
- * - info, warn, error, reset: Single color code strings
197
+ * - debug: Array of 5 colour codes [level0, level1, level2, level3, level4]
198
+ * - info, warn, error, reset: Single colour code strings
153
199
  * Uses @gesslar/colours format like "{F196}"
154
200
  *
155
- * @param {object} [colors=loggerColours] - Color configuration object (partial or complete)
201
+ * @param {object} [colours=loggerColours] - Colour configuration object (partial or complete)
156
202
  * @returns {typeof Glog} The Glog class for chaining
157
203
  */
158
- static withColors(colors = loggerColours) {
159
- this.colors = Object.assign({}, this.colors ?? loggerColours, colors)
204
+ static withColours(colours = loggerColours) {
205
+ this.colours = Object.assign({}, this.colours ?? loggerColours, colours)
160
206
 
161
207
  return this
162
208
  }
@@ -185,6 +231,54 @@ class Glog {
185
231
  return this
186
232
  }
187
233
 
234
+ /**
235
+ * Create a temporary scoped logger with a custom prefix for a single chain (static version)
236
+ * The prefix replaces all formatting (name, tags) with just the prefix + message
237
+ *
238
+ * @param {string} prefix - Temporary prefix to use (e.g., "=>", " ", "-->")
239
+ * @returns {object} Temporary logger with all standard methods
240
+ * @example
241
+ * Glog.use("=>").info("Indented message") // => Indented message
242
+ * Glog.info("Back to normal") // [Log] i Back to normal
243
+ */
244
+ static use(prefix) {
245
+ return {
246
+ debug: (message, level = 1, ...args) => {
247
+ if(this.logLevel > 0 && level <= this.logLevel) {
248
+ Term.debug(`${prefix}${message}`, ...args)
249
+ }
250
+ },
251
+ info: (message, ...args) => Term.info(`${prefix}${message}`, ...args),
252
+ warn: (message, ...args) => Term.warn(`${prefix}${message}`, ...args),
253
+ error: (message, ...args) => Term.error(`${prefix}${message}`, ...args),
254
+ success: (message, ...args) => Term.log(`${prefix}${message}`, ...args),
255
+ log: (...args) => Term.log(prefix, ...args),
256
+ group: (...args) => {
257
+ const label = args.length > 0 ? ` ${args.join(" ")}` : ""
258
+
259
+ Term.group(`${prefix}${label}`)
260
+ },
261
+ groupEnd: () => Term.groupEnd(),
262
+ table: (data, labelOrOptions, options) => {
263
+ let label
264
+ let tableOptions = {}
265
+
266
+ if(typeof labelOrOptions === "string") {
267
+ label = labelOrOptions
268
+ tableOptions = options || {}
269
+ } else if(typeof labelOrOptions === "object" && labelOrOptions !== null) {
270
+ tableOptions = labelOrOptions
271
+ }
272
+
273
+ if(label) {
274
+ Term.log(`${prefix}${label}`)
275
+ }
276
+
277
+ Term.table(data, tableOptions)
278
+ }
279
+ }
280
+ }
281
+
188
282
  // === FLUENT INSTANCE CREATION ===
189
283
 
190
284
  /**
@@ -197,18 +291,36 @@ class Glog {
197
291
  return new this(options)
198
292
  }
199
293
 
294
+ /**
295
+ * Set the logger name for this instance
296
+ *
297
+ * @param {string} name - Logger name to display in output
298
+ * @returns {Glog} This Glog instance for chaining
299
+ */
200
300
  withName(name) {
201
301
  this.#name = name
202
302
 
203
303
  return this
204
304
  }
205
305
 
306
+ /**
307
+ * Set the log level for this instance (0-5)
308
+ *
309
+ * @param {number} level - Log level (0 = off, 1-5 = increasing verbosity)
310
+ * @returns {Glog} This Glog instance for chaining
311
+ */
206
312
  withLogLevel(level) {
207
313
  this.#logLevel = level
208
314
 
209
315
  return this
210
316
  }
211
317
 
318
+ /**
319
+ * Set the log prefix for this instance
320
+ *
321
+ * @param {string} prefix - Prefix to prepend to all log messages
322
+ * @returns {Glog} This Glog instance for chaining
323
+ */
212
324
  withPrefix(prefix) {
213
325
  this.#logPrefix = prefix
214
326
 
@@ -216,93 +328,191 @@ class Glog {
216
328
  }
217
329
 
218
330
  /**
219
- * Enable colors for this logger instance
220
- * Merges with existing color configuration (can pass partial config)
331
+ * Enable colours for this logger instance
332
+ * Merges with existing colour configuration (can pass partial config)
221
333
  * Shape: {debug?: string[], info?: string, warn?: string, error?: string, reset?: string}
222
- * - debug: Array of 5 color codes [level0, level1, level2, level3, level4]
223
- * - info, warn, error, reset: Single color code strings
334
+ * - debug: Array of 5 colour codes [level0, level1, level2, level3, level4]
335
+ * - info, warn, error, reset: Single colour code strings
224
336
  * Uses @gesslar/colours format like "{F196}"
225
337
  *
226
- * @param {object} [colors=loggerColours] - Color configuration object (partial or complete)
338
+ * @param {object} [colours=loggerColours] - Colour configuration object (partial or complete)
227
339
  * @returns {Glog} This Glog instance for chaining
228
340
  */
229
- withColors(colors = loggerColours) {
230
- this.#colors = Object.assign({}, this.#colors ?? loggerColours, colors)
341
+ withColours(colours = loggerColours) {
342
+ this.#colours = Object.assign({}, this.#colours ?? loggerColours, colours)
231
343
 
232
344
  return this
233
345
  }
234
346
 
347
+ /**
348
+ * Enable or disable stack trace extraction for this instance
349
+ *
350
+ * @param {boolean} [enabled=true] - Whether to enable stack traces
351
+ * @returns {Glog} This Glog instance for chaining
352
+ */
235
353
  withStackTrace(enabled = true) {
236
354
  this.#stackTrace = enabled
237
355
 
238
356
  return this
239
357
  }
240
358
 
359
+ /**
360
+ * Use tag names as strings instead of symbols for this instance
361
+ *
362
+ * @param {boolean} [enabled=false] - Whether to use string tags
363
+ * @returns {Glog} This Glog instance for chaining
364
+ */
241
365
  withTagsAsStrings(enabled = false) {
242
366
  this.#tagsAsStrings = enabled
243
367
 
244
368
  return this
245
369
  }
246
370
 
371
+ /**
372
+ * Disable displaying the logger name in output for this instance
373
+ *
374
+ * @returns {Glog} This Glog instance for chaining
375
+ */
247
376
  noDisplayName() {
248
377
  this.#displayName = false
249
378
 
250
379
  return this
251
380
  }
252
381
 
382
+ /**
383
+ * Create a temporary scoped logger with a custom prefix for a single chain
384
+ * The prefix replaces all formatting (name, tags) with just the prefix + message
385
+ *
386
+ * @param {string} prefix - Temporary prefix to use (e.g., "=>", " ", "-->")
387
+ * @returns {object} Temporary logger with all standard methods
388
+ * @example
389
+ * logger.use("=>").info("Indented message") // => Indented message
390
+ * logger.info("Back to normal") // [MyApp] i Back to normal
391
+ */
392
+ use(prefix) {
393
+ return {
394
+ debug: (message, level = 1, ...args) => {
395
+ const currentLevel = this.#logLevel || Glog.logLevel
396
+
397
+ if(currentLevel > 0 && level <= currentLevel) {
398
+ Term.debug(`${prefix}${message}`, ...args)
399
+ }
400
+ },
401
+ info: (message, ...args) => Term.info(`${prefix}${message}`, ...args),
402
+ warn: (message, ...args) => Term.warn(`${prefix}${message}`, ...args),
403
+ error: (message, ...args) => Term.error(`${prefix}${message}`, ...args),
404
+ success: (message, ...args) => Term.log(`${prefix}${message}`, ...args),
405
+ log: (...args) => Term.log(prefix, ...args),
406
+ group: (...args) => {
407
+ const label = args.length > 0 ? ` ${args.join(" ")}` : ""
408
+
409
+ Term.group(`${prefix}${label}`)
410
+ },
411
+ groupEnd: () => Term.groupEnd(),
412
+ table: (data, labelOrOptions, options) => {
413
+ let label
414
+ let tableOptions = {}
415
+
416
+ if(typeof labelOrOptions === "string") {
417
+ label = labelOrOptions
418
+ tableOptions = options || {}
419
+ } else if(typeof labelOrOptions === "object" && labelOrOptions !== null) {
420
+ tableOptions = labelOrOptions
421
+ }
422
+
423
+ if(label) {
424
+ Term.log(`${prefix}${label}`)
425
+ }
426
+
427
+ Term.table(data, tableOptions)
428
+ }
429
+ }
430
+ }
431
+
253
432
  // === UTILITY METHODS ===
254
433
 
434
+ /**
435
+ * Get the current logger name
436
+ *
437
+ * @returns {string} The logger name
438
+ */
255
439
  get name() {
256
440
  return this.#name
257
441
  }
258
442
 
443
+ /**
444
+ * Get the current debug level
445
+ *
446
+ * @returns {number} The debug level (0-5)
447
+ */
259
448
  get debugLevel() {
260
449
  return this.#logLevel
261
450
  }
262
451
 
452
+ /**
453
+ * Get the current logger options configuration
454
+ *
455
+ * @returns {object} The logger options
456
+ * @returns {string} return.name - Logger name
457
+ * @returns {number} return.debugLevel - Debug level
458
+ * @returns {string} return.prefix - Log prefix
459
+ * @returns {object} return.colours - Colour configuration
460
+ * @returns {boolean} return.stackTrace - Stack trace enabled
461
+ */
263
462
  get options() {
264
463
  return {
265
464
  name: this.#name,
266
465
  debugLevel: this.#logLevel,
267
466
  prefix: this.#logPrefix,
268
- colors: this.#colors,
467
+ colours: this.#colours,
269
468
  stackTrace: this.#stackTrace
270
469
  }
271
470
  }
272
471
 
273
472
  #compose(level, message, debugLevel = 0) {
274
- const colors = this.#colors || Glog.colors || loggerColours
473
+ const colours = this.#colours || Glog.colours || loggerColours
275
474
  const name = this.#name || Glog.name || "Log"
276
475
  const useStrings = this.#tagsAsStrings || Glog.tagsAsStrings
277
476
  const showName = this.#displayName
278
477
  const tag = useStrings ? Util.capitalize(level) : logSymbols[level]
279
478
  const namePrefix = showName ? `[${name}] ` : ""
280
479
 
281
- if(!colors) {
480
+ if(!colours) {
282
481
  return useStrings
283
482
  ? `${namePrefix}${tag}: ${message}`
284
483
  : `${namePrefix}${tag} ${message}`
285
484
  }
286
485
 
287
486
  if(level === "debug") {
288
- const colorCode = colors[level][debugLevel] || colors[level][0]
487
+ const colourCode = colours[level][debugLevel] || colours[level][0]
289
488
 
290
489
  return useStrings
291
- ? c`${namePrefix}${colorCode}${tag}{/}: ${message}`
292
- : c`${namePrefix}${colorCode}${tag}{/} ${message}`
490
+ ? c`${namePrefix}${colourCode}${tag}{/}: ${message}`
491
+ : c`${namePrefix}${colourCode}${tag}{/} ${message}`
293
492
  }
294
493
 
295
494
  return useStrings
296
- ? c`${namePrefix}${colors[level]}${tag}{/}: ${message}`
297
- : c`${namePrefix}${colors[level]}${tag}{/} ${message}`
495
+ ? c`${namePrefix}${colours[level]}${tag}{/}: ${message}`
496
+ : c`${namePrefix}${colours[level]}${tag}{/} ${message}`
298
497
  }
299
498
 
300
- // Stack trace functionality - simplified for now
499
+ /**
500
+ * Extract file and function information from stack trace
501
+ *
502
+ * @private
503
+ * @returns {string} Caller tag
504
+ */
301
505
  extractFileFunction() {
302
506
  // Simple fallback - just return a basic tag
303
507
  return "caller"
304
508
  }
305
509
 
510
+ /**
511
+ * Create a new debug function with a specific tag
512
+ *
513
+ * @param {string} tag - Tag to prepend to debug messages
514
+ * @returns {Function} Debug function with the tag
515
+ */
306
516
  newDebug(tag) {
307
517
  return function(message, level, ...arg) {
308
518
  if(this.#stackTrace || Glog.stackTrace) {
@@ -363,16 +573,34 @@ class Glog {
363
573
  }
364
574
  }
365
575
 
576
+ /**
577
+ * Log an informational message
578
+ *
579
+ * @param {string} message - Info message to log
580
+ * @param {...unknown} arg - Additional arguments to log
581
+ */
366
582
  info(message, ...arg) {
367
583
  Term.info(this.#compose("info", message), ...arg)
368
584
  this.#vscodeInfo?.(JSON.stringify(message))
369
585
  }
370
586
 
587
+ /**
588
+ * Log a warning message
589
+ *
590
+ * @param {string} message - Warning message to log
591
+ * @param {...unknown} arg - Additional arguments to log
592
+ */
371
593
  warn(message, ...arg) {
372
594
  Term.warn(this.#compose("warn", message), ...arg)
373
595
  this.#vscodeWarn?.(JSON.stringify(message))
374
596
  }
375
597
 
598
+ /**
599
+ * Log an error message
600
+ *
601
+ * @param {string} message - Error message to log
602
+ * @param {...unknown} arg - Additional arguments to log
603
+ */
376
604
  error(message, ...arg) {
377
605
  Term.error(this.#compose("error", message), ...arg)
378
606
  this.#vscodeError?.(JSON.stringify(message))
@@ -406,7 +634,12 @@ class Glog {
406
634
  }
407
635
  }
408
636
 
409
- // Instance execute for configured loggers
637
+ /**
638
+ * Instance execute method for configured loggers
639
+ * Can be called as: logger(data) or logger(level, data)
640
+ *
641
+ * @param {...unknown} args - Arguments (optional level number, then data)
642
+ */
410
643
  execute(...args) {
411
644
  this.#log(...args)
412
645
  }
@@ -414,13 +647,13 @@ class Glog {
414
647
  // === ENHANCED METHODS WITH @gesslar/colours ===
415
648
 
416
649
  /**
417
- * Log a colorized message using template literals
650
+ * Log a colourized message using template literals
418
651
  *
419
652
  * @param {Array<string>} strings - Template strings
420
653
  * @param {...unknown} values - Template values
421
- * @example logger.colorize`{success}Operation completed{/} in {bold}${time}ms{/}`
654
+ * @example logger.colourize`{success}Operation completed{/} in {bold}${time}ms{/}`
422
655
  */
423
- colorize(strings, ...values) {
656
+ colourize(strings, ...values) {
424
657
  const message = c(strings, ...values)
425
658
  const name = this.#name || Glog.name || "Log"
426
659
 
@@ -428,12 +661,12 @@ class Glog {
428
661
  }
429
662
 
430
663
  /**
431
- * Static version of colorize for global usage
664
+ * Static version of colourize for global usage
432
665
  *
433
666
  * @param {Array<string>} strings - Template strings
434
667
  * @param {...unknown} values - Template values
435
668
  */
436
- static colorize(strings, ...values) {
669
+ static colourize(strings, ...values) {
437
670
  const message = c(strings, ...values)
438
671
  const name = this.name || "Log"
439
672
 
@@ -441,7 +674,7 @@ class Glog {
441
674
  }
442
675
 
443
676
  /**
444
- * Log a success message with green color
677
+ * Log a success message with green colour
445
678
  *
446
679
  * @param {string} message - Success message
447
680
  * @param {...unknown} args - Additional arguments
@@ -457,14 +690,14 @@ class Glog {
457
690
  * @param {...unknown} args - Additional arguments to log
458
691
  */
459
692
  static success(message, ...args) {
460
- const colors = this.colors || loggerColours
693
+ const colours = this.colours || loggerColours
461
694
  const name = this.name || "Log"
462
695
  const useStrings = this.tagsAsStrings
463
696
  const tag = useStrings ? "Success" : logSymbols.success
464
- const colorCode = colors.success || "{F046}"
697
+ const colourCode = colours.success || "{F046}"
465
698
  const formatted = useStrings
466
- ? c`[${name}] ${colorCode}${tag}{/}: ${message}`
467
- : c`[${name}] ${colorCode}${tag}{/} ${message}`
699
+ ? c`[${name}] ${colourCode}${tag}{/}: ${message}`
700
+ : c`[${name}] ${colourCode}${tag}{/} ${message}`
468
701
 
469
702
  Term.log(formatted, ...args)
470
703
  }
@@ -495,14 +728,14 @@ class Glog {
495
728
  * @param {number} [level=1] - Debug level
496
729
  */
497
730
  static groupDebug(message, level = 1) {
498
- const colors = this.colors || loggerColours
731
+ const colours = this.colours || loggerColours
499
732
  const name = this.name || "Log"
500
733
  const useStrings = this.tagsAsStrings
501
734
  const tag = useStrings ? "Debug" : logSymbols.debug
502
- const colorCode = colors.debug[level] || colors.debug[0]
735
+ const colourCode = colours.debug[level] || colours.debug[0]
503
736
  const label = useStrings
504
- ? c`[${name}] ${colorCode}${tag}{/}: ${message}`
505
- : c`[${name}] ${colorCode}${tag}{/} ${message}`
737
+ ? c`[${name}] ${colourCode}${tag}{/}: ${message}`
738
+ : c`[${name}] ${colourCode}${tag}{/} ${message}`
506
739
 
507
740
  Term.group(label)
508
741
  }
@@ -513,13 +746,13 @@ class Glog {
513
746
  * @param {string} message - Group label
514
747
  */
515
748
  static groupInfo(message) {
516
- const colors = this.colors || loggerColours
749
+ const colours = this.colours || loggerColours
517
750
  const name = this.name || "Log"
518
751
  const useStrings = this.tagsAsStrings
519
752
  const tag = useStrings ? "Info" : logSymbols.info
520
753
  const label = useStrings
521
- ? c`[${name}] ${colors.info}${tag}{/}: ${message}`
522
- : c`[${name}] ${colors.info}${tag}{/} ${message}`
754
+ ? c`[${name}] ${colours.info}${tag}{/}: ${message}`
755
+ : c`[${name}] ${colours.info}${tag}{/} ${message}`
523
756
 
524
757
  Term.group(label)
525
758
  }
@@ -657,14 +890,14 @@ class Glog {
657
890
  }
658
891
 
659
892
  /**
660
- * Set a color alias for convenient usage
893
+ * Set a colour alias for convenient usage
661
894
  *
662
895
  * @param {string} alias - Alias name
663
- * @param {string} colorCode - Color code (e.g., "{F196}" or "{<B}")
896
+ * @param {string} colourCode - Colour code (e.g., "{F196}" or "{<B}")
664
897
  * @returns {Glog} The Glog class for chaining.
665
898
  */
666
- static setAlias(alias, colorCode) {
667
- c.alias.set(alias, colorCode)
899
+ static setAlias(alias, colourCode) {
900
+ c.alias.set(alias, colourCode)
668
901
 
669
902
  return this
670
903
  }
@@ -682,6 +915,15 @@ class Glog {
682
915
  * Get a raw logger that outputs without name/tag formatting
683
916
  *
684
917
  * @returns {object} Raw logger interface
918
+ * @returns {Function} return.debug - Raw debug output function
919
+ * @returns {Function} return.info - Raw info output function
920
+ * @returns {Function} return.warn - Raw warning output function
921
+ * @returns {Function} return.error - Raw error output function
922
+ * @returns {Function} return.log - Raw log output function
923
+ * @returns {Function} return.success - Raw success output function
924
+ * @returns {Function} return.table - Raw table output function
925
+ * @returns {Function} return.group - Raw group start function
926
+ * @returns {Function} return.groupEnd - Raw group end function
685
927
  */
686
928
  get raw() {
687
929
  return {
@@ -701,6 +943,15 @@ class Glog {
701
943
  * Static raw logger that outputs without name/tag formatting
702
944
  *
703
945
  * @returns {object} Raw logger interface
946
+ * @returns {Function} return.debug - Raw debug output function
947
+ * @returns {Function} return.info - Raw info output function
948
+ * @returns {Function} return.warn - Raw warning output function
949
+ * @returns {Function} return.error - Raw error output function
950
+ * @returns {Function} return.log - Raw log output function
951
+ * @returns {Function} return.success - Raw success output function
952
+ * @returns {Function} return.table - Raw table output function
953
+ * @returns {Function} return.group - Raw group start function
954
+ * @returns {Function} return.groupEnd - Raw group end function
704
955
  */
705
956
  static get raw() {
706
957
  return {
@@ -44,11 +44,10 @@ export default class VFileObject extends FileObject {
44
44
  super(fileName, parent)
45
45
 
46
46
  const parentRealPath = this.parent.real.path
47
- const relative = FS.absoluteToRelative(this.path, true)
48
- const resolved = FS.resolvePath(parentRealPath, relative)
49
- const {base, dir} = FS.pathParts(resolved)
47
+ const resolved = FS.resolvePath(this.parent.path, fileName)
48
+ const {base} = FS.pathParts(resolved)
50
49
 
51
- this.#real = new FileObject(base, dir)
50
+ this.#real = new FileObject(base, parentRealPath)
52
51
  }
53
52
 
54
53
  get isVirtual() {
@@ -11,6 +11,14 @@ export default class Promised {
11
11
  * @returns {Promise<Array<unknown>>} Results of all promises
12
12
  */
13
13
  static await(promises: Array<Promise<unknown>>): Promise<Array<unknown>>;
14
+ /**
15
+ * Returns the first promise to resolve or reject from an array of promises.
16
+ * Wrapper around Promise.race for consistency with other utility methods.
17
+ *
18
+ * @param {Array<Promise<unknown>>} promises - Array of promises to race
19
+ * @returns {Promise<unknown>} Result of the first settled promise
20
+ */
21
+ static race(promises: Array<Promise<unknown>>): Promise<unknown>;
14
22
  /**
15
23
  * Settles all promises (both fulfilled and rejected) in parallel.
16
24
  * Wrapper around Promise.allSettled for consistency with other utility methods.
@@ -107,13 +115,5 @@ export default class Promised {
107
115
  value?: unknown;
108
116
  reason?: unknown;
109
117
  }>): void;
110
- /**
111
- * Returns the first promise to resolve or reject from an array of promises.
112
- * Wrapper around Promise.race for consistency with other utility methods.
113
- *
114
- * @param {Array<Promise<unknown>>} promises - Array of promises to race
115
- * @returns {Promise<unknown>} Result of the first settled promise
116
- */
117
- static race(promises: Array<Promise<unknown>>): Promise<unknown>;
118
118
  }
119
119
  //# sourceMappingURL=Promised.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Promised.d.ts","sourceRoot":"","sources":["../../../src/browser/lib/Promised.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IACE;;;;;;OAMG;IACH,uBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAInC;IAED;;;;;;OAMG;IACH,wBAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC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