@rstest/core 0.9.1 → 0.9.3
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/LICENSE.md +1 -1
- package/dist/{0~89.js → 0~8843.js} +24 -28
- package/dist/{0~1472.js → 0~browserLoader.js} +11 -11
- package/dist/{0~7882.js → 0~browser~1.js} +60 -61
- package/dist/{0~8426.js → 0~checkThresholds.js} +6 -6
- package/dist/{0~7583.js → 0~chokidar.js} +113 -72
- package/dist/{0~130.js → 0~console.js} +19 -20
- package/dist/{0~9744.js → 0~dist.js} +57 -57
- package/dist/{0~4403.js → 0~generate.js} +9 -6
- package/dist/{0~4809.js → 0~happyDom.js} +2 -2
- package/dist/{0~3346.js → 0~interop.js} +0 -1
- package/dist/{0~62.js → 0~jsdom.js} +2 -2
- package/dist/{0~262.js → 0~lib.js} +4 -1
- package/dist/{0~9634.js → 0~listTests.js} +15 -24
- package/dist/{0~6923.js → 0~loadEsModule.js} +7 -7
- package/dist/{0~5835.js → 0~loadModule.js} +11 -11
- package/dist/{0~6907.js → 0~magic-string.es.js} +2 -1
- package/dist/0~mergeReports.js +127 -0
- package/dist/{0~2255.js → 0~plugin.js} +2 -4
- package/dist/{0~6588.js → 0~restart.js} +8 -12
- package/dist/{0~2173.js → 0~runTests.js} +51 -60
- package/dist/{487.js → 1255.js} +22 -15
- package/dist/{6151.js → 1949.js} +41 -25
- package/dist/{6973.js → 255.js} +9 -10
- package/dist/{9131.js → 3145.js} +229 -479
- package/dist/{1157.js → 4411.js} +37 -37
- package/dist/{4484.js → 5040.js} +1 -2
- package/dist/{3160.js → 6830.js} +429 -106
- package/dist/7011.js +1 -1
- package/dist/{1294.js → 7552.js} +106 -83
- package/dist/{5734.js → 7704.js} +7 -6
- package/dist/browser-runtime/{2~907.js → 2~magic-string.es.js} +18 -11
- package/dist/browser-runtime/{389.js → 723.js} +178 -134
- package/dist/browser-runtime/{389.js.LICENSE.txt → 723.js.LICENSE.txt} +0 -22
- package/dist/browser-runtime/index.d.ts +40 -5
- package/dist/browser-runtime/index.js +1 -1
- package/dist/browser-runtime/rslib-runtime.js +11 -3
- package/dist/browser.d.ts +40 -5
- package/dist/browser.js +9 -7
- package/dist/globalSetupWorker.js +7 -14
- package/dist/index.d.ts +53 -6
- package/dist/index.js +2 -2
- package/dist/rslib-runtime.js +5 -8
- package/dist/worker.d.ts +30 -3
- package/dist/worker.js +20 -46
- package/package.json +19 -18
- package/dist/3160.js.LICENSE.txt +0 -21
- package/dist/4881.js +0 -2
- package/dist/6198.js +0 -2
- /package/dist/{0~7583.js.LICENSE.txt → 0~chokidar.js.LICENSE.txt} +0 -0
- /package/dist/{0~3062.js → 0~utils.js} +0 -0
- /package/dist/{6151.js.LICENSE.txt → 1949.js.LICENSE.txt} +0 -0
- /package/dist/{4597.js → 1983.js} +0 -0
- /package/dist/{1294.js.LICENSE.txt → 7552.js.LICENSE.txt} +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/*!
|
|
1
|
+
/*! LICENSE: 0~chokidar.js.LICENSE.txt */
|
|
2
2
|
import "node:module";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
import { stat as external_node_fs_stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
5
|
+
import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "node:fs/promises";
|
|
6
|
+
import { basename as external_node_path_basename, dirname as external_node_path_dirname, extname, isAbsolute, join, normalize, relative as external_node_path_relative, resolve as external_node_path_resolve, sep } from "node:path";
|
|
6
7
|
import { Readable } from "node:stream";
|
|
7
|
-
import "
|
|
8
|
-
import { readdir as promises_readdir, lstat as promises_lstat, promises_stat as promises_promises_stat, realpath as external_node_fs_promises_realpath } from "./1157.js";
|
|
9
|
-
const external_node_path_ = __webpack_require__("path");
|
|
8
|
+
import { type as external_node_os_type } from "node:os";
|
|
10
9
|
const EntryTypes = {
|
|
11
10
|
FILE_TYPE: 'files',
|
|
12
11
|
DIR_TYPE: 'directories',
|
|
@@ -65,6 +64,20 @@ const normalizeFilter = (filter)=>{
|
|
|
65
64
|
return emptyFn;
|
|
66
65
|
};
|
|
67
66
|
class ReaddirpStream extends Readable {
|
|
67
|
+
parents;
|
|
68
|
+
reading;
|
|
69
|
+
parent;
|
|
70
|
+
_stat;
|
|
71
|
+
_maxDepth;
|
|
72
|
+
_wantsDir;
|
|
73
|
+
_wantsFile;
|
|
74
|
+
_wantsEverything;
|
|
75
|
+
_root;
|
|
76
|
+
_isDirent;
|
|
77
|
+
_statsProp;
|
|
78
|
+
_rdOptions;
|
|
79
|
+
_fileFilter;
|
|
80
|
+
_directoryFilter;
|
|
68
81
|
constructor(options = {}){
|
|
69
82
|
super({
|
|
70
83
|
objectMode: true,
|
|
@@ -78,16 +91,16 @@ class ReaddirpStream extends Readable {
|
|
|
78
91
|
const { root, type } = opts;
|
|
79
92
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
80
93
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
81
|
-
const statMethod = opts.lstat ?
|
|
94
|
+
const statMethod = opts.lstat ? lstat : promises_stat;
|
|
82
95
|
if (wantBigintFsStats) this._stat = (path)=>statMethod(path, {
|
|
83
96
|
bigint: true
|
|
84
97
|
});
|
|
85
98
|
else this._stat = statMethod;
|
|
86
|
-
this._maxDepth = opts.depth
|
|
99
|
+
this._maxDepth = null != opts.depth && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
|
|
87
100
|
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
|
88
101
|
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
|
89
102
|
this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
|
|
90
|
-
this._root = (
|
|
103
|
+
this._root = external_node_path_resolve(root);
|
|
91
104
|
this._isDirent = !opts.alwaysStat;
|
|
92
105
|
this._statsProp = this._isDirent ? 'dirent' : 'stats';
|
|
93
106
|
this._rdOptions = {
|
|
@@ -147,7 +160,7 @@ class ReaddirpStream extends Readable {
|
|
|
147
160
|
async _exploreDir(path, depth) {
|
|
148
161
|
let files;
|
|
149
162
|
try {
|
|
150
|
-
files = await
|
|
163
|
+
files = await readdir(path, this._rdOptions);
|
|
151
164
|
} catch (error) {
|
|
152
165
|
this._onError(error);
|
|
153
166
|
}
|
|
@@ -161,9 +174,9 @@ class ReaddirpStream extends Readable {
|
|
|
161
174
|
let entry;
|
|
162
175
|
const basename = this._isDirent ? dirent.name : dirent;
|
|
163
176
|
try {
|
|
164
|
-
const fullPath = (
|
|
177
|
+
const fullPath = external_node_path_resolve(join(path, basename));
|
|
165
178
|
entry = {
|
|
166
|
-
path: (
|
|
179
|
+
path: external_node_path_relative(this._root, fullPath),
|
|
167
180
|
fullPath,
|
|
168
181
|
basename
|
|
169
182
|
};
|
|
@@ -186,12 +199,12 @@ class ReaddirpStream extends Readable {
|
|
|
186
199
|
if (stats && stats.isSymbolicLink()) {
|
|
187
200
|
const full = entry.fullPath;
|
|
188
201
|
try {
|
|
189
|
-
const entryRealPath = await
|
|
190
|
-
const entryRealPathStats = await
|
|
202
|
+
const entryRealPath = await promises_realpath(full);
|
|
203
|
+
const entryRealPathStats = await lstat(entryRealPath);
|
|
191
204
|
if (entryRealPathStats.isFile()) return 'file';
|
|
192
205
|
if (entryRealPathStats.isDirectory()) {
|
|
193
206
|
const len = entryRealPath.length;
|
|
194
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
207
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === sep) {
|
|
195
208
|
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
196
209
|
recursiveError.code = RECURSIVE_ERROR_CODE;
|
|
197
210
|
return this._onError(recursiveError);
|
|
@@ -220,8 +233,6 @@ function readdirp(root, options = {}) {
|
|
|
220
233
|
options.root = root;
|
|
221
234
|
return new ReaddirpStream(options);
|
|
222
235
|
}
|
|
223
|
-
const external_node_fs_ = __webpack_require__("node:fs");
|
|
224
|
-
const external_node_os_ = __webpack_require__("node:os");
|
|
225
236
|
const STR_DATA = 'data';
|
|
226
237
|
const STR_END = 'end';
|
|
227
238
|
const STR_CLOSE = 'close';
|
|
@@ -231,7 +242,7 @@ const isWindows = 'win32' === pl;
|
|
|
231
242
|
const isMacos = 'darwin' === pl;
|
|
232
243
|
const isLinux = 'linux' === pl;
|
|
233
244
|
const isFreeBSD = 'freebsd' === pl;
|
|
234
|
-
const isIBMi = 'OS400' === (
|
|
245
|
+
const isIBMi = 'OS400' === external_node_os_type();
|
|
235
246
|
const EVENTS = {
|
|
236
247
|
ALL: 'all',
|
|
237
248
|
READY: 'ready',
|
|
@@ -520,7 +531,7 @@ const binaryExtensions = new Set([
|
|
|
520
531
|
'zip',
|
|
521
532
|
'zipx'
|
|
522
533
|
]);
|
|
523
|
-
const isBinaryPath = (filePath)=>binaryExtensions.has(
|
|
534
|
+
const isBinaryPath = (filePath)=>binaryExtensions.has(extname(filePath).slice(1).toLowerCase());
|
|
524
535
|
const foreach = (val, fn)=>{
|
|
525
536
|
if (val instanceof Set) val.forEach(fn);
|
|
526
537
|
else fn(val);
|
|
@@ -550,10 +561,10 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
|
550
561
|
emitRaw(rawEvent, evPath, {
|
|
551
562
|
watchedPath: path
|
|
552
563
|
});
|
|
553
|
-
if (evPath && path !== evPath) fsWatchBroadcast(
|
|
564
|
+
if (evPath && path !== evPath) fsWatchBroadcast(external_node_path_resolve(path, evPath), KEY_LISTENERS, join(path, evPath));
|
|
554
565
|
};
|
|
555
566
|
try {
|
|
556
|
-
return
|
|
567
|
+
return watch(path, {
|
|
557
568
|
persistent: options.persistent
|
|
558
569
|
}, handleEvent);
|
|
559
570
|
} catch (error) {
|
|
@@ -621,7 +632,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers)=>{
|
|
|
621
632
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
622
633
|
const copts = cont && cont.options;
|
|
623
634
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
624
|
-
|
|
635
|
+
unwatchFile(fullPath);
|
|
625
636
|
cont = void 0;
|
|
626
637
|
}
|
|
627
638
|
if (cont) {
|
|
@@ -632,7 +643,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers)=>{
|
|
|
632
643
|
listeners: listener,
|
|
633
644
|
rawEmitters: rawEmitter,
|
|
634
645
|
options,
|
|
635
|
-
watcher:
|
|
646
|
+
watcher: watchFile(fullPath, options, (curr, prev)=>{
|
|
636
647
|
foreach(cont.rawEmitters, (rawEmitter)=>{
|
|
637
648
|
rawEmitter(EV.CHANGE, fullPath, {
|
|
638
649
|
curr,
|
|
@@ -650,24 +661,26 @@ const setFsWatchFileListener = (path, fullPath, options, handlers)=>{
|
|
|
650
661
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
651
662
|
if (isEmptySet(cont.listeners)) {
|
|
652
663
|
FsWatchFileInstances.delete(fullPath);
|
|
653
|
-
|
|
664
|
+
unwatchFile(fullPath);
|
|
654
665
|
cont.options = cont.watcher = void 0;
|
|
655
666
|
Object.freeze(cont);
|
|
656
667
|
}
|
|
657
668
|
};
|
|
658
669
|
};
|
|
659
670
|
class NodeFsHandler {
|
|
671
|
+
fsw;
|
|
672
|
+
_boundHandleError;
|
|
660
673
|
constructor(fsW){
|
|
661
674
|
this.fsw = fsW;
|
|
662
675
|
this._boundHandleError = (error)=>fsW._handleError(error);
|
|
663
676
|
}
|
|
664
677
|
_watchWithNodeFs(path, listener) {
|
|
665
678
|
const opts = this.fsw.options;
|
|
666
|
-
const directory =
|
|
667
|
-
const basename =
|
|
679
|
+
const directory = external_node_path_dirname(path);
|
|
680
|
+
const basename = external_node_path_basename(path);
|
|
668
681
|
const parent = this.fsw._getWatchedDir(directory);
|
|
669
682
|
parent.add(basename);
|
|
670
|
-
const absolutePath =
|
|
683
|
+
const absolutePath = external_node_path_resolve(path);
|
|
671
684
|
const options = {
|
|
672
685
|
persistent: opts.persistent
|
|
673
686
|
};
|
|
@@ -689,8 +702,8 @@ class NodeFsHandler {
|
|
|
689
702
|
}
|
|
690
703
|
_handleFile(file, stats, initialAdd) {
|
|
691
704
|
if (this.fsw.closed) return;
|
|
692
|
-
const dirname =
|
|
693
|
-
const basename =
|
|
705
|
+
const dirname = external_node_path_dirname(file);
|
|
706
|
+
const basename = external_node_path_basename(file);
|
|
694
707
|
const parent = this.fsw._getWatchedDir(dirname);
|
|
695
708
|
let prevStats = stats;
|
|
696
709
|
if (parent.has(basename)) return;
|
|
@@ -757,8 +770,9 @@ class NodeFsHandler {
|
|
|
757
770
|
this.fsw._symlinkPaths.set(full, true);
|
|
758
771
|
}
|
|
759
772
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
760
|
-
directory =
|
|
761
|
-
|
|
773
|
+
directory = join(directory, '');
|
|
774
|
+
const throttleKey = target ? `${directory}:${target}` : directory;
|
|
775
|
+
throttler = this.fsw._throttle('readdir', throttleKey, 1000);
|
|
762
776
|
if (!throttler) return;
|
|
763
777
|
const previous = this.fsw._getWatchedDir(wh.path);
|
|
764
778
|
const current = new Set();
|
|
@@ -773,7 +787,7 @@ class NodeFsHandler {
|
|
|
773
787
|
return;
|
|
774
788
|
}
|
|
775
789
|
const item = entry.path;
|
|
776
|
-
let path =
|
|
790
|
+
let path = join(directory, item);
|
|
777
791
|
current.add(item);
|
|
778
792
|
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) return;
|
|
779
793
|
if (this.fsw.closed) {
|
|
@@ -782,7 +796,7 @@ class NodeFsHandler {
|
|
|
782
796
|
}
|
|
783
797
|
if (item === target || !target && !previous.has(item)) {
|
|
784
798
|
this.fsw._incrReadyCount();
|
|
785
|
-
path =
|
|
799
|
+
path = join(dir, external_node_path_relative(dir, path));
|
|
786
800
|
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
|
787
801
|
}
|
|
788
802
|
}).on(EV.ERROR, this._boundHandleError);
|
|
@@ -804,10 +818,10 @@ class NodeFsHandler {
|
|
|
804
818
|
});
|
|
805
819
|
}
|
|
806
820
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
|
807
|
-
const parentDir = this.fsw._getWatchedDir(
|
|
808
|
-
const tracked = parentDir.has(
|
|
821
|
+
const parentDir = this.fsw._getWatchedDir(external_node_path_dirname(dir));
|
|
822
|
+
const tracked = parentDir.has(external_node_path_basename(dir));
|
|
809
823
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
810
|
-
parentDir.add(
|
|
824
|
+
parentDir.add(external_node_path_basename(dir));
|
|
811
825
|
this.fsw._getWatchedDir(dir);
|
|
812
826
|
let throttler;
|
|
813
827
|
let closer;
|
|
@@ -845,7 +859,7 @@ class NodeFsHandler {
|
|
|
845
859
|
const follow = this.fsw.options.followSymlinks;
|
|
846
860
|
let closer;
|
|
847
861
|
if (stats.isDirectory()) {
|
|
848
|
-
const absPath =
|
|
862
|
+
const absPath = external_node_path_resolve(path);
|
|
849
863
|
const targetPath = follow ? await promises_realpath(path) : path;
|
|
850
864
|
if (this.fsw.closed) return;
|
|
851
865
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
@@ -854,12 +868,12 @@ class NodeFsHandler {
|
|
|
854
868
|
} else if (stats.isSymbolicLink()) {
|
|
855
869
|
const targetPath = follow ? await promises_realpath(path) : path;
|
|
856
870
|
if (this.fsw.closed) return;
|
|
857
|
-
const parent =
|
|
871
|
+
const parent = external_node_path_dirname(wh.watchPath);
|
|
858
872
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
859
873
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
860
874
|
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
|
|
861
875
|
if (this.fsw.closed) return;
|
|
862
|
-
if (void 0 !== targetPath) this.fsw._symlinkPaths.set(
|
|
876
|
+
if (void 0 !== targetPath) this.fsw._symlinkPaths.set(external_node_path_resolve(path), targetPath);
|
|
863
877
|
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
864
878
|
ready();
|
|
865
879
|
if (closer) this.fsw._addPathCloser(path, closer);
|
|
@@ -878,7 +892,7 @@ const ONE_DOT = '.';
|
|
|
878
892
|
const TWO_DOTS = '..';
|
|
879
893
|
const STRING_TYPE = 'string';
|
|
880
894
|
const BACK_SLASH_RE = /\\/g;
|
|
881
|
-
const
|
|
895
|
+
const DOUBLE_SLASH_RE = /\/\//g;
|
|
882
896
|
const DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
|
|
883
897
|
const REPLACER_RE = /^\.[/\\]/;
|
|
884
898
|
function arrify(item) {
|
|
@@ -894,9 +908,9 @@ function createPattern(matcher) {
|
|
|
894
908
|
if ('object' == typeof matcher && null !== matcher) return (string)=>{
|
|
895
909
|
if (matcher.path === string) return true;
|
|
896
910
|
if (matcher.recursive) {
|
|
897
|
-
const relative =
|
|
911
|
+
const relative = external_node_path_relative(matcher.path, string);
|
|
898
912
|
if (!relative) return false;
|
|
899
|
-
return !relative.startsWith('..') && !
|
|
913
|
+
return !relative.startsWith('..') && !isAbsolute(relative);
|
|
900
914
|
}
|
|
901
915
|
return false;
|
|
902
916
|
};
|
|
@@ -904,12 +918,11 @@ function createPattern(matcher) {
|
|
|
904
918
|
}
|
|
905
919
|
function normalizePath(path) {
|
|
906
920
|
if ('string' != typeof path) throw new Error('string expected');
|
|
907
|
-
path =
|
|
921
|
+
path = normalize(path);
|
|
908
922
|
path = path.replace(/\\/g, '/');
|
|
909
923
|
let prepend = false;
|
|
910
924
|
if (path.startsWith('//')) prepend = true;
|
|
911
|
-
|
|
912
|
-
while(path.match(DOUBLE_SLASH_RE))path = path.replace(DOUBLE_SLASH_RE, '/');
|
|
925
|
+
path = path.replace(DOUBLE_SLASH_RE, '/');
|
|
913
926
|
if (prepend) path = '/' + path;
|
|
914
927
|
return path;
|
|
915
928
|
}
|
|
@@ -937,21 +950,24 @@ const toUnix = (string)=>{
|
|
|
937
950
|
let str = string.replace(BACK_SLASH_RE, SLASH);
|
|
938
951
|
let prepend = false;
|
|
939
952
|
if (str.startsWith(SLASH_SLASH)) prepend = true;
|
|
940
|
-
|
|
953
|
+
str = str.replace(DOUBLE_SLASH_RE, SLASH);
|
|
941
954
|
if (prepend) str = SLASH + str;
|
|
942
955
|
return str;
|
|
943
956
|
};
|
|
944
|
-
const normalizePathToUnix = (path)=>toUnix(
|
|
957
|
+
const normalizePathToUnix = (path)=>toUnix(normalize(toUnix(path)));
|
|
945
958
|
const normalizeIgnored = (cwd = '')=>(path)=>{
|
|
946
|
-
if ('string' == typeof path) return normalizePathToUnix(
|
|
959
|
+
if ('string' == typeof path) return normalizePathToUnix(isAbsolute(path) ? path : join(cwd, path));
|
|
947
960
|
return path;
|
|
948
961
|
};
|
|
949
962
|
const getAbsolutePath = (path, cwd)=>{
|
|
950
|
-
if (
|
|
951
|
-
return
|
|
963
|
+
if (isAbsolute(path)) return path;
|
|
964
|
+
return join(cwd, path);
|
|
952
965
|
};
|
|
953
966
|
const EMPTY_SET = Object.freeze(new Set());
|
|
954
967
|
class DirEntry {
|
|
968
|
+
path;
|
|
969
|
+
_removeWatcher;
|
|
970
|
+
items;
|
|
955
971
|
constructor(dir, removeWatcher){
|
|
956
972
|
this.path = dir;
|
|
957
973
|
this._removeWatcher = removeWatcher;
|
|
@@ -971,7 +987,7 @@ class DirEntry {
|
|
|
971
987
|
try {
|
|
972
988
|
await readdir(dir);
|
|
973
989
|
} catch (err) {
|
|
974
|
-
if (this._removeWatcher) this._removeWatcher(
|
|
990
|
+
if (this._removeWatcher) this._removeWatcher(external_node_path_dirname(dir), external_node_path_basename(dir));
|
|
975
991
|
}
|
|
976
992
|
}
|
|
977
993
|
has(item) {
|
|
@@ -997,12 +1013,19 @@ class DirEntry {
|
|
|
997
1013
|
const STAT_METHOD_F = 'stat';
|
|
998
1014
|
const STAT_METHOD_L = 'lstat';
|
|
999
1015
|
class WatchHelper {
|
|
1016
|
+
fsw;
|
|
1017
|
+
path;
|
|
1018
|
+
watchPath;
|
|
1019
|
+
fullWatchPath;
|
|
1020
|
+
dirParts;
|
|
1021
|
+
followSymlinks;
|
|
1022
|
+
statMethod;
|
|
1000
1023
|
constructor(path, follow, fsw){
|
|
1001
1024
|
this.fsw = fsw;
|
|
1002
1025
|
const watchPath = path;
|
|
1003
1026
|
this.path = path = path.replace(REPLACER_RE, '');
|
|
1004
1027
|
this.watchPath = watchPath;
|
|
1005
|
-
this.fullWatchPath =
|
|
1028
|
+
this.fullWatchPath = external_node_path_resolve(watchPath);
|
|
1006
1029
|
this.dirParts = [];
|
|
1007
1030
|
this.dirParts.forEach((parts)=>{
|
|
1008
1031
|
if (parts.length > 1) parts.pop();
|
|
@@ -1011,7 +1034,7 @@ class WatchHelper {
|
|
|
1011
1034
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
1012
1035
|
}
|
|
1013
1036
|
entryPath(entry) {
|
|
1014
|
-
return
|
|
1037
|
+
return join(this.watchPath, external_node_path_relative(this.watchPath, entry.fullPath));
|
|
1015
1038
|
}
|
|
1016
1039
|
filterPath(entry) {
|
|
1017
1040
|
const { stats } = entry;
|
|
@@ -1024,6 +1047,24 @@ class WatchHelper {
|
|
|
1024
1047
|
}
|
|
1025
1048
|
}
|
|
1026
1049
|
class FSWatcher extends EventEmitter {
|
|
1050
|
+
closed;
|
|
1051
|
+
options;
|
|
1052
|
+
_closers;
|
|
1053
|
+
_ignoredPaths;
|
|
1054
|
+
_throttled;
|
|
1055
|
+
_streams;
|
|
1056
|
+
_symlinkPaths;
|
|
1057
|
+
_watched;
|
|
1058
|
+
_pendingWrites;
|
|
1059
|
+
_pendingUnlinks;
|
|
1060
|
+
_readyCount;
|
|
1061
|
+
_emitReady;
|
|
1062
|
+
_closePromise;
|
|
1063
|
+
_userIgnored;
|
|
1064
|
+
_readyEmitted;
|
|
1065
|
+
_emitRaw;
|
|
1066
|
+
_boundRemove;
|
|
1067
|
+
_nodeFsHandler;
|
|
1027
1068
|
constructor(_opts = {}){
|
|
1028
1069
|
super();
|
|
1029
1070
|
this.closed = false;
|
|
@@ -1118,7 +1159,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1118
1159
|
})).then((results)=>{
|
|
1119
1160
|
if (this.closed) return;
|
|
1120
1161
|
results.forEach((item)=>{
|
|
1121
|
-
if (item) this.add(
|
|
1162
|
+
if (item) this.add(external_node_path_dirname(item), external_node_path_basename(_origAdd || item));
|
|
1122
1163
|
});
|
|
1123
1164
|
});
|
|
1124
1165
|
return this;
|
|
@@ -1128,9 +1169,9 @@ class FSWatcher extends EventEmitter {
|
|
|
1128
1169
|
const paths = unifyPaths(paths_);
|
|
1129
1170
|
const { cwd } = this.options;
|
|
1130
1171
|
paths.forEach((path)=>{
|
|
1131
|
-
if (!
|
|
1132
|
-
if (cwd) path =
|
|
1133
|
-
path =
|
|
1172
|
+
if (!isAbsolute(path) && !this._closers.has(path)) {
|
|
1173
|
+
if (cwd) path = join(cwd, path);
|
|
1174
|
+
path = external_node_path_resolve(path);
|
|
1134
1175
|
}
|
|
1135
1176
|
this._closePath(path);
|
|
1136
1177
|
this._addIgnoredPath(path);
|
|
@@ -1167,7 +1208,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1167
1208
|
getWatched() {
|
|
1168
1209
|
const watchList = {};
|
|
1169
1210
|
this._watched.forEach((entry, dir)=>{
|
|
1170
|
-
const key = this.options.cwd ?
|
|
1211
|
+
const key = this.options.cwd ? external_node_path_relative(this.options.cwd, dir) : dir;
|
|
1171
1212
|
const index = key || ONE_DOT;
|
|
1172
1213
|
watchList[index] = entry.getChildren().sort();
|
|
1173
1214
|
});
|
|
@@ -1180,8 +1221,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1180
1221
|
async _emit(event, path, stats) {
|
|
1181
1222
|
if (this.closed) return;
|
|
1182
1223
|
const opts = this.options;
|
|
1183
|
-
if (isWindows) path =
|
|
1184
|
-
if (opts.cwd) path =
|
|
1224
|
+
if (isWindows) path = normalize(path);
|
|
1225
|
+
if (opts.cwd) path = external_node_path_relative(opts.cwd, path);
|
|
1185
1226
|
const args = [
|
|
1186
1227
|
path
|
|
1187
1228
|
];
|
|
@@ -1232,7 +1273,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1232
1273
|
if (isThrottled) return this;
|
|
1233
1274
|
}
|
|
1234
1275
|
if (opts.alwaysStat && void 0 === stats && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
1235
|
-
const fullPath = opts.cwd ?
|
|
1276
|
+
const fullPath = opts.cwd ? join(opts.cwd, path) : path;
|
|
1236
1277
|
let stats;
|
|
1237
1278
|
try {
|
|
1238
1279
|
stats = await promises_stat(fullPath);
|
|
@@ -1284,11 +1325,11 @@ class FSWatcher extends EventEmitter {
|
|
|
1284
1325
|
const pollInterval = awf.pollInterval;
|
|
1285
1326
|
let timeoutHandler;
|
|
1286
1327
|
let fullPath = path;
|
|
1287
|
-
if (this.options.cwd && !
|
|
1328
|
+
if (this.options.cwd && !isAbsolute(path)) fullPath = join(this.options.cwd, path);
|
|
1288
1329
|
const now = new Date();
|
|
1289
1330
|
const writes = this._pendingWrites;
|
|
1290
1331
|
function awaitWriteFinishFn(prevStat) {
|
|
1291
|
-
(
|
|
1332
|
+
external_node_fs_stat(fullPath, (err, curStat)=>{
|
|
1292
1333
|
if (err || !writes.has(path)) {
|
|
1293
1334
|
if (err && 'ENOENT' !== err.code) awfEmit(err);
|
|
1294
1335
|
return;
|
|
@@ -1339,7 +1380,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1339
1380
|
return new WatchHelper(path, this.options.followSymlinks, this);
|
|
1340
1381
|
}
|
|
1341
1382
|
_getWatchedDir(directory) {
|
|
1342
|
-
const dir =
|
|
1383
|
+
const dir = external_node_path_resolve(directory);
|
|
1343
1384
|
if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
1344
1385
|
return this._watched.get(dir);
|
|
1345
1386
|
}
|
|
@@ -1348,8 +1389,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1348
1389
|
return Boolean(256 & Number(stats.mode));
|
|
1349
1390
|
}
|
|
1350
1391
|
_remove(directory, item, isDirectory) {
|
|
1351
|
-
const path =
|
|
1352
|
-
const fullPath =
|
|
1392
|
+
const path = join(directory, item);
|
|
1393
|
+
const fullPath = external_node_path_resolve(path);
|
|
1353
1394
|
isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
|
|
1354
1395
|
if (!this._throttle('remove', path, 100)) return;
|
|
1355
1396
|
if (!isDirectory && 1 === this._watched.size) this.add(directory, item, true);
|
|
@@ -1361,7 +1402,7 @@ class FSWatcher extends EventEmitter {
|
|
|
1361
1402
|
parent.remove(item);
|
|
1362
1403
|
if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
|
|
1363
1404
|
let relPath = path;
|
|
1364
|
-
if (this.options.cwd) relPath =
|
|
1405
|
+
if (this.options.cwd) relPath = external_node_path_relative(this.options.cwd, path);
|
|
1365
1406
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
1366
1407
|
const event = this._pendingWrites.get(relPath).cancelWait();
|
|
1367
1408
|
if (event === EVENTS.ADD) return;
|
|
@@ -1374,8 +1415,8 @@ class FSWatcher extends EventEmitter {
|
|
|
1374
1415
|
}
|
|
1375
1416
|
_closePath(path) {
|
|
1376
1417
|
this._closeFile(path);
|
|
1377
|
-
const dir =
|
|
1378
|
-
this._getWatchedDir(dir).remove(
|
|
1418
|
+
const dir = external_node_path_dirname(path);
|
|
1419
|
+
this._getWatchedDir(dir).remove(external_node_path_basename(path));
|
|
1379
1420
|
}
|
|
1380
1421
|
_closeFile(path) {
|
|
1381
1422
|
const closers = this._closers.get(path);
|
|
@@ -1415,9 +1456,9 @@ class FSWatcher extends EventEmitter {
|
|
|
1415
1456
|
return stream;
|
|
1416
1457
|
}
|
|
1417
1458
|
}
|
|
1418
|
-
function
|
|
1459
|
+
function chokidar_watch(paths, options = {}) {
|
|
1419
1460
|
const watcher = new FSWatcher(options);
|
|
1420
1461
|
watcher.add(paths);
|
|
1421
1462
|
return watcher;
|
|
1422
1463
|
}
|
|
1423
|
-
export { watch };
|
|
1464
|
+
export { chokidar_watch as watch };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
2
|
import { AssertionError, strict } from "node:assert";
|
|
4
3
|
import { Console } from "node:console";
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import { format, formatWithOptions, inspect } from "node:util";
|
|
5
|
+
import { prettyTime, color as logger_color } from "./6830.js";
|
|
7
6
|
const RealDate = Date;
|
|
8
7
|
function createCustomConsole({ rpc, testPath, printConsoleTrace }) {
|
|
9
8
|
const getConsoleTrace = ()=>{
|
|
@@ -22,13 +21,13 @@ function createCustomConsole({ rpc, testPath, printConsoleTrace }) {
|
|
|
22
21
|
getPrettyName(type) {
|
|
23
22
|
switch(type){
|
|
24
23
|
case 'error':
|
|
25
|
-
return
|
|
24
|
+
return logger_color.red(type);
|
|
26
25
|
case 'warn':
|
|
27
|
-
return
|
|
26
|
+
return logger_color.yellow(type);
|
|
28
27
|
case 'info':
|
|
29
|
-
return
|
|
28
|
+
return logger_color.cyan(type);
|
|
30
29
|
default:
|
|
31
|
-
return
|
|
30
|
+
return logger_color.gray(type);
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
_log(name, message, type = 'stdout') {
|
|
@@ -50,40 +49,40 @@ function createCustomConsole({ rpc, testPath, printConsoleTrace }) {
|
|
|
50
49
|
}
|
|
51
50
|
count(label = 'default') {
|
|
52
51
|
if (!this._counters[label]) this._counters[label] = 0;
|
|
53
|
-
this._log('count',
|
|
52
|
+
this._log('count', format(`${label}: ${++this._counters[label]}`));
|
|
54
53
|
}
|
|
55
54
|
countReset(label = 'default') {
|
|
56
55
|
this._counters[label] = 0;
|
|
57
56
|
}
|
|
58
57
|
debug(firstArg, ...args) {
|
|
59
|
-
this._log('debug',
|
|
58
|
+
this._log('debug', format(firstArg, ...args));
|
|
60
59
|
}
|
|
61
60
|
dir(firstArg, options = {}) {
|
|
62
|
-
const representation =
|
|
63
|
-
this._log('dir',
|
|
61
|
+
const representation = inspect(firstArg, options);
|
|
62
|
+
this._log('dir', formatWithOptions(options, representation));
|
|
64
63
|
}
|
|
65
64
|
dirxml(firstArg, ...args) {
|
|
66
|
-
this._log('dirxml',
|
|
65
|
+
this._log('dirxml', format(firstArg, ...args));
|
|
67
66
|
}
|
|
68
67
|
error(firstArg, ...args) {
|
|
69
|
-
this._log('error',
|
|
68
|
+
this._log('error', format(firstArg, ...args), 'stderr');
|
|
70
69
|
}
|
|
71
70
|
group(title, ...args) {
|
|
72
71
|
this._groupDepth++;
|
|
73
|
-
if (null != title || args.length > 0) this._log('group',
|
|
72
|
+
if (null != title || args.length > 0) this._log('group', logger_color.bold(format(title, ...args)));
|
|
74
73
|
}
|
|
75
74
|
groupCollapsed(title, ...args) {
|
|
76
75
|
this._groupDepth++;
|
|
77
|
-
if (null != title || args.length > 0) this._log('groupCollapsed',
|
|
76
|
+
if (null != title || args.length > 0) this._log('groupCollapsed', logger_color.bold(format(title, ...args)));
|
|
78
77
|
}
|
|
79
78
|
groupEnd() {
|
|
80
79
|
if (this._groupDepth > 0) this._groupDepth--;
|
|
81
80
|
}
|
|
82
81
|
info(firstArg, ...args) {
|
|
83
|
-
this._log('info',
|
|
82
|
+
this._log('info', format(firstArg, ...args));
|
|
84
83
|
}
|
|
85
84
|
log(firstArg, ...args) {
|
|
86
|
-
this._log('log',
|
|
85
|
+
this._log('log', format(firstArg, ...args));
|
|
87
86
|
}
|
|
88
87
|
time(label = 'default') {
|
|
89
88
|
if (null != this._timers[label]) return;
|
|
@@ -94,7 +93,7 @@ function createCustomConsole({ rpc, testPath, printConsoleTrace }) {
|
|
|
94
93
|
if (null != startTime) {
|
|
95
94
|
const endTime = RealDate.now();
|
|
96
95
|
const time = endTime - startTime.getTime();
|
|
97
|
-
this._log('time',
|
|
96
|
+
this._log('time', format(`${label}: ${prettyTime(time)}`));
|
|
98
97
|
delete this._timers[label];
|
|
99
98
|
}
|
|
100
99
|
}
|
|
@@ -103,11 +102,11 @@ function createCustomConsole({ rpc, testPath, printConsoleTrace }) {
|
|
|
103
102
|
if (null != startTime) {
|
|
104
103
|
const endTime = new RealDate();
|
|
105
104
|
const time = endTime.getTime() - startTime.getTime();
|
|
106
|
-
this._log('time',
|
|
105
|
+
this._log('time', format(`${label}: ${prettyTime(time)}`, ...data));
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
warn(firstArg, ...args) {
|
|
110
|
-
this._log('warn',
|
|
109
|
+
this._log('warn', format(firstArg, ...args), 'stderr');
|
|
111
110
|
}
|
|
112
111
|
getBuffer() {}
|
|
113
112
|
}
|