@gesslar/toolkit 0.7.0 → 0.8.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/package.json +6 -6
- package/src/lib/Data.js +24 -0
- package/src/lib/DirectoryObject.js +43 -19
- package/src/lib/FileObject.js +109 -29
- package/src/lib/Logger.js +1 -1
- package/src/lib/Util.js +3 -2
- package/src/types/lib/Chide.d.ts +37 -0
- package/src/types/lib/Chide.d.ts.map +1 -0
- package/src/types/lib/Data.d.ts +17 -0
- package/src/types/lib/Data.d.ts.map +1 -1
- package/src/types/lib/DirectoryObject.d.ts +21 -4
- package/src/types/lib/DirectoryObject.d.ts.map +1 -1
- package/src/types/lib/FileObject.d.ts +51 -9
- package/src/types/lib/FileObject.d.ts.map +1 -1
- package/src/types/lib/TypeSpec.d.ts +1 -1
- package/src/types/lib/TypeSpec.d.ts.map +1 -1
- package/src/types/lib/Util.d.ts +3 -2
- package/src/types/lib/Util.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gesslar/toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Get in, bitches, we're going toolkitting.",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@stylistic/eslint-plugin": "^5.5.0",
|
|
61
|
-
"@types/node": "^24.
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
63
|
-
"@typescript-eslint/parser": "^8.46.
|
|
64
|
-
"eslint": "^9.
|
|
65
|
-
"eslint-plugin-jsdoc": "^61.1.
|
|
61
|
+
"@types/node": "^24.10.0",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
63
|
+
"@typescript-eslint/parser": "^8.46.3",
|
|
64
|
+
"eslint": "^9.39.1",
|
|
65
|
+
"eslint-plugin-jsdoc": "^61.1.12"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/lib/Data.js
CHANGED
|
@@ -410,4 +410,28 @@ export default class Data {
|
|
|
410
410
|
|
|
411
411
|
return proto === current
|
|
412
412
|
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Checks if a value is binary data.
|
|
416
|
+
* Returns true for ArrayBuffer, TypedArrays (Uint8Array, Int16Array, etc.),
|
|
417
|
+
* Blob, and Node Buffer instances.
|
|
418
|
+
*
|
|
419
|
+
* @param {unknown} value - The value to check
|
|
420
|
+
* @returns {boolean} True if the value is binary data, false otherwise
|
|
421
|
+
* @example
|
|
422
|
+
* Data.isBinary(new Uint8Array([1, 2, 3])) // true
|
|
423
|
+
* Data.isBinary(new ArrayBuffer(10)) // true
|
|
424
|
+
* Data.isBinary(Buffer.from('hello')) // true
|
|
425
|
+
* Data.isBinary(new Blob(['text'])) // true
|
|
426
|
+
* Data.isBinary('string') // false
|
|
427
|
+
* Data.isBinary({}) // false
|
|
428
|
+
* Data.isBinary(undefined) // false
|
|
429
|
+
*/
|
|
430
|
+
static isBinary(value) {
|
|
431
|
+
return (value !== undefined) &&
|
|
432
|
+
(
|
|
433
|
+
ArrayBuffer.isView(value) ||
|
|
434
|
+
Data.isType(value, "ArrayBuffer|Blob|Buffer")
|
|
435
|
+
)
|
|
436
|
+
}
|
|
413
437
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import fs from "node:fs/promises"
|
|
8
8
|
import path from "node:path"
|
|
9
9
|
import util from "node:util"
|
|
10
|
+
import {URL} from "node:url"
|
|
10
11
|
|
|
11
12
|
import FS from "./FS.js"
|
|
12
13
|
import FileObject from "./FileObject.js"
|
|
@@ -18,7 +19,7 @@ import Sass from "./Sass.js"
|
|
|
18
19
|
*
|
|
19
20
|
* @property {string} supplied - The supplied directory
|
|
20
21
|
* @property {string} path - The resolved path
|
|
21
|
-
* @property {
|
|
22
|
+
* @property {URL} url - The directory URL
|
|
22
23
|
* @property {string} name - The directory name
|
|
23
24
|
* @property {string} module - The directory name without extension
|
|
24
25
|
* @property {string} extension - The directory extension (usually empty)
|
|
@@ -32,7 +33,7 @@ export default class DirectoryObject extends FS {
|
|
|
32
33
|
* @private
|
|
33
34
|
* @property {string|null} supplied - User-supplied path
|
|
34
35
|
* @property {string|null} path - The absolute file path
|
|
35
|
-
* @property {
|
|
36
|
+
* @property {URL|null} url - The file URL
|
|
36
37
|
* @property {string|null} name - The file name
|
|
37
38
|
* @property {string|null} module - The file name without extension
|
|
38
39
|
* @property {string|null} extension - The file extension
|
|
@@ -42,7 +43,7 @@ export default class DirectoryObject extends FS {
|
|
|
42
43
|
#meta = Object.seal({
|
|
43
44
|
supplied: null,
|
|
44
45
|
path: null,
|
|
45
|
-
|
|
46
|
+
url: null,
|
|
46
47
|
name: null,
|
|
47
48
|
module: null,
|
|
48
49
|
extension: null,
|
|
@@ -61,16 +62,15 @@ export default class DirectoryObject extends FS {
|
|
|
61
62
|
super()
|
|
62
63
|
|
|
63
64
|
const fixedDir = FS.fixSlashes(directory ?? ".")
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const trail = filePath.split(path.sep)
|
|
65
|
+
const resolved = path.resolve(fixedDir)
|
|
66
|
+
const url = new URL(FS.pathToUri(resolved))
|
|
67
|
+
const baseName = path.basename(resolved) || "."
|
|
68
|
+
const trail = resolved.split(path.sep)
|
|
69
69
|
const sep = path.sep
|
|
70
70
|
|
|
71
71
|
this.#meta.supplied = fixedDir
|
|
72
|
-
this.#meta.path =
|
|
73
|
-
this.#meta.
|
|
72
|
+
this.#meta.path = resolved
|
|
73
|
+
this.#meta.url = url
|
|
74
74
|
this.#meta.name = baseName
|
|
75
75
|
this.#meta.extension = ""
|
|
76
76
|
this.#meta.module = baseName
|
|
@@ -98,7 +98,7 @@ export default class DirectoryObject extends FS {
|
|
|
98
98
|
return {
|
|
99
99
|
supplied: this.supplied,
|
|
100
100
|
path: this.path,
|
|
101
|
-
|
|
101
|
+
url: this.url.toString(),
|
|
102
102
|
name: this.name,
|
|
103
103
|
module: this.module,
|
|
104
104
|
extension: this.extension,
|
|
@@ -144,12 +144,12 @@ export default class DirectoryObject extends FS {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* Returns the
|
|
147
|
+
* Returns the URL of the current directory.
|
|
148
148
|
*
|
|
149
|
-
* @returns {
|
|
149
|
+
* @returns {URL} The directory URL
|
|
150
150
|
*/
|
|
151
|
-
get
|
|
152
|
-
return this.#meta.
|
|
151
|
+
get url() {
|
|
152
|
+
return this.#meta.url
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
/**
|
|
@@ -239,10 +239,7 @@ export default class DirectoryObject extends FS {
|
|
|
239
239
|
* @returns {Promise<{files: Array<FileObject>, directories: Array<DirectoryObject>}>} The files and directories in the directory.
|
|
240
240
|
*/
|
|
241
241
|
async read() {
|
|
242
|
-
const found = await fs.readdir(
|
|
243
|
-
new URL(this.uri),
|
|
244
|
-
{withFileTypes: true}
|
|
245
|
-
)
|
|
242
|
+
const found = await fs.readdir(this.url, {withFileTypes: true})
|
|
246
243
|
|
|
247
244
|
const files = found
|
|
248
245
|
.filter(dirent => dirent.isFile())
|
|
@@ -331,4 +328,31 @@ export default class DirectoryObject extends FS {
|
|
|
331
328
|
get walkUp() {
|
|
332
329
|
return this.#walkUp()
|
|
333
330
|
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Deletes an empty directory from the filesystem.
|
|
334
|
+
*
|
|
335
|
+
* Recursive deletion is intentionally not supported. If you need to delete
|
|
336
|
+
* a directory with contents, you must imperatively decide your deletion
|
|
337
|
+
* strategy and handle it explicitly.
|
|
338
|
+
*
|
|
339
|
+
* @returns {Promise<void>} Resolves when directory is deleted
|
|
340
|
+
* @throws {Sass} If the directory URL is invalid
|
|
341
|
+
* @throws {Sass} If the directory does not exist
|
|
342
|
+
* @throws {Error} If the directory is not empty (from fs.rmdir)
|
|
343
|
+
* @example
|
|
344
|
+
* const dir = new DirectoryObject('./temp/cache')
|
|
345
|
+
* await dir.delete() // Only works if directory is empty
|
|
346
|
+
*/
|
|
347
|
+
async delete() {
|
|
348
|
+
const dirPath = this.path
|
|
349
|
+
|
|
350
|
+
if(!dirPath)
|
|
351
|
+
throw Sass.new("This object does not represent a valid resource.")
|
|
352
|
+
|
|
353
|
+
if(!(await this.exists))
|
|
354
|
+
throw Sass.new(`No such resource '${this.url.href}'`)
|
|
355
|
+
|
|
356
|
+
return await fs.rmdir(this.path)
|
|
357
|
+
}
|
|
334
358
|
}
|
package/src/lib/FileObject.js
CHANGED
|
@@ -9,6 +9,7 @@ import fs from "node:fs/promises"
|
|
|
9
9
|
import path from "node:path"
|
|
10
10
|
import util from "node:util"
|
|
11
11
|
import YAML from "yaml"
|
|
12
|
+
import {URL} from "node:url"
|
|
12
13
|
|
|
13
14
|
import Data from "./Data.js"
|
|
14
15
|
import DirectoryObject from "./DirectoryObject.js"
|
|
@@ -22,7 +23,7 @@ import Valid from "./Valid.js"
|
|
|
22
23
|
*
|
|
23
24
|
* @property {string} supplied - User-supplied path
|
|
24
25
|
* @property {string} path - The absolute file path
|
|
25
|
-
* @property {
|
|
26
|
+
* @property {URL} url - The file URL
|
|
26
27
|
* @property {string} name - The file name
|
|
27
28
|
* @property {string} module - The file name without extension
|
|
28
29
|
* @property {string} extension - The file extension
|
|
@@ -51,7 +52,7 @@ export default class FileObject extends FS {
|
|
|
51
52
|
* @private
|
|
52
53
|
* @property {string|null} supplied - User-supplied path
|
|
53
54
|
* @property {string|null} path - The absolute file path
|
|
54
|
-
* @property {
|
|
55
|
+
* @property {URL|null} url - The file URL
|
|
55
56
|
* @property {string|null} name - The file name
|
|
56
57
|
* @property {string|null} module - The file name without extension
|
|
57
58
|
* @property {string|null} extension - The file extension
|
|
@@ -62,7 +63,7 @@ export default class FileObject extends FS {
|
|
|
62
63
|
#meta = Object.seal({
|
|
63
64
|
supplied: null,
|
|
64
65
|
path: null,
|
|
65
|
-
|
|
66
|
+
url: null,
|
|
66
67
|
name: null,
|
|
67
68
|
module: null,
|
|
68
69
|
extension: null,
|
|
@@ -102,11 +103,11 @@ export default class FileObject extends FS {
|
|
|
102
103
|
const final = FS.resolvePath(directoryObject.path ?? ".", fixedFile)
|
|
103
104
|
|
|
104
105
|
const resolved = final
|
|
105
|
-
const
|
|
106
|
+
const url = new URL(FS.pathToUri(resolved))
|
|
106
107
|
|
|
107
108
|
this.#meta.supplied = fixedFile
|
|
108
109
|
this.#meta.path = resolved
|
|
109
|
-
this.#meta.
|
|
110
|
+
this.#meta.url = url
|
|
110
111
|
this.#meta.name = base
|
|
111
112
|
this.#meta.extension = ext
|
|
112
113
|
this.#meta.module = path.basename(this.supplied, this.extension)
|
|
@@ -133,7 +134,7 @@ export default class FileObject extends FS {
|
|
|
133
134
|
return {
|
|
134
135
|
supplied: this.supplied,
|
|
135
136
|
path: this.path,
|
|
136
|
-
|
|
137
|
+
url: this.url.toString(),
|
|
137
138
|
name: this.name,
|
|
138
139
|
module: this.module,
|
|
139
140
|
extension: this.extension,
|
|
@@ -162,30 +163,30 @@ export default class FileObject extends FS {
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
/**
|
|
165
|
-
* Return the
|
|
166
|
+
* Return the normalized path that was provided to the constructor.
|
|
166
167
|
*
|
|
167
|
-
* @returns {string} The file path
|
|
168
|
+
* @returns {string} The sanitized user-supplied file path
|
|
168
169
|
*/
|
|
169
170
|
get supplied() {
|
|
170
171
|
return this.#meta.supplied
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
/**
|
|
174
|
-
* Return the resolved path
|
|
175
|
+
* Return the fully resolved absolute path to the file on disk.
|
|
175
176
|
*
|
|
176
|
-
* @returns {string} The file path
|
|
177
|
+
* @returns {string} The fully resolved absolute file path
|
|
177
178
|
*/
|
|
178
179
|
get path() {
|
|
179
180
|
return this.#meta.path
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
/**
|
|
183
|
-
* Returns the
|
|
184
|
+
* Returns the URL of the current file.
|
|
184
185
|
*
|
|
185
|
-
* @returns {
|
|
186
|
+
* @returns {URL} The file URL
|
|
186
187
|
*/
|
|
187
|
-
get
|
|
188
|
-
return this.#meta.
|
|
188
|
+
get url() {
|
|
189
|
+
return this.#meta.url
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
/**
|
|
@@ -354,15 +355,39 @@ export default class FileObject extends FS {
|
|
|
354
355
|
* @returns {Promise<string>} The file contents
|
|
355
356
|
*/
|
|
356
357
|
async read(encoding="utf8") {
|
|
357
|
-
const
|
|
358
|
+
const url = this.url
|
|
358
359
|
|
|
359
|
-
if(!
|
|
360
|
-
throw Sass.new("No
|
|
360
|
+
if(!url)
|
|
361
|
+
throw Sass.new("No URL in file map")
|
|
361
362
|
|
|
362
363
|
if(!(await this.exists))
|
|
363
|
-
throw Sass.new(`No such file '${
|
|
364
|
+
throw Sass.new(`No such file '${url.href}'`)
|
|
364
365
|
|
|
365
|
-
return await fs.readFile(
|
|
366
|
+
return await fs.readFile(url, encoding)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Reads binary data from a file asynchronously.
|
|
371
|
+
* Returns the file contents as a Buffer (Node.js binary data type).
|
|
372
|
+
*
|
|
373
|
+
* @returns {Promise<Buffer>} The file contents as a Buffer
|
|
374
|
+
* @throws {Sass} If the file URL is invalid
|
|
375
|
+
* @throws {Sass} If the file does not exist
|
|
376
|
+
* @example
|
|
377
|
+
* const file = new FileObject('./image.png')
|
|
378
|
+
* const buffer = await file.readBinary()
|
|
379
|
+
* // Use the buffer (e.g., send in HTTP response, process image, etc.)
|
|
380
|
+
*/
|
|
381
|
+
async readBinary() {
|
|
382
|
+
const url = this.url
|
|
383
|
+
|
|
384
|
+
if(!url)
|
|
385
|
+
throw Sass.new("No URL in file map")
|
|
386
|
+
|
|
387
|
+
if(!(await this.exists))
|
|
388
|
+
throw Sass.new(`No such file '${url.href}'`)
|
|
389
|
+
|
|
390
|
+
return await fs.readFile(url)
|
|
366
391
|
}
|
|
367
392
|
|
|
368
393
|
/**
|
|
@@ -372,20 +397,53 @@ export default class FileObject extends FS {
|
|
|
372
397
|
* @param {string} content - The content to write
|
|
373
398
|
* @param {string} [encoding] - The encoding in which to write (default: "utf8")
|
|
374
399
|
* @returns {Promise<void>}
|
|
375
|
-
* @throws {Sass} If the file
|
|
400
|
+
* @throws {Sass} If the file URL is invalid or the parent directory doesn't exist
|
|
376
401
|
* @example
|
|
377
402
|
* const file = new FileObject('./output/data.json')
|
|
378
403
|
* await file.write(JSON.stringify({key: 'value'}))
|
|
379
404
|
*/
|
|
380
405
|
async write(content, encoding="utf8") {
|
|
381
|
-
if(!this.
|
|
382
|
-
throw Sass.new("No
|
|
406
|
+
if(!this.url)
|
|
407
|
+
throw Sass.new("No URL in file")
|
|
383
408
|
|
|
384
409
|
if(await this.directory.exists)
|
|
385
|
-
await fs.writeFile(this.
|
|
410
|
+
await fs.writeFile(this.url, content, encoding)
|
|
386
411
|
|
|
387
412
|
else
|
|
388
|
-
throw Sass.new(`Invalid directory, ${this.directory.
|
|
413
|
+
throw Sass.new(`Invalid directory, ${this.directory.url.href}`)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Writes binary data to a file asynchronously.
|
|
418
|
+
* Validates that the parent directory exists and that the data is valid binary format.
|
|
419
|
+
* Supports ArrayBuffer, TypedArrays (Uint8Array, etc.), Blob, and Node Buffer types.
|
|
420
|
+
*
|
|
421
|
+
* @param {ArrayBuffer|Blob|Buffer} data - The binary data to write
|
|
422
|
+
* @returns {Promise<void>}
|
|
423
|
+
* @throws {Sass} If the file URL is invalid
|
|
424
|
+
* @throws {Sass} If the parent directory doesn't exist
|
|
425
|
+
* @throws {Sass} If the data is not a valid binary type
|
|
426
|
+
* @example
|
|
427
|
+
* const file = new FileObject('./output/image.png')
|
|
428
|
+
* const response = await fetch('https://example.com/image.png')
|
|
429
|
+
* const buffer = await response.arrayBuffer()
|
|
430
|
+
* await file.writeBinary(buffer)
|
|
431
|
+
*/
|
|
432
|
+
async writeBinary(data) {
|
|
433
|
+
if(!this.url)
|
|
434
|
+
throw Sass.new("No URL in file")
|
|
435
|
+
|
|
436
|
+
const exists = await this.directory.exists
|
|
437
|
+
Valid.assert(exists, `Invalid directory, ${this.directory.url.href}`)
|
|
438
|
+
|
|
439
|
+
Valid.assert(Data.isBinary(data), "Data must be binary (ArrayBuffer, TypedArray, Blob, or Buffer)")
|
|
440
|
+
|
|
441
|
+
// Convert ArrayBuffer to Buffer if needed (fs.writeFile doesn't accept ArrayBuffer directly)
|
|
442
|
+
const bufferData = data instanceof ArrayBuffer ? Buffer.from(data) : data
|
|
443
|
+
|
|
444
|
+
// According to the internet, if it's already binary, I don't need
|
|
445
|
+
// an encoding. 🤷
|
|
446
|
+
return await fs.writeFile(this.url, bufferData)
|
|
389
447
|
}
|
|
390
448
|
|
|
391
449
|
/**
|
|
@@ -436,14 +494,36 @@ export default class FileObject extends FS {
|
|
|
436
494
|
* @returns {Promise<object>} The file contents as a module.
|
|
437
495
|
*/
|
|
438
496
|
async import() {
|
|
439
|
-
const
|
|
497
|
+
const url = this.url
|
|
498
|
+
|
|
499
|
+
if(!url)
|
|
500
|
+
throw Sass.new("No URL in file map")
|
|
501
|
+
|
|
502
|
+
if(!(await this.exists))
|
|
503
|
+
throw Sass.new(`No such file '${url.href}'`)
|
|
504
|
+
|
|
505
|
+
return await import(url.href)
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Deletes the file from the filesystem.
|
|
510
|
+
*
|
|
511
|
+
* @returns {Promise<void>} Resolves when file is deleted
|
|
512
|
+
* @throws {Sass} If the file URL is invalid
|
|
513
|
+
* @throws {Sass} If the file does not exist
|
|
514
|
+
* @example
|
|
515
|
+
* const file = new FileObject('./temp/data.json')
|
|
516
|
+
* await file.delete()
|
|
517
|
+
*/
|
|
518
|
+
async delete() {
|
|
519
|
+
const url = this.url
|
|
440
520
|
|
|
441
|
-
if(!
|
|
442
|
-
throw Sass.new("
|
|
521
|
+
if(!url)
|
|
522
|
+
throw Sass.new("This object does not represent a valid resource.")
|
|
443
523
|
|
|
444
524
|
if(!(await this.exists))
|
|
445
|
-
throw Sass.new(`No such
|
|
525
|
+
throw Sass.new(`No such resource '${url.href}'`)
|
|
446
526
|
|
|
447
|
-
return await
|
|
527
|
+
return await fs.unlink(url)
|
|
448
528
|
}
|
|
449
529
|
}
|
package/src/lib/Logger.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
options { depth: 0, colors: false, compact: 3 }.
|
|
9
9
|
* %d: Number will be used to convert all values except BigInt and Symbol.
|
|
10
10
|
* %i: parseInt(value, 10) is used for all values except BigInt and Symbol.
|
|
11
|
-
* %f: parseFloat(value) is used for all values
|
|
11
|
+
* %f: parseFloat(value) is used for all values except Symbol.
|
|
12
12
|
* %j: JSON. Replaced with the string '[Circular]' if the argument contains
|
|
13
13
|
circular references.
|
|
14
14
|
* %o: Object. A string representation of an object with generic JavaScript
|
package/src/lib/Util.js
CHANGED
|
@@ -290,13 +290,14 @@ export default class Util {
|
|
|
290
290
|
* Emits an event asynchronously and waits for all listeners to complete.
|
|
291
291
|
* Like asyncEmit, but uses duck typing for more flexible emitter validation.
|
|
292
292
|
* Accepts any object that has the required EventEmitter-like methods.
|
|
293
|
+
* If it walks like an EventEmitter and quacks like an EventEmitter...
|
|
293
294
|
*
|
|
294
295
|
* @param {object} emitter - Any object with EventEmitter-like interface
|
|
295
296
|
* @param {string} event - The event name to emit
|
|
296
297
|
* @param {...unknown} args - Arguments to pass to event listeners
|
|
297
|
-
* @returns {Promise<void>} Resolves when all listeners have completed
|
|
298
|
+
* @returns {Promise<void>} Resolves when all listeners have completed, but no grapes.
|
|
298
299
|
*/
|
|
299
|
-
static async
|
|
300
|
+
static async asyncEmitQuack(emitter, event, ...args) {
|
|
300
301
|
try {
|
|
301
302
|
if(!emitter ||
|
|
302
303
|
typeof emitter.listeners !== "function" ||
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error class for toolkit errors.
|
|
3
|
+
* Provides error chaining, trace management, and formatted error reporting.
|
|
4
|
+
*/
|
|
5
|
+
export default class Chide extends Sass {
|
|
6
|
+
/**
|
|
7
|
+
* Creates an Chide 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 {Chide} New Chide instance with trace from the original error
|
|
13
|
+
* @throws {Chide} If the first parameter is not an Error instance
|
|
14
|
+
*/
|
|
15
|
+
static from(error: Error, message: string): Chide;
|
|
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|Chide} [error] - Optional existing error to wrap or enhance
|
|
23
|
+
* @returns {Chide} New or enhanced Sass instance
|
|
24
|
+
*/
|
|
25
|
+
static "new"(message: string, error?: Error | Sass | Tantrum | Chide): Chide;
|
|
26
|
+
/**
|
|
27
|
+
* Adds a trace message and returns this instance for chaining.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} message - The trace message to add
|
|
30
|
+
* @returns {this} This Chide instance for method chaining
|
|
31
|
+
*/
|
|
32
|
+
addTrace(message: string): this;
|
|
33
|
+
#private;
|
|
34
|
+
}
|
|
35
|
+
import Sass from "./Sass.js";
|
|
36
|
+
import Tantrum from "./Tantrum.js";
|
|
37
|
+
//# sourceMappingURL=Chide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chide.d.ts","sourceRoot":"","sources":["../../lib/Chide.js"],"names":[],"mappings":"AAkBA;;;GAGG;AACH;IA2GE;;;;;;;;OAQG;IACH,mBALW,KAAK,WACL,MAAM,GACJ,KAAK,CAWjB;IAED;;;;;;;;OAQG;IACH,sBAJW,MAAM,UACN,KAAK,GAAC,IAAI,GAAC,OAAO,GAAC,KAAK,GACtB,KAAK,CAWjB;IA/GD;;;;;OAKG;IACH,kBAHW,MAAM,GACJ,IAAI,CAShB;;CAmGF;iBAzJgB,WAAW;oBAER,cAAc"}
|
package/src/types/lib/Data.d.ts
CHANGED
|
@@ -184,6 +184,23 @@ export default class Data {
|
|
|
184
184
|
* isPlainObject(class Person{}) // false
|
|
185
185
|
*/
|
|
186
186
|
static isPlainObject(value: unknown): boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Checks if a value is binary data.
|
|
189
|
+
* Returns true for ArrayBuffer, TypedArrays (Uint8Array, Int16Array, etc.),
|
|
190
|
+
* Blob, and Node Buffer instances.
|
|
191
|
+
*
|
|
192
|
+
* @param {unknown} value - The value to check
|
|
193
|
+
* @returns {boolean} True if the value is binary data, false otherwise
|
|
194
|
+
* @example
|
|
195
|
+
* Data.isBinary(new Uint8Array([1, 2, 3])) // true
|
|
196
|
+
* Data.isBinary(new ArrayBuffer(10)) // true
|
|
197
|
+
* Data.isBinary(Buffer.from('hello')) // true
|
|
198
|
+
* Data.isBinary(new Blob(['text'])) // true
|
|
199
|
+
* Data.isBinary('string') // false
|
|
200
|
+
* Data.isBinary({}) // false
|
|
201
|
+
* Data.isBinary(undefined) // false
|
|
202
|
+
*/
|
|
203
|
+
static isBinary(value: unknown): boolean;
|
|
187
204
|
}
|
|
188
205
|
import TypeSpec from "./TypeSpec.js";
|
|
189
206
|
//# sourceMappingURL=Data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Data.d.ts","sourceRoot":"","sources":["../../lib/Data.js"],"names":[],"mappings":"AAUA;IACA;;;;;OAKG;IACD,mBAFQ,KAAK,CAA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;;;OAOG;IACH,6BAJW,MAAM,QACN,KAAK,CAAC,MAAM,CAAC,GACX,MAAM,CAiBlB;IAED;;;;;;;OAOG;IACH,2BAJW,MAAM,QACN,KAAK,CAAC,MAAM,CAAC,SACb,OAAO,QAMjB;IAED;;;;;OAKG;IACH,+BAHc,MAAM,EAAA,GACP,MAAM,CAqBlB;IAED;;;;;;;OAOG;IACH,wBAJW,KAAK,CAAC,OAAO,CAAC,aACd,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAClC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAMnC;IAED;;;;;;;OAOG;IACH,kBALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,oBALW,MAAM,OACN,MAAM,OACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,4BAbW,OAAO,GACL,OAAO,CA+BnB;IAED;;;;;;;;;;;;;;;OAeG;IACH,uBAXW,OAAO,GACL,OAAO,CAgBnB;CACF;qBA5aoB,eAAe"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @property {string} supplied - The supplied directory
|
|
6
6
|
* @property {string} path - The resolved path
|
|
7
|
-
* @property {
|
|
7
|
+
* @property {URL} url - The directory URL
|
|
8
8
|
* @property {string} name - The directory name
|
|
9
9
|
* @property {string} module - The directory name without extension
|
|
10
10
|
* @property {string} extension - The directory extension (usually empty)
|
|
@@ -44,11 +44,11 @@ export default class DirectoryObject extends FS {
|
|
|
44
44
|
*/
|
|
45
45
|
get path(): string;
|
|
46
46
|
/**
|
|
47
|
-
* Returns the
|
|
47
|
+
* Returns the URL of the current directory.
|
|
48
48
|
*
|
|
49
|
-
* @returns {
|
|
49
|
+
* @returns {URL} The directory URL
|
|
50
50
|
*/
|
|
51
|
-
get
|
|
51
|
+
get url(): URL;
|
|
52
52
|
/**
|
|
53
53
|
* Returns the directory name with extension (if any) without the path.
|
|
54
54
|
*
|
|
@@ -134,6 +134,22 @@ export default class DirectoryObject extends FS {
|
|
|
134
134
|
* }
|
|
135
135
|
*/
|
|
136
136
|
get walkUp(): object;
|
|
137
|
+
/**
|
|
138
|
+
* Deletes an empty directory from the filesystem.
|
|
139
|
+
*
|
|
140
|
+
* Recursive deletion is intentionally not supported. If you need to delete
|
|
141
|
+
* a directory with contents, you must imperatively decide your deletion
|
|
142
|
+
* strategy and handle it explicitly.
|
|
143
|
+
*
|
|
144
|
+
* @returns {Promise<void>} Resolves when directory is deleted
|
|
145
|
+
* @throws {Sass} If the directory URL is invalid
|
|
146
|
+
* @throws {Sass} If the directory does not exist
|
|
147
|
+
* @throws {Error} If the directory is not empty (from fs.rmdir)
|
|
148
|
+
* @example
|
|
149
|
+
* const dir = new DirectoryObject('./temp/cache')
|
|
150
|
+
* await dir.delete() // Only works if directory is empty
|
|
151
|
+
*/
|
|
152
|
+
delete(): Promise<void>;
|
|
137
153
|
/**
|
|
138
154
|
* Custom inspect method for Node.js console.
|
|
139
155
|
*
|
|
@@ -143,6 +159,7 @@ export default class DirectoryObject extends FS {
|
|
|
143
159
|
#private;
|
|
144
160
|
}
|
|
145
161
|
import FS from "./FS.js";
|
|
162
|
+
import { URL } from "node:url";
|
|
146
163
|
import FileObject from "./FileObject.js";
|
|
147
164
|
import util from "node:util";
|
|
148
165
|
//# 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":"AAeA;;;;;;;;;;;;;GAaG;AACH;IA0BE;;;;OAIG;IACH,uBAFW,MAAM,EAsBhB;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,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,CAcpF;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;IAvPD;;;;OAIG;IACH,yBAFa,MAAM,CAIlB;;CAiPF;eA1Vc,SAAS;oBAFN,UAAU;uBAGL,iBAAiB;iBAJvB,WAAW"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @property {string} supplied - User-supplied path
|
|
6
6
|
* @property {string} path - The absolute file path
|
|
7
|
-
* @property {
|
|
7
|
+
* @property {URL} url - The file URL
|
|
8
8
|
* @property {string} name - The file name
|
|
9
9
|
* @property {string} module - The file name without extension
|
|
10
10
|
* @property {string} extension - The file extension
|
|
@@ -43,23 +43,23 @@ export default class FileObject extends FS {
|
|
|
43
43
|
*/
|
|
44
44
|
get exists(): Promise<boolean>;
|
|
45
45
|
/**
|
|
46
|
-
* Return the
|
|
46
|
+
* Return the normalized path that was provided to the constructor.
|
|
47
47
|
*
|
|
48
|
-
* @returns {string} The file path
|
|
48
|
+
* @returns {string} The sanitized user-supplied file path
|
|
49
49
|
*/
|
|
50
50
|
get supplied(): string;
|
|
51
51
|
/**
|
|
52
|
-
* Return the resolved path
|
|
52
|
+
* Return the fully resolved absolute path to the file on disk.
|
|
53
53
|
*
|
|
54
|
-
* @returns {string} The file path
|
|
54
|
+
* @returns {string} The fully resolved absolute file path
|
|
55
55
|
*/
|
|
56
56
|
get path(): string;
|
|
57
57
|
/**
|
|
58
|
-
* Returns the
|
|
58
|
+
* Returns the URL of the current file.
|
|
59
59
|
*
|
|
60
|
-
* @returns {
|
|
60
|
+
* @returns {URL} The file URL
|
|
61
61
|
*/
|
|
62
|
-
get
|
|
62
|
+
get url(): URL;
|
|
63
63
|
/**
|
|
64
64
|
* Returns the file name with extension (if any) without the path.
|
|
65
65
|
*
|
|
@@ -138,6 +138,19 @@ export default class FileObject extends FS {
|
|
|
138
138
|
* @returns {Promise<string>} The file contents
|
|
139
139
|
*/
|
|
140
140
|
read(encoding?: string): Promise<string>;
|
|
141
|
+
/**
|
|
142
|
+
* Reads binary data from a file asynchronously.
|
|
143
|
+
* Returns the file contents as a Buffer (Node.js binary data type).
|
|
144
|
+
*
|
|
145
|
+
* @returns {Promise<Buffer>} The file contents as a Buffer
|
|
146
|
+
* @throws {Sass} If the file URL is invalid
|
|
147
|
+
* @throws {Sass} If the file does not exist
|
|
148
|
+
* @example
|
|
149
|
+
* const file = new FileObject('./image.png')
|
|
150
|
+
* const buffer = await file.readBinary()
|
|
151
|
+
* // Use the buffer (e.g., send in HTTP response, process image, etc.)
|
|
152
|
+
*/
|
|
153
|
+
readBinary(): Promise<Buffer>;
|
|
141
154
|
/**
|
|
142
155
|
* Writes content to a file asynchronously.
|
|
143
156
|
* Validates that the parent directory exists before writing.
|
|
@@ -145,12 +158,29 @@ export default class FileObject extends FS {
|
|
|
145
158
|
* @param {string} content - The content to write
|
|
146
159
|
* @param {string} [encoding] - The encoding in which to write (default: "utf8")
|
|
147
160
|
* @returns {Promise<void>}
|
|
148
|
-
* @throws {Sass} If the file
|
|
161
|
+
* @throws {Sass} If the file URL is invalid or the parent directory doesn't exist
|
|
149
162
|
* @example
|
|
150
163
|
* const file = new FileObject('./output/data.json')
|
|
151
164
|
* await file.write(JSON.stringify({key: 'value'}))
|
|
152
165
|
*/
|
|
153
166
|
write(content: string, encoding?: string): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Writes binary data to a file asynchronously.
|
|
169
|
+
* Validates that the parent directory exists and that the data is valid binary format.
|
|
170
|
+
* Supports ArrayBuffer, TypedArrays (Uint8Array, etc.), Blob, and Node Buffer types.
|
|
171
|
+
*
|
|
172
|
+
* @param {ArrayBuffer|Blob|Buffer} data - The binary data to write
|
|
173
|
+
* @returns {Promise<void>}
|
|
174
|
+
* @throws {Sass} If the file URL is invalid
|
|
175
|
+
* @throws {Sass} If the parent directory doesn't exist
|
|
176
|
+
* @throws {Sass} If the data is not a valid binary type
|
|
177
|
+
* @example
|
|
178
|
+
* const file = new FileObject('./output/image.png')
|
|
179
|
+
* const response = await fetch('https://example.com/image.png')
|
|
180
|
+
* const buffer = await response.arrayBuffer()
|
|
181
|
+
* await file.writeBinary(buffer)
|
|
182
|
+
*/
|
|
183
|
+
writeBinary(data: ArrayBuffer | Blob | Buffer): Promise<void>;
|
|
154
184
|
/**
|
|
155
185
|
* Loads an object from JSON or YAML file.
|
|
156
186
|
* Attempts to parse content as JSON5 first, then falls back to YAML if specified.
|
|
@@ -173,6 +203,17 @@ export default class FileObject extends FS {
|
|
|
173
203
|
* @returns {Promise<object>} The file contents as a module.
|
|
174
204
|
*/
|
|
175
205
|
import(): Promise<object>;
|
|
206
|
+
/**
|
|
207
|
+
* Deletes the file from the filesystem.
|
|
208
|
+
*
|
|
209
|
+
* @returns {Promise<void>} Resolves when file is deleted
|
|
210
|
+
* @throws {Sass} If the file URL is invalid
|
|
211
|
+
* @throws {Sass} If the file does not exist
|
|
212
|
+
* @example
|
|
213
|
+
* const file = new FileObject('./temp/data.json')
|
|
214
|
+
* await file.delete()
|
|
215
|
+
*/
|
|
216
|
+
delete(): Promise<void>;
|
|
176
217
|
/**
|
|
177
218
|
* Custom inspect method for Node.js console.
|
|
178
219
|
*
|
|
@@ -182,6 +223,7 @@ export default class FileObject extends FS {
|
|
|
182
223
|
#private;
|
|
183
224
|
}
|
|
184
225
|
import FS from "./FS.js";
|
|
226
|
+
import { URL } from "node:url";
|
|
185
227
|
import DirectoryObject from "./DirectoryObject.js";
|
|
186
228
|
import util from "node:util";
|
|
187
229
|
import JSON5 from "json5";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../lib/FileObject.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../lib/FileObject.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;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,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;IA7XD;;;;OAIG;IACH,yBAFa,MAAM,CAIlB;;CAuXF;eAjgBc,SAAS;oBAJN,UAAU;4BAGA,sBAAsB;iBALjC,WAAW;kBAHV,OAAO;iBAIR,MAAM"}
|
|
@@ -86,7 +86,7 @@ export default class TypeSpec {
|
|
|
86
86
|
matches(value: unknown, options: {
|
|
87
87
|
allowEmpty: boolean;
|
|
88
88
|
}): boolean;
|
|
89
|
-
match(value: any, options: any):
|
|
89
|
+
match(value: any, options: any): unknown[];
|
|
90
90
|
#private;
|
|
91
91
|
}
|
|
92
92
|
//# sourceMappingURL=TypeSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSpec.d.ts","sourceRoot":"","sources":["../../lib/TypeSpec.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAGE;;;;;OAKG;IACH,oBAHW,MAAM,WACN,MAAM,EAUhB;IAJC,aAAwB;IACxB,eAAgC;IAChC,6BAA2C;IAI7C;;;;OAIG;IACH,YAFa,MAAM,CAQlB;IAED;;;;OAIG;IACH,UAFa,MAAM,CASlB;IAED;;;;OAIG;IACH,kBAFW,CAAS,IAAO,EAAP,OAAO,KAAG,IAAI,QAIjC;IAED;;;;;OAKG;IACH,gBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,iBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;OAKG;IACH,cAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;;OAMG;IACH,iBAJW,CAAS,IAAO,EAAP,OAAO,EAAE,IAAO,EAAP,OAAO,KAAG,OAAO,gBACnC,OAAO,GACL,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,MAAM,GAAC,SAAS,CAI5B;IAED;;;;;;;;OAQG;IACH,eALW,OAAO,WAEf;QAAyB,UAAU,EAA3B,OAAO;KACf,GAAU,OAAO,CAInB;IAED,
|
|
1
|
+
{"version":3,"file":"TypeSpec.d.ts","sourceRoot":"","sources":["../../lib/TypeSpec.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IAGE;;;;;OAKG;IACH,oBAHW,MAAM,WACN,MAAM,EAUhB;IAJC,aAAwB;IACxB,eAAgC;IAChC,6BAA2C;IAI7C;;;;OAIG;IACH,YAFa,MAAM,CAQlB;IAED;;;;OAIG;IACH,UAFa,MAAM,CASlB;IAED;;;;OAIG;IACH,kBAFW,CAAS,IAAO,EAAP,OAAO,KAAG,IAAI,QAIjC;IAED;;;;;OAKG;IACH,gBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,OAAO,CAInB;IAED;;;;;OAKG;IACH,iBAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;OAKG;IACH,cAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,KAAK,CAAC,OAAO,CAAC,CAI1B;IAED;;;;;;OAMG;IACH,iBAJW,CAAS,IAAO,EAAP,OAAO,EAAE,IAAO,EAAP,OAAO,KAAG,OAAO,gBACnC,OAAO,GACL,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,CAAS,IAAO,EAAP,OAAO,KAAG,OAAO,GACxB,MAAM,GAAC,SAAS,CAI5B;IAED;;;;;;;;OAQG;IACH,eALW,OAAO,WAEf;QAAyB,UAAU,EAA3B,OAAO;KACf,GAAU,OAAO,CAInB;IAED,2CAkDC;;CAiCF"}
|
package/src/types/lib/Util.d.ts
CHANGED
|
@@ -166,13 +166,14 @@ export default class Util {
|
|
|
166
166
|
* Emits an event asynchronously and waits for all listeners to complete.
|
|
167
167
|
* Like asyncEmit, but uses duck typing for more flexible emitter validation.
|
|
168
168
|
* Accepts any object that has the required EventEmitter-like methods.
|
|
169
|
+
* If it walks like an EventEmitter and quacks like an EventEmitter...
|
|
169
170
|
*
|
|
170
171
|
* @param {object} emitter - Any object with EventEmitter-like interface
|
|
171
172
|
* @param {string} event - The event name to emit
|
|
172
173
|
* @param {...unknown} args - Arguments to pass to event listeners
|
|
173
|
-
* @returns {Promise<void>} Resolves when all listeners have completed
|
|
174
|
+
* @returns {Promise<void>} Resolves when all listeners have completed, but no grapes.
|
|
174
175
|
*/
|
|
175
|
-
static
|
|
176
|
+
static asyncEmitQuack(emitter: object, event: string, ...args: unknown[]): Promise<void>;
|
|
176
177
|
/**
|
|
177
178
|
* Determine the Levenshtein distance between two string values
|
|
178
179
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../lib/Util.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACE;;;;;OAKG;IACH,wBAHW,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;;OAMG;IACH,YAJa,CAAC,MACH,MAAM,OAAO,CAAC,CAAC,CAAC,GACd,OAAO,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,CAQ9C;IAED;;;;;;;OAOG;IACH,4BAJW,MAAM,GAAC,MAAM,UACb,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,MAAM,UACb,MAAM,GACJ,MAAM,CAalB;IAED;;;;;OAKG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mCAHW,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAazB;IAED;;;;;;OAMG;IACH,0BAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAInC;IAED;;;;;;OAMG;IACH,2BAHW,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GACrB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAIlC;IAED;;;;;OAKG;IACH,2BAHW,KAAK,CAAC,MAAM,CAAC,GACX,OAAO,CAInB;IAED;;;;;OAKG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