@gesslar/toolkit 3.12.3 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +5 -4
  2. package/package.json +2 -2
  3. package/src/{index.js → node/index.js} +11 -10
  4. package/src/{lib → node/lib}/DirectoryObject.js +47 -88
  5. package/src/{lib → node/lib}/FileObject.js +78 -179
  6. package/src/{lib/FS.js → node/lib/FileSystem.js} +7 -7
  7. package/src/{lib → node/lib}/Glog.js +2 -2
  8. package/src/{lib → node/lib}/Logger.js +1 -1
  9. package/src/{lib → node/lib}/Sass.js +1 -1
  10. package/src/{lib → node/lib}/Tantrum.js +1 -1
  11. package/src/{lib → node/lib}/TempDirectoryObject.js +9 -9
  12. package/src/{lib → node/lib}/Util.js +1 -1
  13. package/src/node/lib/VDirectoryObject.js +198 -0
  14. package/src/node/lib/VFileObject.js +61 -0
  15. package/src/{lib → node/lib}/Valid.js +11 -5
  16. package/src/lib/CappedDirectoryObject.js +0 -276
  17. package/src/types/browser/index.d.ts +0 -13
  18. package/src/types/browser/index.d.ts.map +0 -1
  19. package/src/types/browser/lib/Collection.d.ts +0 -248
  20. package/src/types/browser/lib/Collection.d.ts.map +0 -1
  21. package/src/types/browser/lib/Data.d.ts +0 -250
  22. package/src/types/browser/lib/Data.d.ts.map +0 -1
  23. package/src/types/browser/lib/Disposer.d.ts +0 -33
  24. package/src/types/browser/lib/Disposer.d.ts.map +0 -1
  25. package/src/types/browser/lib/HTML.d.ts +0 -40
  26. package/src/types/browser/lib/HTML.d.ts.map +0 -1
  27. package/src/types/browser/lib/Notify.d.ts +0 -60
  28. package/src/types/browser/lib/Notify.d.ts.map +0 -1
  29. package/src/types/browser/lib/Promised.d.ts +0 -119
  30. package/src/types/browser/lib/Promised.d.ts.map +0 -1
  31. package/src/types/browser/lib/Sass.d.ts +0 -63
  32. package/src/types/browser/lib/Sass.d.ts.map +0 -1
  33. package/src/types/browser/lib/Tantrum.d.ts +0 -52
  34. package/src/types/browser/lib/Tantrum.d.ts.map +0 -1
  35. package/src/types/browser/lib/Time.d.ts +0 -42
  36. package/src/types/browser/lib/Time.d.ts.map +0 -1
  37. package/src/types/browser/lib/TypeSpec.d.ts +0 -90
  38. package/src/types/browser/lib/TypeSpec.d.ts.map +0 -1
  39. package/src/types/browser/lib/Util.d.ts +0 -62
  40. package/src/types/browser/lib/Util.d.ts.map +0 -1
  41. package/src/types/browser/lib/Valid.d.ts +0 -33
  42. package/src/types/browser/lib/Valid.d.ts.map +0 -1
  43. package/src/types/browser/lib/vendor/dompurify.esm.d.ts +0 -29
  44. package/src/types/browser/lib/vendor/dompurify.esm.d.ts.map +0 -1
  45. package/src/types/index.d.ts +0 -20
  46. package/src/types/index.d.ts.map +0 -1
  47. package/src/types/lib/Cache.d.ts +0 -27
  48. package/src/types/lib/Cache.d.ts.map +0 -1
  49. package/src/types/lib/CappedDirectoryObject.d.ts +0 -144
  50. package/src/types/lib/CappedDirectoryObject.d.ts.map +0 -1
  51. package/src/types/lib/DirectoryObject.d.ts +0 -288
  52. package/src/types/lib/DirectoryObject.d.ts.map +0 -1
  53. package/src/types/lib/FS.d.ts +0 -188
  54. package/src/types/lib/FS.d.ts.map +0 -1
  55. package/src/types/lib/FileObject.d.ts +0 -245
  56. package/src/types/lib/FileObject.d.ts.map +0 -1
  57. package/src/types/lib/Glog.d.ts +0 -228
  58. package/src/types/lib/Glog.d.ts.map +0 -1
  59. package/src/types/lib/Logger.d.ts +0 -46
  60. package/src/types/lib/Logger.d.ts.map +0 -1
  61. package/src/types/lib/Notify.d.ts +0 -54
  62. package/src/types/lib/Notify.d.ts.map +0 -1
  63. package/src/types/lib/Sass.d.ts +0 -9
  64. package/src/types/lib/Sass.d.ts.map +0 -1
  65. package/src/types/lib/Tantrum.d.ts +0 -9
  66. package/src/types/lib/Tantrum.d.ts.map +0 -1
  67. package/src/types/lib/TempDirectoryObject.d.ts +0 -42
  68. package/src/types/lib/TempDirectoryObject.d.ts.map +0 -1
  69. package/src/types/lib/Term.d.ts +0 -127
  70. package/src/types/lib/Term.d.ts.map +0 -1
  71. package/src/types/lib/Util.d.ts +0 -100
  72. package/src/types/lib/Util.d.ts.map +0 -1
  73. package/src/types/lib/Valid.d.ts +0 -33
  74. package/src/types/lib/Valid.d.ts.map +0 -1
  75. /package/src/{lib → node/lib}/Cache.js +0 -0
  76. /package/src/{lib → node/lib}/Notify.js +0 -0
  77. /package/src/{lib → node/lib}/Term.js +0 -0
@@ -1,127 +0,0 @@
1
- export default class Term {
2
- /**
3
- * Log an informational message.
4
- *
5
- * @param {...unknown} [arg] - Values to log.
6
- */
7
- static log(...arg?: unknown[]): void;
8
- /**
9
- * Log an informational message.
10
- *
11
- * @param {...unknown} [arg] - Values to log.
12
- */
13
- static info(...arg?: unknown[]): void;
14
- /**
15
- * Log a warning message.
16
- *
17
- * @param {...unknown} [arg] - Warning text / object.
18
- */
19
- static warn(...arg?: unknown[]): void;
20
- /**
21
- * Log an error message (plus optional details).
22
- *
23
- * @param {...unknown} [arg] - Values to log.
24
- */
25
- static error(...arg?: unknown[]): void;
26
- /**
27
- * Log a debug message (no-op unless console.debug provided/visible by env).
28
- *
29
- * @param {...unknown} [arg] - Values to log.
30
- */
31
- static debug(...arg?: unknown[]): void;
32
- /**
33
- * Start a console group for indented output.
34
- *
35
- * @param {...unknown} [arg] - Optional group label.
36
- */
37
- static group(...arg?: unknown[]): void;
38
- /**
39
- * End the current console group.
40
- */
41
- static groupEnd(): void;
42
- /**
43
- * Display tabular data as a table.
44
- *
45
- * @param {object | Array} tabularData - Object or array to display.
46
- * @param {object} [options] - Table options.
47
- * @param {Array<string>} [options.properties] - Optional column properties to display.
48
- * @param {boolean} [options.showHeader=false] - Whether to show the header row with column names.
49
- * @param {boolean} [options.quotedStrings=false] - Whether to show quotes around strings.
50
- */
51
- static table(tabularData: object | any[], options?: {
52
- properties?: Array<string>;
53
- showHeader?: boolean;
54
- quotedStrings?: boolean;
55
- }): void;
56
- /**
57
- * Emit a status line to the terminal.
58
- *
59
- * Accepts either a plain string or an array of message segments (see
60
- * `terminalMessage()` for formatting options). If `silent` is true, output
61
- * is suppressed.
62
- *
63
- * This is a convenient shortcut for logging status updates, with optional
64
- * formatting and easy suppression.
65
- *
66
- * @param {string | Array<string | [string, string]>} args - Message or segments.
67
- * @param {object} [options] - Behaviour flags.
68
- * @param {boolean} options.silent - When true, suppress output.
69
- * @returns {void}
70
- */
71
- static status(args: string | Array<string | [string, string]>, { silent }?: {
72
- silent: boolean;
73
- }): void;
74
- /**
75
- * Constructs a formatted status line.
76
- *
77
- * Input forms:
78
- * - string: printed as-is
79
- * - array: each element is either:
80
- * - a plain string (emitted unchanged), or
81
- * - a tuple: [level, text] where `level` maps to an ansiColors alias
82
- * (e.g. success, info, warn, error, modified).
83
- * - a tuple: [level, text, [openBracket,closeBracket]] where `level` maps to an ansiColors alias
84
- * (e.g. success, info, warn, error, modified). These are rendered as
85
- * colourised bracketed segments: [TEXT].
86
- *
87
- * The function performs a shallow validation: tuple elements must both be
88
- * strings; otherwise a TypeError is thrown. Nested arrays beyond depth 1 are
89
- * not supported.
90
- *
91
- * Recursion: array input is normalised into a single string then re-dispatched
92
- * through `status` to leverage the string branch (keeps logic DRY).
93
- *
94
- * @param {string | Array<string | [string, string] | [string, string, string]>} argList - Message spec.
95
- * @returns {void}
96
- */
97
- static terminalMessage(argList: string | Array<string | [string, string] | [string, string, string]>): void;
98
- /**
99
- * Construct a single coloured bracketed segment from a tuple specifying
100
- * the style level and the text. The first element ("level") maps to an
101
- * `ansiColors` alias (e.g. success, info, warn, error, modified) and is
102
- * used both for the inner text colour and to locate its matching
103
- * "-bracket" alias for the surrounding square brackets. The second
104
- * element is the raw text to display.
105
- *
106
- * Input validation: every element of `parts` must be a string; otherwise
107
- * an `Sass` error is thrown. (Additional elements beyond the first two are
108
- * ignored – the method destructures only the first pair.)
109
- *
110
- * Example:
111
- * terminalBracket(["success", "COMPILED"]) → "[COMPILED]" with coloured
112
- * brackets + inner text (assuming colour support is available in the
113
- * terminal).
114
- *
115
- * This method does not append trailing spaces; callers are responsible for
116
- * joining multiple segments with appropriate separators.
117
- *
118
- * @param {Array<string>} parts - Tuple: [level, text]. Additional entries ignored.
119
- * @returns {string} Colourised bracketed segment (e.g. "[TEXT]").
120
- * @throws {Sass} If any element of `parts` is not a string.
121
- */
122
- static terminalBracket([level, text, brackets]: Array<string>): string;
123
- static resetTerminal(): Promise<void>;
124
- static clearLines(num: any): Promise<void>;
125
- static directWrite(output: any): Promise<any>;
126
- }
127
- //# sourceMappingURL=Term.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Term.d.ts","sourceRoot":"","sources":["../../lib/Term.js"],"names":[],"mappings":"AAOA;IACE;;;;OAIG;IACH,oBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,qBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,qBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;;;OAIG;IACH,sBAFc,OAAO,EAAA,QAIpB;IAED;;OAEG;IACH,wBAEC;IAED;;;;;;;;OAQG;IACH,0BANW,MAAM,QAAQ,YAEtB;QAAgC,UAAU,GAAlC,KAAK,CAAC,MAAM,CAAC;QACK,UAAU,GAA5B,OAAO;QACW,aAAa,GAA/B,OAAO;KACjB,QA2DA;IAED;;;;;;;;;;;;;;OAcG;IACH,oBALW,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,eAEjD;QAAyB,MAAM,EAAvB,OAAO;KACf,GAAU,IAAI,CAOhB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,gCAHW,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,GAClE,IAAI,CA4BhB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gDAJW,KAAK,CAAC,MAAM,CAAC,GACX,MAAM,CASlB;IAED,sCAGC;IAED,2CAEC;IAED,8CAIC;CACF"}
@@ -1,100 +0,0 @@
1
- /**
2
- * Utility class providing common helper functions for string manipulation,
3
- * timing, hashing, and option parsing.
4
- */
5
- export default class Util extends BrowserUtil {
6
- /**
7
- * Compute sha256 hash (hex) of the provided string.
8
- *
9
- * @param {string} s - Input string.
10
- * @returns {string} 64-char hexadecimal digest.
11
- */
12
- static hashOf(s: string): string;
13
- /**
14
- * Extracts canonical option names from a Commander-style options object.
15
- *
16
- * Each key in the input object is a string containing one or more option
17
- * forms, separated by commas (e.g. "-w, --watch"). This function splits each
18
- * key, trims whitespace, and parses out the long option name (e.g. "watch")
19
- * for each entry. If no long option ("--") is present, the short option (e.g.
20
- * "v" from "-v") will be included in the result array. If both are present,
21
- * the long option is preferred.
22
- *
23
- * Example:
24
- * generateOptionNames({"-w, --watch": "desc", "-v": "desc"})
25
- * → ["watch", "v"]
26
- *
27
- * Edge cases:
28
- * - If a key contains only a short option ("-v"), that short name will be
29
- * included in the result.
30
- * - If multiple long options are present, only the first is used.
31
- * - If the option string is malformed, may return undefined for that entry
32
- * (filtered out).
33
- *
34
- * @param {object} object - Mapping of option strings to descriptions.
35
- * @returns {Array<string>} Array of canonical option names (long preferred, short if no long present).
36
- */
37
- static generateOptionNames(object: object): Array<string>;
38
- /**
39
- * Private method that performs the actual async emission logic.
40
- * Handles listener execution, error aggregation, and result processing.
41
- *
42
- * @param {object} emitter - The emitter object (already validated)
43
- * @param {string} event - The event name to emit
44
- * @param {...unknown} args - Arguments to pass to event listeners
45
- * @returns {Promise<void>} Resolves when all listeners have completed
46
- */
47
- static "__#private@#performAsyncEmit"(emitter: object, event: string, ...args: unknown[]): Promise<void>;
48
- /**
49
- * Emits an event asynchronously and waits for all listeners to complete.
50
- * Unlike the standard EventEmitter.emit() which is synchronous, this method
51
- * properly handles async event listeners by waiting for all of them to
52
- * resolve or reject using Promise.allSettled().
53
- *
54
- * Uses strict instanceof checking to ensure the emitter is a genuine EventEmitter.
55
- *
56
- * @param {EventEmitter} emitter - The EventEmitter instance to emit on
57
- * @param {string} event - The event name to emit
58
- * @param {...unknown} args - Arguments to pass to event listeners
59
- * @returns {Promise<void>} Resolves when all listeners have completed
60
- */
61
- static asyncEmit(emitter: EventEmitter, event: string, ...args: unknown[]): Promise<void>;
62
- /**
63
- * Emits an event asynchronously and waits for all listeners to complete.
64
- * Like asyncEmit, but uses duck typing for more flexible emitter validation.
65
- * Accepts any object that has the required EventEmitter-like methods.
66
- * If it walks like an EventEmitter and quacks like an EventEmitter...
67
- *
68
- * @param {object} emitter - Any object with EventEmitter-like interface
69
- * @param {string} event - The event name to emit
70
- * @param {...unknown} args - Arguments to pass to event listeners
71
- * @returns {Promise<void>} Resolves when all listeners have completed, but no grapes.
72
- */
73
- static asyncEmitQuack(emitter: object, event: string, ...args: unknown[]): Promise<void>;
74
- /**
75
- * Retrieves an environment variable and parses it as JSON5.
76
- *
77
- * This method fetches the value of the specified environment variable and
78
- * attempts to parse it using JSON5. If the variable doesn't exist or is
79
- * empty, the default value is returned. If parsing fails, an error is
80
- * thrown.
81
- *
82
- * Example:
83
- * // export MY_CONFIG='{"debug": true, timeout: 5000}'
84
- * Util.getEnv("MY_CONFIG", {debug: false})
85
- * → {debug: true, timeout: 5000}
86
- *
87
- * Edge cases:
88
- * - If the environment variable doesn't exist, returns the default value
89
- * - If the value is an empty string, returns the default value
90
- * - If JSON5 parsing fails, throws a Sass error with context
91
- *
92
- * @param {string} ev - Name of the environment variable to retrieve
93
- * @param {unknown} [def=undefined] - Default value if variable doesn't exist or is empty
94
- * @returns {unknown} Parsed JSON5 value or default
95
- * @throws {Sass} If JSON5 parsing fails
96
- */
97
- static getEnv(ev: string, def?: unknown): unknown;
98
- }
99
- import { Util as BrowserUtil } from "../browser/index.js";
100
- //# sourceMappingURL=Util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../lib/Util.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACE;;;;;OAKG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mCAHW,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAazB;IAED;;;;;;;;OAQG;IACH,+CALW,MAAM,SACN,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAmBzB;IAED;;;;;;;;;;;;OAYG;IACH,0BALW,YAAY,SACZ,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAqBzB;IAED;;;;;;;;;;OAUG;IACH,+BALW,MAAM,SACN,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAyBzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,kBALW,MAAM,QACN,OAAO,GACL,OAAO,CAmBnB;CACF;oCApMiC,qBAAqB"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Validation utility class providing type checking and assertion methods.
3
- */
4
- export default class Valid {
5
- static "__#private@#restrictedProto": string[];
6
- /**
7
- * Validates a value against a type. Uses Data.isType.
8
- *
9
- * @param {unknown} value - The value to validate
10
- * @param {string} type - The expected type in the form of "object", "object[]", "object|object[]"
11
- * @param {object} [options] - Additional options for validation.
12
- */
13
- static type(value: unknown, type: string, options?: object): void;
14
- /**
15
- * Asserts a condition
16
- *
17
- * @param {boolean} condition - The condition to assert
18
- * @param {string} message - The message to display if the condition is not
19
- * met
20
- * @param {number} [arg] - The argument to display if the condition is not
21
- * met (optional)
22
- */
23
- static assert(condition: boolean, message: string, arg?: number): void;
24
- /**
25
- * Protects against prototype pollution by checking keys for dangerous property names.
26
- * Throws if any restricted prototype properties are found in the keys array.
27
- *
28
- * @param {Array<string>} keys - Array of property keys to validate
29
- * @throws {Sass} If any key matches restricted prototype properties (__proto__, constructor, prototype)
30
- */
31
- static prototypePollutionProtection(keys: Array<string>): void;
32
- }
33
- //# sourceMappingURL=Valid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Valid.d.ts","sourceRoot":"","sources":["../../lib/Valid.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,+CAAmE;IAEnE;;;;;;OAMG;IACH,mBAJW,OAAO,QACP,MAAM,YACN,MAAM,QAQhB;IAED;;;;;;;;OAQG;IACH,yBANW,OAAO,WACP,MAAM,QAEN,MAAM,QAkBhB;IAED;;;;;;OAMG;IACH,0CAHW,KAAK,CAAC,MAAM,CAAC,QAYvB;CACF"}
File without changes
File without changes
File without changes