@storm-software/config-tools 1.144.13 → 1.145.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 (159) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +260 -74597
  3. package/bin/config.js +224 -74588
  4. package/dist/chunk-2AVLCXLT.js +0 -0
  5. package/dist/chunk-3NWKPYIG.cjs +68 -0
  6. package/dist/{chunk-7TAUZNGG.cjs → chunk-5BKIG4XN.cjs} +5 -7
  7. package/dist/chunk-65SWKEHV.cjs +1 -0
  8. package/dist/{chunk-UHUKL2FF.js → chunk-6QCPF7DE.js} +3 -5
  9. package/dist/{chunk-TUH2WX5T.js → chunk-7FBGW2FI.js} +3 -5
  10. package/dist/{chunk-OMKDNOX6.cjs → chunk-7NSHGJWY.cjs} +2 -4
  11. package/dist/chunk-7PV6L7I7.cjs +1 -0
  12. package/dist/{chunk-I4SIJOYB.cjs → chunk-B6J2YUGO.cjs} +7 -9
  13. package/dist/{chunk-NCZG3KIJ.js → chunk-BHZFTVXN.js} +2 -4
  14. package/dist/{chunk-LHYMHJN7.js → chunk-CEEL5LLM.js} +8 -10
  15. package/dist/{chunk-WSHWZNKF.cjs → chunk-CRQ4EVX5.cjs} +4 -6
  16. package/dist/chunk-DD3HX2NX.cjs +1 -0
  17. package/dist/{chunk-VNWXMGH6.cjs → chunk-DXUUXBG3.cjs} +6 -8
  18. package/dist/{chunk-3HOVXAQZ.cjs → chunk-EOQEK2MM.cjs} +37 -39
  19. package/dist/chunk-EPBOQXUS.cjs +93 -0
  20. package/dist/{chunk-2F7SMIKE.js → chunk-FXFNC4WC.js} +4 -6
  21. package/dist/chunk-GFL2DSZK.js +44 -0
  22. package/dist/{chunk-V2H3W5RM.cjs → chunk-GMMTDKYU.cjs} +22 -24
  23. package/dist/{chunk-NMYOKDUE.cjs → chunk-HE7RJB2E.cjs} +30 -27
  24. package/dist/{chunk-L3RZVSYE.js → chunk-HI33NNPB.js} +3 -5
  25. package/dist/{chunk-5GWRMIQL.js → chunk-HSCCBYAV.js} +2 -4
  26. package/dist/{chunk-2BONUUVS.cjs → chunk-HSNM6VD2.cjs} +13 -12
  27. package/dist/{chunk-RXWR65M2.js → chunk-IKXDQ7DB.js} +5 -7
  28. package/dist/{chunk-DEWCXJEQ.cjs → chunk-IRCFHYKZ.cjs} +1 -6
  29. package/dist/{chunk-5CCF2WYC.js → chunk-IUT7Y2UY.js} +4 -6
  30. package/dist/chunk-IWD6YQKX.cjs +1 -0
  31. package/dist/chunk-JXLUUN7Z.cjs +179 -0
  32. package/dist/{chunk-XJSXW4P5.cjs → chunk-KRKGLKPD.cjs} +13 -15
  33. package/dist/chunk-L6UNTUC4.js +0 -0
  34. package/dist/{chunk-WBQEFUVW.js → chunk-LQJJD6FB.js} +2 -4
  35. package/dist/chunk-MXRRZKNO.js +77 -0
  36. package/dist/{chunk-MNA5ZBKU.js → chunk-MZ5BNE43.js} +12 -14
  37. package/dist/chunk-NJVL3GF4.js +0 -0
  38. package/dist/{chunk-WN4V6QSX.js → chunk-POXTJ6GF.js} +0 -5
  39. package/dist/{chunk-RR5DGQEI.js → chunk-PR7RQHRE.js} +2 -4
  40. package/dist/{chunk-A55N7CTJ.js → chunk-QBS3OCHH.js} +2 -4
  41. package/dist/{chunk-SJZ346G5.js → chunk-QGYINXXY.js} +3 -5
  42. package/dist/{chunk-M3QWTBKA.js → chunk-R4O6ILOD.js} +10 -7
  43. package/dist/chunk-RRKB32OH.js +0 -0
  44. package/dist/{chunk-E7VZQ7HY.cjs → chunk-RVM5N5ZI.cjs} +2 -4
  45. package/dist/chunk-SA4LVIO6.cjs +77 -0
  46. package/dist/chunk-SHUYVCID.js +6 -0
  47. package/dist/chunk-SLGVSUEV.cjs +36 -0
  48. package/dist/chunk-SPNVYBT4.cjs +44 -0
  49. package/dist/chunk-USNT2KNT.cjs +6 -0
  50. package/dist/chunk-WRGFZXJE.js +179 -0
  51. package/dist/{chunk-54PYJ6Z7.js → chunk-X7BEPYRX.js} +2 -4
  52. package/dist/{chunk-WJP36CPU.cjs → chunk-XAJB3BSF.cjs} +3 -5
  53. package/dist/{chunk-P26TW2V3.cjs → chunk-XDBACKKN.cjs} +3 -5
  54. package/dist/chunk-XY2LDOQ4.cjs +26 -0
  55. package/dist/{chunk-AXVHALK5.cjs → chunk-XYV3B7TT.cjs} +2 -4
  56. package/dist/{chunk-NKL6DBVO.js → chunk-YES7WAZK.js} +8 -7
  57. package/dist/chunk-ZA4IO7YJ.js +36 -0
  58. package/dist/config-file/get-config-file.cjs +20 -25
  59. package/dist/config-file/get-config-file.js +19 -24
  60. package/dist/config-file/index.cjs +21 -26
  61. package/dist/config-file/index.js +20 -25
  62. package/dist/create-storm-config.cjs +23 -28
  63. package/dist/create-storm-config.js +22 -27
  64. package/dist/env/get-env.cjs +7 -6
  65. package/dist/env/get-env.js +6 -5
  66. package/dist/env/index.cjs +9 -8
  67. package/dist/env/index.js +8 -7
  68. package/dist/env/set-env.cjs +6 -6
  69. package/dist/env/set-env.js +5 -5
  70. package/dist/get-config.cjs +24 -29
  71. package/dist/get-config.js +23 -28
  72. package/dist/index.cjs +28 -38
  73. package/dist/index.js +27 -37
  74. package/dist/logger/chalk.cjs +3 -3
  75. package/dist/logger/chalk.js +2 -2
  76. package/dist/logger/console-icons.cjs +5 -5
  77. package/dist/logger/console-icons.js +4 -4
  78. package/dist/logger/console.cjs +14 -13
  79. package/dist/logger/console.js +13 -12
  80. package/dist/logger/create-logger.cjs +15 -14
  81. package/dist/logger/create-logger.js +14 -13
  82. package/dist/logger/format-timestamp.cjs +3 -3
  83. package/dist/logger/format-timestamp.js +2 -2
  84. package/dist/logger/get-log-level.cjs +4 -4
  85. package/dist/logger/get-log-level.js +3 -3
  86. package/dist/logger/index.cjs +16 -15
  87. package/dist/logger/index.js +15 -14
  88. package/dist/logger/is-unicode-supported.cjs +3 -3
  89. package/dist/logger/is-unicode-supported.js +2 -2
  90. package/dist/types.cjs +3 -3
  91. package/dist/types.js +2 -2
  92. package/dist/utilities/apply-workspace-tokens.cjs +6 -6
  93. package/dist/utilities/apply-workspace-tokens.js +5 -5
  94. package/dist/utilities/correct-paths.cjs +3 -3
  95. package/dist/utilities/correct-paths.js +2 -2
  96. package/dist/utilities/file-path-utils.cjs +3 -3
  97. package/dist/utilities/file-path-utils.js +2 -2
  98. package/dist/utilities/find-up.cjs +3 -3
  99. package/dist/utilities/find-up.js +2 -2
  100. package/dist/utilities/find-workspace-root.cjs +5 -5
  101. package/dist/utilities/find-workspace-root.js +4 -4
  102. package/dist/utilities/get-default-config.cjs +7 -6
  103. package/dist/utilities/get-default-config.js +6 -5
  104. package/dist/utilities/index.cjs +19 -18
  105. package/dist/utilities/index.js +18 -17
  106. package/dist/utilities/process-handler.cjs +15 -14
  107. package/dist/utilities/process-handler.js +14 -13
  108. package/dist/utilities/run.cjs +3 -3
  109. package/dist/utilities/run.js +2 -2
  110. package/package.json +4 -5
  111. package/dist/chunk-2GPW5A4A.cjs +0 -50
  112. package/dist/chunk-3IVAD3CI.cjs +0 -510
  113. package/dist/chunk-52JTCGPV.cjs +0 -6
  114. package/dist/chunk-52Z3B7HG.js +0 -6
  115. package/dist/chunk-55BEED5V.cjs +0 -70
  116. package/dist/chunk-5LIAIS5V.js +0 -6
  117. package/dist/chunk-65NJ2BNV.js +0 -49
  118. package/dist/chunk-6SKUJC25.cjs +0 -451
  119. package/dist/chunk-7IOWYE4O.cjs +0 -34070
  120. package/dist/chunk-7LNAPF6J.js +0 -7601
  121. package/dist/chunk-BIBA7MGH.js +0 -84
  122. package/dist/chunk-BZ3KC4XF.cjs +0 -6
  123. package/dist/chunk-EVHBF7QV.cjs +0 -6
  124. package/dist/chunk-F5YSYO5J.js +0 -2645
  125. package/dist/chunk-FIQNSYAM.cjs +0 -1120
  126. package/dist/chunk-IIQMKNOS.cjs +0 -6
  127. package/dist/chunk-JT5CJFOS.cjs +0 -2645
  128. package/dist/chunk-KCNZC4ZI.js +0 -6
  129. package/dist/chunk-M3K4KT2L.cjs +0 -4054
  130. package/dist/chunk-MVPKPUE3.js +0 -1120
  131. package/dist/chunk-MZADO4BZ.cjs +0 -765
  132. package/dist/chunk-PRGAKNNV.js +0 -765
  133. package/dist/chunk-Q3AKY4XY.js +0 -4054
  134. package/dist/chunk-Q42ZDLPG.js +0 -510
  135. package/dist/chunk-QFCXJAOM.js +0 -50
  136. package/dist/chunk-QZAXYX3X.cjs +0 -7601
  137. package/dist/chunk-R6ZWDCX4.cjs +0 -28
  138. package/dist/chunk-RNYNEYJ5.js +0 -451
  139. package/dist/chunk-SCFUDB74.cjs +0 -49
  140. package/dist/chunk-YDVJJTKY.js +0 -34067
  141. package/dist/chunk-Z555MBWN.cjs +0 -84
  142. package/dist/chunk-ZIUQG4HD.js +0 -6
  143. package/dist/chunk-ZXAQ4Y3X.cjs +0 -95
  144. package/dist/dist-UYAH2J3L.js +0 -17570
  145. package/dist/dist-WP6JBNT4.cjs +0 -17571
  146. package/dist/esm-F37IKPYG.cjs +0 -1716
  147. package/dist/esm-SQV6ELTR.js +0 -1716
  148. package/dist/execa-4HBUJBFQ.js +0 -2424
  149. package/dist/execa-K2JB3BB4.cjs +0 -2424
  150. package/dist/json5-PPMIEYQR.cjs +0 -10
  151. package/dist/json5-WTSMELC2.js +0 -10
  152. package/dist/jsonc-B7SFZJW2.js +0 -15
  153. package/dist/jsonc-X7JKFW4T.cjs +0 -15
  154. package/dist/multipart-parser-JIRREWFU.cjs +0 -187
  155. package/dist/multipart-parser-TFNERLJV.js +0 -187
  156. package/dist/toml-MTE5VHET.js +0 -10
  157. package/dist/toml-N2WLYE3T.cjs +0 -10
  158. package/dist/yaml-D6PQ2AEL.js +0 -10
  159. package/dist/yaml-LR2Y4V3W.cjs +0 -10
@@ -1,1716 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
-
4
- var _chunkSCFUDB74cjs = require('./chunk-SCFUDB74.cjs');
5
-
6
- // ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
7
- _chunkSCFUDB74cjs.init_cjs_shims.call(void 0, );
8
- var _fs = require('fs');
9
- var _promises = require('fs/promises');
10
- var _events = require('events');
11
- var _path = require('path'); var sysPath2 = _interopRequireWildcard(_path); var sysPath = _interopRequireWildcard(_path);
12
-
13
- // ../../node_modules/.pnpm/readdirp@4.1.1/node_modules/readdirp/esm/index.js
14
- _chunkSCFUDB74cjs.init_cjs_shims.call(void 0, );
15
-
16
- var _stream = require('stream');
17
-
18
- var EntryTypes = {
19
- FILE_TYPE: "files",
20
- DIR_TYPE: "directories",
21
- FILE_DIR_TYPE: "files_directories",
22
- EVERYTHING_TYPE: "all"
23
- };
24
- var defaultOptions = {
25
- root: ".",
26
- fileFilter: /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (_entryInfo) => true, "fileFilter"),
27
- directoryFilter: /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (_entryInfo) => true, "directoryFilter"),
28
- type: EntryTypes.FILE_TYPE,
29
- lstat: false,
30
- depth: 2147483648,
31
- alwaysStat: false,
32
- highWaterMark: 4096
33
- };
34
- Object.freeze(defaultOptions);
35
- var RECURSIVE_ERROR_CODE = "READDIRP_RECURSIVE_ERROR";
36
- var NORMAL_FLOW_ERRORS = /* @__PURE__ */ new Set([
37
- "ENOENT",
38
- "EPERM",
39
- "EACCES",
40
- "ELOOP",
41
- RECURSIVE_ERROR_CODE
42
- ]);
43
- var ALL_TYPES = [
44
- EntryTypes.DIR_TYPE,
45
- EntryTypes.EVERYTHING_TYPE,
46
- EntryTypes.FILE_DIR_TYPE,
47
- EntryTypes.FILE_TYPE
48
- ];
49
- var DIR_TYPES = /* @__PURE__ */ new Set([
50
- EntryTypes.DIR_TYPE,
51
- EntryTypes.EVERYTHING_TYPE,
52
- EntryTypes.FILE_DIR_TYPE
53
- ]);
54
- var FILE_TYPES = /* @__PURE__ */ new Set([
55
- EntryTypes.EVERYTHING_TYPE,
56
- EntryTypes.FILE_DIR_TYPE,
57
- EntryTypes.FILE_TYPE
58
- ]);
59
- var isNormalFlowError = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (error) => NORMAL_FLOW_ERRORS.has(error.code), "isNormalFlowError");
60
- var wantBigintFsStats = process.platform === "win32";
61
- var emptyFn = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (_entryInfo) => true, "emptyFn");
62
- var normalizeFilter = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (filter) => {
63
- if (filter === void 0) return emptyFn;
64
- if (typeof filter === "function") return filter;
65
- if (typeof filter === "string") {
66
- const fl = filter.trim();
67
- return (entry) => entry.basename === fl;
68
- }
69
- if (Array.isArray(filter)) {
70
- const trItems = filter.map((item) => item.trim());
71
- return (entry) => trItems.some((f) => entry.basename === f);
72
- }
73
- return emptyFn;
74
- }, "normalizeFilter");
75
- var ReaddirpStream = class extends _stream.Readable {
76
- static {
77
- _chunkSCFUDB74cjs.__name.call(void 0, this, "ReaddirpStream");
78
- }
79
- constructor(options = {}) {
80
- super({
81
- objectMode: true,
82
- autoDestroy: true,
83
- highWaterMark: options.highWaterMark
84
- });
85
- const opts = {
86
- ...defaultOptions,
87
- ...options
88
- };
89
- const { root, type } = opts;
90
- this._fileFilter = normalizeFilter(opts.fileFilter);
91
- this._directoryFilter = normalizeFilter(opts.directoryFilter);
92
- const statMethod = opts.lstat ? _promises.lstat : _promises.stat;
93
- if (wantBigintFsStats) {
94
- this._stat = (path) => statMethod(path, {
95
- bigint: true
96
- });
97
- } else {
98
- this._stat = statMethod;
99
- }
100
- this._maxDepth = _nullishCoalesce(opts.depth, () => ( defaultOptions.depth));
101
- this._wantsDir = type ? DIR_TYPES.has(type) : false;
102
- this._wantsFile = type ? FILE_TYPES.has(type) : false;
103
- this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
104
- this._root = _path.resolve.call(void 0, root);
105
- this._isDirent = !opts.alwaysStat;
106
- this._statsProp = this._isDirent ? "dirent" : "stats";
107
- this._rdOptions = {
108
- encoding: "utf8",
109
- withFileTypes: this._isDirent
110
- };
111
- this.parents = [
112
- this._exploreDir(root, 1)
113
- ];
114
- this.reading = false;
115
- this.parent = void 0;
116
- }
117
- async _read(batch) {
118
- if (this.reading) return;
119
- this.reading = true;
120
- try {
121
- while (!this.destroyed && batch > 0) {
122
- const par = this.parent;
123
- const fil = par && par.files;
124
- if (fil && fil.length > 0) {
125
- const { path, depth } = par;
126
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path));
127
- const awaited = await Promise.all(slice);
128
- for (const entry of awaited) {
129
- if (!entry) {
130
- batch--;
131
- return;
132
- }
133
- if (this.destroyed) return;
134
- const entryType = await this._getEntryType(entry);
135
- if (entryType === "directory" && this._directoryFilter(entry)) {
136
- if (depth <= this._maxDepth) {
137
- this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
138
- }
139
- if (this._wantsDir) {
140
- this.push(entry);
141
- batch--;
142
- }
143
- } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
144
- if (this._wantsFile) {
145
- this.push(entry);
146
- batch--;
147
- }
148
- }
149
- }
150
- } else {
151
- const parent = this.parents.pop();
152
- if (!parent) {
153
- this.push(null);
154
- break;
155
- }
156
- this.parent = await parent;
157
- if (this.destroyed) return;
158
- }
159
- }
160
- } catch (error) {
161
- this.destroy(error);
162
- } finally {
163
- this.reading = false;
164
- }
165
- }
166
- async _exploreDir(path, depth) {
167
- let files;
168
- try {
169
- files = await _promises.readdir.call(void 0, path, this._rdOptions);
170
- } catch (error) {
171
- this._onError(error);
172
- }
173
- return {
174
- files,
175
- depth,
176
- path
177
- };
178
- }
179
- async _formatEntry(dirent, path) {
180
- let entry;
181
- const basename3 = this._isDirent ? dirent.name : dirent;
182
- try {
183
- const fullPath = _path.resolve.call(void 0, _path.join.call(void 0, path, basename3));
184
- entry = {
185
- path: _path.relative.call(void 0, this._root, fullPath),
186
- fullPath,
187
- basename: basename3
188
- };
189
- entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
190
- } catch (err) {
191
- this._onError(err);
192
- return;
193
- }
194
- return entry;
195
- }
196
- _onError(err) {
197
- if (isNormalFlowError(err) && !this.destroyed) {
198
- this.emit("warn", err);
199
- } else {
200
- this.destroy(err);
201
- }
202
- }
203
- async _getEntryType(entry) {
204
- if (!entry && this._statsProp in entry) {
205
- return "";
206
- }
207
- const stats = entry[this._statsProp];
208
- if (stats.isFile()) return "file";
209
- if (stats.isDirectory()) return "directory";
210
- if (stats && stats.isSymbolicLink()) {
211
- const full = entry.fullPath;
212
- try {
213
- const entryRealPath = await _promises.realpath.call(void 0, full);
214
- const entryRealPathStats = await _promises.lstat.call(void 0, entryRealPath);
215
- if (entryRealPathStats.isFile()) {
216
- return "file";
217
- }
218
- if (entryRealPathStats.isDirectory()) {
219
- const len = entryRealPath.length;
220
- if (full.startsWith(entryRealPath) && full.substr(len, 1) === _path.sep) {
221
- const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
222
- recursiveError.code = RECURSIVE_ERROR_CODE;
223
- return this._onError(recursiveError);
224
- }
225
- return "directory";
226
- }
227
- } catch (error) {
228
- this._onError(error);
229
- return "";
230
- }
231
- }
232
- }
233
- _includeAsFile(entry) {
234
- const stats = entry && entry[this._statsProp];
235
- return stats && this._wantsEverything && !stats.isDirectory();
236
- }
237
- };
238
- function readdirp(root, options = {}) {
239
- let type = options.entryType || options.type;
240
- if (type === "both") type = EntryTypes.FILE_DIR_TYPE;
241
- if (type) options.type = type;
242
- if (!root) {
243
- throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
244
- } else if (typeof root !== "string") {
245
- throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
246
- } else if (type && !ALL_TYPES.includes(type)) {
247
- throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
248
- }
249
- options.root = root;
250
- return new ReaddirpStream(options);
251
- }
252
- _chunkSCFUDB74cjs.__name.call(void 0, readdirp, "readdirp");
253
-
254
- // ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/handler.js
255
- _chunkSCFUDB74cjs.init_cjs_shims.call(void 0, );
256
-
257
-
258
-
259
- var _os = require('os');
260
- var STR_DATA = "data";
261
- var STR_END = "end";
262
- var STR_CLOSE = "close";
263
- var EMPTY_FN = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, () => {
264
- }, "EMPTY_FN");
265
- var pl = process.platform;
266
- var isWindows = pl === "win32";
267
- var isMacos = pl === "darwin";
268
- var isLinux = pl === "linux";
269
- var isFreeBSD = pl === "freebsd";
270
- var isIBMi = _os.type.call(void 0, ) === "OS400";
271
- var EVENTS = {
272
- ALL: "all",
273
- READY: "ready",
274
- ADD: "add",
275
- CHANGE: "change",
276
- ADD_DIR: "addDir",
277
- UNLINK: "unlink",
278
- UNLINK_DIR: "unlinkDir",
279
- RAW: "raw",
280
- ERROR: "error"
281
- };
282
- var EV = EVENTS;
283
- var THROTTLE_MODE_WATCH = "watch";
284
- var statMethods = {
285
- lstat: _promises.lstat,
286
- stat: _promises.stat
287
- };
288
- var KEY_LISTENERS = "listeners";
289
- var KEY_ERR = "errHandlers";
290
- var KEY_RAW = "rawEmitters";
291
- var HANDLER_KEYS = [
292
- KEY_LISTENERS,
293
- KEY_ERR,
294
- KEY_RAW
295
- ];
296
- var binaryExtensions = /* @__PURE__ */ new Set([
297
- "3dm",
298
- "3ds",
299
- "3g2",
300
- "3gp",
301
- "7z",
302
- "a",
303
- "aac",
304
- "adp",
305
- "afdesign",
306
- "afphoto",
307
- "afpub",
308
- "ai",
309
- "aif",
310
- "aiff",
311
- "alz",
312
- "ape",
313
- "apk",
314
- "appimage",
315
- "ar",
316
- "arj",
317
- "asf",
318
- "au",
319
- "avi",
320
- "bak",
321
- "baml",
322
- "bh",
323
- "bin",
324
- "bk",
325
- "bmp",
326
- "btif",
327
- "bz2",
328
- "bzip2",
329
- "cab",
330
- "caf",
331
- "cgm",
332
- "class",
333
- "cmx",
334
- "cpio",
335
- "cr2",
336
- "cur",
337
- "dat",
338
- "dcm",
339
- "deb",
340
- "dex",
341
- "djvu",
342
- "dll",
343
- "dmg",
344
- "dng",
345
- "doc",
346
- "docm",
347
- "docx",
348
- "dot",
349
- "dotm",
350
- "dra",
351
- "DS_Store",
352
- "dsk",
353
- "dts",
354
- "dtshd",
355
- "dvb",
356
- "dwg",
357
- "dxf",
358
- "ecelp4800",
359
- "ecelp7470",
360
- "ecelp9600",
361
- "egg",
362
- "eol",
363
- "eot",
364
- "epub",
365
- "exe",
366
- "f4v",
367
- "fbs",
368
- "fh",
369
- "fla",
370
- "flac",
371
- "flatpak",
372
- "fli",
373
- "flv",
374
- "fpx",
375
- "fst",
376
- "fvt",
377
- "g3",
378
- "gh",
379
- "gif",
380
- "graffle",
381
- "gz",
382
- "gzip",
383
- "h261",
384
- "h263",
385
- "h264",
386
- "icns",
387
- "ico",
388
- "ief",
389
- "img",
390
- "ipa",
391
- "iso",
392
- "jar",
393
- "jpeg",
394
- "jpg",
395
- "jpgv",
396
- "jpm",
397
- "jxr",
398
- "key",
399
- "ktx",
400
- "lha",
401
- "lib",
402
- "lvp",
403
- "lz",
404
- "lzh",
405
- "lzma",
406
- "lzo",
407
- "m3u",
408
- "m4a",
409
- "m4v",
410
- "mar",
411
- "mdi",
412
- "mht",
413
- "mid",
414
- "midi",
415
- "mj2",
416
- "mka",
417
- "mkv",
418
- "mmr",
419
- "mng",
420
- "mobi",
421
- "mov",
422
- "movie",
423
- "mp3",
424
- "mp4",
425
- "mp4a",
426
- "mpeg",
427
- "mpg",
428
- "mpga",
429
- "mxu",
430
- "nef",
431
- "npx",
432
- "numbers",
433
- "nupkg",
434
- "o",
435
- "odp",
436
- "ods",
437
- "odt",
438
- "oga",
439
- "ogg",
440
- "ogv",
441
- "otf",
442
- "ott",
443
- "pages",
444
- "pbm",
445
- "pcx",
446
- "pdb",
447
- "pdf",
448
- "pea",
449
- "pgm",
450
- "pic",
451
- "png",
452
- "pnm",
453
- "pot",
454
- "potm",
455
- "potx",
456
- "ppa",
457
- "ppam",
458
- "ppm",
459
- "pps",
460
- "ppsm",
461
- "ppsx",
462
- "ppt",
463
- "pptm",
464
- "pptx",
465
- "psd",
466
- "pya",
467
- "pyc",
468
- "pyo",
469
- "pyv",
470
- "qt",
471
- "rar",
472
- "ras",
473
- "raw",
474
- "resources",
475
- "rgb",
476
- "rip",
477
- "rlc",
478
- "rmf",
479
- "rmvb",
480
- "rpm",
481
- "rtf",
482
- "rz",
483
- "s3m",
484
- "s7z",
485
- "scpt",
486
- "sgi",
487
- "shar",
488
- "snap",
489
- "sil",
490
- "sketch",
491
- "slk",
492
- "smv",
493
- "snk",
494
- "so",
495
- "stl",
496
- "suo",
497
- "sub",
498
- "swf",
499
- "tar",
500
- "tbz",
501
- "tbz2",
502
- "tga",
503
- "tgz",
504
- "thmx",
505
- "tif",
506
- "tiff",
507
- "tlz",
508
- "ttc",
509
- "ttf",
510
- "txz",
511
- "udf",
512
- "uvh",
513
- "uvi",
514
- "uvm",
515
- "uvp",
516
- "uvs",
517
- "uvu",
518
- "viv",
519
- "vob",
520
- "war",
521
- "wav",
522
- "wax",
523
- "wbmp",
524
- "wdp",
525
- "weba",
526
- "webm",
527
- "webp",
528
- "whl",
529
- "wim",
530
- "wm",
531
- "wma",
532
- "wmv",
533
- "wmx",
534
- "woff",
535
- "woff2",
536
- "wrm",
537
- "wvx",
538
- "xbm",
539
- "xif",
540
- "xla",
541
- "xlam",
542
- "xls",
543
- "xlsb",
544
- "xlsm",
545
- "xlsx",
546
- "xlt",
547
- "xltm",
548
- "xltx",
549
- "xm",
550
- "xmind",
551
- "xpi",
552
- "xpm",
553
- "xwd",
554
- "xz",
555
- "z",
556
- "zip",
557
- "zipx"
558
- ]);
559
- var isBinaryPath = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase()), "isBinaryPath");
560
- var foreach = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (val, fn) => {
561
- if (val instanceof Set) {
562
- val.forEach(fn);
563
- } else {
564
- fn(val);
565
- }
566
- }, "foreach");
567
- var addAndConvert = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (main, prop, item) => {
568
- let container = main[prop];
569
- if (!(container instanceof Set)) {
570
- main[prop] = container = /* @__PURE__ */ new Set([
571
- container
572
- ]);
573
- }
574
- container.add(item);
575
- }, "addAndConvert");
576
- var clearItem = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (cont) => (key) => {
577
- const set = cont[key];
578
- if (set instanceof Set) {
579
- set.clear();
580
- } else {
581
- delete cont[key];
582
- }
583
- }, "clearItem");
584
- var delFromSet = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (main, prop, item) => {
585
- const container = main[prop];
586
- if (container instanceof Set) {
587
- container.delete(item);
588
- } else if (container === item) {
589
- delete main[prop];
590
- }
591
- }, "delFromSet");
592
- var isEmptySet = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (val) => val instanceof Set ? val.size === 0 : !val, "isEmptySet");
593
- var FsWatchInstances = /* @__PURE__ */ new Map();
594
- function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
595
- const handleEvent = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (rawEvent, evPath) => {
596
- listener(path);
597
- emitRaw(rawEvent, evPath, {
598
- watchedPath: path
599
- });
600
- if (evPath && path !== evPath) {
601
- fsWatchBroadcast(sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath));
602
- }
603
- }, "handleEvent");
604
- try {
605
- return _fs.watch.call(void 0, path, {
606
- persistent: options.persistent
607
- }, handleEvent);
608
- } catch (error) {
609
- errHandler(error);
610
- return void 0;
611
- }
612
- }
613
- _chunkSCFUDB74cjs.__name.call(void 0, createFsWatchInstance, "createFsWatchInstance");
614
- var fsWatchBroadcast = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (fullPath, listenerType, val1, val2, val3) => {
615
- const cont = FsWatchInstances.get(fullPath);
616
- if (!cont) return;
617
- foreach(cont[listenerType], (listener) => {
618
- listener(val1, val2, val3);
619
- });
620
- }, "fsWatchBroadcast");
621
- var setFsWatchListener = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (path, fullPath, options, handlers) => {
622
- const { listener, errHandler, rawEmitter } = handlers;
623
- let cont = FsWatchInstances.get(fullPath);
624
- let watcher;
625
- if (!options.persistent) {
626
- watcher = createFsWatchInstance(path, options, listener, errHandler, rawEmitter);
627
- if (!watcher) return;
628
- return watcher.close.bind(watcher);
629
- }
630
- if (cont) {
631
- addAndConvert(cont, KEY_LISTENERS, listener);
632
- addAndConvert(cont, KEY_ERR, errHandler);
633
- addAndConvert(cont, KEY_RAW, rawEmitter);
634
- } else {
635
- watcher = createFsWatchInstance(path, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
636
- if (!watcher) return;
637
- watcher.on(EV.ERROR, async (error) => {
638
- const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
639
- if (cont) cont.watcherUnusable = true;
640
- if (isWindows && error.code === "EPERM") {
641
- try {
642
- const fd = await _promises.open.call(void 0, path, "r");
643
- await fd.close();
644
- broadcastErr(error);
645
- } catch (err) {
646
- }
647
- } else {
648
- broadcastErr(error);
649
- }
650
- });
651
- cont = {
652
- listeners: listener,
653
- errHandlers: errHandler,
654
- rawEmitters: rawEmitter,
655
- watcher
656
- };
657
- FsWatchInstances.set(fullPath, cont);
658
- }
659
- return () => {
660
- delFromSet(cont, KEY_LISTENERS, listener);
661
- delFromSet(cont, KEY_ERR, errHandler);
662
- delFromSet(cont, KEY_RAW, rawEmitter);
663
- if (isEmptySet(cont.listeners)) {
664
- cont.watcher.close();
665
- FsWatchInstances.delete(fullPath);
666
- HANDLER_KEYS.forEach(clearItem(cont));
667
- cont.watcher = void 0;
668
- Object.freeze(cont);
669
- }
670
- };
671
- }, "setFsWatchListener");
672
- var FsWatchFileInstances = /* @__PURE__ */ new Map();
673
- var setFsWatchFileListener = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (path, fullPath, options, handlers) => {
674
- const { listener, rawEmitter } = handlers;
675
- let cont = FsWatchFileInstances.get(fullPath);
676
- const copts = cont && cont.options;
677
- if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
678
- _fs.unwatchFile.call(void 0, fullPath);
679
- cont = void 0;
680
- }
681
- if (cont) {
682
- addAndConvert(cont, KEY_LISTENERS, listener);
683
- addAndConvert(cont, KEY_RAW, rawEmitter);
684
- } else {
685
- cont = {
686
- listeners: listener,
687
- rawEmitters: rawEmitter,
688
- options,
689
- watcher: _fs.watchFile.call(void 0, fullPath, options, (curr, prev) => {
690
- foreach(cont.rawEmitters, (rawEmitter2) => {
691
- rawEmitter2(EV.CHANGE, fullPath, {
692
- curr,
693
- prev
694
- });
695
- });
696
- const currmtime = curr.mtimeMs;
697
- if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
698
- foreach(cont.listeners, (listener2) => listener2(path, curr));
699
- }
700
- })
701
- };
702
- FsWatchFileInstances.set(fullPath, cont);
703
- }
704
- return () => {
705
- delFromSet(cont, KEY_LISTENERS, listener);
706
- delFromSet(cont, KEY_RAW, rawEmitter);
707
- if (isEmptySet(cont.listeners)) {
708
- FsWatchFileInstances.delete(fullPath);
709
- _fs.unwatchFile.call(void 0, fullPath);
710
- cont.options = cont.watcher = void 0;
711
- Object.freeze(cont);
712
- }
713
- };
714
- }, "setFsWatchFileListener");
715
- var NodeFsHandler = class {
716
- static {
717
- _chunkSCFUDB74cjs.__name.call(void 0, this, "NodeFsHandler");
718
- }
719
- constructor(fsW) {
720
- this.fsw = fsW;
721
- this._boundHandleError = (error) => fsW._handleError(error);
722
- }
723
- /**
724
- * Watch file for changes with fs_watchFile or fs_watch.
725
- * @param path to file or dir
726
- * @param listener on fs change
727
- * @returns closer for the watcher instance
728
- */
729
- _watchWithNodeFs(path, listener) {
730
- const opts = this.fsw.options;
731
- const directory = sysPath.dirname(path);
732
- const basename3 = sysPath.basename(path);
733
- const parent = this.fsw._getWatchedDir(directory);
734
- parent.add(basename3);
735
- const absolutePath = sysPath.resolve(path);
736
- const options = {
737
- persistent: opts.persistent
738
- };
739
- if (!listener) listener = EMPTY_FN;
740
- let closer;
741
- if (opts.usePolling) {
742
- const enableBin = opts.interval !== opts.binaryInterval;
743
- options.interval = enableBin && isBinaryPath(basename3) ? opts.binaryInterval : opts.interval;
744
- closer = setFsWatchFileListener(path, absolutePath, options, {
745
- listener,
746
- rawEmitter: this.fsw._emitRaw
747
- });
748
- } else {
749
- closer = setFsWatchListener(path, absolutePath, options, {
750
- listener,
751
- errHandler: this._boundHandleError,
752
- rawEmitter: this.fsw._emitRaw
753
- });
754
- }
755
- return closer;
756
- }
757
- /**
758
- * Watch a file and emit add event if warranted.
759
- * @returns closer for the watcher instance
760
- */
761
- _handleFile(file, stats, initialAdd) {
762
- if (this.fsw.closed) {
763
- return;
764
- }
765
- const dirname3 = sysPath.dirname(file);
766
- const basename3 = sysPath.basename(file);
767
- const parent = this.fsw._getWatchedDir(dirname3);
768
- let prevStats = stats;
769
- if (parent.has(basename3)) return;
770
- const listener = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, async (path, newStats) => {
771
- if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
772
- if (!newStats || newStats.mtimeMs === 0) {
773
- try {
774
- const newStats2 = await _promises.stat.call(void 0, file);
775
- if (this.fsw.closed) return;
776
- const at = newStats2.atimeMs;
777
- const mt = newStats2.mtimeMs;
778
- if (!at || at <= mt || mt !== prevStats.mtimeMs) {
779
- this.fsw._emit(EV.CHANGE, file, newStats2);
780
- }
781
- if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
782
- this.fsw._closeFile(path);
783
- prevStats = newStats2;
784
- const closer2 = this._watchWithNodeFs(file, listener);
785
- if (closer2) this.fsw._addPathCloser(path, closer2);
786
- } else {
787
- prevStats = newStats2;
788
- }
789
- } catch (error) {
790
- this.fsw._remove(dirname3, basename3);
791
- }
792
- } else if (parent.has(basename3)) {
793
- const at = newStats.atimeMs;
794
- const mt = newStats.mtimeMs;
795
- if (!at || at <= mt || mt !== prevStats.mtimeMs) {
796
- this.fsw._emit(EV.CHANGE, file, newStats);
797
- }
798
- prevStats = newStats;
799
- }
800
- }, "listener");
801
- const closer = this._watchWithNodeFs(file, listener);
802
- if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
803
- if (!this.fsw._throttle(EV.ADD, file, 0)) return;
804
- this.fsw._emit(EV.ADD, file, stats);
805
- }
806
- return closer;
807
- }
808
- /**
809
- * Handle symlinks encountered while reading a dir.
810
- * @param entry returned by readdirp
811
- * @param directory path of dir being read
812
- * @param path of this item
813
- * @param item basename of this item
814
- * @returns true if no more processing is needed for this entry.
815
- */
816
- async _handleSymlink(entry, directory, path, item) {
817
- if (this.fsw.closed) {
818
- return;
819
- }
820
- const full = entry.fullPath;
821
- const dir = this.fsw._getWatchedDir(directory);
822
- if (!this.fsw.options.followSymlinks) {
823
- this.fsw._incrReadyCount();
824
- let linkPath;
825
- try {
826
- linkPath = await _promises.realpath.call(void 0, path);
827
- } catch (e) {
828
- this.fsw._emitReady();
829
- return true;
830
- }
831
- if (this.fsw.closed) return;
832
- if (dir.has(item)) {
833
- if (this.fsw._symlinkPaths.get(full) !== linkPath) {
834
- this.fsw._symlinkPaths.set(full, linkPath);
835
- this.fsw._emit(EV.CHANGE, path, entry.stats);
836
- }
837
- } else {
838
- dir.add(item);
839
- this.fsw._symlinkPaths.set(full, linkPath);
840
- this.fsw._emit(EV.ADD, path, entry.stats);
841
- }
842
- this.fsw._emitReady();
843
- return true;
844
- }
845
- if (this.fsw._symlinkPaths.has(full)) {
846
- return true;
847
- }
848
- this.fsw._symlinkPaths.set(full, true);
849
- }
850
- _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
851
- directory = sysPath.join(directory, "");
852
- throttler = this.fsw._throttle("readdir", directory, 1e3);
853
- if (!throttler) return;
854
- const previous = this.fsw._getWatchedDir(wh.path);
855
- const current = /* @__PURE__ */ new Set();
856
- let stream = this.fsw._readdirp(directory, {
857
- fileFilter: /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (entry) => wh.filterPath(entry), "fileFilter"),
858
- directoryFilter: /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (entry) => wh.filterDir(entry), "directoryFilter")
859
- });
860
- if (!stream) return;
861
- stream.on(STR_DATA, async (entry) => {
862
- if (this.fsw.closed) {
863
- stream = void 0;
864
- return;
865
- }
866
- const item = entry.path;
867
- let path = sysPath.join(directory, item);
868
- current.add(item);
869
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) {
870
- return;
871
- }
872
- if (this.fsw.closed) {
873
- stream = void 0;
874
- return;
875
- }
876
- if (item === target || !target && !previous.has(item)) {
877
- this.fsw._incrReadyCount();
878
- path = sysPath.join(dir, sysPath.relative(dir, path));
879
- this._addToNodeFs(path, initialAdd, wh, depth + 1);
880
- }
881
- }).on(EV.ERROR, this._boundHandleError);
882
- return new Promise((resolve3, reject) => {
883
- if (!stream) return reject();
884
- stream.once(STR_END, () => {
885
- if (this.fsw.closed) {
886
- stream = void 0;
887
- return;
888
- }
889
- const wasThrottled = throttler ? throttler.clear() : false;
890
- resolve3(void 0);
891
- previous.getChildren().filter((item) => {
892
- return item !== directory && !current.has(item);
893
- }).forEach((item) => {
894
- this.fsw._remove(directory, item);
895
- });
896
- stream = void 0;
897
- if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler);
898
- });
899
- });
900
- }
901
- /**
902
- * Read directory to add / remove files from `@watched` list and re-read it on change.
903
- * @param dir fs path
904
- * @param stats
905
- * @param initialAdd
906
- * @param depth relative to user-supplied path
907
- * @param target child path targeted for watch
908
- * @param wh Common watch helpers for this path
909
- * @param realpath
910
- * @returns closer for the watcher instance.
911
- */
912
- async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath2) {
913
- const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
914
- const tracked = parentDir.has(sysPath.basename(dir));
915
- if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
916
- this.fsw._emit(EV.ADD_DIR, dir, stats);
917
- }
918
- parentDir.add(sysPath.basename(dir));
919
- this.fsw._getWatchedDir(dir);
920
- let throttler;
921
- let closer;
922
- const oDepth = this.fsw.options.depth;
923
- if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath2)) {
924
- if (!target) {
925
- await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
926
- if (this.fsw.closed) return;
927
- }
928
- closer = this._watchWithNodeFs(dir, (dirPath, stats2) => {
929
- if (stats2 && stats2.mtimeMs === 0) return;
930
- this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
931
- });
932
- }
933
- return closer;
934
- }
935
- /**
936
- * Handle added file, directory, or glob pattern.
937
- * Delegates call to _handleFile / _handleDir after checks.
938
- * @param path to file or ir
939
- * @param initialAdd was the file added at watch instantiation?
940
- * @param priorWh depth relative to user-supplied path
941
- * @param depth Child path actually targeted for watch
942
- * @param target Child path actually targeted for watch
943
- */
944
- async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
945
- const ready = this.fsw._emitReady;
946
- if (this.fsw._isIgnored(path) || this.fsw.closed) {
947
- ready();
948
- return false;
949
- }
950
- const wh = this.fsw._getWatchHelpers(path);
951
- if (priorWh) {
952
- wh.filterPath = (entry) => priorWh.filterPath(entry);
953
- wh.filterDir = (entry) => priorWh.filterDir(entry);
954
- }
955
- try {
956
- const stats = await statMethods[wh.statMethod](wh.watchPath);
957
- if (this.fsw.closed) return;
958
- if (this.fsw._isIgnored(wh.watchPath, stats)) {
959
- ready();
960
- return false;
961
- }
962
- const follow = this.fsw.options.followSymlinks;
963
- let closer;
964
- if (stats.isDirectory()) {
965
- const absPath = sysPath.resolve(path);
966
- const targetPath = follow ? await _promises.realpath.call(void 0, path) : path;
967
- if (this.fsw.closed) return;
968
- closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
969
- if (this.fsw.closed) return;
970
- if (absPath !== targetPath && targetPath !== void 0) {
971
- this.fsw._symlinkPaths.set(absPath, targetPath);
972
- }
973
- } else if (stats.isSymbolicLink()) {
974
- const targetPath = follow ? await _promises.realpath.call(void 0, path) : path;
975
- if (this.fsw.closed) return;
976
- const parent = sysPath.dirname(wh.watchPath);
977
- this.fsw._getWatchedDir(parent).add(wh.watchPath);
978
- this.fsw._emit(EV.ADD, wh.watchPath, stats);
979
- closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
980
- if (this.fsw.closed) return;
981
- if (targetPath !== void 0) {
982
- this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
983
- }
984
- } else {
985
- closer = this._handleFile(wh.watchPath, stats, initialAdd);
986
- }
987
- ready();
988
- if (closer) this.fsw._addPathCloser(path, closer);
989
- return false;
990
- } catch (error) {
991
- if (this.fsw._handleError(error)) {
992
- ready();
993
- return path;
994
- }
995
- }
996
- }
997
- };
998
-
999
- // ../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js
1000
- var SLASH = "/";
1001
- var SLASH_SLASH = "//";
1002
- var ONE_DOT = ".";
1003
- var TWO_DOTS = "..";
1004
- var STRING_TYPE = "string";
1005
- var BACK_SLASH_RE = /\\/g;
1006
- var DOUBLE_SLASH_RE = /\/\//;
1007
- var DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
1008
- var REPLACER_RE = /^\.[/\\]/;
1009
- function arrify(item) {
1010
- return Array.isArray(item) ? item : [
1011
- item
1012
- ];
1013
- }
1014
- _chunkSCFUDB74cjs.__name.call(void 0, arrify, "arrify");
1015
- var isMatcherObject = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp), "isMatcherObject");
1016
- function createPattern(matcher) {
1017
- if (typeof matcher === "function") return matcher;
1018
- if (typeof matcher === "string") return (string) => matcher === string;
1019
- if (matcher instanceof RegExp) return (string) => matcher.test(string);
1020
- if (typeof matcher === "object" && matcher !== null) {
1021
- return (string) => {
1022
- if (matcher.path === string) return true;
1023
- if (matcher.recursive) {
1024
- const relative3 = sysPath2.relative(matcher.path, string);
1025
- if (!relative3) {
1026
- return false;
1027
- }
1028
- return !relative3.startsWith("..") && !sysPath2.isAbsolute(relative3);
1029
- }
1030
- return false;
1031
- };
1032
- }
1033
- return () => false;
1034
- }
1035
- _chunkSCFUDB74cjs.__name.call(void 0, createPattern, "createPattern");
1036
- function normalizePath(path) {
1037
- if (typeof path !== "string") throw new Error("string expected");
1038
- path = sysPath2.normalize(path);
1039
- path = path.replace(/\\/g, "/");
1040
- let prepend = false;
1041
- if (path.startsWith("//")) prepend = true;
1042
- const DOUBLE_SLASH_RE2 = /\/\//;
1043
- while (path.match(DOUBLE_SLASH_RE2)) path = path.replace(DOUBLE_SLASH_RE2, "/");
1044
- if (prepend) path = "/" + path;
1045
- return path;
1046
- }
1047
- _chunkSCFUDB74cjs.__name.call(void 0, normalizePath, "normalizePath");
1048
- function matchPatterns(patterns, testString, stats) {
1049
- const path = normalizePath(testString);
1050
- for (let index = 0; index < patterns.length; index++) {
1051
- const pattern = patterns[index];
1052
- if (pattern(path, stats)) {
1053
- return true;
1054
- }
1055
- }
1056
- return false;
1057
- }
1058
- _chunkSCFUDB74cjs.__name.call(void 0, matchPatterns, "matchPatterns");
1059
- function anymatch(matchers, testString) {
1060
- if (matchers == null) {
1061
- throw new TypeError("anymatch: specify first argument");
1062
- }
1063
- const matchersArray = arrify(matchers);
1064
- const patterns = matchersArray.map((matcher) => createPattern(matcher));
1065
- if (testString == null) {
1066
- return (testString2, stats) => {
1067
- return matchPatterns(patterns, testString2, stats);
1068
- };
1069
- }
1070
- return matchPatterns(patterns, testString);
1071
- }
1072
- _chunkSCFUDB74cjs.__name.call(void 0, anymatch, "anymatch");
1073
- var unifyPaths = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (paths_) => {
1074
- const paths = arrify(paths_).flat();
1075
- if (!paths.every((p) => typeof p === STRING_TYPE)) {
1076
- throw new TypeError(`Non-string provided as watch path: ${paths}`);
1077
- }
1078
- return paths.map(normalizePathToUnix);
1079
- }, "unifyPaths");
1080
- var toUnix = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (string) => {
1081
- let str = string.replace(BACK_SLASH_RE, SLASH);
1082
- let prepend = false;
1083
- if (str.startsWith(SLASH_SLASH)) {
1084
- prepend = true;
1085
- }
1086
- while (str.match(DOUBLE_SLASH_RE)) {
1087
- str = str.replace(DOUBLE_SLASH_RE, SLASH);
1088
- }
1089
- if (prepend) {
1090
- str = SLASH + str;
1091
- }
1092
- return str;
1093
- }, "toUnix");
1094
- var normalizePathToUnix = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (path) => toUnix(sysPath2.normalize(toUnix(path))), "normalizePathToUnix");
1095
- var normalizeIgnored = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (cwd = "") => (path) => {
1096
- if (typeof path === "string") {
1097
- return normalizePathToUnix(sysPath2.isAbsolute(path) ? path : sysPath2.join(cwd, path));
1098
- } else {
1099
- return path;
1100
- }
1101
- }, "normalizeIgnored");
1102
- var getAbsolutePath = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (path, cwd) => {
1103
- if (sysPath2.isAbsolute(path)) {
1104
- return path;
1105
- }
1106
- return sysPath2.join(cwd, path);
1107
- }, "getAbsolutePath");
1108
- var EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
1109
- var DirEntry = class DirEntry2 {
1110
- static {
1111
- _chunkSCFUDB74cjs.__name.call(void 0, this, "DirEntry");
1112
- }
1113
- constructor(dir, removeWatcher) {
1114
- this.path = dir;
1115
- this._removeWatcher = removeWatcher;
1116
- this.items = /* @__PURE__ */ new Set();
1117
- }
1118
- add(item) {
1119
- const { items } = this;
1120
- if (!items) return;
1121
- if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item);
1122
- }
1123
- async remove(item) {
1124
- const { items } = this;
1125
- if (!items) return;
1126
- items.delete(item);
1127
- if (items.size > 0) return;
1128
- const dir = this.path;
1129
- try {
1130
- await _promises.readdir.call(void 0, dir);
1131
- } catch (err) {
1132
- if (this._removeWatcher) {
1133
- this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
1134
- }
1135
- }
1136
- }
1137
- has(item) {
1138
- const { items } = this;
1139
- if (!items) return;
1140
- return items.has(item);
1141
- }
1142
- getChildren() {
1143
- const { items } = this;
1144
- if (!items) return [];
1145
- return [
1146
- ...items.values()
1147
- ];
1148
- }
1149
- dispose() {
1150
- this.items.clear();
1151
- this.path = "";
1152
- this._removeWatcher = EMPTY_FN;
1153
- this.items = EMPTY_SET;
1154
- Object.freeze(this);
1155
- }
1156
- };
1157
- var STAT_METHOD_F = "stat";
1158
- var STAT_METHOD_L = "lstat";
1159
- var WatchHelper = class {
1160
- static {
1161
- _chunkSCFUDB74cjs.__name.call(void 0, this, "WatchHelper");
1162
- }
1163
- constructor(path, follow, fsw) {
1164
- this.fsw = fsw;
1165
- const watchPath = path;
1166
- this.path = path = path.replace(REPLACER_RE, "");
1167
- this.watchPath = watchPath;
1168
- this.fullWatchPath = sysPath2.resolve(watchPath);
1169
- this.dirParts = [];
1170
- this.dirParts.forEach((parts) => {
1171
- if (parts.length > 1) parts.pop();
1172
- });
1173
- this.followSymlinks = follow;
1174
- this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
1175
- }
1176
- entryPath(entry) {
1177
- return sysPath2.join(this.watchPath, sysPath2.relative(this.watchPath, entry.fullPath));
1178
- }
1179
- filterPath(entry) {
1180
- const { stats } = entry;
1181
- if (stats && stats.isSymbolicLink()) return this.filterDir(entry);
1182
- const resolvedPath = this.entryPath(entry);
1183
- return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
1184
- }
1185
- filterDir(entry) {
1186
- return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
1187
- }
1188
- };
1189
- var FSWatcher = class extends _events.EventEmitter {
1190
- static {
1191
- _chunkSCFUDB74cjs.__name.call(void 0, this, "FSWatcher");
1192
- }
1193
- // Not indenting methods for history sake; for now.
1194
- constructor(_opts = {}) {
1195
- super();
1196
- this.closed = false;
1197
- this._closers = /* @__PURE__ */ new Map();
1198
- this._ignoredPaths = /* @__PURE__ */ new Set();
1199
- this._throttled = /* @__PURE__ */ new Map();
1200
- this._streams = /* @__PURE__ */ new Set();
1201
- this._symlinkPaths = /* @__PURE__ */ new Map();
1202
- this._watched = /* @__PURE__ */ new Map();
1203
- this._pendingWrites = /* @__PURE__ */ new Map();
1204
- this._pendingUnlinks = /* @__PURE__ */ new Map();
1205
- this._readyCount = 0;
1206
- this._readyEmitted = false;
1207
- const awf = _opts.awaitWriteFinish;
1208
- const DEF_AWF = {
1209
- stabilityThreshold: 2e3,
1210
- pollInterval: 100
1211
- };
1212
- const opts = {
1213
- // Defaults
1214
- persistent: true,
1215
- ignoreInitial: false,
1216
- ignorePermissionErrors: false,
1217
- interval: 100,
1218
- binaryInterval: 300,
1219
- followSymlinks: true,
1220
- usePolling: false,
1221
- // useAsync: false,
1222
- atomic: true,
1223
- ..._opts,
1224
- // Change format
1225
- ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]),
1226
- awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === "object" ? {
1227
- ...DEF_AWF,
1228
- ...awf
1229
- } : false
1230
- };
1231
- if (isIBMi) opts.usePolling = true;
1232
- if (opts.atomic === void 0) opts.atomic = !opts.usePolling;
1233
- const envPoll = process.env.CHOKIDAR_USEPOLLING;
1234
- if (envPoll !== void 0) {
1235
- const envLower = envPoll.toLowerCase();
1236
- if (envLower === "false" || envLower === "0") opts.usePolling = false;
1237
- else if (envLower === "true" || envLower === "1") opts.usePolling = true;
1238
- else opts.usePolling = !!envLower;
1239
- }
1240
- const envInterval = process.env.CHOKIDAR_INTERVAL;
1241
- if (envInterval) opts.interval = Number.parseInt(envInterval, 10);
1242
- let readyCalls = 0;
1243
- this._emitReady = () => {
1244
- readyCalls++;
1245
- if (readyCalls >= this._readyCount) {
1246
- this._emitReady = EMPTY_FN;
1247
- this._readyEmitted = true;
1248
- process.nextTick(() => this.emit(EVENTS.READY));
1249
- }
1250
- };
1251
- this._emitRaw = (...args) => this.emit(EVENTS.RAW, ...args);
1252
- this._boundRemove = this._remove.bind(this);
1253
- this.options = opts;
1254
- this._nodeFsHandler = new NodeFsHandler(this);
1255
- Object.freeze(opts);
1256
- }
1257
- _addIgnoredPath(matcher) {
1258
- if (isMatcherObject(matcher)) {
1259
- for (const ignored of this._ignoredPaths) {
1260
- if (isMatcherObject(ignored) && ignored.path === matcher.path && ignored.recursive === matcher.recursive) {
1261
- return;
1262
- }
1263
- }
1264
- }
1265
- this._ignoredPaths.add(matcher);
1266
- }
1267
- _removeIgnoredPath(matcher) {
1268
- this._ignoredPaths.delete(matcher);
1269
- if (typeof matcher === "string") {
1270
- for (const ignored of this._ignoredPaths) {
1271
- if (isMatcherObject(ignored) && ignored.path === matcher) {
1272
- this._ignoredPaths.delete(ignored);
1273
- }
1274
- }
1275
- }
1276
- }
1277
- // Public methods
1278
- /**
1279
- * Adds paths to be watched on an existing FSWatcher instance.
1280
- * @param paths_ file or file list. Other arguments are unused
1281
- */
1282
- add(paths_, _origAdd, _internal) {
1283
- const { cwd } = this.options;
1284
- this.closed = false;
1285
- this._closePromise = void 0;
1286
- let paths = unifyPaths(paths_);
1287
- if (cwd) {
1288
- paths = paths.map((path) => {
1289
- const absPath = getAbsolutePath(path, cwd);
1290
- return absPath;
1291
- });
1292
- }
1293
- paths.forEach((path) => {
1294
- this._removeIgnoredPath(path);
1295
- });
1296
- this._userIgnored = void 0;
1297
- if (!this._readyCount) this._readyCount = 0;
1298
- this._readyCount += paths.length;
1299
- Promise.all(paths.map(async (path) => {
1300
- const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, void 0, 0, _origAdd);
1301
- if (res) this._emitReady();
1302
- return res;
1303
- })).then((results) => {
1304
- if (this.closed) return;
1305
- results.forEach((item) => {
1306
- if (item) this.add(sysPath2.dirname(item), sysPath2.basename(_origAdd || item));
1307
- });
1308
- });
1309
- return this;
1310
- }
1311
- /**
1312
- * Close watchers or start ignoring events from specified paths.
1313
- */
1314
- unwatch(paths_) {
1315
- if (this.closed) return this;
1316
- const paths = unifyPaths(paths_);
1317
- const { cwd } = this.options;
1318
- paths.forEach((path) => {
1319
- if (!sysPath2.isAbsolute(path) && !this._closers.has(path)) {
1320
- if (cwd) path = sysPath2.join(cwd, path);
1321
- path = sysPath2.resolve(path);
1322
- }
1323
- this._closePath(path);
1324
- this._addIgnoredPath(path);
1325
- if (this._watched.has(path)) {
1326
- this._addIgnoredPath({
1327
- path,
1328
- recursive: true
1329
- });
1330
- }
1331
- this._userIgnored = void 0;
1332
- });
1333
- return this;
1334
- }
1335
- /**
1336
- * Close watchers and remove all listeners from watched paths.
1337
- */
1338
- close() {
1339
- if (this._closePromise) {
1340
- return this._closePromise;
1341
- }
1342
- this.closed = true;
1343
- this.removeAllListeners();
1344
- const closers = [];
1345
- this._closers.forEach((closerList) => closerList.forEach((closer) => {
1346
- const promise = closer();
1347
- if (promise instanceof Promise) closers.push(promise);
1348
- }));
1349
- this._streams.forEach((stream) => stream.destroy());
1350
- this._userIgnored = void 0;
1351
- this._readyCount = 0;
1352
- this._readyEmitted = false;
1353
- this._watched.forEach((dirent) => dirent.dispose());
1354
- this._closers.clear();
1355
- this._watched.clear();
1356
- this._streams.clear();
1357
- this._symlinkPaths.clear();
1358
- this._throttled.clear();
1359
- this._closePromise = closers.length ? Promise.all(closers).then(() => void 0) : Promise.resolve();
1360
- return this._closePromise;
1361
- }
1362
- /**
1363
- * Expose list of watched paths
1364
- * @returns for chaining
1365
- */
1366
- getWatched() {
1367
- const watchList = {};
1368
- this._watched.forEach((entry, dir) => {
1369
- const key = this.options.cwd ? sysPath2.relative(this.options.cwd, dir) : dir;
1370
- const index = key || ONE_DOT;
1371
- watchList[index] = entry.getChildren().sort();
1372
- });
1373
- return watchList;
1374
- }
1375
- emitWithAll(event, args) {
1376
- this.emit(event, ...args);
1377
- if (event !== EVENTS.ERROR) this.emit(EVENTS.ALL, event, ...args);
1378
- }
1379
- // Common helpers
1380
- // --------------
1381
- /**
1382
- * Normalize and emit events.
1383
- * Calling _emit DOES NOT MEAN emit() would be called!
1384
- * @param event Type of event
1385
- * @param path File or directory path
1386
- * @param stats arguments to be passed with event
1387
- * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
1388
- */
1389
- async _emit(event, path, stats) {
1390
- if (this.closed) return;
1391
- const opts = this.options;
1392
- if (isWindows) path = sysPath2.normalize(path);
1393
- if (opts.cwd) path = sysPath2.relative(opts.cwd, path);
1394
- const args = [
1395
- path
1396
- ];
1397
- if (stats != null) args.push(stats);
1398
- const awf = opts.awaitWriteFinish;
1399
- let pw;
1400
- if (awf && (pw = this._pendingWrites.get(path))) {
1401
- pw.lastChange = /* @__PURE__ */ new Date();
1402
- return this;
1403
- }
1404
- if (opts.atomic) {
1405
- if (event === EVENTS.UNLINK) {
1406
- this._pendingUnlinks.set(path, [
1407
- event,
1408
- ...args
1409
- ]);
1410
- setTimeout(() => {
1411
- this._pendingUnlinks.forEach((entry, path2) => {
1412
- this.emit(...entry);
1413
- this.emit(EVENTS.ALL, ...entry);
1414
- this._pendingUnlinks.delete(path2);
1415
- });
1416
- }, typeof opts.atomic === "number" ? opts.atomic : 100);
1417
- return this;
1418
- }
1419
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path)) {
1420
- event = EVENTS.CHANGE;
1421
- this._pendingUnlinks.delete(path);
1422
- }
1423
- }
1424
- if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
1425
- const awfEmit = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, (err, stats2) => {
1426
- if (err) {
1427
- event = EVENTS.ERROR;
1428
- args[0] = err;
1429
- this.emitWithAll(event, args);
1430
- } else if (stats2) {
1431
- if (args.length > 1) {
1432
- args[1] = stats2;
1433
- } else {
1434
- args.push(stats2);
1435
- }
1436
- this.emitWithAll(event, args);
1437
- }
1438
- }, "awfEmit");
1439
- this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit);
1440
- return this;
1441
- }
1442
- if (event === EVENTS.CHANGE) {
1443
- const isThrottled = !this._throttle(EVENTS.CHANGE, path, 50);
1444
- if (isThrottled) return this;
1445
- }
1446
- if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
1447
- const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path) : path;
1448
- let stats2;
1449
- try {
1450
- stats2 = await _promises.stat.call(void 0, fullPath);
1451
- } catch (err) {
1452
- }
1453
- if (!stats2 || this.closed) return;
1454
- args.push(stats2);
1455
- }
1456
- this.emitWithAll(event, args);
1457
- return this;
1458
- }
1459
- /**
1460
- * Common handler for errors
1461
- * @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
1462
- */
1463
- _handleError(error) {
1464
- const code = error && error.code;
1465
- if (error && code !== "ENOENT" && code !== "ENOTDIR" && (!this.options.ignorePermissionErrors || code !== "EPERM" && code !== "EACCES")) {
1466
- this.emit(EVENTS.ERROR, error);
1467
- }
1468
- return error || this.closed;
1469
- }
1470
- /**
1471
- * Helper utility for throttling
1472
- * @param actionType type being throttled
1473
- * @param path being acted upon
1474
- * @param timeout duration of time to suppress duplicate actions
1475
- * @returns tracking object or false if action should be suppressed
1476
- */
1477
- _throttle(actionType, path, timeout) {
1478
- if (!this._throttled.has(actionType)) {
1479
- this._throttled.set(actionType, /* @__PURE__ */ new Map());
1480
- }
1481
- const action = this._throttled.get(actionType);
1482
- if (!action) throw new Error("invalid throttle");
1483
- const actionPath = action.get(path);
1484
- if (actionPath) {
1485
- actionPath.count++;
1486
- return false;
1487
- }
1488
- let timeoutObject;
1489
- const clear = /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, () => {
1490
- const item = action.get(path);
1491
- const count = item ? item.count : 0;
1492
- action.delete(path);
1493
- clearTimeout(timeoutObject);
1494
- if (item) clearTimeout(item.timeoutObject);
1495
- return count;
1496
- }, "clear");
1497
- timeoutObject = setTimeout(clear, timeout);
1498
- const thr = {
1499
- timeoutObject,
1500
- clear,
1501
- count: 0
1502
- };
1503
- action.set(path, thr);
1504
- return thr;
1505
- }
1506
- _incrReadyCount() {
1507
- return this._readyCount++;
1508
- }
1509
- /**
1510
- * Awaits write operation to finish.
1511
- * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
1512
- * @param path being acted upon
1513
- * @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
1514
- * @param event
1515
- * @param awfEmit Callback to be called when ready for event to be emitted.
1516
- */
1517
- _awaitWriteFinish(path, threshold, event, awfEmit) {
1518
- const awf = this.options.awaitWriteFinish;
1519
- if (typeof awf !== "object") return;
1520
- const pollInterval = awf.pollInterval;
1521
- let timeoutHandler;
1522
- let fullPath = path;
1523
- if (this.options.cwd && !sysPath2.isAbsolute(path)) {
1524
- fullPath = sysPath2.join(this.options.cwd, path);
1525
- }
1526
- const now = /* @__PURE__ */ new Date();
1527
- const writes = this._pendingWrites;
1528
- function awaitWriteFinishFn(prevStat) {
1529
- _fs.stat.call(void 0, fullPath, (err, curStat) => {
1530
- if (err || !writes.has(path)) {
1531
- if (err && err.code !== "ENOENT") awfEmit(err);
1532
- return;
1533
- }
1534
- const now2 = Number(/* @__PURE__ */ new Date());
1535
- if (prevStat && curStat.size !== prevStat.size) {
1536
- writes.get(path).lastChange = now2;
1537
- }
1538
- const pw = writes.get(path);
1539
- const df = now2 - pw.lastChange;
1540
- if (df >= threshold) {
1541
- writes.delete(path);
1542
- awfEmit(void 0, curStat);
1543
- } else {
1544
- timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
1545
- }
1546
- });
1547
- }
1548
- _chunkSCFUDB74cjs.__name.call(void 0, awaitWriteFinishFn, "awaitWriteFinishFn");
1549
- if (!writes.has(path)) {
1550
- writes.set(path, {
1551
- lastChange: now,
1552
- cancelWait: /* @__PURE__ */ _chunkSCFUDB74cjs.__name.call(void 0, () => {
1553
- writes.delete(path);
1554
- clearTimeout(timeoutHandler);
1555
- return event;
1556
- }, "cancelWait")
1557
- });
1558
- timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
1559
- }
1560
- }
1561
- /**
1562
- * Determines whether user has asked to ignore this path.
1563
- */
1564
- _isIgnored(path, stats) {
1565
- if (this.options.atomic && DOT_RE.test(path)) return true;
1566
- if (!this._userIgnored) {
1567
- const { cwd } = this.options;
1568
- const ign = this.options.ignored;
1569
- const ignored = (ign || []).map(normalizeIgnored(cwd));
1570
- const ignoredPaths = [
1571
- ...this._ignoredPaths
1572
- ];
1573
- const list = [
1574
- ...ignoredPaths.map(normalizeIgnored(cwd)),
1575
- ...ignored
1576
- ];
1577
- this._userIgnored = anymatch(list, void 0);
1578
- }
1579
- return this._userIgnored(path, stats);
1580
- }
1581
- _isntIgnored(path, stat4) {
1582
- return !this._isIgnored(path, stat4);
1583
- }
1584
- /**
1585
- * Provides a set of common helpers and properties relating to symlink handling.
1586
- * @param path file or directory pattern being watched
1587
- */
1588
- _getWatchHelpers(path) {
1589
- return new WatchHelper(path, this.options.followSymlinks, this);
1590
- }
1591
- // Directory helpers
1592
- // -----------------
1593
- /**
1594
- * Provides directory tracking objects
1595
- * @param directory path of the directory
1596
- */
1597
- _getWatchedDir(directory) {
1598
- const dir = sysPath2.resolve(directory);
1599
- if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
1600
- return this._watched.get(dir);
1601
- }
1602
- // File helpers
1603
- // ------------
1604
- /**
1605
- * Check for read permissions: https://stackoverflow.com/a/11781404/1358405
1606
- */
1607
- _hasReadPermissions(stats) {
1608
- if (this.options.ignorePermissionErrors) return true;
1609
- return Boolean(Number(stats.mode) & 256);
1610
- }
1611
- /**
1612
- * Handles emitting unlink events for
1613
- * files and directories, and via recursion, for
1614
- * files and directories within directories that are unlinked
1615
- * @param directory within which the following item is located
1616
- * @param item base path of item/directory
1617
- */
1618
- _remove(directory, item, isDirectory) {
1619
- const path = sysPath2.join(directory, item);
1620
- const fullPath = sysPath2.resolve(path);
1621
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
1622
- if (!this._throttle("remove", path, 100)) return;
1623
- if (!isDirectory && this._watched.size === 1) {
1624
- this.add(directory, item, true);
1625
- }
1626
- const wp = this._getWatchedDir(path);
1627
- const nestedDirectoryChildren = wp.getChildren();
1628
- nestedDirectoryChildren.forEach((nested) => this._remove(path, nested));
1629
- const parent = this._getWatchedDir(directory);
1630
- const wasTracked = parent.has(item);
1631
- parent.remove(item);
1632
- if (this._symlinkPaths.has(fullPath)) {
1633
- this._symlinkPaths.delete(fullPath);
1634
- }
1635
- let relPath = path;
1636
- if (this.options.cwd) relPath = sysPath2.relative(this.options.cwd, path);
1637
- if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
1638
- const event = this._pendingWrites.get(relPath).cancelWait();
1639
- if (event === EVENTS.ADD) return;
1640
- }
1641
- this._watched.delete(path);
1642
- this._watched.delete(fullPath);
1643
- const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
1644
- if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path);
1645
- this._closePath(path);
1646
- }
1647
- /**
1648
- * Closes all watchers for a path
1649
- */
1650
- _closePath(path) {
1651
- this._closeFile(path);
1652
- const dir = sysPath2.dirname(path);
1653
- this._getWatchedDir(dir).remove(sysPath2.basename(path));
1654
- }
1655
- /**
1656
- * Closes only file-specific watchers
1657
- */
1658
- _closeFile(path) {
1659
- const closers = this._closers.get(path);
1660
- if (!closers) return;
1661
- closers.forEach((closer) => closer());
1662
- this._closers.delete(path);
1663
- }
1664
- _addPathCloser(path, closer) {
1665
- if (!closer) return;
1666
- let list = this._closers.get(path);
1667
- if (!list) {
1668
- list = [];
1669
- this._closers.set(path, list);
1670
- }
1671
- list.push(closer);
1672
- }
1673
- _readdirp(root, opts) {
1674
- if (this.closed) return;
1675
- const options = {
1676
- type: EVENTS.ALL,
1677
- alwaysStat: true,
1678
- lstat: true,
1679
- ...opts,
1680
- depth: 0
1681
- };
1682
- let stream = readdirp(root, options);
1683
- this._streams.add(stream);
1684
- stream.once(STR_CLOSE, () => {
1685
- stream = void 0;
1686
- });
1687
- stream.once(STR_END, () => {
1688
- if (stream) {
1689
- this._streams.delete(stream);
1690
- stream = void 0;
1691
- }
1692
- });
1693
- return stream;
1694
- }
1695
- };
1696
- function watch(paths, options = {}) {
1697
- const watcher = new FSWatcher(options);
1698
- watcher.add(paths);
1699
- return watcher;
1700
- }
1701
- _chunkSCFUDB74cjs.__name.call(void 0, watch, "watch");
1702
- var esm_default = {
1703
- watch,
1704
- FSWatcher
1705
- };
1706
-
1707
-
1708
-
1709
-
1710
-
1711
- exports.FSWatcher = FSWatcher; exports.WatchHelper = WatchHelper; exports.default = esm_default; exports.watch = watch;
1712
- /*! Bundled license information:
1713
-
1714
- chokidar/esm/index.js:
1715
- (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
1716
- */