@gesslar/toolkit 3.36.0 → 3.38.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 +19 -18
- package/src/browser/lib/Data.js +8 -10
- package/src/node/lib/DirectoryObject.js +57 -0
- package/src/node/lib/FileObject.js +55 -0
- package/types/browser/lib/Data.d.ts +2 -1
- package/types/browser/lib/Data.d.ts.map +1 -1
- package/types/node/lib/DirectoryObject.d.ts +32 -0
- package/types/node/lib/DirectoryObject.d.ts.map +1 -1
- package/types/node/lib/FileObject.d.ts +33 -0
- package/types/node/lib/FileObject.d.ts.map +1 -1
- package/types/node/lib/Notify.d.ts +1 -0
- package/types/node/lib/Notify.d.ts.map +1 -1
- package/types/node/lib/Util.d.ts +1 -0
- package/types/node/lib/Util.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "gesslar",
|
|
6
6
|
"url": "https://gesslar.dev"
|
|
7
7
|
},
|
|
8
|
-
"version": "3.
|
|
8
|
+
"version": "3.38.0",
|
|
9
9
|
"license": "Unlicense",
|
|
10
10
|
"homepage": "https://github.com/gesslar/toolkit#readme",
|
|
11
11
|
"repository": {
|
|
@@ -52,6 +52,23 @@
|
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=24.13.0"
|
|
54
54
|
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"preinstall": "node ./scripts/check-node-version.mjs",
|
|
57
|
+
"types": "node -e \"require('fs').rmSync('types',{recursive:true,force:true});\" && tsc -p tsconfig.types.json",
|
|
58
|
+
"prepublishOnly": "npm run types",
|
|
59
|
+
"lint": "eslint src/",
|
|
60
|
+
"lint:fix": "eslint src/ --fix",
|
|
61
|
+
"submit": "npm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
62
|
+
"update": "npx npm-check-updates -u && npm install",
|
|
63
|
+
"test": "node --test tests/**/*.test.js",
|
|
64
|
+
"test:coverage": "node --experimental-config-file=node.config.json --experimental-test-coverage --test-timeout=3000 --test tests/**/*.test.js",
|
|
65
|
+
"test:node": "node --test tests/node/*.test.js",
|
|
66
|
+
"test:browser": "node --test tests/browser/*.test.js",
|
|
67
|
+
"pr": "gt submit -p --ai",
|
|
68
|
+
"patch": "npm version patch",
|
|
69
|
+
"minor": "npm version minor",
|
|
70
|
+
"major": "npm version major"
|
|
71
|
+
},
|
|
55
72
|
"dependencies": {
|
|
56
73
|
"@gesslar/colours": "^0.8.0",
|
|
57
74
|
"ajv": "^8.18.0",
|
|
@@ -64,21 +81,5 @@
|
|
|
64
81
|
"eslint": "^10.0.0",
|
|
65
82
|
"happy-dom": "^20.6.3",
|
|
66
83
|
"typescript": "^5.9.3"
|
|
67
|
-
},
|
|
68
|
-
"scripts": {
|
|
69
|
-
"preinstall": "node ./scripts/check-node-version.mjs",
|
|
70
|
-
"types": "node -e \"require('fs').rmSync('types',{recursive:true,force:true});\" && tsc -p tsconfig.types.json",
|
|
71
|
-
"lint": "eslint src/",
|
|
72
|
-
"lint:fix": "eslint src/ --fix",
|
|
73
|
-
"submit": "pnpm publish --access public --//registry.npmjs.org/:_authToken=\"${NPM_ACCESS_TOKEN}\"",
|
|
74
|
-
"update": "pnpm self-update && pnpx npm-check-updates -u && pnpm install",
|
|
75
|
-
"test": "node --test tests/**/*.test.js",
|
|
76
|
-
"test:coverage": "node --experimental-config-file=node.config.json --experimental-test-coverage --test-timeout=3000 --test tests/**/*.test.js",
|
|
77
|
-
"test:node": "node --test tests/node/*.test.js",
|
|
78
|
-
"test:browser": "node --test tests/browser/*.test.js",
|
|
79
|
-
"pr": "gt submit -p --ai",
|
|
80
|
-
"patch": "pnpm version patch",
|
|
81
|
-
"minor": "pnpm version minor",
|
|
82
|
-
"major": "pnpm version major"
|
|
83
84
|
}
|
|
84
|
-
}
|
|
85
|
+
}
|
package/src/browser/lib/Data.js
CHANGED
|
@@ -250,15 +250,6 @@ export default class Data {
|
|
|
250
250
|
if(!Data.isValidType(type))
|
|
251
251
|
return false
|
|
252
252
|
|
|
253
|
-
// We gotta do classes up front. Ugh.
|
|
254
|
-
if(/^[Cc]lass$/.test(type)) {
|
|
255
|
-
if(typeof value === "function" &&
|
|
256
|
-
value.prototype &&
|
|
257
|
-
value.prototype.constructor === value)
|
|
258
|
-
|
|
259
|
-
return true
|
|
260
|
-
}
|
|
261
|
-
|
|
262
253
|
const valueType = Data.typeOf(value)
|
|
263
254
|
|
|
264
255
|
// Special cases that need extra validation
|
|
@@ -271,7 +262,8 @@ export default class Data {
|
|
|
271
262
|
}
|
|
272
263
|
|
|
273
264
|
/**
|
|
274
|
-
* Returns the type of a value, whether it be a primitive, object, or
|
|
265
|
+
* Returns the type of a value, whether it be a primitive, object, or
|
|
266
|
+
* function.
|
|
275
267
|
*
|
|
276
268
|
* @param {unknown} value - The value to check
|
|
277
269
|
* @returns {string} The type of the value
|
|
@@ -285,6 +277,12 @@ export default class Data {
|
|
|
285
277
|
if(type === "object")
|
|
286
278
|
return value.constructor?.name ?? "Object"
|
|
287
279
|
|
|
280
|
+
if(typeof value === "function"
|
|
281
|
+
&& Object.getOwnPropertyDescriptor(value, "prototype")?.writable === false
|
|
282
|
+
&& /^class[\s{]/.test(Function.prototype.toString.call(value))) {
|
|
283
|
+
return "Class"
|
|
284
|
+
}
|
|
285
|
+
|
|
288
286
|
const [first, ...rest] = Array.from(type)
|
|
289
287
|
|
|
290
288
|
return `${first?.toLocaleUpperCase() ?? ""}${rest.join("")}`
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import {glob, mkdir, opendir, readdir, rmdir, stat} from "node:fs/promises"
|
|
8
8
|
import path, {relative} from "node:path"
|
|
9
9
|
import {URL} from "node:url"
|
|
10
|
+
import {inspect} from "node:util"
|
|
10
11
|
|
|
11
12
|
import Data from "../../browser/lib/Data.js"
|
|
12
13
|
import FileObject from "./FileObject.js"
|
|
@@ -158,6 +159,62 @@ export default class DirectoryObject extends FS {
|
|
|
158
159
|
return `[${this.constructor.name}: ${this.path}]`
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Returns a JSON-serializable representation of the DirectoryObject.
|
|
164
|
+
*
|
|
165
|
+
* @returns {object} Plain object with directory metadata
|
|
166
|
+
*/
|
|
167
|
+
toJSON() {
|
|
168
|
+
return {
|
|
169
|
+
supplied: this.supplied,
|
|
170
|
+
path: this.path,
|
|
171
|
+
name: this.name,
|
|
172
|
+
module: this.module,
|
|
173
|
+
extension: this.extension,
|
|
174
|
+
isDirectory: this.isDirectory,
|
|
175
|
+
parentPath: this.#meta.parentPath,
|
|
176
|
+
sep: this.sep,
|
|
177
|
+
trail: this.trail,
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Custom Node.js inspect implementation for console.log output.
|
|
183
|
+
*
|
|
184
|
+
* @param {number} depth - Inspection depth
|
|
185
|
+
* @param {object} options - Inspect options
|
|
186
|
+
* @param {Function} ins - The inspect function
|
|
187
|
+
* @returns {string} Formatted string representation
|
|
188
|
+
*/
|
|
189
|
+
[inspect.custom](depth, options, ins) {
|
|
190
|
+
return `${this.constructor.name} ${ins(this.toJSON(), options)}`
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Returns the directory path as a primitive value, enabling natural use in
|
|
195
|
+
* string contexts. String and default hints return the directory path; number
|
|
196
|
+
* hint returns NaN.
|
|
197
|
+
*
|
|
198
|
+
* @param {"string"|"number"|"default"} hint - The coercion type hint
|
|
199
|
+
* @returns {string|number} The directory path, or NaN for numeric coercion
|
|
200
|
+
*/
|
|
201
|
+
[Symbol.toPrimitive](hint) {
|
|
202
|
+
if(hint === "number") {
|
|
203
|
+
return NaN
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return this.path
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Returns the directory path as a primitive string value.
|
|
211
|
+
*
|
|
212
|
+
* @returns {string} The directory path
|
|
213
|
+
*/
|
|
214
|
+
valueOf() {
|
|
215
|
+
return this.path
|
|
216
|
+
}
|
|
217
|
+
|
|
161
218
|
/**
|
|
162
219
|
* Checks if the directory exists (async).
|
|
163
220
|
*
|
|
@@ -9,6 +9,7 @@ import fs from "node:fs/promises"
|
|
|
9
9
|
import YAML from "yaml"
|
|
10
10
|
import {URL} from "node:url"
|
|
11
11
|
import {Buffer} from "node:buffer"
|
|
12
|
+
import {inspect} from "node:util"
|
|
12
13
|
|
|
13
14
|
import Data from "../../browser/lib/Data.js"
|
|
14
15
|
import DirectoryObject from "./DirectoryObject.js"
|
|
@@ -147,6 +148,60 @@ export default class FileObject extends FS {
|
|
|
147
148
|
return `[${this.constructor.name}: ${this.path}]`
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Returns a JSON-serializable representation of the FileObject.
|
|
153
|
+
*
|
|
154
|
+
* @returns {object} Plain object with file metadata
|
|
155
|
+
*/
|
|
156
|
+
toJSON() {
|
|
157
|
+
return {
|
|
158
|
+
supplied: this.supplied,
|
|
159
|
+
path: this.path,
|
|
160
|
+
name: this.name,
|
|
161
|
+
module: this.module,
|
|
162
|
+
extension: this.extension,
|
|
163
|
+
isFile: this.isFile,
|
|
164
|
+
parentPath: this.parentPath,
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Custom Node.js inspect implementation for console.log output.
|
|
170
|
+
*
|
|
171
|
+
* @param {number} depth - Inspection depth
|
|
172
|
+
* @param {object} options - Inspect options
|
|
173
|
+
* @param {Function} ins - The inspect function
|
|
174
|
+
* @returns {string} Formatted string representation
|
|
175
|
+
*/
|
|
176
|
+
[inspect.custom](depth, options, ins) {
|
|
177
|
+
return `${this.constructor.name} ${ins(this.toJSON(), options)}`
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Returns the file path as a primitive value, enabling natural use in
|
|
182
|
+
* string contexts. String and default hints return the file path; number
|
|
183
|
+
* hint returns NaN.
|
|
184
|
+
*
|
|
185
|
+
* @param {"string"|"number"|"default"} hint - The coercion type hint
|
|
186
|
+
* @returns {string|number} The file path, or NaN for numeric coercion
|
|
187
|
+
*/
|
|
188
|
+
[Symbol.toPrimitive](hint) {
|
|
189
|
+
if(hint === "number") {
|
|
190
|
+
return NaN
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return this.path
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Returns the file path as a primitive string value.
|
|
198
|
+
*
|
|
199
|
+
* @returns {string} The file path
|
|
200
|
+
*/
|
|
201
|
+
valueOf() {
|
|
202
|
+
return this.path
|
|
203
|
+
}
|
|
204
|
+
|
|
150
205
|
/**
|
|
151
206
|
* Checks if the file exists (async).
|
|
152
207
|
*
|
|
@@ -147,7 +147,8 @@ export default class Data {
|
|
|
147
147
|
*/
|
|
148
148
|
static isBaseType(value: unknown, type: string): boolean;
|
|
149
149
|
/**
|
|
150
|
-
* Returns the type of a value, whether it be a primitive, object, or
|
|
150
|
+
* Returns the type of a value, whether it be a primitive, object, or
|
|
151
|
+
* function.
|
|
151
152
|
*
|
|
152
153
|
* @param {unknown} value - The value to check
|
|
153
154
|
* @returns {string} The type of the value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Data.d.ts","sourceRoot":"","sources":["../../../src/browser/lib/Data.js"],"names":[],"mappings":"AAUA;IACA;;;;;OAKG;IACD,mBAFQ,KAAK,CAAC,MAAM,CAAC,CAgBnB;IAEF;;;;;OAKG;IACH,qBAFU,KAAK,CAAC,MAAM,CAAC,CAmBrB;IAEF;;;;;;;OAOG;IACH,kBAFU,KAAK,CAAC,MAAM,CAAC,CAKrB;IAEF;;;;;OAKG;IACH,uBAFU,KAAK,CAAC,MAAM,CAAC,CAE2D;IAElF;;;;;;OAMG;IACH,sBAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;;OAMG;IACH,uBAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;;;;;;;OAWG;IACH,yBATW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAWlB;IAED;;;;;;;;;;;OAWG;IACH,wBATW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAWlB;IAED;;;;;;;OAOG;IACH,yBALW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAWlB;IAED;;;;;;;OAOG;IACH,0BALW,MAAM,UACN,MAAM,oBACN,OAAO,GACL,MAAM,CAYlB;IAED;;;;;OAKG;IAEH;;;;;OAKG;IAEH;;;;;;;OAOG;IACH,2BAJW,MAAM;;;;oBAdH,MAAM;QAgBP,KAAK,CAAC,MAAM,CAAC,CAIzB;IAED;;;;;;;OAOG;IACH,qBALW,OAAO,QACP,MAAM,GAAC,QAAQ;;;;qBAnBZ,OAAO;QAqBR,OAAO,CAQnB;IAED;;;;;OAKG;IACH,yBAHW,MAAM,GACJ,OAAO,CASnB;IAED;;;;;;;;OAQG;IACH,yBAJW,OAAO,QACP,MAAM,GACJ,OAAO,
|
|
1
|
+
{"version":3,"file":"Data.d.ts","sourceRoot":"","sources":["../../../src/browser/lib/Data.js"],"names":[],"mappings":"AAUA;IACA;;;;;OAKG;IACD,mBAFQ,KAAK,CAAC,MAAM,CAAC,CAgBnB;IAEF;;;;;OAKG;IACH,qBAFU,KAAK,CAAC,MAAM,CAAC,CAmBrB;IAEF;;;;;;;OAOG;IACH,kBAFU,KAAK,CAAC,MAAM,CAAC,CAKrB;IAEF;;;;;OAKG;IACH,uBAFU,KAAK,CAAC,MAAM,CAAC,CAE2D;IAElF;;;;;;OAMG;IACH,sBAJW,MAAM,UACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;;OAMG;IACH,uBAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;;;;;;;;;OAWG;IACH,yBATW,MAAM,U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nC;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;qBA5gBoB,eAAe"}
|
|
@@ -80,6 +80,18 @@ export default class DirectoryObject extends FS {
|
|
|
80
80
|
* @param {string?} [supplied="."] - The directory path (defaults to current directory)
|
|
81
81
|
*/
|
|
82
82
|
constructor(supplied?: string | null);
|
|
83
|
+
/**
|
|
84
|
+
* Returns a JSON-serializable representation of the DirectoryObject.
|
|
85
|
+
*
|
|
86
|
+
* @returns {object} Plain object with directory metadata
|
|
87
|
+
*/
|
|
88
|
+
toJSON(): object;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the directory path as a primitive string value.
|
|
91
|
+
*
|
|
92
|
+
* @returns {string} The directory path
|
|
93
|
+
*/
|
|
94
|
+
valueOf(): string;
|
|
83
95
|
/**
|
|
84
96
|
* Checks if the directory exists (async).
|
|
85
97
|
*
|
|
@@ -322,6 +334,24 @@ export default class DirectoryObject extends FS {
|
|
|
322
334
|
* console.log(escaped.path) // "/projects/git/toolkit/foo/bar.js"
|
|
323
335
|
*/
|
|
324
336
|
getFile(filename: string): FileObject;
|
|
337
|
+
/**
|
|
338
|
+
* Custom Node.js inspect implementation for console.log output.
|
|
339
|
+
*
|
|
340
|
+
* @param {number} depth - Inspection depth
|
|
341
|
+
* @param {object} options - Inspect options
|
|
342
|
+
* @param {Function} ins - The inspect function
|
|
343
|
+
* @returns {string} Formatted string representation
|
|
344
|
+
*/
|
|
345
|
+
[inspect.custom](depth: number, options: object, ins: Function): string;
|
|
346
|
+
/**
|
|
347
|
+
* Returns the directory path as a primitive value, enabling natural use in
|
|
348
|
+
* string contexts. String and default hints return the directory path; number
|
|
349
|
+
* hint returns NaN.
|
|
350
|
+
*
|
|
351
|
+
* @param {"string"|"number"|"default"} hint - The coercion type hint
|
|
352
|
+
* @returns {string|number} The directory path, or NaN for numeric coercion
|
|
353
|
+
*/
|
|
354
|
+
[Symbol.toPrimitive](hint: "string" | "number" | "default"): string | number;
|
|
325
355
|
#private;
|
|
326
356
|
}
|
|
327
357
|
export type GeneratorType = {
|
|
@@ -378,5 +408,7 @@ export type DirectoryMeta = {
|
|
|
378
408
|
url: URL | null;
|
|
379
409
|
};
|
|
380
410
|
import FS from "./FileSystem.js";
|
|
411
|
+
import { URL } from "node:url";
|
|
381
412
|
import FileObject from "./FileObject.js";
|
|
413
|
+
import { inspect } from "node:util";
|
|
382
414
|
//# sourceMappingURL=DirectoryObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/DirectoryObject.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DirectoryObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/DirectoryObject.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IAuDE;;;;;;;;;OASG;IACH,kBALa,eAAe,CAO3B;IA7CD;;;;OAIG;IACH,uBAFW,MAAM,OAAC,EA4BjB;IAyBD;;;;OAIG;IACH,UAFa,MAAM,CAclB;IA8BD;;;;OAIG;IACH,WAFa,MAAM,CAIlB;IAED;;;;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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;;;;OAOG;IACH,2BAHW,QAAQ,GAAC,QAAQ,GAAC,SAAS,GACzB,MAAM,GAAC,MAAM,CAQzB;;CA+eF;;UA1qBa,MAAY;QAAC,KAAK,EAAE,eAAe,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAC;eACnD,MAAY,aAAa;;;;;;iBAMzB,OAAO;;;;eACP,MAAM,GAAC,IAAI;;;;YACX,MAAM,GAAC,IAAI;;;;UACX,MAAM,GAAC,IAAI;;;;YACX,eAAe,GAAC,SAAS;;;;gBACzB,MAAM,GAAC,IAAI;;;;UACX,MAAM,GAAC,IAAI;;;;SACX,MAAM,GAAC,IAAI;;;;cACX,MAAM,GAAC,IAAI;;;;WACX,KAAK,CAAC,MAAM,CAAC,GAAC,IAAI;;;;SAClB,GAAG,GAAC,IAAI;;eAvBP,iBAAiB;oBALd,UAAU;uBAIL,iBAAiB;wBAHlB,WAAW"}
|
|
@@ -42,6 +42,18 @@ export default class FileObject extends FS {
|
|
|
42
42
|
* @param {DirectoryObject|string|null} [parent] - The parent directory (object or string)
|
|
43
43
|
*/
|
|
44
44
|
constructor(submitted: string, parent?: DirectoryObject | string | null);
|
|
45
|
+
/**
|
|
46
|
+
* Returns a JSON-serializable representation of the FileObject.
|
|
47
|
+
*
|
|
48
|
+
* @returns {object} Plain object with file metadata
|
|
49
|
+
*/
|
|
50
|
+
toJSON(): object;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the file path as a primitive string value.
|
|
53
|
+
*
|
|
54
|
+
* @returns {string} The file path
|
|
55
|
+
*/
|
|
56
|
+
valueOf(): string;
|
|
45
57
|
/**
|
|
46
58
|
* Checks if the file exists (async).
|
|
47
59
|
*
|
|
@@ -249,10 +261,31 @@ export default class FileObject extends FS {
|
|
|
249
261
|
* await file.delete()
|
|
250
262
|
*/
|
|
251
263
|
delete(): Promise<void>;
|
|
264
|
+
/**
|
|
265
|
+
* Custom Node.js inspect implementation for console.log output.
|
|
266
|
+
*
|
|
267
|
+
* @param {number} depth - Inspection depth
|
|
268
|
+
* @param {object} options - Inspect options
|
|
269
|
+
* @param {Function} ins - The inspect function
|
|
270
|
+
* @returns {string} Formatted string representation
|
|
271
|
+
*/
|
|
272
|
+
[inspect.custom](depth: number, options: object, ins: Function): string;
|
|
273
|
+
/**
|
|
274
|
+
* Returns the file path as a primitive value, enabling natural use in
|
|
275
|
+
* string contexts. String and default hints return the file path; number
|
|
276
|
+
* hint returns NaN.
|
|
277
|
+
*
|
|
278
|
+
* @param {"string"|"number"|"default"} hint - The coercion type hint
|
|
279
|
+
* @returns {string|number} The file path, or NaN for numeric coercion
|
|
280
|
+
*/
|
|
281
|
+
[Symbol.toPrimitive](hint: "string" | "number" | "default"): string | number;
|
|
252
282
|
#private;
|
|
253
283
|
}
|
|
254
284
|
import FS from "./FileSystem.js";
|
|
285
|
+
import { URL } from "node:url";
|
|
255
286
|
import DirectoryObject from "./DirectoryObject.js";
|
|
287
|
+
import { Buffer } from "node:buffer";
|
|
288
|
+
import { inspect } from "node:util";
|
|
256
289
|
import JSON5 from "json5";
|
|
257
290
|
import YAML from "yaml";
|
|
258
291
|
//# sourceMappingURL=FileObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/FileObject.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileObject.d.ts","sourceRoot":"","sources":["../../../src/node/lib/FileObject.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;GAaG;AAEH;IACE;;;;;OAKG;IACH,yBAFU;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,IAAI,CAAC,CAAA;KAAC,CAO1D;IAskBF;;;;;;;;;;;OAWG;IACH,kBAPa,UAAU,CAsCtB;IAvlBD;;;;;OAKG;IACH,uBAHW,MAAM,WACN,eAAe,GAAC,MAAM,GAAC,IAAI,EA+DrC;IAWD;;;;OAIG;IACH,U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,MAAM,GACJ,OAAO,CAAC,UAAU,CAAC,CAyB/B;IAED;;;;;;;;;;;;;OAaG;IACH,kBATW,MAAM,GACJ,OAAO,CAAC,UAAU,CAAC,CA0C/B;IAED;;;;;;;;;OASG;IACH,UAPa,OAAO,CAAC,IAAI,CAAC,CAczB;IA3cD;;;;;;;OAOG;IACH,wBALW,MAAM,WACN,MAAM,kBAEJ,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,2BAHW,QAAQ,GAAC,QAAQ,GAAC,SAAS,GACzB,MAAM,GAAC,MAAM,CAQzB;;CA+dF;eAjpBc,iBAAiB;oBANd,UAAU;4BAKA,sBAAsB;uBAJ7B,aAAa;wBACZ,WAAW;kBALf,OAAO;iBAER,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notify.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Notify.js"],"names":[],"mappings":"AAWA;;;;GAIG;AAEH;;;GAGG;AACH;IACE,iDAAiD;IACjD,MADW,MAAM,CACF;IAKf;;;;;;OAMG;IACH,WAJW,MAAM,YACN,OAAO,GACL,IAAI,CAMhB;IAED;;;;;;;;OAQG;IACH,gBAJW,MAAM,YACN,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAMzB;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,YACN,OAAO,GACL,OAAO,CAQnB;IAED;;;;;;;;OAQG;IACH,SANW,MAAM,WACN,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,YAC1B,YAAY,YACZ,kBAAkB,GAChB,MAAM,IAAI,CAatB;IAED;;;;;;;OAOG;IACH,UALW,MAAM,WACN,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,YAC1B,YAAY,GACV,IAAI,CAMhB;;CACF;;;;;;;WA9Fa,OAAO;;;;aACP,WAAW"}
|
|
1
|
+
{"version":3,"file":"Notify.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Notify.js"],"names":[],"mappings":"AAWA;;;;GAIG;AAEH;;;GAGG;AACH;IACE,iDAAiD;IACjD,MADW,MAAM,CACF;IAKf;;;;;;OAMG;IACH,WAJW,MAAM,YACN,OAAO,GACL,IAAI,CAMhB;IAED;;;;;;;;OAQG;IACH,gBAJW,MAAM,YACN,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAMzB;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,YACN,OAAO,GACL,OAAO,CAQnB;IAED;;;;;;;;OAQG;IACH,SANW,MAAM,WACN,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,YAC1B,YAAY,YACZ,kBAAkB,GAChB,MAAM,IAAI,CAatB;IAED;;;;;;;OAOG;IACH,UALW,MAAM,WACN,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,YAC1B,YAAY,GACV,IAAI,CAMhB;;CACF;;;;;;;WA9Fa,OAAO;;;;aACP,WAAW;;6BARE,aAAa"}
|
package/types/node/lib/Util.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Util.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACE;;;;;OAKG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mCAHW,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAazB;IAED;;;;;;;;OAQG;IACH,+CALW,MAAM,SACN,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAmBzB;IAED;;;;;;;;;;;;OAYG;IACH,0BALW,YAAY,SACZ,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAgBzB;IAED;;;;;;;;;;OAUG;IACH,+BALW,MAAM,SACN,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAoBzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,kBALW,MAAM,QACN,OAAO,GACL,OAAO,CAmBnB;CACF;wBA1LuB,2BAA2B"}
|
|
1
|
+
{"version":3,"file":"Util.d.ts","sourceRoot":"","sources":["../../../src/node/lib/Util.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACE;;;;;OAKG;IACH,iBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mCAHW,MAAM,GACJ,KAAK,CAAC,MAAM,CAAC,CAazB;IAED;;;;;;;;OAQG;IACH,+CALW,MAAM,SACN,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAmBzB;IAED;;;;;;;;;;;;OAYG;IACH,0BALW,YAAY,SACZ,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAgBzB;IAED;;;;;;;;;;OAUG;IACH,+BALW,MAAM,SACN,MAAM,WACH,OAAO,EAAA,GACR,OAAO,CAAC,IAAI,CAAC,CAoBzB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,kBALW,MAAM,QACN,OAAO,GACL,OAAO,CAmBnB;CACF;wBA1LuB,2BAA2B;6BADxB,aAAa"}
|