@vuetify/cli 0.0.12 → 0.0.13-beta.2

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.
@@ -0,0 +1,1177 @@
1
+ #!/usr/bin/env node
2
+ import { n as __esmMin } from "./chunk-DXKUnWKO.mjs";
3
+ import path from "node:path";
4
+ import fs from "node:fs/promises";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ //#region ../../node_modules/.pnpm/@humanfs+core@0.19.1/node_modules/@humanfs/core/src/hfs.js
8
+ /**
9
+ * Asserts that the given path is a valid file path.
10
+ * @param {any} fileOrDirPath The path to check.
11
+ * @returns {void}
12
+ * @throws {TypeError} When the path is not a non-empty string.
13
+ */
14
+ function assertValidFileOrDirPath(fileOrDirPath) {
15
+ if (!fileOrDirPath || !(fileOrDirPath instanceof URL) && typeof fileOrDirPath !== "string") throw new TypeError("Path must be a non-empty string or URL.");
16
+ }
17
+ /**
18
+ * Asserts that the given file contents are valid.
19
+ * @param {any} contents The contents to check.
20
+ * @returns {void}
21
+ * @throws {TypeError} When the contents are not a string or ArrayBuffer.
22
+ */
23
+ function assertValidFileContents(contents) {
24
+ if (typeof contents !== "string" && !(contents instanceof ArrayBuffer) && !ArrayBuffer.isView(contents)) throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.");
25
+ }
26
+ /**
27
+ * Converts the given contents to Uint8Array.
28
+ * @param {any} contents The data to convert.
29
+ * @returns {Uint8Array} The converted Uint8Array.
30
+ * @throws {TypeError} When the contents are not a string or ArrayBuffer.
31
+ */
32
+ function toUint8Array(contents) {
33
+ if (contents instanceof Uint8Array) return contents;
34
+ if (typeof contents === "string") return encoder.encode(contents);
35
+ if (contents instanceof ArrayBuffer) return new Uint8Array(contents);
36
+ if (ArrayBuffer.isView(contents)) {
37
+ const bytes = contents.buffer.slice(contents.byteOffset, contents.byteOffset + contents.byteLength);
38
+ return new Uint8Array(bytes);
39
+ }
40
+ throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
41
+ }
42
+ var decoder, encoder, NoSuchMethodError, MethodNotSupportedError, ImplAlreadySetError, LogEntry, Hfs;
43
+ var init_hfs = __esmMin((() => {
44
+ decoder = new TextDecoder();
45
+ encoder = new TextEncoder();
46
+ NoSuchMethodError = class extends Error {
47
+ /**
48
+ * Creates a new instance.
49
+ * @param {string} methodName The name of the method that was missing.
50
+ */
51
+ constructor(methodName) {
52
+ super(`Method "${methodName}" does not exist on impl.`);
53
+ }
54
+ };
55
+ MethodNotSupportedError = class extends Error {
56
+ /**
57
+ * Creates a new instance.
58
+ * @param {string} methodName The name of the method that was missing.
59
+ */
60
+ constructor(methodName) {
61
+ super(`Method "${methodName}" is not supported on this impl.`);
62
+ }
63
+ };
64
+ ImplAlreadySetError = class extends Error {
65
+ /**
66
+ * Creates a new instance.
67
+ */
68
+ constructor() {
69
+ super(`Implementation already set.`);
70
+ }
71
+ };
72
+ LogEntry = class {
73
+ /**
74
+ * The type of log entry.
75
+ * @type {string}
76
+ */
77
+ type;
78
+ /**
79
+ * The data associated with the log entry.
80
+ * @type {any}
81
+ */
82
+ data;
83
+ /**
84
+ * The time at which the log entry was created.
85
+ * @type {number}
86
+ */
87
+ timestamp = Date.now();
88
+ /**
89
+ * Creates a new instance.
90
+ * @param {string} type The type of log entry.
91
+ * @param {any} [data] The data associated with the log entry.
92
+ */
93
+ constructor(type, data) {
94
+ this.type = type;
95
+ this.data = data;
96
+ }
97
+ };
98
+ Hfs = class {
99
+ /**
100
+ * The base implementation for this instance.
101
+ * @type {HfsImpl}
102
+ */
103
+ #baseImpl;
104
+ /**
105
+ * The current implementation for this instance.
106
+ * @type {HfsImpl}
107
+ */
108
+ #impl;
109
+ /**
110
+ * A map of log names to their corresponding entries.
111
+ * @type {Map<string,Array<LogEntry>>}
112
+ */
113
+ #logs = /* @__PURE__ */ new Map();
114
+ /**
115
+ * Creates a new instance.
116
+ * @param {object} options The options for the instance.
117
+ * @param {HfsImpl} options.impl The implementation to use.
118
+ */
119
+ constructor({ impl }) {
120
+ this.#baseImpl = impl;
121
+ this.#impl = impl;
122
+ }
123
+ /**
124
+ * Logs an entry onto all currently open logs.
125
+ * @param {string} methodName The name of the method being called.
126
+ * @param {...*} args The arguments to the method.
127
+ * @returns {void}
128
+ */
129
+ #log(methodName, ...args) {
130
+ for (const logs of this.#logs.values()) logs.push(new LogEntry("call", {
131
+ methodName,
132
+ args
133
+ }));
134
+ }
135
+ /**
136
+ * Starts a new log with the given name.
137
+ * @param {string} name The name of the log to start;
138
+ * @returns {void}
139
+ * @throws {Error} When the log already exists.
140
+ * @throws {TypeError} When the name is not a non-empty string.
141
+ */
142
+ logStart(name) {
143
+ if (!name || typeof name !== "string") throw new TypeError("Log name must be a non-empty string.");
144
+ if (this.#logs.has(name)) throw new Error(`Log "${name}" already exists.`);
145
+ this.#logs.set(name, []);
146
+ }
147
+ /**
148
+ * Ends a log with the given name and returns the entries.
149
+ * @param {string} name The name of the log to end.
150
+ * @returns {Array<LogEntry>} The entries in the log.
151
+ * @throws {Error} When the log does not exist.
152
+ */
153
+ logEnd(name) {
154
+ if (this.#logs.has(name)) {
155
+ const logs = this.#logs.get(name);
156
+ this.#logs.delete(name);
157
+ return logs;
158
+ }
159
+ throw new Error(`Log "${name}" does not exist.`);
160
+ }
161
+ /**
162
+ * Determines if the current implementation is the base implementation.
163
+ * @returns {boolean} True if the current implementation is the base implementation.
164
+ */
165
+ isBaseImpl() {
166
+ return this.#impl === this.#baseImpl;
167
+ }
168
+ /**
169
+ * Sets the implementation for this instance.
170
+ * @param {object} impl The implementation to use.
171
+ * @returns {void}
172
+ */
173
+ setImpl(impl) {
174
+ this.#log("implSet", impl);
175
+ if (this.#impl !== this.#baseImpl) throw new ImplAlreadySetError();
176
+ this.#impl = impl;
177
+ }
178
+ /**
179
+ * Resets the implementation for this instance back to its original.
180
+ * @returns {void}
181
+ */
182
+ resetImpl() {
183
+ this.#log("implReset");
184
+ this.#impl = this.#baseImpl;
185
+ }
186
+ /**
187
+ * Asserts that the given method exists on the current implementation.
188
+ * @param {string} methodName The name of the method to check.
189
+ * @returns {void}
190
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
191
+ */
192
+ #assertImplMethod(methodName) {
193
+ if (typeof this.#impl[methodName] !== "function") throw new NoSuchMethodError(methodName);
194
+ }
195
+ /**
196
+ * Asserts that the given method exists on the current implementation, and if not,
197
+ * throws an error with a different method name.
198
+ * @param {string} methodName The name of the method to check.
199
+ * @param {string} targetMethodName The name of the method that should be reported
200
+ * as an error when methodName does not exist.
201
+ * @returns {void}
202
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
203
+ */
204
+ #assertImplMethodAlt(methodName, targetMethodName) {
205
+ if (typeof this.#impl[methodName] !== "function") throw new MethodNotSupportedError(targetMethodName);
206
+ }
207
+ /**
208
+ * Calls the given method on the current implementation.
209
+ * @param {string} methodName The name of the method to call.
210
+ * @param {...any} args The arguments to the method.
211
+ * @returns {any} The return value from the method.
212
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
213
+ */
214
+ #callImplMethod(methodName, ...args) {
215
+ this.#log(methodName, ...args);
216
+ this.#assertImplMethod(methodName);
217
+ return this.#impl[methodName](...args);
218
+ }
219
+ /**
220
+ * Calls the given method on the current implementation and doesn't log the call.
221
+ * @param {string} methodName The name of the method to call.
222
+ * @param {...any} args The arguments to the method.
223
+ * @returns {any} The return value from the method.
224
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
225
+ */
226
+ #callImplMethodWithoutLog(methodName, ...args) {
227
+ this.#assertImplMethod(methodName);
228
+ return this.#impl[methodName](...args);
229
+ }
230
+ /**
231
+ * Calls the given method on the current implementation but logs a different method name.
232
+ * @param {string} methodName The name of the method to call.
233
+ * @param {string} targetMethodName The name of the method to log.
234
+ * @param {...any} args The arguments to the method.
235
+ * @returns {any} The return value from the method.
236
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
237
+ */
238
+ #callImplMethodAlt(methodName, targetMethodName, ...args) {
239
+ this.#log(targetMethodName, ...args);
240
+ this.#assertImplMethodAlt(methodName, targetMethodName);
241
+ return this.#impl[methodName](...args);
242
+ }
243
+ /**
244
+ * Reads the given file and returns the contents as text. Assumes UTF-8 encoding.
245
+ * @param {string|URL} filePath The file to read.
246
+ * @returns {Promise<string|undefined>} The contents of the file.
247
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
248
+ * @throws {TypeError} When the file path is not a non-empty string.
249
+ */
250
+ async text(filePath) {
251
+ assertValidFileOrDirPath(filePath);
252
+ const result = await this.#callImplMethodAlt("bytes", "text", filePath);
253
+ return result ? decoder.decode(result) : void 0;
254
+ }
255
+ /**
256
+ * Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding.
257
+ * @param {string|URL} filePath The file to read.
258
+ * @returns {Promise<any|undefined>} The contents of the file as JSON.
259
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
260
+ * @throws {SyntaxError} When the file contents are not valid JSON.
261
+ * @throws {TypeError} When the file path is not a non-empty string.
262
+ */
263
+ async json(filePath) {
264
+ assertValidFileOrDirPath(filePath);
265
+ const result = await this.#callImplMethodAlt("bytes", "json", filePath);
266
+ return result ? JSON.parse(decoder.decode(result)) : void 0;
267
+ }
268
+ /**
269
+ * Reads the given file and returns the contents as an ArrayBuffer.
270
+ * @param {string|URL} filePath The file to read.
271
+ * @returns {Promise<ArrayBuffer|undefined>} The contents of the file as an ArrayBuffer.
272
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
273
+ * @throws {TypeError} When the file path is not a non-empty string.
274
+ * @deprecated Use bytes() instead.
275
+ */
276
+ async arrayBuffer(filePath) {
277
+ assertValidFileOrDirPath(filePath);
278
+ return (await this.#callImplMethodAlt("bytes", "arrayBuffer", filePath))?.buffer;
279
+ }
280
+ /**
281
+ * Reads the given file and returns the contents as an Uint8Array.
282
+ * @param {string|URL} filePath The file to read.
283
+ * @returns {Promise<Uint8Array|undefined>} The contents of the file as an Uint8Array.
284
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
285
+ * @throws {TypeError} When the file path is not a non-empty string.
286
+ */
287
+ async bytes(filePath) {
288
+ assertValidFileOrDirPath(filePath);
289
+ return this.#callImplMethod("bytes", filePath);
290
+ }
291
+ /**
292
+ * Writes the given data to the given file. Creates any necessary directories along the way.
293
+ * If the data is a string, UTF-8 encoding is used.
294
+ * @param {string|URL} filePath The file to write.
295
+ * @param {string|ArrayBuffer|ArrayBufferView} contents The data to write.
296
+ * @returns {Promise<void>} A promise that resolves when the file is written.
297
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
298
+ * @throws {TypeError} When the file path is not a non-empty string.
299
+ */
300
+ async write(filePath, contents) {
301
+ assertValidFileOrDirPath(filePath);
302
+ assertValidFileContents(contents);
303
+ this.#log("write", filePath, contents);
304
+ let value = toUint8Array(contents);
305
+ return this.#callImplMethodWithoutLog("write", filePath, value);
306
+ }
307
+ /**
308
+ * Appends the given data to the given file. Creates any necessary directories along the way.
309
+ * If the data is a string, UTF-8 encoding is used.
310
+ * @param {string|URL} filePath The file to append to.
311
+ * @param {string|ArrayBuffer|ArrayBufferView} contents The data to append.
312
+ * @returns {Promise<void>} A promise that resolves when the file is appended to.
313
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
314
+ * @throws {TypeError} When the file path is not a non-empty string.
315
+ * @throws {TypeError} When the file contents are not a string or ArrayBuffer.
316
+ * @throws {Error} When the file cannot be appended to.
317
+ */
318
+ async append(filePath, contents) {
319
+ assertValidFileOrDirPath(filePath);
320
+ assertValidFileContents(contents);
321
+ this.#log("append", filePath, contents);
322
+ let value = toUint8Array(contents);
323
+ return this.#callImplMethodWithoutLog("append", filePath, value);
324
+ }
325
+ /**
326
+ * Determines if the given file exists.
327
+ * @param {string|URL} filePath The file to check.
328
+ * @returns {Promise<boolean>} True if the file exists.
329
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
330
+ * @throws {TypeError} When the file path is not a non-empty string.
331
+ */
332
+ async isFile(filePath) {
333
+ assertValidFileOrDirPath(filePath);
334
+ return this.#callImplMethod("isFile", filePath);
335
+ }
336
+ /**
337
+ * Determines if the given directory exists.
338
+ * @param {string|URL} dirPath The directory to check.
339
+ * @returns {Promise<boolean>} True if the directory exists.
340
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
341
+ * @throws {TypeError} When the directory path is not a non-empty string.
342
+ */
343
+ async isDirectory(dirPath) {
344
+ assertValidFileOrDirPath(dirPath);
345
+ return this.#callImplMethod("isDirectory", dirPath);
346
+ }
347
+ /**
348
+ * Creates the given directory.
349
+ * @param {string|URL} dirPath The directory to create.
350
+ * @returns {Promise<void>} A promise that resolves when the directory is created.
351
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
352
+ * @throws {TypeError} When the directory path is not a non-empty string.
353
+ */
354
+ async createDirectory(dirPath) {
355
+ assertValidFileOrDirPath(dirPath);
356
+ return this.#callImplMethod("createDirectory", dirPath);
357
+ }
358
+ /**
359
+ * Deletes the given file or empty directory.
360
+ * @param {string|URL} filePath The file to delete.
361
+ * @returns {Promise<boolean>} A promise that resolves when the file or
362
+ * directory is deleted, true if the file or directory is deleted, false
363
+ * if the file or directory does not exist.
364
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
365
+ * @throws {TypeError} When the file path is not a non-empty string.
366
+ */
367
+ async delete(filePath) {
368
+ assertValidFileOrDirPath(filePath);
369
+ return this.#callImplMethod("delete", filePath);
370
+ }
371
+ /**
372
+ * Deletes the given file or directory recursively.
373
+ * @param {string|URL} dirPath The directory to delete.
374
+ * @returns {Promise<boolean>} A promise that resolves when the file or
375
+ * directory is deleted, true if the file or directory is deleted, false
376
+ * if the file or directory does not exist.
377
+ * @throws {NoSuchMethodError} When the method does not exist on the current implementation.
378
+ * @throws {TypeError} When the directory path is not a non-empty string.
379
+ */
380
+ async deleteAll(dirPath) {
381
+ assertValidFileOrDirPath(dirPath);
382
+ return this.#callImplMethod("deleteAll", dirPath);
383
+ }
384
+ /**
385
+ * Returns a list of directory entries for the given path.
386
+ * @param {string|URL} dirPath The path to the directory to read.
387
+ * @returns {AsyncIterable<HfsDirectoryEntry>} A promise that resolves with the
388
+ * directory entries.
389
+ * @throws {TypeError} If the directory path is not a string or URL.
390
+ * @throws {Error} If the directory cannot be read.
391
+ */
392
+ async *list(dirPath) {
393
+ assertValidFileOrDirPath(dirPath);
394
+ yield* await this.#callImplMethod("list", dirPath);
395
+ }
396
+ /**
397
+ * Walks a directory using a depth-first traversal and returns the entries
398
+ * from the traversal.
399
+ * @param {string|URL} dirPath The path to the directory to walk.
400
+ * @param {Object} [options] The options for the walk.
401
+ * @param {(entry:HfsWalkEntry) => Promise<boolean>|boolean} [options.directoryFilter] A filter function to determine
402
+ * if a directory's entries should be included in the walk.
403
+ * @param {(entry:HfsWalkEntry) => Promise<boolean>|boolean} [options.entryFilter] A filter function to determine if
404
+ * an entry should be included in the walk.
405
+ * @returns {AsyncIterable<HfsWalkEntry>} A promise that resolves with the
406
+ * directory entries.
407
+ * @throws {TypeError} If the directory path is not a string or URL.
408
+ * @throws {Error} If the directory cannot be read.
409
+ */
410
+ async *walk(dirPath, { directoryFilter = () => true, entryFilter = () => true } = {}) {
411
+ assertValidFileOrDirPath(dirPath);
412
+ this.#log("walk", dirPath, {
413
+ directoryFilter,
414
+ entryFilter
415
+ });
416
+ const walk = async function* (dirPath$1, { directoryFilter: directoryFilter$1, entryFilter: entryFilter$1, parentPath = "", depth = 1 }) {
417
+ let dirEntries;
418
+ try {
419
+ dirEntries = await this.#callImplMethodWithoutLog("list", dirPath$1);
420
+ } catch (error) {
421
+ if (error.code === "ENOENT") return;
422
+ throw error;
423
+ }
424
+ for await (const listEntry of dirEntries) {
425
+ const walkEntry = {
426
+ path: listEntry.name,
427
+ depth,
428
+ ...listEntry
429
+ };
430
+ if (parentPath) walkEntry.path = `${parentPath}/${walkEntry.path}`;
431
+ let shouldEmitEntry = entryFilter$1(walkEntry);
432
+ if (shouldEmitEntry.then) shouldEmitEntry = await shouldEmitEntry;
433
+ if (shouldEmitEntry) yield walkEntry;
434
+ if (listEntry.isDirectory) {
435
+ let shouldWalkDirectory = directoryFilter$1(walkEntry);
436
+ if (shouldWalkDirectory.then) shouldWalkDirectory = await shouldWalkDirectory;
437
+ if (!shouldWalkDirectory) continue;
438
+ yield* walk(dirPath$1 instanceof URL ? new URL(listEntry.name, dirPath$1.href.endsWith("/") ? dirPath$1.href : `${dirPath$1.href}/`) : `${dirPath$1.endsWith("/") ? dirPath$1 : `${dirPath$1}/`}${listEntry.name}`, {
439
+ directoryFilter: directoryFilter$1,
440
+ entryFilter: entryFilter$1,
441
+ parentPath: walkEntry.path,
442
+ depth: depth + 1
443
+ });
444
+ }
445
+ }
446
+ }.bind(this);
447
+ yield* walk(dirPath, {
448
+ directoryFilter,
449
+ entryFilter
450
+ });
451
+ }
452
+ /**
453
+ * Returns the size of the given file.
454
+ * @param {string|URL} filePath The path to the file to read.
455
+ * @returns {Promise<number>} A promise that resolves with the size of the file.
456
+ * @throws {TypeError} If the file path is not a string or URL.
457
+ * @throws {Error} If the file cannot be read.
458
+ */
459
+ async size(filePath) {
460
+ assertValidFileOrDirPath(filePath);
461
+ return this.#callImplMethod("size", filePath);
462
+ }
463
+ /**
464
+ * Returns the last modified timestamp of the given file or directory.
465
+ * @param {string|URL} fileOrDirPath The path to the file or directory.
466
+ * @returns {Promise<Date|undefined>} A promise that resolves with the last modified date
467
+ * or undefined if the file or directory does not exist.
468
+ * @throws {TypeError} If the path is not a string or URL.
469
+ */
470
+ async lastModified(fileOrDirPath) {
471
+ assertValidFileOrDirPath(fileOrDirPath);
472
+ return this.#callImplMethod("lastModified", fileOrDirPath);
473
+ }
474
+ /**
475
+ * Copys a file from one location to another.
476
+ * @param {string|URL} source The path to the file to copy.
477
+ * @param {string|URL} destination The path to the new file.
478
+ * @returns {Promise<void>} A promise that resolves when the file is copied.
479
+ * @throws {TypeError} If the file path is not a string or URL.
480
+ * @throws {Error} If the file cannot be copied.
481
+ */
482
+ async copy(source, destination) {
483
+ assertValidFileOrDirPath(source);
484
+ assertValidFileOrDirPath(destination);
485
+ return this.#callImplMethod("copy", source, destination);
486
+ }
487
+ /**
488
+ * Copies a file or directory from one location to another.
489
+ * @param {string|URL} source The path to the file or directory to copy.
490
+ * @param {string|URL} destination The path to copy the file or directory to.
491
+ * @returns {Promise<void>} A promise that resolves when the file or directory is
492
+ * copied.
493
+ * @throws {TypeError} If the directory path is not a string or URL.
494
+ * @throws {Error} If the directory cannot be copied.
495
+ */
496
+ async copyAll(source, destination) {
497
+ assertValidFileOrDirPath(source);
498
+ assertValidFileOrDirPath(destination);
499
+ return this.#callImplMethod("copyAll", source, destination);
500
+ }
501
+ /**
502
+ * Moves a file from the source path to the destination path.
503
+ * @param {string|URL} source The location of the file to move.
504
+ * @param {string|URL} destination The destination of the file to move.
505
+ * @returns {Promise<void>} A promise that resolves when the move is complete.
506
+ * @throws {TypeError} If the file or directory paths are not strings.
507
+ * @throws {Error} If the file or directory cannot be moved.
508
+ */
509
+ async move(source, destination) {
510
+ assertValidFileOrDirPath(source);
511
+ assertValidFileOrDirPath(destination);
512
+ return this.#callImplMethod("move", source, destination);
513
+ }
514
+ /**
515
+ * Moves a file or directory from one location to another.
516
+ * @param {string|URL} source The path to the file or directory to move.
517
+ * @param {string|URL} destination The path to move the file or directory to.
518
+ * @returns {Promise<void>} A promise that resolves when the file or directory is
519
+ * moved.
520
+ * @throws {TypeError} If the source is not a string or URL.
521
+ * @throws {TypeError} If the destination is not a string or URL.
522
+ * @throws {Error} If the file or directory cannot be moved.
523
+ */
524
+ async moveAll(source, destination) {
525
+ assertValidFileOrDirPath(source);
526
+ assertValidFileOrDirPath(destination);
527
+ return this.#callImplMethod("moveAll", source, destination);
528
+ }
529
+ };
530
+ }));
531
+
532
+ //#endregion
533
+ //#region ../../node_modules/.pnpm/@humanfs+core@0.19.1/node_modules/@humanfs/core/src/errors.js
534
+ var init_errors = __esmMin((() => {}));
535
+
536
+ //#endregion
537
+ //#region ../../node_modules/.pnpm/@humanfs+core@0.19.1/node_modules/@humanfs/core/src/index.js
538
+ var init_src$1 = __esmMin((() => {
539
+ init_hfs();
540
+ init_errors();
541
+ }));
542
+
543
+ //#endregion
544
+ //#region ../../node_modules/.pnpm/@humanwhocodes+retry@0.4.3/node_modules/@humanwhocodes/retry/dist/retrier.js
545
+ /**
546
+ * Logs a message to the console if the DEBUG environment variable is set.
547
+ * @param {string} message The message to log.
548
+ * @returns {void}
549
+ */
550
+ function debug(message) {
551
+ if (globalThis?.process?.env.DEBUG === "@hwc/retry") console.debug(message);
552
+ }
553
+ /**
554
+ * Checks if it is time to retry a task based on the timestamp and last attempt time.
555
+ * @param {RetryTask} task The task to check.
556
+ * @param {number} maxDelay The maximum delay for the queue.
557
+ * @returns {boolean} true if it is time to retry, false otherwise.
558
+ */
559
+ function isTimeToRetry(task, maxDelay) {
560
+ const timeSinceLastAttempt = Date.now() - task.lastAttempt;
561
+ const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1);
562
+ return timeSinceLastAttempt >= Math.min(timeSinceStart * 1.2, maxDelay);
563
+ }
564
+ /**
565
+ * Checks if it is time to bail out based on the given timestamp.
566
+ * @param {RetryTask} task The task to check.
567
+ * @param {number} timeout The timeout for the queue.
568
+ * @returns {boolean} true if it is time to bail, false otherwise.
569
+ */
570
+ function isTimeToBail(task, timeout) {
571
+ return task.age > timeout;
572
+ }
573
+ /**
574
+ * Creates a new promise with resolve and reject functions.
575
+ * @returns {{promise:Promise<any>, resolve:(value:any) => any, reject: (value:any) => any}} A new promise.
576
+ */
577
+ function createPromise() {
578
+ if (Promise.withResolvers) return Promise.withResolvers();
579
+ let resolve$1, reject;
580
+ const promise = new Promise((res, rej) => {
581
+ resolve$1 = res;
582
+ reject = rej;
583
+ });
584
+ if (resolve$1 === void 0 || reject === void 0) throw new Error("Promise executor did not initialize resolve or reject.");
585
+ return {
586
+ promise,
587
+ resolve: resolve$1,
588
+ reject
589
+ };
590
+ }
591
+ var MAX_TASK_TIMEOUT, MAX_TASK_DELAY, MAX_CONCURRENCY, RetryTask, Retrier;
592
+ var init_retrier = __esmMin((() => {
593
+ MAX_TASK_TIMEOUT = 6e4;
594
+ MAX_TASK_DELAY = 100;
595
+ MAX_CONCURRENCY = 1e3;
596
+ RetryTask = class {
597
+ /**
598
+ * The unique ID for the task.
599
+ * @type {string}
600
+ */
601
+ id = Math.random().toString(36).slice(2);
602
+ /**
603
+ * The function to call.
604
+ * @type {Function}
605
+ */
606
+ fn;
607
+ /**
608
+ * The error that was thrown.
609
+ * @type {Error}
610
+ */
611
+ error;
612
+ /**
613
+ * The timestamp of the task.
614
+ * @type {number}
615
+ */
616
+ timestamp = Date.now();
617
+ /**
618
+ * The timestamp of the last attempt.
619
+ * @type {number}
620
+ */
621
+ lastAttempt = this.timestamp;
622
+ /**
623
+ * The resolve function for the promise.
624
+ * @type {Function}
625
+ */
626
+ resolve;
627
+ /**
628
+ * The reject function for the promise.
629
+ * @type {Function}
630
+ */
631
+ reject;
632
+ /**
633
+ * The AbortSignal to monitor for cancellation.
634
+ * @type {AbortSignal|undefined}
635
+ */
636
+ signal;
637
+ /**
638
+ * Creates a new instance.
639
+ * @param {Function} fn The function to call.
640
+ * @param {Error} error The error that was thrown.
641
+ * @param {Function} resolve The resolve function for the promise.
642
+ * @param {Function} reject The reject function for the promise.
643
+ * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation.
644
+ */
645
+ constructor(fn, error, resolve$1, reject, signal) {
646
+ this.fn = fn;
647
+ this.error = error;
648
+ this.timestamp = Date.now();
649
+ this.lastAttempt = Date.now();
650
+ this.resolve = resolve$1;
651
+ this.reject = reject;
652
+ this.signal = signal;
653
+ }
654
+ /**
655
+ * Gets the age of the task.
656
+ * @returns {number} The age of the task in milliseconds.
657
+ * @readonly
658
+ */
659
+ get age() {
660
+ return Date.now() - this.timestamp;
661
+ }
662
+ };
663
+ Retrier = class {
664
+ /**
665
+ * Represents the queue for processing tasks.
666
+ * @type {Array<RetryTask>}
667
+ */
668
+ #retrying = [];
669
+ /**
670
+ * Represents the queue for pending tasks.
671
+ * @type {Array<Function>}
672
+ */
673
+ #pending = [];
674
+ /**
675
+ * The number of tasks currently being processed.
676
+ * @type {number}
677
+ */
678
+ #working = 0;
679
+ /**
680
+ * The timeout for the queue.
681
+ * @type {number}
682
+ */
683
+ #timeout;
684
+ /**
685
+ * The maximum delay for the queue.
686
+ * @type {number}
687
+ */
688
+ #maxDelay;
689
+ /**
690
+ * The setTimeout() timer ID.
691
+ * @type {NodeJS.Timeout|undefined}
692
+ */
693
+ #timerId;
694
+ /**
695
+ * The function to call.
696
+ * @type {Function}
697
+ */
698
+ #check;
699
+ /**
700
+ * The maximum number of concurrent tasks.
701
+ * @type {number}
702
+ */
703
+ #concurrency;
704
+ /**
705
+ * Creates a new instance.
706
+ * @param {Function} check The function to call.
707
+ * @param {object} [options] The options for the instance.
708
+ * @param {number} [options.timeout] The timeout for the queue.
709
+ * @param {number} [options.maxDelay] The maximum delay for the queue.
710
+ * @param {number} [options.concurrency] The maximum number of concurrent tasks.
711
+ */
712
+ constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY, concurrency = MAX_CONCURRENCY } = {}) {
713
+ if (typeof check !== "function") throw new Error("Missing function to check errors");
714
+ this.#check = check;
715
+ this.#timeout = timeout;
716
+ this.#maxDelay = maxDelay;
717
+ this.#concurrency = concurrency;
718
+ }
719
+ /**
720
+ * Gets the number of tasks waiting to be retried.
721
+ * @returns {number} The number of tasks in the retry queue.
722
+ */
723
+ get retrying() {
724
+ return this.#retrying.length;
725
+ }
726
+ /**
727
+ * Gets the number of tasks waiting to be processed in the pending queue.
728
+ * @returns {number} The number of tasks in the pending queue.
729
+ */
730
+ get pending() {
731
+ return this.#pending.length;
732
+ }
733
+ /**
734
+ * Gets the number of tasks currently being processed.
735
+ * @returns {number} The number of tasks currently being processed.
736
+ */
737
+ get working() {
738
+ return this.#working;
739
+ }
740
+ /**
741
+ * Calls the function and retries if it fails.
742
+ * @param {Function} fn The function to call.
743
+ * @param {Object} options The options for the job.
744
+ * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation.
745
+ * @param {Promise<any>} options.promise The promise to return when the function settles.
746
+ * @param {Function} options.resolve The resolve function for the promise.
747
+ * @param {Function} options.reject The reject function for the promise.
748
+ * @returns {Promise<any>} A promise that resolves when the function is
749
+ * called successfully.
750
+ */
751
+ #call(fn, { signal, promise, resolve: resolve$1, reject }) {
752
+ let result;
753
+ try {
754
+ result = fn();
755
+ } catch (error) {
756
+ reject(new Error(`Synchronous error: ${error.message}`, { cause: error }));
757
+ return promise;
758
+ }
759
+ if (!result || typeof result.then !== "function") {
760
+ reject(/* @__PURE__ */ new Error("Result is not a promise."));
761
+ return promise;
762
+ }
763
+ this.#working++;
764
+ promise.finally(() => {
765
+ this.#working--;
766
+ this.#processPending();
767
+ }).catch(() => {});
768
+ Promise.resolve(result).then((value) => {
769
+ debug("Function called successfully without retry.");
770
+ resolve$1(value);
771
+ }).catch((error) => {
772
+ if (!this.#check(error)) {
773
+ reject(error);
774
+ return;
775
+ }
776
+ const task = new RetryTask(fn, error, resolve$1, reject, signal);
777
+ debug(`Function failed, queuing for retry with task ${task.id}.`);
778
+ this.#retrying.push(task);
779
+ signal?.addEventListener("abort", () => {
780
+ debug(`Task ${task.id} was aborted due to AbortSignal.`);
781
+ reject(signal.reason);
782
+ });
783
+ this.#processQueue();
784
+ });
785
+ return promise;
786
+ }
787
+ /**
788
+ * Adds a new retry job to the queue.
789
+ * @template {(...args: unknown[]) => Promise<unknown>} Func
790
+ * @template {Awaited<ReturnType<Func>>} RetVal
791
+ * @param {Func} fn The function to call.
792
+ * @param {object} [options] The options for the job.
793
+ * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation.
794
+ * @returns {Promise<RetVal>} A promise that resolves when the queue is processed.
795
+ */
796
+ retry(fn, { signal } = {}) {
797
+ signal?.throwIfAborted();
798
+ const { promise, resolve: resolve$1, reject } = createPromise();
799
+ this.#pending.push(() => this.#call(fn, {
800
+ signal,
801
+ promise,
802
+ resolve: resolve$1,
803
+ reject
804
+ }));
805
+ this.#processPending();
806
+ return promise;
807
+ }
808
+ /**
809
+ * Processes the pending queue and the retry queue.
810
+ * @returns {void}
811
+ */
812
+ #processAll() {
813
+ if (this.pending) this.#processPending();
814
+ if (this.retrying) this.#processQueue();
815
+ }
816
+ /**
817
+ * Processes the pending queue to see which tasks can be started.
818
+ * @returns {void}
819
+ */
820
+ #processPending() {
821
+ debug(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`);
822
+ const available = this.#concurrency - this.working;
823
+ if (available <= 0) return;
824
+ const count = Math.min(this.pending, available);
825
+ for (let i = 0; i < count; i++) this.#pending.shift()?.();
826
+ debug(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`);
827
+ }
828
+ /**
829
+ * Processes the queue.
830
+ * @returns {void}
831
+ */
832
+ #processQueue() {
833
+ clearTimeout(this.#timerId);
834
+ this.#timerId = void 0;
835
+ debug(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`);
836
+ const processAgain = () => {
837
+ this.#timerId = setTimeout(() => this.#processAll(), 0);
838
+ };
839
+ const task = this.#retrying.shift();
840
+ if (!task) {
841
+ debug("Queue is empty, exiting.");
842
+ if (this.pending) processAgain();
843
+ return;
844
+ }
845
+ if (isTimeToBail(task, this.#timeout)) {
846
+ debug(`Task ${task.id} was abandoned due to timeout.`);
847
+ task.reject(task.error);
848
+ processAgain();
849
+ return;
850
+ }
851
+ if (!isTimeToRetry(task, this.#maxDelay)) {
852
+ debug(`Task ${task.id} is not ready to retry, skipping.`);
853
+ this.#retrying.push(task);
854
+ processAgain();
855
+ return;
856
+ }
857
+ task.lastAttempt = Date.now();
858
+ Promise.resolve(task.fn()).then((result) => {
859
+ debug(`Task ${task.id} succeeded after ${task.age}ms.`);
860
+ task.resolve(result);
861
+ }).catch((error) => {
862
+ if (!this.#check(error)) {
863
+ debug(`Task ${task.id} failed with non-retryable error: ${error.message}.`);
864
+ task.reject(error);
865
+ return;
866
+ }
867
+ task.lastAttempt = Date.now();
868
+ this.#retrying.push(task);
869
+ debug(`Task ${task.id} failed, requeueing to try again.`);
870
+ }).finally(() => {
871
+ this.#processAll();
872
+ });
873
+ }
874
+ };
875
+ }));
876
+
877
+ //#endregion
878
+ //#region ../../node_modules/.pnpm/@humanfs+node@0.16.7/node_modules/@humanfs/node/src/node-hfs.js
879
+ var RETRY_ERROR_CODES, NodeHfsDirectoryEntry, NodeHfsImpl, NodeHfs, hfs;
880
+ var init_node_hfs = __esmMin((() => {
881
+ init_src$1();
882
+ init_retrier();
883
+ RETRY_ERROR_CODES = new Set(["ENFILE", "EMFILE"]);
884
+ NodeHfsDirectoryEntry = class {
885
+ /**
886
+ * The name of the directory entry.
887
+ * @type {string}
888
+ */
889
+ name;
890
+ /**
891
+ * True if the entry is a file.
892
+ * @type {boolean}
893
+ */
894
+ isFile;
895
+ /**
896
+ * True if the entry is a directory.
897
+ * @type {boolean}
898
+ */
899
+ isDirectory;
900
+ /**
901
+ * True if the entry is a symbolic link.
902
+ * @type {boolean}
903
+ */
904
+ isSymlink;
905
+ /**
906
+ * Creates a new instance.
907
+ * @param {Dirent} dirent The directory entry to wrap.
908
+ */
909
+ constructor(dirent) {
910
+ this.name = dirent.name;
911
+ this.isFile = dirent.isFile();
912
+ this.isDirectory = dirent.isDirectory();
913
+ this.isSymlink = dirent.isSymbolicLink();
914
+ }
915
+ };
916
+ NodeHfsImpl = class {
917
+ /**
918
+ * The file system module to use.
919
+ * @type {Fsp}
920
+ */
921
+ #fsp;
922
+ /**
923
+ * The retryer object used for retrying operations.
924
+ * @type {Retrier}
925
+ */
926
+ #retrier;
927
+ /**
928
+ * Creates a new instance.
929
+ * @param {object} [options] The options for the instance.
930
+ * @param {Fsp} [options.fsp] The file system module to use.
931
+ */
932
+ constructor({ fsp = fs } = {}) {
933
+ this.#fsp = fsp;
934
+ this.#retrier = new Retrier((error) => RETRY_ERROR_CODES.has(error.code));
935
+ }
936
+ /**
937
+ * Reads a file and returns the contents as an Uint8Array.
938
+ * @param {string|URL} filePath The path to the file to read.
939
+ * @returns {Promise<Uint8Array|undefined>} A promise that resolves with the contents
940
+ * of the file or undefined if the file doesn't exist.
941
+ * @throws {Error} If the file cannot be read.
942
+ * @throws {TypeError} If the file path is not a string.
943
+ */
944
+ bytes(filePath) {
945
+ return this.#retrier.retry(() => this.#fsp.readFile(filePath)).then((buffer) => new Uint8Array(buffer.buffer)).catch((error) => {
946
+ if (error.code === "ENOENT") return;
947
+ throw error;
948
+ });
949
+ }
950
+ /**
951
+ * Writes a value to a file. If the value is a string, UTF-8 encoding is used.
952
+ * @param {string|URL} filePath The path to the file to write.
953
+ * @param {Uint8Array} contents The contents to write to the
954
+ * file.
955
+ * @returns {Promise<void>} A promise that resolves when the file is
956
+ * written.
957
+ * @throws {TypeError} If the file path is not a string.
958
+ * @throws {Error} If the file cannot be written.
959
+ */
960
+ async write(filePath, contents) {
961
+ const value = Buffer.from(contents);
962
+ return this.#retrier.retry(() => this.#fsp.writeFile(filePath, value)).catch((error) => {
963
+ if (error.code === "ENOENT") {
964
+ const dirPath = path.dirname(filePath instanceof URL ? fileURLToPath(filePath) : filePath);
965
+ return this.#fsp.mkdir(dirPath, { recursive: true }).then(() => this.#fsp.writeFile(filePath, value));
966
+ }
967
+ throw error;
968
+ });
969
+ }
970
+ /**
971
+ * Appends a value to a file. If the value is a string, UTF-8 encoding is used.
972
+ * @param {string|URL} filePath The path to the file to append to.
973
+ * @param {Uint8Array} contents The contents to append to the
974
+ * file.
975
+ * @returns {Promise<void>} A promise that resolves when the file is
976
+ * written.
977
+ * @throws {TypeError} If the file path is not a string.
978
+ * @throws {Error} If the file cannot be appended to.
979
+ */
980
+ async append(filePath, contents) {
981
+ const value = Buffer.from(contents);
982
+ return this.#retrier.retry(() => this.#fsp.appendFile(filePath, value)).catch((error) => {
983
+ if (error.code === "ENOENT") {
984
+ const dirPath = path.dirname(filePath instanceof URL ? fileURLToPath(filePath) : filePath);
985
+ return this.#fsp.mkdir(dirPath, { recursive: true }).then(() => this.#fsp.appendFile(filePath, value));
986
+ }
987
+ throw error;
988
+ });
989
+ }
990
+ /**
991
+ * Checks if a file exists.
992
+ * @param {string|URL} filePath The path to the file to check.
993
+ * @returns {Promise<boolean>} A promise that resolves with true if the
994
+ * file exists or false if it does not.
995
+ * @throws {Error} If the operation fails with a code other than ENOENT.
996
+ */
997
+ isFile(filePath) {
998
+ return this.#fsp.stat(filePath).then((stat) => stat.isFile()).catch((error) => {
999
+ if (error.code === "ENOENT") return false;
1000
+ throw error;
1001
+ });
1002
+ }
1003
+ /**
1004
+ * Checks if a directory exists.
1005
+ * @param {string|URL} dirPath The path to the directory to check.
1006
+ * @returns {Promise<boolean>} A promise that resolves with true if the
1007
+ * directory exists or false if it does not.
1008
+ * @throws {Error} If the operation fails with a code other than ENOENT.
1009
+ */
1010
+ isDirectory(dirPath) {
1011
+ return this.#fsp.stat(dirPath).then((stat) => stat.isDirectory()).catch((error) => {
1012
+ if (error.code === "ENOENT") return false;
1013
+ throw error;
1014
+ });
1015
+ }
1016
+ /**
1017
+ * Creates a directory recursively.
1018
+ * @param {string|URL} dirPath The path to the directory to create.
1019
+ * @returns {Promise<void>} A promise that resolves when the directory is
1020
+ * created.
1021
+ */
1022
+ async createDirectory(dirPath) {
1023
+ await this.#fsp.mkdir(dirPath, { recursive: true });
1024
+ }
1025
+ /**
1026
+ * Deletes a file or empty directory.
1027
+ * @param {string|URL} fileOrDirPath The path to the file or directory to
1028
+ * delete.
1029
+ * @returns {Promise<boolean>} A promise that resolves when the file or
1030
+ * directory is deleted, true if the file or directory is deleted, false
1031
+ * if the file or directory does not exist.
1032
+ * @throws {TypeError} If the file or directory path is not a string.
1033
+ * @throws {Error} If the file or directory cannot be deleted.
1034
+ */
1035
+ delete(fileOrDirPath) {
1036
+ return this.#fsp.rm(fileOrDirPath).then(() => true).catch((error) => {
1037
+ if (error.code === "ERR_FS_EISDIR") return this.#fsp.rmdir(fileOrDirPath).then(() => true);
1038
+ if (error.code === "ENOENT") return false;
1039
+ throw error;
1040
+ });
1041
+ }
1042
+ /**
1043
+ * Deletes a file or directory recursively.
1044
+ * @param {string|URL} fileOrDirPath The path to the file or directory to
1045
+ * delete.
1046
+ * @returns {Promise<boolean>} A promise that resolves when the file or
1047
+ * directory is deleted, true if the file or directory is deleted, false
1048
+ * if the file or directory does not exist.
1049
+ * @throws {TypeError} If the file or directory path is not a string.
1050
+ * @throws {Error} If the file or directory cannot be deleted.
1051
+ */
1052
+ deleteAll(fileOrDirPath) {
1053
+ return this.#fsp.rm(fileOrDirPath, { recursive: true }).then(() => true).catch((error) => {
1054
+ if (error.code === "ENOENT") return false;
1055
+ throw error;
1056
+ });
1057
+ }
1058
+ /**
1059
+ * Returns a list of directory entries for the given path.
1060
+ * @param {string|URL} dirPath The path to the directory to read.
1061
+ * @returns {AsyncIterable<HfsDirectoryEntry>} A promise that resolves with the
1062
+ * directory entries.
1063
+ * @throws {TypeError} If the directory path is not a string.
1064
+ * @throws {Error} If the directory cannot be read.
1065
+ */
1066
+ async *list(dirPath) {
1067
+ const entries = await this.#fsp.readdir(dirPath, { withFileTypes: true });
1068
+ for (const entry of entries) yield new NodeHfsDirectoryEntry(entry);
1069
+ }
1070
+ /**
1071
+ * Returns the size of a file. This method handles ENOENT errors
1072
+ * and returns undefined in that case.
1073
+ * @param {string|URL} filePath The path to the file to read.
1074
+ * @returns {Promise<number|undefined>} A promise that resolves with the size of the
1075
+ * file in bytes or undefined if the file doesn't exist.
1076
+ */
1077
+ size(filePath) {
1078
+ return this.#fsp.stat(filePath).then((stat) => stat.size).catch((error) => {
1079
+ if (error.code === "ENOENT") return;
1080
+ throw error;
1081
+ });
1082
+ }
1083
+ /**
1084
+ * Returns the last modified date of a file or directory. This method handles ENOENT errors
1085
+ * and returns undefined in that case.
1086
+ * @param {string|URL} fileOrDirPath The path to the file to read.
1087
+ * @returns {Promise<Date|undefined>} A promise that resolves with the last modified
1088
+ * date of the file or directory, or undefined if the file doesn't exist.
1089
+ */
1090
+ lastModified(fileOrDirPath) {
1091
+ return this.#fsp.stat(fileOrDirPath).then((stat) => stat.mtime).catch((error) => {
1092
+ if (error.code === "ENOENT") return;
1093
+ throw error;
1094
+ });
1095
+ }
1096
+ /**
1097
+ * Copies a file from one location to another.
1098
+ * @param {string|URL} source The path to the file to copy.
1099
+ * @param {string|URL} destination The path to copy the file to.
1100
+ * @returns {Promise<void>} A promise that resolves when the file is copied.
1101
+ * @throws {Error} If the source file does not exist.
1102
+ * @throws {Error} If the source file is a directory.
1103
+ * @throws {Error} If the destination file is a directory.
1104
+ */
1105
+ copy(source, destination) {
1106
+ return this.#fsp.copyFile(source, destination);
1107
+ }
1108
+ /**
1109
+ * Copies a file or directory from one location to another.
1110
+ * @param {string|URL} source The path to the file or directory to copy.
1111
+ * @param {string|URL} destination The path to copy the file or directory to.
1112
+ * @returns {Promise<void>} A promise that resolves when the file or directory is
1113
+ * copied.
1114
+ * @throws {Error} If the source file or directory does not exist.
1115
+ * @throws {Error} If the destination file or directory is a directory.
1116
+ */
1117
+ async copyAll(source, destination) {
1118
+ if (await this.isFile(source)) return this.copy(source, destination);
1119
+ const sourceStr = source instanceof URL ? fileURLToPath(source) : source;
1120
+ const destinationStr = destination instanceof URL ? fileURLToPath(destination) : destination;
1121
+ await this.createDirectory(destination);
1122
+ for await (const entry of this.list(source)) {
1123
+ const fromEntryPath = path.join(sourceStr, entry.name);
1124
+ const toEntryPath = path.join(destinationStr, entry.name);
1125
+ if (entry.isDirectory) await this.copyAll(fromEntryPath, toEntryPath);
1126
+ else await this.copy(fromEntryPath, toEntryPath);
1127
+ }
1128
+ }
1129
+ /**
1130
+ * Moves a file from the source path to the destination path.
1131
+ * @param {string|URL} source The location of the file to move.
1132
+ * @param {string|URL} destination The destination of the file to move.
1133
+ * @returns {Promise<void>} A promise that resolves when the move is complete.
1134
+ * @throws {TypeError} If the file paths are not strings.
1135
+ * @throws {Error} If the file cannot be moved.
1136
+ */
1137
+ move(source, destination) {
1138
+ return this.#fsp.stat(source).then((stat) => {
1139
+ if (stat.isDirectory()) throw new Error(`EISDIR: illegal operation on a directory, move '${source}' -> '${destination}'`);
1140
+ return this.#fsp.rename(source, destination);
1141
+ });
1142
+ }
1143
+ /**
1144
+ * Moves a file or directory from the source path to the destination path.
1145
+ * @param {string|URL} source The location of the file or directory to move.
1146
+ * @param {string|URL} destination The destination of the file or directory to move.
1147
+ * @returns {Promise<void>} A promise that resolves when the move is complete.
1148
+ * @throws {TypeError} If the file paths are not strings.
1149
+ * @throws {Error} If the file or directory cannot be moved.
1150
+ */
1151
+ async moveAll(source, destination) {
1152
+ return this.#fsp.rename(source, destination);
1153
+ }
1154
+ };
1155
+ NodeHfs = class extends Hfs {
1156
+ /**
1157
+ * Creates a new instance.
1158
+ * @param {object} [options] The options for the instance.
1159
+ * @param {Fsp} [options.fsp] The file system module to use.
1160
+ */
1161
+ constructor({ fsp } = {}) {
1162
+ super({ impl: new NodeHfsImpl({ fsp }) });
1163
+ }
1164
+ };
1165
+ hfs = new NodeHfs();
1166
+ }));
1167
+
1168
+ //#endregion
1169
+ //#region ../../node_modules/.pnpm/@humanfs+node@0.16.7/node_modules/@humanfs/node/src/index.js
1170
+ var init_src = __esmMin((() => {
1171
+ init_node_hfs();
1172
+ init_src$1();
1173
+ }));
1174
+
1175
+ //#endregion
1176
+ init_src();
1177
+ export { hfs };