@bleedingdev/modern-js-utils 3.9.3-ultramodern.6 → 3.9.3-ultramodern.8
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.
- package/dist/compiled/address/provenance.json +1 -1
- package/dist/compiled/browserslist/index.js +7 -7
- package/dist/compiled/browserslist/provenance.json +1 -1
- package/dist/compiled/chalk/provenance.json +1 -1
- package/dist/compiled/chokidar/index.d.mts +18 -9
- package/dist/compiled/chokidar/index.d.ts +18 -9
- package/dist/compiled/chokidar/index.js +194 -171
- package/dist/compiled/chokidar/index.mjs +94 -71
- package/dist/compiled/chokidar/provenance.json +2 -2
- package/dist/compiled/commander/provenance.json +1 -1
- package/dist/compiled/debug/provenance.json +1 -1
- package/dist/compiled/dotenv-expand/LICENSE +11 -7
- package/dist/compiled/dotenv-expand/declaration-licenses/dotenv-expand/LICENSE +11 -7
- package/dist/compiled/dotenv-expand/index.js +5545 -61
- package/dist/compiled/dotenv-expand/licenses-cjs.txt +12 -7
- package/dist/compiled/dotenv-expand/package.json +1 -1
- package/dist/compiled/dotenv-expand/provenance.json +7 -7
- package/dist/compiled/execa/index.d.mts +67 -33
- package/dist/compiled/execa/index.d.ts +67 -33
- package/dist/compiled/execa/index.js +1848 -1369
- package/dist/compiled/execa/index.mjs +1851 -1372
- package/dist/compiled/execa/package.json +1 -1
- package/dist/compiled/execa/provenance.json +3 -3
- package/dist/compiled/filesize/index.js +26 -25
- package/dist/compiled/filesize/index.js.LICENSE.txt +1 -1
- package/dist/compiled/filesize/index.mjs +25 -24
- package/dist/compiled/filesize/index.mjs.LICENSE.txt +1 -1
- package/dist/compiled/filesize/package.json +1 -1
- package/dist/compiled/filesize/provenance.json +4 -4
- package/dist/compiled/fs-extra/provenance.json +1 -1
- package/dist/compiled/glob/provenance.json +3 -3
- package/dist/compiled/globby/index.js +431 -139
- package/dist/compiled/globby/index.mjs +576 -284
- package/dist/compiled/globby/provenance.json +1 -1
- package/dist/compiled/gzip-size/provenance.json +1 -1
- package/dist/compiled/import-lazy/provenance.json +1 -1
- package/dist/compiled/inquirer/index.d.mts +10 -0
- package/dist/compiled/inquirer/index.d.ts +10 -0
- package/dist/compiled/inquirer/index.js +112 -96
- package/dist/compiled/inquirer/index.mjs +98 -82
- package/dist/compiled/inquirer/licenses-cjs.txt +26 -0
- package/dist/compiled/inquirer/licenses-esm.txt +26 -0
- package/dist/compiled/inquirer/package.json +1 -1
- package/dist/compiled/inquirer/provenance.json +18 -18
- package/dist/compiled/js-yaml/index.js +258 -208
- package/dist/compiled/js-yaml/index.js.LICENSE.txt +1 -1
- package/dist/compiled/js-yaml/index.mjs +328 -278
- package/dist/compiled/js-yaml/index.mjs.LICENSE.txt +1 -1
- package/dist/compiled/js-yaml/package.json +1 -1
- package/dist/compiled/js-yaml/provenance.json +4 -4
- package/dist/compiled/json5/provenance.json +1 -1
- package/dist/compiled/lodash/common/function.d.ts +2 -2
- package/dist/compiled/lodash/provenance.json +2 -2
- package/dist/compiled/mime-types/provenance.json +1 -1
- package/dist/compiled/minimist/provenance.json +1 -1
- package/dist/compiled/nanoid/index.d.mts +3 -3
- package/dist/compiled/nanoid/index.d.ts +3 -3
- package/dist/compiled/nanoid/index.js +10 -10
- package/dist/compiled/nanoid/index.mjs +10 -10
- package/dist/compiled/nanoid/package.json +1 -1
- package/dist/compiled/nanoid/provenance.json +4 -4
- package/dist/compiled/ora/index.js +310 -286
- package/dist/compiled/ora/index.mjs +651 -627
- package/dist/compiled/ora/provenance.json +1 -1
- package/dist/compiled/pkg-up/provenance.json +1 -1
- package/dist/compiled/semver/provenance.json +1 -1
- package/dist/compiled/signale/provenance.json +1 -1
- package/dist/compiled/slash/provenance.json +1 -1
- package/dist/compiled/strip-ansi/index.js +1 -1
- package/dist/compiled/strip-ansi/index.mjs +3 -3
- package/dist/compiled/strip-ansi/provenance.json +1 -1
- package/dist/compiled/tsconfig-paths/provenance.json +1 -1
- package/dist/compiled/upath/provenance.json +1 -1
- package/dist/compiled/url-join/index.js +56 -29
- package/dist/compiled/url-join/index.mjs +57 -30
- package/dist/compiled/url-join/package.json +1 -1
- package/dist/compiled/url-join/provenance.json +4 -4
- package/dist/types/cli/commands.d.ts +1 -1
- package/dist/types/compiled.d.ts +7 -7
- package/package.json +8 -8
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
const i = require("node:fs");
|
|
36
36
|
const r = require("node:fs/promises");
|
|
37
37
|
const n = require("node:path");
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const o = require("node:stream");
|
|
39
|
+
const a = {
|
|
40
40
|
FILE_TYPE: "files",
|
|
41
41
|
DIR_TYPE: "directories",
|
|
42
42
|
FILE_DIR_TYPE: "files_directories",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
root: ".",
|
|
47
47
|
fileFilter: (t)=>true,
|
|
48
48
|
directoryFilter: (t)=>true,
|
|
49
|
-
type:
|
|
49
|
+
type: a.FILE_TYPE,
|
|
50
50
|
lstat: false,
|
|
51
51
|
depth: 2147483648,
|
|
52
52
|
alwaysStat: false,
|
|
53
|
-
highWaterMark:
|
|
53
|
+
highWaterMark: 256
|
|
54
54
|
};
|
|
55
55
|
Object.freeze(h);
|
|
56
56
|
const c = "READDIRP_RECURSIVE_ERROR";
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
c
|
|
63
63
|
]);
|
|
64
64
|
const d = [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
a.DIR_TYPE,
|
|
66
|
+
a.EVERYTHING_TYPE,
|
|
67
|
+
a.FILE_DIR_TYPE,
|
|
68
|
+
a.FILE_TYPE
|
|
69
69
|
];
|
|
70
70
|
const f = new Set([
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
a.DIR_TYPE,
|
|
72
|
+
a.EVERYTHING_TYPE,
|
|
73
|
+
a.FILE_DIR_TYPE
|
|
74
74
|
]);
|
|
75
75
|
const u = new Set([
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
a.EVERYTHING_TYPE,
|
|
77
|
+
a.FILE_DIR_TYPE,
|
|
78
|
+
a.FILE_TYPE
|
|
79
79
|
]);
|
|
80
80
|
const isNormalFlowError = (t)=>l.has(t.code);
|
|
81
81
|
const p = "win32" === process.platform;
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
}
|
|
94
94
|
return emptyFn;
|
|
95
95
|
};
|
|
96
|
-
class ReaddirpStream extends
|
|
96
|
+
class ReaddirpStream extends o.Readable {
|
|
97
97
|
parents;
|
|
98
98
|
reading;
|
|
99
99
|
parent;
|
|
@@ -108,37 +108,45 @@
|
|
|
108
108
|
_rdOptions;
|
|
109
109
|
_fileFilter;
|
|
110
110
|
_directoryFilter;
|
|
111
|
+
_relStart;
|
|
111
112
|
constructor(t = {}){
|
|
112
113
|
super({
|
|
113
114
|
objectMode: true,
|
|
114
115
|
autoDestroy: true,
|
|
115
|
-
highWaterMark: t.highWaterMark
|
|
116
|
+
highWaterMark: t.highWaterMark ?? h.highWaterMark
|
|
116
117
|
});
|
|
117
118
|
const e = {
|
|
118
119
|
...h,
|
|
119
120
|
...t
|
|
120
121
|
};
|
|
121
|
-
const
|
|
122
|
+
const s = e.root ?? h.root;
|
|
123
|
+
const i = e.type ?? h.type;
|
|
122
124
|
this._fileFilter = normalizeFilter(e.fileFilter);
|
|
123
125
|
this._directoryFilter = normalizeFilter(e.directoryFilter);
|
|
124
|
-
const
|
|
125
|
-
if (p) this._stat = (t)=>
|
|
126
|
+
const o = e.lstat ? r.lstat : r.stat;
|
|
127
|
+
if (p) this._stat = (t)=>o(t, {
|
|
126
128
|
bigint: true
|
|
127
129
|
});
|
|
128
|
-
else this._stat =
|
|
130
|
+
else this._stat = o;
|
|
129
131
|
this._maxDepth = null != e.depth && Number.isSafeInteger(e.depth) ? e.depth : h.depth;
|
|
130
|
-
this._wantsDir =
|
|
131
|
-
this._wantsFile =
|
|
132
|
-
this._wantsEverything = i ===
|
|
132
|
+
this._wantsDir = f.has(i);
|
|
133
|
+
this._wantsFile = u.has(i);
|
|
134
|
+
this._wantsEverything = i === a.EVERYTHING_TYPE;
|
|
133
135
|
this._root = (0, n.resolve)(s);
|
|
136
|
+
this._relStart = this._root.endsWith(n.sep) ? this._root.length : this._root.length + 1;
|
|
134
137
|
this._isDirent = !e.alwaysStat;
|
|
135
138
|
this._statsProp = this._isDirent ? "dirent" : "stats";
|
|
136
139
|
this._rdOptions = {
|
|
137
140
|
encoding: "utf8",
|
|
138
141
|
withFileTypes: this._isDirent
|
|
139
142
|
};
|
|
143
|
+
const c = {
|
|
144
|
+
path: this._root,
|
|
145
|
+
depth: 1
|
|
146
|
+
};
|
|
147
|
+
c.pending = this._exploreDir(this._root, 1);
|
|
140
148
|
this.parents = [
|
|
141
|
-
|
|
149
|
+
c
|
|
142
150
|
];
|
|
143
151
|
this.reading = false;
|
|
144
152
|
this.parent = void 0;
|
|
@@ -153,13 +161,17 @@
|
|
|
153
161
|
if (s && s.length > 0) {
|
|
154
162
|
const { path: i, depth: r } = e;
|
|
155
163
|
const n = s.splice(0, t).map((t)=>this._formatEntry(t, i));
|
|
156
|
-
const
|
|
157
|
-
for (const e of
|
|
164
|
+
const o = this._isDirent ? n : await Promise.all(n);
|
|
165
|
+
for (const e of o){
|
|
158
166
|
if (!e) continue;
|
|
159
167
|
if (this.destroyed) return;
|
|
160
|
-
|
|
168
|
+
let s = this._getEntryType(e);
|
|
169
|
+
if ("string" != typeof s) s = await s;
|
|
161
170
|
if ("directory" === s && this._directoryFilter(e)) {
|
|
162
|
-
if (r <= this._maxDepth) this.parents.push(
|
|
171
|
+
if (r <= this._maxDepth) this.parents.push({
|
|
172
|
+
path: e.fullPath,
|
|
173
|
+
depth: r + 1
|
|
174
|
+
});
|
|
163
175
|
if (this._wantsDir) {
|
|
164
176
|
this.push(e);
|
|
165
177
|
t--;
|
|
@@ -177,7 +189,10 @@
|
|
|
177
189
|
this.push(null);
|
|
178
190
|
break;
|
|
179
191
|
}
|
|
180
|
-
|
|
192
|
+
const e = t.pending ?? this._exploreDir(t.path, t.depth);
|
|
193
|
+
const s = this.parents[this.parents.length - 1];
|
|
194
|
+
if (s && !s.pending) s.pending = this._exploreDir(s.path, s.depth);
|
|
195
|
+
this.parent = await e;
|
|
181
196
|
if (this.destroyed) return;
|
|
182
197
|
}
|
|
183
198
|
}
|
|
@@ -200,52 +215,57 @@
|
|
|
200
215
|
path: t
|
|
201
216
|
};
|
|
202
217
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const i =
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
} catch (t) {
|
|
215
|
-
this._onError(t);
|
|
216
|
-
return;
|
|
218
|
+
_formatEntry(t, e) {
|
|
219
|
+
const s = this._isDirent ? t.name : t;
|
|
220
|
+
const i = (0, n.join)(e, s);
|
|
221
|
+
const r = {
|
|
222
|
+
path: i.slice(this._relStart),
|
|
223
|
+
fullPath: i,
|
|
224
|
+
basename: s
|
|
225
|
+
};
|
|
226
|
+
if (this._isDirent) {
|
|
227
|
+
r.dirent = t;
|
|
228
|
+
return r;
|
|
217
229
|
}
|
|
218
|
-
return
|
|
230
|
+
return this._stat(i).then((t)=>{
|
|
231
|
+
r.stats = t;
|
|
232
|
+
return r;
|
|
233
|
+
}, (t)=>{
|
|
234
|
+
this._onError(t);
|
|
235
|
+
});
|
|
219
236
|
}
|
|
220
237
|
_onError(t) {
|
|
221
238
|
if (isNormalFlowError(t) && !this.destroyed) this.emit("warn", t);
|
|
222
239
|
else this.destroy(t);
|
|
223
240
|
}
|
|
224
|
-
|
|
225
|
-
if (!t
|
|
241
|
+
_getEntryType(t) {
|
|
242
|
+
if (!t || !(this._statsProp in t)) return "";
|
|
226
243
|
const e = t[this._statsProp];
|
|
227
244
|
if (e.isFile()) return "file";
|
|
228
245
|
if (e.isDirectory()) return "directory";
|
|
229
|
-
if (e
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
246
|
+
if (e.isSymbolicLink()) return this._getSymlinkEntryType(t);
|
|
247
|
+
return "";
|
|
248
|
+
}
|
|
249
|
+
async _getSymlinkEntryType(t) {
|
|
250
|
+
const e = t.fullPath;
|
|
251
|
+
try {
|
|
252
|
+
const t = await (0, r.realpath)(e);
|
|
253
|
+
const s = await (0, r.lstat)(t);
|
|
254
|
+
if (s.isFile()) return "file";
|
|
255
|
+
if (s.isDirectory()) {
|
|
256
|
+
const s = t.length;
|
|
257
|
+
if (e.startsWith(t) && e[s] === n.sep) {
|
|
258
|
+
const s = new Error(`Circular symlink detected: "${e}" points to "${t}"`);
|
|
259
|
+
s.code = c;
|
|
260
|
+
this._onError(s);
|
|
261
|
+
return "";
|
|
243
262
|
}
|
|
244
|
-
|
|
245
|
-
this._onError(t);
|
|
246
|
-
return "";
|
|
263
|
+
return "directory";
|
|
247
264
|
}
|
|
265
|
+
} catch (t) {
|
|
266
|
+
this._onError(t);
|
|
248
267
|
}
|
|
268
|
+
return "";
|
|
249
269
|
}
|
|
250
270
|
_includeAsFile(t) {
|
|
251
271
|
const e = t && t[this._statsProp];
|
|
@@ -254,14 +274,17 @@
|
|
|
254
274
|
}
|
|
255
275
|
function readdirp(t, e = {}) {
|
|
256
276
|
let s = e.entryType || e.type;
|
|
257
|
-
if ("both" === s) s =
|
|
258
|
-
if (s) e.type = s;
|
|
277
|
+
if ("both" === s) s = a.FILE_DIR_TYPE;
|
|
259
278
|
if (t) {
|
|
260
279
|
if ("string" != typeof t) throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
|
|
261
280
|
else if (s && !d.includes(s)) throw new Error(`readdirp: Invalid type passed. Use one of ${d.join(", ")}`);
|
|
262
281
|
} else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
|
|
263
|
-
|
|
264
|
-
|
|
282
|
+
const i = {
|
|
283
|
+
...e,
|
|
284
|
+
root: t
|
|
285
|
+
};
|
|
286
|
+
if (s) i.type = s;
|
|
287
|
+
return new ReaddirpStream(i);
|
|
265
288
|
}
|
|
266
289
|
const m = require("node:os");
|
|
267
290
|
const w = "data";
|
|
@@ -287,17 +310,17 @@
|
|
|
287
310
|
};
|
|
288
311
|
const F = I;
|
|
289
312
|
const W = "watch";
|
|
290
|
-
const
|
|
313
|
+
const S = {
|
|
291
314
|
lstat: r.lstat,
|
|
292
315
|
stat: r.stat
|
|
293
316
|
};
|
|
294
317
|
const k = "listeners";
|
|
295
|
-
const
|
|
296
|
-
const
|
|
318
|
+
const x = "errHandlers";
|
|
319
|
+
const A = "rawEmitters";
|
|
297
320
|
const T = [
|
|
298
321
|
k,
|
|
299
|
-
|
|
300
|
-
|
|
322
|
+
x,
|
|
323
|
+
A
|
|
301
324
|
];
|
|
302
325
|
const N = new Set([
|
|
303
326
|
"3dm",
|
|
@@ -586,10 +609,10 @@
|
|
|
586
609
|
};
|
|
587
610
|
const isEmptySet = (t)=>t instanceof Set ? 0 === t.size : !t;
|
|
588
611
|
const C = new Map;
|
|
589
|
-
function createFsWatchInstance(t, e, s, r,
|
|
612
|
+
function createFsWatchInstance(t, e, s, r, o) {
|
|
590
613
|
const handleEvent = (e, i)=>{
|
|
591
614
|
s(t);
|
|
592
|
-
|
|
615
|
+
o(e, i, {
|
|
593
616
|
watchedPath: t
|
|
594
617
|
});
|
|
595
618
|
if (i && t !== i) fsWatchBroadcast(n.resolve(t, i), k, n.join(t, i));
|
|
@@ -611,23 +634,23 @@
|
|
|
611
634
|
});
|
|
612
635
|
};
|
|
613
636
|
const setFsWatchListener = (t, e, s, i)=>{
|
|
614
|
-
const { listener: n, errHandler:
|
|
637
|
+
const { listener: n, errHandler: o, rawEmitter: a } = i;
|
|
615
638
|
let h = C.get(e);
|
|
616
639
|
let c;
|
|
617
640
|
if (!s.persistent) {
|
|
618
|
-
c = createFsWatchInstance(t, s, n,
|
|
641
|
+
c = createFsWatchInstance(t, s, n, o, a);
|
|
619
642
|
if (!c) return;
|
|
620
643
|
return c.close.bind(c);
|
|
621
644
|
}
|
|
622
645
|
if (h) {
|
|
623
646
|
addAndConvert(h, k, n);
|
|
647
|
+
addAndConvert(h, x, o);
|
|
624
648
|
addAndConvert(h, A, a);
|
|
625
|
-
addAndConvert(h, S, o);
|
|
626
649
|
} else {
|
|
627
|
-
c = createFsWatchInstance(t, s, fsWatchBroadcast.bind(null, e, k),
|
|
650
|
+
c = createFsWatchInstance(t, s, fsWatchBroadcast.bind(null, e, k), o, fsWatchBroadcast.bind(null, e, A));
|
|
628
651
|
if (!c) return;
|
|
629
652
|
c.on(F.ERROR, async (s)=>{
|
|
630
|
-
const i = fsWatchBroadcast.bind(null, e,
|
|
653
|
+
const i = fsWatchBroadcast.bind(null, e, x);
|
|
631
654
|
if (h) h.watcherUnusable = true;
|
|
632
655
|
if (P && "EPERM" === s.code) try {
|
|
633
656
|
const e = await (0, r.open)(t, "r");
|
|
@@ -638,16 +661,16 @@
|
|
|
638
661
|
});
|
|
639
662
|
h = {
|
|
640
663
|
listeners: n,
|
|
641
|
-
errHandlers:
|
|
642
|
-
rawEmitters:
|
|
664
|
+
errHandlers: o,
|
|
665
|
+
rawEmitters: a,
|
|
643
666
|
watcher: c
|
|
644
667
|
};
|
|
645
668
|
C.set(e, h);
|
|
646
669
|
}
|
|
647
670
|
return ()=>{
|
|
648
671
|
delFromSet(h, k, n);
|
|
672
|
+
delFromSet(h, x, o);
|
|
649
673
|
delFromSet(h, A, a);
|
|
650
|
-
delFromSet(h, S, o);
|
|
651
674
|
if (isEmptySet(h.listeners)) {
|
|
652
675
|
h.watcher.close();
|
|
653
676
|
C.delete(e);
|
|
@@ -659,42 +682,42 @@
|
|
|
659
682
|
};
|
|
660
683
|
const j = new Map;
|
|
661
684
|
const setFsWatchFileListener = (t, e, s, r)=>{
|
|
662
|
-
const { listener: n, rawEmitter:
|
|
663
|
-
let
|
|
664
|
-
const h =
|
|
685
|
+
const { listener: n, rawEmitter: o } = r;
|
|
686
|
+
let a = j.get(e);
|
|
687
|
+
const h = a && a.options;
|
|
665
688
|
if (h && (h.persistent < s.persistent || h.interval > s.interval)) {
|
|
666
689
|
(0, i.unwatchFile)(e);
|
|
667
|
-
|
|
690
|
+
a = void 0;
|
|
668
691
|
}
|
|
669
|
-
if (
|
|
670
|
-
addAndConvert(
|
|
671
|
-
addAndConvert(
|
|
692
|
+
if (a) {
|
|
693
|
+
addAndConvert(a, k, n);
|
|
694
|
+
addAndConvert(a, A, o);
|
|
672
695
|
} else {
|
|
673
|
-
|
|
696
|
+
a = {
|
|
674
697
|
listeners: n,
|
|
675
|
-
rawEmitters:
|
|
698
|
+
rawEmitters: o,
|
|
676
699
|
options: s,
|
|
677
700
|
watcher: (0, i.watchFile)(e, s, (s, i)=>{
|
|
678
|
-
foreach(
|
|
701
|
+
foreach(a.rawEmitters, (t)=>{
|
|
679
702
|
t(F.CHANGE, e, {
|
|
680
703
|
curr: s,
|
|
681
704
|
prev: i
|
|
682
705
|
});
|
|
683
706
|
});
|
|
684
707
|
const r = s.mtimeMs;
|
|
685
|
-
if (s.size !== i.size || r > i.mtimeMs || 0 === r) foreach(
|
|
708
|
+
if (s.size !== i.size || r > i.mtimeMs || 0 === r) foreach(a.listeners, (e)=>e(t, s));
|
|
686
709
|
})
|
|
687
710
|
};
|
|
688
|
-
j.set(e,
|
|
711
|
+
j.set(e, a);
|
|
689
712
|
}
|
|
690
713
|
return ()=>{
|
|
691
|
-
delFromSet(
|
|
692
|
-
delFromSet(
|
|
693
|
-
if (isEmptySet(
|
|
714
|
+
delFromSet(a, k, n);
|
|
715
|
+
delFromSet(a, A, o);
|
|
716
|
+
if (isEmptySet(a.listeners)) {
|
|
694
717
|
j.delete(e);
|
|
695
718
|
(0, i.unwatchFile)(e);
|
|
696
|
-
|
|
697
|
-
Object.freeze(
|
|
719
|
+
a.options = a.watcher = void 0;
|
|
720
|
+
Object.freeze(a);
|
|
698
721
|
}
|
|
699
722
|
};
|
|
700
723
|
};
|
|
@@ -709,9 +732,9 @@
|
|
|
709
732
|
const s = this.fsw.options;
|
|
710
733
|
const i = n.dirname(t);
|
|
711
734
|
const r = n.basename(t);
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
const
|
|
735
|
+
const o = this.fsw._getWatchedDir(i);
|
|
736
|
+
o.add(r);
|
|
737
|
+
const a = n.resolve(t);
|
|
715
738
|
const h = {
|
|
716
739
|
persistent: s.persistent
|
|
717
740
|
};
|
|
@@ -720,11 +743,11 @@
|
|
|
720
743
|
if (s.usePolling) {
|
|
721
744
|
const i = s.interval !== s.binaryInterval;
|
|
722
745
|
h.interval = i && isBinaryPath(r) ? s.binaryInterval : s.interval;
|
|
723
|
-
c = setFsWatchFileListener(t,
|
|
746
|
+
c = setFsWatchFileListener(t, a, h, {
|
|
724
747
|
listener: e,
|
|
725
748
|
rawEmitter: this.fsw._emitRaw
|
|
726
749
|
});
|
|
727
|
-
} else c = setFsWatchListener(t,
|
|
750
|
+
} else c = setFsWatchListener(t, a, h, {
|
|
728
751
|
listener: e,
|
|
729
752
|
errHandler: this._boundHandleError,
|
|
730
753
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -734,14 +757,14 @@
|
|
|
734
757
|
_handleFile(t, e, s) {
|
|
735
758
|
if (this.fsw.closed) return;
|
|
736
759
|
const i = n.dirname(t);
|
|
737
|
-
const
|
|
738
|
-
const
|
|
760
|
+
const o = n.basename(t);
|
|
761
|
+
const a = this.fsw._getWatchedDir(i);
|
|
739
762
|
let h = e;
|
|
740
|
-
if (
|
|
763
|
+
if (a.has(o)) return;
|
|
741
764
|
const listener = async (e, s)=>{
|
|
742
765
|
if (!this.fsw._throttle(W, t, 5)) return;
|
|
743
766
|
if (s && 0 !== s.mtimeMs) {
|
|
744
|
-
if (
|
|
767
|
+
if (a.has(o)) {
|
|
745
768
|
const e = s.atimeMs;
|
|
746
769
|
const i = s.mtimeMs;
|
|
747
770
|
if (!e || e <= i || i !== h.mtimeMs) this.fsw._emit(F.CHANGE, t, s);
|
|
@@ -760,7 +783,7 @@
|
|
|
760
783
|
if (i) this.fsw._addPathCloser(e, i);
|
|
761
784
|
} else h = s;
|
|
762
785
|
} catch (t) {
|
|
763
|
-
this.fsw._remove(i,
|
|
786
|
+
this.fsw._remove(i, o);
|
|
764
787
|
}
|
|
765
788
|
};
|
|
766
789
|
const c = this._watchWithNodeFs(t, listener);
|
|
@@ -773,7 +796,7 @@
|
|
|
773
796
|
async _handleSymlink(t, e, s, i) {
|
|
774
797
|
if (this.fsw.closed) return;
|
|
775
798
|
const n = t.fullPath;
|
|
776
|
-
const
|
|
799
|
+
const o = this.fsw._getWatchedDir(e);
|
|
777
800
|
if (!this.fsw.options.followSymlinks) {
|
|
778
801
|
this.fsw._incrReadyCount();
|
|
779
802
|
let e;
|
|
@@ -784,13 +807,13 @@
|
|
|
784
807
|
return true;
|
|
785
808
|
}
|
|
786
809
|
if (this.fsw.closed) return;
|
|
787
|
-
if (
|
|
810
|
+
if (o.has(i)) {
|
|
788
811
|
if (this.fsw._symlinkPaths.get(n) !== e) {
|
|
789
812
|
this.fsw._symlinkPaths.set(n, e);
|
|
790
813
|
this.fsw._emit(F.CHANGE, s, t.stats);
|
|
791
814
|
}
|
|
792
815
|
} else {
|
|
793
|
-
|
|
816
|
+
o.add(i);
|
|
794
817
|
this.fsw._symlinkPaths.set(n, e);
|
|
795
818
|
this.fsw._emit(F.ADD, s, t.stats);
|
|
796
819
|
}
|
|
@@ -800,11 +823,11 @@
|
|
|
800
823
|
if (this.fsw._symlinkPaths.has(n)) return true;
|
|
801
824
|
this.fsw._symlinkPaths.set(n, true);
|
|
802
825
|
}
|
|
803
|
-
_handleRead(t, e, s, i, r,
|
|
826
|
+
_handleRead(t, e, s, i, r, o, a) {
|
|
804
827
|
t = n.join(t, "");
|
|
805
828
|
const h = i ? `${t}:${i}` : t;
|
|
806
|
-
|
|
807
|
-
if (!
|
|
829
|
+
a = this.fsw._throttle("readdir", h, 1e3);
|
|
830
|
+
if (!a) return;
|
|
808
831
|
const c = this.fsw._getWatchedDir(s.path);
|
|
809
832
|
const l = new Set;
|
|
810
833
|
let d = this.fsw._readdirp(t, {
|
|
@@ -812,15 +835,15 @@
|
|
|
812
835
|
directoryFilter: (t)=>s.filterDir(t)
|
|
813
836
|
});
|
|
814
837
|
if (!d) return;
|
|
815
|
-
d.on(w, async (
|
|
838
|
+
d.on(w, async (a)=>{
|
|
816
839
|
if (this.fsw.closed) {
|
|
817
840
|
d = void 0;
|
|
818
841
|
return;
|
|
819
842
|
}
|
|
820
|
-
const h =
|
|
843
|
+
const h = a.path;
|
|
821
844
|
let f = n.join(t, h);
|
|
822
845
|
l.add(h);
|
|
823
|
-
if (
|
|
846
|
+
if (a.stats.isSymbolicLink() && await this._handleSymlink(a, t, f, h)) return;
|
|
824
847
|
if (this.fsw.closed) {
|
|
825
848
|
d = void 0;
|
|
826
849
|
return;
|
|
@@ -828,7 +851,7 @@
|
|
|
828
851
|
if (h === i || !i && !c.has(h)) {
|
|
829
852
|
this.fsw._incrReadyCount();
|
|
830
853
|
f = n.join(r, n.relative(r, f));
|
|
831
|
-
this._addToNodeFs(f, e, s,
|
|
854
|
+
this._addToNodeFs(f, e, s, o + 1);
|
|
832
855
|
}
|
|
833
856
|
}).on(F.ERROR, this._boundHandleError);
|
|
834
857
|
return new Promise((e, n)=>{
|
|
@@ -838,17 +861,17 @@
|
|
|
838
861
|
d = void 0;
|
|
839
862
|
return;
|
|
840
863
|
}
|
|
841
|
-
const n =
|
|
864
|
+
const n = a ? a.clear() : false;
|
|
842
865
|
e(void 0);
|
|
843
866
|
c.getChildren().filter((e)=>e !== t && !l.has(e)).forEach((e)=>{
|
|
844
867
|
this.fsw._remove(t, e);
|
|
845
868
|
});
|
|
846
869
|
d = void 0;
|
|
847
|
-
if (n) this._handleRead(t, false, s, i, r,
|
|
870
|
+
if (n) this._handleRead(t, false, s, i, r, o, a);
|
|
848
871
|
});
|
|
849
872
|
});
|
|
850
873
|
}
|
|
851
|
-
async _handleDir(t, e, s, i, r,
|
|
874
|
+
async _handleDir(t, e, s, i, r, o, a) {
|
|
852
875
|
const h = this.fsw._getWatchedDir(n.dirname(t));
|
|
853
876
|
const c = h.has(n.basename(t));
|
|
854
877
|
if (!(s && this.fsw.options.ignoreInitial) && !r && !c) this.fsw._emit(F.ADD_DIR, t, e);
|
|
@@ -857,22 +880,22 @@
|
|
|
857
880
|
let l;
|
|
858
881
|
let d;
|
|
859
882
|
const f = this.fsw.options.depth;
|
|
860
|
-
if ((null == f || i <= f) && !this.fsw._symlinkPaths.has(
|
|
883
|
+
if ((null == f || i <= f) && !this.fsw._symlinkPaths.has(a)) {
|
|
861
884
|
if (!r) {
|
|
862
|
-
await this._handleRead(t, s,
|
|
885
|
+
await this._handleRead(t, s, o, r, t, i, l);
|
|
863
886
|
if (this.fsw.closed) return;
|
|
864
887
|
}
|
|
865
888
|
d = this._watchWithNodeFs(t, (e, s)=>{
|
|
866
889
|
if (s && 0 === s.mtimeMs) return;
|
|
867
|
-
this._handleRead(e, false,
|
|
890
|
+
this._handleRead(e, false, o, r, t, i, l);
|
|
868
891
|
});
|
|
869
892
|
}
|
|
870
893
|
return d;
|
|
871
894
|
}
|
|
872
|
-
async _addToNodeFs(t, e, s, i,
|
|
873
|
-
const
|
|
895
|
+
async _addToNodeFs(t, e, s, i, o) {
|
|
896
|
+
const a = this.fsw._emitReady;
|
|
874
897
|
if (this.fsw._isIgnored(t) || this.fsw.closed) {
|
|
875
|
-
|
|
898
|
+
a();
|
|
876
899
|
return false;
|
|
877
900
|
}
|
|
878
901
|
const h = this.fsw._getWatchHelpers(t);
|
|
@@ -881,37 +904,37 @@
|
|
|
881
904
|
h.filterDir = (t)=>s.filterDir(t);
|
|
882
905
|
}
|
|
883
906
|
try {
|
|
884
|
-
const s = await
|
|
907
|
+
const s = await S[h.statMethod](h.watchPath);
|
|
885
908
|
if (this.fsw.closed) return;
|
|
886
909
|
if (this.fsw._isIgnored(h.watchPath, s)) {
|
|
887
|
-
|
|
910
|
+
a();
|
|
888
911
|
return false;
|
|
889
912
|
}
|
|
890
913
|
const c = this.fsw.options.followSymlinks;
|
|
891
914
|
let l;
|
|
892
915
|
if (s.isDirectory()) {
|
|
893
|
-
const
|
|
916
|
+
const a = n.resolve(t);
|
|
894
917
|
const d = c ? await (0, r.realpath)(t) : t;
|
|
895
918
|
if (this.fsw.closed) return;
|
|
896
|
-
l = await this._handleDir(h.watchPath, s, e, i,
|
|
919
|
+
l = await this._handleDir(h.watchPath, s, e, i, o, h, d);
|
|
897
920
|
if (this.fsw.closed) return;
|
|
898
|
-
if (
|
|
921
|
+
if (a !== d && void 0 !== d) this.fsw._symlinkPaths.set(a, d);
|
|
899
922
|
} else if (s.isSymbolicLink()) {
|
|
900
|
-
const
|
|
923
|
+
const o = c ? await (0, r.realpath)(t) : t;
|
|
901
924
|
if (this.fsw.closed) return;
|
|
902
|
-
const
|
|
903
|
-
this.fsw._getWatchedDir(
|
|
925
|
+
const a = n.dirname(h.watchPath);
|
|
926
|
+
this.fsw._getWatchedDir(a).add(h.watchPath);
|
|
904
927
|
this.fsw._emit(F.ADD, h.watchPath, s);
|
|
905
|
-
l = await this._handleDir(
|
|
928
|
+
l = await this._handleDir(a, s, e, i, t, h, o);
|
|
906
929
|
if (this.fsw.closed) return;
|
|
907
|
-
if (void 0 !==
|
|
930
|
+
if (void 0 !== o) this.fsw._symlinkPaths.set(n.resolve(t), o);
|
|
908
931
|
} else l = this._handleFile(h.watchPath, s, e);
|
|
909
|
-
|
|
932
|
+
a();
|
|
910
933
|
if (l) this.fsw._addPathCloser(t, l);
|
|
911
934
|
return false;
|
|
912
935
|
} catch (e) {
|
|
913
936
|
if (this.fsw._handleError(e)) {
|
|
914
|
-
|
|
937
|
+
a();
|
|
915
938
|
return t;
|
|
916
939
|
}
|
|
917
940
|
}
|
|
@@ -1141,10 +1164,10 @@
|
|
|
1141
1164
|
}
|
|
1142
1165
|
const n = process.env.CHOKIDAR_INTERVAL;
|
|
1143
1166
|
if (n) i.interval = Number.parseInt(n, 10);
|
|
1144
|
-
let
|
|
1167
|
+
let o = 0;
|
|
1145
1168
|
this._emitReady = ()=>{
|
|
1146
|
-
|
|
1147
|
-
if (
|
|
1169
|
+
o++;
|
|
1170
|
+
if (o >= this._readyCount) {
|
|
1148
1171
|
this._emitReady = EMPTY_FN;
|
|
1149
1172
|
this._readyEmitted = true;
|
|
1150
1173
|
process.nextTick(()=>this.emit(I.READY));
|
|
@@ -1254,13 +1277,13 @@
|
|
|
1254
1277
|
const i = this.options;
|
|
1255
1278
|
if (P) e = n.normalize(e);
|
|
1256
1279
|
if (i.cwd) e = n.relative(i.cwd, e);
|
|
1257
|
-
const
|
|
1280
|
+
const o = [
|
|
1258
1281
|
e
|
|
1259
1282
|
];
|
|
1260
|
-
if (null != s)
|
|
1261
|
-
const
|
|
1283
|
+
if (null != s) o.push(s);
|
|
1284
|
+
const a = i.awaitWriteFinish;
|
|
1262
1285
|
let h;
|
|
1263
|
-
if (
|
|
1286
|
+
if (a && (h = this._pendingWrites.get(e))) {
|
|
1264
1287
|
h.lastChange = new Date;
|
|
1265
1288
|
return this;
|
|
1266
1289
|
}
|
|
@@ -1268,7 +1291,7 @@
|
|
|
1268
1291
|
if (t === I.UNLINK) {
|
|
1269
1292
|
this._pendingUnlinks.set(e, [
|
|
1270
1293
|
t,
|
|
1271
|
-
...
|
|
1294
|
+
...o
|
|
1272
1295
|
]);
|
|
1273
1296
|
setTimeout(()=>{
|
|
1274
1297
|
this._pendingUnlinks.forEach((t, e)=>{
|
|
@@ -1284,19 +1307,19 @@
|
|
|
1284
1307
|
this._pendingUnlinks.delete(e);
|
|
1285
1308
|
}
|
|
1286
1309
|
}
|
|
1287
|
-
if (
|
|
1310
|
+
if (a && (t === I.ADD || t === I.CHANGE) && this._readyEmitted) {
|
|
1288
1311
|
const awfEmit = (e, s)=>{
|
|
1289
1312
|
if (e) {
|
|
1290
1313
|
t = I.ERROR;
|
|
1291
|
-
|
|
1292
|
-
this.emitWithAll(t,
|
|
1314
|
+
o[0] = e;
|
|
1315
|
+
this.emitWithAll(t, o);
|
|
1293
1316
|
} else if (s) {
|
|
1294
|
-
if (
|
|
1295
|
-
else
|
|
1296
|
-
this.emitWithAll(t,
|
|
1317
|
+
if (o.length > 1) o[1] = s;
|
|
1318
|
+
else o.push(s);
|
|
1319
|
+
this.emitWithAll(t, o);
|
|
1297
1320
|
}
|
|
1298
1321
|
};
|
|
1299
|
-
this._awaitWriteFinish(e,
|
|
1322
|
+
this._awaitWriteFinish(e, a.stabilityThreshold, t, awfEmit);
|
|
1300
1323
|
return this;
|
|
1301
1324
|
}
|
|
1302
1325
|
if (t === I.CHANGE) {
|
|
@@ -1310,9 +1333,9 @@
|
|
|
1310
1333
|
s = await (0, r.stat)(t);
|
|
1311
1334
|
} catch (t) {}
|
|
1312
1335
|
if (!s || this.closed) return;
|
|
1313
|
-
|
|
1336
|
+
o.push(s);
|
|
1314
1337
|
}
|
|
1315
|
-
this.emitWithAll(t,
|
|
1338
|
+
this.emitWithAll(t, o);
|
|
1316
1339
|
return this;
|
|
1317
1340
|
}
|
|
1318
1341
|
_handleError(t) {
|
|
@@ -1339,21 +1362,21 @@
|
|
|
1339
1362
|
return s;
|
|
1340
1363
|
};
|
|
1341
1364
|
n = setTimeout(clear, s);
|
|
1342
|
-
const
|
|
1365
|
+
const o = {
|
|
1343
1366
|
timeoutObject: n,
|
|
1344
1367
|
clear: clear,
|
|
1345
1368
|
count: 0
|
|
1346
1369
|
};
|
|
1347
|
-
i.set(e,
|
|
1348
|
-
return
|
|
1370
|
+
i.set(e, o);
|
|
1371
|
+
return o;
|
|
1349
1372
|
}
|
|
1350
1373
|
_incrReadyCount() {
|
|
1351
1374
|
return this._readyCount++;
|
|
1352
1375
|
}
|
|
1353
1376
|
_awaitWriteFinish(t, e, s, r) {
|
|
1354
|
-
const
|
|
1355
|
-
if ("object" != typeof
|
|
1356
|
-
const
|
|
1377
|
+
const o = this.options.awaitWriteFinish;
|
|
1378
|
+
if ("object" != typeof o) return;
|
|
1379
|
+
const a = o.pollInterval;
|
|
1357
1380
|
let h;
|
|
1358
1381
|
let c = t;
|
|
1359
1382
|
if (this.options.cwd && !n.isAbsolute(t)) c = n.join(this.options.cwd, t);
|
|
@@ -1365,14 +1388,14 @@
|
|
|
1365
1388
|
if (i && "ENOENT" !== i.code) r(i);
|
|
1366
1389
|
return;
|
|
1367
1390
|
}
|
|
1368
|
-
const
|
|
1369
|
-
if (s && n.size !== s.size) d.get(t).lastChange =
|
|
1391
|
+
const o = Number(new Date);
|
|
1392
|
+
if (s && n.size !== s.size) d.get(t).lastChange = o;
|
|
1370
1393
|
const c = d.get(t);
|
|
1371
|
-
const l =
|
|
1394
|
+
const l = o - c.lastChange;
|
|
1372
1395
|
if (l >= e) {
|
|
1373
1396
|
d.delete(t);
|
|
1374
1397
|
r(void 0, n);
|
|
1375
|
-
} else h = setTimeout(awaitWriteFinishFn,
|
|
1398
|
+
} else h = setTimeout(awaitWriteFinishFn, a, n);
|
|
1376
1399
|
});
|
|
1377
1400
|
}
|
|
1378
1401
|
if (!d.has(t)) {
|
|
@@ -1384,7 +1407,7 @@
|
|
|
1384
1407
|
return s;
|
|
1385
1408
|
}
|
|
1386
1409
|
});
|
|
1387
|
-
h = setTimeout(awaitWriteFinishFn,
|
|
1410
|
+
h = setTimeout(awaitWriteFinishFn, a);
|
|
1388
1411
|
}
|
|
1389
1412
|
}
|
|
1390
1413
|
_isIgnored(t, e) {
|
|
@@ -1425,9 +1448,9 @@
|
|
|
1425
1448
|
s = null != s ? s : this._watched.has(i) || this._watched.has(r);
|
|
1426
1449
|
if (!this._throttle("remove", i, 100)) return;
|
|
1427
1450
|
if (!s && 1 === this._watched.size) this.add(t, e, true);
|
|
1428
|
-
const
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1451
|
+
const o = this._getWatchedDir(i);
|
|
1452
|
+
const a = o.getChildren();
|
|
1453
|
+
a.forEach((t)=>this._remove(i, t));
|
|
1431
1454
|
const h = this._getWatchedDir(t);
|
|
1432
1455
|
const c = h.has(e);
|
|
1433
1456
|
h.remove(e);
|