@gesslar/toolkit 3.14.0 → 3.14.1
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 +10 -9
- package/types/browser/index.d.ts +13 -0
- package/types/browser/index.d.ts.map +1 -0
- package/types/browser/lib/Collection.d.ts +248 -0
- package/types/browser/lib/Collection.d.ts.map +1 -0
- package/types/browser/lib/Data.d.ts +250 -0
- package/types/browser/lib/Data.d.ts.map +1 -0
- package/types/browser/lib/Disposer.d.ts +33 -0
- package/types/browser/lib/Disposer.d.ts.map +1 -0
- package/types/browser/lib/HTML.d.ts +40 -0
- package/types/browser/lib/HTML.d.ts.map +1 -0
- package/types/browser/lib/Notify.d.ts +60 -0
- package/types/browser/lib/Notify.d.ts.map +1 -0
- package/types/browser/lib/Promised.d.ts +119 -0
- package/types/browser/lib/Promised.d.ts.map +1 -0
- package/types/browser/lib/Sass.d.ts +63 -0
- package/types/browser/lib/Sass.d.ts.map +1 -0
- package/types/browser/lib/Tantrum.d.ts +52 -0
- package/types/browser/lib/Tantrum.d.ts.map +1 -0
- package/types/browser/lib/Time.d.ts +42 -0
- package/types/browser/lib/Time.d.ts.map +1 -0
- package/types/browser/lib/TypeSpec.d.ts +90 -0
- package/types/browser/lib/TypeSpec.d.ts.map +1 -0
- package/types/browser/lib/Util.d.ts +62 -0
- package/types/browser/lib/Util.d.ts.map +1 -0
- package/types/browser/lib/Valid.d.ts +33 -0
- package/types/browser/lib/Valid.d.ts.map +1 -0
- package/types/browser/lib/vendor/dompurify.esm.d.ts +29 -0
- package/types/browser/lib/vendor/dompurify.esm.d.ts.map +1 -0
- package/types/node/index.d.ts +21 -0
- package/types/node/index.d.ts.map +1 -0
- package/types/node/lib/Cache.d.ts +27 -0
- package/types/node/lib/Cache.d.ts.map +1 -0
- package/types/node/lib/DirectoryObject.d.ts +277 -0
- package/types/node/lib/DirectoryObject.d.ts.map +1 -0
- package/types/node/lib/FileObject.d.ts +209 -0
- package/types/node/lib/FileObject.d.ts.map +1 -0
- package/types/node/lib/FileSystem.d.ts +188 -0
- package/types/node/lib/FileSystem.d.ts.map +1 -0
- package/types/node/lib/Glog.d.ts +228 -0
- package/types/node/lib/Glog.d.ts.map +1 -0
- package/types/node/lib/Logger.d.ts +46 -0
- package/types/node/lib/Logger.d.ts.map +1 -0
- package/types/node/lib/Notify.d.ts +54 -0
- package/types/node/lib/Notify.d.ts.map +1 -0
- package/types/node/lib/Sass.d.ts +9 -0
- package/types/node/lib/Sass.d.ts.map +1 -0
- package/types/node/lib/Tantrum.d.ts +9 -0
- package/types/node/lib/Tantrum.d.ts.map +1 -0
- package/types/node/lib/TempDirectoryObject.d.ts +42 -0
- package/types/node/lib/TempDirectoryObject.d.ts.map +1 -0
- package/types/node/lib/Term.d.ts +127 -0
- package/types/node/lib/Term.d.ts.map +1 -0
- package/types/node/lib/Util.d.ts +100 -0
- package/types/node/lib/Util.d.ts.map +1 -0
- package/types/node/lib/VDirectoryObject.d.ts +132 -0
- package/types/node/lib/VDirectoryObject.d.ts.map +1 -0
- package/types/node/lib/VFileObject.d.ts +33 -0
- package/types/node/lib/VFileObject.d.ts.map +1 -0
- package/types/node/lib/Valid.d.ts +35 -0
- package/types/node/lib/Valid.d.ts.map +1 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VDirectoryObject extends DirectoryObject with constraints that ensure
|
|
3
|
+
* all operations are restricted to a specific directory tree (the "cap").
|
|
4
|
+
*
|
|
5
|
+
* All path operations are validated to ensure they remain within the
|
|
6
|
+
* cap directory hierarchy for security.
|
|
7
|
+
*
|
|
8
|
+
* @augments DirectoryObject
|
|
9
|
+
*/
|
|
10
|
+
export default class VDirectoryObject extends DirectoryObject {
|
|
11
|
+
/**
|
|
12
|
+
* Creates a VDirectoryObject from the current working directory.
|
|
13
|
+
* This is useful when working with pnpx or other tools where you need to
|
|
14
|
+
* cap at the project's root directory determined at runtime.
|
|
15
|
+
*
|
|
16
|
+
* @returns {VDirectoryObject} A VDirectoryObject capped at the current working directory
|
|
17
|
+
* @example
|
|
18
|
+
* // When using pnpx or similar tools
|
|
19
|
+
* const projectRoot = VDirectoryObject.fromCwd()
|
|
20
|
+
* const srcDir = projectRoot.getDirectory("src")
|
|
21
|
+
* // srcDir is capped at the project root
|
|
22
|
+
*/
|
|
23
|
+
static fromCwd(): VDirectoryObject;
|
|
24
|
+
/**
|
|
25
|
+
* Constructs a VDirectoryObject instance.
|
|
26
|
+
*
|
|
27
|
+
* Without a parent, creates a new cap at the specified real directory location
|
|
28
|
+
* with virtual path "/". With a parent, the path is resolved relative to the
|
|
29
|
+
* parent's virtual path (absolute paths treated as cap-relative).
|
|
30
|
+
*
|
|
31
|
+
* @param {string} [directory="."] - Real directory path when no parent (becomes cap), or relative/absolute virtual path when parent provided
|
|
32
|
+
* @param {VDirectoryObject?} [parent] - Optional parent capped directory
|
|
33
|
+
* @throws {Sass} If parent is provided but not a VDirectoryObject
|
|
34
|
+
* @example
|
|
35
|
+
* // Create new capped directory at current directory
|
|
36
|
+
* const cwd = new VDirectoryObject()
|
|
37
|
+
* // Virtual path: "/", Real path: process.cwd(), Cap: itself
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Create new capped directory
|
|
41
|
+
* const cache = new VDirectoryObject("/home/user/.cache")
|
|
42
|
+
* // Virtual path: "/", Real path: /home/user/.cache, Cap: itself
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Create subdirectory with parent
|
|
46
|
+
* const data = new VDirectoryObject("data", cache)
|
|
47
|
+
* // Virtual path: /data, Real path: /home/user/.cache/data, Cap: cache
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Virtual absolute path with parent (treated as cap-relative)
|
|
51
|
+
* const config = new VDirectoryObject("/etc/config", cache)
|
|
52
|
+
* // Virtual path: /etc/config, Real path: /home/user/.cache/etc/config, Cap: cache
|
|
53
|
+
*/
|
|
54
|
+
constructor(directory?: string, source?: any);
|
|
55
|
+
/**
|
|
56
|
+
* Indicates whether this directory is capped (constrained to a specific tree).
|
|
57
|
+
* Always returns true for VDirectoryObject instances.
|
|
58
|
+
*
|
|
59
|
+
* @returns {boolean} True for all VDirectoryObject instances
|
|
60
|
+
* @example
|
|
61
|
+
* const capped = new TempDirectoryObject("myapp")
|
|
62
|
+
* console.log(capped.isVirtual) // true
|
|
63
|
+
*
|
|
64
|
+
* const regular = new DirectoryObject("/tmp")
|
|
65
|
+
* console.log(regular.isVirtual) // false
|
|
66
|
+
*/
|
|
67
|
+
get isVirtual(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the cap (root) of the capped directory tree.
|
|
70
|
+
* For root VDirectoryObject instances, returns itself.
|
|
71
|
+
* For children, returns the inherited cap from the parent chain.
|
|
72
|
+
*
|
|
73
|
+
* @returns {VDirectoryObject} The cap directory object (root of the capped tree)
|
|
74
|
+
* @example
|
|
75
|
+
* const temp = new TempDirectoryObject("myapp")
|
|
76
|
+
* console.log(temp.cap === temp) // true (root is its own cap)
|
|
77
|
+
*
|
|
78
|
+
* const subdir = temp.getDirectory("data")
|
|
79
|
+
* console.log(subdir.cap === temp) // true (child inherits parent's cap)
|
|
80
|
+
*/
|
|
81
|
+
get cap(): VDirectoryObject;
|
|
82
|
+
/**
|
|
83
|
+
* Returns a plain DirectoryObject representing the actual filesystem location.
|
|
84
|
+
* This provides an "escape hatch" from the capped environment to interact
|
|
85
|
+
* with the real filesystem when needed.
|
|
86
|
+
*
|
|
87
|
+
* @returns {DirectoryObject} Uncapped directory object at the real filesystem path
|
|
88
|
+
* @example
|
|
89
|
+
* const temp = new TempDirectoryObject("myapp")
|
|
90
|
+
* const subdir = temp.getDirectory("data")
|
|
91
|
+
*
|
|
92
|
+
* // Work within the capped environment (virtual paths)
|
|
93
|
+
* console.log(subdir.path) // "/data" (virtual)
|
|
94
|
+
* subdir.getFile("config.json") // Stays within cap
|
|
95
|
+
*
|
|
96
|
+
* // Break out to real filesystem when needed
|
|
97
|
+
* console.log(subdir.real.path) // "/tmp/myapp-ABC123/data" (real)
|
|
98
|
+
* subdir.real.parent // Can traverse outside the cap
|
|
99
|
+
*/
|
|
100
|
+
get real(): DirectoryObject;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the parent directory of this capped directory.
|
|
103
|
+
* Returns null only if this directory is at the cap (the "root" of the capped tree).
|
|
104
|
+
*
|
|
105
|
+
* Note: The returned parent is a VDirectoryObject with the same cap.
|
|
106
|
+
* This maintains the capping behavior throughout the directory hierarchy.
|
|
107
|
+
*
|
|
108
|
+
* @returns {VDirectoryObject|null} Parent directory or null if at cap root
|
|
109
|
+
* @example
|
|
110
|
+
* const capped = new TempDirectoryObject("myapp")
|
|
111
|
+
* const subdir = capped.getDirectory("data")
|
|
112
|
+
* console.log(subdir.parent.path) // Returns parent VDirectoryObject
|
|
113
|
+
* console.log(capped.parent) // null (at cap root)
|
|
114
|
+
*/
|
|
115
|
+
get parent(): VDirectoryObject | null;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the path of the parent directory.
|
|
118
|
+
* Returns null if this directory is at the cap root (no parent).
|
|
119
|
+
*
|
|
120
|
+
* @returns {string|null} The parent directory path, or null if at cap root
|
|
121
|
+
* @example
|
|
122
|
+
* const temp = new TempDirectoryObject("myapp")
|
|
123
|
+
* console.log(temp.parentPath) // null (at cap root)
|
|
124
|
+
*
|
|
125
|
+
* const subdir = temp.getDirectory("data")
|
|
126
|
+
* console.log(subdir.parentPath) // "/" (parent's virtual path)
|
|
127
|
+
*/
|
|
128
|
+
get parentPath(): string | null;
|
|
129
|
+
#private;
|
|
130
|
+
}
|
|
131
|
+
import DirectoryObject from "./DirectoryObject.js";
|
|
132
|
+
//# sourceMappingURL=VDirectoryObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VDirectoryObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/VDirectoryObject.js"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH;IAmEE;;;;;;;;;;;OAWG;IACH,kBAPa,gBAAgB,CAS5B;IA3ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,wBAvBW,MAAM,gBAoDhB;IAkBD;;;;;;;;;;;OAWG;IACH,iBARa,OAAO,CAUnB;IAED;;;;;;;;;;;;OAYG;IACH,WARa,gBAAgB,CAU5B;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,YAba,eAAe,CAe3B;IAED;;;;;;;;;;;;;OAaG;IACH,cAPa,gBAAgB,GAAC,IAAI,CASjC;IAED;;;;;;;;;;;OAWG;IACH,kBARa,MAAM,GAAC,IAAI,CAUvB;;CAEF;4BAzL2B,sBAAsB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VFileObject extends FileObject with virtual path support, maintaining both
|
|
3
|
+
* a virtual path (relative to cap) and a real filesystem path.
|
|
4
|
+
*
|
|
5
|
+
* Virtual files must have a VDirectoryObject parent and cannot exist independently.
|
|
6
|
+
* All file operations use the real filesystem path while exposing clean virtual paths.
|
|
7
|
+
*
|
|
8
|
+
* @property {string} supplied - User-supplied path
|
|
9
|
+
* @property {string} path - The virtual file path (relative to cap)
|
|
10
|
+
* @property {URL} url - The file URL
|
|
11
|
+
* @property {string} name - The file name
|
|
12
|
+
* @property {string} module - The file name without extension
|
|
13
|
+
* @property {string} extension - The file extension
|
|
14
|
+
* @property {boolean} isFile - Always true for files
|
|
15
|
+
* @property {boolean} isVirtual - Always true for VFileObject instances
|
|
16
|
+
* @property {VDirectoryObject} parent - The parent virtual directory object
|
|
17
|
+
* @property {FileObject} real - The real filesystem FileObject
|
|
18
|
+
* @property {Promise<boolean>} exists - Whether the file exists (async)
|
|
19
|
+
*/
|
|
20
|
+
export default class VFileObject extends FileObject {
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a VFileObject instance.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} fileName - The file path
|
|
25
|
+
* @param {VDirectoryObject} parent - The parent virtual directory (required)
|
|
26
|
+
*/
|
|
27
|
+
constructor(fileName: string, parent: VDirectoryObject);
|
|
28
|
+
get isVirtual(): boolean;
|
|
29
|
+
get real(): FileObject;
|
|
30
|
+
#private;
|
|
31
|
+
}
|
|
32
|
+
import FileObject from "./FileObject.js";
|
|
33
|
+
//# sourceMappingURL=VFileObject.d.ts.map
|
|
@@ -0,0 +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,EAc1B;IAED,yBAEC;IAED,uBAEC;;CACF;uBAtDsB,iBAAiB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
26
|
+
* property names.
|
|
27
|
+
*
|
|
28
|
+
* Throws if any restricted prototype properties are found in the keys array.
|
|
29
|
+
*
|
|
30
|
+
* @param {Array<string>} keys - Array of property keys to validate
|
|
31
|
+
* @throws {Sass} If any key matches restricted prototype properties (__proto__, constructor, prototype)
|
|
32
|
+
*/
|
|
33
|
+
static prototypePollutionProtection(keys: Array<string>): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=Valid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Valid.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Valid.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,+CAAmE;IAEnE;;;;;;OAMG;IACH,mBAJW,OAAO,QACP,MAAM,YACN,MAAM,QAYhB;IAED;;;;;;;;OAQG;IACH,yBANW,OAAO,WACP,MAAM,QAEN,MAAM,QAkBhB;IAED;;;;;;;;OAQG;IACH,0CAHW,KAAK,CAAC,MAAM,CAAC,QAYvB;CACF"}
|