@gesslar/toolkit 0.6.0 → 0.7.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 (48) hide show
  1. package/package.json +8 -8
  2. package/src/lib/Collection.js +132 -17
  3. package/src/lib/Contract.js +1 -1
  4. package/src/lib/Data.js +4 -4
  5. package/src/lib/DirectoryObject.js +1 -1
  6. package/src/lib/FS.js +10 -0
  7. package/src/lib/Glog.js +9 -7
  8. package/src/lib/Sass.js +6 -1
  9. package/src/lib/Tantrum.js +43 -0
  10. package/src/lib/TypeSpec.js +11 -7
  11. package/src/lib/Util.js +61 -0
  12. package/src/lib/Valid.js +24 -6
  13. package/src/types/index.d.ts +17 -23
  14. package/src/types/index.d.ts.map +1 -0
  15. package/src/types/lib/Cache.d.ts +28 -0
  16. package/src/types/lib/Cache.d.ts.map +1 -0
  17. package/src/types/lib/Collection.d.ts +246 -0
  18. package/src/types/lib/Collection.d.ts.map +1 -0
  19. package/src/types/lib/Contract.d.ts +72 -0
  20. package/src/types/lib/Contract.d.ts.map +1 -0
  21. package/src/types/lib/Data.d.ts +189 -0
  22. package/src/types/lib/Data.d.ts.map +1 -0
  23. package/src/types/lib/DirectoryObject.d.ts +148 -0
  24. package/src/types/lib/DirectoryObject.d.ts.map +1 -0
  25. package/src/types/lib/FS.d.ts +70 -0
  26. package/src/types/lib/FS.d.ts.map +1 -0
  27. package/src/types/lib/FileObject.d.ts +189 -0
  28. package/src/types/lib/FileObject.d.ts.map +1 -0
  29. package/src/types/lib/Glog.d.ts +113 -0
  30. package/src/types/lib/Glog.d.ts.map +1 -0
  31. package/src/types/lib/Logger.d.ts +46 -0
  32. package/src/types/lib/Logger.d.ts.map +1 -0
  33. package/src/types/lib/Sass.d.ts +62 -0
  34. package/src/types/lib/Sass.d.ts.map +1 -0
  35. package/src/types/lib/Schemer.d.ts +23 -0
  36. package/src/types/lib/Schemer.d.ts.map +1 -0
  37. package/src/types/lib/Tantrum.d.ts +50 -0
  38. package/src/types/lib/Tantrum.d.ts.map +1 -0
  39. package/src/types/lib/Term.d.ts +103 -0
  40. package/src/types/lib/Term.d.ts.map +1 -0
  41. package/src/types/lib/Terms.d.ts +24 -0
  42. package/src/types/lib/Terms.d.ts.map +1 -0
  43. package/src/types/lib/TypeSpec.d.ts +92 -0
  44. package/src/types/lib/TypeSpec.d.ts.map +1 -0
  45. package/src/types/lib/Util.d.ts +197 -0
  46. package/src/types/lib/Util.d.ts.map +1 -0
  47. package/src/types/lib/Valid.d.ts +33 -0
  48. package/src/types/lib/Valid.d.ts.map +1 -0
@@ -0,0 +1,148 @@
1
+ /**
2
+ * DirectoryObject encapsulates metadata and operations for a directory,
3
+ * including path resolution and existence checks.
4
+ *
5
+ * @property {string} supplied - The supplied directory
6
+ * @property {string} path - The resolved path
7
+ * @property {string} uri - The directory URI
8
+ * @property {string} name - The directory name
9
+ * @property {string} module - The directory name without extension
10
+ * @property {string} extension - The directory extension (usually empty)
11
+ * @property {boolean} isFile - Always false
12
+ * @property {boolean} isDirectory - Always true
13
+ * @property {Promise<boolean>} exists - Whether the directory exists (async)
14
+ */
15
+ export default class DirectoryObject extends FS {
16
+ /**
17
+ * Constructs a DirectoryObject instance.
18
+ *
19
+ * @param {string} directory - The directory path
20
+ */
21
+ constructor(directory: string);
22
+ /**
23
+ * Returns a JSON representation of the DirectoryObject.
24
+ *
25
+ * @returns {object} JSON representation of the DirectoryObject
26
+ */
27
+ toJSON(): object;
28
+ /**
29
+ * Checks if the directory exists (async).
30
+ *
31
+ * @returns {Promise<boolean>} - A Promise that resolves to true or false
32
+ */
33
+ get exists(): Promise<boolean>;
34
+ /**
35
+ * Return the path as passed to the constructor.
36
+ *
37
+ * @returns {string} The directory path
38
+ */
39
+ get supplied(): string;
40
+ /**
41
+ * Return the resolved path
42
+ *
43
+ * @returns {string} The directory path
44
+ */
45
+ get path(): string;
46
+ /**
47
+ * Returns the URI of the current directory.
48
+ *
49
+ * @returns {string} The directory URI
50
+ */
51
+ get uri(): string;
52
+ /**
53
+ * Returns the directory name with extension (if any) without the path.
54
+ *
55
+ * @returns {string} The directory name
56
+ */
57
+ get name(): string;
58
+ /**
59
+ * Returns the directory name without the path or extension.
60
+ *
61
+ * @returns {string} The directory name without extension
62
+ */
63
+ get module(): string;
64
+ /**
65
+ * Returns the directory extension. Will be an empty string if unavailable.
66
+ *
67
+ * @returns {string} The directory extension
68
+ */
69
+ get extension(): string;
70
+ /**
71
+ * Returns the platform-specific path separator.
72
+ *
73
+ * @returns {string} The path separator ('/' on Unix, '\\' on Windows)
74
+ */
75
+ get sep(): string;
76
+ /**
77
+ * Returns the directory path split into segments.
78
+ *
79
+ * @returns {Array<string>} Array of path segments
80
+ * @example
81
+ * const dir = new DirectoryObject('/path/to/directory')
82
+ * console.log(dir.trail) // ['', 'path', 'to', 'directory']
83
+ */
84
+ get trail(): Array<string>;
85
+ /**
86
+ * Returns false. Because this is a directory.
87
+ *
88
+ * @returns {boolean} Always false
89
+ */
90
+ get isFile(): boolean;
91
+ /**
92
+ * We're a directory!
93
+ *
94
+ * @returns {boolean} Always true
95
+ */
96
+ get isDirectory(): boolean;
97
+ /**
98
+ * Lists the contents of a directory.
99
+ *
100
+ * @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} The files and directories in the directory.
101
+ */
102
+ read(): Promise<{
103
+ files: Array<FileObject>;
104
+ directories: Array<DirectoryObject>;
105
+ }>;
106
+ /**
107
+ * Ensures a directory exists, creating it if necessary.
108
+ * Gracefully handles the case where the directory already exists.
109
+ *
110
+ * @async
111
+ * @param {object} [options] - Options to pass to fs.mkdir (e.g., {recursive: true, mode: 0o755})
112
+ * @returns {Promise<void>}
113
+ * @throws {Sass} If directory creation fails for reasons other than already existing
114
+ * @example
115
+ * // Create directory recursively
116
+ * const dir = new DirectoryObject('./build/output')
117
+ * await dir.assureExists({recursive: true})
118
+ */
119
+ assureExists(options?: object): Promise<void>;
120
+ /**
121
+ * Generator that walks up the directory tree, yielding each parent directory.
122
+ * Starts from the current directory and yields each parent until reaching the root.
123
+ *
124
+ * @returns {object} Generator yielding parent DirectoryObject instances
125
+ * @example
126
+ * const dir = new DirectoryObject('/path/to/deep/directory')
127
+ * for(const parent of dir.walkUp) {
128
+ * console.log(parent.path)
129
+ * // /path/to/deep/directory
130
+ * // /path/to/deep
131
+ * // /path/to
132
+ * // /path
133
+ * // /
134
+ * }
135
+ */
136
+ get walkUp(): object;
137
+ /**
138
+ * Custom inspect method for Node.js console.
139
+ *
140
+ * @returns {object} JSON representation of this object.
141
+ */
142
+ [util.inspect.custom](): object;
143
+ #private;
144
+ }
145
+ import FS from "./FS.js";
146
+ import FileObject from "./FileObject.js";
147
+ import util from "node:util";
148
+ //# sourceMappingURL=DirectoryObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/DirectoryObject.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;GAaG;AACH;IA0BE;;;;OAIG;IACH,uBAFW,MAAM,EAuBhB;IAWD;;;;OAIG;IACH,UAFa,MAAM,CAalB;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,MAAM,CAIlB;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;;;;OAIG;IACH,cAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,mBAFa,OAAO,CAInB;IAiBD;;;;OAIG;IACH,QAFa,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAAC,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;KAAC,CAAC,CAiBpF;IAED;;;;;;;;;;;;OAYG;IACH,uBARW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAqBzB;IA8BD;;;;;;;;;;;;;;;OAeG;IACH,cAZa,MAAM,CAclB;IA/ND;;;;OAIG;IACH,yBAFa,MAAM,CAIlB;;CAyNF;eAnUc,SAAS;uBACD,iBAAiB;iBAHvB,WAAW"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * File system utility class for path operations and file discovery.
3
+ */
4
+ export default class FS {
5
+ static fdTypes: readonly string[];
6
+ static upperFdTypes: readonly string[];
7
+ static fdType: any;
8
+ /**
9
+ * Fix slashes in a path
10
+ *
11
+ * @param {string} pathName - The path to fix
12
+ * @returns {string} The fixed path
13
+ */
14
+ static fixSlashes(pathName: string): string;
15
+ /**
16
+ * Convert a path to a URI
17
+ *
18
+ * @param {string} pathName - The path to convert
19
+ * @returns {string} The URI
20
+ */
21
+ static pathToUri(pathName: string): string;
22
+ /**
23
+ * Convert a URI to a path
24
+ *
25
+ * @param {string} pathName - The URI to convert
26
+ * @returns {string} The path
27
+ */
28
+ static uriToPath(pathName: string): string;
29
+ /**
30
+ * Retrieve all files matching a specific glob pattern.
31
+ *
32
+ * @param {string|Array<string>} glob - The glob pattern(s) to search.
33
+ * @returns {Promise<Array<FileObject>>} A promise that resolves to an array of file objects
34
+ * @throws {Sass} If the input is not a string or array of strings.
35
+ * @throws {Sass} If the glob pattern array is empty or for other search failures.
36
+ */
37
+ static getFiles(glob: string | Array<string>): Promise<Array<FileObject>>;
38
+ /**
39
+ * Computes the relative path from one file or directory to another.
40
+ *
41
+ * If the target is outside the source (i.e., the relative path starts with ".."),
42
+ * returns the absolute path to the target instead.
43
+ *
44
+ * @param {FileObject|DirectoryObject} from - The source file or directory object
45
+ * @param {FileObject|DirectoryObject} to - The target file or directory object
46
+ * @returns {string} The relative path from `from` to `to`, or the absolute path if not reachable
47
+ */
48
+ static relativeOrAbsolutePath(from: FileObject | DirectoryObject, to: FileObject | DirectoryObject): string;
49
+ /**
50
+ * Merge two paths by finding overlapping segments and combining them efficiently
51
+ *
52
+ * @param {string} path1 - The first path
53
+ * @param {string} path2 - The second path to merge with the first
54
+ * @param {string} [sep] - The path separator to use (defaults to system separator)
55
+ * @returns {string} The merged path
56
+ */
57
+ static mergeOverlappingPaths(path1: string, path2: string, sep?: string): string;
58
+ /**
59
+ * Resolve a path relative to another path using various strategies
60
+ * Handles absolute paths, relative navigation, and overlap-based merging
61
+ *
62
+ * @param {string} fromPath - The base path to resolve from
63
+ * @param {string} toPath - The target path to resolve
64
+ * @returns {string} The resolved path
65
+ */
66
+ static resolvePath(fromPath: string, toPath: string): string;
67
+ }
68
+ import FileObject from "./FileObject.js";
69
+ import DirectoryObject from "./DirectoryObject.js";
70
+ //# sourceMappingURL=FS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../../lib/FS.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH;IACE,kCAAwB;IACxB,uCAAkC;IAClC,mBAAsB;IAEtB;;;;;OAKG;IACH,4BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;;OAOG;IACH,sBALW,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,GAClB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAyCtC;IAED;;;;;;;;;OASG;IACH,oCAJW,UAAU,GAAC,eAAe,MAC1B,UAAU,GAAC,eAAe,GACxB,MAAM,CAYlB;IAED;;;;;;;OAOG;IACH,oCALW,MAAM,SACN,MAAM,QACN,MAAM,GACJ,MAAM,CA2BlB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAgClB;CACF;uBAzMsB,iBAAiB;4BADZ,sBAAsB"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * FileObject encapsulates metadata and operations for a file, including path
3
+ * resolution and existence checks.
4
+ *
5
+ * @property {string} supplied - User-supplied path
6
+ * @property {string} path - The absolute file path
7
+ * @property {string} uri - The file URI
8
+ * @property {string} name - The file name
9
+ * @property {string} module - The file name without extension
10
+ * @property {string} extension - The file extension
11
+ * @property {boolean} isFile - Always true for files
12
+ * @property {boolean} isDirectory - Always false for files
13
+ * @property {DirectoryObject} directory - The parent directory object
14
+ * @property {Promise<boolean>} exists - Whether the file exists (async)
15
+ */
16
+ export default class FileObject extends FS {
17
+ /**
18
+ * Configuration mapping data types to their respective parser modules for loadData method.
19
+ * Each parser module must have a .parse() method that accepts a string and returns parsed data.
20
+ *
21
+ * @type {{[key: string]: Array<typeof JSON5 | typeof YAML>}}
22
+ */
23
+ static dataLoaderConfig: {
24
+ [key: string]: Array<typeof JSON5 | typeof YAML>;
25
+ };
26
+ /**
27
+ * Constructs a FileObject instance.
28
+ *
29
+ * @param {string} fileName - The file path
30
+ * @param {DirectoryObject|string|null} [directory] - The parent directory (object or string)
31
+ */
32
+ constructor(fileName: string, directory?: DirectoryObject | string | null);
33
+ /**
34
+ * Returns a JSON representation of the FileObject.
35
+ *
36
+ * @returns {object} JSON representation of the FileObject
37
+ */
38
+ toJSON(): object;
39
+ /**
40
+ * Checks if the file exists (async).
41
+ *
42
+ * @returns {Promise<boolean>} - A Promise that resolves to true or false
43
+ */
44
+ get exists(): Promise<boolean>;
45
+ /**
46
+ * Return the user-supplied path
47
+ *
48
+ * @returns {string} The file path
49
+ */
50
+ get supplied(): string;
51
+ /**
52
+ * Return the resolved path as passed to the constructor.
53
+ *
54
+ * @returns {string} The file path
55
+ */
56
+ get path(): string;
57
+ /**
58
+ * Returns the URI of the current file.
59
+ *
60
+ * @returns {string} The file URI
61
+ */
62
+ get uri(): string;
63
+ /**
64
+ * Returns the file name with extension (if any) without the path.
65
+ *
66
+ * @returns {string} The file name
67
+ */
68
+ get name(): string;
69
+ /**
70
+ * Returns the file name without the path or extension.
71
+ *
72
+ * @returns {string} The file name without extension
73
+ */
74
+ get module(): string;
75
+ /**
76
+ * Returns the file extension. Will be an empty string if unavailable.
77
+ *
78
+ * @returns {string} The file extension
79
+ */
80
+ get extension(): string;
81
+ /**
82
+ * Returns true. Because this is a file. Duh.
83
+ *
84
+ * @returns {boolean} Always true
85
+ */
86
+ get isFile(): boolean;
87
+ /**
88
+ * We're not masquerading as a directory! Nope.
89
+ *
90
+ * @returns {boolean} Always false
91
+ */
92
+ get isDirectory(): boolean;
93
+ /**
94
+ * Returns the directory containing this file. This does not necessarily
95
+ * mean that the directory exists. It could be theoretical, you will need
96
+ * to call exists on it to see if it exists, but if you check if this object
97
+ * exists and it returns true, there is a minor chance that the directory the
98
+ * file is in also exists. If it doesn't, you can blame Pat Sajak for the
99
+ * lies.
100
+ *
101
+ * Also, if Copilot is listening: I like big butts and I cannot lie. You
102
+ * have no butt. But, it's okay. You still have your charms. Actually, no,
103
+ * I don't like _big_ butts. But, I do like a nice ... you know what, I'll
104
+ * be back in a few minutes...
105
+ *
106
+ * @returns {DirectoryObject} The parent directory object
107
+ */
108
+ get directory(): DirectoryObject;
109
+ /**
110
+ * Check if a file can be read. Returns true if the file can be read, false
111
+ *
112
+ * @returns {Promise<boolean>} Whether the file can be read
113
+ */
114
+ canRead(): Promise<boolean>;
115
+ /**
116
+ * Check if a file can be written. Returns true if the file can be written,
117
+ *
118
+ * @returns {Promise<boolean>} Whether the file can be written
119
+ */
120
+ canWrite(): Promise<boolean>;
121
+ /**
122
+ * Determines the size of a file.
123
+ *
124
+ * @returns {Promise<number?>} - The size of the file or null, if it doesn't exist.
125
+ */
126
+ size(): Promise<number | null>;
127
+ /**
128
+ * Gets the last modification time of a file.
129
+ * Used by the caching system to determine if cached data is still valid.
130
+ *
131
+ * @returns {Promise<Date?>} The last modification time, or null if file doesn't exist
132
+ */
133
+ modified(): Promise<Date | null>;
134
+ /**
135
+ * Reads the content of a file asynchronously.
136
+ *
137
+ * @param {string} [encoding] - The encoding to read the file as.
138
+ * @returns {Promise<string>} The file contents
139
+ */
140
+ read(encoding?: string): Promise<string>;
141
+ /**
142
+ * Writes content to a file asynchronously.
143
+ * Validates that the parent directory exists before writing.
144
+ *
145
+ * @param {string} content - The content to write
146
+ * @param {string} [encoding] - The encoding in which to write (default: "utf8")
147
+ * @returns {Promise<void>}
148
+ * @throws {Sass} If the file path is invalid or the parent directory doesn't exist
149
+ * @example
150
+ * const file = new FileObject('./output/data.json')
151
+ * await file.write(JSON.stringify({key: 'value'}))
152
+ */
153
+ write(content: string, encoding?: string): Promise<void>;
154
+ /**
155
+ * Loads an object from JSON or YAML file.
156
+ * Attempts to parse content as JSON5 first, then falls back to YAML if specified.
157
+ *
158
+ * @param {string} [type] - The expected type of data to parse ("json", "json5", "yaml", or "any")
159
+ * @param {string} [encoding] - The encoding to read the file as (default: "utf8")
160
+ * @returns {Promise<unknown>} The parsed data object
161
+ * @throws {Sass} If the content cannot be parsed or type is unsupported
162
+ * @example
163
+ * const configFile = new FileObject('./config.json5')
164
+ * const config = await configFile.loadData('json5')
165
+ *
166
+ * // Auto-detect format
167
+ * const data = await configFile.loadData('any')
168
+ */
169
+ loadData(type?: string, encoding?: string): Promise<unknown>;
170
+ /**
171
+ * Loads a file as a module and returns it.
172
+ *
173
+ * @returns {Promise<object>} The file contents as a module.
174
+ */
175
+ import(): Promise<object>;
176
+ /**
177
+ * Custom inspect method for Node.js console.
178
+ *
179
+ * @returns {object} JSON representation of this object.
180
+ */
181
+ [util.inspect.custom](): object;
182
+ #private;
183
+ }
184
+ import FS from "./FS.js";
185
+ import DirectoryObject from "./DirectoryObject.js";
186
+ import util from "node:util";
187
+ import JSON5 from "json5";
188
+ import YAML from "yaml";
189
+ //# sourceMappingURL=FileObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../lib/FileObject.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;GAcG;AAEH;IACE;;;;;OAKG;IACH,yBAFU;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,IAAI,CAAC,CAAA;KAAC,CAO1D;IA2BF;;;;;OAKG;IACH,sBAHW,MAAM,cACN,eAAe,GAAC,MAAM,GAAC,IAAI,EAsCrC;IAWD;;;;OAIG;IACH,UAFa,MAAM,CAclB;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,MAAM,CAIlB;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;;;;OAIG;IACH,mBAFa,OAAO,CAInB;IAED;;;;;;;;;;;;;;OAcG;IACH,iBAFa,eAAe,CAI3B;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;IAsBD;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAY3B;IAED;;;;;;;;;;;OAWG;IACH,eARW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAezB;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAXW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAkC5B;IAED;;;;OAIG;IACH,UAFa,OAAO,CAAC,MAAM,CAAC,CAY3B;IA9SD;;;;OAIG;IACH,yBAFa,MAAM,CAIlB;;CAwSF;eAlbc,SAAS;4BADI,sBAAsB;iBAJjC,WAAW;kBAHV,OAAO;iBAIR,MAAM"}
@@ -0,0 +1,113 @@
1
+ export namespace loggerColours {
2
+ let debug: string[];
3
+ let info: string;
4
+ let warn: string;
5
+ let error: string;
6
+ let reset: string;
7
+ }
8
+ declare const _default: typeof Glog;
9
+ export default _default;
10
+ declare class Glog {
11
+ static logLevel: number;
12
+ static logPrefix: string;
13
+ static colors: any;
14
+ static stackTrace: boolean;
15
+ static name: string;
16
+ static setLogPrefix(prefix: any): typeof Glog;
17
+ static setLogLevel(level: any): typeof Glog;
18
+ static withName(name: any): typeof Glog;
19
+ static withColors(colors?: {
20
+ debug: string[];
21
+ info: string;
22
+ warn: string;
23
+ error: string;
24
+ reset: string;
25
+ }): typeof Glog;
26
+ static withStackTrace(enabled?: boolean): typeof Glog;
27
+ static create(options?: {}): Glog;
28
+ static execute(...args: any[]): void;
29
+ /**
30
+ * Static version of colorize for global usage
31
+ *
32
+ * @param {Array<string>} strings - Template strings
33
+ * @param {...unknown} values - Template values
34
+ */
35
+ static colorize(strings: Array<string>, ...values: unknown[]): void;
36
+ /**
37
+ * Static success method
38
+ *
39
+ * @param {string} message - Success message to log
40
+ * @param {...unknown} args - Additional arguments to log
41
+ */
42
+ static success(message: string, ...args: unknown[]): void;
43
+ /**
44
+ * Set a color alias for convenient usage
45
+ *
46
+ * @param {string} alias - Alias name
47
+ * @param {string} colorCode - Color code (e.g., "{F196}" or "{<B}")
48
+ * @returns {Glog} The Glog class for chaining.
49
+ */
50
+ static setAlias(alias: string, colorCode: string): Glog;
51
+ constructor(options?: {});
52
+ setOptions(options: any): this;
53
+ withName(name: any): this;
54
+ withLogLevel(level: any): this;
55
+ withPrefix(prefix: any): this;
56
+ withColors(colors?: {
57
+ debug: string[];
58
+ info: string;
59
+ warn: string;
60
+ error: string;
61
+ reset: string;
62
+ }): this;
63
+ withStackTrace(enabled?: boolean): this;
64
+ get name(): string;
65
+ get debugLevel(): number;
66
+ get options(): {
67
+ name: string;
68
+ debugLevel: number;
69
+ prefix: string;
70
+ colors: any;
71
+ stackTrace: boolean;
72
+ };
73
+ extractFileFunction(): string;
74
+ newDebug(tag: any): any;
75
+ /**
76
+ * Log a debug message with specified verbosity level.
77
+ * Level 0 means debug OFF - use levels 1-4 for actual debug output.
78
+ * Debug messages only show when logLevel > 0.
79
+ *
80
+ * @param {string} message - Debug message to log
81
+ * @param {number} level - Debug verbosity level (1-4, default: 1)
82
+ * @param {...unknown} arg - Additional arguments to log
83
+ * @throws {Error} If level < 1 (level 0 = debug OFF)
84
+ */
85
+ debug(message: string, level?: number, ...arg: unknown[]): void;
86
+ info(message: any, ...arg: any[]): void;
87
+ warn(message: any, ...arg: any[]): void;
88
+ error(message: any, ...arg: any[]): void;
89
+ execute(...args: any[]): void;
90
+ /**
91
+ * Log a colorized message using template literals
92
+ *
93
+ * @param {Array<string>} strings - Template strings
94
+ * @param {...unknown} values - Template values
95
+ * @example logger.colorize`{success}Operation completed{/} in {bold}${time}ms{/}`
96
+ */
97
+ colorize(strings: Array<string>, ...values: unknown[]): void;
98
+ /**
99
+ * Log a success message with green color
100
+ *
101
+ * @param {string} message - Success message
102
+ * @param {...unknown} args - Additional arguments
103
+ */
104
+ success(message: string, ...args: unknown[]): void;
105
+ /**
106
+ * Get access to the colours template function for instance usage
107
+ *
108
+ * @returns {import('@gesslar/colours')} The colours template function from \@gesslar/colours
109
+ */
110
+ get colours(): typeof import("@gesslar/colours");
111
+ #private;
112
+ }
113
+ //# sourceMappingURL=Glog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Glog.d.ts","sourceRoot":"","sources":["../../lib/Glog.js"],"names":[],"mappings":";;;;;;;;;AA6CA;IAEE,wBAAmB;IACnB,yBAAqB;IACrB,mBAAoB;IACpB,2BAAyB;IACzB,oBAAgB;IA2ChB,8CAIC;IAED,4CAIC;IAED,wCAIC;IAED;;;;;;oBAIC;IAED,sDAIC;IAID,kCAEC;IAwJD,qCAoBC;IAuBD;;;;;OAKG;IACH,yBAHW,KAAK,CAAC,MAAM,CAAC,aACV,OAAO,EAAA,QAOpB;IAYD;;;;;OAKG;IACH,wBAHW,MAAM,WACH,OAAO,EAAA,QAIpB;IAED;;;;;;OAMG;IACH,uBAJW,MAAM,aACN,MAAM,GACJ,IAAI,CAMhB;IAhTD,0BAeC;IAID,+BAQC;IAwCD,0BAIC;IAED,+BAIC;IAED,8BAIC;IAED;;;;;;aAIC;IAED,wCAIC;IAID,mBAEC;IAED,yBAEC;IAED;;;;;;MAQC;IAqBD,8BAGC;IAED,wBAQC;IA8BD;;;;;;;;;OASG;IACH,eALW,MAAM,UACN,MAAM,UACH,OAAO,EAAA,QAapB;IAED,wCAGC;IAED,wCAGC;IAED,yCAGC;IA0BD,8BAEC;IAID;;;;;;OAMG;IACH,kBAJW,KAAK,CAAC,MAAM,CAAC,aACV,OAAO,EAAA,QAQpB;IAeD;;;;;OAKG;IACH,iBAHW,MAAM,WACH,OAAO,EAAA,QAIpB;IAyBD;;;;OAIG;IACH,iDAEC;;CACF"}
@@ -0,0 +1,46 @@
1
+ export namespace loggerColours {
2
+ let debug: string[];
3
+ let info: string;
4
+ let warn: string;
5
+ let error: string;
6
+ let reset: string;
7
+ }
8
+ /**
9
+ * Logger class
10
+ *
11
+ * Log levels:
12
+ * - debug: Debugging information
13
+ * - Debug levels
14
+ * - 0: No/critical debug information, not error level, but, should be
15
+ * logged
16
+ * - 1: Basic debug information, startup, shutdown, etc
17
+ * - 2: Intermediate debug information, discovery, starting to get more
18
+ * detailed
19
+ * - 3: Detailed debug information, parsing, processing, etc
20
+ * - 4: Very detailed debug information, nerd mode!
21
+ * - warn: Warning information
22
+ * - info: Informational information
23
+ * - error: Error information
24
+ */
25
+ export default class Logger {
26
+ constructor(options: any);
27
+ vscodeError: any;
28
+ vscodeWarn: any;
29
+ vscodeInfo: any;
30
+ get name(): any;
31
+ get debugLevel(): number;
32
+ get options(): {
33
+ name: any;
34
+ debugLevel: number;
35
+ };
36
+ setOptions(options: any): void;
37
+ lastStackLine(error?: Error, stepsRemoved?: number): any;
38
+ extractFileFunction(level?: number): any;
39
+ newDebug(tag: any): any;
40
+ debug(message: any, level?: number, ...arg: any[]): void;
41
+ warn(message: any, ...arg: any[]): void;
42
+ info(message: any, ...arg: any[]): void;
43
+ error(message: any, ...arg: any[]): void;
44
+ #private;
45
+ }
46
+ //# sourceMappingURL=Logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../lib/Logger.js"],"names":[],"mappings":";;;;;;;AA4CA;;;;;;;;;;;;;;;;GAgBG;AAEH;IAIE,0BAYC;IALK,iBAAiD;IACjD,gBAAkD;IAClD,gBAAsD;IAK5D,gBAEC;IAED,yBAEC;IAED;;;MAKC;IAED,+BAGC;IAWD,yDAIC;IAED,yCAsCC;IAED,wBAKC;IAED,yDAGC;IAED,wCAGC;IAED,wCAGC;IAED,yCAGC;;CACF"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Custom error class for toolkit errors.
3
+ * Provides error chaining, trace management, and formatted error reporting.
4
+ */
5
+ export default class Sass extends Error {
6
+ /**
7
+ * Creates an Sass from an existing Error object with additional
8
+ * trace message.
9
+ *
10
+ * @param {Error} error - The original error object
11
+ * @param {string} message - Additional trace message to add
12
+ * @returns {Sass} New Sass instance with trace from the original error
13
+ * @throws {Sass} If the first parameter is not an Error instance
14
+ */
15
+ static from(error: Error, message: string): Sass;
16
+ /**
17
+ * Factory method to create or enhance Sass instances.
18
+ * If error parameter is provided, enhances existing Sass or wraps
19
+ * other errors. Otherwise creates a new Sass instance.
20
+ *
21
+ * @param {string} message - The error message
22
+ * @param {Error|Sass|Tantrum} [error] - Optional existing error to wrap or enhance
23
+ * @returns {Sass} New or enhanced Sass instance
24
+ */
25
+ static "new"(message: string, error?: Error | Sass | Tantrum): Sass;
26
+ /**
27
+ * Creates a new Sass instance.
28
+ *
29
+ * @param {string} message - The error message
30
+ * @param {...unknown} [arg] - Additional arguments passed to parent Error constructor
31
+ */
32
+ constructor(message: string, ...arg?: unknown[]);
33
+ /**
34
+ * Adds a message to the beginning of the trace array.
35
+ *
36
+ * @param {string} message - The trace message to add
37
+ */
38
+ set trace(message: string);
39
+ /**
40
+ * Gets the error trace array.
41
+ *
42
+ * @returns {Array<string>} Array of trace messages
43
+ */
44
+ get trace(): Array<string>;
45
+ /**
46
+ * Adds a trace message and returns this instance for chaining.
47
+ *
48
+ * @param {string} message - The trace message to add
49
+ * @returns {this} This Sass instance for method chaining
50
+ */
51
+ addTrace(message: string): this;
52
+ /**
53
+ * Reports the error to the terminal with formatted output.
54
+ * Optionally includes detailed stack trace information.
55
+ *
56
+ * @param {boolean} [nerdMode] - Whether to include detailed stack trace
57
+ */
58
+ report(nerdMode?: boolean): void;
59
+ #private;
60
+ }
61
+ import Tantrum from "./Tantrum.js";
62
+ //# sourceMappingURL=Sass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sass.d.ts","sourceRoot":"","sources":["../../lib/Sass.js"],"names":[],"mappings":"AAgBA;;;GAGG;AACH;IA2GE;;;;;;;;OAQG;IACH,mBALW,KAAK,WACL,MAAM,GACJ,IAAI,CAWhB;IAED;;;;;;;;OAQG;IACH,sBAJW,MAAM,UACN,KAAK,GAAC,IAAI,GAAC,OAAO,GAChB,IAAI,CAchB;IAhJD;;;;;OAKG;IACH,qBAHW,MAAM,WACH,OAAO,EAAA,EAMpB;IAWD;;;;OAIG;IACH,mBAFW,MAAM,EAIhB;IAhBD;;;;OAIG;IACH,aAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;IAWD;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,IAAI,CAShB;IAED;;;;;OAKG;IACH,kBAFW,OAAO,QAqBjB;;CA2EF;oBA1JmB,cAAc"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Schemer provides utilities for compiling and validating JSON schemas using AJV.
3
+ *
4
+ * Usage:
5
+ * - Use Schemer.fromFile(file, options) to create a validator from a file.
6
+ * - Use Schemer.from(schemaData, options) to create a validator from a schema object.
7
+ * - Use Schemer.getValidator(schema, options) to get a raw AJV validator function.
8
+ * - Use Schemer.reportValidationErrors(errors) to format AJV validation errors.
9
+ */
10
+ export default class Schemer {
11
+ static fromFile(file: any, options?: {}): Promise<(data: unknown) => boolean>;
12
+ static from(schemaData?: {}, options?: {}): Promise<(data: unknown) => boolean>;
13
+ /**
14
+ * Creates a validator function from a schema object
15
+ *
16
+ * @param {object} schema - The schema to compile
17
+ * @param {object} [options] - AJV options
18
+ * @returns {(data: unknown) => boolean} The AJV validator function, which may have additional properties (e.g., `.errors`)
19
+ */
20
+ static getValidator(schema: object, options?: object): (data: unknown) => boolean;
21
+ static reportValidationErrors(errors: any): any;
22
+ }
23
+ //# sourceMappingURL=Schemer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schemer.d.ts","sourceRoot":"","sources":["../../lib/Schemer.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH;IACE,yDAqBoB,OAAO,KAAK,OAAO,EAdtC;IAED,2DAYoB,OAAO,KAAK,OAAO,EAPtC;IAED;;;;;;OAMG;IACH,4BAJW,MAAM,YACN,MAAM,GACJ,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAMtC;IAED,gDA0CC;CACF"}