@vibecheck-ai/mcp 24.6.8 → 24.6.11

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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/APITruthEngine-IZRR3NT5-LPFUOMLD.js +9 -0
  3. package/dist/CredentialsEngine-B66ANCBB-HY5ZQTSX.js +9 -0
  4. package/dist/EnvVarEngine-ZFNW2XKP-6HRTZULP.js +9 -0
  5. package/dist/ErrorHandlingEngine-VAHVDVFG-3GDGRN3U.js +11 -0
  6. package/dist/FrameworkPackEngine-RRBJW4MC-KH7WRXXS.js +12 -0
  7. package/dist/GhostRouteEngine-UMYBCOCL-MSZOPVZY.js +9 -0
  8. package/dist/LogicGapEngine-OK5UKZQ5-YGXZDERB.js +11 -0
  9. package/dist/PhantomDepEngine-HQEXAS25-TRVEXBMF.js +10 -0
  10. package/dist/SecurityEngine-MVMRPKLH-BNP7IC46.js +9 -0
  11. package/dist/VersionHallucinationEngine-673DJ26J-BD4SK6JX.js +9 -0
  12. package/dist/chokidar-CI5VJY5M.js +2414 -0
  13. package/dist/chunk-43XAAYST.js +863 -0
  14. package/dist/chunk-5DADZJ3D.js +650 -0
  15. package/dist/chunk-DDTUTWRY.js +605 -0
  16. package/dist/chunk-DGNNNAVK.js +304 -0
  17. package/dist/chunk-F34MHA6A.js +772 -0
  18. package/dist/chunk-FGMVY5QW.js +42 -0
  19. package/dist/chunk-G3FQJC2H.js +1968 -0
  20. package/dist/chunk-J52EUKKW.js +196 -0
  21. package/dist/chunk-JZSHXEYP.js +915 -0
  22. package/dist/chunk-LQSBUKYZ.js +551 -0
  23. package/dist/chunk-MUP4JXOF.js +219 -0
  24. package/dist/chunk-NR36RTVO.js +152 -0
  25. package/dist/chunk-QFDZMUGO.js +213300 -0
  26. package/dist/chunk-QGPX6H6L.js +3044 -0
  27. package/dist/chunk-QYXENOVK.js +499 -0
  28. package/dist/chunk-RNFMO5GH.js +8861 -0
  29. package/dist/chunk-RR5ETBSV.js +66 -0
  30. package/dist/chunk-YWUMPN4Z.js +53 -0
  31. package/dist/dist-HFMJ3GIR.js +1091 -0
  32. package/dist/dist-JUOVMQEA.js +9 -0
  33. package/dist/dist-NXITTS32-O3XLWR6T.js +386 -0
  34. package/dist/dist-OUJKMVTB.js +22 -0
  35. package/dist/fingerprint-NOJ7TDB6-K6SB7LCZ.js +9 -0
  36. package/dist/index.js +4735 -3577
  37. package/dist/semantic-WW6XVII4.js +8544 -0
  38. package/dist/transformers.node-K4WKH4PR.js +45809 -0
  39. package/dist/tree-sitter-AGICL65I.js +1412 -0
  40. package/dist/tree-sitter-H5E7LKR4-MKO3NNLJ.js +9 -0
  41. package/package.json +7 -6
@@ -0,0 +1,2414 @@
1
+ import { createRequire } from 'module';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname } from 'path';
4
+ import { require_picomatch, require_glob_parent, require_is_glob, require_braces } from './chunk-QGPX6H6L.js';
5
+ import { __commonJS, __require, __esm } from './chunk-YWUMPN4Z.js';
6
+
7
+ createRequire(import.meta.url);
8
+ const __filename$1 = fileURLToPath(import.meta.url);
9
+ dirname(__filename$1);
10
+
11
+ // ../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js
12
+ var require_readdirp = __commonJS({
13
+ "../../node_modules/.pnpm/readdirp@3.6.0/node_modules/readdirp/index.js"(exports$1, module) {
14
+ var fs = __require("fs");
15
+ var { Readable } = __require("stream");
16
+ var sysPath = __require("path");
17
+ var { promisify } = __require("util");
18
+ var picomatch = require_picomatch();
19
+ var readdir = promisify(fs.readdir);
20
+ var stat = promisify(fs.stat);
21
+ var lstat = promisify(fs.lstat);
22
+ var realpath = promisify(fs.realpath);
23
+ var BANG = "!";
24
+ var RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
25
+ var NORMAL_FLOW_ERRORS = /* @__PURE__ */ new Set(["ENOENT", "EPERM", "EACCES", "ELOOP", RECURSIVE_ERROR_CODE]);
26
+ var FILE_TYPE = "files";
27
+ var DIR_TYPE = "directories";
28
+ var FILE_DIR_TYPE = "files_directories";
29
+ var EVERYTHING_TYPE = "all";
30
+ var ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
31
+ var isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);
32
+ var [maj, min] = process.versions.node.split(".").slice(0, 2).map((n) => Number.parseInt(n, 10));
33
+ var wantBigintFsStats = process.platform === "win32" && (maj > 10 || maj === 10 && min >= 5);
34
+ var normalizeFilter = (filter) => {
35
+ if (filter === void 0) return;
36
+ if (typeof filter === "function") return filter;
37
+ if (typeof filter === "string") {
38
+ const glob = picomatch(filter.trim());
39
+ return (entry) => glob(entry.basename);
40
+ }
41
+ if (Array.isArray(filter)) {
42
+ const positive = [];
43
+ const negative = [];
44
+ for (const item of filter) {
45
+ const trimmed = item.trim();
46
+ if (trimmed.charAt(0) === BANG) {
47
+ negative.push(picomatch(trimmed.slice(1)));
48
+ } else {
49
+ positive.push(picomatch(trimmed));
50
+ }
51
+ }
52
+ if (negative.length > 0) {
53
+ if (positive.length > 0) {
54
+ return (entry) => positive.some((f) => f(entry.basename)) && !negative.some((f) => f(entry.basename));
55
+ }
56
+ return (entry) => !negative.some((f) => f(entry.basename));
57
+ }
58
+ return (entry) => positive.some((f) => f(entry.basename));
59
+ }
60
+ };
61
+ var ReaddirpStream = class _ReaddirpStream extends Readable {
62
+ static get defaultOptions() {
63
+ return {
64
+ root: ".",
65
+ /* eslint-disable no-unused-vars */
66
+ fileFilter: (path) => true,
67
+ directoryFilter: (path) => true,
68
+ /* eslint-enable no-unused-vars */
69
+ type: FILE_TYPE,
70
+ lstat: false,
71
+ depth: 2147483648,
72
+ alwaysStat: false
73
+ };
74
+ }
75
+ constructor(options = {}) {
76
+ super({
77
+ objectMode: true,
78
+ autoDestroy: true,
79
+ highWaterMark: options.highWaterMark || 4096
80
+ });
81
+ const opts = { ..._ReaddirpStream.defaultOptions, ...options };
82
+ const { root, type } = opts;
83
+ this._fileFilter = normalizeFilter(opts.fileFilter);
84
+ this._directoryFilter = normalizeFilter(opts.directoryFilter);
85
+ const statMethod = opts.lstat ? lstat : stat;
86
+ if (wantBigintFsStats) {
87
+ this._stat = (path) => statMethod(path, { bigint: true });
88
+ } else {
89
+ this._stat = statMethod;
90
+ }
91
+ this._maxDepth = opts.depth;
92
+ this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
93
+ this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
94
+ this._wantsEverything = type === EVERYTHING_TYPE;
95
+ this._root = sysPath.resolve(root);
96
+ this._isDirent = "Dirent" in fs && !opts.alwaysStat;
97
+ this._statsProp = this._isDirent ? "dirent" : "stats";
98
+ this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
99
+ this.parents = [this._exploreDir(root, 1)];
100
+ this.reading = false;
101
+ this.parent = void 0;
102
+ }
103
+ async _read(batch) {
104
+ if (this.reading) return;
105
+ this.reading = true;
106
+ try {
107
+ while (!this.destroyed && batch > 0) {
108
+ const { path, depth, files = [] } = this.parent || {};
109
+ if (files.length > 0) {
110
+ const slice = files.splice(0, batch).map((dirent) => this._formatEntry(dirent, path));
111
+ for (const entry of await Promise.all(slice)) {
112
+ if (this.destroyed) return;
113
+ const entryType = await this._getEntryType(entry);
114
+ if (entryType === "directory" && this._directoryFilter(entry)) {
115
+ if (depth <= this._maxDepth) {
116
+ this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
117
+ }
118
+ if (this._wantsDir) {
119
+ this.push(entry);
120
+ batch--;
121
+ }
122
+ } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
123
+ if (this._wantsFile) {
124
+ this.push(entry);
125
+ batch--;
126
+ }
127
+ }
128
+ }
129
+ } else {
130
+ const parent = this.parents.pop();
131
+ if (!parent) {
132
+ this.push(null);
133
+ break;
134
+ }
135
+ this.parent = await parent;
136
+ if (this.destroyed) return;
137
+ }
138
+ }
139
+ } catch (error) {
140
+ this.destroy(error);
141
+ } finally {
142
+ this.reading = false;
143
+ }
144
+ }
145
+ async _exploreDir(path, depth) {
146
+ let files;
147
+ try {
148
+ files = await readdir(path, this._rdOptions);
149
+ } catch (error) {
150
+ this._onError(error);
151
+ }
152
+ return { files, depth, path };
153
+ }
154
+ async _formatEntry(dirent, path) {
155
+ let entry;
156
+ try {
157
+ const basename = this._isDirent ? dirent.name : dirent;
158
+ const fullPath = sysPath.resolve(sysPath.join(path, basename));
159
+ entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename };
160
+ entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
161
+ } catch (err) {
162
+ this._onError(err);
163
+ }
164
+ return entry;
165
+ }
166
+ _onError(err) {
167
+ if (isNormalFlowError(err) && !this.destroyed) {
168
+ this.emit("warn", err);
169
+ } else {
170
+ this.destroy(err);
171
+ }
172
+ }
173
+ async _getEntryType(entry) {
174
+ const stats = entry && entry[this._statsProp];
175
+ if (!stats) {
176
+ return;
177
+ }
178
+ if (stats.isFile()) {
179
+ return "file";
180
+ }
181
+ if (stats.isDirectory()) {
182
+ return "directory";
183
+ }
184
+ if (stats && stats.isSymbolicLink()) {
185
+ const full = entry.fullPath;
186
+ try {
187
+ const entryRealPath = await realpath(full);
188
+ const entryRealPathStats = await lstat(entryRealPath);
189
+ if (entryRealPathStats.isFile()) {
190
+ return "file";
191
+ }
192
+ if (entryRealPathStats.isDirectory()) {
193
+ const len = entryRealPath.length;
194
+ if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath.sep) {
195
+ const recursiveError = new Error(
196
+ `Circular symlink detected: "${full}" points to "${entryRealPath}"`
197
+ );
198
+ recursiveError.code = RECURSIVE_ERROR_CODE;
199
+ return this._onError(recursiveError);
200
+ }
201
+ return "directory";
202
+ }
203
+ } catch (error) {
204
+ this._onError(error);
205
+ }
206
+ }
207
+ }
208
+ _includeAsFile(entry) {
209
+ const stats = entry && entry[this._statsProp];
210
+ return stats && this._wantsEverything && !stats.isDirectory();
211
+ }
212
+ };
213
+ var readdirp = (root, options = {}) => {
214
+ let type = options.entryType || options.type;
215
+ if (type === "both") type = FILE_DIR_TYPE;
216
+ if (type) options.type = type;
217
+ if (!root) {
218
+ throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
219
+ } else if (typeof root !== "string") {
220
+ throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
221
+ } else if (type && !ALL_TYPES.includes(type)) {
222
+ throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
223
+ }
224
+ options.root = root;
225
+ return new ReaddirpStream(options);
226
+ };
227
+ var readdirpPromise = (root, options = {}) => {
228
+ return new Promise((resolve, reject) => {
229
+ const files = [];
230
+ readdirp(root, options).on("data", (entry) => files.push(entry)).on("end", () => resolve(files)).on("error", (error) => reject(error));
231
+ });
232
+ };
233
+ readdirp.promise = readdirpPromise;
234
+ readdirp.ReaddirpStream = ReaddirpStream;
235
+ readdirp.default = readdirp;
236
+ module.exports = readdirp;
237
+ }
238
+ });
239
+
240
+ // ../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js
241
+ var require_normalize_path = __commonJS({
242
+ "../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js"(exports$1, module) {
243
+ module.exports = function(path, stripTrailing) {
244
+ if (typeof path !== "string") {
245
+ throw new TypeError("expected path to be a string");
246
+ }
247
+ if (path === "\\" || path === "/") return "/";
248
+ var len = path.length;
249
+ if (len <= 1) return path;
250
+ var prefix = "";
251
+ if (len > 4 && path[3] === "\\") {
252
+ var ch = path[2];
253
+ if ((ch === "?" || ch === ".") && path.slice(0, 2) === "\\\\") {
254
+ path = path.slice(2);
255
+ prefix = "//";
256
+ }
257
+ }
258
+ var segs = path.split(/[/\\]+/);
259
+ if (stripTrailing !== false && segs[segs.length - 1] === "") {
260
+ segs.pop();
261
+ }
262
+ return prefix + segs.join("/");
263
+ };
264
+ }
265
+ });
266
+
267
+ // ../../node_modules/.pnpm/anymatch@3.1.3/node_modules/anymatch/index.js
268
+ var require_anymatch = __commonJS({
269
+ "../../node_modules/.pnpm/anymatch@3.1.3/node_modules/anymatch/index.js"(exports$1, module) {
270
+ Object.defineProperty(exports$1, "__esModule", { value: true });
271
+ var picomatch = require_picomatch();
272
+ var normalizePath = require_normalize_path();
273
+ var BANG = "!";
274
+ var DEFAULT_OPTIONS = { returnIndex: false };
275
+ var arrify = (item) => Array.isArray(item) ? item : [item];
276
+ var createPattern = (matcher, options) => {
277
+ if (typeof matcher === "function") {
278
+ return matcher;
279
+ }
280
+ if (typeof matcher === "string") {
281
+ const glob = picomatch(matcher, options);
282
+ return (string) => matcher === string || glob(string);
283
+ }
284
+ if (matcher instanceof RegExp) {
285
+ return (string) => matcher.test(string);
286
+ }
287
+ return (string) => false;
288
+ };
289
+ var matchPatterns = (patterns, negPatterns, args, returnIndex) => {
290
+ const isList = Array.isArray(args);
291
+ const _path = isList ? args[0] : args;
292
+ if (!isList && typeof _path !== "string") {
293
+ throw new TypeError("anymatch: second argument must be a string: got " + Object.prototype.toString.call(_path));
294
+ }
295
+ const path = normalizePath(_path, false);
296
+ for (let index = 0; index < negPatterns.length; index++) {
297
+ const nglob = negPatterns[index];
298
+ if (nglob(path)) {
299
+ return returnIndex ? -1 : false;
300
+ }
301
+ }
302
+ const applied = isList && [path].concat(args.slice(1));
303
+ for (let index = 0; index < patterns.length; index++) {
304
+ const pattern = patterns[index];
305
+ if (isList ? pattern(...applied) : pattern(path)) {
306
+ return returnIndex ? index : true;
307
+ }
308
+ }
309
+ return returnIndex ? -1 : false;
310
+ };
311
+ var anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => {
312
+ if (matchers == null) {
313
+ throw new TypeError("anymatch: specify first argument");
314
+ }
315
+ const opts = typeof options === "boolean" ? { returnIndex: options } : options;
316
+ const returnIndex = opts.returnIndex || false;
317
+ const mtchers = arrify(matchers);
318
+ const negatedGlobs = mtchers.filter((item) => typeof item === "string" && item.charAt(0) === BANG).map((item) => item.slice(1)).map((item) => picomatch(item, opts));
319
+ const patterns = mtchers.filter((item) => typeof item !== "string" || typeof item === "string" && item.charAt(0) !== BANG).map((matcher) => createPattern(matcher, opts));
320
+ if (testString == null) {
321
+ return (testString2, ri = false) => {
322
+ const returnIndex2 = typeof ri === "boolean" ? ri : false;
323
+ return matchPatterns(patterns, negatedGlobs, testString2, returnIndex2);
324
+ };
325
+ }
326
+ return matchPatterns(patterns, negatedGlobs, testString, returnIndex);
327
+ };
328
+ anymatch.default = anymatch;
329
+ module.exports = anymatch;
330
+ }
331
+ });
332
+
333
+ // ../../node_modules/.pnpm/binary-extensions@2.3.0/node_modules/binary-extensions/binary-extensions.json
334
+ var require_binary_extensions = __commonJS({
335
+ "../../node_modules/.pnpm/binary-extensions@2.3.0/node_modules/binary-extensions/binary-extensions.json"(exports$1, module) {
336
+ module.exports = [
337
+ "3dm",
338
+ "3ds",
339
+ "3g2",
340
+ "3gp",
341
+ "7z",
342
+ "a",
343
+ "aac",
344
+ "adp",
345
+ "afdesign",
346
+ "afphoto",
347
+ "afpub",
348
+ "ai",
349
+ "aif",
350
+ "aiff",
351
+ "alz",
352
+ "ape",
353
+ "apk",
354
+ "appimage",
355
+ "ar",
356
+ "arj",
357
+ "asf",
358
+ "au",
359
+ "avi",
360
+ "bak",
361
+ "baml",
362
+ "bh",
363
+ "bin",
364
+ "bk",
365
+ "bmp",
366
+ "btif",
367
+ "bz2",
368
+ "bzip2",
369
+ "cab",
370
+ "caf",
371
+ "cgm",
372
+ "class",
373
+ "cmx",
374
+ "cpio",
375
+ "cr2",
376
+ "cur",
377
+ "dat",
378
+ "dcm",
379
+ "deb",
380
+ "dex",
381
+ "djvu",
382
+ "dll",
383
+ "dmg",
384
+ "dng",
385
+ "doc",
386
+ "docm",
387
+ "docx",
388
+ "dot",
389
+ "dotm",
390
+ "dra",
391
+ "DS_Store",
392
+ "dsk",
393
+ "dts",
394
+ "dtshd",
395
+ "dvb",
396
+ "dwg",
397
+ "dxf",
398
+ "ecelp4800",
399
+ "ecelp7470",
400
+ "ecelp9600",
401
+ "egg",
402
+ "eol",
403
+ "eot",
404
+ "epub",
405
+ "exe",
406
+ "f4v",
407
+ "fbs",
408
+ "fh",
409
+ "fla",
410
+ "flac",
411
+ "flatpak",
412
+ "fli",
413
+ "flv",
414
+ "fpx",
415
+ "fst",
416
+ "fvt",
417
+ "g3",
418
+ "gh",
419
+ "gif",
420
+ "graffle",
421
+ "gz",
422
+ "gzip",
423
+ "h261",
424
+ "h263",
425
+ "h264",
426
+ "icns",
427
+ "ico",
428
+ "ief",
429
+ "img",
430
+ "ipa",
431
+ "iso",
432
+ "jar",
433
+ "jpeg",
434
+ "jpg",
435
+ "jpgv",
436
+ "jpm",
437
+ "jxr",
438
+ "key",
439
+ "ktx",
440
+ "lha",
441
+ "lib",
442
+ "lvp",
443
+ "lz",
444
+ "lzh",
445
+ "lzma",
446
+ "lzo",
447
+ "m3u",
448
+ "m4a",
449
+ "m4v",
450
+ "mar",
451
+ "mdi",
452
+ "mht",
453
+ "mid",
454
+ "midi",
455
+ "mj2",
456
+ "mka",
457
+ "mkv",
458
+ "mmr",
459
+ "mng",
460
+ "mobi",
461
+ "mov",
462
+ "movie",
463
+ "mp3",
464
+ "mp4",
465
+ "mp4a",
466
+ "mpeg",
467
+ "mpg",
468
+ "mpga",
469
+ "mxu",
470
+ "nef",
471
+ "npx",
472
+ "numbers",
473
+ "nupkg",
474
+ "o",
475
+ "odp",
476
+ "ods",
477
+ "odt",
478
+ "oga",
479
+ "ogg",
480
+ "ogv",
481
+ "otf",
482
+ "ott",
483
+ "pages",
484
+ "pbm",
485
+ "pcx",
486
+ "pdb",
487
+ "pdf",
488
+ "pea",
489
+ "pgm",
490
+ "pic",
491
+ "png",
492
+ "pnm",
493
+ "pot",
494
+ "potm",
495
+ "potx",
496
+ "ppa",
497
+ "ppam",
498
+ "ppm",
499
+ "pps",
500
+ "ppsm",
501
+ "ppsx",
502
+ "ppt",
503
+ "pptm",
504
+ "pptx",
505
+ "psd",
506
+ "pya",
507
+ "pyc",
508
+ "pyo",
509
+ "pyv",
510
+ "qt",
511
+ "rar",
512
+ "ras",
513
+ "raw",
514
+ "resources",
515
+ "rgb",
516
+ "rip",
517
+ "rlc",
518
+ "rmf",
519
+ "rmvb",
520
+ "rpm",
521
+ "rtf",
522
+ "rz",
523
+ "s3m",
524
+ "s7z",
525
+ "scpt",
526
+ "sgi",
527
+ "shar",
528
+ "snap",
529
+ "sil",
530
+ "sketch",
531
+ "slk",
532
+ "smv",
533
+ "snk",
534
+ "so",
535
+ "stl",
536
+ "suo",
537
+ "sub",
538
+ "swf",
539
+ "tar",
540
+ "tbz",
541
+ "tbz2",
542
+ "tga",
543
+ "tgz",
544
+ "thmx",
545
+ "tif",
546
+ "tiff",
547
+ "tlz",
548
+ "ttc",
549
+ "ttf",
550
+ "txz",
551
+ "udf",
552
+ "uvh",
553
+ "uvi",
554
+ "uvm",
555
+ "uvp",
556
+ "uvs",
557
+ "uvu",
558
+ "viv",
559
+ "vob",
560
+ "war",
561
+ "wav",
562
+ "wax",
563
+ "wbmp",
564
+ "wdp",
565
+ "weba",
566
+ "webm",
567
+ "webp",
568
+ "whl",
569
+ "wim",
570
+ "wm",
571
+ "wma",
572
+ "wmv",
573
+ "wmx",
574
+ "woff",
575
+ "woff2",
576
+ "wrm",
577
+ "wvx",
578
+ "xbm",
579
+ "xif",
580
+ "xla",
581
+ "xlam",
582
+ "xls",
583
+ "xlsb",
584
+ "xlsm",
585
+ "xlsx",
586
+ "xlt",
587
+ "xltm",
588
+ "xltx",
589
+ "xm",
590
+ "xmind",
591
+ "xpi",
592
+ "xpm",
593
+ "xwd",
594
+ "xz",
595
+ "z",
596
+ "zip",
597
+ "zipx"
598
+ ];
599
+ }
600
+ });
601
+
602
+ // ../../node_modules/.pnpm/binary-extensions@2.3.0/node_modules/binary-extensions/index.js
603
+ var require_binary_extensions2 = __commonJS({
604
+ "../../node_modules/.pnpm/binary-extensions@2.3.0/node_modules/binary-extensions/index.js"(exports$1, module) {
605
+ module.exports = require_binary_extensions();
606
+ }
607
+ });
608
+
609
+ // ../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js
610
+ var require_is_binary_path = __commonJS({
611
+ "../../node_modules/.pnpm/is-binary-path@2.1.0/node_modules/is-binary-path/index.js"(exports$1, module) {
612
+ var path = __require("path");
613
+ var binaryExtensions = require_binary_extensions2();
614
+ var extensions = new Set(binaryExtensions);
615
+ module.exports = (filePath) => extensions.has(path.extname(filePath).slice(1).toLowerCase());
616
+ }
617
+ });
618
+
619
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/constants.js
620
+ var require_constants = __commonJS({
621
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/constants.js"(exports$1) {
622
+ var { sep } = __require("path");
623
+ var { platform } = process;
624
+ var os = __require("os");
625
+ exports$1.EV_ALL = "all";
626
+ exports$1.EV_READY = "ready";
627
+ exports$1.EV_ADD = "add";
628
+ exports$1.EV_CHANGE = "change";
629
+ exports$1.EV_ADD_DIR = "addDir";
630
+ exports$1.EV_UNLINK = "unlink";
631
+ exports$1.EV_UNLINK_DIR = "unlinkDir";
632
+ exports$1.EV_RAW = "raw";
633
+ exports$1.EV_ERROR = "error";
634
+ exports$1.STR_DATA = "data";
635
+ exports$1.STR_END = "end";
636
+ exports$1.STR_CLOSE = "close";
637
+ exports$1.FSEVENT_CREATED = "created";
638
+ exports$1.FSEVENT_MODIFIED = "modified";
639
+ exports$1.FSEVENT_DELETED = "deleted";
640
+ exports$1.FSEVENT_MOVED = "moved";
641
+ exports$1.FSEVENT_CLONED = "cloned";
642
+ exports$1.FSEVENT_UNKNOWN = "unknown";
643
+ exports$1.FSEVENT_FLAG_MUST_SCAN_SUBDIRS = 1;
644
+ exports$1.FSEVENT_TYPE_FILE = "file";
645
+ exports$1.FSEVENT_TYPE_DIRECTORY = "directory";
646
+ exports$1.FSEVENT_TYPE_SYMLINK = "symlink";
647
+ exports$1.KEY_LISTENERS = "listeners";
648
+ exports$1.KEY_ERR = "errHandlers";
649
+ exports$1.KEY_RAW = "rawEmitters";
650
+ exports$1.HANDLER_KEYS = [exports$1.KEY_LISTENERS, exports$1.KEY_ERR, exports$1.KEY_RAW];
651
+ exports$1.DOT_SLASH = `.${sep}`;
652
+ exports$1.BACK_SLASH_RE = /\\/g;
653
+ exports$1.DOUBLE_SLASH_RE = /\/\//;
654
+ exports$1.SLASH_OR_BACK_SLASH_RE = /[/\\]/;
655
+ exports$1.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
656
+ exports$1.REPLACER_RE = /^\.[/\\]/;
657
+ exports$1.SLASH = "/";
658
+ exports$1.SLASH_SLASH = "//";
659
+ exports$1.BRACE_START = "{";
660
+ exports$1.BANG = "!";
661
+ exports$1.ONE_DOT = ".";
662
+ exports$1.TWO_DOTS = "..";
663
+ exports$1.STAR = "*";
664
+ exports$1.GLOBSTAR = "**";
665
+ exports$1.ROOT_GLOBSTAR = "/**/*";
666
+ exports$1.SLASH_GLOBSTAR = "/**";
667
+ exports$1.DIR_SUFFIX = "Dir";
668
+ exports$1.ANYMATCH_OPTS = { dot: true };
669
+ exports$1.STRING_TYPE = "string";
670
+ exports$1.FUNCTION_TYPE = "function";
671
+ exports$1.EMPTY_STR = "";
672
+ exports$1.EMPTY_FN = () => {
673
+ };
674
+ exports$1.IDENTITY_FN = (val) => val;
675
+ exports$1.isWindows = platform === "win32";
676
+ exports$1.isMacos = platform === "darwin";
677
+ exports$1.isLinux = platform === "linux";
678
+ exports$1.isIBMi = os.type() === "OS400";
679
+ }
680
+ });
681
+
682
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/nodefs-handler.js
683
+ var require_nodefs_handler = __commonJS({
684
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/nodefs-handler.js"(exports$1, module) {
685
+ var fs = __require("fs");
686
+ var sysPath = __require("path");
687
+ var { promisify } = __require("util");
688
+ var isBinaryPath = require_is_binary_path();
689
+ var {
690
+ isWindows,
691
+ isLinux,
692
+ EMPTY_FN,
693
+ EMPTY_STR,
694
+ KEY_LISTENERS,
695
+ KEY_ERR,
696
+ KEY_RAW,
697
+ HANDLER_KEYS,
698
+ EV_CHANGE,
699
+ EV_ADD,
700
+ EV_ADD_DIR,
701
+ EV_ERROR,
702
+ STR_DATA,
703
+ STR_END,
704
+ BRACE_START,
705
+ STAR
706
+ } = require_constants();
707
+ var THROTTLE_MODE_WATCH = "watch";
708
+ var open = promisify(fs.open);
709
+ var stat = promisify(fs.stat);
710
+ var lstat = promisify(fs.lstat);
711
+ var close = promisify(fs.close);
712
+ var fsrealpath = promisify(fs.realpath);
713
+ var statMethods = { lstat, stat };
714
+ var foreach = (val, fn) => {
715
+ if (val instanceof Set) {
716
+ val.forEach(fn);
717
+ } else {
718
+ fn(val);
719
+ }
720
+ };
721
+ var addAndConvert = (main, prop, item) => {
722
+ let container = main[prop];
723
+ if (!(container instanceof Set)) {
724
+ main[prop] = container = /* @__PURE__ */ new Set([container]);
725
+ }
726
+ container.add(item);
727
+ };
728
+ var clearItem = (cont) => (key) => {
729
+ const set = cont[key];
730
+ if (set instanceof Set) {
731
+ set.clear();
732
+ } else {
733
+ delete cont[key];
734
+ }
735
+ };
736
+ var delFromSet = (main, prop, item) => {
737
+ const container = main[prop];
738
+ if (container instanceof Set) {
739
+ container.delete(item);
740
+ } else if (container === item) {
741
+ delete main[prop];
742
+ }
743
+ };
744
+ var isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
745
+ var FsWatchInstances = /* @__PURE__ */ new Map();
746
+ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
747
+ const handleEvent = (rawEvent, evPath) => {
748
+ listener(path);
749
+ emitRaw(rawEvent, evPath, { watchedPath: path });
750
+ if (evPath && path !== evPath) {
751
+ fsWatchBroadcast(
752
+ sysPath.resolve(path, evPath),
753
+ KEY_LISTENERS,
754
+ sysPath.join(path, evPath)
755
+ );
756
+ }
757
+ };
758
+ try {
759
+ return fs.watch(path, options, handleEvent);
760
+ } catch (error) {
761
+ errHandler(error);
762
+ }
763
+ }
764
+ var fsWatchBroadcast = (fullPath, type, val1, val2, val3) => {
765
+ const cont = FsWatchInstances.get(fullPath);
766
+ if (!cont) return;
767
+ foreach(cont[type], (listener) => {
768
+ listener(val1, val2, val3);
769
+ });
770
+ };
771
+ var setFsWatchListener = (path, fullPath, options, handlers) => {
772
+ const { listener, errHandler, rawEmitter } = handlers;
773
+ let cont = FsWatchInstances.get(fullPath);
774
+ let watcher;
775
+ if (!options.persistent) {
776
+ watcher = createFsWatchInstance(
777
+ path,
778
+ options,
779
+ listener,
780
+ errHandler,
781
+ rawEmitter
782
+ );
783
+ return watcher.close.bind(watcher);
784
+ }
785
+ if (cont) {
786
+ addAndConvert(cont, KEY_LISTENERS, listener);
787
+ addAndConvert(cont, KEY_ERR, errHandler);
788
+ addAndConvert(cont, KEY_RAW, rawEmitter);
789
+ } else {
790
+ watcher = createFsWatchInstance(
791
+ path,
792
+ options,
793
+ fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
794
+ errHandler,
795
+ // no need to use broadcast here
796
+ fsWatchBroadcast.bind(null, fullPath, KEY_RAW)
797
+ );
798
+ if (!watcher) return;
799
+ watcher.on(EV_ERROR, async (error) => {
800
+ const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
801
+ cont.watcherUnusable = true;
802
+ if (isWindows && error.code === "EPERM") {
803
+ try {
804
+ const fd = await open(path, "r");
805
+ await close(fd);
806
+ broadcastErr(error);
807
+ } catch (err) {
808
+ }
809
+ } else {
810
+ broadcastErr(error);
811
+ }
812
+ });
813
+ cont = {
814
+ listeners: listener,
815
+ errHandlers: errHandler,
816
+ rawEmitters: rawEmitter,
817
+ watcher
818
+ };
819
+ FsWatchInstances.set(fullPath, cont);
820
+ }
821
+ return () => {
822
+ delFromSet(cont, KEY_LISTENERS, listener);
823
+ delFromSet(cont, KEY_ERR, errHandler);
824
+ delFromSet(cont, KEY_RAW, rawEmitter);
825
+ if (isEmptySet(cont.listeners)) {
826
+ cont.watcher.close();
827
+ FsWatchInstances.delete(fullPath);
828
+ HANDLER_KEYS.forEach(clearItem(cont));
829
+ cont.watcher = void 0;
830
+ Object.freeze(cont);
831
+ }
832
+ };
833
+ };
834
+ var FsWatchFileInstances = /* @__PURE__ */ new Map();
835
+ var setFsWatchFileListener = (path, fullPath, options, handlers) => {
836
+ const { listener, rawEmitter } = handlers;
837
+ let cont = FsWatchFileInstances.get(fullPath);
838
+ const copts = cont && cont.options;
839
+ if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
840
+ cont.listeners;
841
+ cont.rawEmitters;
842
+ fs.unwatchFile(fullPath);
843
+ cont = void 0;
844
+ }
845
+ if (cont) {
846
+ addAndConvert(cont, KEY_LISTENERS, listener);
847
+ addAndConvert(cont, KEY_RAW, rawEmitter);
848
+ } else {
849
+ cont = {
850
+ listeners: listener,
851
+ rawEmitters: rawEmitter,
852
+ options,
853
+ watcher: fs.watchFile(fullPath, options, (curr, prev) => {
854
+ foreach(cont.rawEmitters, (rawEmitter2) => {
855
+ rawEmitter2(EV_CHANGE, fullPath, { curr, prev });
856
+ });
857
+ const currmtime = curr.mtimeMs;
858
+ if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
859
+ foreach(cont.listeners, (listener2) => listener2(path, curr));
860
+ }
861
+ })
862
+ };
863
+ FsWatchFileInstances.set(fullPath, cont);
864
+ }
865
+ return () => {
866
+ delFromSet(cont, KEY_LISTENERS, listener);
867
+ delFromSet(cont, KEY_RAW, rawEmitter);
868
+ if (isEmptySet(cont.listeners)) {
869
+ FsWatchFileInstances.delete(fullPath);
870
+ fs.unwatchFile(fullPath);
871
+ cont.options = cont.watcher = void 0;
872
+ Object.freeze(cont);
873
+ }
874
+ };
875
+ };
876
+ var NodeFsHandler = class {
877
+ /**
878
+ * @param {import("../index").FSWatcher} fsW
879
+ */
880
+ constructor(fsW) {
881
+ this.fsw = fsW;
882
+ this._boundHandleError = (error) => fsW._handleError(error);
883
+ }
884
+ /**
885
+ * Watch file for changes with fs_watchFile or fs_watch.
886
+ * @param {String} path to file or dir
887
+ * @param {Function} listener on fs change
888
+ * @returns {Function} closer for the watcher instance
889
+ */
890
+ _watchWithNodeFs(path, listener) {
891
+ const opts = this.fsw.options;
892
+ const directory = sysPath.dirname(path);
893
+ const basename = sysPath.basename(path);
894
+ const parent = this.fsw._getWatchedDir(directory);
895
+ parent.add(basename);
896
+ const absolutePath = sysPath.resolve(path);
897
+ const options = { persistent: opts.persistent };
898
+ if (!listener) listener = EMPTY_FN;
899
+ let closer;
900
+ if (opts.usePolling) {
901
+ options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ? opts.binaryInterval : opts.interval;
902
+ closer = setFsWatchFileListener(path, absolutePath, options, {
903
+ listener,
904
+ rawEmitter: this.fsw._emitRaw
905
+ });
906
+ } else {
907
+ closer = setFsWatchListener(path, absolutePath, options, {
908
+ listener,
909
+ errHandler: this._boundHandleError,
910
+ rawEmitter: this.fsw._emitRaw
911
+ });
912
+ }
913
+ return closer;
914
+ }
915
+ /**
916
+ * Watch a file and emit add event if warranted.
917
+ * @param {Path} file Path
918
+ * @param {fs.Stats} stats result of fs_stat
919
+ * @param {Boolean} initialAdd was the file added at watch instantiation?
920
+ * @returns {Function} closer for the watcher instance
921
+ */
922
+ _handleFile(file, stats, initialAdd) {
923
+ if (this.fsw.closed) {
924
+ return;
925
+ }
926
+ const dirname = sysPath.dirname(file);
927
+ const basename = sysPath.basename(file);
928
+ const parent = this.fsw._getWatchedDir(dirname);
929
+ let prevStats = stats;
930
+ if (parent.has(basename)) return;
931
+ const listener = async (path, newStats) => {
932
+ if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
933
+ if (!newStats || newStats.mtimeMs === 0) {
934
+ try {
935
+ const newStats2 = await stat(file);
936
+ if (this.fsw.closed) return;
937
+ const at = newStats2.atimeMs;
938
+ const mt = newStats2.mtimeMs;
939
+ if (!at || at <= mt || mt !== prevStats.mtimeMs) {
940
+ this.fsw._emit(EV_CHANGE, file, newStats2);
941
+ }
942
+ if (isLinux && prevStats.ino !== newStats2.ino) {
943
+ this.fsw._closeFile(path);
944
+ prevStats = newStats2;
945
+ this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener));
946
+ } else {
947
+ prevStats = newStats2;
948
+ }
949
+ } catch (error) {
950
+ this.fsw._remove(dirname, basename);
951
+ }
952
+ } else if (parent.has(basename)) {
953
+ const at = newStats.atimeMs;
954
+ const mt = newStats.mtimeMs;
955
+ if (!at || at <= mt || mt !== prevStats.mtimeMs) {
956
+ this.fsw._emit(EV_CHANGE, file, newStats);
957
+ }
958
+ prevStats = newStats;
959
+ }
960
+ };
961
+ const closer = this._watchWithNodeFs(file, listener);
962
+ if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
963
+ if (!this.fsw._throttle(EV_ADD, file, 0)) return;
964
+ this.fsw._emit(EV_ADD, file, stats);
965
+ }
966
+ return closer;
967
+ }
968
+ /**
969
+ * Handle symlinks encountered while reading a dir.
970
+ * @param {Object} entry returned by readdirp
971
+ * @param {String} directory path of dir being read
972
+ * @param {String} path of this item
973
+ * @param {String} item basename of this item
974
+ * @returns {Promise<Boolean>} true if no more processing is needed for this entry.
975
+ */
976
+ async _handleSymlink(entry, directory, path, item) {
977
+ if (this.fsw.closed) {
978
+ return;
979
+ }
980
+ const full = entry.fullPath;
981
+ const dir = this.fsw._getWatchedDir(directory);
982
+ if (!this.fsw.options.followSymlinks) {
983
+ this.fsw._incrReadyCount();
984
+ let linkPath;
985
+ try {
986
+ linkPath = await fsrealpath(path);
987
+ } catch (e) {
988
+ this.fsw._emitReady();
989
+ return true;
990
+ }
991
+ if (this.fsw.closed) return;
992
+ if (dir.has(item)) {
993
+ if (this.fsw._symlinkPaths.get(full) !== linkPath) {
994
+ this.fsw._symlinkPaths.set(full, linkPath);
995
+ this.fsw._emit(EV_CHANGE, path, entry.stats);
996
+ }
997
+ } else {
998
+ dir.add(item);
999
+ this.fsw._symlinkPaths.set(full, linkPath);
1000
+ this.fsw._emit(EV_ADD, path, entry.stats);
1001
+ }
1002
+ this.fsw._emitReady();
1003
+ return true;
1004
+ }
1005
+ if (this.fsw._symlinkPaths.has(full)) {
1006
+ return true;
1007
+ }
1008
+ this.fsw._symlinkPaths.set(full, true);
1009
+ }
1010
+ _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
1011
+ directory = sysPath.join(directory, EMPTY_STR);
1012
+ if (!wh.hasGlob) {
1013
+ throttler = this.fsw._throttle("readdir", directory, 1e3);
1014
+ if (!throttler) return;
1015
+ }
1016
+ const previous = this.fsw._getWatchedDir(wh.path);
1017
+ const current = /* @__PURE__ */ new Set();
1018
+ let stream = this.fsw._readdirp(directory, {
1019
+ fileFilter: (entry) => wh.filterPath(entry),
1020
+ directoryFilter: (entry) => wh.filterDir(entry),
1021
+ depth: 0
1022
+ }).on(STR_DATA, async (entry) => {
1023
+ if (this.fsw.closed) {
1024
+ stream = void 0;
1025
+ return;
1026
+ }
1027
+ const item = entry.path;
1028
+ let path = sysPath.join(directory, item);
1029
+ current.add(item);
1030
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) {
1031
+ return;
1032
+ }
1033
+ if (this.fsw.closed) {
1034
+ stream = void 0;
1035
+ return;
1036
+ }
1037
+ if (item === target || !target && !previous.has(item)) {
1038
+ this.fsw._incrReadyCount();
1039
+ path = sysPath.join(dir, sysPath.relative(dir, path));
1040
+ this._addToNodeFs(path, initialAdd, wh, depth + 1);
1041
+ }
1042
+ }).on(EV_ERROR, this._boundHandleError);
1043
+ return new Promise(
1044
+ (resolve) => stream.once(STR_END, () => {
1045
+ if (this.fsw.closed) {
1046
+ stream = void 0;
1047
+ return;
1048
+ }
1049
+ const wasThrottled = throttler ? throttler.clear() : false;
1050
+ resolve();
1051
+ previous.getChildren().filter((item) => {
1052
+ return item !== directory && !current.has(item) && // in case of intersecting globs;
1053
+ // a path may have been filtered out of this readdir, but
1054
+ // shouldn't be removed because it matches a different glob
1055
+ (!wh.hasGlob || wh.filterPath({
1056
+ fullPath: sysPath.resolve(directory, item)
1057
+ }));
1058
+ }).forEach((item) => {
1059
+ this.fsw._remove(directory, item);
1060
+ });
1061
+ stream = void 0;
1062
+ if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler);
1063
+ })
1064
+ );
1065
+ }
1066
+ /**
1067
+ * Read directory to add / remove files from `@watched` list and re-read it on change.
1068
+ * @param {String} dir fs path
1069
+ * @param {fs.Stats} stats
1070
+ * @param {Boolean} initialAdd
1071
+ * @param {Number} depth relative to user-supplied path
1072
+ * @param {String} target child path targeted for watch
1073
+ * @param {Object} wh Common watch helpers for this path
1074
+ * @param {String} realpath
1075
+ * @returns {Promise<Function>} closer for the watcher instance.
1076
+ */
1077
+ async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
1078
+ const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
1079
+ const tracked = parentDir.has(sysPath.basename(dir));
1080
+ if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
1081
+ if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR, dir, stats);
1082
+ }
1083
+ parentDir.add(sysPath.basename(dir));
1084
+ this.fsw._getWatchedDir(dir);
1085
+ let throttler;
1086
+ let closer;
1087
+ const oDepth = this.fsw.options.depth;
1088
+ if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
1089
+ if (!target) {
1090
+ await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
1091
+ if (this.fsw.closed) return;
1092
+ }
1093
+ closer = this._watchWithNodeFs(dir, (dirPath, stats2) => {
1094
+ if (stats2 && stats2.mtimeMs === 0) return;
1095
+ this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
1096
+ });
1097
+ }
1098
+ return closer;
1099
+ }
1100
+ /**
1101
+ * Handle added file, directory, or glob pattern.
1102
+ * Delegates call to _handleFile / _handleDir after checks.
1103
+ * @param {String} path to file or ir
1104
+ * @param {Boolean} initialAdd was the file added at watch instantiation?
1105
+ * @param {Object} priorWh depth relative to user-supplied path
1106
+ * @param {Number} depth Child path actually targeted for watch
1107
+ * @param {String=} target Child path actually targeted for watch
1108
+ * @returns {Promise}
1109
+ */
1110
+ async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
1111
+ const ready = this.fsw._emitReady;
1112
+ if (this.fsw._isIgnored(path) || this.fsw.closed) {
1113
+ ready();
1114
+ return false;
1115
+ }
1116
+ const wh = this.fsw._getWatchHelpers(path, depth);
1117
+ if (!wh.hasGlob && priorWh) {
1118
+ wh.hasGlob = priorWh.hasGlob;
1119
+ wh.globFilter = priorWh.globFilter;
1120
+ wh.filterPath = (entry) => priorWh.filterPath(entry);
1121
+ wh.filterDir = (entry) => priorWh.filterDir(entry);
1122
+ }
1123
+ try {
1124
+ const stats = await statMethods[wh.statMethod](wh.watchPath);
1125
+ if (this.fsw.closed) return;
1126
+ if (this.fsw._isIgnored(wh.watchPath, stats)) {
1127
+ ready();
1128
+ return false;
1129
+ }
1130
+ const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START);
1131
+ let closer;
1132
+ if (stats.isDirectory()) {
1133
+ const absPath = sysPath.resolve(path);
1134
+ const targetPath = follow ? await fsrealpath(path) : path;
1135
+ if (this.fsw.closed) return;
1136
+ closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
1137
+ if (this.fsw.closed) return;
1138
+ if (absPath !== targetPath && targetPath !== void 0) {
1139
+ this.fsw._symlinkPaths.set(absPath, targetPath);
1140
+ }
1141
+ } else if (stats.isSymbolicLink()) {
1142
+ const targetPath = follow ? await fsrealpath(path) : path;
1143
+ if (this.fsw.closed) return;
1144
+ const parent = sysPath.dirname(wh.watchPath);
1145
+ this.fsw._getWatchedDir(parent).add(wh.watchPath);
1146
+ this.fsw._emit(EV_ADD, wh.watchPath, stats);
1147
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
1148
+ if (this.fsw.closed) return;
1149
+ if (targetPath !== void 0) {
1150
+ this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
1151
+ }
1152
+ } else {
1153
+ closer = this._handleFile(wh.watchPath, stats, initialAdd);
1154
+ }
1155
+ ready();
1156
+ this.fsw._addPathCloser(path, closer);
1157
+ return false;
1158
+ } catch (error) {
1159
+ if (this.fsw._handleError(error)) {
1160
+ ready();
1161
+ return path;
1162
+ }
1163
+ }
1164
+ }
1165
+ };
1166
+ module.exports = NodeFsHandler;
1167
+ }
1168
+ });
1169
+
1170
+ // ../../node_modules/.pnpm/fsevents@2.3.3/node_modules/fsevents/fsevents.node
1171
+ var fsevents_default;
1172
+ var init_fsevents = __esm({
1173
+ "../../node_modules/.pnpm/fsevents@2.3.3/node_modules/fsevents/fsevents.node"() {
1174
+ fsevents_default = "./fsevents-X6WP4TKM.node";
1175
+ }
1176
+ });
1177
+
1178
+ // node-file:/Users/liquidgroove/Desktop/Vibecheck-Official/node_modules/.pnpm/fsevents@2.3.3/node_modules/fsevents/fsevents.node
1179
+ var require_fsevents = __commonJS({
1180
+ "node-file:/Users/liquidgroove/Desktop/Vibecheck-Official/node_modules/.pnpm/fsevents@2.3.3/node_modules/fsevents/fsevents.node"(exports$1, module) {
1181
+ init_fsevents();
1182
+ try {
1183
+ module.exports = __require(fsevents_default);
1184
+ } catch {
1185
+ }
1186
+ }
1187
+ });
1188
+
1189
+ // ../../node_modules/.pnpm/fsevents@2.3.3/node_modules/fsevents/fsevents.js
1190
+ var require_fsevents2 = __commonJS({
1191
+ "../../node_modules/.pnpm/fsevents@2.3.3/node_modules/fsevents/fsevents.js"(exports$1) {
1192
+ if (process.platform !== "darwin") {
1193
+ throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`);
1194
+ }
1195
+ var Native = require_fsevents();
1196
+ var events = Native.constants;
1197
+ function watch(path, since, handler) {
1198
+ if (typeof path !== "string") {
1199
+ throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`);
1200
+ }
1201
+ if ("function" === typeof since && "undefined" === typeof handler) {
1202
+ handler = since;
1203
+ since = Native.flags.SinceNow;
1204
+ }
1205
+ if (typeof since !== "number") {
1206
+ throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`);
1207
+ }
1208
+ if (typeof handler !== "function") {
1209
+ throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`);
1210
+ }
1211
+ let instance = Native.start(Native.global, path, since, handler);
1212
+ if (!instance) throw new Error(`could not watch: ${path}`);
1213
+ return () => {
1214
+ const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(void 0);
1215
+ instance = void 0;
1216
+ return result;
1217
+ };
1218
+ }
1219
+ function getInfo(path, flags) {
1220
+ return {
1221
+ path,
1222
+ flags,
1223
+ event: getEventType(flags),
1224
+ type: getFileType(flags),
1225
+ changes: getFileChanges(flags)
1226
+ };
1227
+ }
1228
+ function getFileType(flags) {
1229
+ if (events.ItemIsFile & flags) return "file";
1230
+ if (events.ItemIsDir & flags) return "directory";
1231
+ if (events.MustScanSubDirs & flags) return "directory";
1232
+ if (events.ItemIsSymlink & flags) return "symlink";
1233
+ }
1234
+ function anyIsTrue(obj) {
1235
+ for (let key in obj) {
1236
+ if (obj[key]) return true;
1237
+ }
1238
+ return false;
1239
+ }
1240
+ function getEventType(flags) {
1241
+ if (events.ItemRemoved & flags) return "deleted";
1242
+ if (events.ItemRenamed & flags) return "moved";
1243
+ if (events.ItemCreated & flags) return "created";
1244
+ if (events.ItemModified & flags) return "modified";
1245
+ if (events.RootChanged & flags) return "root-changed";
1246
+ if (events.ItemCloned & flags) return "cloned";
1247
+ if (anyIsTrue(flags)) return "modified";
1248
+ return "unknown";
1249
+ }
1250
+ function getFileChanges(flags) {
1251
+ return {
1252
+ inode: !!(events.ItemInodeMetaMod & flags),
1253
+ finder: !!(events.ItemFinderInfoMod & flags),
1254
+ access: !!(events.ItemChangeOwner & flags),
1255
+ xattrs: !!(events.ItemXattrMod & flags)
1256
+ };
1257
+ }
1258
+ exports$1.watch = watch;
1259
+ exports$1.getInfo = getInfo;
1260
+ exports$1.constants = events;
1261
+ }
1262
+ });
1263
+
1264
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js
1265
+ var require_fsevents_handler = __commonJS({
1266
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js"(exports$1, module) {
1267
+ var fs = __require("fs");
1268
+ var sysPath = __require("path");
1269
+ var { promisify } = __require("util");
1270
+ var fsevents;
1271
+ try {
1272
+ fsevents = require_fsevents2();
1273
+ } catch (error) {
1274
+ if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error);
1275
+ }
1276
+ if (fsevents) {
1277
+ const mtch = process.version.match(/v(\d+)\.(\d+)/);
1278
+ if (mtch && mtch[1] && mtch[2]) {
1279
+ const maj = Number.parseInt(mtch[1], 10);
1280
+ const min = Number.parseInt(mtch[2], 10);
1281
+ if (maj === 8 && min < 16) {
1282
+ fsevents = void 0;
1283
+ }
1284
+ }
1285
+ }
1286
+ var {
1287
+ EV_ADD,
1288
+ EV_CHANGE,
1289
+ EV_ADD_DIR,
1290
+ EV_UNLINK,
1291
+ EV_ERROR,
1292
+ STR_DATA,
1293
+ STR_END,
1294
+ FSEVENT_CREATED,
1295
+ FSEVENT_MODIFIED,
1296
+ FSEVENT_DELETED,
1297
+ FSEVENT_MOVED,
1298
+ // FSEVENT_CLONED,
1299
+ FSEVENT_UNKNOWN,
1300
+ FSEVENT_FLAG_MUST_SCAN_SUBDIRS,
1301
+ FSEVENT_TYPE_FILE,
1302
+ FSEVENT_TYPE_DIRECTORY,
1303
+ FSEVENT_TYPE_SYMLINK,
1304
+ ROOT_GLOBSTAR,
1305
+ DIR_SUFFIX,
1306
+ DOT_SLASH,
1307
+ FUNCTION_TYPE,
1308
+ EMPTY_FN,
1309
+ IDENTITY_FN
1310
+ } = require_constants();
1311
+ var Depth = (value) => isNaN(value) ? {} : { depth: value };
1312
+ var stat = promisify(fs.stat);
1313
+ var lstat = promisify(fs.lstat);
1314
+ var realpath = promisify(fs.realpath);
1315
+ var statMethods = { stat, lstat };
1316
+ var FSEventsWatchers = /* @__PURE__ */ new Map();
1317
+ var consolidateThreshhold = 10;
1318
+ var wrongEventFlags = /* @__PURE__ */ new Set([
1319
+ 69888,
1320
+ 70400,
1321
+ 71424,
1322
+ 72704,
1323
+ 73472,
1324
+ 131328,
1325
+ 131840,
1326
+ 262912
1327
+ ]);
1328
+ var createFSEventsInstance = (path, callback) => {
1329
+ const stop = fsevents.watch(path, callback);
1330
+ return { stop };
1331
+ };
1332
+ function setFSEventsListener(path, realPath, listener, rawEmitter) {
1333
+ let watchPath = sysPath.extname(realPath) ? sysPath.dirname(realPath) : realPath;
1334
+ const parentPath = sysPath.dirname(watchPath);
1335
+ let cont = FSEventsWatchers.get(watchPath);
1336
+ if (couldConsolidate(parentPath)) {
1337
+ watchPath = parentPath;
1338
+ }
1339
+ const resolvedPath = sysPath.resolve(path);
1340
+ const hasSymlink = resolvedPath !== realPath;
1341
+ const filteredListener = (fullPath, flags, info) => {
1342
+ if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath);
1343
+ if (fullPath === resolvedPath || !fullPath.indexOf(resolvedPath + sysPath.sep)) listener(fullPath, flags, info);
1344
+ };
1345
+ let watchedParent = false;
1346
+ for (const watchedPath of FSEventsWatchers.keys()) {
1347
+ if (realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep) === 0) {
1348
+ watchPath = watchedPath;
1349
+ cont = FSEventsWatchers.get(watchPath);
1350
+ watchedParent = true;
1351
+ break;
1352
+ }
1353
+ }
1354
+ if (cont || watchedParent) {
1355
+ cont.listeners.add(filteredListener);
1356
+ } else {
1357
+ cont = {
1358
+ listeners: /* @__PURE__ */ new Set([filteredListener]),
1359
+ rawEmitter,
1360
+ watcher: createFSEventsInstance(watchPath, (fullPath, flags) => {
1361
+ if (!cont.listeners.size) return;
1362
+ if (flags & FSEVENT_FLAG_MUST_SCAN_SUBDIRS) return;
1363
+ const info = fsevents.getInfo(fullPath, flags);
1364
+ cont.listeners.forEach((list) => {
1365
+ list(fullPath, flags, info);
1366
+ });
1367
+ cont.rawEmitter(info.event, fullPath, info);
1368
+ })
1369
+ };
1370
+ FSEventsWatchers.set(watchPath, cont);
1371
+ }
1372
+ return () => {
1373
+ const lst = cont.listeners;
1374
+ lst.delete(filteredListener);
1375
+ if (!lst.size) {
1376
+ FSEventsWatchers.delete(watchPath);
1377
+ if (cont.watcher) return cont.watcher.stop().then(() => {
1378
+ cont.rawEmitter = cont.watcher = void 0;
1379
+ Object.freeze(cont);
1380
+ });
1381
+ }
1382
+ };
1383
+ }
1384
+ var couldConsolidate = (path) => {
1385
+ let count = 0;
1386
+ for (const watchPath of FSEventsWatchers.keys()) {
1387
+ if (watchPath.indexOf(path) === 0) {
1388
+ count++;
1389
+ if (count >= consolidateThreshhold) {
1390
+ return true;
1391
+ }
1392
+ }
1393
+ }
1394
+ return false;
1395
+ };
1396
+ var canUse = () => fsevents && FSEventsWatchers.size < 128;
1397
+ var calcDepth = (path, root) => {
1398
+ let i = 0;
1399
+ while (!path.indexOf(root) && (path = sysPath.dirname(path)) !== root) i++;
1400
+ return i;
1401
+ };
1402
+ var sameTypes = (info, stats) => info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() || info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() || info.type === FSEVENT_TYPE_FILE && stats.isFile();
1403
+ var FsEventsHandler = class {
1404
+ /**
1405
+ * @param {import('../index').FSWatcher} fsw
1406
+ */
1407
+ constructor(fsw) {
1408
+ this.fsw = fsw;
1409
+ }
1410
+ checkIgnored(path, stats) {
1411
+ const ipaths = this.fsw._ignoredPaths;
1412
+ if (this.fsw._isIgnored(path, stats)) {
1413
+ ipaths.add(path);
1414
+ if (stats && stats.isDirectory()) {
1415
+ ipaths.add(path + ROOT_GLOBSTAR);
1416
+ }
1417
+ return true;
1418
+ }
1419
+ ipaths.delete(path);
1420
+ ipaths.delete(path + ROOT_GLOBSTAR);
1421
+ }
1422
+ addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
1423
+ const event = watchedDir.has(item) ? EV_CHANGE : EV_ADD;
1424
+ this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts);
1425
+ }
1426
+ async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
1427
+ try {
1428
+ const stats = await stat(path);
1429
+ if (this.fsw.closed) return;
1430
+ if (sameTypes(info, stats)) {
1431
+ this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
1432
+ } else {
1433
+ this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
1434
+ }
1435
+ } catch (error) {
1436
+ if (error.code === "EACCES") {
1437
+ this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
1438
+ } else {
1439
+ this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
1440
+ }
1441
+ }
1442
+ }
1443
+ handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) {
1444
+ if (this.fsw.closed || this.checkIgnored(path)) return;
1445
+ if (event === EV_UNLINK) {
1446
+ const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY;
1447
+ if (isDirectory || watchedDir.has(item)) {
1448
+ this.fsw._remove(parent, item, isDirectory);
1449
+ }
1450
+ } else {
1451
+ if (event === EV_ADD) {
1452
+ if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path);
1453
+ if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) {
1454
+ const curDepth = opts.depth === void 0 ? void 0 : calcDepth(fullPath, realPath) + 1;
1455
+ return this._addToFsEvents(path, false, true, curDepth);
1456
+ }
1457
+ this.fsw._getWatchedDir(parent).add(item);
1458
+ }
1459
+ const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event;
1460
+ this.fsw._emit(eventName, path);
1461
+ if (eventName === EV_ADD_DIR) this._addToFsEvents(path, false, true);
1462
+ }
1463
+ }
1464
+ /**
1465
+ * Handle symlinks encountered during directory scan
1466
+ * @param {String} watchPath - file/dir path to be watched with fsevents
1467
+ * @param {String} realPath - real path (in case of symlinks)
1468
+ * @param {Function} transform - path transformer
1469
+ * @param {Function} globFilter - path filter in case a glob pattern was provided
1470
+ * @returns {Function} closer for the watcher instance
1471
+ */
1472
+ _watchWithFsEvents(watchPath, realPath, transform, globFilter) {
1473
+ if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return;
1474
+ const opts = this.fsw.options;
1475
+ const watchCallback = async (fullPath, flags, info) => {
1476
+ if (this.fsw.closed) return;
1477
+ if (opts.depth !== void 0 && calcDepth(fullPath, realPath) > opts.depth) return;
1478
+ const path = transform(sysPath.join(
1479
+ watchPath,
1480
+ sysPath.relative(watchPath, fullPath)
1481
+ ));
1482
+ if (globFilter && !globFilter(path)) return;
1483
+ const parent = sysPath.dirname(path);
1484
+ const item = sysPath.basename(path);
1485
+ const watchedDir = this.fsw._getWatchedDir(
1486
+ info.type === FSEVENT_TYPE_DIRECTORY ? path : parent
1487
+ );
1488
+ if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) {
1489
+ if (typeof opts.ignored === FUNCTION_TYPE) {
1490
+ let stats;
1491
+ try {
1492
+ stats = await stat(path);
1493
+ } catch (error) {
1494
+ }
1495
+ if (this.fsw.closed) return;
1496
+ if (this.checkIgnored(path, stats)) return;
1497
+ if (sameTypes(info, stats)) {
1498
+ this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
1499
+ } else {
1500
+ this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
1501
+ }
1502
+ } else {
1503
+ this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
1504
+ }
1505
+ } else {
1506
+ switch (info.event) {
1507
+ case FSEVENT_CREATED:
1508
+ case FSEVENT_MODIFIED:
1509
+ return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
1510
+ case FSEVENT_DELETED:
1511
+ case FSEVENT_MOVED:
1512
+ return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
1513
+ }
1514
+ }
1515
+ };
1516
+ const closer = setFSEventsListener(
1517
+ watchPath,
1518
+ realPath,
1519
+ watchCallback,
1520
+ this.fsw._emitRaw
1521
+ );
1522
+ this.fsw._emitReady();
1523
+ return closer;
1524
+ }
1525
+ /**
1526
+ * Handle symlinks encountered during directory scan
1527
+ * @param {String} linkPath path to symlink
1528
+ * @param {String} fullPath absolute path to the symlink
1529
+ * @param {Function} transform pre-existing path transformer
1530
+ * @param {Number} curDepth level of subdirectories traversed to where symlink is
1531
+ * @returns {Promise<void>}
1532
+ */
1533
+ async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) {
1534
+ if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return;
1535
+ this.fsw._symlinkPaths.set(fullPath, true);
1536
+ this.fsw._incrReadyCount();
1537
+ try {
1538
+ const linkTarget = await realpath(linkPath);
1539
+ if (this.fsw.closed) return;
1540
+ if (this.fsw._isIgnored(linkTarget)) {
1541
+ return this.fsw._emitReady();
1542
+ }
1543
+ this.fsw._incrReadyCount();
1544
+ this._addToFsEvents(linkTarget || linkPath, (path) => {
1545
+ let aliasedPath = linkPath;
1546
+ if (linkTarget && linkTarget !== DOT_SLASH) {
1547
+ aliasedPath = path.replace(linkTarget, linkPath);
1548
+ } else if (path !== DOT_SLASH) {
1549
+ aliasedPath = sysPath.join(linkPath, path);
1550
+ }
1551
+ return transform(aliasedPath);
1552
+ }, false, curDepth);
1553
+ } catch (error) {
1554
+ if (this.fsw._handleError(error)) {
1555
+ return this.fsw._emitReady();
1556
+ }
1557
+ }
1558
+ }
1559
+ /**
1560
+ *
1561
+ * @param {Path} newPath
1562
+ * @param {fs.Stats} stats
1563
+ */
1564
+ emitAdd(newPath, stats, processPath, opts, forceAdd) {
1565
+ const pp = processPath(newPath);
1566
+ const isDir = stats.isDirectory();
1567
+ const dirObj = this.fsw._getWatchedDir(sysPath.dirname(pp));
1568
+ const base = sysPath.basename(pp);
1569
+ if (isDir) this.fsw._getWatchedDir(pp);
1570
+ if (dirObj.has(base)) return;
1571
+ dirObj.add(base);
1572
+ if (!opts.ignoreInitial || forceAdd === true) {
1573
+ this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats);
1574
+ }
1575
+ }
1576
+ initWatch(realPath, path, wh, processPath) {
1577
+ if (this.fsw.closed) return;
1578
+ const closer = this._watchWithFsEvents(
1579
+ wh.watchPath,
1580
+ sysPath.resolve(realPath || wh.watchPath),
1581
+ processPath,
1582
+ wh.globFilter
1583
+ );
1584
+ this.fsw._addPathCloser(path, closer);
1585
+ }
1586
+ /**
1587
+ * Handle added path with fsevents
1588
+ * @param {String} path file/dir path or glob pattern
1589
+ * @param {Function|Boolean=} transform converts working path to what the user expects
1590
+ * @param {Boolean=} forceAdd ensure add is emitted
1591
+ * @param {Number=} priorDepth Level of subdirectories already traversed.
1592
+ * @returns {Promise<void>}
1593
+ */
1594
+ async _addToFsEvents(path, transform, forceAdd, priorDepth) {
1595
+ if (this.fsw.closed) {
1596
+ return;
1597
+ }
1598
+ const opts = this.fsw.options;
1599
+ const processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN;
1600
+ const wh = this.fsw._getWatchHelpers(path);
1601
+ try {
1602
+ const stats = await statMethods[wh.statMethod](wh.watchPath);
1603
+ if (this.fsw.closed) return;
1604
+ if (this.fsw._isIgnored(wh.watchPath, stats)) {
1605
+ throw null;
1606
+ }
1607
+ if (stats.isDirectory()) {
1608
+ if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd);
1609
+ if (priorDepth && priorDepth > opts.depth) return;
1610
+ this.fsw._readdirp(wh.watchPath, {
1611
+ fileFilter: (entry) => wh.filterPath(entry),
1612
+ directoryFilter: (entry) => wh.filterDir(entry),
1613
+ ...Depth(opts.depth - (priorDepth || 0))
1614
+ }).on(STR_DATA, (entry) => {
1615
+ if (this.fsw.closed) {
1616
+ return;
1617
+ }
1618
+ if (entry.stats.isDirectory() && !wh.filterPath(entry)) return;
1619
+ const joinedPath = sysPath.join(wh.watchPath, entry.path);
1620
+ const { fullPath } = entry;
1621
+ if (wh.followSymlinks && entry.stats.isSymbolicLink()) {
1622
+ const curDepth = opts.depth === void 0 ? void 0 : calcDepth(joinedPath, sysPath.resolve(wh.watchPath)) + 1;
1623
+ this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth);
1624
+ } else {
1625
+ this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd);
1626
+ }
1627
+ }).on(EV_ERROR, EMPTY_FN).on(STR_END, () => {
1628
+ this.fsw._emitReady();
1629
+ });
1630
+ } else {
1631
+ this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd);
1632
+ this.fsw._emitReady();
1633
+ }
1634
+ } catch (error) {
1635
+ if (!error || this.fsw._handleError(error)) {
1636
+ this.fsw._emitReady();
1637
+ this.fsw._emitReady();
1638
+ }
1639
+ }
1640
+ if (opts.persistent && forceAdd !== true) {
1641
+ if (typeof transform === FUNCTION_TYPE) {
1642
+ this.initWatch(void 0, path, wh, processPath);
1643
+ } else {
1644
+ let realPath;
1645
+ try {
1646
+ realPath = await realpath(wh.watchPath);
1647
+ } catch (e) {
1648
+ }
1649
+ this.initWatch(realPath, path, wh, processPath);
1650
+ }
1651
+ }
1652
+ }
1653
+ };
1654
+ module.exports = FsEventsHandler;
1655
+ module.exports.canUse = canUse;
1656
+ }
1657
+ });
1658
+
1659
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js
1660
+ var require_chokidar = __commonJS({
1661
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js"(exports$1) {
1662
+ var { EventEmitter } = __require("events");
1663
+ var fs = __require("fs");
1664
+ var sysPath = __require("path");
1665
+ var { promisify } = __require("util");
1666
+ var readdirp = require_readdirp();
1667
+ var anymatch = require_anymatch().default;
1668
+ var globParent = require_glob_parent();
1669
+ var isGlob = require_is_glob();
1670
+ var braces = require_braces();
1671
+ var normalizePath = require_normalize_path();
1672
+ var NodeFsHandler = require_nodefs_handler();
1673
+ var FsEventsHandler = require_fsevents_handler();
1674
+ var {
1675
+ EV_ALL,
1676
+ EV_READY,
1677
+ EV_ADD,
1678
+ EV_CHANGE,
1679
+ EV_UNLINK,
1680
+ EV_ADD_DIR,
1681
+ EV_UNLINK_DIR,
1682
+ EV_RAW,
1683
+ EV_ERROR,
1684
+ STR_CLOSE,
1685
+ STR_END,
1686
+ BACK_SLASH_RE,
1687
+ DOUBLE_SLASH_RE,
1688
+ SLASH_OR_BACK_SLASH_RE,
1689
+ DOT_RE,
1690
+ REPLACER_RE,
1691
+ SLASH,
1692
+ SLASH_SLASH,
1693
+ BRACE_START,
1694
+ BANG,
1695
+ ONE_DOT,
1696
+ TWO_DOTS,
1697
+ GLOBSTAR,
1698
+ SLASH_GLOBSTAR,
1699
+ ANYMATCH_OPTS,
1700
+ STRING_TYPE,
1701
+ FUNCTION_TYPE,
1702
+ EMPTY_STR,
1703
+ EMPTY_FN,
1704
+ isWindows,
1705
+ isMacos,
1706
+ isIBMi
1707
+ } = require_constants();
1708
+ var stat = promisify(fs.stat);
1709
+ var readdir = promisify(fs.readdir);
1710
+ var arrify = (value = []) => Array.isArray(value) ? value : [value];
1711
+ var flatten = (list, result = []) => {
1712
+ list.forEach((item) => {
1713
+ if (Array.isArray(item)) {
1714
+ flatten(item, result);
1715
+ } else {
1716
+ result.push(item);
1717
+ }
1718
+ });
1719
+ return result;
1720
+ };
1721
+ var unifyPaths = (paths_) => {
1722
+ const paths = flatten(arrify(paths_));
1723
+ if (!paths.every((p) => typeof p === STRING_TYPE)) {
1724
+ throw new TypeError(`Non-string provided as watch path: ${paths}`);
1725
+ }
1726
+ return paths.map(normalizePathToUnix);
1727
+ };
1728
+ var toUnix = (string) => {
1729
+ let str = string.replace(BACK_SLASH_RE, SLASH);
1730
+ let prepend = false;
1731
+ if (str.startsWith(SLASH_SLASH)) {
1732
+ prepend = true;
1733
+ }
1734
+ while (str.match(DOUBLE_SLASH_RE)) {
1735
+ str = str.replace(DOUBLE_SLASH_RE, SLASH);
1736
+ }
1737
+ if (prepend) {
1738
+ str = SLASH + str;
1739
+ }
1740
+ return str;
1741
+ };
1742
+ var normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path)));
1743
+ var normalizeIgnored = (cwd = EMPTY_STR) => (path) => {
1744
+ if (typeof path !== STRING_TYPE) return path;
1745
+ return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path));
1746
+ };
1747
+ var getAbsolutePath = (path, cwd) => {
1748
+ if (sysPath.isAbsolute(path)) {
1749
+ return path;
1750
+ }
1751
+ if (path.startsWith(BANG)) {
1752
+ return BANG + sysPath.join(cwd, path.slice(1));
1753
+ }
1754
+ return sysPath.join(cwd, path);
1755
+ };
1756
+ var undef = (opts, key) => opts[key] === void 0;
1757
+ var DirEntry = class {
1758
+ /**
1759
+ * @param {Path} dir
1760
+ * @param {Function} removeWatcher
1761
+ */
1762
+ constructor(dir, removeWatcher) {
1763
+ this.path = dir;
1764
+ this._removeWatcher = removeWatcher;
1765
+ this.items = /* @__PURE__ */ new Set();
1766
+ }
1767
+ add(item) {
1768
+ const { items } = this;
1769
+ if (!items) return;
1770
+ if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item);
1771
+ }
1772
+ async remove(item) {
1773
+ const { items } = this;
1774
+ if (!items) return;
1775
+ items.delete(item);
1776
+ if (items.size > 0) return;
1777
+ const dir = this.path;
1778
+ try {
1779
+ await readdir(dir);
1780
+ } catch (err) {
1781
+ if (this._removeWatcher) {
1782
+ this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir));
1783
+ }
1784
+ }
1785
+ }
1786
+ has(item) {
1787
+ const { items } = this;
1788
+ if (!items) return;
1789
+ return items.has(item);
1790
+ }
1791
+ /**
1792
+ * @returns {Array<String>}
1793
+ */
1794
+ getChildren() {
1795
+ const { items } = this;
1796
+ if (!items) return;
1797
+ return [...items.values()];
1798
+ }
1799
+ dispose() {
1800
+ this.items.clear();
1801
+ delete this.path;
1802
+ delete this._removeWatcher;
1803
+ delete this.items;
1804
+ Object.freeze(this);
1805
+ }
1806
+ };
1807
+ var STAT_METHOD_F = "stat";
1808
+ var STAT_METHOD_L = "lstat";
1809
+ var WatchHelper = class {
1810
+ constructor(path, watchPath, follow, fsw) {
1811
+ this.fsw = fsw;
1812
+ this.path = path = path.replace(REPLACER_RE, EMPTY_STR);
1813
+ this.watchPath = watchPath;
1814
+ this.fullWatchPath = sysPath.resolve(watchPath);
1815
+ this.hasGlob = watchPath !== path;
1816
+ if (path === EMPTY_STR) this.hasGlob = false;
1817
+ this.globSymlink = this.hasGlob && follow ? void 0 : false;
1818
+ this.globFilter = this.hasGlob ? anymatch(path, void 0, ANYMATCH_OPTS) : false;
1819
+ this.dirParts = this.getDirParts(path);
1820
+ this.dirParts.forEach((parts) => {
1821
+ if (parts.length > 1) parts.pop();
1822
+ });
1823
+ this.followSymlinks = follow;
1824
+ this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
1825
+ }
1826
+ checkGlobSymlink(entry) {
1827
+ if (this.globSymlink === void 0) {
1828
+ this.globSymlink = entry.fullParentDir === this.fullWatchPath ? false : { realPath: entry.fullParentDir, linkPath: this.fullWatchPath };
1829
+ }
1830
+ if (this.globSymlink) {
1831
+ return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath);
1832
+ }
1833
+ return entry.fullPath;
1834
+ }
1835
+ entryPath(entry) {
1836
+ return sysPath.join(
1837
+ this.watchPath,
1838
+ sysPath.relative(this.watchPath, this.checkGlobSymlink(entry))
1839
+ );
1840
+ }
1841
+ filterPath(entry) {
1842
+ const { stats } = entry;
1843
+ if (stats && stats.isSymbolicLink()) return this.filterDir(entry);
1844
+ const resolvedPath = this.entryPath(entry);
1845
+ const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? this.globFilter(resolvedPath) : true;
1846
+ return matchesGlob && this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
1847
+ }
1848
+ getDirParts(path) {
1849
+ if (!this.hasGlob) return [];
1850
+ const parts = [];
1851
+ const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path];
1852
+ expandedPath.forEach((path2) => {
1853
+ parts.push(sysPath.relative(this.watchPath, path2).split(SLASH_OR_BACK_SLASH_RE));
1854
+ });
1855
+ return parts;
1856
+ }
1857
+ filterDir(entry) {
1858
+ if (this.hasGlob) {
1859
+ const entryParts = this.getDirParts(this.checkGlobSymlink(entry));
1860
+ let globstar = false;
1861
+ this.unmatchedGlob = !this.dirParts.some((parts) => {
1862
+ return parts.every((part, i) => {
1863
+ if (part === GLOBSTAR) globstar = true;
1864
+ return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS);
1865
+ });
1866
+ });
1867
+ }
1868
+ return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
1869
+ }
1870
+ };
1871
+ var FSWatcher = class extends EventEmitter {
1872
+ // Not indenting methods for history sake; for now.
1873
+ constructor(_opts) {
1874
+ super();
1875
+ const opts = {};
1876
+ if (_opts) Object.assign(opts, _opts);
1877
+ this._watched = /* @__PURE__ */ new Map();
1878
+ this._closers = /* @__PURE__ */ new Map();
1879
+ this._ignoredPaths = /* @__PURE__ */ new Set();
1880
+ this._throttled = /* @__PURE__ */ new Map();
1881
+ this._symlinkPaths = /* @__PURE__ */ new Map();
1882
+ this._streams = /* @__PURE__ */ new Set();
1883
+ this.closed = false;
1884
+ if (undef(opts, "persistent")) opts.persistent = true;
1885
+ if (undef(opts, "ignoreInitial")) opts.ignoreInitial = false;
1886
+ if (undef(opts, "ignorePermissionErrors")) opts.ignorePermissionErrors = false;
1887
+ if (undef(opts, "interval")) opts.interval = 100;
1888
+ if (undef(opts, "binaryInterval")) opts.binaryInterval = 300;
1889
+ if (undef(opts, "disableGlobbing")) opts.disableGlobbing = false;
1890
+ opts.enableBinaryInterval = opts.binaryInterval !== opts.interval;
1891
+ if (undef(opts, "useFsEvents")) opts.useFsEvents = !opts.usePolling;
1892
+ const canUseFsEvents = FsEventsHandler.canUse();
1893
+ if (!canUseFsEvents) opts.useFsEvents = false;
1894
+ if (undef(opts, "usePolling") && !opts.useFsEvents) {
1895
+ opts.usePolling = isMacos;
1896
+ }
1897
+ if (isIBMi) {
1898
+ opts.usePolling = true;
1899
+ }
1900
+ const envPoll = process.env.CHOKIDAR_USEPOLLING;
1901
+ if (envPoll !== void 0) {
1902
+ const envLower = envPoll.toLowerCase();
1903
+ if (envLower === "false" || envLower === "0") {
1904
+ opts.usePolling = false;
1905
+ } else if (envLower === "true" || envLower === "1") {
1906
+ opts.usePolling = true;
1907
+ } else {
1908
+ opts.usePolling = !!envLower;
1909
+ }
1910
+ }
1911
+ const envInterval = process.env.CHOKIDAR_INTERVAL;
1912
+ if (envInterval) {
1913
+ opts.interval = Number.parseInt(envInterval, 10);
1914
+ }
1915
+ if (undef(opts, "atomic")) opts.atomic = !opts.usePolling && !opts.useFsEvents;
1916
+ if (opts.atomic) this._pendingUnlinks = /* @__PURE__ */ new Map();
1917
+ if (undef(opts, "followSymlinks")) opts.followSymlinks = true;
1918
+ if (undef(opts, "awaitWriteFinish")) opts.awaitWriteFinish = false;
1919
+ if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {};
1920
+ const awf = opts.awaitWriteFinish;
1921
+ if (awf) {
1922
+ if (!awf.stabilityThreshold) awf.stabilityThreshold = 2e3;
1923
+ if (!awf.pollInterval) awf.pollInterval = 100;
1924
+ this._pendingWrites = /* @__PURE__ */ new Map();
1925
+ }
1926
+ if (opts.ignored) opts.ignored = arrify(opts.ignored);
1927
+ let readyCalls = 0;
1928
+ this._emitReady = () => {
1929
+ readyCalls++;
1930
+ if (readyCalls >= this._readyCount) {
1931
+ this._emitReady = EMPTY_FN;
1932
+ this._readyEmitted = true;
1933
+ process.nextTick(() => this.emit(EV_READY));
1934
+ }
1935
+ };
1936
+ this._emitRaw = (...args) => this.emit(EV_RAW, ...args);
1937
+ this._readyEmitted = false;
1938
+ this.options = opts;
1939
+ if (opts.useFsEvents) {
1940
+ this._fsEventsHandler = new FsEventsHandler(this);
1941
+ } else {
1942
+ this._nodeFsHandler = new NodeFsHandler(this);
1943
+ }
1944
+ Object.freeze(opts);
1945
+ }
1946
+ // Public methods
1947
+ /**
1948
+ * Adds paths to be watched on an existing FSWatcher instance
1949
+ * @param {Path|Array<Path>} paths_
1950
+ * @param {String=} _origAdd private; for handling non-existent paths to be watched
1951
+ * @param {Boolean=} _internal private; indicates a non-user add
1952
+ * @returns {FSWatcher} for chaining
1953
+ */
1954
+ add(paths_, _origAdd, _internal) {
1955
+ const { cwd, disableGlobbing } = this.options;
1956
+ this.closed = false;
1957
+ let paths = unifyPaths(paths_);
1958
+ if (cwd) {
1959
+ paths = paths.map((path) => {
1960
+ const absPath = getAbsolutePath(path, cwd);
1961
+ if (disableGlobbing || !isGlob(path)) {
1962
+ return absPath;
1963
+ }
1964
+ return normalizePath(absPath);
1965
+ });
1966
+ }
1967
+ paths = paths.filter((path) => {
1968
+ if (path.startsWith(BANG)) {
1969
+ this._ignoredPaths.add(path.slice(1));
1970
+ return false;
1971
+ }
1972
+ this._ignoredPaths.delete(path);
1973
+ this._ignoredPaths.delete(path + SLASH_GLOBSTAR);
1974
+ this._userIgnored = void 0;
1975
+ return true;
1976
+ });
1977
+ if (this.options.useFsEvents && this._fsEventsHandler) {
1978
+ if (!this._readyCount) this._readyCount = paths.length;
1979
+ if (this.options.persistent) this._readyCount += paths.length;
1980
+ paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path));
1981
+ } else {
1982
+ if (!this._readyCount) this._readyCount = 0;
1983
+ this._readyCount += paths.length;
1984
+ Promise.all(
1985
+ paths.map(async (path) => {
1986
+ const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd);
1987
+ if (res) this._emitReady();
1988
+ return res;
1989
+ })
1990
+ ).then((results) => {
1991
+ if (this.closed) return;
1992
+ results.filter((item) => item).forEach((item) => {
1993
+ this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item));
1994
+ });
1995
+ });
1996
+ }
1997
+ return this;
1998
+ }
1999
+ /**
2000
+ * Close watchers or start ignoring events from specified paths.
2001
+ * @param {Path|Array<Path>} paths_ - string or array of strings, file/directory paths and/or globs
2002
+ * @returns {FSWatcher} for chaining
2003
+ */
2004
+ unwatch(paths_) {
2005
+ if (this.closed) return this;
2006
+ const paths = unifyPaths(paths_);
2007
+ const { cwd } = this.options;
2008
+ paths.forEach((path) => {
2009
+ if (!sysPath.isAbsolute(path) && !this._closers.has(path)) {
2010
+ if (cwd) path = sysPath.join(cwd, path);
2011
+ path = sysPath.resolve(path);
2012
+ }
2013
+ this._closePath(path);
2014
+ this._ignoredPaths.add(path);
2015
+ if (this._watched.has(path)) {
2016
+ this._ignoredPaths.add(path + SLASH_GLOBSTAR);
2017
+ }
2018
+ this._userIgnored = void 0;
2019
+ });
2020
+ return this;
2021
+ }
2022
+ /**
2023
+ * Close watchers and remove all listeners from watched paths.
2024
+ * @returns {Promise<void>}.
2025
+ */
2026
+ close() {
2027
+ if (this.closed) return this._closePromise;
2028
+ this.closed = true;
2029
+ this.removeAllListeners();
2030
+ const closers = [];
2031
+ this._closers.forEach((closerList) => closerList.forEach((closer) => {
2032
+ const promise = closer();
2033
+ if (promise instanceof Promise) closers.push(promise);
2034
+ }));
2035
+ this._streams.forEach((stream) => stream.destroy());
2036
+ this._userIgnored = void 0;
2037
+ this._readyCount = 0;
2038
+ this._readyEmitted = false;
2039
+ this._watched.forEach((dirent) => dirent.dispose());
2040
+ ["closers", "watched", "streams", "symlinkPaths", "throttled"].forEach((key) => {
2041
+ this[`_${key}`].clear();
2042
+ });
2043
+ this._closePromise = closers.length ? Promise.all(closers).then(() => void 0) : Promise.resolve();
2044
+ return this._closePromise;
2045
+ }
2046
+ /**
2047
+ * Expose list of watched paths
2048
+ * @returns {Object} for chaining
2049
+ */
2050
+ getWatched() {
2051
+ const watchList = {};
2052
+ this._watched.forEach((entry, dir) => {
2053
+ const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir;
2054
+ watchList[key || ONE_DOT] = entry.getChildren().sort();
2055
+ });
2056
+ return watchList;
2057
+ }
2058
+ emitWithAll(event, args) {
2059
+ this.emit(...args);
2060
+ if (event !== EV_ERROR) this.emit(EV_ALL, ...args);
2061
+ }
2062
+ // Common helpers
2063
+ // --------------
2064
+ /**
2065
+ * Normalize and emit events.
2066
+ * Calling _emit DOES NOT MEAN emit() would be called!
2067
+ * @param {EventName} event Type of event
2068
+ * @param {Path} path File or directory path
2069
+ * @param {*=} val1 arguments to be passed with event
2070
+ * @param {*=} val2
2071
+ * @param {*=} val3
2072
+ * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
2073
+ */
2074
+ async _emit(event, path, val1, val2, val3) {
2075
+ if (this.closed) return;
2076
+ const opts = this.options;
2077
+ if (isWindows) path = sysPath.normalize(path);
2078
+ if (opts.cwd) path = sysPath.relative(opts.cwd, path);
2079
+ const args = [event, path];
2080
+ if (val3 !== void 0) args.push(val1, val2, val3);
2081
+ else if (val2 !== void 0) args.push(val1, val2);
2082
+ else if (val1 !== void 0) args.push(val1);
2083
+ const awf = opts.awaitWriteFinish;
2084
+ let pw;
2085
+ if (awf && (pw = this._pendingWrites.get(path))) {
2086
+ pw.lastChange = /* @__PURE__ */ new Date();
2087
+ return this;
2088
+ }
2089
+ if (opts.atomic) {
2090
+ if (event === EV_UNLINK) {
2091
+ this._pendingUnlinks.set(path, args);
2092
+ setTimeout(() => {
2093
+ this._pendingUnlinks.forEach((entry, path2) => {
2094
+ this.emit(...entry);
2095
+ this.emit(EV_ALL, ...entry);
2096
+ this._pendingUnlinks.delete(path2);
2097
+ });
2098
+ }, typeof opts.atomic === "number" ? opts.atomic : 100);
2099
+ return this;
2100
+ }
2101
+ if (event === EV_ADD && this._pendingUnlinks.has(path)) {
2102
+ event = args[0] = EV_CHANGE;
2103
+ this._pendingUnlinks.delete(path);
2104
+ }
2105
+ }
2106
+ if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) {
2107
+ const awfEmit = (err, stats) => {
2108
+ if (err) {
2109
+ event = args[0] = EV_ERROR;
2110
+ args[1] = err;
2111
+ this.emitWithAll(event, args);
2112
+ } else if (stats) {
2113
+ if (args.length > 2) {
2114
+ args[2] = stats;
2115
+ } else {
2116
+ args.push(stats);
2117
+ }
2118
+ this.emitWithAll(event, args);
2119
+ }
2120
+ };
2121
+ this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit);
2122
+ return this;
2123
+ }
2124
+ if (event === EV_CHANGE) {
2125
+ const isThrottled = !this._throttle(EV_CHANGE, path, 50);
2126
+ if (isThrottled) return this;
2127
+ }
2128
+ if (opts.alwaysStat && val1 === void 0 && (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE)) {
2129
+ const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path;
2130
+ let stats;
2131
+ try {
2132
+ stats = await stat(fullPath);
2133
+ } catch (err) {
2134
+ }
2135
+ if (!stats || this.closed) return;
2136
+ args.push(stats);
2137
+ }
2138
+ this.emitWithAll(event, args);
2139
+ return this;
2140
+ }
2141
+ /**
2142
+ * Common handler for errors
2143
+ * @param {Error} error
2144
+ * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
2145
+ */
2146
+ _handleError(error) {
2147
+ const code = error && error.code;
2148
+ if (error && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) {
2149
+ this.emit(EV_ERROR, error);
2150
+ }
2151
+ return error || this.closed;
2152
+ }
2153
+ /**
2154
+ * Helper utility for throttling
2155
+ * @param {ThrottleType} actionType type being throttled
2156
+ * @param {Path} path being acted upon
2157
+ * @param {Number} timeout duration of time to suppress duplicate actions
2158
+ * @returns {Object|false} tracking object or false if action should be suppressed
2159
+ */
2160
+ _throttle(actionType, path, timeout) {
2161
+ if (!this._throttled.has(actionType)) {
2162
+ this._throttled.set(actionType, /* @__PURE__ */ new Map());
2163
+ }
2164
+ const action = this._throttled.get(actionType);
2165
+ const actionPath = action.get(path);
2166
+ if (actionPath) {
2167
+ actionPath.count++;
2168
+ return false;
2169
+ }
2170
+ let timeoutObject;
2171
+ const clear = () => {
2172
+ const item = action.get(path);
2173
+ const count = item ? item.count : 0;
2174
+ action.delete(path);
2175
+ clearTimeout(timeoutObject);
2176
+ if (item) clearTimeout(item.timeoutObject);
2177
+ return count;
2178
+ };
2179
+ timeoutObject = setTimeout(clear, timeout);
2180
+ const thr = { timeoutObject, clear, count: 0 };
2181
+ action.set(path, thr);
2182
+ return thr;
2183
+ }
2184
+ _incrReadyCount() {
2185
+ return this._readyCount++;
2186
+ }
2187
+ /**
2188
+ * Awaits write operation to finish.
2189
+ * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
2190
+ * @param {Path} path being acted upon
2191
+ * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
2192
+ * @param {EventName} event
2193
+ * @param {Function} awfEmit Callback to be called when ready for event to be emitted.
2194
+ */
2195
+ _awaitWriteFinish(path, threshold, event, awfEmit) {
2196
+ let timeoutHandler;
2197
+ let fullPath = path;
2198
+ if (this.options.cwd && !sysPath.isAbsolute(path)) {
2199
+ fullPath = sysPath.join(this.options.cwd, path);
2200
+ }
2201
+ const now = /* @__PURE__ */ new Date();
2202
+ const awaitWriteFinish = (prevStat) => {
2203
+ fs.stat(fullPath, (err, curStat) => {
2204
+ if (err || !this._pendingWrites.has(path)) {
2205
+ if (err && err.code !== "ENOENT") awfEmit(err);
2206
+ return;
2207
+ }
2208
+ const now2 = Number(/* @__PURE__ */ new Date());
2209
+ if (prevStat && curStat.size !== prevStat.size) {
2210
+ this._pendingWrites.get(path).lastChange = now2;
2211
+ }
2212
+ const pw = this._pendingWrites.get(path);
2213
+ const df = now2 - pw.lastChange;
2214
+ if (df >= threshold) {
2215
+ this._pendingWrites.delete(path);
2216
+ awfEmit(void 0, curStat);
2217
+ } else {
2218
+ timeoutHandler = setTimeout(
2219
+ awaitWriteFinish,
2220
+ this.options.awaitWriteFinish.pollInterval,
2221
+ curStat
2222
+ );
2223
+ }
2224
+ });
2225
+ };
2226
+ if (!this._pendingWrites.has(path)) {
2227
+ this._pendingWrites.set(path, {
2228
+ lastChange: now,
2229
+ cancelWait: () => {
2230
+ this._pendingWrites.delete(path);
2231
+ clearTimeout(timeoutHandler);
2232
+ return event;
2233
+ }
2234
+ });
2235
+ timeoutHandler = setTimeout(
2236
+ awaitWriteFinish,
2237
+ this.options.awaitWriteFinish.pollInterval
2238
+ );
2239
+ }
2240
+ }
2241
+ _getGlobIgnored() {
2242
+ return [...this._ignoredPaths.values()];
2243
+ }
2244
+ /**
2245
+ * Determines whether user has asked to ignore this path.
2246
+ * @param {Path} path filepath or dir
2247
+ * @param {fs.Stats=} stats result of fs.stat
2248
+ * @returns {Boolean}
2249
+ */
2250
+ _isIgnored(path, stats) {
2251
+ if (this.options.atomic && DOT_RE.test(path)) return true;
2252
+ if (!this._userIgnored) {
2253
+ const { cwd } = this.options;
2254
+ const ign = this.options.ignored;
2255
+ const ignored = ign && ign.map(normalizeIgnored(cwd));
2256
+ const paths = arrify(ignored).filter((path2) => typeof path2 === STRING_TYPE && !isGlob(path2)).map((path2) => path2 + SLASH_GLOBSTAR);
2257
+ const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths);
2258
+ this._userIgnored = anymatch(list, void 0, ANYMATCH_OPTS);
2259
+ }
2260
+ return this._userIgnored([path, stats]);
2261
+ }
2262
+ _isntIgnored(path, stat2) {
2263
+ return !this._isIgnored(path, stat2);
2264
+ }
2265
+ /**
2266
+ * Provides a set of common helpers and properties relating to symlink and glob handling.
2267
+ * @param {Path} path file, directory, or glob pattern being watched
2268
+ * @param {Number=} depth at any depth > 0, this isn't a glob
2269
+ * @returns {WatchHelper} object containing helpers for this path
2270
+ */
2271
+ _getWatchHelpers(path, depth) {
2272
+ const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path);
2273
+ const follow = this.options.followSymlinks;
2274
+ return new WatchHelper(path, watchPath, follow, this);
2275
+ }
2276
+ // Directory helpers
2277
+ // -----------------
2278
+ /**
2279
+ * Provides directory tracking objects
2280
+ * @param {String} directory path of the directory
2281
+ * @returns {DirEntry} the directory's tracking object
2282
+ */
2283
+ _getWatchedDir(directory) {
2284
+ if (!this._boundRemove) this._boundRemove = this._remove.bind(this);
2285
+ const dir = sysPath.resolve(directory);
2286
+ if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
2287
+ return this._watched.get(dir);
2288
+ }
2289
+ // File helpers
2290
+ // ------------
2291
+ /**
2292
+ * Check for read permissions.
2293
+ * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405
2294
+ * @param {fs.Stats} stats - object, result of fs_stat
2295
+ * @returns {Boolean} indicates whether the file can be read
2296
+ */
2297
+ _hasReadPermissions(stats) {
2298
+ if (this.options.ignorePermissionErrors) return true;
2299
+ const md = stats && Number.parseInt(stats.mode, 10);
2300
+ const st = md & 511;
2301
+ const it = Number.parseInt(st.toString(8)[0], 10);
2302
+ return Boolean(4 & it);
2303
+ }
2304
+ /**
2305
+ * Handles emitting unlink events for
2306
+ * files and directories, and via recursion, for
2307
+ * files and directories within directories that are unlinked
2308
+ * @param {String} directory within which the following item is located
2309
+ * @param {String} item base path of item/directory
2310
+ * @returns {void}
2311
+ */
2312
+ _remove(directory, item, isDirectory) {
2313
+ const path = sysPath.join(directory, item);
2314
+ const fullPath = sysPath.resolve(path);
2315
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
2316
+ if (!this._throttle("remove", path, 100)) return;
2317
+ if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) {
2318
+ this.add(directory, item, true);
2319
+ }
2320
+ const wp = this._getWatchedDir(path);
2321
+ const nestedDirectoryChildren = wp.getChildren();
2322
+ nestedDirectoryChildren.forEach((nested) => this._remove(path, nested));
2323
+ const parent = this._getWatchedDir(directory);
2324
+ const wasTracked = parent.has(item);
2325
+ parent.remove(item);
2326
+ if (this._symlinkPaths.has(fullPath)) {
2327
+ this._symlinkPaths.delete(fullPath);
2328
+ }
2329
+ let relPath = path;
2330
+ if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path);
2331
+ if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
2332
+ const event = this._pendingWrites.get(relPath).cancelWait();
2333
+ if (event === EV_ADD) return;
2334
+ }
2335
+ this._watched.delete(path);
2336
+ this._watched.delete(fullPath);
2337
+ const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK;
2338
+ if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path);
2339
+ if (!this.options.useFsEvents) {
2340
+ this._closePath(path);
2341
+ }
2342
+ }
2343
+ /**
2344
+ * Closes all watchers for a path
2345
+ * @param {Path} path
2346
+ */
2347
+ _closePath(path) {
2348
+ this._closeFile(path);
2349
+ const dir = sysPath.dirname(path);
2350
+ this._getWatchedDir(dir).remove(sysPath.basename(path));
2351
+ }
2352
+ /**
2353
+ * Closes only file-specific watchers
2354
+ * @param {Path} path
2355
+ */
2356
+ _closeFile(path) {
2357
+ const closers = this._closers.get(path);
2358
+ if (!closers) return;
2359
+ closers.forEach((closer) => closer());
2360
+ this._closers.delete(path);
2361
+ }
2362
+ /**
2363
+ *
2364
+ * @param {Path} path
2365
+ * @param {Function} closer
2366
+ */
2367
+ _addPathCloser(path, closer) {
2368
+ if (!closer) return;
2369
+ let list = this._closers.get(path);
2370
+ if (!list) {
2371
+ list = [];
2372
+ this._closers.set(path, list);
2373
+ }
2374
+ list.push(closer);
2375
+ }
2376
+ _readdirp(root, opts) {
2377
+ if (this.closed) return;
2378
+ const options = { type: EV_ALL, alwaysStat: true, lstat: true, ...opts };
2379
+ let stream = readdirp(root, options);
2380
+ this._streams.add(stream);
2381
+ stream.once(STR_CLOSE, () => {
2382
+ stream = void 0;
2383
+ });
2384
+ stream.once(STR_END, () => {
2385
+ if (stream) {
2386
+ this._streams.delete(stream);
2387
+ stream = void 0;
2388
+ }
2389
+ });
2390
+ return stream;
2391
+ }
2392
+ };
2393
+ exports$1.FSWatcher = FSWatcher;
2394
+ var watch = (paths, options) => {
2395
+ const watcher = new FSWatcher(options);
2396
+ watcher.add(paths);
2397
+ return watcher;
2398
+ };
2399
+ exports$1.watch = watch;
2400
+ }
2401
+ });
2402
+ var chokidarCI5VJY5M = require_chokidar();
2403
+ /*! Bundled license information:
2404
+
2405
+ normalize-path/index.js:
2406
+ (*!
2407
+ * normalize-path <https://github.com/jonschlinkert/normalize-path>
2408
+ *
2409
+ * Copyright (c) 2014-2018, Jon Schlinkert.
2410
+ * Released under the MIT License.
2411
+ *)
2412
+ */
2413
+
2414
+ export { chokidarCI5VJY5M as default };