@types/node 24.2.1 → 24.3.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/child_process.d.ts +25 -121
- node/fs/promises.d.ts +19 -26
- node/fs.d.ts +19 -35
- node/inspector.d.ts +56 -0
- node/package.json +2 -2
- node/test.d.ts +104 -0
- node/url.d.ts +11 -0
node/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated: Fri,
|
11
|
+
* Last updated: Fri, 15 Aug 2025 08:39:32 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node/child_process.d.ts
CHANGED
@@ -66,7 +66,6 @@
|
|
66
66
|
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/child_process.js)
|
67
67
|
*/
|
68
68
|
declare module "child_process" {
|
69
|
-
import { ObjectEncodingOptions } from "node:fs";
|
70
69
|
import { Abortable, EventEmitter } from "node:events";
|
71
70
|
import * as dgram from "node:dgram";
|
72
71
|
import * as net from "node:net";
|
@@ -887,12 +886,13 @@ declare module "child_process" {
|
|
887
886
|
signal?: AbortSignal | undefined;
|
888
887
|
maxBuffer?: number | undefined;
|
889
888
|
killSignal?: NodeJS.Signals | number | undefined;
|
889
|
+
encoding?: string | null | undefined;
|
890
890
|
}
|
891
891
|
interface ExecOptionsWithStringEncoding extends ExecOptions {
|
892
|
-
encoding
|
892
|
+
encoding?: BufferEncoding | undefined;
|
893
893
|
}
|
894
894
|
interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
895
|
-
encoding:
|
895
|
+
encoding: "buffer" | null; // specify `null`.
|
896
896
|
}
|
897
897
|
interface ExecException extends Error {
|
898
898
|
cmd?: string | undefined;
|
@@ -995,38 +995,19 @@ declare module "child_process" {
|
|
995
995
|
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
996
996
|
function exec(
|
997
997
|
command: string,
|
998
|
-
options:
|
999
|
-
encoding: "buffer" | null;
|
1000
|
-
} & ExecOptions,
|
998
|
+
options: ExecOptionsWithBufferEncoding,
|
1001
999
|
callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
1002
1000
|
): ChildProcess;
|
1003
|
-
// `options` with well
|
1004
|
-
function exec(
|
1005
|
-
command: string,
|
1006
|
-
options: {
|
1007
|
-
encoding: BufferEncoding;
|
1008
|
-
} & ExecOptions,
|
1009
|
-
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
1010
|
-
): ChildProcess;
|
1011
|
-
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
1012
|
-
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
1013
|
-
function exec(
|
1014
|
-
command: string,
|
1015
|
-
options: {
|
1016
|
-
encoding: BufferEncoding;
|
1017
|
-
} & ExecOptions,
|
1018
|
-
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1019
|
-
): ChildProcess;
|
1020
|
-
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
1001
|
+
// `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
|
1021
1002
|
function exec(
|
1022
1003
|
command: string,
|
1023
|
-
options:
|
1004
|
+
options: ExecOptionsWithStringEncoding,
|
1024
1005
|
callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
|
1025
1006
|
): ChildProcess;
|
1026
1007
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
1027
1008
|
function exec(
|
1028
1009
|
command: string,
|
1029
|
-
options:
|
1010
|
+
options: ExecOptions | undefined | null,
|
1030
1011
|
callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1031
1012
|
): ChildProcess;
|
1032
1013
|
interface PromiseWithChild<T> extends Promise<T> {
|
@@ -1039,32 +1020,21 @@ declare module "child_process" {
|
|
1039
1020
|
}>;
|
1040
1021
|
function __promisify__(
|
1041
1022
|
command: string,
|
1042
|
-
options:
|
1043
|
-
encoding: "buffer" | null;
|
1044
|
-
} & ExecOptions,
|
1023
|
+
options: ExecOptionsWithBufferEncoding,
|
1045
1024
|
): PromiseWithChild<{
|
1046
1025
|
stdout: Buffer;
|
1047
1026
|
stderr: Buffer;
|
1048
1027
|
}>;
|
1049
1028
|
function __promisify__(
|
1050
1029
|
command: string,
|
1051
|
-
options:
|
1052
|
-
encoding: BufferEncoding;
|
1053
|
-
} & ExecOptions,
|
1030
|
+
options: ExecOptionsWithStringEncoding,
|
1054
1031
|
): PromiseWithChild<{
|
1055
1032
|
stdout: string;
|
1056
1033
|
stderr: string;
|
1057
1034
|
}>;
|
1058
1035
|
function __promisify__(
|
1059
1036
|
command: string,
|
1060
|
-
options: ExecOptions,
|
1061
|
-
): PromiseWithChild<{
|
1062
|
-
stdout: string;
|
1063
|
-
stderr: string;
|
1064
|
-
}>;
|
1065
|
-
function __promisify__(
|
1066
|
-
command: string,
|
1067
|
-
options?: (ObjectEncodingOptions & ExecOptions) | null,
|
1037
|
+
options: ExecOptions | undefined | null,
|
1068
1038
|
): PromiseWithChild<{
|
1069
1039
|
stdout: string | Buffer;
|
1070
1040
|
stderr: string | Buffer;
|
@@ -1076,16 +1046,16 @@ declare module "child_process" {
|
|
1076
1046
|
windowsVerbatimArguments?: boolean | undefined;
|
1077
1047
|
shell?: boolean | string | undefined;
|
1078
1048
|
signal?: AbortSignal | undefined;
|
1049
|
+
encoding?: string | null | undefined;
|
1079
1050
|
}
|
1080
1051
|
interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
1081
|
-
encoding
|
1052
|
+
encoding?: BufferEncoding | undefined;
|
1082
1053
|
}
|
1083
1054
|
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
1084
1055
|
encoding: "buffer" | null;
|
1085
1056
|
}
|
1086
|
-
|
1087
|
-
|
1088
|
-
}
|
1057
|
+
/** @deprecated Use `ExecFileOptions` instead. */
|
1058
|
+
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {}
|
1089
1059
|
type ExecFileException =
|
1090
1060
|
& Omit<ExecException, "code">
|
1091
1061
|
& Omit<NodeJS.ErrnoException, "code">
|
@@ -1154,80 +1124,44 @@ declare module "child_process" {
|
|
1154
1124
|
* @param args List of string arguments.
|
1155
1125
|
* @param callback Called with the output when process terminates.
|
1156
1126
|
*/
|
1157
|
-
function execFile(file: string): ChildProcess;
|
1158
|
-
function execFile(
|
1159
|
-
file: string,
|
1160
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1161
|
-
): ChildProcess;
|
1162
|
-
function execFile(file: string, args?: readonly string[] | null): ChildProcess;
|
1163
|
-
function execFile(
|
1164
|
-
file: string,
|
1165
|
-
args: readonly string[] | undefined | null,
|
1166
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1167
|
-
): ChildProcess;
|
1168
1127
|
// no `options` definitely means stdout/stderr are `string`.
|
1169
1128
|
function execFile(
|
1170
1129
|
file: string,
|
1171
|
-
callback
|
1130
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1172
1131
|
): ChildProcess;
|
1173
1132
|
function execFile(
|
1174
1133
|
file: string,
|
1175
1134
|
args: readonly string[] | undefined | null,
|
1176
|
-
callback
|
1135
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1177
1136
|
): ChildProcess;
|
1178
1137
|
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
1179
1138
|
function execFile(
|
1180
1139
|
file: string,
|
1181
1140
|
options: ExecFileOptionsWithBufferEncoding,
|
1182
|
-
callback
|
1141
|
+
callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
1183
1142
|
): ChildProcess;
|
1184
1143
|
function execFile(
|
1185
1144
|
file: string,
|
1186
1145
|
args: readonly string[] | undefined | null,
|
1187
1146
|
options: ExecFileOptionsWithBufferEncoding,
|
1188
|
-
callback
|
1147
|
+
callback?: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
1189
1148
|
): ChildProcess;
|
1190
|
-
// `options` with well
|
1149
|
+
// `options` with well-known or absent `encoding` means stdout/stderr are definitely `string`.
|
1191
1150
|
function execFile(
|
1192
1151
|
file: string,
|
1193
1152
|
options: ExecFileOptionsWithStringEncoding,
|
1194
|
-
callback
|
1153
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1195
1154
|
): ChildProcess;
|
1196
1155
|
function execFile(
|
1197
1156
|
file: string,
|
1198
1157
|
args: readonly string[] | undefined | null,
|
1199
1158
|
options: ExecFileOptionsWithStringEncoding,
|
1200
|
-
callback
|
1201
|
-
): ChildProcess;
|
1202
|
-
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
1203
|
-
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
1204
|
-
function execFile(
|
1205
|
-
file: string,
|
1206
|
-
options: ExecFileOptionsWithOtherEncoding,
|
1207
|
-
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1208
|
-
): ChildProcess;
|
1209
|
-
function execFile(
|
1210
|
-
file: string,
|
1211
|
-
args: readonly string[] | undefined | null,
|
1212
|
-
options: ExecFileOptionsWithOtherEncoding,
|
1213
|
-
callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
1214
|
-
): ChildProcess;
|
1215
|
-
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
1216
|
-
function execFile(
|
1217
|
-
file: string,
|
1218
|
-
options: ExecFileOptions,
|
1219
|
-
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1220
|
-
): ChildProcess;
|
1221
|
-
function execFile(
|
1222
|
-
file: string,
|
1223
|
-
args: readonly string[] | undefined | null,
|
1224
|
-
options: ExecFileOptions,
|
1225
|
-
callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1159
|
+
callback?: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
1226
1160
|
): ChildProcess;
|
1227
1161
|
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
1228
1162
|
function execFile(
|
1229
1163
|
file: string,
|
1230
|
-
options:
|
1164
|
+
options: ExecFileOptions | undefined | null,
|
1231
1165
|
callback:
|
1232
1166
|
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
1233
1167
|
| undefined
|
@@ -1236,7 +1170,7 @@ declare module "child_process" {
|
|
1236
1170
|
function execFile(
|
1237
1171
|
file: string,
|
1238
1172
|
args: readonly string[] | undefined | null,
|
1239
|
-
options:
|
1173
|
+
options: ExecFileOptions | undefined | null,
|
1240
1174
|
callback:
|
1241
1175
|
| ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
|
1242
1176
|
| undefined
|
@@ -1286,37 +1220,7 @@ declare module "child_process" {
|
|
1286
1220
|
}>;
|
1287
1221
|
function __promisify__(
|
1288
1222
|
file: string,
|
1289
|
-
options:
|
1290
|
-
): PromiseWithChild<{
|
1291
|
-
stdout: string | Buffer;
|
1292
|
-
stderr: string | Buffer;
|
1293
|
-
}>;
|
1294
|
-
function __promisify__(
|
1295
|
-
file: string,
|
1296
|
-
args: readonly string[] | undefined | null,
|
1297
|
-
options: ExecFileOptionsWithOtherEncoding,
|
1298
|
-
): PromiseWithChild<{
|
1299
|
-
stdout: string | Buffer;
|
1300
|
-
stderr: string | Buffer;
|
1301
|
-
}>;
|
1302
|
-
function __promisify__(
|
1303
|
-
file: string,
|
1304
|
-
options: ExecFileOptions,
|
1305
|
-
): PromiseWithChild<{
|
1306
|
-
stdout: string;
|
1307
|
-
stderr: string;
|
1308
|
-
}>;
|
1309
|
-
function __promisify__(
|
1310
|
-
file: string,
|
1311
|
-
args: readonly string[] | undefined | null,
|
1312
|
-
options: ExecFileOptions,
|
1313
|
-
): PromiseWithChild<{
|
1314
|
-
stdout: string;
|
1315
|
-
stderr: string;
|
1316
|
-
}>;
|
1317
|
-
function __promisify__(
|
1318
|
-
file: string,
|
1319
|
-
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
1223
|
+
options: ExecFileOptions | undefined | null,
|
1320
1224
|
): PromiseWithChild<{
|
1321
1225
|
stdout: string | Buffer;
|
1322
1226
|
stderr: string | Buffer;
|
@@ -1324,7 +1228,7 @@ declare module "child_process" {
|
|
1324
1228
|
function __promisify__(
|
1325
1229
|
file: string,
|
1326
1230
|
args: readonly string[] | undefined | null,
|
1327
|
-
options:
|
1231
|
+
options: ExecFileOptions | undefined | null,
|
1328
1232
|
): PromiseWithChild<{
|
1329
1233
|
stdout: string | Buffer;
|
1330
1234
|
stderr: string | Buffer;
|
node/fs/promises.d.ts
CHANGED
@@ -40,7 +40,7 @@ declare module "fs/promises" {
|
|
40
40
|
StatsFs,
|
41
41
|
TimeLike,
|
42
42
|
WatchEventType,
|
43
|
-
WatchOptions,
|
43
|
+
WatchOptions as _WatchOptions,
|
44
44
|
WriteStream,
|
45
45
|
WriteVResult,
|
46
46
|
} from "node:fs";
|
@@ -1182,6 +1182,16 @@ declare module "fs/promises" {
|
|
1182
1182
|
* @return Fulfills with an {fs.Dir}.
|
1183
1183
|
*/
|
1184
1184
|
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
1185
|
+
interface WatchOptions extends _WatchOptions {
|
1186
|
+
maxQueue?: number | undefined;
|
1187
|
+
overflow?: "ignore" | "throw" | undefined;
|
1188
|
+
}
|
1189
|
+
interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
1190
|
+
encoding: "buffer";
|
1191
|
+
}
|
1192
|
+
interface WatchOptionsWithStringEncoding extends WatchOptions {
|
1193
|
+
encoding?: BufferEncoding | undefined;
|
1194
|
+
}
|
1185
1195
|
/**
|
1186
1196
|
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
1187
1197
|
*
|
@@ -1214,33 +1224,16 @@ declare module "fs/promises" {
|
|
1214
1224
|
*/
|
1215
1225
|
function watch(
|
1216
1226
|
filename: PathLike,
|
1217
|
-
options
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
):
|
1223
|
-
/**
|
1224
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
1225
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
1226
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
1227
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
1228
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
1229
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
1230
|
-
*/
|
1231
|
-
function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
|
1232
|
-
/**
|
1233
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
1234
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
1235
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
1236
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
1237
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
1238
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
1239
|
-
*/
|
1227
|
+
options?: WatchOptionsWithStringEncoding | BufferEncoding,
|
1228
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string>>;
|
1229
|
+
function watch(
|
1230
|
+
filename: PathLike,
|
1231
|
+
options: WatchOptionsWithBufferEncoding | "buffer",
|
1232
|
+
): NodeJS.AsyncIterator<FileChangeInfo<Buffer>>;
|
1240
1233
|
function watch(
|
1241
1234
|
filename: PathLike,
|
1242
|
-
options: WatchOptions |
|
1243
|
-
):
|
1235
|
+
options: WatchOptions | BufferEncoding | "buffer",
|
1236
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string | Buffer>>;
|
1244
1237
|
/**
|
1245
1238
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
1246
1239
|
* including subdirectories and files.
|
node/fs.d.ts
CHANGED
@@ -323,15 +323,17 @@ declare module "fs" {
|
|
323
323
|
*/
|
324
324
|
readSync(): Dirent | null;
|
325
325
|
/**
|
326
|
-
*
|
326
|
+
* Calls `dir.close()` if the directory handle is open, and returns a promise that
|
327
|
+
* fulfills when disposal is complete.
|
327
328
|
* @since v24.1.0
|
328
329
|
*/
|
329
|
-
[Symbol.
|
330
|
+
[Symbol.asyncDispose](): Promise<void>;
|
330
331
|
/**
|
331
|
-
*
|
332
|
+
* Calls `dir.closeSync()` if the directory handle is open, and returns
|
333
|
+
* `undefined`.
|
332
334
|
* @since v24.1.0
|
333
335
|
*/
|
334
|
-
[Symbol.
|
336
|
+
[Symbol.dispose](): void;
|
335
337
|
}
|
336
338
|
/**
|
337
339
|
* Class: fs.StatWatcher
|
@@ -3331,6 +3333,12 @@ declare module "fs" {
|
|
3331
3333
|
persistent?: boolean | undefined;
|
3332
3334
|
recursive?: boolean | undefined;
|
3333
3335
|
}
|
3336
|
+
export interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
3337
|
+
encoding: "buffer";
|
3338
|
+
}
|
3339
|
+
export interface WatchOptionsWithStringEncoding extends WatchOptions {
|
3340
|
+
encoding?: BufferEncoding | undefined;
|
3341
|
+
}
|
3334
3342
|
export type WatchEventType = "rename" | "change";
|
3335
3343
|
export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
|
3336
3344
|
export type StatsListener = (curr: Stats, prev: Stats) => void;
|
@@ -3357,44 +3365,20 @@ declare module "fs" {
|
|
3357
3365
|
*/
|
3358
3366
|
export function watch(
|
3359
3367
|
filename: PathLike,
|
3360
|
-
options
|
3361
|
-
|
3362
|
-
encoding: "buffer";
|
3363
|
-
})
|
3364
|
-
| "buffer",
|
3365
|
-
listener?: WatchListener<Buffer>,
|
3368
|
+
options?: WatchOptionsWithStringEncoding | BufferEncoding | null,
|
3369
|
+
listener?: WatchListener<string>,
|
3366
3370
|
): FSWatcher;
|
3367
|
-
/**
|
3368
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
3369
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
3370
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
3371
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
3372
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
3373
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
3374
|
-
*/
|
3375
3371
|
export function watch(
|
3376
3372
|
filename: PathLike,
|
3377
|
-
options
|
3378
|
-
listener
|
3373
|
+
options: WatchOptionsWithBufferEncoding | "buffer",
|
3374
|
+
listener: WatchListener<Buffer>,
|
3379
3375
|
): FSWatcher;
|
3380
|
-
/**
|
3381
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
3382
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
3383
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
3384
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
3385
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
3386
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
3387
|
-
*/
|
3388
3376
|
export function watch(
|
3389
3377
|
filename: PathLike,
|
3390
|
-
options: WatchOptions |
|
3391
|
-
listener
|
3378
|
+
options: WatchOptions | BufferEncoding | "buffer" | null,
|
3379
|
+
listener: WatchListener<string | Buffer>,
|
3392
3380
|
): FSWatcher;
|
3393
|
-
|
3394
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
3395
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
3396
|
-
*/
|
3397
|
-
export function watch(filename: PathLike, listener?: WatchListener<string>): FSWatcher;
|
3381
|
+
export function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
|
3398
3382
|
/**
|
3399
3383
|
* Test whether or not the given path exists by checking with the file system.
|
3400
3384
|
* Then call the `callback` argument with either true or false:
|
node/inspector.d.ts
CHANGED
@@ -1759,6 +1759,7 @@ declare module 'inspector' {
|
|
1759
1759
|
url: string;
|
1760
1760
|
method: string;
|
1761
1761
|
headers: Headers;
|
1762
|
+
hasPostData: boolean;
|
1762
1763
|
}
|
1763
1764
|
/**
|
1764
1765
|
* HTTP response data.
|
@@ -1776,12 +1777,40 @@ declare module 'inspector' {
|
|
1776
1777
|
*/
|
1777
1778
|
interface Headers {
|
1778
1779
|
}
|
1780
|
+
interface GetRequestPostDataParameterType {
|
1781
|
+
/**
|
1782
|
+
* Identifier of the network request to get content for.
|
1783
|
+
*/
|
1784
|
+
requestId: RequestId;
|
1785
|
+
}
|
1786
|
+
interface GetResponseBodyParameterType {
|
1787
|
+
/**
|
1788
|
+
* Identifier of the network request to get content for.
|
1789
|
+
*/
|
1790
|
+
requestId: RequestId;
|
1791
|
+
}
|
1779
1792
|
interface StreamResourceContentParameterType {
|
1780
1793
|
/**
|
1781
1794
|
* Identifier of the request to stream.
|
1782
1795
|
*/
|
1783
1796
|
requestId: RequestId;
|
1784
1797
|
}
|
1798
|
+
interface GetRequestPostDataReturnType {
|
1799
|
+
/**
|
1800
|
+
* Request body string, omitting files from multipart requests
|
1801
|
+
*/
|
1802
|
+
postData: string;
|
1803
|
+
}
|
1804
|
+
interface GetResponseBodyReturnType {
|
1805
|
+
/**
|
1806
|
+
* Response body.
|
1807
|
+
*/
|
1808
|
+
body: string;
|
1809
|
+
/**
|
1810
|
+
* True, if content was sent as base64.
|
1811
|
+
*/
|
1812
|
+
base64Encoded: boolean;
|
1813
|
+
}
|
1785
1814
|
interface StreamResourceContentReturnType {
|
1786
1815
|
/**
|
1787
1816
|
* Data that has been buffered until streaming is enabled.
|
@@ -2285,6 +2314,16 @@ declare module 'inspector' {
|
|
2285
2314
|
* Enables network tracking, network events will now be delivered to the client.
|
2286
2315
|
*/
|
2287
2316
|
post(method: 'Network.enable', callback?: (err: Error | null) => void): void;
|
2317
|
+
/**
|
2318
|
+
* Returns post data sent with the request. Returns an error when no data was sent with the request.
|
2319
|
+
*/
|
2320
|
+
post(method: 'Network.getRequestPostData', params?: Network.GetRequestPostDataParameterType, callback?: (err: Error | null, params: Network.GetRequestPostDataReturnType) => void): void;
|
2321
|
+
post(method: 'Network.getRequestPostData', callback?: (err: Error | null, params: Network.GetRequestPostDataReturnType) => void): void;
|
2322
|
+
/**
|
2323
|
+
* Returns content served for the given request.
|
2324
|
+
*/
|
2325
|
+
post(method: 'Network.getResponseBody', params?: Network.GetResponseBodyParameterType, callback?: (err: Error | null, params: Network.GetResponseBodyReturnType) => void): void;
|
2326
|
+
post(method: 'Network.getResponseBody', callback?: (err: Error | null, params: Network.GetResponseBodyReturnType) => void): void;
|
2288
2327
|
/**
|
2289
2328
|
* Enables streaming of the response for the given requestId.
|
2290
2329
|
* If enabled, the dataReceived event contains the data that was received during streaming.
|
@@ -3062,9 +3101,18 @@ declare module 'inspector' {
|
|
3062
3101
|
*
|
3063
3102
|
* Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if
|
3064
3103
|
* `Network.streamResourceContent` command was not invoked for the given request yet.
|
3104
|
+
*
|
3105
|
+
* Also enables `Network.getResponseBody` command to retrieve the response data.
|
3065
3106
|
* @since v24.2.0
|
3066
3107
|
*/
|
3067
3108
|
function dataReceived(params: DataReceivedEventDataType): void;
|
3109
|
+
/**
|
3110
|
+
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
3111
|
+
*
|
3112
|
+
* Enables `Network.getRequestPostData` command to retrieve the request data.
|
3113
|
+
* @since v24.3.0
|
3114
|
+
*/
|
3115
|
+
function dataSent(params: unknown): void;
|
3068
3116
|
/**
|
3069
3117
|
* This feature is only available with the `--experimental-network-inspection` flag enabled.
|
3070
3118
|
*
|
@@ -3450,6 +3498,14 @@ declare module 'inspector/promises' {
|
|
3450
3498
|
* Enables network tracking, network events will now be delivered to the client.
|
3451
3499
|
*/
|
3452
3500
|
post(method: 'Network.enable'): Promise<void>;
|
3501
|
+
/**
|
3502
|
+
* Returns post data sent with the request. Returns an error when no data was sent with the request.
|
3503
|
+
*/
|
3504
|
+
post(method: 'Network.getRequestPostData', params?: Network.GetRequestPostDataParameterType): Promise<Network.GetRequestPostDataReturnType>;
|
3505
|
+
/**
|
3506
|
+
* Returns content served for the given request.
|
3507
|
+
*/
|
3508
|
+
post(method: 'Network.getResponseBody', params?: Network.GetResponseBodyParameterType): Promise<Network.GetResponseBodyReturnType>;
|
3453
3509
|
/**
|
3454
3510
|
* Enables streaming of the response for the given requestId.
|
3455
3511
|
* If enabled, the dataReceived event contains the data that was received during streaming.
|
node/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "24.
|
3
|
+
"version": "24.3.0",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -150,6 +150,6 @@
|
|
150
150
|
"undici-types": "~7.10.0"
|
151
151
|
},
|
152
152
|
"peerDependencies": {},
|
153
|
-
"typesPublisherContentHash": "
|
153
|
+
"typesPublisherContentHash": "1db0510763ba3afd8e54c0591e60a100a7b90926f5d7da28ae32d8f845d725da",
|
154
154
|
"typeScriptVersion": "5.2"
|
155
155
|
}
|
node/test.d.ts
CHANGED
@@ -1707,6 +1707,46 @@ declare module "node:test" {
|
|
1707
1707
|
* @param options Optional configuration options for the mock module.
|
1708
1708
|
*/
|
1709
1709
|
module(specifier: string, options?: MockModuleOptions): MockModuleContext;
|
1710
|
+
/**
|
1711
|
+
* Creates a mock for a property value on an object. This allows you to track and control access to a specific property,
|
1712
|
+
* including how many times it is read (getter) or written (setter), and to restore the original value after mocking.
|
1713
|
+
*
|
1714
|
+
* ```js
|
1715
|
+
* test('mocks a property value', (t) => {
|
1716
|
+
* const obj = { foo: 42 };
|
1717
|
+
* const prop = t.mock.property(obj, 'foo', 100);
|
1718
|
+
*
|
1719
|
+
* assert.strictEqual(obj.foo, 100);
|
1720
|
+
* assert.strictEqual(prop.mock.accessCount(), 1);
|
1721
|
+
* assert.strictEqual(prop.mock.accesses[0].type, 'get');
|
1722
|
+
* assert.strictEqual(prop.mock.accesses[0].value, 100);
|
1723
|
+
*
|
1724
|
+
* obj.foo = 200;
|
1725
|
+
* assert.strictEqual(prop.mock.accessCount(), 2);
|
1726
|
+
* assert.strictEqual(prop.mock.accesses[1].type, 'set');
|
1727
|
+
* assert.strictEqual(prop.mock.accesses[1].value, 200);
|
1728
|
+
*
|
1729
|
+
* prop.mock.restore();
|
1730
|
+
* assert.strictEqual(obj.foo, 42);
|
1731
|
+
* });
|
1732
|
+
* ```
|
1733
|
+
* @since v24.3.0
|
1734
|
+
* @param object The object whose value is being mocked.
|
1735
|
+
* @param propertyName The identifier of the property on `object` to mock.
|
1736
|
+
* @param value An optional value used as the mock value
|
1737
|
+
* for `object[propertyName]`. **Default:** The original property value.
|
1738
|
+
* @returns A proxy to the mocked object. The mocked object contains a
|
1739
|
+
* special `mock` property, which is an instance of [`MockPropertyContext`][], and
|
1740
|
+
* can be used for inspecting and changing the behavior of the mocked property.
|
1741
|
+
*/
|
1742
|
+
property<
|
1743
|
+
MockedObject extends object,
|
1744
|
+
PropertyName extends keyof MockedObject,
|
1745
|
+
>(
|
1746
|
+
object: MockedObject,
|
1747
|
+
property: PropertyName,
|
1748
|
+
value?: MockedObject[PropertyName],
|
1749
|
+
): MockedObject & { mock: MockPropertyContext<MockedObject[PropertyName]> };
|
1710
1750
|
/**
|
1711
1751
|
* This function restores the default behavior of all mocks that were previously
|
1712
1752
|
* created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be
|
@@ -1876,6 +1916,70 @@ declare module "node:test" {
|
|
1876
1916
|
*/
|
1877
1917
|
restore(): void;
|
1878
1918
|
}
|
1919
|
+
/**
|
1920
|
+
* @since v24.3.0
|
1921
|
+
*/
|
1922
|
+
class MockPropertyContext<PropertyType = any> {
|
1923
|
+
/**
|
1924
|
+
* A getter that returns a copy of the internal array used to track accesses (get/set) to
|
1925
|
+
* the mocked property. Each entry in the array is an object with the following properties:
|
1926
|
+
*/
|
1927
|
+
readonly accesses: Array<{
|
1928
|
+
type: "get" | "set";
|
1929
|
+
value: PropertyType;
|
1930
|
+
stack: Error;
|
1931
|
+
}>;
|
1932
|
+
/**
|
1933
|
+
* This function returns the number of times that the property was accessed.
|
1934
|
+
* This function is more efficient than checking `ctx.accesses.length` because
|
1935
|
+
* `ctx.accesses` is a getter that creates a copy of the internal access tracking array.
|
1936
|
+
* @returns The number of times that the property was accessed (read or written).
|
1937
|
+
*/
|
1938
|
+
accessCount(): number;
|
1939
|
+
/**
|
1940
|
+
* This function is used to change the value returned by the mocked property getter.
|
1941
|
+
* @param value The new value to be set as the mocked property value.
|
1942
|
+
*/
|
1943
|
+
mockImplementation(value: PropertyType): void;
|
1944
|
+
/**
|
1945
|
+
* This function is used to change the behavior of an existing mock for a single
|
1946
|
+
* invocation. Once invocation `onAccess` has occurred, the mock will revert to
|
1947
|
+
* whatever behavior it would have used had `mockImplementationOnce()` not been
|
1948
|
+
* called.
|
1949
|
+
*
|
1950
|
+
* The following example creates a mock function using `t.mock.property()`, calls the
|
1951
|
+
* mock property, changes the mock implementation to a different value for the
|
1952
|
+
* next invocation, and then resumes its previous behavior.
|
1953
|
+
*
|
1954
|
+
* ```js
|
1955
|
+
* test('changes a mock behavior once', (t) => {
|
1956
|
+
* const obj = { foo: 1 };
|
1957
|
+
*
|
1958
|
+
* const prop = t.mock.property(obj, 'foo', 5);
|
1959
|
+
*
|
1960
|
+
* assert.strictEqual(obj.foo, 5);
|
1961
|
+
* prop.mock.mockImplementationOnce(25);
|
1962
|
+
* assert.strictEqual(obj.foo, 25);
|
1963
|
+
* assert.strictEqual(obj.foo, 5);
|
1964
|
+
* });
|
1965
|
+
* ```
|
1966
|
+
* @param value The value to be used as the mock's
|
1967
|
+
* implementation for the invocation number specified by `onAccess`.
|
1968
|
+
* @param onAccess The invocation number that will use `value`. If
|
1969
|
+
* the specified invocation has already occurred then an exception is thrown.
|
1970
|
+
* **Default:** The number of the next invocation.
|
1971
|
+
*/
|
1972
|
+
mockImplementationOnce(value: PropertyType, onAccess?: number): void;
|
1973
|
+
/**
|
1974
|
+
* Resets the access history of the mocked property.
|
1975
|
+
*/
|
1976
|
+
resetAccesses(): void;
|
1977
|
+
/**
|
1978
|
+
* Resets the implementation of the mock property to its original behavior. The
|
1979
|
+
* mock can still be used after calling this function.
|
1980
|
+
*/
|
1981
|
+
restore(): void;
|
1982
|
+
}
|
1879
1983
|
interface MockTimersOptions {
|
1880
1984
|
apis: ReadonlyArray<"setInterval" | "setTimeout" | "setImmediate" | "Date">;
|
1881
1985
|
now?: number | Date | undefined;
|
node/url.d.ts
CHANGED
@@ -315,6 +315,17 @@ declare module "url" {
|
|
315
315
|
* @return The fully-resolved platform-specific Node.js file path.
|
316
316
|
*/
|
317
317
|
function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
|
318
|
+
/**
|
319
|
+
* Like `url.fileURLToPath(...)` except that instead of returning a string
|
320
|
+
* representation of the path, a `Buffer` is returned. This conversion is
|
321
|
+
* helpful when the input URL contains percent-encoded segments that are
|
322
|
+
* not valid UTF-8 / Unicode sequences.
|
323
|
+
* @since v24.3.0
|
324
|
+
* @param url The file URL string or URL object to convert to a path.
|
325
|
+
* @returns The fully-resolved platform-specific Node.js file path
|
326
|
+
* as a `Buffer`.
|
327
|
+
*/
|
328
|
+
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): Buffer;
|
318
329
|
/**
|
319
330
|
* This function ensures that `path` is resolved absolutely, and that the URL
|
320
331
|
* control characters are correctly encoded when converting into a File URL.
|