@shopify/cli 3.73.2 → 3.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/assets/dev-console/extensions/dev-console/assets/{index-D7F9wNys.js → index-lyGm6l3x.js} +12 -12
  2. package/dist/assets/dev-console/index.html +2 -2
  3. package/dist/assets/speedscope/SourceCodePro-Regular.ttf.f546cbe0.woff2 +0 -0
  4. package/dist/assets/speedscope/demangle-cpp.1768f4cc.js +4 -0
  5. package/dist/assets/speedscope/favicon-16x16.f74b3187.png +0 -0
  6. package/dist/assets/speedscope/favicon-32x32.bc503437.png +0 -0
  7. package/dist/assets/speedscope/file-format-schema.json +324 -0
  8. package/dist/assets/speedscope/import.bcbb2033.js +123 -0
  9. package/dist/assets/speedscope/index.html +2 -0
  10. package/dist/assets/speedscope/perf-vertx-stacks-01-collapsed-all.2681da68.txt +199 -0
  11. package/dist/assets/speedscope/release.txt +3 -0
  12. package/dist/assets/speedscope/reset.8c46b7a1.css +2 -0
  13. package/dist/assets/speedscope/source-code-pro.52b1676f.css +2 -0
  14. package/dist/assets/speedscope/source-code-pro.LICENSE.md +93 -0
  15. package/dist/assets/speedscope/source-map.438fa06b.js +24 -0
  16. package/dist/assets/speedscope/speedscope.6f107512.js +193 -0
  17. package/dist/{chokidar-5LLC6S6D.js → chokidar-BLUAYFAB.js} +13 -1044
  18. package/dist/chokidar-OATAHMV6.js +1122 -0
  19. package/dist/{chunk-ES3T7FIW.js → chunk-2GCE2GUM.js} +3 -3
  20. package/dist/chunk-3I3GQNEW.js +95 -0
  21. package/dist/{chunk-5NHIBL5K.js → chunk-4QRIOWN3.js} +2 -2
  22. package/dist/{chunk-Y2KXNORY.js → chunk-4W33LVQQ.js} +3 -3
  23. package/dist/{chunk-CKC5C2DR.js → chunk-53WQGP7S.js} +4 -4
  24. package/dist/chunk-57Q6OQG4.js +111 -0
  25. package/dist/{chunk-MHUINF7I.js → chunk-5CLGH5PH.js} +2 -2
  26. package/dist/{chunk-CRHXI6PS.js → chunk-5DBS6QOU.js} +102 -638
  27. package/dist/{chunk-ZOCACHGF.js → chunk-5JC3BUPR.js} +3 -3
  28. package/dist/{chunk-YMB5HUU3.js → chunk-5JWRABV2.js} +8 -8
  29. package/dist/{chunk-LLWX47E4.js → chunk-6JNRBEP6.js} +7 -9
  30. package/dist/{chunk-Y43XESY2.js → chunk-76NEANNG.js} +6442 -3165
  31. package/dist/{chunk-LVEURM2X.js → chunk-7T4EKFVU.js} +16 -2
  32. package/dist/{chunk-WKN62GWH.js → chunk-ACIVN2Q4.js} +502 -699
  33. package/dist/{chunk-ZX3L2JKV.js → chunk-AKL7T64Q.js} +80 -133
  34. package/dist/{chunk-2QGVACPR.js → chunk-B27LGWRZ.js} +3 -3
  35. package/dist/{chunk-BUFIEXZ5.js → chunk-B3YWYURY.js} +701 -141
  36. package/dist/{chunk-7VQ2QADA.js → chunk-BWBSJLZN.js} +333 -156
  37. package/dist/{chunk-K7HGDAI4.js → chunk-CDBXAE2F.js} +20 -104
  38. package/dist/{chunk-SBPFWO4S.js → chunk-CDQA3SST.js} +56182 -37290
  39. package/dist/chunk-CP3BRHWK.js +33 -0
  40. package/dist/{chunk-XEZJEXCU.js → chunk-D5AR5HKB.js} +2 -2
  41. package/dist/chunk-EMPP4I5H.js +497 -0
  42. package/dist/{chunk-DVCOVWXF.js → chunk-FCWD4NEK.js} +3 -3
  43. package/dist/{chunk-PJZVGRJ6.js → chunk-FMXC2O6H.js} +2 -2
  44. package/dist/{chunk-2GWO5FJL.js → chunk-GVMUVIT5.js} +7 -7
  45. package/dist/{chunk-KUM3DVPF.js → chunk-HMDWNGIV.js} +142 -471
  46. package/dist/{chunk-SVSIFM5Y.js → chunk-I6YWZKVU.js} +2 -2
  47. package/dist/{chunk-7TAOK36E.js → chunk-IYQNHNNP.js} +4 -4
  48. package/dist/{chunk-KXGCBBJW.js → chunk-JWRRKMF2.js} +2 -2
  49. package/dist/{chunk-IY7TUSI2.js → chunk-L3FVJFIT.js} +498 -412
  50. package/dist/{chunk-FJHGD37G.js → chunk-LH6BHL6J.js} +3 -3
  51. package/dist/{chunk-OAZFIMJ3.js → chunk-LQ2ZKVR6.js} +45 -115
  52. package/dist/{chunk-ONK6AXDE.js → chunk-MDJOXUMQ.js} +4 -4
  53. package/dist/{chunk-52WEPVL5.js → chunk-MSBZRBI5.js} +4 -4
  54. package/dist/{chunk-3HBRMIPY.js → chunk-MW7RWHY5.js} +341 -211
  55. package/dist/{chunk-O73CKGH7.js → chunk-NUW6LQU4.js} +4 -4
  56. package/dist/{chunk-ZQ55XXD5.js → chunk-PMOQBQSE.js} +3 -3
  57. package/dist/{chunk-2RKSPXIM.js → chunk-QEUQO265.js} +5 -7
  58. package/dist/chunk-QRARFXIM.js +1137 -0
  59. package/dist/{chunk-NQFTYLP6.js → chunk-R7RENZQC.js} +3 -3
  60. package/dist/chunk-UB7RN523.js +15933 -0
  61. package/dist/{chunk-GSPOKRGB.js → chunk-VI4NVMJH.js} +2 -2
  62. package/dist/{chunk-WNQ6HYKJ.js → chunk-WBTJ7MQU.js} +3 -3
  63. package/dist/{chunk-2EKHINO6.js → chunk-WKO4CJCL.js} +5 -7
  64. package/dist/{chunk-YP35ARHU.js → chunk-WNUVUNTL.js} +41 -23
  65. package/dist/{chunk-AWW6JHWH.js → chunk-XBIDXV7B.js} +4 -4
  66. package/dist/{chunk-KETZRITQ.js → chunk-XJNTFQIK.js} +5 -5
  67. package/dist/cli/commands/auth/logout.js +20 -19
  68. package/dist/cli/commands/auth/logout.test.js +22 -21
  69. package/dist/cli/commands/cache/clear.js +19 -18
  70. package/dist/cli/commands/debug/command-flags.js +19 -18
  71. package/dist/cli/commands/docs/generate.js +19 -18
  72. package/dist/cli/commands/docs/generate.test.js +20 -19
  73. package/dist/cli/commands/help.js +19 -18
  74. package/dist/cli/commands/kitchen-sink/async.js +20 -19
  75. package/dist/cli/commands/kitchen-sink/async.test.js +21 -20
  76. package/dist/cli/commands/kitchen-sink/index.js +22 -21
  77. package/dist/cli/commands/kitchen-sink/index.test.js +23 -22
  78. package/dist/cli/commands/kitchen-sink/prompts.js +20 -19
  79. package/dist/cli/commands/kitchen-sink/prompts.test.js +21 -20
  80. package/dist/cli/commands/kitchen-sink/static.js +20 -19
  81. package/dist/cli/commands/kitchen-sink/static.test.js +21 -20
  82. package/dist/cli/commands/notifications/generate.js +20 -19
  83. package/dist/cli/commands/notifications/list.js +20 -19
  84. package/dist/cli/commands/search.js +20 -19
  85. package/dist/cli/commands/upgrade.js +20 -19
  86. package/dist/cli/commands/upgrade.test.js +2 -1
  87. package/dist/cli/commands/version.js +20 -19
  88. package/dist/cli/commands/version.test.js +21 -20
  89. package/dist/cli/services/commands/notifications.js +14 -13
  90. package/dist/cli/services/commands/search.js +9 -8
  91. package/dist/cli/services/commands/search.test.js +10 -9
  92. package/dist/cli/services/commands/version.js +10 -9
  93. package/dist/cli/services/commands/version.test.js +12 -11
  94. package/dist/cli/services/kitchen-sink/async.js +9 -8
  95. package/dist/cli/services/kitchen-sink/prompts.js +9 -8
  96. package/dist/cli/services/kitchen-sink/static.js +9 -8
  97. package/dist/cli/services/upgrade.d.ts +0 -1
  98. package/dist/cli/services/upgrade.js +11 -10
  99. package/dist/cli/services/upgrade.test.js +14 -13
  100. package/dist/configs/all.yml +6 -0
  101. package/dist/configs/recommended.yml +6 -0
  102. package/dist/{custom-oclif-loader-4X7Y4CNS.js → custom-oclif-loader-ZY5GUSB3.js} +9 -8
  103. package/dist/{del-P2RS6GN2.js → del-FBU5JYXS.js} +4 -4
  104. package/dist/{devtools-K7FXBBFZ.js → devtools-6LOQORRT.js} +2 -2
  105. package/dist/{error-handler-KHFKBXR4.js → error-handler-YRN4E6SY.js} +17 -16
  106. package/dist/hooks/postrun.js +18 -16
  107. package/dist/hooks/prerun.js +15 -14
  108. package/dist/{http-proxy-FXWKYHZ3.js → http-proxy-L3MCJRQS.js} +3 -2
  109. package/dist/index.js +18712 -17414
  110. package/dist/lib-E2DSNKUX.js +13 -0
  111. package/dist/{local-PBMBK3CF.js → local-VTZT5Q4L.js} +11 -10
  112. package/dist/{morph-OSHCID2F.js → morph-ACVSDUS7.js} +3 -3
  113. package/dist/{node-ENALIQ2H.js → node-ONVZF27D.js} +23 -20
  114. package/dist/{node-package-manager-CVGCLCTC.js → node-package-manager-BZNXJETD.js} +11 -10
  115. package/dist/{npa-TM76BGG3.js → npa-JAX2F6CO.js} +2 -2
  116. package/dist/out-AZBX4ITJ.js +7 -0
  117. package/dist/{path-2HZUSAGR.js → path-2K5HIMHZ.js} +3 -2
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/dist/{ui-BBB46DQS.js → ui-3RKZNTJR.js} +9 -8
  120. package/dist/{workerd-F7DWDIYO.js → workerd-PSNADDQA.js} +23 -20
  121. package/oclif.manifest.json +103 -2
  122. package/package.json +9 -9
  123. package/LICENSE +0 -8
  124. package/dist/chunk-KIOWYILS.js +0 -3811
  125. package/dist/chunk-R4HZPLY4.js +0 -15746
  126. package/dist/lib-QZGSY5YB.js +0 -13
  127. package/dist/out-JR4DWQ2G.js +0 -7
  128. /package/dist/assets/dev-console/extensions/dev-console/assets/{index-Cgb-oKsM.css → index-n8yr6cxq.css} +0 -0
@@ -0,0 +1,1122 @@
1
+ import {
2
+ require_anymatch,
3
+ require_is_binary_path,
4
+ require_readdirp
5
+ } from "./chunk-EMPP4I5H.js";
6
+ import {
7
+ require_normalize_path
8
+ } from "./chunk-X7YTIMNN.js";
9
+ import {
10
+ require_braces,
11
+ require_glob_parent,
12
+ require_is_glob
13
+ } from "./chunk-B3YWYURY.js";
14
+ import {
15
+ __commonJS,
16
+ __require,
17
+ init_cjs_shims
18
+ } from "./chunk-PKR7KJ6P.js";
19
+
20
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/constants.js
21
+ var require_constants = __commonJS({
22
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/constants.js"(exports) {
23
+ "use strict";
24
+ init_cjs_shims();
25
+ var { sep } = __require("path"), { platform } = process, os = __require("os");
26
+ exports.EV_ALL = "all";
27
+ exports.EV_READY = "ready";
28
+ exports.EV_ADD = "add";
29
+ exports.EV_CHANGE = "change";
30
+ exports.EV_ADD_DIR = "addDir";
31
+ exports.EV_UNLINK = "unlink";
32
+ exports.EV_UNLINK_DIR = "unlinkDir";
33
+ exports.EV_RAW = "raw";
34
+ exports.EV_ERROR = "error";
35
+ exports.STR_DATA = "data";
36
+ exports.STR_END = "end";
37
+ exports.STR_CLOSE = "close";
38
+ exports.FSEVENT_CREATED = "created";
39
+ exports.FSEVENT_MODIFIED = "modified";
40
+ exports.FSEVENT_DELETED = "deleted";
41
+ exports.FSEVENT_MOVED = "moved";
42
+ exports.FSEVENT_CLONED = "cloned";
43
+ exports.FSEVENT_UNKNOWN = "unknown";
44
+ exports.FSEVENT_FLAG_MUST_SCAN_SUBDIRS = 1;
45
+ exports.FSEVENT_TYPE_FILE = "file";
46
+ exports.FSEVENT_TYPE_DIRECTORY = "directory";
47
+ exports.FSEVENT_TYPE_SYMLINK = "symlink";
48
+ exports.KEY_LISTENERS = "listeners";
49
+ exports.KEY_ERR = "errHandlers";
50
+ exports.KEY_RAW = "rawEmitters";
51
+ exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW];
52
+ exports.DOT_SLASH = `.${sep}`;
53
+ exports.BACK_SLASH_RE = /\\/g;
54
+ exports.DOUBLE_SLASH_RE = /\/\//;
55
+ exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/;
56
+ exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
57
+ exports.REPLACER_RE = /^\.[/\\]/;
58
+ exports.SLASH = "/";
59
+ exports.SLASH_SLASH = "//";
60
+ exports.BRACE_START = "{";
61
+ exports.BANG = "!";
62
+ exports.ONE_DOT = ".";
63
+ exports.TWO_DOTS = "..";
64
+ exports.STAR = "*";
65
+ exports.GLOBSTAR = "**";
66
+ exports.ROOT_GLOBSTAR = "/**/*";
67
+ exports.SLASH_GLOBSTAR = "/**";
68
+ exports.DIR_SUFFIX = "Dir";
69
+ exports.ANYMATCH_OPTS = { dot: !0 };
70
+ exports.STRING_TYPE = "string";
71
+ exports.FUNCTION_TYPE = "function";
72
+ exports.EMPTY_STR = "";
73
+ exports.EMPTY_FN = () => {
74
+ };
75
+ exports.IDENTITY_FN = (val) => val;
76
+ exports.isWindows = platform === "win32";
77
+ exports.isMacos = platform === "darwin";
78
+ exports.isLinux = platform === "linux";
79
+ exports.isIBMi = os.type() === "OS400";
80
+ }
81
+ });
82
+
83
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/nodefs-handler.js
84
+ var require_nodefs_handler = __commonJS({
85
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/nodefs-handler.js"(exports, module) {
86
+ "use strict";
87
+ init_cjs_shims();
88
+ var fs = __require("fs"), sysPath = __require("path"), { promisify } = __require("util"), isBinaryPath = require_is_binary_path(), {
89
+ isWindows,
90
+ isLinux,
91
+ EMPTY_FN,
92
+ EMPTY_STR,
93
+ KEY_LISTENERS,
94
+ KEY_ERR,
95
+ KEY_RAW,
96
+ HANDLER_KEYS,
97
+ EV_CHANGE,
98
+ EV_ADD,
99
+ EV_ADD_DIR,
100
+ EV_ERROR,
101
+ STR_DATA,
102
+ STR_END,
103
+ BRACE_START,
104
+ STAR
105
+ } = require_constants(), THROTTLE_MODE_WATCH = "watch", open = promisify(fs.open), stat = promisify(fs.stat), lstat = promisify(fs.lstat), close = promisify(fs.close), fsrealpath = promisify(fs.realpath), statMethods = { lstat, stat }, foreach = (val, fn) => {
106
+ val instanceof Set ? val.forEach(fn) : fn(val);
107
+ }, addAndConvert = (main, prop, item) => {
108
+ let container = main[prop];
109
+ container instanceof Set || (main[prop] = container = /* @__PURE__ */ new Set([container])), container.add(item);
110
+ }, clearItem = (cont) => (key) => {
111
+ let set = cont[key];
112
+ set instanceof Set ? set.clear() : delete cont[key];
113
+ }, delFromSet = (main, prop, item) => {
114
+ let container = main[prop];
115
+ container instanceof Set ? container.delete(item) : container === item && delete main[prop];
116
+ }, isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val, FsWatchInstances = /* @__PURE__ */ new Map();
117
+ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
118
+ let handleEvent = (rawEvent, evPath) => {
119
+ listener(path), emitRaw(rawEvent, evPath, { watchedPath: path }), evPath && path !== evPath && fsWatchBroadcast(
120
+ sysPath.resolve(path, evPath),
121
+ KEY_LISTENERS,
122
+ sysPath.join(path, evPath)
123
+ );
124
+ };
125
+ try {
126
+ return fs.watch(path, options, handleEvent);
127
+ } catch (error) {
128
+ errHandler(error);
129
+ }
130
+ }
131
+ var fsWatchBroadcast = (fullPath, type, val1, val2, val3) => {
132
+ let cont = FsWatchInstances.get(fullPath);
133
+ cont && foreach(cont[type], (listener) => {
134
+ listener(val1, val2, val3);
135
+ });
136
+ }, setFsWatchListener = (path, fullPath, options, handlers) => {
137
+ let { listener, errHandler, rawEmitter } = handlers, cont = FsWatchInstances.get(fullPath), watcher;
138
+ if (!options.persistent)
139
+ return watcher = createFsWatchInstance(
140
+ path,
141
+ options,
142
+ listener,
143
+ errHandler,
144
+ rawEmitter
145
+ ), watcher.close.bind(watcher);
146
+ if (cont)
147
+ addAndConvert(cont, KEY_LISTENERS, listener), addAndConvert(cont, KEY_ERR, errHandler), addAndConvert(cont, KEY_RAW, rawEmitter);
148
+ else {
149
+ if (watcher = createFsWatchInstance(
150
+ path,
151
+ options,
152
+ fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
153
+ errHandler,
154
+ // no need to use broadcast here
155
+ fsWatchBroadcast.bind(null, fullPath, KEY_RAW)
156
+ ), !watcher) return;
157
+ watcher.on(EV_ERROR, async (error) => {
158
+ let broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
159
+ if (cont.watcherUnusable = !0, isWindows && error.code === "EPERM")
160
+ try {
161
+ let fd = await open(path, "r");
162
+ await close(fd), broadcastErr(error);
163
+ } catch {
164
+ }
165
+ else
166
+ broadcastErr(error);
167
+ }), cont = {
168
+ listeners: listener,
169
+ errHandlers: errHandler,
170
+ rawEmitters: rawEmitter,
171
+ watcher
172
+ }, FsWatchInstances.set(fullPath, cont);
173
+ }
174
+ return () => {
175
+ delFromSet(cont, KEY_LISTENERS, listener), delFromSet(cont, KEY_ERR, errHandler), delFromSet(cont, KEY_RAW, rawEmitter), isEmptySet(cont.listeners) && (cont.watcher.close(), FsWatchInstances.delete(fullPath), HANDLER_KEYS.forEach(clearItem(cont)), cont.watcher = void 0, Object.freeze(cont));
176
+ };
177
+ }, FsWatchFileInstances = /* @__PURE__ */ new Map(), setFsWatchFileListener = (path, fullPath, options, handlers) => {
178
+ let { listener, rawEmitter } = handlers, cont = FsWatchFileInstances.get(fullPath), listeners = /* @__PURE__ */ new Set(), rawEmitters = /* @__PURE__ */ new Set(), copts = cont && cont.options;
179
+ return copts && (copts.persistent < options.persistent || copts.interval > options.interval) && (listeners = cont.listeners, rawEmitters = cont.rawEmitters, fs.unwatchFile(fullPath), cont = void 0), cont ? (addAndConvert(cont, KEY_LISTENERS, listener), addAndConvert(cont, KEY_RAW, rawEmitter)) : (cont = {
180
+ listeners: listener,
181
+ rawEmitters: rawEmitter,
182
+ options,
183
+ watcher: fs.watchFile(fullPath, options, (curr, prev) => {
184
+ foreach(cont.rawEmitters, (rawEmitter2) => {
185
+ rawEmitter2(EV_CHANGE, fullPath, { curr, prev });
186
+ });
187
+ let currmtime = curr.mtimeMs;
188
+ (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) && foreach(cont.listeners, (listener2) => listener2(path, curr));
189
+ })
190
+ }, FsWatchFileInstances.set(fullPath, cont)), () => {
191
+ delFromSet(cont, KEY_LISTENERS, listener), delFromSet(cont, KEY_RAW, rawEmitter), isEmptySet(cont.listeners) && (FsWatchFileInstances.delete(fullPath), fs.unwatchFile(fullPath), cont.options = cont.watcher = void 0, Object.freeze(cont));
192
+ };
193
+ }, NodeFsHandler = class {
194
+ /**
195
+ * @param {import("../index").FSWatcher} fsW
196
+ */
197
+ constructor(fsW) {
198
+ this.fsw = fsW, this._boundHandleError = (error) => fsW._handleError(error);
199
+ }
200
+ /**
201
+ * Watch file for changes with fs_watchFile or fs_watch.
202
+ * @param {String} path to file or dir
203
+ * @param {Function} listener on fs change
204
+ * @returns {Function} closer for the watcher instance
205
+ */
206
+ _watchWithNodeFs(path, listener) {
207
+ let opts = this.fsw.options, directory = sysPath.dirname(path), basename = sysPath.basename(path);
208
+ this.fsw._getWatchedDir(directory).add(basename);
209
+ let absolutePath = sysPath.resolve(path), options = { persistent: opts.persistent };
210
+ listener || (listener = EMPTY_FN);
211
+ let closer;
212
+ return opts.usePolling ? (options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ? opts.binaryInterval : opts.interval, closer = setFsWatchFileListener(path, absolutePath, options, {
213
+ listener,
214
+ rawEmitter: this.fsw._emitRaw
215
+ })) : closer = setFsWatchListener(path, absolutePath, options, {
216
+ listener,
217
+ errHandler: this._boundHandleError,
218
+ rawEmitter: this.fsw._emitRaw
219
+ }), closer;
220
+ }
221
+ /**
222
+ * Watch a file and emit add event if warranted.
223
+ * @param {Path} file Path
224
+ * @param {fs.Stats} stats result of fs_stat
225
+ * @param {Boolean} initialAdd was the file added at watch instantiation?
226
+ * @returns {Function} closer for the watcher instance
227
+ */
228
+ _handleFile(file, stats, initialAdd) {
229
+ if (this.fsw.closed)
230
+ return;
231
+ let dirname = sysPath.dirname(file), basename = sysPath.basename(file), parent = this.fsw._getWatchedDir(dirname), prevStats = stats;
232
+ if (parent.has(basename)) return;
233
+ let listener = async (path, newStats) => {
234
+ if (this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) {
235
+ if (!newStats || newStats.mtimeMs === 0)
236
+ try {
237
+ let newStats2 = await stat(file);
238
+ if (this.fsw.closed) return;
239
+ let at = newStats2.atimeMs, mt = newStats2.mtimeMs;
240
+ (!at || at <= mt || mt !== prevStats.mtimeMs) && this.fsw._emit(EV_CHANGE, file, newStats2), isLinux && prevStats.ino !== newStats2.ino ? (this.fsw._closeFile(path), prevStats = newStats2, this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener))) : prevStats = newStats2;
241
+ } catch {
242
+ this.fsw._remove(dirname, basename);
243
+ }
244
+ else if (parent.has(basename)) {
245
+ let at = newStats.atimeMs, mt = newStats.mtimeMs;
246
+ (!at || at <= mt || mt !== prevStats.mtimeMs) && this.fsw._emit(EV_CHANGE, file, newStats), prevStats = newStats;
247
+ }
248
+ }
249
+ }, closer = this._watchWithNodeFs(file, listener);
250
+ if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
251
+ if (!this.fsw._throttle(EV_ADD, file, 0)) return;
252
+ this.fsw._emit(EV_ADD, file, stats);
253
+ }
254
+ return closer;
255
+ }
256
+ /**
257
+ * Handle symlinks encountered while reading a dir.
258
+ * @param {Object} entry returned by readdirp
259
+ * @param {String} directory path of dir being read
260
+ * @param {String} path of this item
261
+ * @param {String} item basename of this item
262
+ * @returns {Promise<Boolean>} true if no more processing is needed for this entry.
263
+ */
264
+ async _handleSymlink(entry, directory, path, item) {
265
+ if (this.fsw.closed)
266
+ return;
267
+ let full = entry.fullPath, dir = this.fsw._getWatchedDir(directory);
268
+ if (!this.fsw.options.followSymlinks) {
269
+ this.fsw._incrReadyCount();
270
+ let linkPath;
271
+ try {
272
+ linkPath = await fsrealpath(path);
273
+ } catch {
274
+ return this.fsw._emitReady(), !0;
275
+ }
276
+ return this.fsw.closed ? void 0 : (dir.has(item) ? this.fsw._symlinkPaths.get(full) !== linkPath && (this.fsw._symlinkPaths.set(full, linkPath), this.fsw._emit(EV_CHANGE, path, entry.stats)) : (dir.add(item), this.fsw._symlinkPaths.set(full, linkPath), this.fsw._emit(EV_ADD, path, entry.stats)), this.fsw._emitReady(), !0);
277
+ }
278
+ if (this.fsw._symlinkPaths.has(full))
279
+ return !0;
280
+ this.fsw._symlinkPaths.set(full, !0);
281
+ }
282
+ _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
283
+ if (directory = sysPath.join(directory, EMPTY_STR), !wh.hasGlob && (throttler = this.fsw._throttle("readdir", directory, 1e3), !throttler))
284
+ return;
285
+ let previous = this.fsw._getWatchedDir(wh.path), current = /* @__PURE__ */ new Set(), stream = this.fsw._readdirp(directory, {
286
+ fileFilter: (entry) => wh.filterPath(entry),
287
+ directoryFilter: (entry) => wh.filterDir(entry),
288
+ depth: 0
289
+ }).on(STR_DATA, async (entry) => {
290
+ if (this.fsw.closed) {
291
+ stream = void 0;
292
+ return;
293
+ }
294
+ let item = entry.path, path = sysPath.join(directory, item);
295
+ if (current.add(item), !(entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item))) {
296
+ if (this.fsw.closed) {
297
+ stream = void 0;
298
+ return;
299
+ }
300
+ (item === target || !target && !previous.has(item)) && (this.fsw._incrReadyCount(), path = sysPath.join(dir, sysPath.relative(dir, path)), this._addToNodeFs(path, initialAdd, wh, depth + 1));
301
+ }
302
+ }).on(EV_ERROR, this._boundHandleError);
303
+ return new Promise(
304
+ (resolve) => stream.once(STR_END, () => {
305
+ if (this.fsw.closed) {
306
+ stream = void 0;
307
+ return;
308
+ }
309
+ let wasThrottled = throttler ? throttler.clear() : !1;
310
+ resolve(), previous.getChildren().filter((item) => item !== directory && !current.has(item) && // in case of intersecting globs;
311
+ // a path may have been filtered out of this readdir, but
312
+ // shouldn't be removed because it matches a different glob
313
+ (!wh.hasGlob || wh.filterPath({
314
+ fullPath: sysPath.resolve(directory, item)
315
+ }))).forEach((item) => {
316
+ this.fsw._remove(directory, item);
317
+ }), stream = void 0, wasThrottled && this._handleRead(directory, !1, wh, target, dir, depth, throttler);
318
+ })
319
+ );
320
+ }
321
+ /**
322
+ * Read directory to add / remove files from `@watched` list and re-read it on change.
323
+ * @param {String} dir fs path
324
+ * @param {fs.Stats} stats
325
+ * @param {Boolean} initialAdd
326
+ * @param {Number} depth relative to user-supplied path
327
+ * @param {String} target child path targeted for watch
328
+ * @param {Object} wh Common watch helpers for this path
329
+ * @param {String} realpath
330
+ * @returns {Promise<Function>} closer for the watcher instance.
331
+ */
332
+ async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
333
+ let parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir)), tracked = parentDir.has(sysPath.basename(dir));
334
+ !(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked && (!wh.hasGlob || wh.globFilter(dir)) && this.fsw._emit(EV_ADD_DIR, dir, stats), parentDir.add(sysPath.basename(dir)), this.fsw._getWatchedDir(dir);
335
+ let throttler, closer, oDepth = this.fsw.options.depth;
336
+ if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
337
+ if (!target && (await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler), this.fsw.closed))
338
+ return;
339
+ closer = this._watchWithNodeFs(dir, (dirPath, stats2) => {
340
+ stats2 && stats2.mtimeMs === 0 || this._handleRead(dirPath, !1, wh, target, dir, depth, throttler);
341
+ });
342
+ }
343
+ return closer;
344
+ }
345
+ /**
346
+ * Handle added file, directory, or glob pattern.
347
+ * Delegates call to _handleFile / _handleDir after checks.
348
+ * @param {String} path to file or ir
349
+ * @param {Boolean} initialAdd was the file added at watch instantiation?
350
+ * @param {Object} priorWh depth relative to user-supplied path
351
+ * @param {Number} depth Child path actually targeted for watch
352
+ * @param {String=} target Child path actually targeted for watch
353
+ * @returns {Promise}
354
+ */
355
+ async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
356
+ let ready = this.fsw._emitReady;
357
+ if (this.fsw._isIgnored(path) || this.fsw.closed)
358
+ return ready(), !1;
359
+ let wh = this.fsw._getWatchHelpers(path, depth);
360
+ !wh.hasGlob && priorWh && (wh.hasGlob = priorWh.hasGlob, wh.globFilter = priorWh.globFilter, wh.filterPath = (entry) => priorWh.filterPath(entry), wh.filterDir = (entry) => priorWh.filterDir(entry));
361
+ try {
362
+ let stats = await statMethods[wh.statMethod](wh.watchPath);
363
+ if (this.fsw.closed) return;
364
+ if (this.fsw._isIgnored(wh.watchPath, stats))
365
+ return ready(), !1;
366
+ let follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START), closer;
367
+ if (stats.isDirectory()) {
368
+ let absPath = sysPath.resolve(path), targetPath = follow ? await fsrealpath(path) : path;
369
+ if (this.fsw.closed || (closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath), this.fsw.closed)) return;
370
+ absPath !== targetPath && targetPath !== void 0 && this.fsw._symlinkPaths.set(absPath, targetPath);
371
+ } else if (stats.isSymbolicLink()) {
372
+ let targetPath = follow ? await fsrealpath(path) : path;
373
+ if (this.fsw.closed) return;
374
+ let parent = sysPath.dirname(wh.watchPath);
375
+ if (this.fsw._getWatchedDir(parent).add(wh.watchPath), this.fsw._emit(EV_ADD, wh.watchPath, stats), closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath), this.fsw.closed) return;
376
+ targetPath !== void 0 && this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
377
+ } else
378
+ closer = this._handleFile(wh.watchPath, stats, initialAdd);
379
+ return ready(), this.fsw._addPathCloser(path, closer), !1;
380
+ } catch (error) {
381
+ if (this.fsw._handleError(error))
382
+ return ready(), path;
383
+ }
384
+ }
385
+ };
386
+ module.exports = NodeFsHandler;
387
+ }
388
+ });
389
+
390
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js
391
+ var require_fsevents_handler = __commonJS({
392
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/lib/fsevents-handler.js"(exports, module) {
393
+ "use strict";
394
+ init_cjs_shims();
395
+ var fs = __require("fs"), sysPath = __require("path"), { promisify } = __require("util"), fsevents;
396
+ try {
397
+ fsevents = __require("fsevents");
398
+ } catch (error) {
399
+ process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR && console.error(error);
400
+ }
401
+ if (fsevents) {
402
+ let mtch = process.version.match(/v(\d+)\.(\d+)/);
403
+ if (mtch && mtch[1] && mtch[2]) {
404
+ let maj = Number.parseInt(mtch[1], 10), min = Number.parseInt(mtch[2], 10);
405
+ maj === 8 && min < 16 && (fsevents = void 0);
406
+ }
407
+ }
408
+ var {
409
+ EV_ADD,
410
+ EV_CHANGE,
411
+ EV_ADD_DIR,
412
+ EV_UNLINK,
413
+ EV_ERROR,
414
+ STR_DATA,
415
+ STR_END,
416
+ FSEVENT_CREATED,
417
+ FSEVENT_MODIFIED,
418
+ FSEVENT_DELETED,
419
+ FSEVENT_MOVED,
420
+ // FSEVENT_CLONED,
421
+ FSEVENT_UNKNOWN,
422
+ FSEVENT_FLAG_MUST_SCAN_SUBDIRS,
423
+ FSEVENT_TYPE_FILE,
424
+ FSEVENT_TYPE_DIRECTORY,
425
+ FSEVENT_TYPE_SYMLINK,
426
+ ROOT_GLOBSTAR,
427
+ DIR_SUFFIX,
428
+ DOT_SLASH,
429
+ FUNCTION_TYPE,
430
+ EMPTY_FN,
431
+ IDENTITY_FN
432
+ } = require_constants(), Depth = (value) => isNaN(value) ? {} : { depth: value }, stat = promisify(fs.stat), lstat = promisify(fs.lstat), realpath = promisify(fs.realpath), statMethods = { stat, lstat }, FSEventsWatchers = /* @__PURE__ */ new Map(), consolidateThreshhold = 10, wrongEventFlags = /* @__PURE__ */ new Set([
433
+ 69888,
434
+ 70400,
435
+ 71424,
436
+ 72704,
437
+ 73472,
438
+ 131328,
439
+ 131840,
440
+ 262912
441
+ ]), createFSEventsInstance = (path, callback) => ({ stop: fsevents.watch(path, callback) });
442
+ function setFSEventsListener(path, realPath, listener, rawEmitter) {
443
+ let watchPath = sysPath.extname(realPath) ? sysPath.dirname(realPath) : realPath, parentPath = sysPath.dirname(watchPath), cont = FSEventsWatchers.get(watchPath);
444
+ couldConsolidate(parentPath) && (watchPath = parentPath);
445
+ let resolvedPath = sysPath.resolve(path), hasSymlink = resolvedPath !== realPath, filteredListener = (fullPath, flags, info) => {
446
+ hasSymlink && (fullPath = fullPath.replace(realPath, resolvedPath)), (fullPath === resolvedPath || !fullPath.indexOf(resolvedPath + sysPath.sep)) && listener(fullPath, flags, info);
447
+ }, watchedParent = !1;
448
+ for (let watchedPath of FSEventsWatchers.keys())
449
+ if (realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep) === 0) {
450
+ watchPath = watchedPath, cont = FSEventsWatchers.get(watchPath), watchedParent = !0;
451
+ break;
452
+ }
453
+ return cont || watchedParent ? cont.listeners.add(filteredListener) : (cont = {
454
+ listeners: /* @__PURE__ */ new Set([filteredListener]),
455
+ rawEmitter,
456
+ watcher: createFSEventsInstance(watchPath, (fullPath, flags) => {
457
+ if (!cont.listeners.size || flags & FSEVENT_FLAG_MUST_SCAN_SUBDIRS) return;
458
+ let info = fsevents.getInfo(fullPath, flags);
459
+ cont.listeners.forEach((list) => {
460
+ list(fullPath, flags, info);
461
+ }), cont.rawEmitter(info.event, fullPath, info);
462
+ })
463
+ }, FSEventsWatchers.set(watchPath, cont)), () => {
464
+ let lst = cont.listeners;
465
+ if (lst.delete(filteredListener), !lst.size && (FSEventsWatchers.delete(watchPath), cont.watcher))
466
+ return cont.watcher.stop().then(() => {
467
+ cont.rawEmitter = cont.watcher = void 0, Object.freeze(cont);
468
+ });
469
+ };
470
+ }
471
+ var couldConsolidate = (path) => {
472
+ let count = 0;
473
+ for (let watchPath of FSEventsWatchers.keys())
474
+ if (watchPath.indexOf(path) === 0 && (count++, count >= consolidateThreshhold))
475
+ return !0;
476
+ return !1;
477
+ }, canUse = () => fsevents && FSEventsWatchers.size < 128, calcDepth = (path, root) => {
478
+ let i = 0;
479
+ for (; !path.indexOf(root) && (path = sysPath.dirname(path)) !== root; ) i++;
480
+ return i;
481
+ }, sameTypes = (info, stats) => info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() || info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() || info.type === FSEVENT_TYPE_FILE && stats.isFile(), FsEventsHandler = class {
482
+ /**
483
+ * @param {import('../index').FSWatcher} fsw
484
+ */
485
+ constructor(fsw) {
486
+ this.fsw = fsw;
487
+ }
488
+ checkIgnored(path, stats) {
489
+ let ipaths = this.fsw._ignoredPaths;
490
+ if (this.fsw._isIgnored(path, stats))
491
+ return ipaths.add(path), stats && stats.isDirectory() && ipaths.add(path + ROOT_GLOBSTAR), !0;
492
+ ipaths.delete(path), ipaths.delete(path + ROOT_GLOBSTAR);
493
+ }
494
+ addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
495
+ let event = watchedDir.has(item) ? EV_CHANGE : EV_ADD;
496
+ this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts);
497
+ }
498
+ async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) {
499
+ try {
500
+ let stats = await stat(path);
501
+ if (this.fsw.closed) return;
502
+ sameTypes(info, stats) ? this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) : this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
503
+ } catch (error) {
504
+ error.code === "EACCES" ? this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) : this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
505
+ }
506
+ }
507
+ handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) {
508
+ if (!(this.fsw.closed || this.checkIgnored(path)))
509
+ if (event === EV_UNLINK) {
510
+ let isDirectory = info.type === FSEVENT_TYPE_DIRECTORY;
511
+ (isDirectory || watchedDir.has(item)) && this.fsw._remove(parent, item, isDirectory);
512
+ } else {
513
+ if (event === EV_ADD) {
514
+ if (info.type === FSEVENT_TYPE_DIRECTORY && this.fsw._getWatchedDir(path), info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) {
515
+ let curDepth = opts.depth === void 0 ? void 0 : calcDepth(fullPath, realPath) + 1;
516
+ return this._addToFsEvents(path, !1, !0, curDepth);
517
+ }
518
+ this.fsw._getWatchedDir(parent).add(item);
519
+ }
520
+ let eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event;
521
+ this.fsw._emit(eventName, path), eventName === EV_ADD_DIR && this._addToFsEvents(path, !1, !0);
522
+ }
523
+ }
524
+ /**
525
+ * Handle symlinks encountered during directory scan
526
+ * @param {String} watchPath - file/dir path to be watched with fsevents
527
+ * @param {String} realPath - real path (in case of symlinks)
528
+ * @param {Function} transform - path transformer
529
+ * @param {Function} globFilter - path filter in case a glob pattern was provided
530
+ * @returns {Function} closer for the watcher instance
531
+ */
532
+ _watchWithFsEvents(watchPath, realPath, transform, globFilter) {
533
+ if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return;
534
+ let opts = this.fsw.options, closer = setFSEventsListener(
535
+ watchPath,
536
+ realPath,
537
+ async (fullPath, flags, info) => {
538
+ if (this.fsw.closed || opts.depth !== void 0 && calcDepth(fullPath, realPath) > opts.depth) return;
539
+ let path = transform(sysPath.join(
540
+ watchPath,
541
+ sysPath.relative(watchPath, fullPath)
542
+ ));
543
+ if (globFilter && !globFilter(path)) return;
544
+ let parent = sysPath.dirname(path), item = sysPath.basename(path), watchedDir = this.fsw._getWatchedDir(
545
+ info.type === FSEVENT_TYPE_DIRECTORY ? path : parent
546
+ );
547
+ if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN)
548
+ if (typeof opts.ignored === FUNCTION_TYPE) {
549
+ let stats;
550
+ try {
551
+ stats = await stat(path);
552
+ } catch {
553
+ }
554
+ if (this.fsw.closed || this.checkIgnored(path, stats)) return;
555
+ sameTypes(info, stats) ? this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) : this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
556
+ } else
557
+ this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
558
+ else
559
+ switch (info.event) {
560
+ case FSEVENT_CREATED:
561
+ case FSEVENT_MODIFIED:
562
+ return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
563
+ case FSEVENT_DELETED:
564
+ case FSEVENT_MOVED:
565
+ return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
566
+ }
567
+ },
568
+ this.fsw._emitRaw
569
+ );
570
+ return this.fsw._emitReady(), closer;
571
+ }
572
+ /**
573
+ * Handle symlinks encountered during directory scan
574
+ * @param {String} linkPath path to symlink
575
+ * @param {String} fullPath absolute path to the symlink
576
+ * @param {Function} transform pre-existing path transformer
577
+ * @param {Number} curDepth level of subdirectories traversed to where symlink is
578
+ * @returns {Promise<void>}
579
+ */
580
+ async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) {
581
+ if (!(this.fsw.closed || this.fsw._symlinkPaths.has(fullPath))) {
582
+ this.fsw._symlinkPaths.set(fullPath, !0), this.fsw._incrReadyCount();
583
+ try {
584
+ let linkTarget = await realpath(linkPath);
585
+ if (this.fsw.closed) return;
586
+ if (this.fsw._isIgnored(linkTarget))
587
+ return this.fsw._emitReady();
588
+ this.fsw._incrReadyCount(), this._addToFsEvents(linkTarget || linkPath, (path) => {
589
+ let aliasedPath = linkPath;
590
+ return linkTarget && linkTarget !== DOT_SLASH ? aliasedPath = path.replace(linkTarget, linkPath) : path !== DOT_SLASH && (aliasedPath = sysPath.join(linkPath, path)), transform(aliasedPath);
591
+ }, !1, curDepth);
592
+ } catch (error) {
593
+ if (this.fsw._handleError(error))
594
+ return this.fsw._emitReady();
595
+ }
596
+ }
597
+ }
598
+ /**
599
+ *
600
+ * @param {Path} newPath
601
+ * @param {fs.Stats} stats
602
+ */
603
+ emitAdd(newPath, stats, processPath, opts, forceAdd) {
604
+ let pp = processPath(newPath), isDir = stats.isDirectory(), dirObj = this.fsw._getWatchedDir(sysPath.dirname(pp)), base = sysPath.basename(pp);
605
+ isDir && this.fsw._getWatchedDir(pp), !dirObj.has(base) && (dirObj.add(base), (!opts.ignoreInitial || forceAdd === !0) && this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats));
606
+ }
607
+ initWatch(realPath, path, wh, processPath) {
608
+ if (this.fsw.closed) return;
609
+ let closer = this._watchWithFsEvents(
610
+ wh.watchPath,
611
+ sysPath.resolve(realPath || wh.watchPath),
612
+ processPath,
613
+ wh.globFilter
614
+ );
615
+ this.fsw._addPathCloser(path, closer);
616
+ }
617
+ /**
618
+ * Handle added path with fsevents
619
+ * @param {String} path file/dir path or glob pattern
620
+ * @param {Function|Boolean=} transform converts working path to what the user expects
621
+ * @param {Boolean=} forceAdd ensure add is emitted
622
+ * @param {Number=} priorDepth Level of subdirectories already traversed.
623
+ * @returns {Promise<void>}
624
+ */
625
+ async _addToFsEvents(path, transform, forceAdd, priorDepth) {
626
+ if (this.fsw.closed)
627
+ return;
628
+ let opts = this.fsw.options, processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN, wh = this.fsw._getWatchHelpers(path);
629
+ try {
630
+ let stats = await statMethods[wh.statMethod](wh.watchPath);
631
+ if (this.fsw.closed) return;
632
+ if (this.fsw._isIgnored(wh.watchPath, stats))
633
+ throw null;
634
+ if (stats.isDirectory()) {
635
+ if (wh.globFilter || this.emitAdd(processPath(path), stats, processPath, opts, forceAdd), priorDepth && priorDepth > opts.depth) return;
636
+ this.fsw._readdirp(wh.watchPath, {
637
+ fileFilter: (entry) => wh.filterPath(entry),
638
+ directoryFilter: (entry) => wh.filterDir(entry),
639
+ ...Depth(opts.depth - (priorDepth || 0))
640
+ }).on(STR_DATA, (entry) => {
641
+ if (this.fsw.closed || entry.stats.isDirectory() && !wh.filterPath(entry)) return;
642
+ let joinedPath = sysPath.join(wh.watchPath, entry.path), { fullPath } = entry;
643
+ if (wh.followSymlinks && entry.stats.isSymbolicLink()) {
644
+ let curDepth = opts.depth === void 0 ? void 0 : calcDepth(joinedPath, sysPath.resolve(wh.watchPath)) + 1;
645
+ this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth);
646
+ } else
647
+ this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd);
648
+ }).on(EV_ERROR, EMPTY_FN).on(STR_END, () => {
649
+ this.fsw._emitReady();
650
+ });
651
+ } else
652
+ this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd), this.fsw._emitReady();
653
+ } catch (error) {
654
+ (!error || this.fsw._handleError(error)) && (this.fsw._emitReady(), this.fsw._emitReady());
655
+ }
656
+ if (opts.persistent && forceAdd !== !0)
657
+ if (typeof transform === FUNCTION_TYPE)
658
+ this.initWatch(void 0, path, wh, processPath);
659
+ else {
660
+ let realPath;
661
+ try {
662
+ realPath = await realpath(wh.watchPath);
663
+ } catch {
664
+ }
665
+ this.initWatch(realPath, path, wh, processPath);
666
+ }
667
+ }
668
+ };
669
+ module.exports = FsEventsHandler;
670
+ module.exports.canUse = canUse;
671
+ }
672
+ });
673
+
674
+ // ../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js
675
+ var require_chokidar = __commonJS({
676
+ "../../node_modules/.pnpm/chokidar@3.6.0/node_modules/chokidar/index.js"(exports) {
677
+ init_cjs_shims();
678
+ var { EventEmitter } = __require("events"), fs = __require("fs"), sysPath = __require("path"), { promisify } = __require("util"), readdirp = require_readdirp(), anymatch = require_anymatch().default, globParent = require_glob_parent(), isGlob = require_is_glob(), braces = require_braces(), normalizePath = require_normalize_path(), NodeFsHandler = require_nodefs_handler(), FsEventsHandler = require_fsevents_handler(), {
679
+ EV_ALL,
680
+ EV_READY,
681
+ EV_ADD,
682
+ EV_CHANGE,
683
+ EV_UNLINK,
684
+ EV_ADD_DIR,
685
+ EV_UNLINK_DIR,
686
+ EV_RAW,
687
+ EV_ERROR,
688
+ STR_CLOSE,
689
+ STR_END,
690
+ BACK_SLASH_RE,
691
+ DOUBLE_SLASH_RE,
692
+ SLASH_OR_BACK_SLASH_RE,
693
+ DOT_RE,
694
+ REPLACER_RE,
695
+ SLASH,
696
+ SLASH_SLASH,
697
+ BRACE_START,
698
+ BANG,
699
+ ONE_DOT,
700
+ TWO_DOTS,
701
+ GLOBSTAR,
702
+ SLASH_GLOBSTAR,
703
+ ANYMATCH_OPTS,
704
+ STRING_TYPE,
705
+ FUNCTION_TYPE,
706
+ EMPTY_STR,
707
+ EMPTY_FN,
708
+ isWindows,
709
+ isMacos,
710
+ isIBMi
711
+ } = require_constants(), stat = promisify(fs.stat), readdir = promisify(fs.readdir), arrify = (value = []) => Array.isArray(value) ? value : [value], flatten = (list, result = []) => (list.forEach((item) => {
712
+ Array.isArray(item) ? flatten(item, result) : result.push(item);
713
+ }), result), unifyPaths = (paths_) => {
714
+ let paths = flatten(arrify(paths_));
715
+ if (!paths.every((p) => typeof p === STRING_TYPE))
716
+ throw new TypeError(`Non-string provided as watch path: ${paths}`);
717
+ return paths.map(normalizePathToUnix);
718
+ }, toUnix = (string) => {
719
+ let str = string.replace(BACK_SLASH_RE, SLASH), prepend = !1;
720
+ for (str.startsWith(SLASH_SLASH) && (prepend = !0); str.match(DOUBLE_SLASH_RE); )
721
+ str = str.replace(DOUBLE_SLASH_RE, SLASH);
722
+ return prepend && (str = SLASH + str), str;
723
+ }, normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path))), normalizeIgnored = (cwd = EMPTY_STR) => (path) => typeof path !== STRING_TYPE ? path : normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path)), getAbsolutePath = (path, cwd) => sysPath.isAbsolute(path) ? path : path.startsWith(BANG) ? BANG + sysPath.join(cwd, path.slice(1)) : sysPath.join(cwd, path), undef = (opts, key) => opts[key] === void 0, DirEntry = class {
724
+ /**
725
+ * @param {Path} dir
726
+ * @param {Function} removeWatcher
727
+ */
728
+ constructor(dir, removeWatcher) {
729
+ this.path = dir, this._removeWatcher = removeWatcher, this.items = /* @__PURE__ */ new Set();
730
+ }
731
+ add(item) {
732
+ let { items } = this;
733
+ items && item !== ONE_DOT && item !== TWO_DOTS && items.add(item);
734
+ }
735
+ async remove(item) {
736
+ let { items } = this;
737
+ if (!items || (items.delete(item), items.size > 0)) return;
738
+ let dir = this.path;
739
+ try {
740
+ await readdir(dir);
741
+ } catch {
742
+ this._removeWatcher && this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir));
743
+ }
744
+ }
745
+ has(item) {
746
+ let { items } = this;
747
+ if (items)
748
+ return items.has(item);
749
+ }
750
+ /**
751
+ * @returns {Array<String>}
752
+ */
753
+ getChildren() {
754
+ let { items } = this;
755
+ if (items)
756
+ return [...items.values()];
757
+ }
758
+ dispose() {
759
+ this.items.clear(), delete this.path, delete this._removeWatcher, delete this.items, Object.freeze(this);
760
+ }
761
+ }, STAT_METHOD_F = "stat", STAT_METHOD_L = "lstat", WatchHelper = class {
762
+ constructor(path, watchPath, follow, fsw) {
763
+ this.fsw = fsw, this.path = path = path.replace(REPLACER_RE, EMPTY_STR), this.watchPath = watchPath, this.fullWatchPath = sysPath.resolve(watchPath), this.hasGlob = watchPath !== path, path === EMPTY_STR && (this.hasGlob = !1), this.globSymlink = this.hasGlob && follow ? void 0 : !1, this.globFilter = this.hasGlob ? anymatch(path, void 0, ANYMATCH_OPTS) : !1, this.dirParts = this.getDirParts(path), this.dirParts.forEach((parts) => {
764
+ parts.length > 1 && parts.pop();
765
+ }), this.followSymlinks = follow, this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
766
+ }
767
+ checkGlobSymlink(entry) {
768
+ return this.globSymlink === void 0 && (this.globSymlink = entry.fullParentDir === this.fullWatchPath ? !1 : { realPath: entry.fullParentDir, linkPath: this.fullWatchPath }), this.globSymlink ? entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath) : entry.fullPath;
769
+ }
770
+ entryPath(entry) {
771
+ return sysPath.join(
772
+ this.watchPath,
773
+ sysPath.relative(this.watchPath, this.checkGlobSymlink(entry))
774
+ );
775
+ }
776
+ filterPath(entry) {
777
+ let { stats } = entry;
778
+ if (stats && stats.isSymbolicLink()) return this.filterDir(entry);
779
+ let resolvedPath = this.entryPath(entry);
780
+ return (this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? this.globFilter(resolvedPath) : !0) && this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
781
+ }
782
+ getDirParts(path) {
783
+ if (!this.hasGlob) return [];
784
+ let parts = [];
785
+ return (path.includes(BRACE_START) ? braces.expand(path) : [path]).forEach((path2) => {
786
+ parts.push(sysPath.relative(this.watchPath, path2).split(SLASH_OR_BACK_SLASH_RE));
787
+ }), parts;
788
+ }
789
+ filterDir(entry) {
790
+ if (this.hasGlob) {
791
+ let entryParts = this.getDirParts(this.checkGlobSymlink(entry)), globstar = !1;
792
+ this.unmatchedGlob = !this.dirParts.some((parts) => parts.every((part, i) => (part === GLOBSTAR && (globstar = !0), globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS))));
793
+ }
794
+ return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
795
+ }
796
+ }, FSWatcher = class extends EventEmitter {
797
+ // Not indenting methods for history sake; for now.
798
+ constructor(_opts) {
799
+ super();
800
+ let opts = {};
801
+ _opts && Object.assign(opts, _opts), this._watched = /* @__PURE__ */ new Map(), this._closers = /* @__PURE__ */ new Map(), this._ignoredPaths = /* @__PURE__ */ new Set(), this._throttled = /* @__PURE__ */ new Map(), this._symlinkPaths = /* @__PURE__ */ new Map(), this._streams = /* @__PURE__ */ new Set(), this.closed = !1, undef(opts, "persistent") && (opts.persistent = !0), undef(opts, "ignoreInitial") && (opts.ignoreInitial = !1), undef(opts, "ignorePermissionErrors") && (opts.ignorePermissionErrors = !1), undef(opts, "interval") && (opts.interval = 100), undef(opts, "binaryInterval") && (opts.binaryInterval = 300), undef(opts, "disableGlobbing") && (opts.disableGlobbing = !1), opts.enableBinaryInterval = opts.binaryInterval !== opts.interval, undef(opts, "useFsEvents") && (opts.useFsEvents = !opts.usePolling), FsEventsHandler.canUse() || (opts.useFsEvents = !1), undef(opts, "usePolling") && !opts.useFsEvents && (opts.usePolling = isMacos), isIBMi && (opts.usePolling = !0);
802
+ let envPoll = process.env.CHOKIDAR_USEPOLLING;
803
+ if (envPoll !== void 0) {
804
+ let envLower = envPoll.toLowerCase();
805
+ envLower === "false" || envLower === "0" ? opts.usePolling = !1 : envLower === "true" || envLower === "1" ? opts.usePolling = !0 : opts.usePolling = !!envLower;
806
+ }
807
+ let envInterval = process.env.CHOKIDAR_INTERVAL;
808
+ envInterval && (opts.interval = Number.parseInt(envInterval, 10)), undef(opts, "atomic") && (opts.atomic = !opts.usePolling && !opts.useFsEvents), opts.atomic && (this._pendingUnlinks = /* @__PURE__ */ new Map()), undef(opts, "followSymlinks") && (opts.followSymlinks = !0), undef(opts, "awaitWriteFinish") && (opts.awaitWriteFinish = !1), opts.awaitWriteFinish === !0 && (opts.awaitWriteFinish = {});
809
+ let awf = opts.awaitWriteFinish;
810
+ awf && (awf.stabilityThreshold || (awf.stabilityThreshold = 2e3), awf.pollInterval || (awf.pollInterval = 100), this._pendingWrites = /* @__PURE__ */ new Map()), opts.ignored && (opts.ignored = arrify(opts.ignored));
811
+ let readyCalls = 0;
812
+ this._emitReady = () => {
813
+ readyCalls++, readyCalls >= this._readyCount && (this._emitReady = EMPTY_FN, this._readyEmitted = !0, process.nextTick(() => this.emit(EV_READY)));
814
+ }, this._emitRaw = (...args) => this.emit(EV_RAW, ...args), this._readyEmitted = !1, this.options = opts, opts.useFsEvents ? this._fsEventsHandler = new FsEventsHandler(this) : this._nodeFsHandler = new NodeFsHandler(this), Object.freeze(opts);
815
+ }
816
+ // Public methods
817
+ /**
818
+ * Adds paths to be watched on an existing FSWatcher instance
819
+ * @param {Path|Array<Path>} paths_
820
+ * @param {String=} _origAdd private; for handling non-existent paths to be watched
821
+ * @param {Boolean=} _internal private; indicates a non-user add
822
+ * @returns {FSWatcher} for chaining
823
+ */
824
+ add(paths_, _origAdd, _internal) {
825
+ let { cwd, disableGlobbing } = this.options;
826
+ this.closed = !1;
827
+ let paths = unifyPaths(paths_);
828
+ return cwd && (paths = paths.map((path) => {
829
+ let absPath = getAbsolutePath(path, cwd);
830
+ return disableGlobbing || !isGlob(path) ? absPath : normalizePath(absPath);
831
+ })), paths = paths.filter((path) => path.startsWith(BANG) ? (this._ignoredPaths.add(path.slice(1)), !1) : (this._ignoredPaths.delete(path), this._ignoredPaths.delete(path + SLASH_GLOBSTAR), this._userIgnored = void 0, !0)), this.options.useFsEvents && this._fsEventsHandler ? (this._readyCount || (this._readyCount = paths.length), this.options.persistent && (this._readyCount += paths.length), paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path))) : (this._readyCount || (this._readyCount = 0), this._readyCount += paths.length, Promise.all(
832
+ paths.map(async (path) => {
833
+ let res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd);
834
+ return res && this._emitReady(), res;
835
+ })
836
+ ).then((results) => {
837
+ this.closed || results.filter((item) => item).forEach((item) => {
838
+ this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item));
839
+ });
840
+ })), this;
841
+ }
842
+ /**
843
+ * Close watchers or start ignoring events from specified paths.
844
+ * @param {Path|Array<Path>} paths_ - string or array of strings, file/directory paths and/or globs
845
+ * @returns {FSWatcher} for chaining
846
+ */
847
+ unwatch(paths_) {
848
+ if (this.closed) return this;
849
+ let paths = unifyPaths(paths_), { cwd } = this.options;
850
+ return paths.forEach((path) => {
851
+ !sysPath.isAbsolute(path) && !this._closers.has(path) && (cwd && (path = sysPath.join(cwd, path)), path = sysPath.resolve(path)), this._closePath(path), this._ignoredPaths.add(path), this._watched.has(path) && this._ignoredPaths.add(path + SLASH_GLOBSTAR), this._userIgnored = void 0;
852
+ }), this;
853
+ }
854
+ /**
855
+ * Close watchers and remove all listeners from watched paths.
856
+ * @returns {Promise<void>}.
857
+ */
858
+ close() {
859
+ if (this.closed) return this._closePromise;
860
+ this.closed = !0, this.removeAllListeners();
861
+ let closers = [];
862
+ return this._closers.forEach((closerList) => closerList.forEach((closer) => {
863
+ let promise = closer();
864
+ promise instanceof Promise && closers.push(promise);
865
+ })), this._streams.forEach((stream) => stream.destroy()), this._userIgnored = void 0, this._readyCount = 0, this._readyEmitted = !1, this._watched.forEach((dirent) => dirent.dispose()), ["closers", "watched", "streams", "symlinkPaths", "throttled"].forEach((key) => {
866
+ this[`_${key}`].clear();
867
+ }), this._closePromise = closers.length ? Promise.all(closers).then(() => {
868
+ }) : Promise.resolve(), this._closePromise;
869
+ }
870
+ /**
871
+ * Expose list of watched paths
872
+ * @returns {Object} for chaining
873
+ */
874
+ getWatched() {
875
+ let watchList = {};
876
+ return this._watched.forEach((entry, dir) => {
877
+ let key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir;
878
+ watchList[key || ONE_DOT] = entry.getChildren().sort();
879
+ }), watchList;
880
+ }
881
+ emitWithAll(event, args) {
882
+ this.emit(...args), event !== EV_ERROR && this.emit(EV_ALL, ...args);
883
+ }
884
+ // Common helpers
885
+ // --------------
886
+ /**
887
+ * Normalize and emit events.
888
+ * Calling _emit DOES NOT MEAN emit() would be called!
889
+ * @param {EventName} event Type of event
890
+ * @param {Path} path File or directory path
891
+ * @param {*=} val1 arguments to be passed with event
892
+ * @param {*=} val2
893
+ * @param {*=} val3
894
+ * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
895
+ */
896
+ async _emit(event, path, val1, val2, val3) {
897
+ if (this.closed) return;
898
+ let opts = this.options;
899
+ isWindows && (path = sysPath.normalize(path)), opts.cwd && (path = sysPath.relative(opts.cwd, path));
900
+ let args = [event, path];
901
+ val3 !== void 0 ? args.push(val1, val2, val3) : val2 !== void 0 ? args.push(val1, val2) : val1 !== void 0 && args.push(val1);
902
+ let awf = opts.awaitWriteFinish, pw;
903
+ if (awf && (pw = this._pendingWrites.get(path)))
904
+ return pw.lastChange = /* @__PURE__ */ new Date(), this;
905
+ if (opts.atomic) {
906
+ if (event === EV_UNLINK)
907
+ return this._pendingUnlinks.set(path, args), setTimeout(() => {
908
+ this._pendingUnlinks.forEach((entry, path2) => {
909
+ this.emit(...entry), this.emit(EV_ALL, ...entry), this._pendingUnlinks.delete(path2);
910
+ });
911
+ }, typeof opts.atomic == "number" ? opts.atomic : 100), this;
912
+ event === EV_ADD && this._pendingUnlinks.has(path) && (event = args[0] = EV_CHANGE, this._pendingUnlinks.delete(path));
913
+ }
914
+ if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) {
915
+ let awfEmit = (err, stats) => {
916
+ err ? (event = args[0] = EV_ERROR, args[1] = err, this.emitWithAll(event, args)) : stats && (args.length > 2 ? args[2] = stats : args.push(stats), this.emitWithAll(event, args));
917
+ };
918
+ return this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit), this;
919
+ }
920
+ if (event === EV_CHANGE && !this._throttle(EV_CHANGE, path, 50))
921
+ return this;
922
+ if (opts.alwaysStat && val1 === void 0 && (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE)) {
923
+ let fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path, stats;
924
+ try {
925
+ stats = await stat(fullPath);
926
+ } catch {
927
+ }
928
+ if (!stats || this.closed) return;
929
+ args.push(stats);
930
+ }
931
+ return this.emitWithAll(event, args), this;
932
+ }
933
+ /**
934
+ * Common handler for errors
935
+ * @param {Error} error
936
+ * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
937
+ */
938
+ _handleError(error) {
939
+ let code = error && error.code;
940
+ return error && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES") && this.emit(EV_ERROR, error), error || this.closed;
941
+ }
942
+ /**
943
+ * Helper utility for throttling
944
+ * @param {ThrottleType} actionType type being throttled
945
+ * @param {Path} path being acted upon
946
+ * @param {Number} timeout duration of time to suppress duplicate actions
947
+ * @returns {Object|false} tracking object or false if action should be suppressed
948
+ */
949
+ _throttle(actionType, path, timeout) {
950
+ this._throttled.has(actionType) || this._throttled.set(actionType, /* @__PURE__ */ new Map());
951
+ let action = this._throttled.get(actionType), actionPath = action.get(path);
952
+ if (actionPath)
953
+ return actionPath.count++, !1;
954
+ let timeoutObject, clear = () => {
955
+ let item = action.get(path), count = item ? item.count : 0;
956
+ return action.delete(path), clearTimeout(timeoutObject), item && clearTimeout(item.timeoutObject), count;
957
+ };
958
+ timeoutObject = setTimeout(clear, timeout);
959
+ let thr = { timeoutObject, clear, count: 0 };
960
+ return action.set(path, thr), thr;
961
+ }
962
+ _incrReadyCount() {
963
+ return this._readyCount++;
964
+ }
965
+ /**
966
+ * Awaits write operation to finish.
967
+ * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
968
+ * @param {Path} path being acted upon
969
+ * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
970
+ * @param {EventName} event
971
+ * @param {Function} awfEmit Callback to be called when ready for event to be emitted.
972
+ */
973
+ _awaitWriteFinish(path, threshold, event, awfEmit) {
974
+ let timeoutHandler, fullPath = path;
975
+ this.options.cwd && !sysPath.isAbsolute(path) && (fullPath = sysPath.join(this.options.cwd, path));
976
+ let now = /* @__PURE__ */ new Date(), awaitWriteFinish = (prevStat) => {
977
+ fs.stat(fullPath, (err, curStat) => {
978
+ if (err || !this._pendingWrites.has(path)) {
979
+ err && err.code !== "ENOENT" && awfEmit(err);
980
+ return;
981
+ }
982
+ let now2 = Number(/* @__PURE__ */ new Date());
983
+ prevStat && curStat.size !== prevStat.size && (this._pendingWrites.get(path).lastChange = now2);
984
+ let pw = this._pendingWrites.get(path);
985
+ now2 - pw.lastChange >= threshold ? (this._pendingWrites.delete(path), awfEmit(void 0, curStat)) : timeoutHandler = setTimeout(
986
+ awaitWriteFinish,
987
+ this.options.awaitWriteFinish.pollInterval,
988
+ curStat
989
+ );
990
+ });
991
+ };
992
+ this._pendingWrites.has(path) || (this._pendingWrites.set(path, {
993
+ lastChange: now,
994
+ cancelWait: () => (this._pendingWrites.delete(path), clearTimeout(timeoutHandler), event)
995
+ }), timeoutHandler = setTimeout(
996
+ awaitWriteFinish,
997
+ this.options.awaitWriteFinish.pollInterval
998
+ ));
999
+ }
1000
+ _getGlobIgnored() {
1001
+ return [...this._ignoredPaths.values()];
1002
+ }
1003
+ /**
1004
+ * Determines whether user has asked to ignore this path.
1005
+ * @param {Path} path filepath or dir
1006
+ * @param {fs.Stats=} stats result of fs.stat
1007
+ * @returns {Boolean}
1008
+ */
1009
+ _isIgnored(path, stats) {
1010
+ if (this.options.atomic && DOT_RE.test(path)) return !0;
1011
+ if (!this._userIgnored) {
1012
+ let { cwd } = this.options, ign = this.options.ignored, ignored = ign && ign.map(normalizeIgnored(cwd)), paths = arrify(ignored).filter((path2) => typeof path2 === STRING_TYPE && !isGlob(path2)).map((path2) => path2 + SLASH_GLOBSTAR), list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths);
1013
+ this._userIgnored = anymatch(list, void 0, ANYMATCH_OPTS);
1014
+ }
1015
+ return this._userIgnored([path, stats]);
1016
+ }
1017
+ _isntIgnored(path, stat2) {
1018
+ return !this._isIgnored(path, stat2);
1019
+ }
1020
+ /**
1021
+ * Provides a set of common helpers and properties relating to symlink and glob handling.
1022
+ * @param {Path} path file, directory, or glob pattern being watched
1023
+ * @param {Number=} depth at any depth > 0, this isn't a glob
1024
+ * @returns {WatchHelper} object containing helpers for this path
1025
+ */
1026
+ _getWatchHelpers(path, depth) {
1027
+ let watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path), follow = this.options.followSymlinks;
1028
+ return new WatchHelper(path, watchPath, follow, this);
1029
+ }
1030
+ // Directory helpers
1031
+ // -----------------
1032
+ /**
1033
+ * Provides directory tracking objects
1034
+ * @param {String} directory path of the directory
1035
+ * @returns {DirEntry} the directory's tracking object
1036
+ */
1037
+ _getWatchedDir(directory) {
1038
+ this._boundRemove || (this._boundRemove = this._remove.bind(this));
1039
+ let dir = sysPath.resolve(directory);
1040
+ return this._watched.has(dir) || this._watched.set(dir, new DirEntry(dir, this._boundRemove)), this._watched.get(dir);
1041
+ }
1042
+ // File helpers
1043
+ // ------------
1044
+ /**
1045
+ * Check for read permissions.
1046
+ * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405
1047
+ * @param {fs.Stats} stats - object, result of fs_stat
1048
+ * @returns {Boolean} indicates whether the file can be read
1049
+ */
1050
+ _hasReadPermissions(stats) {
1051
+ if (this.options.ignorePermissionErrors) return !0;
1052
+ let st = (stats && Number.parseInt(stats.mode, 10)) & 511;
1053
+ return !!(4 & Number.parseInt(st.toString(8)[0], 10));
1054
+ }
1055
+ /**
1056
+ * Handles emitting unlink events for
1057
+ * files and directories, and via recursion, for
1058
+ * files and directories within directories that are unlinked
1059
+ * @param {String} directory within which the following item is located
1060
+ * @param {String} item base path of item/directory
1061
+ * @returns {void}
1062
+ */
1063
+ _remove(directory, item, isDirectory) {
1064
+ let path = sysPath.join(directory, item), fullPath = sysPath.resolve(path);
1065
+ if (isDirectory = isDirectory ?? (this._watched.has(path) || this._watched.has(fullPath)), !this._throttle("remove", path, 100)) return;
1066
+ !isDirectory && !this.options.useFsEvents && this._watched.size === 1 && this.add(directory, item, !0), this._getWatchedDir(path).getChildren().forEach((nested) => this._remove(path, nested));
1067
+ let parent = this._getWatchedDir(directory), wasTracked = parent.has(item);
1068
+ parent.remove(item), this._symlinkPaths.has(fullPath) && this._symlinkPaths.delete(fullPath);
1069
+ let relPath = path;
1070
+ if (this.options.cwd && (relPath = sysPath.relative(this.options.cwd, path)), this.options.awaitWriteFinish && this._pendingWrites.has(relPath) && this._pendingWrites.get(relPath).cancelWait() === EV_ADD)
1071
+ return;
1072
+ this._watched.delete(path), this._watched.delete(fullPath);
1073
+ let eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK;
1074
+ wasTracked && !this._isIgnored(path) && this._emit(eventName, path), this.options.useFsEvents || this._closePath(path);
1075
+ }
1076
+ /**
1077
+ * Closes all watchers for a path
1078
+ * @param {Path} path
1079
+ */
1080
+ _closePath(path) {
1081
+ this._closeFile(path);
1082
+ let dir = sysPath.dirname(path);
1083
+ this._getWatchedDir(dir).remove(sysPath.basename(path));
1084
+ }
1085
+ /**
1086
+ * Closes only file-specific watchers
1087
+ * @param {Path} path
1088
+ */
1089
+ _closeFile(path) {
1090
+ let closers = this._closers.get(path);
1091
+ closers && (closers.forEach((closer) => closer()), this._closers.delete(path));
1092
+ }
1093
+ /**
1094
+ *
1095
+ * @param {Path} path
1096
+ * @param {Function} closer
1097
+ */
1098
+ _addPathCloser(path, closer) {
1099
+ if (!closer) return;
1100
+ let list = this._closers.get(path);
1101
+ list || (list = [], this._closers.set(path, list)), list.push(closer);
1102
+ }
1103
+ _readdirp(root, opts) {
1104
+ if (this.closed) return;
1105
+ let options = { type: EV_ALL, alwaysStat: !0, lstat: !0, ...opts }, stream = readdirp(root, options);
1106
+ return this._streams.add(stream), stream.once(STR_CLOSE, () => {
1107
+ stream = void 0;
1108
+ }), stream.once(STR_END, () => {
1109
+ stream && (this._streams.delete(stream), stream = void 0);
1110
+ }), stream;
1111
+ }
1112
+ };
1113
+ exports.FSWatcher = FSWatcher;
1114
+ var watch = (paths, options) => {
1115
+ let watcher = new FSWatcher(options);
1116
+ return watcher.add(paths), watcher;
1117
+ };
1118
+ exports.watch = watch;
1119
+ }
1120
+ });
1121
+ export default require_chokidar();
1122
+ //# sourceMappingURL=chokidar-OATAHMV6.js.map