7
7
8
8
const path = require ( "path" ) ;
9
9
10
- /** @typedef {import("fs").Stats } NodeFsStats */
11
10
/** @typedef {import("../../declarations/WebpackOptions").WatchOptions } WatchOptions */
12
11
/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry } FileSystemInfoEntry */
13
12
13
+ /**
14
+ * @typedef {Object } IStats
15
+ * @property {() => boolean } isFile
16
+ * @property {() => boolean } isDirectory
17
+ * @property {() => boolean } isBlockDevice
18
+ * @property {() => boolean } isCharacterDevice
19
+ * @property {() => boolean } isSymbolicLink
20
+ * @property {() => boolean } isFIFO
21
+ * @property {() => boolean } isSocket
22
+ * @property {number | bigint } dev
23
+ * @property {number | bigint } ino
24
+ * @property {number | bigint } mode
25
+ * @property {number | bigint } nlink
26
+ * @property {number | bigint } uid
27
+ * @property {number | bigint } gid
28
+ * @property {number | bigint } rdev
29
+ * @property {number | bigint } size
30
+ * @property {number | bigint } blksize
31
+ * @property {number | bigint } blocks
32
+ * @property {number | bigint } atimeMs
33
+ * @property {number | bigint } mtimeMs
34
+ * @property {number | bigint } ctimeMs
35
+ * @property {number | bigint } birthtimeMs
36
+ * @property {Date } atime
37
+ * @property {Date } mtime
38
+ * @property {Date } ctime
39
+ * @property {Date } birthtime
40
+ */
41
+
42
+ /**
43
+ * @typedef {Object } IDirent
44
+ * @property {() => boolean } isFile
45
+ * @property {() => boolean } isDirectory
46
+ * @property {() => boolean } isBlockDevice
47
+ * @property {() => boolean } isCharacterDevice
48
+ * @property {() => boolean } isSymbolicLink
49
+ * @property {() => boolean } isFIFO
50
+ * @property {() => boolean } isSocket
51
+ * @property {string | Buffer } name
52
+ */
53
+
14
54
/** @typedef {function(NodeJS.ErrnoException=): void } Callback */
15
55
/** @typedef {function(NodeJS.ErrnoException=, Buffer=): void } BufferCallback */
16
56
/** @typedef {function(NodeJS.ErrnoException=, Buffer|string=): void } BufferOrStringCallback */
17
- /** @typedef {function(NodeJS.ErrnoException=, string[] =): void } StringArrayCallback */
57
+ /** @typedef {function(NodeJS.ErrnoException=, ( string | Buffer)[] | IDirent[] =): void } DirentArrayCallback */
18
58
/** @typedef {function(NodeJS.ErrnoException=, string=): void } StringCallback */
19
59
/** @typedef {function(NodeJS.ErrnoException=, number=): void } NumberCallback */
20
- /** @typedef {function(NodeJS.ErrnoException=, NodeFsStats =): void } StatsCallback */
60
+ /** @typedef {function(NodeJS.ErrnoException=, IStats =): void } StatsCallback */
21
61
/** @typedef {function((NodeJS.ErrnoException | Error)=, any=): void } ReadJsonCallback */
22
62
23
63
/**
@@ -45,20 +85,20 @@ const path = require("path");
45
85
* @property {function(string, Buffer|string, Callback): void } writeFile
46
86
* @property {function(string, Callback): void } mkdir
47
87
* @property {function(string, StatsCallback): void } stat
48
- * @property {function(string, BufferCallback ): void } readFile
88
+ * @property {function(string, BufferOrStringCallback ): void } readFile
49
89
* @property {(function(string, string): string)= } join
50
90
* @property {(function(string, string): string)= } relative
51
91
* @property {(function(string): string)= } dirname
52
92
*/
53
93
54
94
/**
55
95
* @typedef {Object } InputFileSystem
56
- * @property {function(string, BufferCallback ): void } readFile
96
+ * @property {function(string, BufferOrStringCallback ): void } readFile
57
97
* @property {(function(string, ReadJsonCallback): void)= } readJson
58
98
* @property {function(string, BufferOrStringCallback): void } readlink
59
- * @property {function(string, StringArrayCallback ): void } readdir
99
+ * @property {function(string, DirentArrayCallback ): void } readdir
60
100
* @property {function(string, StatsCallback): void } stat
61
- * @property {(function(string, StringCallback ): void)= } realpath
101
+ * @property {(function(string, BufferOrStringCallback ): void)= } realpath
62
102
* @property {(function(string=): void)= } purge
63
103
* @property {(function(string, string): string)= } join
64
104
* @property {(function(string, string): string)= } relative
@@ -73,7 +113,7 @@ const path = require("path");
73
113
/**
74
114
* @typedef {Object } IntermediateFileSystemExtras
75
115
* @property {function(string): void } mkdirSync
76
- * @property {function(string): import("fs").WriteStream } createWriteStream
116
+ * @property {function(string): NodeJS.WritableStream } createWriteStream
77
117
* @property {function(string, string, NumberCallback): void } open
78
118
* @property {function(number, Buffer, number, number, number, NumberCallback): void } read
79
119
* @property {function(number, Callback): void } close
0 commit comments