@types/node 26.2.0 → 26.4.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.
- node/README.md +1 -1
- node/buffer.buffer.d.ts +10 -5
- node/crypto.d.ts +2 -4
- node/dgram.d.ts +119 -4
- node/fs/promises.d.ts +61 -65
- node/fs.d.ts +86 -76
- node/http.d.ts +17 -1
- node/http2.d.ts +12 -4
- node/index.d.ts +1 -0
- node/inspector.d.ts +2 -1
- node/net.d.ts +108 -16
- node/package.json +2 -2
- node/process.d.ts +52 -0
- node/quic.d.ts +246 -38
- node/sqlite.d.ts +6 -2
- node/stream/iter.d.ts +4 -4
- node/test.d.ts +36 -0
- node/tls.d.ts +24 -0
- node/ts5.6/buffer.buffer.d.ts +5 -0
- node/ts5.6/index.d.ts +1 -0
- node/ts5.7/index.d.ts +1 -0
- node/tty.d.ts +4 -3
- node/vfs.d.ts +210 -0
- node/vm.d.ts +1 -1
node/vfs.d.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
declare module "node:vfs" {
|
|
2
|
+
/**
|
|
3
|
+
* Convenience factory equivalent to `new VirtualFileSystem(provider, options)`.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* const vfs = require('node:vfs');
|
|
7
|
+
*
|
|
8
|
+
* // Default in-memory provider
|
|
9
|
+
* const memoryVfs = vfs.create();
|
|
10
|
+
*
|
|
11
|
+
* // Explicit provider
|
|
12
|
+
* const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/sandbox'));
|
|
13
|
+
* ```
|
|
14
|
+
* @since v26.4.0
|
|
15
|
+
* @param provider The provider to use. **Default:** `new MemoryProvider()`.
|
|
16
|
+
*/
|
|
17
|
+
function create(provider?: VirtualProvider, options?: VirtualFileSystemOptions): VirtualFileSystem;
|
|
18
|
+
function create(options: VirtualFileSystemOptions): VirtualFileSystem;
|
|
19
|
+
interface VirtualFileSystemOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Whether to emit the experimental warning. **Default:** `true`.
|
|
22
|
+
*/
|
|
23
|
+
emitExperimentalWarning?: boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A `VirtualFileSystem` wraps a {@link VirtualProvider} and exposes a
|
|
27
|
+
* `node:fs`-like API. Each instance maintains its own file tree.
|
|
28
|
+
* @since v26.4.0
|
|
29
|
+
*/
|
|
30
|
+
class VirtualFileSystem {
|
|
31
|
+
/**
|
|
32
|
+
* @param provider The provider to use. **Default:** `new MemoryProvider()`.
|
|
33
|
+
*/
|
|
34
|
+
constructor(provider?: VirtualProvider, options?: VirtualFileSystemOptions);
|
|
35
|
+
constructor(options: VirtualFileSystemOptions);
|
|
36
|
+
/**
|
|
37
|
+
* The provider backing this VFS instance.
|
|
38
|
+
* @since v26.4.0
|
|
39
|
+
*/
|
|
40
|
+
readonly provider: VirtualProvider;
|
|
41
|
+
/**
|
|
42
|
+
* `true` when the underlying provider is read-only.
|
|
43
|
+
* @since v26.4.0
|
|
44
|
+
*/
|
|
45
|
+
readonly readonly: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface VirtualFileSystem extends
|
|
48
|
+
// Synchronous API
|
|
49
|
+
Pick<
|
|
50
|
+
typeof import("node:fs"),
|
|
51
|
+
| "existsSync"
|
|
52
|
+
| "statSync"
|
|
53
|
+
| "lstatSync"
|
|
54
|
+
| "readFileSync"
|
|
55
|
+
| "writeFileSync"
|
|
56
|
+
| "appendFileSync"
|
|
57
|
+
| "readdirSync"
|
|
58
|
+
| "mkdirSync"
|
|
59
|
+
| "rmdirSync"
|
|
60
|
+
| "unlinkSync"
|
|
61
|
+
| "renameSync"
|
|
62
|
+
| "copyFileSync"
|
|
63
|
+
| "realpathSync"
|
|
64
|
+
| "readlinkSync"
|
|
65
|
+
| "symlinkSync"
|
|
66
|
+
| "accessSync"
|
|
67
|
+
| "rmSync"
|
|
68
|
+
| "truncateSync"
|
|
69
|
+
| "ftruncateSync"
|
|
70
|
+
| "linkSync"
|
|
71
|
+
| "chmodSync"
|
|
72
|
+
| "chownSync"
|
|
73
|
+
| "utimesSync"
|
|
74
|
+
| "lutimesSync"
|
|
75
|
+
| "mkdtempSync"
|
|
76
|
+
| "opendirSync"
|
|
77
|
+
| "openAsBlob"
|
|
78
|
+
| "openSync"
|
|
79
|
+
| "closeSync"
|
|
80
|
+
| "readSync"
|
|
81
|
+
| "writeSync"
|
|
82
|
+
| "fstatSync"
|
|
83
|
+
| "createReadStream"
|
|
84
|
+
| "createWriteStream"
|
|
85
|
+
| "watch"
|
|
86
|
+
| "watchFile"
|
|
87
|
+
| "unwatchFile"
|
|
88
|
+
>,
|
|
89
|
+
// Callback API
|
|
90
|
+
Pick<
|
|
91
|
+
typeof import("node:fs"),
|
|
92
|
+
| "readFile"
|
|
93
|
+
| "writeFile"
|
|
94
|
+
| "stat"
|
|
95
|
+
| "lstat"
|
|
96
|
+
| "readdir"
|
|
97
|
+
| "realpath"
|
|
98
|
+
| "readlink"
|
|
99
|
+
| "access"
|
|
100
|
+
| "open"
|
|
101
|
+
| "close"
|
|
102
|
+
| "read"
|
|
103
|
+
| "write"
|
|
104
|
+
| "rm"
|
|
105
|
+
| "fstat"
|
|
106
|
+
| "truncate"
|
|
107
|
+
| "ftruncate"
|
|
108
|
+
| "link"
|
|
109
|
+
| "mkdtemp"
|
|
110
|
+
| "opendir"
|
|
111
|
+
>
|
|
112
|
+
{
|
|
113
|
+
// Promise API
|
|
114
|
+
readonly promises: Pick<
|
|
115
|
+
typeof import("node:fs/promises"),
|
|
116
|
+
| "readFile"
|
|
117
|
+
| "writeFile"
|
|
118
|
+
| "appendFile"
|
|
119
|
+
| "stat"
|
|
120
|
+
| "lstat"
|
|
121
|
+
| "readdir"
|
|
122
|
+
| "mkdir"
|
|
123
|
+
| "rmdir"
|
|
124
|
+
| "unlink"
|
|
125
|
+
| "rename"
|
|
126
|
+
| "copyFile"
|
|
127
|
+
| "realpath"
|
|
128
|
+
| "readlink"
|
|
129
|
+
| "symlink"
|
|
130
|
+
| "access"
|
|
131
|
+
| "rm"
|
|
132
|
+
| "truncate"
|
|
133
|
+
| "link"
|
|
134
|
+
| "mkdtemp"
|
|
135
|
+
| "chmod"
|
|
136
|
+
| "chown"
|
|
137
|
+
| "lchown"
|
|
138
|
+
| "utimes"
|
|
139
|
+
| "lutimes"
|
|
140
|
+
| "open"
|
|
141
|
+
| "lchmod"
|
|
142
|
+
| "watch"
|
|
143
|
+
>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The base class for all VFS providers. Subclasses implement the essential
|
|
147
|
+
* primitives (such as `open`, `stat`, `readdir`, `mkdir`, `rmdir`, `unlink`,
|
|
148
|
+
* `rename`, etc.) and inherit default implementations of the derived
|
|
149
|
+
* methods (such as `readFile`, `writeFile`, `exists`, `copyFile`, `access`, etc.).
|
|
150
|
+
* @since v26.4.0
|
|
151
|
+
*/
|
|
152
|
+
abstract class VirtualProvider {
|
|
153
|
+
get readonly(): boolean;
|
|
154
|
+
get supportsSymlinks(): boolean;
|
|
155
|
+
get supportsWatch(): boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The default in-memory provider. Stores files, directories, and symbolic
|
|
159
|
+
* links in a `Map`-backed tree, supports symlinks (`supportsSymlinks ===
|
|
160
|
+
* true`), and supports watching (`supportsWatch === true`).
|
|
161
|
+
* @since v26.4.0
|
|
162
|
+
*/
|
|
163
|
+
class MemoryProvider extends VirtualProvider {
|
|
164
|
+
/**
|
|
165
|
+
* Locks the provider into read-only mode. Subsequent writes through any
|
|
166
|
+
* `VirtualFileSystem` using this provider throw `EROFS`. There is no
|
|
167
|
+
* way to revert the provider to writable.
|
|
168
|
+
*
|
|
169
|
+
* ```js
|
|
170
|
+
* const vfs = require('node:vfs');
|
|
171
|
+
*
|
|
172
|
+
* const provider = new vfs.MemoryProvider();
|
|
173
|
+
* const myVfs = vfs.create(provider);
|
|
174
|
+
* myVfs.writeFileSync('/seed.txt', 'initial');
|
|
175
|
+
*
|
|
176
|
+
* provider.setReadOnly();
|
|
177
|
+
*
|
|
178
|
+
* myVfs.writeFileSync('/x.txt', 'fail'); // throws EROFS
|
|
179
|
+
* ```
|
|
180
|
+
* @since v26.4.0
|
|
181
|
+
*/
|
|
182
|
+
setReadOnly(): void;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A provider that wraps a directory (i.e. one on the actual file system) and exposes its
|
|
186
|
+
* contents through the VFS API. All VFS paths are resolved relative to
|
|
187
|
+
* the root and verified to stay inside it; symbolic links resolving
|
|
188
|
+
* outside the root are rejected.
|
|
189
|
+
* @since v26.4.0
|
|
190
|
+
*/
|
|
191
|
+
class RealFSProvider extends VirtualProvider {
|
|
192
|
+
/**
|
|
193
|
+
* ```js
|
|
194
|
+
* const vfs = require('node:vfs');
|
|
195
|
+
*
|
|
196
|
+
* const realVfs = vfs.create(new vfs.RealFSProvider('/tmp/sandbox'));
|
|
197
|
+
* realVfs.writeFileSync('/file.txt', 'hello'); // writes /tmp/sandbox/file.txt
|
|
198
|
+
* ```
|
|
199
|
+
* @since v26.4.0
|
|
200
|
+
* @param rootPath The absolute file-system path to use as the root.
|
|
201
|
+
* Must be a non-empty string.
|
|
202
|
+
*/
|
|
203
|
+
constructor(rootPath: string);
|
|
204
|
+
/**
|
|
205
|
+
* The resolved absolute path used as the root.
|
|
206
|
+
* @since v26.4.0
|
|
207
|
+
*/
|
|
208
|
+
readonly rootPath: string;
|
|
209
|
+
}
|
|
210
|
+
}
|
node/vm.d.ts
CHANGED
|
@@ -741,7 +741,7 @@ declare module "node:vm" {
|
|
|
741
741
|
*/
|
|
742
742
|
status: ModuleStatus;
|
|
743
743
|
/**
|
|
744
|
-
* Evaluate the module and its
|
|
744
|
+
* Evaluate the module and its dependencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of
|
|
745
745
|
* [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification.
|
|
746
746
|
*
|
|
747
747
|
* If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated;
|