@gesslar/toolkit 1.8.0 → 1.9.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/README.md +83 -28
- package/package.json +2 -8
- package/src/lib/DirectoryObject.js +90 -9
- package/src/lib/FS.js +94 -0
- package/src/lib/FileObject.js +5 -1
- package/src/lib/Notify.js +11 -5
- package/src/types/lib/DirectoryObject.d.ts +39 -7
- package/src/types/lib/DirectoryObject.d.ts.map +1 -1
- package/src/types/lib/FS.d.ts +47 -0
- package/src/types/lib/FS.d.ts.map +1 -1
- package/src/types/lib/FileObject.d.ts +3 -10
- package/src/types/lib/FileObject.d.ts.map +1 -1
- package/src/types/lib/Notify.d.ts +0 -1
- package/src/types/lib/Notify.d.ts.map +1 -1
- package/src/types/lib/Util.d.ts +0 -1
- package/src/types/lib/Util.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,97 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Gesslar's Toolkit of Amazing ✌🏻
|
|
2
2
|
|
|
3
3
|
This package is intended to be a collection of useful utilities for any
|
|
4
4
|
project's consumption. Not the kind that gives you bleeding, hacking coughs,
|
|
5
|
-
but the kind that
|
|
5
|
+
but the kind that gives "yumyum."
|
|
6
6
|
|
|
7
7
|
There are file and directory abstractions, uhmm, there's also some terminal
|
|
8
8
|
things and validity checkers, lots of data functions.
|
|
9
9
|
|
|
10
|
+
## Included Classes
|
|
11
|
+
|
|
12
|
+
### Browser
|
|
13
|
+
|
|
14
|
+
These classes exist and function within the browser, or browser-like environment, such as
|
|
15
|
+
a Tauri app.
|
|
16
|
+
|
|
17
|
+
| Name | Description |
|
|
18
|
+
| ---- | ----------- |
|
|
19
|
+
| Collection | Array, Map, etc methods |
|
|
20
|
+
| Data | Primitive manipulation and identification |
|
|
21
|
+
| Disposer | Participate in lifecycle mechanics |
|
|
22
|
+
| HTML | HTML-related methods |
|
|
23
|
+
| Notify | Wrapper around DOM event system |
|
|
24
|
+
| Sass | The best Error class this side of Tatooine |
|
|
25
|
+
| Tantrum | Sass's louder, shoutier AggregateError cousin |
|
|
26
|
+
| TypeSpec | String-based type management |
|
|
27
|
+
| Util | Porn |
|
|
28
|
+
| Valid | Assert methods for validation |
|
|
29
|
+
|
|
30
|
+
### Node.js
|
|
31
|
+
|
|
32
|
+
Everything included in the browser but more, and backendier.
|
|
33
|
+
|
|
34
|
+
| Name | Description |
|
|
35
|
+
| ---- | ----------- |
|
|
36
|
+
| Cache | Cache management for use with file IO |
|
|
37
|
+
| Contract | Contract management |
|
|
38
|
+
| DirectoryObject | Wrapper around Node's fs for directories |
|
|
39
|
+
| FileObject | Wrapper around Node's fs for directories |
|
|
40
|
+
| FS | Base for DirectoryObject and FileObject, but with additional static methods |
|
|
41
|
+
| Glog | The superior logging framework |
|
|
42
|
+
| Notify | Wrapper around Node's event system |
|
|
43
|
+
| Sass | The best Error class the other side of Tatooine |
|
|
44
|
+
| Schemer | Schema management |
|
|
45
|
+
| Tantrum | *crowd of wookiee roars* |
|
|
46
|
+
| Term | Terminal based methods |
|
|
47
|
+
| Terms | Terms for use with Contract |
|
|
48
|
+
| Util | Not porn, promise 🤞🏼 |
|
|
49
|
+
| Valid | Assert methods for validation |
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```shell
|
|
54
|
+
npm i @gesslar/toolkit
|
|
55
|
+
```
|
|
56
|
+
|
|
10
57
|
## Usage
|
|
11
58
|
|
|
12
|
-
|
|
59
|
+
Toolkit is environment aware and knows whether it is being used in a web browser or in
|
|
60
|
+
Node.js. It is not strictly necessary to specify whether you require the `node` or
|
|
61
|
+
`browser` variant, but you may do so if you like to feel like a nice control daddy.
|
|
62
|
+
|
|
63
|
+
### Browser-like
|
|
64
|
+
|
|
65
|
+
TypeScript editors do not pick up types from jsDelivr. If you want inline types without
|
|
66
|
+
installing from npm, use the esm.sh `?dts` URL or install the package locally for
|
|
67
|
+
development and use the CDN at runtime.
|
|
68
|
+
|
|
69
|
+
#### jsDelivr (runtime only)
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
https://cdn.jsdelivr.net/npm/@gesslar/toolkit
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### esm.sh (runtime, types)
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
https://esm.sh/@gesslar/toolkit
|
|
79
|
+
https://esm.sh/@gesslar/toolkit?dts` (serves `.d.ts` for editors)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Node.js
|
|
13
83
|
|
|
14
84
|
```javascript
|
|
15
|
-
import
|
|
16
|
-
// or explicitly:
|
|
17
|
-
import { Data, FileObject } from '@gesslar/toolkit/node'
|
|
85
|
+
import * as TK from "@gesslar/toolkit"
|
|
18
86
|
```
|
|
19
87
|
|
|
20
|
-
|
|
88
|
+
```javascript
|
|
89
|
+
import {Data, FileObject, Cache} from "@gesslar/toolkit"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
import {Data, Filebject} from "@gesslar/toolkit/node"
|
|
94
|
+
```
|
|
21
95
|
|
|
22
96
|
```javascript
|
|
23
97
|
import { Data, Collection, Util } from '@gesslar/toolkit/browser'
|
|
@@ -27,31 +101,12 @@ The browser version includes: Data, Collection, Util, Type (TypeSpec), Valid,
|
|
|
27
101
|
Sass, and Tantrum. Node-only modules (FileObject, Cache, FS, etc.) are not
|
|
28
102
|
available in the browser version.
|
|
29
103
|
|
|
30
|
-
**Browser via CDN (no install):**
|
|
31
|
-
|
|
32
|
-
Substitute the `__VERSION__` below with the release version you are seeking.
|
|
33
|
-
|
|
34
|
-
- jsDelivr (runtime only):
|
|
35
|
-
`https://cdn.jsdelivr.net/npm/@gesslar/toolkit@__VERSION__/browser`
|
|
36
|
-
|
|
37
|
-
- esm.sh (runtime + optional types):
|
|
38
|
-
`https://esm.sh/@gesslar/toolkit@__VERSION__/browser`
|
|
39
|
-
`https://esm.sh/@gesslar/toolkit@__VERSION__/browser?dts` (serves `.d.ts` for editors)
|
|
40
|
-
|
|
41
|
-
Notes:
|
|
42
|
-
|
|
43
|
-
- Nothing to configure in this repo for CDN use; both URLs just work after
|
|
44
|
-
the version is published to npm.
|
|
45
|
-
- TypeScript editors do not pick up types from jsDelivr. If you want inline
|
|
46
|
-
types without installing from npm, use the esm.sh `?dts` URL or install the
|
|
47
|
-
package locally for development and use the CDN at runtime.
|
|
48
|
-
|
|
49
104
|
Basically, if you want it, it is most definitely here, and working 100% and
|
|
50
105
|
absolutely none of that is true. There are only a few classes here, but they're
|
|
51
|
-
pretty. And if you bug-shame them, I will
|
|
106
|
+
pretty. And if you bug-shame them, I will *come for you like* ...
|
|
52
107
|
|
|
53
108
|
nah. Just don't be a dick, okay? Play nice, share, lick a veggie and gentlemen,
|
|
54
|
-
spend
|
|
109
|
+
spend fewer than 5 minutes washing your pits, chest, and downstairs and maybe
|
|
55
110
|
give some time to the other parts. Like the parts that walk on things, sit
|
|
56
111
|
on things. Some things that enjoy being sat upon do not enjoy being sat upon
|
|
57
112
|
by gross sitter-upon-things.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gesslar/toolkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Get in, bitches, we're going toolkitting.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -70,12 +70,6 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@gesslar/uglier": "^0.0.5",
|
|
73
|
-
"
|
|
74
|
-
"@types/node": "^24.10.1",
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
76
|
-
"@typescript-eslint/parser": "^8.48.1",
|
|
77
|
-
"eslint": "^9.39.1",
|
|
78
|
-
"eslint-plugin-jsdoc": "^61.4.1",
|
|
79
|
-
"globals": "^16.5.0"
|
|
73
|
+
"typescript": "^5.9.3"
|
|
80
74
|
}
|
|
81
75
|
}
|
|
@@ -4,14 +4,15 @@
|
|
|
4
4
|
* resolution and existence checks.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import {mkdir, opendir, readdir, rmdir} from "node:fs/promises"
|
|
8
8
|
import path from "node:path"
|
|
9
|
-
import util from "node:util"
|
|
10
9
|
import {URL} from "node:url"
|
|
10
|
+
import util from "node:util"
|
|
11
11
|
|
|
12
12
|
import FS from "./FS.js"
|
|
13
13
|
import FileObject from "./FileObject.js"
|
|
14
14
|
import Sass from "./Sass.js"
|
|
15
|
+
import {Data, Valid} from "../browser/index.js"
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* DirectoryObject encapsulates metadata and operations for a directory,
|
|
@@ -51,16 +52,24 @@ export default class DirectoryObject extends FS {
|
|
|
51
52
|
isDirectory: true,
|
|
52
53
|
trail: null,
|
|
53
54
|
sep: null,
|
|
55
|
+
temporary: null,
|
|
54
56
|
})
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
59
|
* Constructs a DirectoryObject instance.
|
|
58
60
|
*
|
|
59
|
-
* @param {string} directory - The directory path
|
|
61
|
+
* @param {string? | DirectoryObject?} directory - The directory path or DirectoryObject
|
|
62
|
+
* @param {boolean} [temporary] - Whether this is a temporary directory.
|
|
60
63
|
*/
|
|
61
|
-
constructor(directory) {
|
|
64
|
+
constructor(directory=null, temporary=false) {
|
|
62
65
|
super()
|
|
63
66
|
|
|
67
|
+
Valid.type(directory, "String|DirectoryObject|Null")
|
|
68
|
+
|
|
69
|
+
// If passed a DirectoryObject, extract its path
|
|
70
|
+
if(Data.isType(directory, "DirectoryObject"))
|
|
71
|
+
directory = directory.path
|
|
72
|
+
|
|
64
73
|
const fixedDir = FS.fixSlashes(directory ?? ".")
|
|
65
74
|
const resolved = path.resolve(fixedDir)
|
|
66
75
|
const url = new URL(FS.pathToUri(resolved))
|
|
@@ -76,6 +85,7 @@ export default class DirectoryObject extends FS {
|
|
|
76
85
|
this.#meta.module = baseName
|
|
77
86
|
this.#meta.trail = trail
|
|
78
87
|
this.#meta.sep = sep
|
|
88
|
+
this.#meta.temporary = temporary
|
|
79
89
|
|
|
80
90
|
Object.freeze(this.#meta)
|
|
81
91
|
}
|
|
@@ -200,6 +210,50 @@ export default class DirectoryObject extends FS {
|
|
|
200
210
|
return this.#meta.trail
|
|
201
211
|
}
|
|
202
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Returns whether this directory is marked as temporary.
|
|
215
|
+
*
|
|
216
|
+
* @returns {boolean} True if this is a temporary directory, false otherwise
|
|
217
|
+
*/
|
|
218
|
+
get temporary() {
|
|
219
|
+
return this.#meta.temporary
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Recursively removes a temporary directory and all its contents.
|
|
224
|
+
*
|
|
225
|
+
* This method will delete all files and subdirectories within this directory,
|
|
226
|
+
* then delete the directory itself. It only works on directories explicitly
|
|
227
|
+
* marked as temporary for safety.
|
|
228
|
+
*
|
|
229
|
+
* @async
|
|
230
|
+
* @returns {Promise<void>}
|
|
231
|
+
* @throws {Sass} If the directory is not marked as temporary
|
|
232
|
+
* @throws {Sass} If the directory deletion fails
|
|
233
|
+
* @example
|
|
234
|
+
* const tempDir = await FS.tempDirectory("my-temp")
|
|
235
|
+
* // ... use the directory ...
|
|
236
|
+
* await tempDir.remove() // Recursively deletes everything
|
|
237
|
+
*/
|
|
238
|
+
async remove() {
|
|
239
|
+
if(!this.temporary)
|
|
240
|
+
throw Sass.new("This is not a temporary directory.")
|
|
241
|
+
|
|
242
|
+
/** @type {{files: Array<FileObject>, directories: Array<DirectoryObject>}} */
|
|
243
|
+
const {files, directories} = await this.read()
|
|
244
|
+
|
|
245
|
+
// Remove subdirectories recursively
|
|
246
|
+
for(const dir of directories)
|
|
247
|
+
await dir.remove()
|
|
248
|
+
|
|
249
|
+
// Remove files
|
|
250
|
+
for(const file of files)
|
|
251
|
+
await file.delete()
|
|
252
|
+
|
|
253
|
+
// Delete the now-empty directory
|
|
254
|
+
await this.delete()
|
|
255
|
+
}
|
|
256
|
+
|
|
203
257
|
/**
|
|
204
258
|
* Returns false. Because this is a directory.
|
|
205
259
|
*
|
|
@@ -225,7 +279,7 @@ export default class DirectoryObject extends FS {
|
|
|
225
279
|
*/
|
|
226
280
|
async #directoryExists() {
|
|
227
281
|
try {
|
|
228
|
-
(await
|
|
282
|
+
(await opendir(this.path)).close()
|
|
229
283
|
|
|
230
284
|
return true
|
|
231
285
|
} catch(_) {
|
|
@@ -239,7 +293,7 @@ export default class DirectoryObject extends FS {
|
|
|
239
293
|
* @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} The files and directories in the directory.
|
|
240
294
|
*/
|
|
241
295
|
async read() {
|
|
242
|
-
const found = await
|
|
296
|
+
const found = await readdir(this.url, {withFileTypes: true})
|
|
243
297
|
|
|
244
298
|
const files = found
|
|
245
299
|
.filter(dirent => dirent.isFile())
|
|
@@ -247,7 +301,11 @@ export default class DirectoryObject extends FS {
|
|
|
247
301
|
|
|
248
302
|
const directories = found
|
|
249
303
|
.filter(dirent => dirent.isDirectory())
|
|
250
|
-
.map(dirent =>
|
|
304
|
+
.map(dirent => {
|
|
305
|
+
const dirPath = path.join(this.path, dirent.name)
|
|
306
|
+
|
|
307
|
+
return new DirectoryObject(dirPath, this.temporary)
|
|
308
|
+
})
|
|
251
309
|
|
|
252
310
|
return {files, directories}
|
|
253
311
|
}
|
|
@@ -270,7 +328,7 @@ export default class DirectoryObject extends FS {
|
|
|
270
328
|
return
|
|
271
329
|
|
|
272
330
|
try {
|
|
273
|
-
await
|
|
331
|
+
await mkdir(this.path, options)
|
|
274
332
|
} catch(e) {
|
|
275
333
|
if(e.code === "EEXIST") {
|
|
276
334
|
// Directory already exists, ignore
|
|
@@ -353,7 +411,7 @@ export default class DirectoryObject extends FS {
|
|
|
353
411
|
if(!(await this.exists))
|
|
354
412
|
throw Sass.new(`No such resource '${this.url.href}'`)
|
|
355
413
|
|
|
356
|
-
return await
|
|
414
|
+
return await rmdir(this.path)
|
|
357
415
|
}
|
|
358
416
|
|
|
359
417
|
/**
|
|
@@ -380,4 +438,27 @@ export default class DirectoryObject extends FS {
|
|
|
380
438
|
|
|
381
439
|
return await directory.exists
|
|
382
440
|
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Creates a new DirectoryObject by merging this directory's path with a new
|
|
444
|
+
* path.
|
|
445
|
+
*
|
|
446
|
+
* Uses overlapping path segment detection to intelligently combine paths.
|
|
447
|
+
* Preserves the temporary flag from the current directory.
|
|
448
|
+
*
|
|
449
|
+
* @param {string} newPath - The path to merge with this directory's path.
|
|
450
|
+
* @returns {DirectoryObject} A new DirectoryObject with the merged path.
|
|
451
|
+
* @example
|
|
452
|
+
* const dir = new DirectoryObject("/projects/git/toolkit")
|
|
453
|
+
* const subDir = dir.to("toolkit/src/lib")
|
|
454
|
+
* console.log(subDir.path) // "/projects/git/toolkit/src/lib"
|
|
455
|
+
*/
|
|
456
|
+
to(newPath) {
|
|
457
|
+
Valid.type(newPath, "String")
|
|
458
|
+
|
|
459
|
+
const thisPath = this.path
|
|
460
|
+
const merged = FS.mergeOverlappingPaths(thisPath, newPath)
|
|
461
|
+
|
|
462
|
+
return new this(merged, this.temporary)
|
|
463
|
+
}
|
|
383
464
|
}
|
package/src/lib/FS.js
CHANGED
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
import {globby} from "globby"
|
|
9
9
|
import path from "node:path"
|
|
10
10
|
import url from "node:url"
|
|
11
|
+
import fs from "node:fs/promises"
|
|
12
|
+
import os from "node:os"
|
|
11
13
|
|
|
12
14
|
import Collection from "../browser/lib/Collection.js"
|
|
13
15
|
import Sass from "./Sass.js"
|
|
14
16
|
import Valid from "./Valid.js"
|
|
17
|
+
import DirectoryObject from "./DirectoryObject.js"
|
|
15
18
|
|
|
16
19
|
/** @typedef {import("./FileObject.js").default} FileObject */
|
|
17
20
|
/** @typedef {import("./DirectoryObject.js").default} DirectoryObject */
|
|
@@ -33,6 +36,7 @@ export default class FS {
|
|
|
33
36
|
/**
|
|
34
37
|
* Fix slashes in a path
|
|
35
38
|
*
|
|
39
|
+
* @static
|
|
36
40
|
* @param {string} pathName - The path to fix
|
|
37
41
|
* @returns {string} The fixed path
|
|
38
42
|
*/
|
|
@@ -43,6 +47,7 @@ export default class FS {
|
|
|
43
47
|
/**
|
|
44
48
|
* Convert a path to a URI
|
|
45
49
|
*
|
|
50
|
+
* @static
|
|
46
51
|
* @param {string} pathName - The path to convert
|
|
47
52
|
* @returns {string} The URI
|
|
48
53
|
*/
|
|
@@ -59,6 +64,7 @@ export default class FS {
|
|
|
59
64
|
/**
|
|
60
65
|
* Convert a URI to a path
|
|
61
66
|
*
|
|
67
|
+
* @static
|
|
62
68
|
* @param {string} pathName - The URI to convert
|
|
63
69
|
* @returns {string} The path
|
|
64
70
|
*/
|
|
@@ -73,6 +79,7 @@ export default class FS {
|
|
|
73
79
|
/**
|
|
74
80
|
* Retrieve all files matching a specific glob pattern.
|
|
75
81
|
*
|
|
82
|
+
* @static
|
|
76
83
|
* @param {string|Array<string>} glob - The glob pattern(s) to search.
|
|
77
84
|
* @returns {Promise<Array<FileObject>>} A promise that resolves to an array of file objects
|
|
78
85
|
* @throws {Sass} If the input is not a string or array of strings.
|
|
@@ -117,6 +124,7 @@ export default class FS {
|
|
|
117
124
|
* If the target is outside the source (i.e., the relative path starts with ".."),
|
|
118
125
|
* returns the absolute path to the target instead.
|
|
119
126
|
*
|
|
127
|
+
* @static
|
|
120
128
|
* @param {FileObject|DirectoryObject} from - The source file or directory object
|
|
121
129
|
* @param {FileObject|DirectoryObject} to - The target file or directory object
|
|
122
130
|
* @returns {string} The relative path from `from` to `to`, or the absolute path if not reachable
|
|
@@ -136,6 +144,7 @@ export default class FS {
|
|
|
136
144
|
/**
|
|
137
145
|
* Merge two paths by finding overlapping segments and combining them efficiently
|
|
138
146
|
*
|
|
147
|
+
* @static
|
|
139
148
|
* @param {string} path1 - The first path
|
|
140
149
|
* @param {string} path2 - The second path to merge with the first
|
|
141
150
|
* @param {string} [sep] - The path separator to use (defaults to system separator)
|
|
@@ -172,6 +181,7 @@ export default class FS {
|
|
|
172
181
|
* Resolve a path relative to another path using various strategies
|
|
173
182
|
* Handles absolute paths, relative navigation, and overlap-based merging
|
|
174
183
|
*
|
|
184
|
+
* @static
|
|
175
185
|
* @param {string} fromPath - The base path to resolve from
|
|
176
186
|
* @param {string} toPath - The target path to resolve
|
|
177
187
|
* @returns {string} The resolved path
|
|
@@ -207,4 +217,88 @@ export default class FS {
|
|
|
207
217
|
// join if no overlap
|
|
208
218
|
return FS.mergeOverlappingPaths(from, normalizedTo)
|
|
209
219
|
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Creates a new temporary directory and wraps it in a DirectoryObject.
|
|
223
|
+
*
|
|
224
|
+
* When called without a parent, creates a new temporary directory in the OS
|
|
225
|
+
* temp folder with a unique name. When called with a parent DirectoryObject,
|
|
226
|
+
* creates a subdirectory within that parent.
|
|
227
|
+
*
|
|
228
|
+
* The parent directory (if provided) must:
|
|
229
|
+
* - Be marked as temporary
|
|
230
|
+
* - Actually exist on the filesystem
|
|
231
|
+
* - Have lineage tracing back to the OS temp directory
|
|
232
|
+
*
|
|
233
|
+
* These validations ensure that only legitimately temporary directories can
|
|
234
|
+
* be created and later removed with the remove() method.
|
|
235
|
+
*
|
|
236
|
+
* @static
|
|
237
|
+
* @async
|
|
238
|
+
* @param {string} name - The base name for the temporary directory. When creating a root temp directory, a random suffix will be appended for uniqueness.
|
|
239
|
+
* @param {DirectoryObject|null} [parent] - Optional parent DirectoryObject to create this directory within. Must be a temporary directory itself.
|
|
240
|
+
* @returns {Promise<DirectoryObject>} A DirectoryObject representing the created temporary directory, with the temporary flag set to true.
|
|
241
|
+
* @throws {Sass} If name is not a string
|
|
242
|
+
* @throws {Sass} If parent is provided but is not a DirectoryObject
|
|
243
|
+
* @throws {Sass} If parent is not marked as temporary
|
|
244
|
+
* @throws {Sass} If parent does not exist
|
|
245
|
+
* @throws {Sass} If parent's lineage does not trace back to the OS temp directory
|
|
246
|
+
* @example
|
|
247
|
+
* // Create a standalone temporary directory
|
|
248
|
+
* const tempDir = await FS.tempDirectory("my-temp")
|
|
249
|
+
* console.log(tempDir.temporary) // true
|
|
250
|
+
* console.log(tempDir.path) // /tmp/my-temp-abc123 (on Unix)
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* // Create nested temporary directories
|
|
254
|
+
* const parent = await FS.tempDirectory("parent")
|
|
255
|
+
* const child = await FS.tempDirectory("child", parent)
|
|
256
|
+
* console.log(child.path.startsWith(parent.path)) // true
|
|
257
|
+
* await parent.remove() // Removes both parent and child
|
|
258
|
+
*/
|
|
259
|
+
static async tempDirectory(name, parent=null) {
|
|
260
|
+
Valid.type(name, "String")
|
|
261
|
+
Valid.type(parent, "Null|DirectoryObject")
|
|
262
|
+
|
|
263
|
+
const temp = os.tmpdir()
|
|
264
|
+
|
|
265
|
+
if(parent) {
|
|
266
|
+
Valid.assert(parent.temporary, "Parent must be a temporary DirectoryObject.")
|
|
267
|
+
Valid.assert(await parent.exists, "Parent must exist.")
|
|
268
|
+
|
|
269
|
+
let found = false
|
|
270
|
+
for(const p of parent.walkUp) {
|
|
271
|
+
if(p.path === temp) {
|
|
272
|
+
found = true
|
|
273
|
+
break
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
Valid.assert(found, "The lineage of this directory must be the OS temp directory.")
|
|
278
|
+
|
|
279
|
+
// Security: Reject absolute paths, path traversal, and path separators
|
|
280
|
+
Valid.assert(
|
|
281
|
+
!path.isAbsolute(name),
|
|
282
|
+
"Temporary directory name must not be an absolute path."
|
|
283
|
+
)
|
|
284
|
+
Valid.assert(
|
|
285
|
+
!name.includes("/") && !name.includes("\\") && !name.includes(path.sep),
|
|
286
|
+
"Temporary directory name must not contain path separators."
|
|
287
|
+
)
|
|
288
|
+
Valid.assert(
|
|
289
|
+
name.length > 0,
|
|
290
|
+
"Temporary directory name must not be empty."
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
const dir = new DirectoryObject(path.join(parent.path, name), true)
|
|
294
|
+
await dir.assureExists()
|
|
295
|
+
|
|
296
|
+
return dir
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const prefix = name.endsWith("-") ? name : `${name}-`
|
|
300
|
+
const dir = await fs.mkdtemp(path.join(temp, prefix))
|
|
301
|
+
|
|
302
|
+
return new DirectoryObject(dir, true)
|
|
303
|
+
}
|
|
210
304
|
}
|
package/src/lib/FileObject.js
CHANGED
|
@@ -75,12 +75,16 @@ export default class FileObject extends FS {
|
|
|
75
75
|
/**
|
|
76
76
|
* Constructs a FileObject instance.
|
|
77
77
|
*
|
|
78
|
-
* @param {string} fileName - The file path
|
|
78
|
+
* @param {string | FileObject} fileName - The file path or FileObject
|
|
79
79
|
* @param {DirectoryObject|string|null} [directory] - The parent directory (object or string)
|
|
80
80
|
*/
|
|
81
81
|
constructor(fileName, directory=null) {
|
|
82
82
|
super()
|
|
83
83
|
|
|
84
|
+
// If passed a FileObject, extract its path
|
|
85
|
+
if(Data.isType(fileName, "FileObject"))
|
|
86
|
+
fileName = fileName.path
|
|
87
|
+
|
|
84
88
|
if(!fileName || typeof fileName !== "string" || fileName.length === 0) {
|
|
85
89
|
throw Sass.new("fileName must be a non-empty string")
|
|
86
90
|
}
|
package/src/lib/Notify.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import {EventEmitter} from "node:events"
|
|
8
8
|
|
|
9
|
+
import Valid from "./Valid.js"
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* @typedef {object} NotifyEventOptions
|
|
11
13
|
* @property {boolean} [once] - Whether the listener should be invoked only once.
|
|
@@ -31,6 +33,9 @@ export default new class Notify {
|
|
|
31
33
|
* @returns {void}
|
|
32
34
|
*/
|
|
33
35
|
emit(type, payload=undefined) {
|
|
36
|
+
Valid.type(type, "String")
|
|
37
|
+
Valid.assert(type.length > 0, "Event type cannot be an empty string.")
|
|
38
|
+
|
|
34
39
|
this.#emitter.emit(type, payload)
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -43,6 +48,9 @@ export default new class Notify {
|
|
|
43
48
|
* @returns {unknown} The payload after listeners have processed it.
|
|
44
49
|
*/
|
|
45
50
|
request(type, payload={}) {
|
|
51
|
+
Valid.type(type, "String")
|
|
52
|
+
Valid.assert(type.length > 0, "Event type cannot be an empty string.")
|
|
53
|
+
|
|
46
54
|
this.#emitter.emit(type, payload)
|
|
47
55
|
|
|
48
56
|
return payload
|
|
@@ -58,11 +66,9 @@ export default new class Notify {
|
|
|
58
66
|
* @returns {() => void} Dispose function to unregister the handler.
|
|
59
67
|
*/
|
|
60
68
|
on(type, handler, emitter=this.#emitter, options=undefined) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if(typeof handler !== "function")
|
|
65
|
-
throw new Error("No handler function specified.")
|
|
69
|
+
Valid.type(type, "String")
|
|
70
|
+
Valid.assert(type.length > 0, "Event type cannot be an empty string.")
|
|
71
|
+
Valid.type(handler, "Function")
|
|
66
72
|
|
|
67
73
|
if(options?.once) {
|
|
68
74
|
emitter.once(type, handler, options)
|
|
@@ -13,12 +13,14 @@
|
|
|
13
13
|
* @property {Promise<boolean>} exists - Whether the directory exists (async)
|
|
14
14
|
*/
|
|
15
15
|
export default class DirectoryObject extends FS {
|
|
16
|
+
[x: number]: () => object;
|
|
16
17
|
/**
|
|
17
18
|
* Constructs a DirectoryObject instance.
|
|
18
19
|
*
|
|
19
|
-
* @param {string} directory - The directory path
|
|
20
|
+
* @param {string? | DirectoryObject?} directory - The directory path or DirectoryObject
|
|
21
|
+
* @param {boolean} [temporary] - Whether this is a temporary directory.
|
|
20
22
|
*/
|
|
21
|
-
constructor(directory
|
|
23
|
+
constructor(directory?: any, temporary?: boolean);
|
|
22
24
|
/**
|
|
23
25
|
* Returns a JSON representation of the DirectoryObject.
|
|
24
26
|
*
|
|
@@ -82,6 +84,29 @@ export default class DirectoryObject extends FS {
|
|
|
82
84
|
* console.log(dir.trail) // ['', 'path', 'to', 'directory']
|
|
83
85
|
*/
|
|
84
86
|
get trail(): Array<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns whether this directory is marked as temporary.
|
|
89
|
+
*
|
|
90
|
+
* @returns {boolean} True if this is a temporary directory, false otherwise
|
|
91
|
+
*/
|
|
92
|
+
get temporary(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Recursively removes a temporary directory and all its contents.
|
|
95
|
+
*
|
|
96
|
+
* This method will delete all files and subdirectories within this directory,
|
|
97
|
+
* then delete the directory itself. It only works on directories explicitly
|
|
98
|
+
* marked as temporary for safety.
|
|
99
|
+
*
|
|
100
|
+
* @async
|
|
101
|
+
* @returns {Promise<void>}
|
|
102
|
+
* @throws {Sass} If the directory is not marked as temporary
|
|
103
|
+
* @throws {Sass} If the directory deletion fails
|
|
104
|
+
* @example
|
|
105
|
+
* const tempDir = await FS.tempDirectory("my-temp")
|
|
106
|
+
* // ... use the directory ...
|
|
107
|
+
* await tempDir.remove() // Recursively deletes everything
|
|
108
|
+
*/
|
|
109
|
+
remove(): Promise<void>;
|
|
85
110
|
/**
|
|
86
111
|
* Returns false. Because this is a directory.
|
|
87
112
|
*
|
|
@@ -165,15 +190,22 @@ export default class DirectoryObject extends FS {
|
|
|
165
190
|
*/
|
|
166
191
|
hasDirectory(dirname: string): Promise<boolean>;
|
|
167
192
|
/**
|
|
168
|
-
*
|
|
193
|
+
* Creates a new DirectoryObject by merging this directory's path with a new
|
|
194
|
+
* path.
|
|
195
|
+
*
|
|
196
|
+
* Uses overlapping path segment detection to intelligently combine paths.
|
|
197
|
+
* Preserves the temporary flag from the current directory.
|
|
169
198
|
*
|
|
170
|
-
* @
|
|
199
|
+
* @param {string} newPath - The path to merge with this directory's path.
|
|
200
|
+
* @returns {DirectoryObject} A new DirectoryObject with the merged path.
|
|
201
|
+
* @example
|
|
202
|
+
* const dir = new DirectoryObject("/projects/git/toolkit")
|
|
203
|
+
* const subDir = dir.to("toolkit/src/lib")
|
|
204
|
+
* console.log(subDir.path) // "/projects/git/toolkit/src/lib"
|
|
171
205
|
*/
|
|
172
|
-
|
|
206
|
+
to(newPath: string): DirectoryObject;
|
|
173
207
|
#private;
|
|
174
208
|
}
|
|
175
209
|
import FS from "./FS.js";
|
|
176
|
-
import { URL } from "node:url";
|
|
177
210
|
import FileObject from "./FileObject.js";
|
|
178
|
-
import util from "node:util";
|
|
179
211
|
//# sourceMappingURL=DirectoryObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/DirectoryObject.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../lib/DirectoryObject.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;GAaG;AACH;uBA4Fe,MAAM;IAjEnB;;;;;OAKG;IACH,yCAFW,OAAO,EA6BjB;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,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;;;;OAIG;IACH,iBAFa,OAAO,CAInB;IAED;;;;;;;;;;;;;;;OAeG;IACH,UARa,OAAO,CAAC,IAAI,CAAC,CAyBzB;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,CAkBpF;IAED;;;;;;;;;;;;OAYG;IACH,uBARW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAqBzB;IA8BD;;;;;;;;;;;;;;;OAeG;IACH,cAZa,MAAM,CAclB;IAED;;;;;;;;;;;;;;OAcG;IACH,UARa,OAAO,CAAC,IAAI,CAAC,CAkBzB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAM5B;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAO5B;IAED;;;;;;;;;;;;;OAaG;IACH,YAPW,MAAM,GACJ,eAAe,CAa3B;;CACF;eApcc,SAAS;uBACD,iBAAiB"}
|
package/src/types/lib/FS.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export default class FS {
|
|
|
8
8
|
/**
|
|
9
9
|
* Fix slashes in a path
|
|
10
10
|
*
|
|
11
|
+
* @static
|
|
11
12
|
* @param {string} pathName - The path to fix
|
|
12
13
|
* @returns {string} The fixed path
|
|
13
14
|
*/
|
|
@@ -15,6 +16,7 @@ export default class FS {
|
|
|
15
16
|
/**
|
|
16
17
|
* Convert a path to a URI
|
|
17
18
|
*
|
|
19
|
+
* @static
|
|
18
20
|
* @param {string} pathName - The path to convert
|
|
19
21
|
* @returns {string} The URI
|
|
20
22
|
*/
|
|
@@ -22,6 +24,7 @@ export default class FS {
|
|
|
22
24
|
/**
|
|
23
25
|
* Convert a URI to a path
|
|
24
26
|
*
|
|
27
|
+
* @static
|
|
25
28
|
* @param {string} pathName - The URI to convert
|
|
26
29
|
* @returns {string} The path
|
|
27
30
|
*/
|
|
@@ -29,6 +32,7 @@ export default class FS {
|
|
|
29
32
|
/**
|
|
30
33
|
* Retrieve all files matching a specific glob pattern.
|
|
31
34
|
*
|
|
35
|
+
* @static
|
|
32
36
|
* @param {string|Array<string>} glob - The glob pattern(s) to search.
|
|
33
37
|
* @returns {Promise<Array<FileObject>>} A promise that resolves to an array of file objects
|
|
34
38
|
* @throws {Sass} If the input is not a string or array of strings.
|
|
@@ -41,6 +45,7 @@ export default class FS {
|
|
|
41
45
|
* If the target is outside the source (i.e., the relative path starts with ".."),
|
|
42
46
|
* returns the absolute path to the target instead.
|
|
43
47
|
*
|
|
48
|
+
* @static
|
|
44
49
|
* @param {FileObject|DirectoryObject} from - The source file or directory object
|
|
45
50
|
* @param {FileObject|DirectoryObject} to - The target file or directory object
|
|
46
51
|
* @returns {string} The relative path from `from` to `to`, or the absolute path if not reachable
|
|
@@ -49,6 +54,7 @@ export default class FS {
|
|
|
49
54
|
/**
|
|
50
55
|
* Merge two paths by finding overlapping segments and combining them efficiently
|
|
51
56
|
*
|
|
57
|
+
* @static
|
|
52
58
|
* @param {string} path1 - The first path
|
|
53
59
|
* @param {string} path2 - The second path to merge with the first
|
|
54
60
|
* @param {string} [sep] - The path separator to use (defaults to system separator)
|
|
@@ -59,12 +65,53 @@ export default class FS {
|
|
|
59
65
|
* Resolve a path relative to another path using various strategies
|
|
60
66
|
* Handles absolute paths, relative navigation, and overlap-based merging
|
|
61
67
|
*
|
|
68
|
+
* @static
|
|
62
69
|
* @param {string} fromPath - The base path to resolve from
|
|
63
70
|
* @param {string} toPath - The target path to resolve
|
|
64
71
|
* @returns {string} The resolved path
|
|
65
72
|
*/
|
|
66
73
|
static resolvePath(fromPath: string, toPath: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a new temporary directory and wraps it in a DirectoryObject.
|
|
76
|
+
*
|
|
77
|
+
* When called without a parent, creates a new temporary directory in the OS
|
|
78
|
+
* temp folder with a unique name. When called with a parent DirectoryObject,
|
|
79
|
+
* creates a subdirectory within that parent.
|
|
80
|
+
*
|
|
81
|
+
* The parent directory (if provided) must:
|
|
82
|
+
* - Be marked as temporary
|
|
83
|
+
* - Actually exist on the filesystem
|
|
84
|
+
* - Have lineage tracing back to the OS temp directory
|
|
85
|
+
*
|
|
86
|
+
* These validations ensure that only legitimately temporary directories can
|
|
87
|
+
* be created and later removed with the remove() method.
|
|
88
|
+
*
|
|
89
|
+
* @static
|
|
90
|
+
* @async
|
|
91
|
+
* @param {string} name - The base name for the temporary directory. When creating a root temp directory, a random suffix will be appended for uniqueness.
|
|
92
|
+
* @param {DirectoryObject|null} [parent] - Optional parent DirectoryObject to create this directory within. Must be a temporary directory itself.
|
|
93
|
+
* @returns {Promise<DirectoryObject>} A DirectoryObject representing the created temporary directory, with the temporary flag set to true.
|
|
94
|
+
* @throws {Sass} If name is not a string
|
|
95
|
+
* @throws {Sass} If parent is provided but is not a DirectoryObject
|
|
96
|
+
* @throws {Sass} If parent is not marked as temporary
|
|
97
|
+
* @throws {Sass} If parent does not exist
|
|
98
|
+
* @throws {Sass} If parent's lineage does not trace back to the OS temp directory
|
|
99
|
+
* @example
|
|
100
|
+
* // Create a standalone temporary directory
|
|
101
|
+
* const tempDir = await FS.tempDirectory("my-temp")
|
|
102
|
+
* console.log(tempDir.temporary) // true
|
|
103
|
+
* console.log(tempDir.path) // /tmp/my-temp-abc123 (on Unix)
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* // Create nested temporary directories
|
|
107
|
+
* const parent = await FS.tempDirectory("parent")
|
|
108
|
+
* const child = await FS.tempDirectory("child", parent)
|
|
109
|
+
* console.log(child.path.startsWith(parent.path)) // true
|
|
110
|
+
* await parent.remove() // Removes both parent and child
|
|
111
|
+
*/
|
|
112
|
+
static tempDirectory(name: string, parent?: DirectoryObject | null): Promise<DirectoryObject>;
|
|
67
113
|
}
|
|
68
114
|
export type FileObject = import("./FileObject.js").default;
|
|
69
115
|
export type DirectoryObject = import("./DirectoryObject.js").default;
|
|
116
|
+
import DirectoryObject from "./DirectoryObject.js";
|
|
70
117
|
//# sourceMappingURL=FS.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../../lib/FS.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FS.d.ts","sourceRoot":"","sources":["../../lib/FS.js"],"names":[],"mappings":"AA2BA;;GAEG;AACH;IACE,kCAAwB;IACxB,uCAAkC;IAClC,mBAAsB;IAEtB;;;;;;OAMG;IACH,4BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;OAMG;IACH,2BAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;;OAMG;IACH,2BAHW,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;;;OAQG;IACH,sBALW,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,GAClB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAmCtC;IAED;;;;;;;;;;OAUG;IACH,oCAJW,UAAU,GAAC,eAAe,MAC1B,UAAU,GAAC,eAAe,GACxB,MAAM,CAYlB;IAED;;;;;;;;OAQG;IACH,oCALW,MAAM,SACN,MAAM,QACN,MAAM,GACJ,MAAM,CA2BlB;IAED;;;;;;;;OAQG;IACH,6BAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAgClB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,2BArBW,MAAM,WACN,eAAe,GAAC,IAAI,GAClB,OAAO,CAAC,eAAe,CAAC,CA+DpC;CACF;yBA7Ra,OAAO,iBAAiB,EAAE,OAAO;8BACjC,OAAO,sBAAsB,EAAE,OAAO;4BAHxB,sBAAsB"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* @property {Promise<boolean>} exists - Whether the file exists (async)
|
|
15
15
|
*/
|
|
16
16
|
export default class FileObject extends FS {
|
|
17
|
+
[x: number]: () => object;
|
|
17
18
|
/**
|
|
18
19
|
* Configuration mapping data types to their respective parser modules for loadData method.
|
|
19
20
|
* Each parser module must have a .parse() method that accepts a string and returns parsed data.
|
|
@@ -26,10 +27,10 @@ export default class FileObject extends FS {
|
|
|
26
27
|
/**
|
|
27
28
|
* Constructs a FileObject instance.
|
|
28
29
|
*
|
|
29
|
-
* @param {string} fileName - The file path
|
|
30
|
+
* @param {string | FileObject} fileName - The file path or FileObject
|
|
30
31
|
* @param {DirectoryObject|string|null} [directory] - The parent directory (object or string)
|
|
31
32
|
*/
|
|
32
|
-
constructor(fileName: string, directory?: DirectoryObject | string | null);
|
|
33
|
+
constructor(fileName: string | FileObject, directory?: DirectoryObject | string | null);
|
|
33
34
|
/**
|
|
34
35
|
* Returns a JSON representation of the FileObject.
|
|
35
36
|
*
|
|
@@ -214,18 +215,10 @@ export default class FileObject extends FS {
|
|
|
214
215
|
* await file.delete()
|
|
215
216
|
*/
|
|
216
217
|
delete(): Promise<void>;
|
|
217
|
-
/**
|
|
218
|
-
* Custom inspect method for Node.js console.
|
|
219
|
-
*
|
|
220
|
-
* @returns {object} JSON representation of this object.
|
|
221
|
-
*/
|
|
222
|
-
[util.inspect.custom](): object;
|
|
223
218
|
#private;
|
|
224
219
|
}
|
|
225
220
|
import FS from "./FS.js";
|
|
226
|
-
import { URL } from "node:url";
|
|
227
221
|
import DirectoryObject from "./DirectoryObject.js";
|
|
228
|
-
import util from "node:util";
|
|
229
222
|
import JSON5 from "json5";
|
|
230
223
|
import YAML from "yaml";
|
|
231
224
|
//# sourceMappingURL=FileObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../lib/FileObject.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;GAcG;AAEH;
|
|
1
|
+
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../lib/FileObject.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;GAcG;AAEH;uBAsHe,MAAM;IArHnB;;;;;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,GAAG,UAAU,cACnB,eAAe,GAAC,MAAM,GAAC,IAAI,EA0CrC;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,GAAG,CAIf;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,cARa,OAAO,CAAC,MAAM,CAAC,CAkB3B;IAED;;;;;;;;;;;OAWG;IACH,eARW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAezB;IAED;;;;;;;;;;;;;;;OAeG;IACH,kBAXW,WAAW,GAAC,IAAI,GAAC,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAyBzB;IAED;;;;;;;;;;;;;;OAcG;IACH,gBAXW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAkC5B;IAED;;;;OAIG;IACH,UAFa,OAAO,CAAC,MAAM,CAAC,CAY3B;IAED;;;;;;;;;OASG;IACH,UAPa,OAAO,CAAC,IAAI,CAAC,CAiBzB;;CACF;eArgBc,SAAS;4BADI,sBAAsB;kBARhC,OAAO;iBAIR,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notify.d.ts","sourceRoot":"","sources":["../../lib/Notify.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Notify.d.ts","sourceRoot":"","sources":["../../lib/Notify.js"],"names":[],"mappings":";IAqBE,iDAAiD;UAAtC,MAAM;IAGjB,kDAAkD;2BAAvC,YAAY;IAGvB;;;;;;OAMG;eAHQ,MAAM,YACN,OAAO,GACL,IAAI;IASjB;;;;;;;OAOG;kBAHQ,MAAM,YACN,OAAO,GACL,OAAO;IAWpB;;;;;;;;OAQG;aALQ,MAAM,WACN,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,YAC1B,YAAY,YACZ,kBAAkB,GAChB,MAAM,IAAI;IAgBvB;;;;;;;OAOG;cAJQ,MAAM,WACN,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,YAC1B,YAAY,GACV,IAAI;;;;;;;WA3EL,OAAO;;;;aACP,WAAW"}
|
package/src/types/lib/Util.d.ts
CHANGED
|
@@ -73,5 +73,4 @@ export default class Util extends BrowserUtil {
|
|
|
73
73
|
static asyncEmitQuack(emitter: object, event: string, ...args: unknown[]): Promise<void>;
|
|
74
74
|
}
|
|
75
75
|
import { Util as BrowserUtil } from "../browser/index.js";
|
|
76
|
-
import { EventEmitter } from "node:events";
|
|
77
76
|
//# sourceMappingURL=Util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../lib/Util.js"],"names":[],"mappings":"AAKA;;;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;CACF;oCAvJiC,qBAAqB
|
|
1
|
+
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../lib/Util.js"],"names":[],"mappings":"AAKA;;;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;CACF;oCAvJiC,qBAAqB"}
|