nitro-nightly 3.0.1-20251217-093053-f360ffee → 3.0.1-20251217-124302-0d9f782c

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.
@@ -2,1607 +2,11 @@ import * as sp from "node:path";
2
2
  import { join, relative, resolve, sep } from "node:path";
3
3
  import { stat, unwatchFile, watch, watchFile } from "node:fs";
4
4
  import { lstat, open, readdir, realpath, stat as stat$1 } from "node:fs/promises";
5
- import { stat as stat$2, unwatchFile as unwatchFile$1, watch as watch$1, watchFile as watchFile$1 } from "fs";
6
- import * as sysPath from "path";
7
5
  import { type } from "node:os";
8
- import { type as type$1 } from "os";
9
6
  import { EventEmitter } from "node:events";
10
7
  import { Readable } from "node:stream";
11
- import { lstat as lstat$1, open as open$1, readdir as readdir$1, realpath as realpath$1, stat as stat$3 } from "fs/promises";
12
- import { EventEmitter as EventEmitter$1 } from "events";
13
8
 
14
9
  //#region node_modules/.pnpm/readdirp@5.0.0/node_modules/readdirp/index.js
15
- const EntryTypes$1 = {
16
- FILE_TYPE: "files",
17
- DIR_TYPE: "directories",
18
- FILE_DIR_TYPE: "files_directories",
19
- EVERYTHING_TYPE: "all"
20
- };
21
- const defaultOptions$1 = {
22
- root: ".",
23
- fileFilter: (_entryInfo) => true,
24
- directoryFilter: (_entryInfo) => true,
25
- type: EntryTypes$1.FILE_TYPE,
26
- lstat: false,
27
- depth: 2147483648,
28
- alwaysStat: false,
29
- highWaterMark: 4096
30
- };
31
- Object.freeze(defaultOptions$1);
32
- const RECURSIVE_ERROR_CODE$1 = "READDIRP_RECURSIVE_ERROR";
33
- const NORMAL_FLOW_ERRORS$1 = new Set([
34
- "ENOENT",
35
- "EPERM",
36
- "EACCES",
37
- "ELOOP",
38
- RECURSIVE_ERROR_CODE$1
39
- ]);
40
- const ALL_TYPES$1 = [
41
- EntryTypes$1.DIR_TYPE,
42
- EntryTypes$1.EVERYTHING_TYPE,
43
- EntryTypes$1.FILE_DIR_TYPE,
44
- EntryTypes$1.FILE_TYPE
45
- ];
46
- const DIR_TYPES$1 = new Set([
47
- EntryTypes$1.DIR_TYPE,
48
- EntryTypes$1.EVERYTHING_TYPE,
49
- EntryTypes$1.FILE_DIR_TYPE
50
- ]);
51
- const FILE_TYPES$1 = new Set([
52
- EntryTypes$1.EVERYTHING_TYPE,
53
- EntryTypes$1.FILE_DIR_TYPE,
54
- EntryTypes$1.FILE_TYPE
55
- ]);
56
- const isNormalFlowError$1 = (error) => NORMAL_FLOW_ERRORS$1.has(error.code);
57
- const wantBigintFsStats$1 = process.platform === "win32";
58
- const emptyFn$1 = (_entryInfo) => true;
59
- const normalizeFilter$1 = (filter) => {
60
- if (filter === void 0) return emptyFn$1;
61
- if (typeof filter === "function") return filter;
62
- if (typeof filter === "string") {
63
- const fl = filter.trim();
64
- return (entry) => entry.basename === fl;
65
- }
66
- if (Array.isArray(filter)) {
67
- const trItems = filter.map((item) => item.trim());
68
- return (entry) => trItems.some((f) => entry.basename === f);
69
- }
70
- return emptyFn$1;
71
- };
72
- /** Readable readdir stream, emitting new files as they're being listed. */
73
- var ReaddirpStream$1 = class extends Readable {
74
- parents;
75
- reading;
76
- parent;
77
- _stat;
78
- _maxDepth;
79
- _wantsDir;
80
- _wantsFile;
81
- _wantsEverything;
82
- _root;
83
- _isDirent;
84
- _statsProp;
85
- _rdOptions;
86
- _fileFilter;
87
- _directoryFilter;
88
- constructor(options = {}) {
89
- super({
90
- objectMode: true,
91
- autoDestroy: true,
92
- highWaterMark: options.highWaterMark
93
- });
94
- const opts = {
95
- ...defaultOptions$1,
96
- ...options
97
- };
98
- const { root, type: type$2 } = opts;
99
- this._fileFilter = normalizeFilter$1(opts.fileFilter);
100
- this._directoryFilter = normalizeFilter$1(opts.directoryFilter);
101
- const statMethod = opts.lstat ? lstat : stat$1;
102
- if (wantBigintFsStats$1) this._stat = (path$2) => statMethod(path$2, { bigint: true });
103
- else this._stat = statMethod;
104
- this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions$1.depth;
105
- this._wantsDir = type$2 ? DIR_TYPES$1.has(type$2) : false;
106
- this._wantsFile = type$2 ? FILE_TYPES$1.has(type$2) : false;
107
- this._wantsEverything = type$2 === EntryTypes$1.EVERYTHING_TYPE;
108
- this._root = resolve(root);
109
- this._isDirent = !opts.alwaysStat;
110
- this._statsProp = this._isDirent ? "dirent" : "stats";
111
- this._rdOptions = {
112
- encoding: "utf8",
113
- withFileTypes: this._isDirent
114
- };
115
- this.parents = [this._exploreDir(root, 1)];
116
- this.reading = false;
117
- this.parent = void 0;
118
- }
119
- async _read(batch) {
120
- if (this.reading) return;
121
- this.reading = true;
122
- try {
123
- while (!this.destroyed && batch > 0) {
124
- const par = this.parent;
125
- const fil = par && par.files;
126
- if (fil && fil.length > 0) {
127
- const { path: path$2, depth } = par;
128
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path$2));
129
- const awaited = await Promise.all(slice);
130
- for (const entry of awaited) {
131
- if (!entry) continue;
132
- if (this.destroyed) return;
133
- const entryType = await this._getEntryType(entry);
134
- if (entryType === "directory" && this._directoryFilter(entry)) {
135
- if (depth <= this._maxDepth) this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
136
- if (this._wantsDir) {
137
- this.push(entry);
138
- batch--;
139
- }
140
- } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
141
- if (this._wantsFile) {
142
- this.push(entry);
143
- batch--;
144
- }
145
- }
146
- }
147
- } else {
148
- const parent = this.parents.pop();
149
- if (!parent) {
150
- this.push(null);
151
- break;
152
- }
153
- this.parent = await parent;
154
- if (this.destroyed) return;
155
- }
156
- }
157
- } catch (error) {
158
- this.destroy(error);
159
- } finally {
160
- this.reading = false;
161
- }
162
- }
163
- async _exploreDir(path$2, depth) {
164
- let files;
165
- try {
166
- files = await readdir(path$2, this._rdOptions);
167
- } catch (error) {
168
- this._onError(error);
169
- }
170
- return {
171
- files,
172
- depth,
173
- path: path$2
174
- };
175
- }
176
- async _formatEntry(dirent, path$2) {
177
- let entry;
178
- const basename$2 = this._isDirent ? dirent.name : dirent;
179
- try {
180
- const fullPath = resolve(join(path$2, basename$2));
181
- entry = {
182
- path: relative(this._root, fullPath),
183
- fullPath,
184
- basename: basename$2
185
- };
186
- entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
187
- } catch (err) {
188
- this._onError(err);
189
- return;
190
- }
191
- return entry;
192
- }
193
- _onError(err) {
194
- if (isNormalFlowError$1(err) && !this.destroyed) this.emit("warn", err);
195
- else this.destroy(err);
196
- }
197
- async _getEntryType(entry) {
198
- if (!entry && this._statsProp in entry) return "";
199
- const stats = entry[this._statsProp];
200
- if (stats.isFile()) return "file";
201
- if (stats.isDirectory()) return "directory";
202
- if (stats && stats.isSymbolicLink()) {
203
- const full = entry.fullPath;
204
- try {
205
- const entryRealPath = await realpath(full);
206
- const entryRealPathStats = await lstat(entryRealPath);
207
- if (entryRealPathStats.isFile()) return "file";
208
- if (entryRealPathStats.isDirectory()) {
209
- const len = entryRealPath.length;
210
- if (full.startsWith(entryRealPath) && full.substr(len, 1) === sep) {
211
- const recursiveError = /* @__PURE__ */ new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
212
- recursiveError.code = RECURSIVE_ERROR_CODE$1;
213
- return this._onError(recursiveError);
214
- }
215
- return "directory";
216
- }
217
- } catch (error) {
218
- this._onError(error);
219
- return "";
220
- }
221
- }
222
- }
223
- _includeAsFile(entry) {
224
- const stats = entry && entry[this._statsProp];
225
- return stats && this._wantsEverything && !stats.isDirectory();
226
- }
227
- };
228
- /**
229
- * Streaming version: Reads all files and directories in given root recursively.
230
- * Consumes ~constant small amount of RAM.
231
- * @param root Root directory
232
- * @param options Options to specify root (start directory), filters and recursion depth
233
- */
234
- function readdirp$1(root, options = {}) {
235
- let type$2 = options.entryType || options.type;
236
- if (type$2 === "both") type$2 = EntryTypes$1.FILE_DIR_TYPE;
237
- if (type$2) options.type = type$2;
238
- if (!root) throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
239
- else if (typeof root !== "string") throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
240
- else if (type$2 && !ALL_TYPES$1.includes(type$2)) throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES$1.join(", ")}`);
241
- options.root = root;
242
- return new ReaddirpStream$1(options);
243
- }
244
-
245
- //#endregion
246
- //#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/handler.js
247
- const STR_DATA$1 = "data";
248
- const STR_END$1 = "end";
249
- const STR_CLOSE$1 = "close";
250
- const EMPTY_FN$1 = () => {};
251
- const pl$1 = process.platform;
252
- const isWindows$1 = pl$1 === "win32";
253
- const isMacos$1 = pl$1 === "darwin";
254
- const isLinux$1 = pl$1 === "linux";
255
- const isFreeBSD$1 = pl$1 === "freebsd";
256
- const isIBMi$1 = type() === "OS400";
257
- const EVENTS$1 = {
258
- ALL: "all",
259
- READY: "ready",
260
- ADD: "add",
261
- CHANGE: "change",
262
- ADD_DIR: "addDir",
263
- UNLINK: "unlink",
264
- UNLINK_DIR: "unlinkDir",
265
- RAW: "raw",
266
- ERROR: "error"
267
- };
268
- const EV$1 = EVENTS$1;
269
- const THROTTLE_MODE_WATCH$1 = "watch";
270
- const statMethods$1 = {
271
- lstat,
272
- stat: stat$1
273
- };
274
- const KEY_LISTENERS$1 = "listeners";
275
- const KEY_ERR$1 = "errHandlers";
276
- const KEY_RAW$1 = "rawEmitters";
277
- const HANDLER_KEYS$1 = [
278
- KEY_LISTENERS$1,
279
- KEY_ERR$1,
280
- KEY_RAW$1
281
- ];
282
- const binaryExtensions$1 = new Set([
283
- "3dm",
284
- "3ds",
285
- "3g2",
286
- "3gp",
287
- "7z",
288
- "a",
289
- "aac",
290
- "adp",
291
- "afdesign",
292
- "afphoto",
293
- "afpub",
294
- "ai",
295
- "aif",
296
- "aiff",
297
- "alz",
298
- "ape",
299
- "apk",
300
- "appimage",
301
- "ar",
302
- "arj",
303
- "asf",
304
- "au",
305
- "avi",
306
- "bak",
307
- "baml",
308
- "bh",
309
- "bin",
310
- "bk",
311
- "bmp",
312
- "btif",
313
- "bz2",
314
- "bzip2",
315
- "cab",
316
- "caf",
317
- "cgm",
318
- "class",
319
- "cmx",
320
- "cpio",
321
- "cr2",
322
- "cur",
323
- "dat",
324
- "dcm",
325
- "deb",
326
- "dex",
327
- "djvu",
328
- "dll",
329
- "dmg",
330
- "dng",
331
- "doc",
332
- "docm",
333
- "docx",
334
- "dot",
335
- "dotm",
336
- "dra",
337
- "DS_Store",
338
- "dsk",
339
- "dts",
340
- "dtshd",
341
- "dvb",
342
- "dwg",
343
- "dxf",
344
- "ecelp4800",
345
- "ecelp7470",
346
- "ecelp9600",
347
- "egg",
348
- "eol",
349
- "eot",
350
- "epub",
351
- "exe",
352
- "f4v",
353
- "fbs",
354
- "fh",
355
- "fla",
356
- "flac",
357
- "flatpak",
358
- "fli",
359
- "flv",
360
- "fpx",
361
- "fst",
362
- "fvt",
363
- "g3",
364
- "gh",
365
- "gif",
366
- "graffle",
367
- "gz",
368
- "gzip",
369
- "h261",
370
- "h263",
371
- "h264",
372
- "icns",
373
- "ico",
374
- "ief",
375
- "img",
376
- "ipa",
377
- "iso",
378
- "jar",
379
- "jpeg",
380
- "jpg",
381
- "jpgv",
382
- "jpm",
383
- "jxr",
384
- "key",
385
- "ktx",
386
- "lha",
387
- "lib",
388
- "lvp",
389
- "lz",
390
- "lzh",
391
- "lzma",
392
- "lzo",
393
- "m3u",
394
- "m4a",
395
- "m4v",
396
- "mar",
397
- "mdi",
398
- "mht",
399
- "mid",
400
- "midi",
401
- "mj2",
402
- "mka",
403
- "mkv",
404
- "mmr",
405
- "mng",
406
- "mobi",
407
- "mov",
408
- "movie",
409
- "mp3",
410
- "mp4",
411
- "mp4a",
412
- "mpeg",
413
- "mpg",
414
- "mpga",
415
- "mxu",
416
- "nef",
417
- "npx",
418
- "numbers",
419
- "nupkg",
420
- "o",
421
- "odp",
422
- "ods",
423
- "odt",
424
- "oga",
425
- "ogg",
426
- "ogv",
427
- "otf",
428
- "ott",
429
- "pages",
430
- "pbm",
431
- "pcx",
432
- "pdb",
433
- "pdf",
434
- "pea",
435
- "pgm",
436
- "pic",
437
- "png",
438
- "pnm",
439
- "pot",
440
- "potm",
441
- "potx",
442
- "ppa",
443
- "ppam",
444
- "ppm",
445
- "pps",
446
- "ppsm",
447
- "ppsx",
448
- "ppt",
449
- "pptm",
450
- "pptx",
451
- "psd",
452
- "pya",
453
- "pyc",
454
- "pyo",
455
- "pyv",
456
- "qt",
457
- "rar",
458
- "ras",
459
- "raw",
460
- "resources",
461
- "rgb",
462
- "rip",
463
- "rlc",
464
- "rmf",
465
- "rmvb",
466
- "rpm",
467
- "rtf",
468
- "rz",
469
- "s3m",
470
- "s7z",
471
- "scpt",
472
- "sgi",
473
- "shar",
474
- "snap",
475
- "sil",
476
- "sketch",
477
- "slk",
478
- "smv",
479
- "snk",
480
- "so",
481
- "stl",
482
- "suo",
483
- "sub",
484
- "swf",
485
- "tar",
486
- "tbz",
487
- "tbz2",
488
- "tga",
489
- "tgz",
490
- "thmx",
491
- "tif",
492
- "tiff",
493
- "tlz",
494
- "ttc",
495
- "ttf",
496
- "txz",
497
- "udf",
498
- "uvh",
499
- "uvi",
500
- "uvm",
501
- "uvp",
502
- "uvs",
503
- "uvu",
504
- "viv",
505
- "vob",
506
- "war",
507
- "wav",
508
- "wax",
509
- "wbmp",
510
- "wdp",
511
- "weba",
512
- "webm",
513
- "webp",
514
- "whl",
515
- "wim",
516
- "wm",
517
- "wma",
518
- "wmv",
519
- "wmx",
520
- "woff",
521
- "woff2",
522
- "wrm",
523
- "wvx",
524
- "xbm",
525
- "xif",
526
- "xla",
527
- "xlam",
528
- "xls",
529
- "xlsb",
530
- "xlsm",
531
- "xlsx",
532
- "xlt",
533
- "xltm",
534
- "xltx",
535
- "xm",
536
- "xmind",
537
- "xpi",
538
- "xpm",
539
- "xwd",
540
- "xz",
541
- "z",
542
- "zip",
543
- "zipx"
544
- ]);
545
- const isBinaryPath$1 = (filePath) => binaryExtensions$1.has(sp.extname(filePath).slice(1).toLowerCase());
546
- const foreach$1 = (val, fn) => {
547
- if (val instanceof Set) val.forEach(fn);
548
- else fn(val);
549
- };
550
- const addAndConvert$1 = (main, prop, item) => {
551
- let container = main[prop];
552
- if (!(container instanceof Set)) main[prop] = container = new Set([container]);
553
- container.add(item);
554
- };
555
- const clearItem$1 = (cont) => (key) => {
556
- const set = cont[key];
557
- if (set instanceof Set) set.clear();
558
- else delete cont[key];
559
- };
560
- const delFromSet$1 = (main, prop, item) => {
561
- const container = main[prop];
562
- if (container instanceof Set) container.delete(item);
563
- else if (container === item) delete main[prop];
564
- };
565
- const isEmptySet$1 = (val) => val instanceof Set ? val.size === 0 : !val;
566
- const FsWatchInstances$1 = /* @__PURE__ */ new Map();
567
- /**
568
- * Instantiates the fs_watch interface
569
- * @param path to be watched
570
- * @param options to be passed to fs_watch
571
- * @param listener main event handler
572
- * @param errHandler emits info about errors
573
- * @param emitRaw emits raw event data
574
- * @returns {NativeFsWatcher}
575
- */
576
- function createFsWatchInstance$1(path$2, options, listener, errHandler, emitRaw) {
577
- const handleEvent = (rawEvent, evPath) => {
578
- listener(path$2);
579
- emitRaw(rawEvent, evPath, { watchedPath: path$2 });
580
- if (evPath && path$2 !== evPath) fsWatchBroadcast$1(sp.resolve(path$2, evPath), KEY_LISTENERS$1, sp.join(path$2, evPath));
581
- };
582
- try {
583
- return watch(path$2, { persistent: options.persistent }, handleEvent);
584
- } catch (error) {
585
- errHandler(error);
586
- return;
587
- }
588
- }
589
- /**
590
- * Helper for passing fs_watch event data to a collection of listeners
591
- * @param fullPath absolute path bound to fs_watch instance
592
- */
593
- const fsWatchBroadcast$1 = (fullPath, listenerType, val1, val2, val3) => {
594
- const cont = FsWatchInstances$1.get(fullPath);
595
- if (!cont) return;
596
- foreach$1(cont[listenerType], (listener) => {
597
- listener(val1, val2, val3);
598
- });
599
- };
600
- /**
601
- * Instantiates the fs_watch interface or binds listeners
602
- * to an existing one covering the same file system entry
603
- * @param path
604
- * @param fullPath absolute path
605
- * @param options to be passed to fs_watch
606
- * @param handlers container for event listener functions
607
- */
608
- const setFsWatchListener$1 = (path$2, fullPath, options, handlers) => {
609
- const { listener, errHandler, rawEmitter } = handlers;
610
- let cont = FsWatchInstances$1.get(fullPath);
611
- let watcher;
612
- if (!options.persistent) {
613
- watcher = createFsWatchInstance$1(path$2, options, listener, errHandler, rawEmitter);
614
- if (!watcher) return;
615
- return watcher.close.bind(watcher);
616
- }
617
- if (cont) {
618
- addAndConvert$1(cont, KEY_LISTENERS$1, listener);
619
- addAndConvert$1(cont, KEY_ERR$1, errHandler);
620
- addAndConvert$1(cont, KEY_RAW$1, rawEmitter);
621
- } else {
622
- watcher = createFsWatchInstance$1(path$2, options, fsWatchBroadcast$1.bind(null, fullPath, KEY_LISTENERS$1), errHandler, fsWatchBroadcast$1.bind(null, fullPath, KEY_RAW$1));
623
- if (!watcher) return;
624
- watcher.on(EV$1.ERROR, async (error) => {
625
- const broadcastErr = fsWatchBroadcast$1.bind(null, fullPath, KEY_ERR$1);
626
- if (cont) cont.watcherUnusable = true;
627
- if (isWindows$1 && error.code === "EPERM") try {
628
- await (await open(path$2, "r")).close();
629
- broadcastErr(error);
630
- } catch (err) {}
631
- else broadcastErr(error);
632
- });
633
- cont = {
634
- listeners: listener,
635
- errHandlers: errHandler,
636
- rawEmitters: rawEmitter,
637
- watcher
638
- };
639
- FsWatchInstances$1.set(fullPath, cont);
640
- }
641
- return () => {
642
- delFromSet$1(cont, KEY_LISTENERS$1, listener);
643
- delFromSet$1(cont, KEY_ERR$1, errHandler);
644
- delFromSet$1(cont, KEY_RAW$1, rawEmitter);
645
- if (isEmptySet$1(cont.listeners)) {
646
- cont.watcher.close();
647
- FsWatchInstances$1.delete(fullPath);
648
- HANDLER_KEYS$1.forEach(clearItem$1(cont));
649
- cont.watcher = void 0;
650
- Object.freeze(cont);
651
- }
652
- };
653
- };
654
- const FsWatchFileInstances$1 = /* @__PURE__ */ new Map();
655
- /**
656
- * Instantiates the fs_watchFile interface or binds listeners
657
- * to an existing one covering the same file system entry
658
- * @param path to be watched
659
- * @param fullPath absolute path
660
- * @param options options to be passed to fs_watchFile
661
- * @param handlers container for event listener functions
662
- * @returns closer
663
- */
664
- const setFsWatchFileListener$1 = (path$2, fullPath, options, handlers) => {
665
- const { listener, rawEmitter } = handlers;
666
- let cont = FsWatchFileInstances$1.get(fullPath);
667
- const copts = cont && cont.options;
668
- if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
669
- unwatchFile(fullPath);
670
- cont = void 0;
671
- }
672
- if (cont) {
673
- addAndConvert$1(cont, KEY_LISTENERS$1, listener);
674
- addAndConvert$1(cont, KEY_RAW$1, rawEmitter);
675
- } else {
676
- cont = {
677
- listeners: listener,
678
- rawEmitters: rawEmitter,
679
- options,
680
- watcher: watchFile(fullPath, options, (curr, prev) => {
681
- foreach$1(cont.rawEmitters, (rawEmitter$1) => {
682
- rawEmitter$1(EV$1.CHANGE, fullPath, {
683
- curr,
684
- prev
685
- });
686
- });
687
- const currmtime = curr.mtimeMs;
688
- if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach$1(cont.listeners, (listener$1) => listener$1(path$2, curr));
689
- })
690
- };
691
- FsWatchFileInstances$1.set(fullPath, cont);
692
- }
693
- return () => {
694
- delFromSet$1(cont, KEY_LISTENERS$1, listener);
695
- delFromSet$1(cont, KEY_RAW$1, rawEmitter);
696
- if (isEmptySet$1(cont.listeners)) {
697
- FsWatchFileInstances$1.delete(fullPath);
698
- unwatchFile(fullPath);
699
- cont.options = cont.watcher = void 0;
700
- Object.freeze(cont);
701
- }
702
- };
703
- };
704
- /**
705
- * @mixin
706
- */
707
- var NodeFsHandler$1 = class {
708
- fsw;
709
- _boundHandleError;
710
- constructor(fsW) {
711
- this.fsw = fsW;
712
- this._boundHandleError = (error) => fsW._handleError(error);
713
- }
714
- /**
715
- * Watch file for changes with fs_watchFile or fs_watch.
716
- * @param path to file or dir
717
- * @param listener on fs change
718
- * @returns closer for the watcher instance
719
- */
720
- _watchWithNodeFs(path$2, listener) {
721
- const opts = this.fsw.options;
722
- const directory = sp.dirname(path$2);
723
- const basename$2 = sp.basename(path$2);
724
- this.fsw._getWatchedDir(directory).add(basename$2);
725
- const absolutePath = sp.resolve(path$2);
726
- const options = { persistent: opts.persistent };
727
- if (!listener) listener = EMPTY_FN$1;
728
- let closer;
729
- if (opts.usePolling) {
730
- options.interval = opts.interval !== opts.binaryInterval && isBinaryPath$1(basename$2) ? opts.binaryInterval : opts.interval;
731
- closer = setFsWatchFileListener$1(path$2, absolutePath, options, {
732
- listener,
733
- rawEmitter: this.fsw._emitRaw
734
- });
735
- } else closer = setFsWatchListener$1(path$2, absolutePath, options, {
736
- listener,
737
- errHandler: this._boundHandleError,
738
- rawEmitter: this.fsw._emitRaw
739
- });
740
- return closer;
741
- }
742
- /**
743
- * Watch a file and emit add event if warranted.
744
- * @returns closer for the watcher instance
745
- */
746
- _handleFile(file, stats, initialAdd) {
747
- if (this.fsw.closed) return;
748
- const dirname$2 = sp.dirname(file);
749
- const basename$2 = sp.basename(file);
750
- const parent = this.fsw._getWatchedDir(dirname$2);
751
- let prevStats = stats;
752
- if (parent.has(basename$2)) return;
753
- const listener = async (path$2, newStats) => {
754
- if (!this.fsw._throttle(THROTTLE_MODE_WATCH$1, file, 5)) return;
755
- if (!newStats || newStats.mtimeMs === 0) try {
756
- const newStats$1 = await stat$1(file);
757
- if (this.fsw.closed) return;
758
- const at = newStats$1.atimeMs;
759
- const mt = newStats$1.mtimeMs;
760
- if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV$1.CHANGE, file, newStats$1);
761
- if ((isMacos$1 || isLinux$1 || isFreeBSD$1) && prevStats.ino !== newStats$1.ino) {
762
- this.fsw._closeFile(path$2);
763
- prevStats = newStats$1;
764
- const closer$1 = this._watchWithNodeFs(file, listener);
765
- if (closer$1) this.fsw._addPathCloser(path$2, closer$1);
766
- } else prevStats = newStats$1;
767
- } catch (error) {
768
- this.fsw._remove(dirname$2, basename$2);
769
- }
770
- else if (parent.has(basename$2)) {
771
- const at = newStats.atimeMs;
772
- const mt = newStats.mtimeMs;
773
- if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV$1.CHANGE, file, newStats);
774
- prevStats = newStats;
775
- }
776
- };
777
- const closer = this._watchWithNodeFs(file, listener);
778
- if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
779
- if (!this.fsw._throttle(EV$1.ADD, file, 0)) return;
780
- this.fsw._emit(EV$1.ADD, file, stats);
781
- }
782
- return closer;
783
- }
784
- /**
785
- * Handle symlinks encountered while reading a dir.
786
- * @param entry returned by readdirp
787
- * @param directory path of dir being read
788
- * @param path of this item
789
- * @param item basename of this item
790
- * @returns true if no more processing is needed for this entry.
791
- */
792
- async _handleSymlink(entry, directory, path$2, item) {
793
- if (this.fsw.closed) return;
794
- const full = entry.fullPath;
795
- const dir = this.fsw._getWatchedDir(directory);
796
- if (!this.fsw.options.followSymlinks) {
797
- this.fsw._incrReadyCount();
798
- let linkPath;
799
- try {
800
- linkPath = await realpath(path$2);
801
- } catch (e) {
802
- this.fsw._emitReady();
803
- return true;
804
- }
805
- if (this.fsw.closed) return;
806
- if (dir.has(item)) {
807
- if (this.fsw._symlinkPaths.get(full) !== linkPath) {
808
- this.fsw._symlinkPaths.set(full, linkPath);
809
- this.fsw._emit(EV$1.CHANGE, path$2, entry.stats);
810
- }
811
- } else {
812
- dir.add(item);
813
- this.fsw._symlinkPaths.set(full, linkPath);
814
- this.fsw._emit(EV$1.ADD, path$2, entry.stats);
815
- }
816
- this.fsw._emitReady();
817
- return true;
818
- }
819
- if (this.fsw._symlinkPaths.has(full)) return true;
820
- this.fsw._symlinkPaths.set(full, true);
821
- }
822
- _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
823
- directory = sp.join(directory, "");
824
- const throttleKey = target ? `${directory}:${target}` : directory;
825
- throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
826
- if (!throttler) return;
827
- const previous = this.fsw._getWatchedDir(wh.path);
828
- const current = /* @__PURE__ */ new Set();
829
- let stream = this.fsw._readdirp(directory, {
830
- fileFilter: (entry) => wh.filterPath(entry),
831
- directoryFilter: (entry) => wh.filterDir(entry)
832
- });
833
- if (!stream) return;
834
- stream.on(STR_DATA$1, async (entry) => {
835
- if (this.fsw.closed) {
836
- stream = void 0;
837
- return;
838
- }
839
- const item = entry.path;
840
- let path$2 = sp.join(directory, item);
841
- current.add(item);
842
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path$2, item)) return;
843
- if (this.fsw.closed) {
844
- stream = void 0;
845
- return;
846
- }
847
- if (item === target || !target && !previous.has(item)) {
848
- this.fsw._incrReadyCount();
849
- path$2 = sp.join(dir, sp.relative(dir, path$2));
850
- this._addToNodeFs(path$2, initialAdd, wh, depth + 1);
851
- }
852
- }).on(EV$1.ERROR, this._boundHandleError);
853
- return new Promise((resolve$2, reject) => {
854
- if (!stream) return reject();
855
- stream.once(STR_END$1, () => {
856
- if (this.fsw.closed) {
857
- stream = void 0;
858
- return;
859
- }
860
- const wasThrottled = throttler ? throttler.clear() : false;
861
- resolve$2(void 0);
862
- previous.getChildren().filter((item) => {
863
- return item !== directory && !current.has(item);
864
- }).forEach((item) => {
865
- this.fsw._remove(directory, item);
866
- });
867
- stream = void 0;
868
- if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler);
869
- });
870
- });
871
- }
872
- /**
873
- * Read directory to add / remove files from `@watched` list and re-read it on change.
874
- * @param dir fs path
875
- * @param stats
876
- * @param initialAdd
877
- * @param depth relative to user-supplied path
878
- * @param target child path targeted for watch
879
- * @param wh Common watch helpers for this path
880
- * @param realpath
881
- * @returns closer for the watcher instance.
882
- */
883
- async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath$2) {
884
- const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
885
- const tracked = parentDir.has(sp.basename(dir));
886
- if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV$1.ADD_DIR, dir, stats);
887
- parentDir.add(sp.basename(dir));
888
- this.fsw._getWatchedDir(dir);
889
- let throttler;
890
- let closer;
891
- const oDepth = this.fsw.options.depth;
892
- if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath$2)) {
893
- if (!target) {
894
- await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
895
- if (this.fsw.closed) return;
896
- }
897
- closer = this._watchWithNodeFs(dir, (dirPath, stats$1) => {
898
- if (stats$1 && stats$1.mtimeMs === 0) return;
899
- this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
900
- });
901
- }
902
- return closer;
903
- }
904
- /**
905
- * Handle added file, directory, or glob pattern.
906
- * Delegates call to _handleFile / _handleDir after checks.
907
- * @param path to file or ir
908
- * @param initialAdd was the file added at watch instantiation?
909
- * @param priorWh depth relative to user-supplied path
910
- * @param depth Child path actually targeted for watch
911
- * @param target Child path actually targeted for watch
912
- */
913
- async _addToNodeFs(path$2, initialAdd, priorWh, depth, target) {
914
- const ready = this.fsw._emitReady;
915
- if (this.fsw._isIgnored(path$2) || this.fsw.closed) {
916
- ready();
917
- return false;
918
- }
919
- const wh = this.fsw._getWatchHelpers(path$2);
920
- if (priorWh) {
921
- wh.filterPath = (entry) => priorWh.filterPath(entry);
922
- wh.filterDir = (entry) => priorWh.filterDir(entry);
923
- }
924
- try {
925
- const stats = await statMethods$1[wh.statMethod](wh.watchPath);
926
- if (this.fsw.closed) return;
927
- if (this.fsw._isIgnored(wh.watchPath, stats)) {
928
- ready();
929
- return false;
930
- }
931
- const follow = this.fsw.options.followSymlinks;
932
- let closer;
933
- if (stats.isDirectory()) {
934
- const absPath = sp.resolve(path$2);
935
- const targetPath = follow ? await realpath(path$2) : path$2;
936
- if (this.fsw.closed) return;
937
- closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
938
- if (this.fsw.closed) return;
939
- if (absPath !== targetPath && targetPath !== void 0) this.fsw._symlinkPaths.set(absPath, targetPath);
940
- } else if (stats.isSymbolicLink()) {
941
- const targetPath = follow ? await realpath(path$2) : path$2;
942
- if (this.fsw.closed) return;
943
- const parent = sp.dirname(wh.watchPath);
944
- this.fsw._getWatchedDir(parent).add(wh.watchPath);
945
- this.fsw._emit(EV$1.ADD, wh.watchPath, stats);
946
- closer = await this._handleDir(parent, stats, initialAdd, depth, path$2, wh, targetPath);
947
- if (this.fsw.closed) return;
948
- if (targetPath !== void 0) this.fsw._symlinkPaths.set(sp.resolve(path$2), targetPath);
949
- } else closer = this._handleFile(wh.watchPath, stats, initialAdd);
950
- ready();
951
- if (closer) this.fsw._addPathCloser(path$2, closer);
952
- return false;
953
- } catch (error) {
954
- if (this.fsw._handleError(error)) {
955
- ready();
956
- return path$2;
957
- }
958
- }
959
- }
960
- };
961
-
962
- //#endregion
963
- //#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
964
- /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
965
- const SLASH$1 = "/";
966
- const SLASH_SLASH$1 = "//";
967
- const ONE_DOT$1 = ".";
968
- const TWO_DOTS$1 = "..";
969
- const STRING_TYPE$1 = "string";
970
- const BACK_SLASH_RE$1 = /\\/g;
971
- const DOUBLE_SLASH_RE$1 = /\/\//g;
972
- const DOT_RE$1 = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
973
- const REPLACER_RE$1 = /^\.[/\\]/;
974
- function arrify$1(item) {
975
- return Array.isArray(item) ? item : [item];
976
- }
977
- const isMatcherObject$1 = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
978
- function createPattern$1(matcher) {
979
- if (typeof matcher === "function") return matcher;
980
- if (typeof matcher === "string") return (string) => matcher === string;
981
- if (matcher instanceof RegExp) return (string) => matcher.test(string);
982
- if (typeof matcher === "object" && matcher !== null) return (string) => {
983
- if (matcher.path === string) return true;
984
- if (matcher.recursive) {
985
- const relative$2 = sp.relative(matcher.path, string);
986
- if (!relative$2) return false;
987
- return !relative$2.startsWith("..") && !sp.isAbsolute(relative$2);
988
- }
989
- return false;
990
- };
991
- return () => false;
992
- }
993
- function normalizePath$1(path$2) {
994
- if (typeof path$2 !== "string") throw new Error("string expected");
995
- path$2 = sp.normalize(path$2);
996
- path$2 = path$2.replace(/\\/g, "/");
997
- let prepend = false;
998
- if (path$2.startsWith("//")) prepend = true;
999
- path$2 = path$2.replace(DOUBLE_SLASH_RE$1, "/");
1000
- if (prepend) path$2 = "/" + path$2;
1001
- return path$2;
1002
- }
1003
- function matchPatterns$1(patterns, testString, stats) {
1004
- const path$2 = normalizePath$1(testString);
1005
- for (let index = 0; index < patterns.length; index++) {
1006
- const pattern = patterns[index];
1007
- if (pattern(path$2, stats)) return true;
1008
- }
1009
- return false;
1010
- }
1011
- function anymatch$1(matchers, testString) {
1012
- if (matchers == null) throw new TypeError("anymatch: specify first argument");
1013
- const patterns = arrify$1(matchers).map((matcher) => createPattern$1(matcher));
1014
- if (testString == null) return (testString$1, stats) => {
1015
- return matchPatterns$1(patterns, testString$1, stats);
1016
- };
1017
- return matchPatterns$1(patterns, testString);
1018
- }
1019
- const unifyPaths$1 = (paths_) => {
1020
- const paths = arrify$1(paths_).flat();
1021
- if (!paths.every((p) => typeof p === STRING_TYPE$1)) throw new TypeError(`Non-string provided as watch path: ${paths}`);
1022
- return paths.map(normalizePathToUnix$1);
1023
- };
1024
- const toUnix$1 = (string) => {
1025
- let str = string.replace(BACK_SLASH_RE$1, SLASH$1);
1026
- let prepend = false;
1027
- if (str.startsWith(SLASH_SLASH$1)) prepend = true;
1028
- str = str.replace(DOUBLE_SLASH_RE$1, SLASH$1);
1029
- if (prepend) str = SLASH$1 + str;
1030
- return str;
1031
- };
1032
- const normalizePathToUnix$1 = (path$2) => toUnix$1(sp.normalize(toUnix$1(path$2)));
1033
- const normalizeIgnored$1 = (cwd = "") => (path$2) => {
1034
- if (typeof path$2 === "string") return normalizePathToUnix$1(sp.isAbsolute(path$2) ? path$2 : sp.join(cwd, path$2));
1035
- else return path$2;
1036
- };
1037
- const getAbsolutePath$1 = (path$2, cwd) => {
1038
- if (sp.isAbsolute(path$2)) return path$2;
1039
- return sp.join(cwd, path$2);
1040
- };
1041
- const EMPTY_SET$1 = Object.freeze(/* @__PURE__ */ new Set());
1042
- /**
1043
- * Directory entry.
1044
- */
1045
- var DirEntry$1 = class {
1046
- path;
1047
- _removeWatcher;
1048
- items;
1049
- constructor(dir, removeWatcher) {
1050
- this.path = dir;
1051
- this._removeWatcher = removeWatcher;
1052
- this.items = /* @__PURE__ */ new Set();
1053
- }
1054
- add(item) {
1055
- const { items } = this;
1056
- if (!items) return;
1057
- if (item !== ONE_DOT$1 && item !== TWO_DOTS$1) items.add(item);
1058
- }
1059
- async remove(item) {
1060
- const { items } = this;
1061
- if (!items) return;
1062
- items.delete(item);
1063
- if (items.size > 0) return;
1064
- const dir = this.path;
1065
- try {
1066
- await readdir(dir);
1067
- } catch (err) {
1068
- if (this._removeWatcher) this._removeWatcher(sp.dirname(dir), sp.basename(dir));
1069
- }
1070
- }
1071
- has(item) {
1072
- const { items } = this;
1073
- if (!items) return;
1074
- return items.has(item);
1075
- }
1076
- getChildren() {
1077
- const { items } = this;
1078
- if (!items) return [];
1079
- return [...items.values()];
1080
- }
1081
- dispose() {
1082
- this.items.clear();
1083
- this.path = "";
1084
- this._removeWatcher = EMPTY_FN$1;
1085
- this.items = EMPTY_SET$1;
1086
- Object.freeze(this);
1087
- }
1088
- };
1089
- const STAT_METHOD_F$1 = "stat";
1090
- const STAT_METHOD_L$1 = "lstat";
1091
- var WatchHelper$1 = class {
1092
- fsw;
1093
- path;
1094
- watchPath;
1095
- fullWatchPath;
1096
- dirParts;
1097
- followSymlinks;
1098
- statMethod;
1099
- constructor(path$2, follow, fsw) {
1100
- this.fsw = fsw;
1101
- const watchPath = path$2;
1102
- this.path = path$2 = path$2.replace(REPLACER_RE$1, "");
1103
- this.watchPath = watchPath;
1104
- this.fullWatchPath = sp.resolve(watchPath);
1105
- this.dirParts = [];
1106
- this.dirParts.forEach((parts) => {
1107
- if (parts.length > 1) parts.pop();
1108
- });
1109
- this.followSymlinks = follow;
1110
- this.statMethod = follow ? STAT_METHOD_F$1 : STAT_METHOD_L$1;
1111
- }
1112
- entryPath(entry) {
1113
- return sp.join(this.watchPath, sp.relative(this.watchPath, entry.fullPath));
1114
- }
1115
- filterPath(entry) {
1116
- const { stats } = entry;
1117
- if (stats && stats.isSymbolicLink()) return this.filterDir(entry);
1118
- const resolvedPath = this.entryPath(entry);
1119
- return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
1120
- }
1121
- filterDir(entry) {
1122
- return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
1123
- }
1124
- };
1125
- /**
1126
- * Watches files & directories for changes. Emitted events:
1127
- * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
1128
- *
1129
- * new FSWatcher()
1130
- * .add(directories)
1131
- * .on('add', path => log('File', path, 'was added'))
1132
- */
1133
- var FSWatcher$1 = class extends EventEmitter {
1134
- closed;
1135
- options;
1136
- _closers;
1137
- _ignoredPaths;
1138
- _throttled;
1139
- _streams;
1140
- _symlinkPaths;
1141
- _watched;
1142
- _pendingWrites;
1143
- _pendingUnlinks;
1144
- _readyCount;
1145
- _emitReady;
1146
- _closePromise;
1147
- _userIgnored;
1148
- _readyEmitted;
1149
- _emitRaw;
1150
- _boundRemove;
1151
- _nodeFsHandler;
1152
- constructor(_opts = {}) {
1153
- super();
1154
- this.closed = false;
1155
- this._closers = /* @__PURE__ */ new Map();
1156
- this._ignoredPaths = /* @__PURE__ */ new Set();
1157
- this._throttled = /* @__PURE__ */ new Map();
1158
- this._streams = /* @__PURE__ */ new Set();
1159
- this._symlinkPaths = /* @__PURE__ */ new Map();
1160
- this._watched = /* @__PURE__ */ new Map();
1161
- this._pendingWrites = /* @__PURE__ */ new Map();
1162
- this._pendingUnlinks = /* @__PURE__ */ new Map();
1163
- this._readyCount = 0;
1164
- this._readyEmitted = false;
1165
- const awf = _opts.awaitWriteFinish;
1166
- const DEF_AWF = {
1167
- stabilityThreshold: 2e3,
1168
- pollInterval: 100
1169
- };
1170
- const opts = {
1171
- persistent: true,
1172
- ignoreInitial: false,
1173
- ignorePermissionErrors: false,
1174
- interval: 100,
1175
- binaryInterval: 300,
1176
- followSymlinks: true,
1177
- usePolling: false,
1178
- atomic: true,
1179
- ..._opts,
1180
- ignored: _opts.ignored ? arrify$1(_opts.ignored) : arrify$1([]),
1181
- awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === "object" ? {
1182
- ...DEF_AWF,
1183
- ...awf
1184
- } : false
1185
- };
1186
- if (isIBMi$1) opts.usePolling = true;
1187
- if (opts.atomic === void 0) opts.atomic = !opts.usePolling;
1188
- const envPoll = process.env.CHOKIDAR_USEPOLLING;
1189
- if (envPoll !== void 0) {
1190
- const envLower = envPoll.toLowerCase();
1191
- if (envLower === "false" || envLower === "0") opts.usePolling = false;
1192
- else if (envLower === "true" || envLower === "1") opts.usePolling = true;
1193
- else opts.usePolling = !!envLower;
1194
- }
1195
- const envInterval = process.env.CHOKIDAR_INTERVAL;
1196
- if (envInterval) opts.interval = Number.parseInt(envInterval, 10);
1197
- let readyCalls = 0;
1198
- this._emitReady = () => {
1199
- readyCalls++;
1200
- if (readyCalls >= this._readyCount) {
1201
- this._emitReady = EMPTY_FN$1;
1202
- this._readyEmitted = true;
1203
- process.nextTick(() => this.emit(EVENTS$1.READY));
1204
- }
1205
- };
1206
- this._emitRaw = (...args) => this.emit(EVENTS$1.RAW, ...args);
1207
- this._boundRemove = this._remove.bind(this);
1208
- this.options = opts;
1209
- this._nodeFsHandler = new NodeFsHandler$1(this);
1210
- Object.freeze(opts);
1211
- }
1212
- _addIgnoredPath(matcher) {
1213
- if (isMatcherObject$1(matcher)) {
1214
- for (const ignored of this._ignoredPaths) if (isMatcherObject$1(ignored) && ignored.path === matcher.path && ignored.recursive === matcher.recursive) return;
1215
- }
1216
- this._ignoredPaths.add(matcher);
1217
- }
1218
- _removeIgnoredPath(matcher) {
1219
- this._ignoredPaths.delete(matcher);
1220
- if (typeof matcher === "string") {
1221
- for (const ignored of this._ignoredPaths) if (isMatcherObject$1(ignored) && ignored.path === matcher) this._ignoredPaths.delete(ignored);
1222
- }
1223
- }
1224
- /**
1225
- * Adds paths to be watched on an existing FSWatcher instance.
1226
- * @param paths_ file or file list. Other arguments are unused
1227
- */
1228
- add(paths_, _origAdd, _internal) {
1229
- const { cwd } = this.options;
1230
- this.closed = false;
1231
- this._closePromise = void 0;
1232
- let paths = unifyPaths$1(paths_);
1233
- if (cwd) paths = paths.map((path$2) => {
1234
- return getAbsolutePath$1(path$2, cwd);
1235
- });
1236
- paths.forEach((path$2) => {
1237
- this._removeIgnoredPath(path$2);
1238
- });
1239
- this._userIgnored = void 0;
1240
- if (!this._readyCount) this._readyCount = 0;
1241
- this._readyCount += paths.length;
1242
- Promise.all(paths.map(async (path$2) => {
1243
- const res = await this._nodeFsHandler._addToNodeFs(path$2, !_internal, void 0, 0, _origAdd);
1244
- if (res) this._emitReady();
1245
- return res;
1246
- })).then((results) => {
1247
- if (this.closed) return;
1248
- results.forEach((item) => {
1249
- if (item) this.add(sp.dirname(item), sp.basename(_origAdd || item));
1250
- });
1251
- });
1252
- return this;
1253
- }
1254
- /**
1255
- * Close watchers or start ignoring events from specified paths.
1256
- */
1257
- unwatch(paths_) {
1258
- if (this.closed) return this;
1259
- const paths = unifyPaths$1(paths_);
1260
- const { cwd } = this.options;
1261
- paths.forEach((path$2) => {
1262
- if (!sp.isAbsolute(path$2) && !this._closers.has(path$2)) {
1263
- if (cwd) path$2 = sp.join(cwd, path$2);
1264
- path$2 = sp.resolve(path$2);
1265
- }
1266
- this._closePath(path$2);
1267
- this._addIgnoredPath(path$2);
1268
- if (this._watched.has(path$2)) this._addIgnoredPath({
1269
- path: path$2,
1270
- recursive: true
1271
- });
1272
- this._userIgnored = void 0;
1273
- });
1274
- return this;
1275
- }
1276
- /**
1277
- * Close watchers and remove all listeners from watched paths.
1278
- */
1279
- close() {
1280
- if (this._closePromise) return this._closePromise;
1281
- this.closed = true;
1282
- this.removeAllListeners();
1283
- const closers = [];
1284
- this._closers.forEach((closerList) => closerList.forEach((closer) => {
1285
- const promise = closer();
1286
- if (promise instanceof Promise) closers.push(promise);
1287
- }));
1288
- this._streams.forEach((stream) => stream.destroy());
1289
- this._userIgnored = void 0;
1290
- this._readyCount = 0;
1291
- this._readyEmitted = false;
1292
- this._watched.forEach((dirent) => dirent.dispose());
1293
- this._closers.clear();
1294
- this._watched.clear();
1295
- this._streams.clear();
1296
- this._symlinkPaths.clear();
1297
- this._throttled.clear();
1298
- this._closePromise = closers.length ? Promise.all(closers).then(() => void 0) : Promise.resolve();
1299
- return this._closePromise;
1300
- }
1301
- /**
1302
- * Expose list of watched paths
1303
- * @returns for chaining
1304
- */
1305
- getWatched() {
1306
- const watchList = {};
1307
- this._watched.forEach((entry, dir) => {
1308
- const index = (this.options.cwd ? sp.relative(this.options.cwd, dir) : dir) || ONE_DOT$1;
1309
- watchList[index] = entry.getChildren().sort();
1310
- });
1311
- return watchList;
1312
- }
1313
- emitWithAll(event, args) {
1314
- this.emit(event, ...args);
1315
- if (event !== EVENTS$1.ERROR) this.emit(EVENTS$1.ALL, event, ...args);
1316
- }
1317
- /**
1318
- * Normalize and emit events.
1319
- * Calling _emit DOES NOT MEAN emit() would be called!
1320
- * @param event Type of event
1321
- * @param path File or directory path
1322
- * @param stats arguments to be passed with event
1323
- * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
1324
- */
1325
- async _emit(event, path$2, stats) {
1326
- if (this.closed) return;
1327
- const opts = this.options;
1328
- if (isWindows$1) path$2 = sp.normalize(path$2);
1329
- if (opts.cwd) path$2 = sp.relative(opts.cwd, path$2);
1330
- const args = [path$2];
1331
- if (stats != null) args.push(stats);
1332
- const awf = opts.awaitWriteFinish;
1333
- let pw;
1334
- if (awf && (pw = this._pendingWrites.get(path$2))) {
1335
- pw.lastChange = /* @__PURE__ */ new Date();
1336
- return this;
1337
- }
1338
- if (opts.atomic) {
1339
- if (event === EVENTS$1.UNLINK) {
1340
- this._pendingUnlinks.set(path$2, [event, ...args]);
1341
- setTimeout(() => {
1342
- this._pendingUnlinks.forEach((entry, path$3) => {
1343
- this.emit(...entry);
1344
- this.emit(EVENTS$1.ALL, ...entry);
1345
- this._pendingUnlinks.delete(path$3);
1346
- });
1347
- }, typeof opts.atomic === "number" ? opts.atomic : 100);
1348
- return this;
1349
- }
1350
- if (event === EVENTS$1.ADD && this._pendingUnlinks.has(path$2)) {
1351
- event = EVENTS$1.CHANGE;
1352
- this._pendingUnlinks.delete(path$2);
1353
- }
1354
- }
1355
- if (awf && (event === EVENTS$1.ADD || event === EVENTS$1.CHANGE) && this._readyEmitted) {
1356
- const awfEmit = (err, stats$1) => {
1357
- if (err) {
1358
- event = EVENTS$1.ERROR;
1359
- args[0] = err;
1360
- this.emitWithAll(event, args);
1361
- } else if (stats$1) {
1362
- if (args.length > 1) args[1] = stats$1;
1363
- else args.push(stats$1);
1364
- this.emitWithAll(event, args);
1365
- }
1366
- };
1367
- this._awaitWriteFinish(path$2, awf.stabilityThreshold, event, awfEmit);
1368
- return this;
1369
- }
1370
- if (event === EVENTS$1.CHANGE) {
1371
- if (!this._throttle(EVENTS$1.CHANGE, path$2, 50)) return this;
1372
- }
1373
- if (opts.alwaysStat && stats === void 0 && (event === EVENTS$1.ADD || event === EVENTS$1.ADD_DIR || event === EVENTS$1.CHANGE)) {
1374
- const fullPath = opts.cwd ? sp.join(opts.cwd, path$2) : path$2;
1375
- let stats$1;
1376
- try {
1377
- stats$1 = await stat$1(fullPath);
1378
- } catch (err) {}
1379
- if (!stats$1 || this.closed) return;
1380
- args.push(stats$1);
1381
- }
1382
- this.emitWithAll(event, args);
1383
- return this;
1384
- }
1385
- /**
1386
- * Common handler for errors
1387
- * @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
1388
- */
1389
- _handleError(error) {
1390
- const code = error && error.code;
1391
- if (error && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) this.emit(EVENTS$1.ERROR, error);
1392
- return error || this.closed;
1393
- }
1394
- /**
1395
- * Helper utility for throttling
1396
- * @param actionType type being throttled
1397
- * @param path being acted upon
1398
- * @param timeout duration of time to suppress duplicate actions
1399
- * @returns tracking object or false if action should be suppressed
1400
- */
1401
- _throttle(actionType, path$2, timeout) {
1402
- if (!this._throttled.has(actionType)) this._throttled.set(actionType, /* @__PURE__ */ new Map());
1403
- const action = this._throttled.get(actionType);
1404
- if (!action) throw new Error("invalid throttle");
1405
- const actionPath = action.get(path$2);
1406
- if (actionPath) {
1407
- actionPath.count++;
1408
- return false;
1409
- }
1410
- let timeoutObject;
1411
- const clear = () => {
1412
- const item = action.get(path$2);
1413
- const count = item ? item.count : 0;
1414
- action.delete(path$2);
1415
- clearTimeout(timeoutObject);
1416
- if (item) clearTimeout(item.timeoutObject);
1417
- return count;
1418
- };
1419
- timeoutObject = setTimeout(clear, timeout);
1420
- const thr = {
1421
- timeoutObject,
1422
- clear,
1423
- count: 0
1424
- };
1425
- action.set(path$2, thr);
1426
- return thr;
1427
- }
1428
- _incrReadyCount() {
1429
- return this._readyCount++;
1430
- }
1431
- /**
1432
- * Awaits write operation to finish.
1433
- * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
1434
- * @param path being acted upon
1435
- * @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
1436
- * @param event
1437
- * @param awfEmit Callback to be called when ready for event to be emitted.
1438
- */
1439
- _awaitWriteFinish(path$2, threshold, event, awfEmit) {
1440
- const awf = this.options.awaitWriteFinish;
1441
- if (typeof awf !== "object") return;
1442
- const pollInterval = awf.pollInterval;
1443
- let timeoutHandler;
1444
- let fullPath = path$2;
1445
- if (this.options.cwd && !sp.isAbsolute(path$2)) fullPath = sp.join(this.options.cwd, path$2);
1446
- const now = /* @__PURE__ */ new Date();
1447
- const writes = this._pendingWrites;
1448
- function awaitWriteFinishFn(prevStat) {
1449
- stat(fullPath, (err, curStat) => {
1450
- if (err || !writes.has(path$2)) {
1451
- if (err && err.code !== "ENOENT") awfEmit(err);
1452
- return;
1453
- }
1454
- const now$1 = Number(/* @__PURE__ */ new Date());
1455
- if (prevStat && curStat.size !== prevStat.size) writes.get(path$2).lastChange = now$1;
1456
- if (now$1 - writes.get(path$2).lastChange >= threshold) {
1457
- writes.delete(path$2);
1458
- awfEmit(void 0, curStat);
1459
- } else timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
1460
- });
1461
- }
1462
- if (!writes.has(path$2)) {
1463
- writes.set(path$2, {
1464
- lastChange: now,
1465
- cancelWait: () => {
1466
- writes.delete(path$2);
1467
- clearTimeout(timeoutHandler);
1468
- return event;
1469
- }
1470
- });
1471
- timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
1472
- }
1473
- }
1474
- /**
1475
- * Determines whether user has asked to ignore this path.
1476
- */
1477
- _isIgnored(path$2, stats) {
1478
- if (this.options.atomic && DOT_RE$1.test(path$2)) return true;
1479
- if (!this._userIgnored) {
1480
- const { cwd } = this.options;
1481
- const ignored = (this.options.ignored || []).map(normalizeIgnored$1(cwd));
1482
- this._userIgnored = anymatch$1([...[...this._ignoredPaths].map(normalizeIgnored$1(cwd)), ...ignored], void 0);
1483
- }
1484
- return this._userIgnored(path$2, stats);
1485
- }
1486
- _isntIgnored(path$2, stat$4) {
1487
- return !this._isIgnored(path$2, stat$4);
1488
- }
1489
- /**
1490
- * Provides a set of common helpers and properties relating to symlink handling.
1491
- * @param path file or directory pattern being watched
1492
- */
1493
- _getWatchHelpers(path$2) {
1494
- return new WatchHelper$1(path$2, this.options.followSymlinks, this);
1495
- }
1496
- /**
1497
- * Provides directory tracking objects
1498
- * @param directory path of the directory
1499
- */
1500
- _getWatchedDir(directory) {
1501
- const dir = sp.resolve(directory);
1502
- if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry$1(dir, this._boundRemove));
1503
- return this._watched.get(dir);
1504
- }
1505
- /**
1506
- * Check for read permissions: https://stackoverflow.com/a/11781404/1358405
1507
- */
1508
- _hasReadPermissions(stats) {
1509
- if (this.options.ignorePermissionErrors) return true;
1510
- return Boolean(Number(stats.mode) & 256);
1511
- }
1512
- /**
1513
- * Handles emitting unlink events for
1514
- * files and directories, and via recursion, for
1515
- * files and directories within directories that are unlinked
1516
- * @param directory within which the following item is located
1517
- * @param item base path of item/directory
1518
- */
1519
- _remove(directory, item, isDirectory) {
1520
- const path$2 = sp.join(directory, item);
1521
- const fullPath = sp.resolve(path$2);
1522
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path$2) || this._watched.has(fullPath);
1523
- if (!this._throttle("remove", path$2, 100)) return;
1524
- if (!isDirectory && this._watched.size === 1) this.add(directory, item, true);
1525
- this._getWatchedDir(path$2).getChildren().forEach((nested) => this._remove(path$2, nested));
1526
- const parent = this._getWatchedDir(directory);
1527
- const wasTracked = parent.has(item);
1528
- parent.remove(item);
1529
- if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
1530
- let relPath = path$2;
1531
- if (this.options.cwd) relPath = sp.relative(this.options.cwd, path$2);
1532
- if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
1533
- if (this._pendingWrites.get(relPath).cancelWait() === EVENTS$1.ADD) return;
1534
- }
1535
- this._watched.delete(path$2);
1536
- this._watched.delete(fullPath);
1537
- const eventName = isDirectory ? EVENTS$1.UNLINK_DIR : EVENTS$1.UNLINK;
1538
- if (wasTracked && !this._isIgnored(path$2)) this._emit(eventName, path$2);
1539
- this._closePath(path$2);
1540
- }
1541
- /**
1542
- * Closes all watchers for a path
1543
- */
1544
- _closePath(path$2) {
1545
- this._closeFile(path$2);
1546
- const dir = sp.dirname(path$2);
1547
- this._getWatchedDir(dir).remove(sp.basename(path$2));
1548
- }
1549
- /**
1550
- * Closes only file-specific watchers
1551
- */
1552
- _closeFile(path$2) {
1553
- const closers = this._closers.get(path$2);
1554
- if (!closers) return;
1555
- closers.forEach((closer) => closer());
1556
- this._closers.delete(path$2);
1557
- }
1558
- _addPathCloser(path$2, closer) {
1559
- if (!closer) return;
1560
- let list = this._closers.get(path$2);
1561
- if (!list) {
1562
- list = [];
1563
- this._closers.set(path$2, list);
1564
- }
1565
- list.push(closer);
1566
- }
1567
- _readdirp(root, opts) {
1568
- if (this.closed) return;
1569
- let stream = readdirp$1(root, {
1570
- type: EVENTS$1.ALL,
1571
- alwaysStat: true,
1572
- lstat: true,
1573
- ...opts,
1574
- depth: 0
1575
- });
1576
- this._streams.add(stream);
1577
- stream.once(STR_CLOSE$1, () => {
1578
- stream = void 0;
1579
- });
1580
- stream.once(STR_END$1, () => {
1581
- if (stream) {
1582
- this._streams.delete(stream);
1583
- stream = void 0;
1584
- }
1585
- });
1586
- return stream;
1587
- }
1588
- };
1589
- /**
1590
- * Instantiates watcher with paths to be tracked.
1591
- * @param paths file / directory paths
1592
- * @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
1593
- * @returns an instance of FSWatcher for chaining.
1594
- * @example
1595
- * const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
1596
- * watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
1597
- */
1598
- function watch$3(paths, options = {}) {
1599
- const watcher = new FSWatcher$1(options);
1600
- watcher.add(paths);
1601
- return watcher;
1602
- }
1603
-
1604
- //#endregion
1605
- //#region node_modules/.pnpm/readdirp@4.1.2/node_modules/readdirp/esm/index.js
1606
10
  const EntryTypes = {
1607
11
  FILE_TYPE: "files",
1608
12
  DIR_TYPE: "directories",
@@ -1662,6 +66,20 @@ const normalizeFilter = (filter) => {
1662
66
  };
1663
67
  /** Readable readdir stream, emitting new files as they're being listed. */
1664
68
  var ReaddirpStream = class extends Readable {
69
+ parents;
70
+ reading;
71
+ parent;
72
+ _stat;
73
+ _maxDepth;
74
+ _wantsDir;
75
+ _wantsFile;
76
+ _wantsEverything;
77
+ _root;
78
+ _isDirent;
79
+ _statsProp;
80
+ _rdOptions;
81
+ _fileFilter;
82
+ _directoryFilter;
1665
83
  constructor(options = {}) {
1666
84
  super({
1667
85
  objectMode: true,
@@ -1672,16 +90,16 @@ var ReaddirpStream = class extends Readable {
1672
90
  ...defaultOptions,
1673
91
  ...options
1674
92
  };
1675
- const { root, type: type$2 } = opts;
93
+ const { root, type: type$1 } = opts;
1676
94
  this._fileFilter = normalizeFilter(opts.fileFilter);
1677
95
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
1678
96
  const statMethod = opts.lstat ? lstat : stat$1;
1679
- if (wantBigintFsStats) this._stat = (path$2) => statMethod(path$2, { bigint: true });
97
+ if (wantBigintFsStats) this._stat = (path$1) => statMethod(path$1, { bigint: true });
1680
98
  else this._stat = statMethod;
1681
- this._maxDepth = opts.depth ?? defaultOptions.depth;
1682
- this._wantsDir = type$2 ? DIR_TYPES.has(type$2) : false;
1683
- this._wantsFile = type$2 ? FILE_TYPES.has(type$2) : false;
1684
- this._wantsEverything = type$2 === EntryTypes.EVERYTHING_TYPE;
99
+ this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
100
+ this._wantsDir = type$1 ? DIR_TYPES.has(type$1) : false;
101
+ this._wantsFile = type$1 ? FILE_TYPES.has(type$1) : false;
102
+ this._wantsEverything = type$1 === EntryTypes.EVERYTHING_TYPE;
1685
103
  this._root = resolve(root);
1686
104
  this._isDirent = !opts.alwaysStat;
1687
105
  this._statsProp = this._isDirent ? "dirent" : "stats";
@@ -1701,8 +119,8 @@ var ReaddirpStream = class extends Readable {
1701
119
  const par = this.parent;
1702
120
  const fil = par && par.files;
1703
121
  if (fil && fil.length > 0) {
1704
- const { path: path$2, depth } = par;
1705
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path$2));
122
+ const { path: path$1, depth } = par;
123
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path$1));
1706
124
  const awaited = await Promise.all(slice);
1707
125
  for (const entry of awaited) {
1708
126
  if (!entry) continue;
@@ -1737,28 +155,28 @@ var ReaddirpStream = class extends Readable {
1737
155
  this.reading = false;
1738
156
  }
1739
157
  }
1740
- async _exploreDir(path$2, depth) {
158
+ async _exploreDir(path$1, depth) {
1741
159
  let files;
1742
160
  try {
1743
- files = await readdir(path$2, this._rdOptions);
161
+ files = await readdir(path$1, this._rdOptions);
1744
162
  } catch (error) {
1745
163
  this._onError(error);
1746
164
  }
1747
165
  return {
1748
166
  files,
1749
167
  depth,
1750
- path: path$2
168
+ path: path$1
1751
169
  };
1752
170
  }
1753
- async _formatEntry(dirent, path$2) {
171
+ async _formatEntry(dirent, path$1) {
1754
172
  let entry;
1755
- const basename$2 = this._isDirent ? dirent.name : dirent;
173
+ const basename$1 = this._isDirent ? dirent.name : dirent;
1756
174
  try {
1757
- const fullPath = resolve(join(path$2, basename$2));
175
+ const fullPath = resolve(join(path$1, basename$1));
1758
176
  entry = {
1759
177
  path: relative(this._root, fullPath),
1760
178
  fullPath,
1761
- basename: basename$2
179
+ basename: basename$1
1762
180
  };
1763
181
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
1764
182
  } catch (err) {
@@ -1809,18 +227,18 @@ var ReaddirpStream = class extends Readable {
1809
227
  * @param options Options to specify root (start directory), filters and recursion depth
1810
228
  */
1811
229
  function readdirp(root, options = {}) {
1812
- let type$2 = options.entryType || options.type;
1813
- if (type$2 === "both") type$2 = EntryTypes.FILE_DIR_TYPE;
1814
- if (type$2) options.type = type$2;
230
+ let type$1 = options.entryType || options.type;
231
+ if (type$1 === "both") type$1 = EntryTypes.FILE_DIR_TYPE;
232
+ if (type$1) options.type = type$1;
1815
233
  if (!root) throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
1816
234
  else if (typeof root !== "string") throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
1817
- else if (type$2 && !ALL_TYPES.includes(type$2)) throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
235
+ else if (type$1 && !ALL_TYPES.includes(type$1)) throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
1818
236
  options.root = root;
1819
237
  return new ReaddirpStream(options);
1820
238
  }
1821
239
 
1822
240
  //#endregion
1823
- //#region node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/handler.js
241
+ //#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/handler.js
1824
242
  const STR_DATA = "data";
1825
243
  const STR_END = "end";
1826
244
  const STR_CLOSE = "close";
@@ -1830,7 +248,7 @@ const isWindows = pl === "win32";
1830
248
  const isMacos = pl === "darwin";
1831
249
  const isLinux = pl === "linux";
1832
250
  const isFreeBSD = pl === "freebsd";
1833
- const isIBMi = type$1() === "OS400";
251
+ const isIBMi = type() === "OS400";
1834
252
  const EVENTS = {
1835
253
  ALL: "all",
1836
254
  READY: "ready",
@@ -1845,8 +263,8 @@ const EVENTS = {
1845
263
  const EV = EVENTS;
1846
264
  const THROTTLE_MODE_WATCH = "watch";
1847
265
  const statMethods = {
1848
- lstat: lstat$1,
1849
- stat: stat$3
266
+ lstat,
267
+ stat: stat$1
1850
268
  };
1851
269
  const KEY_LISTENERS = "listeners";
1852
270
  const KEY_ERR = "errHandlers";
@@ -2119,7 +537,7 @@ const binaryExtensions = new Set([
2119
537
  "zip",
2120
538
  "zipx"
2121
539
  ]);
2122
- const isBinaryPath = (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase());
540
+ const isBinaryPath = (filePath) => binaryExtensions.has(sp.extname(filePath).slice(1).toLowerCase());
2123
541
  const foreach = (val, fn) => {
2124
542
  if (val instanceof Set) val.forEach(fn);
2125
543
  else fn(val);
@@ -2150,14 +568,14 @@ const FsWatchInstances = /* @__PURE__ */ new Map();
2150
568
  * @param emitRaw emits raw event data
2151
569
  * @returns {NativeFsWatcher}
2152
570
  */
2153
- function createFsWatchInstance(path$2, options, listener, errHandler, emitRaw) {
571
+ function createFsWatchInstance(path$1, options, listener, errHandler, emitRaw) {
2154
572
  const handleEvent = (rawEvent, evPath) => {
2155
- listener(path$2);
2156
- emitRaw(rawEvent, evPath, { watchedPath: path$2 });
2157
- if (evPath && path$2 !== evPath) fsWatchBroadcast(sysPath.resolve(path$2, evPath), KEY_LISTENERS, sysPath.join(path$2, evPath));
573
+ listener(path$1);
574
+ emitRaw(rawEvent, evPath, { watchedPath: path$1 });
575
+ if (evPath && path$1 !== evPath) fsWatchBroadcast(sp.resolve(path$1, evPath), KEY_LISTENERS, sp.join(path$1, evPath));
2158
576
  };
2159
577
  try {
2160
- return watch$1(path$2, { persistent: options.persistent }, handleEvent);
578
+ return watch(path$1, { persistent: options.persistent }, handleEvent);
2161
579
  } catch (error) {
2162
580
  errHandler(error);
2163
581
  return;
@@ -2182,12 +600,12 @@ const fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
2182
600
  * @param options to be passed to fs_watch
2183
601
  * @param handlers container for event listener functions
2184
602
  */
2185
- const setFsWatchListener = (path$2, fullPath, options, handlers) => {
603
+ const setFsWatchListener = (path$1, fullPath, options, handlers) => {
2186
604
  const { listener, errHandler, rawEmitter } = handlers;
2187
605
  let cont = FsWatchInstances.get(fullPath);
2188
606
  let watcher;
2189
607
  if (!options.persistent) {
2190
- watcher = createFsWatchInstance(path$2, options, listener, errHandler, rawEmitter);
608
+ watcher = createFsWatchInstance(path$1, options, listener, errHandler, rawEmitter);
2191
609
  if (!watcher) return;
2192
610
  return watcher.close.bind(watcher);
2193
611
  }
@@ -2196,13 +614,13 @@ const setFsWatchListener = (path$2, fullPath, options, handlers) => {
2196
614
  addAndConvert(cont, KEY_ERR, errHandler);
2197
615
  addAndConvert(cont, KEY_RAW, rawEmitter);
2198
616
  } else {
2199
- watcher = createFsWatchInstance(path$2, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
617
+ watcher = createFsWatchInstance(path$1, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
2200
618
  if (!watcher) return;
2201
619
  watcher.on(EV.ERROR, async (error) => {
2202
620
  const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
2203
621
  if (cont) cont.watcherUnusable = true;
2204
622
  if (isWindows && error.code === "EPERM") try {
2205
- await (await open$1(path$2, "r")).close();
623
+ await (await open(path$1, "r")).close();
2206
624
  broadcastErr(error);
2207
625
  } catch (err) {}
2208
626
  else broadcastErr(error);
@@ -2238,12 +656,12 @@ const FsWatchFileInstances = /* @__PURE__ */ new Map();
2238
656
  * @param handlers container for event listener functions
2239
657
  * @returns closer
2240
658
  */
2241
- const setFsWatchFileListener = (path$2, fullPath, options, handlers) => {
659
+ const setFsWatchFileListener = (path$1, fullPath, options, handlers) => {
2242
660
  const { listener, rawEmitter } = handlers;
2243
661
  let cont = FsWatchFileInstances.get(fullPath);
2244
662
  const copts = cont && cont.options;
2245
663
  if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
2246
- unwatchFile$1(fullPath);
664
+ unwatchFile(fullPath);
2247
665
  cont = void 0;
2248
666
  }
2249
667
  if (cont) {
@@ -2254,7 +672,7 @@ const setFsWatchFileListener = (path$2, fullPath, options, handlers) => {
2254
672
  listeners: listener,
2255
673
  rawEmitters: rawEmitter,
2256
674
  options,
2257
- watcher: watchFile$1(fullPath, options, (curr, prev) => {
675
+ watcher: watchFile(fullPath, options, (curr, prev) => {
2258
676
  foreach(cont.rawEmitters, (rawEmitter$1) => {
2259
677
  rawEmitter$1(EV.CHANGE, fullPath, {
2260
678
  curr,
@@ -2262,7 +680,7 @@ const setFsWatchFileListener = (path$2, fullPath, options, handlers) => {
2262
680
  });
2263
681
  });
2264
682
  const currmtime = curr.mtimeMs;
2265
- if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach(cont.listeners, (listener$1) => listener$1(path$2, curr));
683
+ if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach(cont.listeners, (listener$1) => listener$1(path$1, curr));
2266
684
  })
2267
685
  };
2268
686
  FsWatchFileInstances.set(fullPath, cont);
@@ -2272,7 +690,7 @@ const setFsWatchFileListener = (path$2, fullPath, options, handlers) => {
2272
690
  delFromSet(cont, KEY_RAW, rawEmitter);
2273
691
  if (isEmptySet(cont.listeners)) {
2274
692
  FsWatchFileInstances.delete(fullPath);
2275
- unwatchFile$1(fullPath);
693
+ unwatchFile(fullPath);
2276
694
  cont.options = cont.watcher = void 0;
2277
695
  Object.freeze(cont);
2278
696
  }
@@ -2282,6 +700,8 @@ const setFsWatchFileListener = (path$2, fullPath, options, handlers) => {
2282
700
  * @mixin
2283
701
  */
2284
702
  var NodeFsHandler = class {
703
+ fsw;
704
+ _boundHandleError;
2285
705
  constructor(fsW) {
2286
706
  this.fsw = fsW;
2287
707
  this._boundHandleError = (error) => fsW._handleError(error);
@@ -2292,22 +712,22 @@ var NodeFsHandler = class {
2292
712
  * @param listener on fs change
2293
713
  * @returns closer for the watcher instance
2294
714
  */
2295
- _watchWithNodeFs(path$2, listener) {
715
+ _watchWithNodeFs(path$1, listener) {
2296
716
  const opts = this.fsw.options;
2297
- const directory = sysPath.dirname(path$2);
2298
- const basename$2 = sysPath.basename(path$2);
2299
- this.fsw._getWatchedDir(directory).add(basename$2);
2300
- const absolutePath = sysPath.resolve(path$2);
717
+ const directory = sp.dirname(path$1);
718
+ const basename$1 = sp.basename(path$1);
719
+ this.fsw._getWatchedDir(directory).add(basename$1);
720
+ const absolutePath = sp.resolve(path$1);
2301
721
  const options = { persistent: opts.persistent };
2302
722
  if (!listener) listener = EMPTY_FN;
2303
723
  let closer;
2304
724
  if (opts.usePolling) {
2305
- options.interval = opts.interval !== opts.binaryInterval && isBinaryPath(basename$2) ? opts.binaryInterval : opts.interval;
2306
- closer = setFsWatchFileListener(path$2, absolutePath, options, {
725
+ options.interval = opts.interval !== opts.binaryInterval && isBinaryPath(basename$1) ? opts.binaryInterval : opts.interval;
726
+ closer = setFsWatchFileListener(path$1, absolutePath, options, {
2307
727
  listener,
2308
728
  rawEmitter: this.fsw._emitRaw
2309
729
  });
2310
- } else closer = setFsWatchListener(path$2, absolutePath, options, {
730
+ } else closer = setFsWatchListener(path$1, absolutePath, options, {
2311
731
  listener,
2312
732
  errHandler: this._boundHandleError,
2313
733
  rawEmitter: this.fsw._emitRaw
@@ -2320,29 +740,29 @@ var NodeFsHandler = class {
2320
740
  */
2321
741
  _handleFile(file, stats, initialAdd) {
2322
742
  if (this.fsw.closed) return;
2323
- const dirname$2 = sysPath.dirname(file);
2324
- const basename$2 = sysPath.basename(file);
2325
- const parent = this.fsw._getWatchedDir(dirname$2);
743
+ const dirname$1 = sp.dirname(file);
744
+ const basename$1 = sp.basename(file);
745
+ const parent = this.fsw._getWatchedDir(dirname$1);
2326
746
  let prevStats = stats;
2327
- if (parent.has(basename$2)) return;
2328
- const listener = async (path$2, newStats) => {
747
+ if (parent.has(basename$1)) return;
748
+ const listener = async (path$1, newStats) => {
2329
749
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
2330
750
  if (!newStats || newStats.mtimeMs === 0) try {
2331
- const newStats$1 = await stat$3(file);
751
+ const newStats$1 = await stat$1(file);
2332
752
  if (this.fsw.closed) return;
2333
753
  const at = newStats$1.atimeMs;
2334
754
  const mt = newStats$1.mtimeMs;
2335
755
  if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV.CHANGE, file, newStats$1);
2336
756
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats$1.ino) {
2337
- this.fsw._closeFile(path$2);
757
+ this.fsw._closeFile(path$1);
2338
758
  prevStats = newStats$1;
2339
759
  const closer$1 = this._watchWithNodeFs(file, listener);
2340
- if (closer$1) this.fsw._addPathCloser(path$2, closer$1);
760
+ if (closer$1) this.fsw._addPathCloser(path$1, closer$1);
2341
761
  } else prevStats = newStats$1;
2342
762
  } catch (error) {
2343
- this.fsw._remove(dirname$2, basename$2);
763
+ this.fsw._remove(dirname$1, basename$1);
2344
764
  }
2345
- else if (parent.has(basename$2)) {
765
+ else if (parent.has(basename$1)) {
2346
766
  const at = newStats.atimeMs;
2347
767
  const mt = newStats.mtimeMs;
2348
768
  if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV.CHANGE, file, newStats);
@@ -2364,7 +784,7 @@ var NodeFsHandler = class {
2364
784
  * @param item basename of this item
2365
785
  * @returns true if no more processing is needed for this entry.
2366
786
  */
2367
- async _handleSymlink(entry, directory, path$2, item) {
787
+ async _handleSymlink(entry, directory, path$1, item) {
2368
788
  if (this.fsw.closed) return;
2369
789
  const full = entry.fullPath;
2370
790
  const dir = this.fsw._getWatchedDir(directory);
@@ -2372,7 +792,7 @@ var NodeFsHandler = class {
2372
792
  this.fsw._incrReadyCount();
2373
793
  let linkPath;
2374
794
  try {
2375
- linkPath = await realpath$1(path$2);
795
+ linkPath = await realpath(path$1);
2376
796
  } catch (e) {
2377
797
  this.fsw._emitReady();
2378
798
  return true;
@@ -2381,12 +801,12 @@ var NodeFsHandler = class {
2381
801
  if (dir.has(item)) {
2382
802
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
2383
803
  this.fsw._symlinkPaths.set(full, linkPath);
2384
- this.fsw._emit(EV.CHANGE, path$2, entry.stats);
804
+ this.fsw._emit(EV.CHANGE, path$1, entry.stats);
2385
805
  }
2386
806
  } else {
2387
807
  dir.add(item);
2388
808
  this.fsw._symlinkPaths.set(full, linkPath);
2389
- this.fsw._emit(EV.ADD, path$2, entry.stats);
809
+ this.fsw._emit(EV.ADD, path$1, entry.stats);
2390
810
  }
2391
811
  this.fsw._emitReady();
2392
812
  return true;
@@ -2395,8 +815,9 @@ var NodeFsHandler = class {
2395
815
  this.fsw._symlinkPaths.set(full, true);
2396
816
  }
2397
817
  _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
2398
- directory = sysPath.join(directory, "");
2399
- throttler = this.fsw._throttle("readdir", directory, 1e3);
818
+ directory = sp.join(directory, "");
819
+ const throttleKey = target ? `${directory}:${target}` : directory;
820
+ throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
2400
821
  if (!throttler) return;
2401
822
  const previous = this.fsw._getWatchedDir(wh.path);
2402
823
  const current = /* @__PURE__ */ new Set();
@@ -2411,20 +832,20 @@ var NodeFsHandler = class {
2411
832
  return;
2412
833
  }
2413
834
  const item = entry.path;
2414
- let path$2 = sysPath.join(directory, item);
835
+ let path$1 = sp.join(directory, item);
2415
836
  current.add(item);
2416
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path$2, item)) return;
837
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path$1, item)) return;
2417
838
  if (this.fsw.closed) {
2418
839
  stream = void 0;
2419
840
  return;
2420
841
  }
2421
842
  if (item === target || !target && !previous.has(item)) {
2422
843
  this.fsw._incrReadyCount();
2423
- path$2 = sysPath.join(dir, sysPath.relative(dir, path$2));
2424
- this._addToNodeFs(path$2, initialAdd, wh, depth + 1);
844
+ path$1 = sp.join(dir, sp.relative(dir, path$1));
845
+ this._addToNodeFs(path$1, initialAdd, wh, depth + 1);
2425
846
  }
2426
847
  }).on(EV.ERROR, this._boundHandleError);
2427
- return new Promise((resolve$2, reject) => {
848
+ return new Promise((resolve$1, reject) => {
2428
849
  if (!stream) return reject();
2429
850
  stream.once(STR_END, () => {
2430
851
  if (this.fsw.closed) {
@@ -2432,7 +853,7 @@ var NodeFsHandler = class {
2432
853
  return;
2433
854
  }
2434
855
  const wasThrottled = throttler ? throttler.clear() : false;
2435
- resolve$2(void 0);
856
+ resolve$1(void 0);
2436
857
  previous.getChildren().filter((item) => {
2437
858
  return item !== directory && !current.has(item);
2438
859
  }).forEach((item) => {
@@ -2454,16 +875,16 @@ var NodeFsHandler = class {
2454
875
  * @param realpath
2455
876
  * @returns closer for the watcher instance.
2456
877
  */
2457
- async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath$2) {
2458
- const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
2459
- const tracked = parentDir.has(sysPath.basename(dir));
878
+ async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath$1) {
879
+ const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
880
+ const tracked = parentDir.has(sp.basename(dir));
2460
881
  if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
2461
- parentDir.add(sysPath.basename(dir));
882
+ parentDir.add(sp.basename(dir));
2462
883
  this.fsw._getWatchedDir(dir);
2463
884
  let throttler;
2464
885
  let closer;
2465
886
  const oDepth = this.fsw.options.depth;
2466
- if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath$2)) {
887
+ if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath$1)) {
2467
888
  if (!target) {
2468
889
  await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
2469
890
  if (this.fsw.closed) return;
@@ -2484,13 +905,13 @@ var NodeFsHandler = class {
2484
905
  * @param depth Child path actually targeted for watch
2485
906
  * @param target Child path actually targeted for watch
2486
907
  */
2487
- async _addToNodeFs(path$2, initialAdd, priorWh, depth, target) {
908
+ async _addToNodeFs(path$1, initialAdd, priorWh, depth, target) {
2488
909
  const ready = this.fsw._emitReady;
2489
- if (this.fsw._isIgnored(path$2) || this.fsw.closed) {
910
+ if (this.fsw._isIgnored(path$1) || this.fsw.closed) {
2490
911
  ready();
2491
912
  return false;
2492
913
  }
2493
- const wh = this.fsw._getWatchHelpers(path$2);
914
+ const wh = this.fsw._getWatchHelpers(path$1);
2494
915
  if (priorWh) {
2495
916
  wh.filterPath = (entry) => priorWh.filterPath(entry);
2496
917
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -2505,36 +926,36 @@ var NodeFsHandler = class {
2505
926
  const follow = this.fsw.options.followSymlinks;
2506
927
  let closer;
2507
928
  if (stats.isDirectory()) {
2508
- const absPath = sysPath.resolve(path$2);
2509
- const targetPath = follow ? await realpath$1(path$2) : path$2;
929
+ const absPath = sp.resolve(path$1);
930
+ const targetPath = follow ? await realpath(path$1) : path$1;
2510
931
  if (this.fsw.closed) return;
2511
932
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
2512
933
  if (this.fsw.closed) return;
2513
934
  if (absPath !== targetPath && targetPath !== void 0) this.fsw._symlinkPaths.set(absPath, targetPath);
2514
935
  } else if (stats.isSymbolicLink()) {
2515
- const targetPath = follow ? await realpath$1(path$2) : path$2;
936
+ const targetPath = follow ? await realpath(path$1) : path$1;
2516
937
  if (this.fsw.closed) return;
2517
- const parent = sysPath.dirname(wh.watchPath);
938
+ const parent = sp.dirname(wh.watchPath);
2518
939
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
2519
940
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
2520
- closer = await this._handleDir(parent, stats, initialAdd, depth, path$2, wh, targetPath);
941
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path$1, wh, targetPath);
2521
942
  if (this.fsw.closed) return;
2522
- if (targetPath !== void 0) this.fsw._symlinkPaths.set(sysPath.resolve(path$2), targetPath);
943
+ if (targetPath !== void 0) this.fsw._symlinkPaths.set(sp.resolve(path$1), targetPath);
2523
944
  } else closer = this._handleFile(wh.watchPath, stats, initialAdd);
2524
945
  ready();
2525
- if (closer) this.fsw._addPathCloser(path$2, closer);
946
+ if (closer) this.fsw._addPathCloser(path$1, closer);
2526
947
  return false;
2527
948
  } catch (error) {
2528
949
  if (this.fsw._handleError(error)) {
2529
950
  ready();
2530
- return path$2;
951
+ return path$1;
2531
952
  }
2532
953
  }
2533
954
  }
2534
955
  };
2535
956
 
2536
957
  //#endregion
2537
- //#region node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
958
+ //#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
2538
959
  /*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
2539
960
  const SLASH = "/";
2540
961
  const SLASH_SLASH = "//";
@@ -2542,7 +963,7 @@ const ONE_DOT = ".";
2542
963
  const TWO_DOTS = "..";
2543
964
  const STRING_TYPE = "string";
2544
965
  const BACK_SLASH_RE = /\\/g;
2545
- const DOUBLE_SLASH_RE = /\/\//;
966
+ const DOUBLE_SLASH_RE = /\/\//g;
2546
967
  const DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
2547
968
  const REPLACER_RE = /^\.[/\\]/;
2548
969
  function arrify(item) {
@@ -2556,30 +977,29 @@ function createPattern(matcher) {
2556
977
  if (typeof matcher === "object" && matcher !== null) return (string) => {
2557
978
  if (matcher.path === string) return true;
2558
979
  if (matcher.recursive) {
2559
- const relative$2 = sysPath.relative(matcher.path, string);
2560
- if (!relative$2) return false;
2561
- return !relative$2.startsWith("..") && !sysPath.isAbsolute(relative$2);
980
+ const relative$1 = sp.relative(matcher.path, string);
981
+ if (!relative$1) return false;
982
+ return !relative$1.startsWith("..") && !sp.isAbsolute(relative$1);
2562
983
  }
2563
984
  return false;
2564
985
  };
2565
986
  return () => false;
2566
987
  }
2567
- function normalizePath(path$2) {
2568
- if (typeof path$2 !== "string") throw new Error("string expected");
2569
- path$2 = sysPath.normalize(path$2);
2570
- path$2 = path$2.replace(/\\/g, "/");
988
+ function normalizePath(path$1) {
989
+ if (typeof path$1 !== "string") throw new Error("string expected");
990
+ path$1 = sp.normalize(path$1);
991
+ path$1 = path$1.replace(/\\/g, "/");
2571
992
  let prepend = false;
2572
- if (path$2.startsWith("//")) prepend = true;
2573
- const DOUBLE_SLASH_RE$2 = /\/\//;
2574
- while (path$2.match(DOUBLE_SLASH_RE$2)) path$2 = path$2.replace(DOUBLE_SLASH_RE$2, "/");
2575
- if (prepend) path$2 = "/" + path$2;
2576
- return path$2;
993
+ if (path$1.startsWith("//")) prepend = true;
994
+ path$1 = path$1.replace(DOUBLE_SLASH_RE, "/");
995
+ if (prepend) path$1 = "/" + path$1;
996
+ return path$1;
2577
997
  }
2578
998
  function matchPatterns(patterns, testString, stats) {
2579
- const path$2 = normalizePath(testString);
999
+ const path$1 = normalizePath(testString);
2580
1000
  for (let index = 0; index < patterns.length; index++) {
2581
1001
  const pattern = patterns[index];
2582
- if (pattern(path$2, stats)) return true;
1002
+ if (pattern(path$1, stats)) return true;
2583
1003
  }
2584
1004
  return false;
2585
1005
  }
@@ -2600,24 +1020,27 @@ const toUnix = (string) => {
2600
1020
  let str = string.replace(BACK_SLASH_RE, SLASH);
2601
1021
  let prepend = false;
2602
1022
  if (str.startsWith(SLASH_SLASH)) prepend = true;
2603
- while (str.match(DOUBLE_SLASH_RE)) str = str.replace(DOUBLE_SLASH_RE, SLASH);
1023
+ str = str.replace(DOUBLE_SLASH_RE, SLASH);
2604
1024
  if (prepend) str = SLASH + str;
2605
1025
  return str;
2606
1026
  };
2607
- const normalizePathToUnix = (path$2) => toUnix(sysPath.normalize(toUnix(path$2)));
2608
- const normalizeIgnored = (cwd = "") => (path$2) => {
2609
- if (typeof path$2 === "string") return normalizePathToUnix(sysPath.isAbsolute(path$2) ? path$2 : sysPath.join(cwd, path$2));
2610
- else return path$2;
1027
+ const normalizePathToUnix = (path$1) => toUnix(sp.normalize(toUnix(path$1)));
1028
+ const normalizeIgnored = (cwd = "") => (path$1) => {
1029
+ if (typeof path$1 === "string") return normalizePathToUnix(sp.isAbsolute(path$1) ? path$1 : sp.join(cwd, path$1));
1030
+ else return path$1;
2611
1031
  };
2612
- const getAbsolutePath = (path$2, cwd) => {
2613
- if (sysPath.isAbsolute(path$2)) return path$2;
2614
- return sysPath.join(cwd, path$2);
1032
+ const getAbsolutePath = (path$1, cwd) => {
1033
+ if (sp.isAbsolute(path$1)) return path$1;
1034
+ return sp.join(cwd, path$1);
2615
1035
  };
2616
1036
  const EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
2617
1037
  /**
2618
1038
  * Directory entry.
2619
1039
  */
2620
1040
  var DirEntry = class {
1041
+ path;
1042
+ _removeWatcher;
1043
+ items;
2621
1044
  constructor(dir, removeWatcher) {
2622
1045
  this.path = dir;
2623
1046
  this._removeWatcher = removeWatcher;
@@ -2635,9 +1058,9 @@ var DirEntry = class {
2635
1058
  if (items.size > 0) return;
2636
1059
  const dir = this.path;
2637
1060
  try {
2638
- await readdir$1(dir);
1061
+ await readdir(dir);
2639
1062
  } catch (err) {
2640
- if (this._removeWatcher) this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir));
1063
+ if (this._removeWatcher) this._removeWatcher(sp.dirname(dir), sp.basename(dir));
2641
1064
  }
2642
1065
  }
2643
1066
  has(item) {
@@ -2661,12 +1084,19 @@ var DirEntry = class {
2661
1084
  const STAT_METHOD_F = "stat";
2662
1085
  const STAT_METHOD_L = "lstat";
2663
1086
  var WatchHelper = class {
2664
- constructor(path$2, follow, fsw) {
1087
+ fsw;
1088
+ path;
1089
+ watchPath;
1090
+ fullWatchPath;
1091
+ dirParts;
1092
+ followSymlinks;
1093
+ statMethod;
1094
+ constructor(path$1, follow, fsw) {
2665
1095
  this.fsw = fsw;
2666
- const watchPath = path$2;
2667
- this.path = path$2 = path$2.replace(REPLACER_RE, "");
1096
+ const watchPath = path$1;
1097
+ this.path = path$1 = path$1.replace(REPLACER_RE, "");
2668
1098
  this.watchPath = watchPath;
2669
- this.fullWatchPath = sysPath.resolve(watchPath);
1099
+ this.fullWatchPath = sp.resolve(watchPath);
2670
1100
  this.dirParts = [];
2671
1101
  this.dirParts.forEach((parts) => {
2672
1102
  if (parts.length > 1) parts.pop();
@@ -2675,7 +1105,7 @@ var WatchHelper = class {
2675
1105
  this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
2676
1106
  }
2677
1107
  entryPath(entry) {
2678
- return sysPath.join(this.watchPath, sysPath.relative(this.watchPath, entry.fullPath));
1108
+ return sp.join(this.watchPath, sp.relative(this.watchPath, entry.fullPath));
2679
1109
  }
2680
1110
  filterPath(entry) {
2681
1111
  const { stats } = entry;
@@ -2695,7 +1125,25 @@ var WatchHelper = class {
2695
1125
  * .add(directories)
2696
1126
  * .on('add', path => log('File', path, 'was added'))
2697
1127
  */
2698
- var FSWatcher = class extends EventEmitter$1 {
1128
+ var FSWatcher = class extends EventEmitter {
1129
+ closed;
1130
+ options;
1131
+ _closers;
1132
+ _ignoredPaths;
1133
+ _throttled;
1134
+ _streams;
1135
+ _symlinkPaths;
1136
+ _watched;
1137
+ _pendingWrites;
1138
+ _pendingUnlinks;
1139
+ _readyCount;
1140
+ _emitReady;
1141
+ _closePromise;
1142
+ _userIgnored;
1143
+ _readyEmitted;
1144
+ _emitRaw;
1145
+ _boundRemove;
1146
+ _nodeFsHandler;
2699
1147
  constructor(_opts = {}) {
2700
1148
  super();
2701
1149
  this.closed = false;
@@ -2777,23 +1225,23 @@ var FSWatcher = class extends EventEmitter$1 {
2777
1225
  this.closed = false;
2778
1226
  this._closePromise = void 0;
2779
1227
  let paths = unifyPaths(paths_);
2780
- if (cwd) paths = paths.map((path$2) => {
2781
- return getAbsolutePath(path$2, cwd);
1228
+ if (cwd) paths = paths.map((path$1) => {
1229
+ return getAbsolutePath(path$1, cwd);
2782
1230
  });
2783
- paths.forEach((path$2) => {
2784
- this._removeIgnoredPath(path$2);
1231
+ paths.forEach((path$1) => {
1232
+ this._removeIgnoredPath(path$1);
2785
1233
  });
2786
1234
  this._userIgnored = void 0;
2787
1235
  if (!this._readyCount) this._readyCount = 0;
2788
1236
  this._readyCount += paths.length;
2789
- Promise.all(paths.map(async (path$2) => {
2790
- const res = await this._nodeFsHandler._addToNodeFs(path$2, !_internal, void 0, 0, _origAdd);
1237
+ Promise.all(paths.map(async (path$1) => {
1238
+ const res = await this._nodeFsHandler._addToNodeFs(path$1, !_internal, void 0, 0, _origAdd);
2791
1239
  if (res) this._emitReady();
2792
1240
  return res;
2793
1241
  })).then((results) => {
2794
1242
  if (this.closed) return;
2795
1243
  results.forEach((item) => {
2796
- if (item) this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item));
1244
+ if (item) this.add(sp.dirname(item), sp.basename(_origAdd || item));
2797
1245
  });
2798
1246
  });
2799
1247
  return this;
@@ -2805,15 +1253,15 @@ var FSWatcher = class extends EventEmitter$1 {
2805
1253
  if (this.closed) return this;
2806
1254
  const paths = unifyPaths(paths_);
2807
1255
  const { cwd } = this.options;
2808
- paths.forEach((path$2) => {
2809
- if (!sysPath.isAbsolute(path$2) && !this._closers.has(path$2)) {
2810
- if (cwd) path$2 = sysPath.join(cwd, path$2);
2811
- path$2 = sysPath.resolve(path$2);
1256
+ paths.forEach((path$1) => {
1257
+ if (!sp.isAbsolute(path$1) && !this._closers.has(path$1)) {
1258
+ if (cwd) path$1 = sp.join(cwd, path$1);
1259
+ path$1 = sp.resolve(path$1);
2812
1260
  }
2813
- this._closePath(path$2);
2814
- this._addIgnoredPath(path$2);
2815
- if (this._watched.has(path$2)) this._addIgnoredPath({
2816
- path: path$2,
1261
+ this._closePath(path$1);
1262
+ this._addIgnoredPath(path$1);
1263
+ if (this._watched.has(path$1)) this._addIgnoredPath({
1264
+ path: path$1,
2817
1265
  recursive: true
2818
1266
  });
2819
1267
  this._userIgnored = void 0;
@@ -2852,7 +1300,7 @@ var FSWatcher = class extends EventEmitter$1 {
2852
1300
  getWatched() {
2853
1301
  const watchList = {};
2854
1302
  this._watched.forEach((entry, dir) => {
2855
- const index = (this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir) || ONE_DOT;
1303
+ const index = (this.options.cwd ? sp.relative(this.options.cwd, dir) : dir) || ONE_DOT;
2856
1304
  watchList[index] = entry.getChildren().sort();
2857
1305
  });
2858
1306
  return watchList;
@@ -2869,34 +1317,34 @@ var FSWatcher = class extends EventEmitter$1 {
2869
1317
  * @param stats arguments to be passed with event
2870
1318
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
2871
1319
  */
2872
- async _emit(event, path$2, stats) {
1320
+ async _emit(event, path$1, stats) {
2873
1321
  if (this.closed) return;
2874
1322
  const opts = this.options;
2875
- if (isWindows) path$2 = sysPath.normalize(path$2);
2876
- if (opts.cwd) path$2 = sysPath.relative(opts.cwd, path$2);
2877
- const args = [path$2];
1323
+ if (isWindows) path$1 = sp.normalize(path$1);
1324
+ if (opts.cwd) path$1 = sp.relative(opts.cwd, path$1);
1325
+ const args = [path$1];
2878
1326
  if (stats != null) args.push(stats);
2879
1327
  const awf = opts.awaitWriteFinish;
2880
1328
  let pw;
2881
- if (awf && (pw = this._pendingWrites.get(path$2))) {
1329
+ if (awf && (pw = this._pendingWrites.get(path$1))) {
2882
1330
  pw.lastChange = /* @__PURE__ */ new Date();
2883
1331
  return this;
2884
1332
  }
2885
1333
  if (opts.atomic) {
2886
1334
  if (event === EVENTS.UNLINK) {
2887
- this._pendingUnlinks.set(path$2, [event, ...args]);
1335
+ this._pendingUnlinks.set(path$1, [event, ...args]);
2888
1336
  setTimeout(() => {
2889
- this._pendingUnlinks.forEach((entry, path$3) => {
1337
+ this._pendingUnlinks.forEach((entry, path$2) => {
2890
1338
  this.emit(...entry);
2891
1339
  this.emit(EVENTS.ALL, ...entry);
2892
- this._pendingUnlinks.delete(path$3);
1340
+ this._pendingUnlinks.delete(path$2);
2893
1341
  });
2894
1342
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
2895
1343
  return this;
2896
1344
  }
2897
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path$2)) {
1345
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path$1)) {
2898
1346
  event = EVENTS.CHANGE;
2899
- this._pendingUnlinks.delete(path$2);
1347
+ this._pendingUnlinks.delete(path$1);
2900
1348
  }
2901
1349
  }
2902
1350
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -2911,17 +1359,17 @@ var FSWatcher = class extends EventEmitter$1 {
2911
1359
  this.emitWithAll(event, args);
2912
1360
  }
2913
1361
  };
2914
- this._awaitWriteFinish(path$2, awf.stabilityThreshold, event, awfEmit);
1362
+ this._awaitWriteFinish(path$1, awf.stabilityThreshold, event, awfEmit);
2915
1363
  return this;
2916
1364
  }
2917
1365
  if (event === EVENTS.CHANGE) {
2918
- if (!this._throttle(EVENTS.CHANGE, path$2, 50)) return this;
1366
+ if (!this._throttle(EVENTS.CHANGE, path$1, 50)) return this;
2919
1367
  }
2920
1368
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
2921
- const fullPath = opts.cwd ? sysPath.join(opts.cwd, path$2) : path$2;
1369
+ const fullPath = opts.cwd ? sp.join(opts.cwd, path$1) : path$1;
2922
1370
  let stats$1;
2923
1371
  try {
2924
- stats$1 = await stat$3(fullPath);
1372
+ stats$1 = await stat$1(fullPath);
2925
1373
  } catch (err) {}
2926
1374
  if (!stats$1 || this.closed) return;
2927
1375
  args.push(stats$1);
@@ -2945,20 +1393,20 @@ var FSWatcher = class extends EventEmitter$1 {
2945
1393
  * @param timeout duration of time to suppress duplicate actions
2946
1394
  * @returns tracking object or false if action should be suppressed
2947
1395
  */
2948
- _throttle(actionType, path$2, timeout) {
1396
+ _throttle(actionType, path$1, timeout) {
2949
1397
  if (!this._throttled.has(actionType)) this._throttled.set(actionType, /* @__PURE__ */ new Map());
2950
1398
  const action = this._throttled.get(actionType);
2951
1399
  if (!action) throw new Error("invalid throttle");
2952
- const actionPath = action.get(path$2);
1400
+ const actionPath = action.get(path$1);
2953
1401
  if (actionPath) {
2954
1402
  actionPath.count++;
2955
1403
  return false;
2956
1404
  }
2957
1405
  let timeoutObject;
2958
1406
  const clear = () => {
2959
- const item = action.get(path$2);
1407
+ const item = action.get(path$1);
2960
1408
  const count = item ? item.count : 0;
2961
- action.delete(path$2);
1409
+ action.delete(path$1);
2962
1410
  clearTimeout(timeoutObject);
2963
1411
  if (item) clearTimeout(item.timeoutObject);
2964
1412
  return count;
@@ -2969,7 +1417,7 @@ var FSWatcher = class extends EventEmitter$1 {
2969
1417
  clear,
2970
1418
  count: 0
2971
1419
  };
2972
- action.set(path$2, thr);
1420
+ action.set(path$1, thr);
2973
1421
  return thr;
2974
1422
  }
2975
1423
  _incrReadyCount() {
@@ -2983,34 +1431,34 @@ var FSWatcher = class extends EventEmitter$1 {
2983
1431
  * @param event
2984
1432
  * @param awfEmit Callback to be called when ready for event to be emitted.
2985
1433
  */
2986
- _awaitWriteFinish(path$2, threshold, event, awfEmit) {
1434
+ _awaitWriteFinish(path$1, threshold, event, awfEmit) {
2987
1435
  const awf = this.options.awaitWriteFinish;
2988
1436
  if (typeof awf !== "object") return;
2989
1437
  const pollInterval = awf.pollInterval;
2990
1438
  let timeoutHandler;
2991
- let fullPath = path$2;
2992
- if (this.options.cwd && !sysPath.isAbsolute(path$2)) fullPath = sysPath.join(this.options.cwd, path$2);
1439
+ let fullPath = path$1;
1440
+ if (this.options.cwd && !sp.isAbsolute(path$1)) fullPath = sp.join(this.options.cwd, path$1);
2993
1441
  const now = /* @__PURE__ */ new Date();
2994
1442
  const writes = this._pendingWrites;
2995
1443
  function awaitWriteFinishFn(prevStat) {
2996
- stat$2(fullPath, (err, curStat) => {
2997
- if (err || !writes.has(path$2)) {
1444
+ stat(fullPath, (err, curStat) => {
1445
+ if (err || !writes.has(path$1)) {
2998
1446
  if (err && err.code !== "ENOENT") awfEmit(err);
2999
1447
  return;
3000
1448
  }
3001
1449
  const now$1 = Number(/* @__PURE__ */ new Date());
3002
- if (prevStat && curStat.size !== prevStat.size) writes.get(path$2).lastChange = now$1;
3003
- if (now$1 - writes.get(path$2).lastChange >= threshold) {
3004
- writes.delete(path$2);
1450
+ if (prevStat && curStat.size !== prevStat.size) writes.get(path$1).lastChange = now$1;
1451
+ if (now$1 - writes.get(path$1).lastChange >= threshold) {
1452
+ writes.delete(path$1);
3005
1453
  awfEmit(void 0, curStat);
3006
1454
  } else timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
3007
1455
  });
3008
1456
  }
3009
- if (!writes.has(path$2)) {
3010
- writes.set(path$2, {
1457
+ if (!writes.has(path$1)) {
1458
+ writes.set(path$1, {
3011
1459
  lastChange: now,
3012
1460
  cancelWait: () => {
3013
- writes.delete(path$2);
1461
+ writes.delete(path$1);
3014
1462
  clearTimeout(timeoutHandler);
3015
1463
  return event;
3016
1464
  }
@@ -3021,31 +1469,31 @@ var FSWatcher = class extends EventEmitter$1 {
3021
1469
  /**
3022
1470
  * Determines whether user has asked to ignore this path.
3023
1471
  */
3024
- _isIgnored(path$2, stats) {
3025
- if (this.options.atomic && DOT_RE.test(path$2)) return true;
1472
+ _isIgnored(path$1, stats) {
1473
+ if (this.options.atomic && DOT_RE.test(path$1)) return true;
3026
1474
  if (!this._userIgnored) {
3027
1475
  const { cwd } = this.options;
3028
1476
  const ignored = (this.options.ignored || []).map(normalizeIgnored(cwd));
3029
1477
  this._userIgnored = anymatch([...[...this._ignoredPaths].map(normalizeIgnored(cwd)), ...ignored], void 0);
3030
1478
  }
3031
- return this._userIgnored(path$2, stats);
1479
+ return this._userIgnored(path$1, stats);
3032
1480
  }
3033
- _isntIgnored(path$2, stat$4) {
3034
- return !this._isIgnored(path$2, stat$4);
1481
+ _isntIgnored(path$1, stat$2) {
1482
+ return !this._isIgnored(path$1, stat$2);
3035
1483
  }
3036
1484
  /**
3037
1485
  * Provides a set of common helpers and properties relating to symlink handling.
3038
1486
  * @param path file or directory pattern being watched
3039
1487
  */
3040
- _getWatchHelpers(path$2) {
3041
- return new WatchHelper(path$2, this.options.followSymlinks, this);
1488
+ _getWatchHelpers(path$1) {
1489
+ return new WatchHelper(path$1, this.options.followSymlinks, this);
3042
1490
  }
3043
1491
  /**
3044
1492
  * Provides directory tracking objects
3045
1493
  * @param directory path of the directory
3046
1494
  */
3047
1495
  _getWatchedDir(directory) {
3048
- const dir = sysPath.resolve(directory);
1496
+ const dir = sp.resolve(directory);
3049
1497
  if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
3050
1498
  return this._watched.get(dir);
3051
1499
  }
@@ -3064,50 +1512,50 @@ var FSWatcher = class extends EventEmitter$1 {
3064
1512
  * @param item base path of item/directory
3065
1513
  */
3066
1514
  _remove(directory, item, isDirectory) {
3067
- const path$2 = sysPath.join(directory, item);
3068
- const fullPath = sysPath.resolve(path$2);
3069
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path$2) || this._watched.has(fullPath);
3070
- if (!this._throttle("remove", path$2, 100)) return;
1515
+ const path$1 = sp.join(directory, item);
1516
+ const fullPath = sp.resolve(path$1);
1517
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path$1) || this._watched.has(fullPath);
1518
+ if (!this._throttle("remove", path$1, 100)) return;
3071
1519
  if (!isDirectory && this._watched.size === 1) this.add(directory, item, true);
3072
- this._getWatchedDir(path$2).getChildren().forEach((nested) => this._remove(path$2, nested));
1520
+ this._getWatchedDir(path$1).getChildren().forEach((nested) => this._remove(path$1, nested));
3073
1521
  const parent = this._getWatchedDir(directory);
3074
1522
  const wasTracked = parent.has(item);
3075
1523
  parent.remove(item);
3076
1524
  if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
3077
- let relPath = path$2;
3078
- if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path$2);
1525
+ let relPath = path$1;
1526
+ if (this.options.cwd) relPath = sp.relative(this.options.cwd, path$1);
3079
1527
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
3080
1528
  if (this._pendingWrites.get(relPath).cancelWait() === EVENTS.ADD) return;
3081
1529
  }
3082
- this._watched.delete(path$2);
1530
+ this._watched.delete(path$1);
3083
1531
  this._watched.delete(fullPath);
3084
1532
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
3085
- if (wasTracked && !this._isIgnored(path$2)) this._emit(eventName, path$2);
3086
- this._closePath(path$2);
1533
+ if (wasTracked && !this._isIgnored(path$1)) this._emit(eventName, path$1);
1534
+ this._closePath(path$1);
3087
1535
  }
3088
1536
  /**
3089
1537
  * Closes all watchers for a path
3090
1538
  */
3091
- _closePath(path$2) {
3092
- this._closeFile(path$2);
3093
- const dir = sysPath.dirname(path$2);
3094
- this._getWatchedDir(dir).remove(sysPath.basename(path$2));
1539
+ _closePath(path$1) {
1540
+ this._closeFile(path$1);
1541
+ const dir = sp.dirname(path$1);
1542
+ this._getWatchedDir(dir).remove(sp.basename(path$1));
3095
1543
  }
3096
1544
  /**
3097
1545
  * Closes only file-specific watchers
3098
1546
  */
3099
- _closeFile(path$2) {
3100
- const closers = this._closers.get(path$2);
1547
+ _closeFile(path$1) {
1548
+ const closers = this._closers.get(path$1);
3101
1549
  if (!closers) return;
3102
1550
  closers.forEach((closer) => closer());
3103
- this._closers.delete(path$2);
1551
+ this._closers.delete(path$1);
3104
1552
  }
3105
- _addPathCloser(path$2, closer) {
1553
+ _addPathCloser(path$1, closer) {
3106
1554
  if (!closer) return;
3107
- let list = this._closers.get(path$2);
1555
+ let list = this._closers.get(path$1);
3108
1556
  if (!list) {
3109
1557
  list = [];
3110
- this._closers.set(path$2, list);
1558
+ this._closers.set(path$1, list);
3111
1559
  }
3112
1560
  list.push(closer);
3113
1561
  }
@@ -3142,15 +1590,15 @@ var FSWatcher = class extends EventEmitter$1 {
3142
1590
  * const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
3143
1591
  * watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
3144
1592
  */
3145
- function watch$2(paths, options = {}) {
1593
+ function watch$1(paths, options = {}) {
3146
1594
  const watcher = new FSWatcher(options);
3147
1595
  watcher.add(paths);
3148
1596
  return watcher;
3149
1597
  }
3150
- var esm_default = {
3151
- watch: watch$2,
1598
+ var chokidar_default = {
1599
+ watch: watch$1,
3152
1600
  FSWatcher
3153
1601
  };
3154
1602
 
3155
1603
  //#endregion
3156
- export { watch$3 as a, watch$2 as i, WatchHelper as n, esm_default as r, FSWatcher as t };
1604
+ export { watch$1 as i, WatchHelper as n, chokidar_default as r, FSWatcher as t };