instrumentality 0.0.12 → 0.0.14
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/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -3
- package/dist/dom.d.ts.map +1 -1
- package/dist/dom.js +2 -2
- package/dist/road.d.ts +50 -43
- package/dist/road.d.ts.map +1 -1
- package/dist/road.js +117 -84
- package/package.json +1 -1
- package/src/base.ts +1 -5
- package/src/dom.ts +2 -2
- package/src/road.ts +86 -83
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,wIAAwI;AACxI,qBAAa,GAAI,SAAQ,KAAK;IAAY,IAAI,SAA0B;CAAE;AAC1E,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,CAAA;AAIxB;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUpL;AAID;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAsD;AAIvG;;;;;GAKG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,IACvD,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAGhE;;;;;GAKG;AACH,M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c,CAAA;AAG3C;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAmC1D;AAGD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,2BAgCzC"}
|
package/dist/base.js
CHANGED
|
@@ -100,8 +100,6 @@ export const BASE122_ILLEGAL_INDEX = {
|
|
|
100
100
|
};
|
|
101
101
|
/** Shortened payload marker used when escaping an illegal 7-bit value and no subsequent 7-bit chunk is available (the current chunk is reused as payload). */
|
|
102
102
|
export const BASE122_SHORT = 0b111;
|
|
103
|
-
/** Lazy-initialized TextDecoder instance used for decoding base-122 encoded data. */
|
|
104
|
-
let DECODER;
|
|
105
103
|
/**
|
|
106
104
|
* Encodes indexed data into a base-122 representation.
|
|
107
105
|
*
|
|
@@ -142,7 +140,7 @@ export function encode122(data_) {
|
|
|
142
140
|
out[outIndex++] = 0b10000000 | (payload & 0b00111111);
|
|
143
141
|
}
|
|
144
142
|
}
|
|
145
|
-
return
|
|
143
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(out.subarray(0, outIndex));
|
|
146
144
|
}
|
|
147
145
|
/**
|
|
148
146
|
* Decodes a base-122 encoded string back into its original byte representation.
|
package/dist/dom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../src/dom.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAIzC;AAID;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAKrF;AAGD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAE1F;AAGD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAAE,IAAI,EAAE,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAEhG;AAID;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IAC9C,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAA;CACrC,EAAE,KAAK,SAAM,GAAG,IAAI,CASpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAM,GAAG,IAAI,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMjD"}
|
package/dist/dom.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolves on `DOMContentLoaded` or immediately if the document is already ready.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export function onceReady() {
|
|
5
5
|
if (document.readyState === "complete" || document.readyState === "interactive")
|
|
6
|
-
return;
|
|
6
|
+
return Promise.resolve();
|
|
7
7
|
return new Promise(r => document.addEventListener("DOMContentLoaded", () => r(), { once: true }));
|
|
8
8
|
}
|
|
9
9
|
/**
|
package/dist/road.d.ts
CHANGED
|
@@ -25,18 +25,6 @@ export { resolveStat as resStat };
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function resolveDirent(dirent: fs.Dirent): typeof File | typeof Folder | typeof BlockDevice | typeof CharacterDevice | typeof SymbolicLink | typeof Fifo | typeof Socket;
|
|
27
27
|
export { resolveDirent as resDirent };
|
|
28
|
-
/**
|
|
29
|
-
* Creates the appropriate subclass of {@link Road} based on the file mode of the specified path.
|
|
30
|
-
*
|
|
31
|
-
* @param path_ The path to follow.
|
|
32
|
-
* @returns A new instance of {@link Road}.
|
|
33
|
-
* @throws If {@link fp.lstat}/{@link fs.lstatSync} fails to retrieved the status of {@link path_}.
|
|
34
|
-
*/
|
|
35
|
-
export declare function factory(path_: string): Promise<BlockDevice | CharacterDevice | Fifo | File | Folder | Socket | SymbolicLink>;
|
|
36
|
-
export { factory as fac, factory as mk };
|
|
37
|
-
/** Sync version of {@link factory}. */
|
|
38
|
-
export declare function factorySync(path_: string): BlockDevice | CharacterDevice | Fifo | File | Folder | Socket | SymbolicLink;
|
|
39
|
-
export { factorySync as facSync, factorySync as mkSync };
|
|
40
28
|
/**
|
|
41
29
|
* A map that keeps track of locked roads to prevent concurrent modifications.
|
|
42
30
|
*
|
|
@@ -129,8 +117,8 @@ export declare abstract class Road {
|
|
|
129
117
|
moveSync(into_: Folder): void;
|
|
130
118
|
rename(newName_: string): Promise<void>;
|
|
131
119
|
renameSync(newName_: string): void;
|
|
132
|
-
abstract check(): Promise<boolean>;
|
|
133
|
-
abstract checkSync(): boolean;
|
|
120
|
+
abstract check(throwOnError_: boolean): Promise<boolean>;
|
|
121
|
+
abstract checkSync(throwOnError_: boolean): boolean;
|
|
134
122
|
/** Type narrowing for {@link File} (similar to `instanceof` without unnecessary runtime checks). */
|
|
135
123
|
isFile(): this is File;
|
|
136
124
|
/** Type narrowing for {@link Folder} (similar to `instanceof` without unnecessary runtime checks). */
|
|
@@ -156,6 +144,18 @@ export declare abstract class Road {
|
|
|
156
144
|
}
|
|
157
145
|
/** Constructor type for a subclass of {@link Road}. */
|
|
158
146
|
export type road_t<T extends Road> = new (...args_: ConstructorParameters<typeof Road>) => T;
|
|
147
|
+
/**
|
|
148
|
+
* Creates the appropriate subclass of {@link Road} based on the file mode of the specified path.
|
|
149
|
+
*
|
|
150
|
+
* @param path_ The path to follow.
|
|
151
|
+
* @returns A new instance of {@link Road}.
|
|
152
|
+
* @throws If {@link fp.lstat}/{@link fs.lstatSync} fails to retrieved the status of {@link path_}.
|
|
153
|
+
*/
|
|
154
|
+
export declare function road(path_: string): Promise<BlockDevice | CharacterDevice | Fifo | File | Folder | Socket | SymbolicLink>;
|
|
155
|
+
export { road as fac, road as mk, road as factory };
|
|
156
|
+
/** Sync version of {@link road}. */
|
|
157
|
+
export declare function roadSync(path_: string): BlockDevice | CharacterDevice | Fifo | File | Folder | Socket | SymbolicLink;
|
|
158
|
+
export { roadSync as facSync, roadSync as mkSync, roadSync as factorySync };
|
|
159
159
|
/** Subclass of {@link Road} that represents a file. */
|
|
160
160
|
export declare class File extends Road {
|
|
161
161
|
/**
|
|
@@ -208,13 +208,13 @@ export declare class File extends Road {
|
|
|
208
208
|
truncWritePastSync(offset_: number, data_: Buffer | string): void;
|
|
209
209
|
append(data_: Buffer | string, options_?: fs.WriteFileOptions): Promise<void>;
|
|
210
210
|
appendSync(data_: Buffer | string, options_?: fs.WriteFileOptions): void;
|
|
211
|
-
check(): Promise<boolean>;
|
|
212
|
-
checkSync(): boolean;
|
|
211
|
+
check(throwOnError_: boolean): Promise<boolean>;
|
|
212
|
+
checkSync(throwOnError_: boolean): boolean;
|
|
213
213
|
isFile(): this is File;
|
|
214
214
|
}
|
|
215
215
|
export declare function file(...args: ConstructorParameters<typeof File>): File;
|
|
216
216
|
/** Helper type for filtering {@link Road} instances. */
|
|
217
|
-
export type filter_t<T extends Road> = ((
|
|
217
|
+
export type filter_t<T extends Road> = ((found: Road) => found is T);
|
|
218
218
|
export declare class Folder extends Road {
|
|
219
219
|
static create(at_: string): Promise<Folder>;
|
|
220
220
|
static readonly mk: typeof Folder.create;
|
|
@@ -236,9 +236,9 @@ export declare class Folder extends Road {
|
|
|
236
236
|
walkSync<T extends Road>(filter_: filter_t<T>): Iterable<T>;
|
|
237
237
|
walkSync(filter_: (r: Road) => boolean): Iterable<Road>;
|
|
238
238
|
find(name_: string): Promise<Road | null>;
|
|
239
|
-
find<T extends Road>(name_: string,
|
|
239
|
+
find<T extends Road>(name_: string, filter_: filter_t<T>): Promise<T | null>;
|
|
240
240
|
findSync(name_: string): Road | null;
|
|
241
|
-
findSync<T extends Road>(name_: string,
|
|
241
|
+
findSync<T extends Road>(name_: string, filter_: filter_t<T>): T | null;
|
|
242
242
|
add<T extends Road>(name_: string, createable_: {
|
|
243
243
|
mk: (at: string) => Promise<T>;
|
|
244
244
|
}): Promise<T>;
|
|
@@ -253,19 +253,20 @@ export declare class Folder extends Road {
|
|
|
253
253
|
}, cb_: (r: T) => void): void;
|
|
254
254
|
size(): Promise<number>;
|
|
255
255
|
sizeSync(): number;
|
|
256
|
-
check(): Promise<boolean>;
|
|
257
|
-
checkSync(): boolean;
|
|
256
|
+
check(throwOnError_: boolean): Promise<boolean>;
|
|
257
|
+
checkSync(throwOnError_: boolean): boolean;
|
|
258
258
|
isFolder(): this is Folder;
|
|
259
259
|
isDir(): this is Folder;
|
|
260
260
|
isDirectory(): this is Folder;
|
|
261
261
|
}
|
|
262
262
|
export declare function folder(...args: ConstructorParameters<typeof Folder>): Folder;
|
|
263
263
|
export declare function dir(...args: ConstructorParameters<typeof Folder>): Folder;
|
|
264
|
+
export declare function directory(...args: ConstructorParameters<typeof Folder>): Folder;
|
|
264
265
|
export declare function sysRoot(): Folder;
|
|
265
266
|
export declare function home(): Folder;
|
|
266
267
|
export declare function tmp(): Folder;
|
|
267
268
|
export declare function here(): Folder;
|
|
268
|
-
export { Folder as Dir, Folder as Directory
|
|
269
|
+
export { Folder as Dir, Folder as Directory };
|
|
269
270
|
export declare class SymbolicLink extends Road {
|
|
270
271
|
static create(at_: string, target_: string | Road): Promise<SymbolicLink>;
|
|
271
272
|
static readonly mk: typeof SymbolicLink.create;
|
|
@@ -279,61 +280,67 @@ export declare class SymbolicLink extends Road {
|
|
|
279
280
|
sizeSync(): number;
|
|
280
281
|
delete(): Promise<void>;
|
|
281
282
|
deleteSync(): void;
|
|
282
|
-
check(): Promise<boolean>;
|
|
283
|
-
checkSync(): boolean;
|
|
283
|
+
check(throwOnError_: boolean): Promise<boolean>;
|
|
284
|
+
checkSync(throwOnError_: boolean): boolean;
|
|
284
285
|
isSymlink(): this is SymbolicLink;
|
|
285
286
|
isSymbolicLink(): this is SymbolicLink;
|
|
286
287
|
}
|
|
287
288
|
export { SymbolicLink as Symlink };
|
|
288
289
|
export declare function symlink(...args: ConstructorParameters<typeof SymbolicLink>): SymbolicLink;
|
|
290
|
+
/**
|
|
291
|
+
* Represents a system-level resource that is not subject to modification.
|
|
292
|
+
* All modification operations will throw an error.
|
|
293
|
+
*
|
|
294
|
+
* One could say 'this road truly is *unusable*.' hehe
|
|
295
|
+
*/
|
|
289
296
|
export declare abstract class UnusableRoad extends Road {
|
|
290
|
-
readonly mutable:
|
|
297
|
+
readonly mutable: never;
|
|
291
298
|
size(): Promise<0>;
|
|
292
299
|
sizeSync(): 0;
|
|
293
300
|
error(): never;
|
|
294
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be locked */
|
|
301
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be locked */
|
|
295
302
|
lock(): never;
|
|
296
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be locked */
|
|
303
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be locked */
|
|
297
304
|
lockSync(): never;
|
|
298
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be deleted */
|
|
305
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be deleted */
|
|
299
306
|
delete(): never;
|
|
300
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be deleted */
|
|
307
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be deleted */
|
|
301
308
|
deleteSync(): never;
|
|
302
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be moved */
|
|
309
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be moved */
|
|
303
310
|
move(): never;
|
|
304
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be moved */
|
|
311
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be moved */
|
|
305
312
|
moveSync(): never;
|
|
306
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be copied */
|
|
313
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be copied */
|
|
307
314
|
copy(): never;
|
|
308
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be copied */
|
|
315
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be copied */
|
|
309
316
|
copySync(): never;
|
|
310
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be renamed */
|
|
317
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be renamed */
|
|
311
318
|
rename(): never;
|
|
312
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be renamed */
|
|
319
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be renamed */
|
|
313
320
|
renameSync(): never;
|
|
314
321
|
isUnusable(): this is UnusableRoad;
|
|
315
322
|
}
|
|
316
323
|
export declare class BlockDevice extends UnusableRoad {
|
|
317
|
-
check(): Promise<boolean>;
|
|
318
|
-
checkSync(): boolean;
|
|
324
|
+
check(throwOnError_: boolean): Promise<boolean>;
|
|
325
|
+
checkSync(throwOnError_: boolean): boolean;
|
|
319
326
|
isBlockDevice(): this is BlockDevice;
|
|
320
327
|
}
|
|
321
328
|
export declare function blockDevice(...args: ConstructorParameters<typeof BlockDevice>): BlockDevice;
|
|
322
329
|
export declare class CharacterDevice extends UnusableRoad {
|
|
323
|
-
check(): Promise<boolean>;
|
|
324
|
-
checkSync(): boolean;
|
|
330
|
+
check(throwOnError_: boolean): Promise<boolean>;
|
|
331
|
+
checkSync(throwOnError_: boolean): boolean;
|
|
325
332
|
isCharacterDevice(): this is CharacterDevice;
|
|
326
333
|
}
|
|
327
334
|
export declare function characterDevice(...args: ConstructorParameters<typeof CharacterDevice>): CharacterDevice;
|
|
328
335
|
export declare class Fifo extends UnusableRoad {
|
|
329
|
-
check(): Promise<boolean>;
|
|
330
|
-
checkSync(): boolean;
|
|
336
|
+
check(throwOnError_: boolean): Promise<boolean>;
|
|
337
|
+
checkSync(throwOnError_: boolean): boolean;
|
|
331
338
|
isFifo(): this is Fifo;
|
|
332
339
|
}
|
|
333
340
|
export declare function fifo(...args: ConstructorParameters<typeof Fifo>): Fifo;
|
|
334
341
|
export declare class Socket extends UnusableRoad {
|
|
335
|
-
check(): Promise<boolean>;
|
|
336
|
-
checkSync(): boolean;
|
|
342
|
+
check(throwOnError_: boolean): Promise<boolean>;
|
|
343
|
+
checkSync(throwOnError_: boolean): boolean;
|
|
337
344
|
isSocket(): this is Socket;
|
|
338
345
|
}
|
|
339
346
|
export declare function socket(...args: ConstructorParameters<typeof Socket>): Socket;
|
package/dist/road.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"road.d.ts","sourceRoot":"","sources":["../src/road.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAItC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAIlC,0GAA0G;AAC1G,qBAAa,GAAI,SAAQ,MAAM;IAAY,IAAI,SAA+B;CAAE;AAChF,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,GAAG,IAAI,KAAK,EAAE,CAAA;AAIzC;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,IAAI,GAAG,O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name}`);
|
|
58
58
|
}
|
|
59
59
|
export { resolveDirent as resDirent };
|
|
60
|
-
/**
|
|
61
|
-
* Creates the appropriate subclass of {@link Road} based on the file mode of the specified path.
|
|
62
|
-
*
|
|
63
|
-
* @param path_ The path to follow.
|
|
64
|
-
* @returns A new instance of {@link Road}.
|
|
65
|
-
* @throws If {@link fp.lstat}/{@link fs.lstatSync} fails to retrieved the status of {@link path_}.
|
|
66
|
-
*/
|
|
67
|
-
export async function factory(path_) {
|
|
68
|
-
return new (resolveStat((await fp.lstat(path_)).mode))(path_, false);
|
|
69
|
-
}
|
|
70
|
-
export { factory as fac, factory as mk };
|
|
71
|
-
/** Sync version of {@link factory}. */
|
|
72
|
-
export function factorySync(path_) {
|
|
73
|
-
return new (resolveStat(fs.lstatSync(path_).mode))(path_, false);
|
|
74
|
-
}
|
|
75
|
-
export { factorySync as facSync, factorySync as mkSync };
|
|
76
60
|
/**
|
|
77
61
|
* A map that keeps track of locked roads to prevent concurrent modifications.
|
|
78
62
|
*
|
|
@@ -116,7 +100,7 @@ export class Road {
|
|
|
116
100
|
*/
|
|
117
101
|
constructor(path_, typeCheck_) {
|
|
118
102
|
this.pointsTo = ph.resolve(path_);
|
|
119
|
-
if (typeCheck_ && !this.checkSync())
|
|
103
|
+
if (typeCheck_ && !this.checkSync(true))
|
|
120
104
|
throw new Err(`Type mismatch: '${this.isAt}'`);
|
|
121
105
|
}
|
|
122
106
|
/** @returns An instance of {@link Folder} representing the parent directory of the current road. */
|
|
@@ -161,7 +145,9 @@ export class Road {
|
|
|
161
145
|
try {
|
|
162
146
|
await l.previous;
|
|
163
147
|
}
|
|
164
|
-
catch {
|
|
148
|
+
catch {
|
|
149
|
+
null;
|
|
150
|
+
}
|
|
165
151
|
return l;
|
|
166
152
|
}
|
|
167
153
|
lockSync() {
|
|
@@ -180,7 +166,7 @@ export class Road {
|
|
|
180
166
|
async untilAccessible(abs, expectMode = fsc.F_OK, cb_) {
|
|
181
167
|
const watcher = fs.watch(this.isAt);
|
|
182
168
|
try {
|
|
183
|
-
for await (
|
|
169
|
+
for await (const _ of on(watcher, 'change', { signal: abs })) {
|
|
184
170
|
try {
|
|
185
171
|
await fp.access(this.isAt, expectMode);
|
|
186
172
|
return;
|
|
@@ -207,7 +193,7 @@ export class Road {
|
|
|
207
193
|
async onChange(abs_, cb_) {
|
|
208
194
|
const watcher = fs.watch(this.isAt);
|
|
209
195
|
try {
|
|
210
|
-
for await (
|
|
196
|
+
for await (const _ of on(watcher, 'change', { signal: abs_ }))
|
|
211
197
|
return await cb_?.() ?? null;
|
|
212
198
|
return null;
|
|
213
199
|
}
|
|
@@ -289,6 +275,18 @@ export class Road {
|
|
|
289
275
|
/** Type narrowing for {@link Socket} (similar to `instanceof` without unnecessary runtime checks). */
|
|
290
276
|
isSocket() { return false; }
|
|
291
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Creates the appropriate subclass of {@link Road} based on the file mode of the specified path.
|
|
280
|
+
*
|
|
281
|
+
* @param path_ The path to follow.
|
|
282
|
+
* @returns A new instance of {@link Road}.
|
|
283
|
+
* @throws If {@link fp.lstat}/{@link fs.lstatSync} fails to retrieved the status of {@link path_}.
|
|
284
|
+
*/
|
|
285
|
+
export async function road(path_) { return new (resolveStat((await fp.lstat(path_)).mode))(path_, false); }
|
|
286
|
+
export { road as fac, road as mk, road as factory };
|
|
287
|
+
/** Sync version of {@link road}. */
|
|
288
|
+
export function roadSync(path_) { return new (resolveStat((fs.lstatSync(path_).mode)))(path_, false); }
|
|
289
|
+
export { roadSync as facSync, roadSync as mkSync, roadSync as factorySync };
|
|
292
290
|
/** Subclass of {@link Road} that represents a file. */
|
|
293
291
|
export class File extends Road {
|
|
294
292
|
/**
|
|
@@ -326,7 +324,7 @@ export class File extends Road {
|
|
|
326
324
|
/** The file name without its extension. */
|
|
327
325
|
get noExt() { return ph.basename(this.isAt, this.ext); }
|
|
328
326
|
async read(options_) {
|
|
329
|
-
return fp.readFile(this.isAt, options_);
|
|
327
|
+
return await fp.readFile(this.isAt, options_);
|
|
330
328
|
}
|
|
331
329
|
readSync(options_) {
|
|
332
330
|
return fs.readFileSync(this.isAt, options_);
|
|
@@ -408,11 +406,15 @@ export class File extends Road {
|
|
|
408
406
|
try {
|
|
409
407
|
iter1.return?.(undefined);
|
|
410
408
|
}
|
|
411
|
-
catch {
|
|
409
|
+
catch {
|
|
410
|
+
null;
|
|
411
|
+
}
|
|
412
412
|
try {
|
|
413
413
|
iter2.return?.(undefined);
|
|
414
414
|
}
|
|
415
|
-
catch {
|
|
415
|
+
catch {
|
|
416
|
+
null;
|
|
417
|
+
}
|
|
416
418
|
}
|
|
417
419
|
}
|
|
418
420
|
async hash(algorithm_ = "sha256", options_, encoding_) {
|
|
@@ -507,16 +509,20 @@ export class File extends Road {
|
|
|
507
509
|
using _ = this.lockSync();
|
|
508
510
|
fs.appendFileSync(this.isAt, data_, options_);
|
|
509
511
|
}
|
|
510
|
-
async check() { try {
|
|
512
|
+
async check(throwOnError_) { try {
|
|
511
513
|
return (await fp.lstat(this.isAt)).isFile();
|
|
512
514
|
}
|
|
513
|
-
catch {
|
|
515
|
+
catch (e) {
|
|
516
|
+
if (throwOnError_)
|
|
517
|
+
throw e;
|
|
514
518
|
return false;
|
|
515
519
|
} }
|
|
516
|
-
checkSync() { try {
|
|
520
|
+
checkSync(throwOnError_) { try {
|
|
517
521
|
return fs.lstatSync(this.isAt).isFile();
|
|
518
522
|
}
|
|
519
|
-
catch {
|
|
523
|
+
catch (e) {
|
|
524
|
+
if (throwOnError_)
|
|
525
|
+
throw e;
|
|
520
526
|
return false;
|
|
521
527
|
} }
|
|
522
528
|
isFile() { return true; }
|
|
@@ -584,12 +590,10 @@ export class Folder extends Road {
|
|
|
584
590
|
yield* entry.walkSync(filter_);
|
|
585
591
|
}
|
|
586
592
|
}
|
|
587
|
-
async find(name_,
|
|
593
|
+
async find(name_, filter_) {
|
|
588
594
|
try {
|
|
589
|
-
const found = await
|
|
590
|
-
if (!
|
|
591
|
-
return found;
|
|
592
|
-
if (found instanceof expect_)
|
|
595
|
+
const found = await road(this.join(name_));
|
|
596
|
+
if (!filter_ || filter_(found))
|
|
593
597
|
return found;
|
|
594
598
|
return null;
|
|
595
599
|
}
|
|
@@ -597,45 +601,43 @@ export class Folder extends Road {
|
|
|
597
601
|
return null;
|
|
598
602
|
}
|
|
599
603
|
}
|
|
600
|
-
findSync(name_,
|
|
604
|
+
findSync(name_, filter_) {
|
|
601
605
|
try {
|
|
602
|
-
const found =
|
|
603
|
-
if (!
|
|
604
|
-
return found;
|
|
605
|
-
if (found instanceof expect_)
|
|
606
|
+
const found = roadSync(this.join(name_));
|
|
607
|
+
if (!filter_ || filter_(found))
|
|
606
608
|
return found;
|
|
607
609
|
return null;
|
|
608
610
|
}
|
|
609
|
-
catch
|
|
611
|
+
catch {
|
|
610
612
|
return null;
|
|
611
613
|
}
|
|
612
614
|
}
|
|
613
615
|
async add(name_, createable_) {
|
|
614
616
|
const newPath = this.join(name_);
|
|
615
617
|
await createable_.mk(newPath);
|
|
616
|
-
return (await
|
|
618
|
+
return (await road(newPath));
|
|
617
619
|
}
|
|
618
620
|
addSync(name_, createable_) {
|
|
619
621
|
const newPath = this.join(name_);
|
|
620
622
|
createable_.mkSync(newPath);
|
|
621
|
-
return
|
|
623
|
+
return roadSync(newPath);
|
|
622
624
|
}
|
|
623
625
|
async borrow(createable_, cb_) {
|
|
624
|
-
const
|
|
626
|
+
const created = await createable_.mk(this.join(`instrumentality@${crypto.randomUUID()}`));
|
|
625
627
|
try {
|
|
626
|
-
await cb_(
|
|
628
|
+
await cb_(created);
|
|
627
629
|
}
|
|
628
630
|
finally {
|
|
629
|
-
await fp.rm(
|
|
631
|
+
await fp.rm(created.isAt, { recursive: true, force: true });
|
|
630
632
|
}
|
|
631
633
|
}
|
|
632
634
|
borrowSync(createable_, cb_) {
|
|
633
|
-
const
|
|
635
|
+
const created = createable_.mkSync(this.join(`instrumentality@${crypto.randomUUID()}`));
|
|
634
636
|
try {
|
|
635
|
-
cb_(
|
|
637
|
+
cb_(created);
|
|
636
638
|
}
|
|
637
639
|
finally {
|
|
638
|
-
fs.rmSync(
|
|
640
|
+
fs.rmSync(created.isAt, { recursive: true, force: true });
|
|
639
641
|
}
|
|
640
642
|
}
|
|
641
643
|
async size() {
|
|
@@ -650,16 +652,20 @@ export class Folder extends Road {
|
|
|
650
652
|
size += entry.sizeSync();
|
|
651
653
|
return size;
|
|
652
654
|
}
|
|
653
|
-
async check() { try {
|
|
655
|
+
async check(throwOnError_) { try {
|
|
654
656
|
return (await fp.lstat(this.isAt)).isDirectory();
|
|
655
657
|
}
|
|
656
|
-
catch {
|
|
658
|
+
catch (e) {
|
|
659
|
+
if (throwOnError_)
|
|
660
|
+
throw e;
|
|
657
661
|
return false;
|
|
658
662
|
} }
|
|
659
|
-
checkSync() { try {
|
|
663
|
+
checkSync(throwOnError_) { try {
|
|
660
664
|
return fs.lstatSync(this.isAt).isDirectory();
|
|
661
665
|
}
|
|
662
|
-
catch {
|
|
666
|
+
catch (e) {
|
|
667
|
+
if (throwOnError_)
|
|
668
|
+
throw e;
|
|
663
669
|
return false;
|
|
664
670
|
} }
|
|
665
671
|
isFolder() { return true; }
|
|
@@ -668,11 +674,12 @@ export class Folder extends Road {
|
|
|
668
674
|
}
|
|
669
675
|
export function folder(...args) { return new Folder(...args); }
|
|
670
676
|
export function dir(...args) { return new Folder(...args); }
|
|
677
|
+
export function directory(...args) { return new Folder(...args); }
|
|
671
678
|
export function sysRoot() { return new Folder(ph.parse(process.cwd()).root, false); }
|
|
672
679
|
export function home() { return new Folder(os.homedir(), false); }
|
|
673
680
|
export function tmp() { return new Folder(os.tmpdir(), false); }
|
|
674
681
|
export function here() { return new Folder(process.cwd(), false); }
|
|
675
|
-
export { Folder as Dir, Folder as Directory
|
|
682
|
+
export { Folder as Dir, Folder as Directory };
|
|
676
683
|
export class SymbolicLink extends Road {
|
|
677
684
|
static async create(at_, target_) {
|
|
678
685
|
try {
|
|
@@ -695,10 +702,10 @@ export class SymbolicLink extends Road {
|
|
|
695
702
|
}
|
|
696
703
|
static mkSync = SymbolicLink.createSync;
|
|
697
704
|
async target() {
|
|
698
|
-
return
|
|
705
|
+
return await road(ph.resolve(ph.dirname(this.isAt), await fp.readlink(this.isAt)));
|
|
699
706
|
}
|
|
700
707
|
targetSync() {
|
|
701
|
-
return
|
|
708
|
+
return roadSync(ph.resolve(ph.dirname(this.isAt), fs.readlinkSync(this.isAt)));
|
|
702
709
|
}
|
|
703
710
|
async retarget(to_) {
|
|
704
711
|
using _ = await this.lock();
|
|
@@ -720,16 +727,20 @@ export class SymbolicLink extends Road {
|
|
|
720
727
|
using _ = this.lockSync();
|
|
721
728
|
fs.unlinkSync(this.isAt);
|
|
722
729
|
}
|
|
723
|
-
async check() { try {
|
|
730
|
+
async check(throwOnError_) { try {
|
|
724
731
|
return (await fp.lstat(this.isAt)).isSymbolicLink();
|
|
725
732
|
}
|
|
726
|
-
catch {
|
|
733
|
+
catch (e) {
|
|
734
|
+
if (throwOnError_)
|
|
735
|
+
throw e;
|
|
727
736
|
return false;
|
|
728
737
|
} }
|
|
729
|
-
checkSync() { try {
|
|
738
|
+
checkSync(throwOnError_) { try {
|
|
730
739
|
return fs.lstatSync(this.isAt).isSymbolicLink();
|
|
731
740
|
}
|
|
732
|
-
catch {
|
|
741
|
+
catch (e) {
|
|
742
|
+
if (throwOnError_)
|
|
743
|
+
throw e;
|
|
733
744
|
return false;
|
|
734
745
|
} }
|
|
735
746
|
isSymlink() { return true; }
|
|
@@ -737,92 +748,114 @@ export class SymbolicLink extends Road {
|
|
|
737
748
|
}
|
|
738
749
|
export { SymbolicLink as Symlink };
|
|
739
750
|
export function symlink(...args) { return new SymbolicLink(...args); }
|
|
751
|
+
/**
|
|
752
|
+
* Represents a system-level resource that is not subject to modification.
|
|
753
|
+
* All modification operations will throw an error.
|
|
754
|
+
*
|
|
755
|
+
* One could say 'this road truly is *unusable*.' hehe
|
|
756
|
+
*/
|
|
740
757
|
export class UnusableRoad extends Road {
|
|
741
758
|
mutable = false; // Modification will cause system issues (e.g. deleting a device file)
|
|
742
|
-
|
|
759
|
+
size() { return Promise.resolve(0); }
|
|
743
760
|
sizeSync() { return 0; }
|
|
744
761
|
error() { throw new Err(`${this.constructor.name} at '${this.isAt}' is a system-level resource thus not subject to modification.`); }
|
|
745
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be locked */
|
|
762
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be locked */
|
|
746
763
|
lock() { return this.error(); }
|
|
747
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be locked */
|
|
764
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be locked */
|
|
748
765
|
lockSync() { return this.error(); }
|
|
749
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be deleted */
|
|
766
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be deleted */
|
|
750
767
|
delete() { return this.error(); }
|
|
751
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be deleted */
|
|
768
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be deleted */
|
|
752
769
|
deleteSync() { return this.error(); }
|
|
753
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be moved */
|
|
770
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be moved */
|
|
754
771
|
move() { return this.error(); }
|
|
755
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be moved */
|
|
772
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be moved */
|
|
756
773
|
moveSync() { return this.error(); }
|
|
757
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be copied */
|
|
774
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be copied */
|
|
758
775
|
copy() { return this.error(); }
|
|
759
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be copied */
|
|
776
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be copied */
|
|
760
777
|
copySync() { return this.error(); }
|
|
761
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be renamed */
|
|
778
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be renamed */
|
|
762
779
|
rename() { return this.error(); }
|
|
763
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be renamed */
|
|
780
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be renamed */
|
|
764
781
|
renameSync() { return this.error(); }
|
|
765
782
|
isUnusable() { return true; }
|
|
766
783
|
}
|
|
767
784
|
export class BlockDevice extends UnusableRoad {
|
|
768
|
-
async check() { try {
|
|
785
|
+
async check(throwOnError_) { try {
|
|
769
786
|
return (await fp.lstat(this.isAt)).isBlockDevice();
|
|
770
787
|
}
|
|
771
|
-
catch {
|
|
788
|
+
catch (e) {
|
|
789
|
+
if (throwOnError_)
|
|
790
|
+
throw e;
|
|
772
791
|
return false;
|
|
773
792
|
} }
|
|
774
|
-
checkSync() { try {
|
|
793
|
+
checkSync(throwOnError_) { try {
|
|
775
794
|
return fs.lstatSync(this.isAt).isBlockDevice();
|
|
776
795
|
}
|
|
777
|
-
catch {
|
|
796
|
+
catch (e) {
|
|
797
|
+
if (throwOnError_)
|
|
798
|
+
throw e;
|
|
778
799
|
return false;
|
|
779
800
|
} }
|
|
780
801
|
isBlockDevice() { return true; }
|
|
781
802
|
}
|
|
782
803
|
export function blockDevice(...args) { return new BlockDevice(...args); }
|
|
783
804
|
export class CharacterDevice extends UnusableRoad {
|
|
784
|
-
async check() { try {
|
|
805
|
+
async check(throwOnError_) { try {
|
|
785
806
|
return (await fp.lstat(this.isAt)).isCharacterDevice();
|
|
786
807
|
}
|
|
787
|
-
catch {
|
|
808
|
+
catch (e) {
|
|
809
|
+
if (throwOnError_)
|
|
810
|
+
throw e;
|
|
788
811
|
return false;
|
|
789
812
|
} }
|
|
790
|
-
checkSync() { try {
|
|
813
|
+
checkSync(throwOnError_) { try {
|
|
791
814
|
return fs.lstatSync(this.isAt).isCharacterDevice();
|
|
792
815
|
}
|
|
793
|
-
catch {
|
|
816
|
+
catch (e) {
|
|
817
|
+
if (throwOnError_)
|
|
818
|
+
throw e;
|
|
794
819
|
return false;
|
|
795
820
|
} }
|
|
796
821
|
isCharacterDevice() { return true; }
|
|
797
822
|
}
|
|
798
823
|
export function characterDevice(...args) { return new CharacterDevice(...args); }
|
|
799
824
|
export class Fifo extends UnusableRoad {
|
|
800
|
-
async check() { try {
|
|
825
|
+
async check(throwOnError_) { try {
|
|
801
826
|
return (await fp.lstat(this.isAt)).isFIFO();
|
|
802
827
|
}
|
|
803
|
-
catch {
|
|
828
|
+
catch (e) {
|
|
829
|
+
if (throwOnError_)
|
|
830
|
+
throw e;
|
|
804
831
|
return false;
|
|
805
832
|
} }
|
|
806
|
-
checkSync() { try {
|
|
833
|
+
checkSync(throwOnError_) { try {
|
|
807
834
|
return fs.lstatSync(this.isAt).isFIFO();
|
|
808
835
|
}
|
|
809
|
-
catch {
|
|
836
|
+
catch (e) {
|
|
837
|
+
if (throwOnError_)
|
|
838
|
+
throw e;
|
|
810
839
|
return false;
|
|
811
840
|
} }
|
|
812
841
|
isFifo() { return true; }
|
|
813
842
|
}
|
|
814
843
|
export function fifo(...args) { return new Fifo(...args); }
|
|
815
844
|
export class Socket extends UnusableRoad {
|
|
816
|
-
async check() { try {
|
|
845
|
+
async check(throwOnError_) { try {
|
|
817
846
|
return (await fp.lstat(this.isAt)).isSocket();
|
|
818
847
|
}
|
|
819
|
-
catch {
|
|
848
|
+
catch (e) {
|
|
849
|
+
if (throwOnError_)
|
|
850
|
+
throw e;
|
|
820
851
|
return false;
|
|
821
852
|
} }
|
|
822
|
-
checkSync() { try {
|
|
853
|
+
checkSync(throwOnError_) { try {
|
|
823
854
|
return fs.lstatSync(this.isAt).isSocket();
|
|
824
855
|
}
|
|
825
|
-
catch {
|
|
856
|
+
catch (e) {
|
|
857
|
+
if (throwOnError_)
|
|
858
|
+
throw e;
|
|
826
859
|
return false;
|
|
827
860
|
} }
|
|
828
861
|
isSocket() { return true; }
|
package/package.json
CHANGED
package/src/base.ts
CHANGED
|
@@ -177,10 +177,6 @@ export const BASE122_ILLEGAL_INDEX: Readonly<Record<number, number>> = {
|
|
|
177
177
|
export const BASE122_SHORT = 0b111 as const
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
/** Lazy-initialized TextDecoder instance used for decoding base-122 encoded data. */
|
|
181
|
-
let DECODER: TextDecoder
|
|
182
|
-
|
|
183
|
-
|
|
184
180
|
/**
|
|
185
181
|
* Encodes indexed data into a base-122 representation.
|
|
186
182
|
*
|
|
@@ -223,7 +219,7 @@ export function encode122(data_: ArrayLike<number>): string {
|
|
|
223
219
|
out[outIndex++] = 0b10000000 | (payload & 0b00111111)
|
|
224
220
|
}
|
|
225
221
|
}
|
|
226
|
-
return
|
|
222
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(out.subarray(0, outIndex))
|
|
227
223
|
}
|
|
228
224
|
|
|
229
225
|
|
package/src/dom.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolves on `DOMContentLoaded` or immediately if the document is already ready.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export function onceReady(): Promise<void> {
|
|
5
5
|
if (document.readyState === "complete" || document.readyState === "interactive")
|
|
6
|
-
return
|
|
6
|
+
return Promise.resolve()
|
|
7
7
|
return new Promise(r => document.addEventListener("DOMContentLoaded", () => r(), { once: true }))
|
|
8
8
|
}
|
|
9
9
|
|
package/src/road.ts
CHANGED
|
@@ -57,25 +57,6 @@ export { resolveDirent as resDirent }
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* Creates the appropriate subclass of {@link Road} based on the file mode of the specified path.
|
|
62
|
-
*
|
|
63
|
-
* @param path_ The path to follow.
|
|
64
|
-
* @returns A new instance of {@link Road}.
|
|
65
|
-
* @throws If {@link fp.lstat}/{@link fs.lstatSync} fails to retrieved the status of {@link path_}.
|
|
66
|
-
*/
|
|
67
|
-
export async function factory(path_: string) {
|
|
68
|
-
return new (resolveStat((await fp.lstat(path_)).mode))(path_, false)
|
|
69
|
-
}
|
|
70
|
-
export { factory as fac, factory as mk }
|
|
71
|
-
/** Sync version of {@link factory}. */
|
|
72
|
-
export function factorySync(path_: string) {
|
|
73
|
-
return new (resolveStat(fs.lstatSync(path_).mode))(path_, false)
|
|
74
|
-
}
|
|
75
|
-
export { factorySync as facSync, factorySync as mkSync }
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
60
|
/**
|
|
80
61
|
* A map that keeps track of locked roads to prevent concurrent modifications.
|
|
81
62
|
*
|
|
@@ -124,7 +105,7 @@ export abstract class Road {
|
|
|
124
105
|
*/
|
|
125
106
|
constructor(path_: string, typeCheck_: boolean) {
|
|
126
107
|
this.pointsTo = ph.resolve(path_)
|
|
127
|
-
if (typeCheck_ && !this.checkSync())
|
|
108
|
+
if (typeCheck_ && !this.checkSync(true))
|
|
128
109
|
throw new Err(`Type mismatch: '${this.isAt}'`)
|
|
129
110
|
}
|
|
130
111
|
|
|
@@ -168,7 +149,7 @@ export abstract class Road {
|
|
|
168
149
|
}
|
|
169
150
|
async lock(): Promise<Disposable> {
|
|
170
151
|
const l = this.reserveLock(true)
|
|
171
|
-
try { await l.previous } catch {}
|
|
152
|
+
try { await l.previous } catch { null }
|
|
172
153
|
return l
|
|
173
154
|
}
|
|
174
155
|
lockSync(): Disposable {
|
|
@@ -188,7 +169,7 @@ export abstract class Road {
|
|
|
188
169
|
async untilAccessible(abs: AbortSignal, expectMode = fsc.F_OK, cb_?: (err: unknown) => unknown): Promise<void> {
|
|
189
170
|
const watcher = fs.watch(this.isAt)
|
|
190
171
|
try {
|
|
191
|
-
for await (
|
|
172
|
+
for await (const _ of on(watcher, 'change', { signal: abs })) {
|
|
192
173
|
try {
|
|
193
174
|
await fp.access(this.isAt, expectMode)
|
|
194
175
|
return
|
|
@@ -209,7 +190,7 @@ export abstract class Road {
|
|
|
209
190
|
async onChange<T>(abs_: AbortSignal, cb_?: () => T) {
|
|
210
191
|
const watcher = fs.watch(this.isAt)
|
|
211
192
|
try {
|
|
212
|
-
for await (
|
|
193
|
+
for await (const _ of on(watcher, 'change', { signal: abs_ }))
|
|
213
194
|
return await cb_?.() ?? null
|
|
214
195
|
return null
|
|
215
196
|
}
|
|
@@ -272,8 +253,8 @@ export abstract class Road {
|
|
|
272
253
|
}
|
|
273
254
|
|
|
274
255
|
// jsdocs for the abstract methods are in the subclasses
|
|
275
|
-
abstract check(): Promise<boolean>
|
|
276
|
-
abstract checkSync(): boolean
|
|
256
|
+
abstract check(throwOnError_: boolean): Promise<boolean>
|
|
257
|
+
abstract checkSync(throwOnError_: boolean): boolean
|
|
277
258
|
|
|
278
259
|
/** Type narrowing for {@link File} (similar to `instanceof` without unnecessary runtime checks). */
|
|
279
260
|
isFile(): this is File { return false as const }
|
|
@@ -298,9 +279,30 @@ export abstract class Road {
|
|
|
298
279
|
/** Type narrowing for {@link Socket} (similar to `instanceof` without unnecessary runtime checks). */
|
|
299
280
|
isSocket(): this is Socket { return false as const }
|
|
300
281
|
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
301
285
|
/** Constructor type for a subclass of {@link Road}. */
|
|
302
286
|
export type road_t<T extends Road> = new (...args_: ConstructorParameters<typeof Road>) => T
|
|
303
287
|
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Creates the appropriate subclass of {@link Road} based on the file mode of the specified path.
|
|
294
|
+
*
|
|
295
|
+
* @param path_ The path to follow.
|
|
296
|
+
* @returns A new instance of {@link Road}.
|
|
297
|
+
* @throws If {@link fp.lstat}/{@link fs.lstatSync} fails to retrieved the status of {@link path_}.
|
|
298
|
+
*/
|
|
299
|
+
export async function road(path_: string) { return new (resolveStat((await fp.lstat(path_)).mode))(path_, false) }
|
|
300
|
+
export { road as fac, road as mk, road as factory }
|
|
301
|
+
/** Sync version of {@link road}. */
|
|
302
|
+
export function roadSync(path_: string) { return new (resolveStat((fs.lstatSync(path_).mode)))(path_, false) }
|
|
303
|
+
export { roadSync as facSync, roadSync as mkSync, roadSync as factorySync }
|
|
304
|
+
|
|
305
|
+
|
|
304
306
|
|
|
305
307
|
|
|
306
308
|
/** Subclass of {@link Road} that represents a file. */
|
|
@@ -342,7 +344,7 @@ export class File extends Road {
|
|
|
342
344
|
async read(): Promise<Buffer>
|
|
343
345
|
async read(options_: Parameters<typeof fp.readFile>[1]): Promise<string>
|
|
344
346
|
async read(options_?: Parameters<typeof fp.readFile>[1]): Promise<Buffer | string> {
|
|
345
|
-
return fp.readFile(this.isAt, options_!)
|
|
347
|
+
return await fp.readFile(this.isAt, options_!)
|
|
346
348
|
}
|
|
347
349
|
readSync(): Buffer
|
|
348
350
|
readSync(options_: Parameters<typeof fs.readFileSync>[1]): string
|
|
@@ -406,8 +408,8 @@ export class File extends Road {
|
|
|
406
408
|
}
|
|
407
409
|
}
|
|
408
410
|
finally {
|
|
409
|
-
try { iter1.return?.(undefined) } catch {}
|
|
410
|
-
try { iter2.return?.(undefined) } catch {}
|
|
411
|
+
try { iter1.return?.(undefined) } catch { null }
|
|
412
|
+
try { iter2.return?.(undefined) } catch { null }
|
|
411
413
|
}
|
|
412
414
|
}
|
|
413
415
|
|
|
@@ -501,8 +503,8 @@ export class File extends Road {
|
|
|
501
503
|
fs.appendFileSync(this.isAt, data_, options_)
|
|
502
504
|
}
|
|
503
505
|
|
|
504
|
-
async check(): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isFile() } catch { return false } }
|
|
505
|
-
checkSync(): boolean { try { return fs.lstatSync(this.isAt).isFile() } catch { return false } }
|
|
506
|
+
async check(throwOnError_: boolean): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isFile() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
507
|
+
checkSync(throwOnError_: boolean): boolean { try { return fs.lstatSync(this.isAt).isFile() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
506
508
|
|
|
507
509
|
override isFile(): this is File { return true as const }
|
|
508
510
|
}
|
|
@@ -513,7 +515,8 @@ export function file(...args: ConstructorParameters<typeof File>): File { return
|
|
|
513
515
|
|
|
514
516
|
|
|
515
517
|
/** Helper type for filtering {@link Road} instances. */
|
|
516
|
-
export type filter_t<T extends Road> = ((
|
|
518
|
+
export type filter_t<T extends Road> = ((found: Road) => found is T)
|
|
519
|
+
|
|
517
520
|
|
|
518
521
|
export class Folder extends Road {
|
|
519
522
|
static async create(at_: string) {
|
|
@@ -591,52 +594,46 @@ export class Folder extends Road {
|
|
|
591
594
|
}
|
|
592
595
|
|
|
593
596
|
async find(name_: string): Promise<Road | null>
|
|
594
|
-
async find<T extends Road>(name_: string,
|
|
595
|
-
async find<T extends Road>(name_: string,
|
|
597
|
+
async find<T extends Road>(name_: string, filter_: filter_t<T>): Promise<T | null>
|
|
598
|
+
async find<T extends Road>(name_: string, filter_?: filter_t<T>): Promise<Road | T | null> {
|
|
596
599
|
try {
|
|
597
|
-
const found = await
|
|
598
|
-
if (!
|
|
600
|
+
const found = await road(this.join(name_))
|
|
601
|
+
if (!filter_ || filter_(found))
|
|
599
602
|
return found
|
|
600
|
-
if (found instanceof expect_)
|
|
601
|
-
return found as T
|
|
602
603
|
return null
|
|
603
|
-
}
|
|
604
|
-
catch { return null }
|
|
604
|
+
} catch { return null }
|
|
605
605
|
}
|
|
606
606
|
findSync(name_: string): Road | null
|
|
607
|
-
findSync<T extends Road>(name_: string,
|
|
608
|
-
findSync<T extends Road>(name_: string,
|
|
607
|
+
findSync<T extends Road>(name_: string, filter_: filter_t<T>): T | null
|
|
608
|
+
findSync<T extends Road>(name_: string, filter_?: filter_t<T>): Road | T | null {
|
|
609
609
|
try {
|
|
610
|
-
const found =
|
|
611
|
-
if (!
|
|
610
|
+
const found = roadSync(this.join(name_))
|
|
611
|
+
if (!filter_ || filter_(found))
|
|
612
612
|
return found
|
|
613
|
-
if (found instanceof expect_)
|
|
614
|
-
return found as T
|
|
615
613
|
return null
|
|
616
|
-
}
|
|
617
|
-
catch(e: unknown) { return null }
|
|
614
|
+
} catch { return null }
|
|
618
615
|
}
|
|
619
616
|
|
|
620
617
|
async add<T extends Road>(name_: string, createable_: { mk: (at: string) => Promise<T> }): Promise<T> {
|
|
621
618
|
const newPath = this.join(name_)
|
|
622
619
|
await createable_.mk(newPath)
|
|
623
|
-
return (await
|
|
620
|
+
return (await road(newPath)) as unknown as T
|
|
624
621
|
}
|
|
625
622
|
addSync<T extends Road>(name_: string, createable_: { mkSync: (at: string) => T }): T {
|
|
626
623
|
const newPath = this.join(name_)
|
|
627
624
|
createable_.mkSync(newPath)
|
|
628
|
-
return
|
|
625
|
+
return roadSync(newPath) as unknown as T
|
|
629
626
|
}
|
|
630
627
|
|
|
631
628
|
async borrow<T extends Road>(createable_: { mk: (at: string) => Promise<T> }, cb_: (r: T) => Promise<void> | void): Promise<void> {
|
|
632
|
-
const
|
|
633
|
-
try { await cb_(
|
|
634
|
-
finally { await fp.rm(
|
|
629
|
+
const created = await createable_.mk(this.join(`instrumentality@${crypto.randomUUID()}`))
|
|
630
|
+
try { await cb_(created) }
|
|
631
|
+
finally { await fp.rm(created.isAt, { recursive: true, force: true }) }
|
|
635
632
|
}
|
|
636
633
|
borrowSync<T extends Road>(createable_: { mkSync: (at: string) => T }, cb_: (r: T) => void): void {
|
|
637
|
-
const
|
|
638
|
-
try { cb_(
|
|
639
|
-
finally { fs.rmSync(
|
|
634
|
+
const created = createable_.mkSync(this.join(`instrumentality@${crypto.randomUUID()}`))
|
|
635
|
+
try { cb_(created) }
|
|
636
|
+
finally { fs.rmSync(created.isAt, { recursive: true, force: true }) }
|
|
640
637
|
}
|
|
641
638
|
|
|
642
639
|
async size(): Promise<number> {
|
|
@@ -652,8 +649,8 @@ export class Folder extends Road {
|
|
|
652
649
|
return size
|
|
653
650
|
}
|
|
654
651
|
|
|
655
|
-
async check(): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isDirectory() } catch { return false } }
|
|
656
|
-
checkSync(): boolean { try { return fs.lstatSync(this.isAt).isDirectory() } catch { return false } }
|
|
652
|
+
async check(throwOnError_: boolean): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isDirectory() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
653
|
+
checkSync(throwOnError_: boolean): boolean { try { return fs.lstatSync(this.isAt).isDirectory() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
657
654
|
|
|
658
655
|
override isFolder(): this is Folder { return true as const }
|
|
659
656
|
override isDir(): this is Folder { return true as const }
|
|
@@ -663,13 +660,14 @@ export class Folder extends Road {
|
|
|
663
660
|
|
|
664
661
|
export function folder(...args: ConstructorParameters<typeof Folder>): Folder { return new Folder(...args) }
|
|
665
662
|
export function dir(...args: ConstructorParameters<typeof Folder>): Folder { return new Folder(...args) }
|
|
663
|
+
export function directory(...args: ConstructorParameters<typeof Folder>): Folder { return new Folder(...args) }
|
|
666
664
|
|
|
667
665
|
|
|
668
666
|
export function sysRoot() { return new Folder(ph.parse(process.cwd()).root, false) }
|
|
669
667
|
export function home() { return new Folder(os.homedir(), false) }
|
|
670
668
|
export function tmp() { return new Folder(os.tmpdir(), false) }
|
|
671
669
|
export function here() { return new Folder(process.cwd(), false) }
|
|
672
|
-
export { Folder as Dir, Folder as Directory
|
|
670
|
+
export { Folder as Dir, Folder as Directory }
|
|
673
671
|
|
|
674
672
|
|
|
675
673
|
|
|
@@ -688,10 +686,10 @@ export class SymbolicLink extends Road {
|
|
|
688
686
|
static readonly mkSync: typeof SymbolicLink.createSync = SymbolicLink.createSync
|
|
689
687
|
|
|
690
688
|
async target() {
|
|
691
|
-
return
|
|
689
|
+
return await road(ph.resolve(ph.dirname(this.isAt), await fp.readlink(this.isAt)))
|
|
692
690
|
}
|
|
693
691
|
targetSync() {
|
|
694
|
-
return
|
|
692
|
+
return roadSync(ph.resolve(ph.dirname(this.isAt), fs.readlinkSync(this.isAt)))
|
|
695
693
|
}
|
|
696
694
|
async retarget(to_: Road) {
|
|
697
695
|
using _ = await this.lock()
|
|
@@ -716,8 +714,8 @@ export class SymbolicLink extends Road {
|
|
|
716
714
|
fs.unlinkSync(this.isAt)
|
|
717
715
|
}
|
|
718
716
|
|
|
719
|
-
async check(): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isSymbolicLink() } catch { return false } }
|
|
720
|
-
checkSync(): boolean { try { return fs.lstatSync(this.isAt).isSymbolicLink() } catch { return false } }
|
|
717
|
+
async check(throwOnError_: boolean): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isSymbolicLink() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
718
|
+
checkSync(throwOnError_: boolean): boolean { try { return fs.lstatSync(this.isAt).isSymbolicLink() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
721
719
|
|
|
722
720
|
override isSymlink(): this is SymbolicLink { return true as const }
|
|
723
721
|
override isSymbolicLink(): this is SymbolicLink { return true as const }
|
|
@@ -731,55 +729,60 @@ export function symlink(...args: ConstructorParameters<typeof SymbolicLink>): Sy
|
|
|
731
729
|
|
|
732
730
|
|
|
733
731
|
|
|
732
|
+
/**
|
|
733
|
+
* Represents a system-level resource that is not subject to modification.
|
|
734
|
+
* All modification operations will throw an error.
|
|
735
|
+
*
|
|
736
|
+
* One could say 'this road truly is *unusable*.' hehe
|
|
737
|
+
*/
|
|
734
738
|
export abstract class UnusableRoad extends Road {
|
|
735
|
-
override readonly mutable = false as
|
|
736
|
-
|
|
739
|
+
override readonly mutable: never = false as never // Modification will cause system issues (e.g. deleting a device file)
|
|
740
|
+
size(): Promise<0> { return Promise.resolve(0) }
|
|
737
741
|
sizeSync(): 0 { return 0 }
|
|
738
742
|
error(): never { throw new Err(`${this.constructor.name} at '${this.isAt}' is a system-level resource thus not subject to modification.`) }
|
|
739
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be locked */
|
|
743
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be locked */
|
|
740
744
|
override lock(): never { return this.error() }
|
|
741
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be locked */
|
|
745
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be locked */
|
|
742
746
|
override lockSync(): never { return this.error() }
|
|
743
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be deleted */
|
|
747
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be deleted */
|
|
744
748
|
override delete(): never { return this.error() }
|
|
745
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be deleted */
|
|
749
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be deleted */
|
|
746
750
|
override deleteSync(): never { return this.error() }
|
|
747
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be moved */
|
|
751
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be moved */
|
|
748
752
|
override move(): never { return this.error() }
|
|
749
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be moved */
|
|
753
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be moved */
|
|
750
754
|
override moveSync(): never { return this.error() }
|
|
751
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be copied */
|
|
755
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be copied */
|
|
752
756
|
override copy(): never { return this.error() }
|
|
753
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be copied */
|
|
757
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be copied */
|
|
754
758
|
override copySync(): never { return this.error() }
|
|
755
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be renamed */
|
|
759
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be renamed */
|
|
756
760
|
override rename(): never { return this.error() }
|
|
757
|
-
/** @deprecated System-level resources (UnusableRoad) can't/shouldn't be renamed */
|
|
761
|
+
/** @deprecated System-level resources ({@link UnusableRoad}) can't/shouldn't be renamed */
|
|
758
762
|
override renameSync(): never { return this.error() }
|
|
759
|
-
|
|
760
763
|
override isUnusable(): this is UnusableRoad { return true as const }
|
|
761
764
|
}
|
|
762
765
|
export class BlockDevice extends UnusableRoad {
|
|
763
|
-
async check(): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isBlockDevice() } catch { return false } }
|
|
764
|
-
checkSync(): boolean { try { return fs.lstatSync(this.isAt).isBlockDevice() } catch { return false } }
|
|
766
|
+
async check(throwOnError_: boolean): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isBlockDevice() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
767
|
+
checkSync(throwOnError_: boolean): boolean { try { return fs.lstatSync(this.isAt).isBlockDevice() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
765
768
|
override isBlockDevice(): this is BlockDevice { return true as const }
|
|
766
769
|
}
|
|
767
770
|
export function blockDevice(...args: ConstructorParameters<typeof BlockDevice>): BlockDevice { return new BlockDevice(...args) }
|
|
768
771
|
export class CharacterDevice extends UnusableRoad {
|
|
769
|
-
async check(): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isCharacterDevice() } catch { return false } }
|
|
770
|
-
checkSync(): boolean { try { return fs.lstatSync(this.isAt).isCharacterDevice() } catch { return false } }
|
|
772
|
+
async check(throwOnError_: boolean): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isCharacterDevice() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
773
|
+
checkSync(throwOnError_: boolean): boolean { try { return fs.lstatSync(this.isAt).isCharacterDevice() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
771
774
|
override isCharacterDevice(): this is CharacterDevice { return true as const }
|
|
772
775
|
}
|
|
773
776
|
export function characterDevice(...args: ConstructorParameters<typeof CharacterDevice>): CharacterDevice { return new CharacterDevice(...args) }
|
|
774
777
|
export class Fifo extends UnusableRoad {
|
|
775
|
-
async check(): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isFIFO() } catch { return false } }
|
|
776
|
-
checkSync(): boolean { try { return fs.lstatSync(this.isAt).isFIFO() } catch { return false } }
|
|
778
|
+
async check(throwOnError_: boolean): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isFIFO() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
779
|
+
checkSync(throwOnError_: boolean): boolean { try { return fs.lstatSync(this.isAt).isFIFO() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
777
780
|
override isFifo(): this is Fifo { return true as const }
|
|
778
781
|
}
|
|
779
782
|
export function fifo(...args: ConstructorParameters<typeof Fifo>): Fifo { return new Fifo(...args) }
|
|
780
783
|
export class Socket extends UnusableRoad {
|
|
781
|
-
async check(): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isSocket() } catch { return false } }
|
|
782
|
-
checkSync(): boolean { try { return fs.lstatSync(this.isAt).isSocket() } catch { return false } }
|
|
784
|
+
async check(throwOnError_: boolean): Promise<boolean> { try { return (await fp.lstat(this.isAt)).isSocket() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
785
|
+
checkSync(throwOnError_: boolean): boolean { try { return fs.lstatSync(this.isAt).isSocket() } catch (e) { if (throwOnError_) throw e; return false } }
|
|
783
786
|
override isSocket(): this is Socket { return true as const }
|
|
784
787
|
}
|
|
785
788
|
export function socket(...args: ConstructorParameters<typeof Socket>): Socket { return new Socket(...args) }
|