@types/node 22.18.13 → 22.19.1

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.
Files changed (74) hide show
  1. {node v22.18 → node v22.19}/README.md +1 -1
  2. node v22.19/assert/strict.d.ts +111 -0
  3. {node v22.18 → node v22.19}/assert.d.ts +100 -95
  4. {node v22.18 → node v22.19}/dns.d.ts +5 -0
  5. {node v22.18 → node v22.19}/http.d.ts +28 -3
  6. {node v22.18 → node v22.19}/index.d.ts +1 -0
  7. node v22.19/inspector.d.ts +253 -0
  8. {node v22.18 → node v22.19}/inspector.generated.d.ts +727 -886
  9. {node v22.18 → node v22.19}/net.d.ts +21 -0
  10. {node v22.18 → node v22.19}/package.json +2 -2
  11. {node v22.18 → node v22.19}/process.d.ts +19 -0
  12. {node v22.18 → node v22.19}/sqlite.d.ts +7 -0
  13. {node v22.18 → node v22.19}/tls.d.ts +32 -0
  14. {node v22.18 → node v22.19}/ts5.6/index.d.ts +1 -0
  15. {node v22.18 → node v22.19}/url.d.ts +8 -5
  16. {node v22.18 → node v22.19}/util.d.ts +11 -4
  17. {node v22.18 → node v22.19}/worker_threads.d.ts +7 -0
  18. {node v22.18 → node v22.19}/zlib.d.ts +6 -0
  19. node v22.18/assert/strict.d.ts +0 -8
  20. {node v22.18 → node v22.19}/LICENSE +0 -0
  21. {node v22.18 → node v22.19}/async_hooks.d.ts +0 -0
  22. {node v22.18 → node v22.19}/buffer.buffer.d.ts +0 -0
  23. {node v22.18 → node v22.19}/buffer.d.ts +0 -0
  24. {node v22.18 → node v22.19}/child_process.d.ts +0 -0
  25. {node v22.18 → node v22.19}/cluster.d.ts +0 -0
  26. {node v22.18 → node v22.19}/compatibility/disposable.d.ts +0 -0
  27. {node v22.18 → node v22.19}/compatibility/index.d.ts +0 -0
  28. {node v22.18 → node v22.19}/compatibility/indexable.d.ts +0 -0
  29. {node v22.18 → node v22.19}/compatibility/iterators.d.ts +0 -0
  30. {node v22.18 → node v22.19}/console.d.ts +0 -0
  31. {node v22.18 → node v22.19}/constants.d.ts +0 -0
  32. {node v22.18 → node v22.19}/crypto.d.ts +0 -0
  33. {node v22.18 → node v22.19}/dgram.d.ts +0 -0
  34. {node v22.18 → node v22.19}/diagnostics_channel.d.ts +0 -0
  35. {node v22.18 → node v22.19}/dns/promises.d.ts +0 -0
  36. {node v22.18 → node v22.19}/domain.d.ts +0 -0
  37. {node v22.18 → node v22.19}/events.d.ts +0 -0
  38. {node v22.18 → node v22.19}/fs/promises.d.ts +0 -0
  39. {node v22.18 → node v22.19}/fs.d.ts +0 -0
  40. {node v22.18 → node v22.19}/globals.d.ts +0 -0
  41. {node v22.18 → node v22.19}/globals.typedarray.d.ts +0 -0
  42. {node v22.18 → node v22.19}/http2.d.ts +0 -0
  43. {node v22.18 → node v22.19}/https.d.ts +0 -0
  44. {node v22.18 → node v22.19}/module.d.ts +0 -0
  45. {node v22.18 → node v22.19}/os.d.ts +0 -0
  46. {node v22.18 → node v22.19}/path.d.ts +0 -0
  47. {node v22.18 → node v22.19}/perf_hooks.d.ts +0 -0
  48. {node v22.18 → node v22.19}/punycode.d.ts +0 -0
  49. {node v22.18 → node v22.19}/querystring.d.ts +0 -0
  50. {node v22.18 → node v22.19}/readline/promises.d.ts +0 -0
  51. {node v22.18 → node v22.19}/readline.d.ts +0 -0
  52. {node v22.18 → node v22.19}/repl.d.ts +0 -0
  53. {node v22.18 → node v22.19}/sea.d.ts +0 -0
  54. {node v22.18 → node v22.19}/stream/consumers.d.ts +0 -0
  55. {node v22.18 → node v22.19}/stream/promises.d.ts +0 -0
  56. {node v22.18 → node v22.19}/stream/web.d.ts +0 -0
  57. {node v22.18 → node v22.19}/stream.d.ts +0 -0
  58. {node v22.18 → node v22.19}/string_decoder.d.ts +0 -0
  59. {node v22.18 → node v22.19}/test.d.ts +0 -0
  60. {node v22.18 → node v22.19}/timers/promises.d.ts +0 -0
  61. {node v22.18 → node v22.19}/timers.d.ts +0 -0
  62. {node v22.18 → node v22.19}/trace_events.d.ts +0 -0
  63. {node v22.18 → node v22.19}/ts5.6/buffer.buffer.d.ts +0 -0
  64. {node v22.18 → node v22.19}/ts5.6/globals.typedarray.d.ts +0 -0
  65. {node v22.18 → node v22.19}/tty.d.ts +0 -0
  66. {node v22.18 → node v22.19}/v8.d.ts +0 -0
  67. {node v22.18 → node v22.19}/vm.d.ts +0 -0
  68. {node v22.18 → node v22.19}/wasi.d.ts +0 -0
  69. {node v22.18 → node v22.19}/web-globals/abortcontroller.d.ts +0 -0
  70. {node v22.18 → node v22.19}/web-globals/domexception.d.ts +0 -0
  71. {node v22.18 → node v22.19}/web-globals/events.d.ts +0 -0
  72. {node v22.18 → node v22.19}/web-globals/fetch.d.ts +0 -0
  73. {node v22.18 → node v22.19}/web-globals/navigator.d.ts +0 -0
  74. {node v22.18 → node v22.19}/web-globals/storage.d.ts +0 -0
@@ -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/v22.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 28 Oct 2025 17:37:26 GMT
11
+ * Last updated: Tue, 11 Nov 2025 23:33:13 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -0,0 +1,111 @@
1
+ /**
2
+ * In strict assertion mode, non-strict methods behave like their corresponding
3
+ * strict methods. For example, `assert.deepEqual()` will behave like
4
+ * `assert.deepStrictEqual()`.
5
+ *
6
+ * In strict assertion mode, error messages for objects display a diff. In legacy
7
+ * assertion mode, error messages for objects display the objects, often truncated.
8
+ *
9
+ * To use strict assertion mode:
10
+ *
11
+ * ```js
12
+ * import { strict as assert } from 'node:assert';
13
+ * ```
14
+ *
15
+ * ```js
16
+ * import assert from 'node:assert/strict';
17
+ * ```
18
+ *
19
+ * Example error diff:
20
+ *
21
+ * ```js
22
+ * import { strict as assert } from 'node:assert';
23
+ *
24
+ * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
25
+ * // AssertionError: Expected inputs to be strictly deep-equal:
26
+ * // + actual - expected ... Lines skipped
27
+ * //
28
+ * // [
29
+ * // [
30
+ * // ...
31
+ * // 2,
32
+ * // + 3
33
+ * // - '3'
34
+ * // ],
35
+ * // ...
36
+ * // 5
37
+ * // ]
38
+ * ```
39
+ *
40
+ * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS`
41
+ * environment variables. This will also deactivate the colors in the REPL. For
42
+ * more on color support in terminal environments, read the tty
43
+ * [`getColorDepth()`](https://nodejs.org/docs/latest-v22.x/api/tty.html#writestreamgetcolordepthenv) documentation.
44
+ * @since v15.0.0
45
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert/strict.js)
46
+ */
47
+ declare module "assert/strict" {
48
+ import {
49
+ Assert,
50
+ AssertionError,
51
+ AssertionErrorOptions,
52
+ AssertOptions,
53
+ AssertPredicate,
54
+ AssertStrict,
55
+ CallTracker,
56
+ CallTrackerCall,
57
+ CallTrackerReportInformation,
58
+ deepStrictEqual,
59
+ doesNotMatch,
60
+ doesNotReject,
61
+ doesNotThrow,
62
+ fail,
63
+ ifError,
64
+ match,
65
+ notDeepStrictEqual,
66
+ notStrictEqual,
67
+ ok,
68
+ partialDeepStrictEqual,
69
+ rejects,
70
+ strictEqual,
71
+ throws,
72
+ } from "node:assert";
73
+ function strict(value: unknown, message?: string | Error): asserts value;
74
+ namespace strict {
75
+ export {
76
+ Assert,
77
+ AssertionError,
78
+ AssertionErrorOptions,
79
+ AssertOptions,
80
+ AssertPredicate,
81
+ AssertStrict,
82
+ CallTracker,
83
+ CallTrackerCall,
84
+ CallTrackerReportInformation,
85
+ deepStrictEqual,
86
+ deepStrictEqual as deepEqual,
87
+ doesNotMatch,
88
+ doesNotReject,
89
+ doesNotThrow,
90
+ fail,
91
+ ifError,
92
+ match,
93
+ notDeepStrictEqual,
94
+ notDeepStrictEqual as notDeepEqual,
95
+ notStrictEqual,
96
+ notStrictEqual as notEqual,
97
+ ok,
98
+ partialDeepStrictEqual,
99
+ rejects,
100
+ strict,
101
+ strictEqual,
102
+ strictEqual as equal,
103
+ throws,
104
+ };
105
+ }
106
+ export = strict;
107
+ }
108
+ declare module "node:assert/strict" {
109
+ import strict = require("assert/strict");
110
+ export = strict;
111
+ }
@@ -4,12 +4,14 @@
4
4
  * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/assert.js)
5
5
  */
6
6
  declare module "assert" {
7
+ import strict = require("assert/strict");
7
8
  /**
8
- * An alias of {@link ok}.
9
+ * An alias of {@link assert.ok}.
9
10
  * @since v0.5.9
10
11
  * @param value The input that is checked for being truthy.
11
12
  */
12
13
  function assert(value: unknown, message?: string | Error): asserts value;
14
+ const kOptions: unique symbol;
13
15
  namespace assert {
14
16
  type AssertMethodNames =
15
17
  | "deepEqual"
@@ -30,10 +32,100 @@ declare module "assert" {
30
32
  | "rejects"
31
33
  | "strictEqual"
32
34
  | "throws";
35
+ interface AssertOptions {
36
+ /**
37
+ * If set to `'full'`, shows the full diff in assertion errors.
38
+ * @default 'simple'
39
+ */
40
+ diff?: "simple" | "full" | undefined;
41
+ /**
42
+ * If set to `true`, non-strict methods behave like their
43
+ * corresponding strict methods.
44
+ * @default true
45
+ */
46
+ strict?: boolean | undefined;
47
+ }
48
+ interface Assert extends Pick<typeof assert, AssertMethodNames> {
49
+ readonly [kOptions]: AssertOptions & { strict: false };
50
+ }
51
+ interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {
52
+ readonly [kOptions]: AssertOptions & { strict: true };
53
+ }
54
+ /**
55
+ * The `Assert` class allows creating independent assertion instances with custom options.
56
+ * @since v22.19.0
57
+ */
58
+ var Assert: {
59
+ /**
60
+ * Creates a new assertion instance. The `diff` option controls the verbosity of diffs in assertion error messages.
61
+ *
62
+ * ```js
63
+ * const { Assert } = require('node:assert');
64
+ * const assertInstance = new Assert({ diff: 'full' });
65
+ * assertInstance.deepStrictEqual({ a: 1 }, { a: 2 });
66
+ * // Shows a full diff in the error message.
67
+ * ```
68
+ *
69
+ * **Important**: When destructuring assertion methods from an `Assert` instance,
70
+ * the methods lose their connection to the instance's configuration options (such as `diff` and `strict` settings).
71
+ * The destructured methods will fall back to default behavior instead.
72
+ *
73
+ * ```js
74
+ * const myAssert = new Assert({ diff: 'full' });
75
+ *
76
+ * // This works as expected - uses 'full' diff
77
+ * myAssert.strictEqual({ a: 1 }, { b: { c: 1 } });
78
+ *
79
+ * // This loses the 'full' diff setting - falls back to default 'simple' diff
80
+ * const { strictEqual } = myAssert;
81
+ * strictEqual({ a: 1 }, { b: { c: 1 } });
82
+ * ```
83
+ *
84
+ * When destructured, methods lose access to the instance's `this` context and revert to default assertion behavior
85
+ * (diff: 'simple', non-strict mode).
86
+ * To maintain custom options when using destructured methods, avoid
87
+ * destructuring and call methods directly on the instance.
88
+ * @since v22.19.0
89
+ */
90
+ new(
91
+ options?: AssertOptions & { strict?: true },
92
+ ): AssertStrict;
93
+ new(
94
+ options: AssertOptions,
95
+ ): Assert;
96
+ };
97
+ interface AssertionErrorOptions {
98
+ /**
99
+ * If provided, the error message is set to this value.
100
+ */
101
+ message?: string | undefined;
102
+ /**
103
+ * The `actual` property on the error instance.
104
+ */
105
+ actual?: unknown;
106
+ /**
107
+ * The `expected` property on the error instance.
108
+ */
109
+ expected?: unknown;
110
+ /**
111
+ * The `operator` property on the error instance.
112
+ */
113
+ operator?: string | undefined;
114
+ /**
115
+ * If provided, the generated stack trace omits frames before this function.
116
+ */
117
+ stackStartFn?: Function | undefined;
118
+ /**
119
+ * If set to `'full'`, shows the full diff in assertion errors.
120
+ * @default 'simple'
121
+ */
122
+ diff?: "simple" | "full" | undefined;
123
+ }
33
124
  /**
34
125
  * Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
35
126
  */
36
127
  class AssertionError extends Error {
128
+ constructor(options: AssertionErrorOptions);
37
129
  /**
38
130
  * Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
39
131
  */
@@ -42,10 +134,6 @@ declare module "assert" {
42
134
  * Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
43
135
  */
44
136
  expected: unknown;
45
- /**
46
- * Set to the passed in operator value.
47
- */
48
- operator: string;
49
137
  /**
50
138
  * Indicates if the message was auto-generated (`true`) or not.
51
139
  */
@@ -54,19 +142,10 @@ declare module "assert" {
54
142
  * Value is always `ERR_ASSERTION` to show that the error is an assertion error.
55
143
  */
56
144
  code: "ERR_ASSERTION";
57
- constructor(options?: {
58
- /** If provided, the error message is set to this value. */
59
- message?: string | undefined;
60
- /** The `actual` property on the error instance. */
61
- actual?: unknown | undefined;
62
- /** The `expected` property on the error instance. */
63
- expected?: unknown | undefined;
64
- /** The `operator` property on the error instance. */
65
- operator?: string | undefined;
66
- /** If provided, the generated stack trace omits frames before this function. */
67
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
68
- stackStartFn?: Function | undefined;
69
- });
145
+ /**
146
+ * Set to the passed in operator value.
147
+ */
148
+ operator: string;
70
149
  }
71
150
  /**
72
151
  * This feature is deprecated and will be removed in a future version.
@@ -987,83 +1066,9 @@ declare module "assert" {
987
1066
  * @since v22.13.0
988
1067
  */
989
1068
  function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
990
- /**
991
- * In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
992
- * {@link deepEqual} will behave like {@link deepStrictEqual}.
993
- *
994
- * In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
995
- * messages for objects display the objects, often truncated.
996
- *
997
- * To use strict assertion mode:
998
- *
999
- * ```js
1000
- * import { strict as assert } from 'node:assert';
1001
- * import assert from 'node:assert/strict';
1002
- * ```
1003
- *
1004
- * Example error diff:
1005
- *
1006
- * ```js
1007
- * import { strict as assert } from 'node:assert';
1008
- *
1009
- * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
1010
- * // AssertionError: Expected inputs to be strictly deep-equal:
1011
- * // + actual - expected ... Lines skipped
1012
- * //
1013
- * // [
1014
- * // [
1015
- * // ...
1016
- * // 2,
1017
- * // + 3
1018
- * // - '3'
1019
- * // ],
1020
- * // ...
1021
- * // 5
1022
- * // ]
1023
- * ```
1024
- *
1025
- * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
1026
- * deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
1027
- * `getColorDepth()` documentation.
1028
- *
1029
- * @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
1030
- */
1031
- namespace strict {
1032
- type AssertionError = assert.AssertionError;
1033
- type AssertPredicate = assert.AssertPredicate;
1034
- type CallTrackerCall = assert.CallTrackerCall;
1035
- type CallTrackerReportInformation = assert.CallTrackerReportInformation;
1036
- }
1037
- const strict:
1038
- & Omit<
1039
- typeof assert,
1040
- | "equal"
1041
- | "notEqual"
1042
- | "deepEqual"
1043
- | "notDeepEqual"
1044
- | "ok"
1045
- | "strictEqual"
1046
- | "deepStrictEqual"
1047
- | "ifError"
1048
- | "strict"
1049
- | "AssertionError"
1050
- >
1051
- & {
1052
- (value: unknown, message?: string | Error): asserts value;
1053
- equal: typeof strictEqual;
1054
- notEqual: typeof notStrictEqual;
1055
- deepEqual: typeof deepStrictEqual;
1056
- notDeepEqual: typeof notDeepStrictEqual;
1057
- // Mapped types and assertion functions are incompatible?
1058
- // TS2775: Assertions require every name in the call target
1059
- // to be declared with an explicit type annotation.
1060
- ok: typeof ok;
1061
- strictEqual: typeof strictEqual;
1062
- deepStrictEqual: typeof deepStrictEqual;
1063
- ifError: typeof ifError;
1064
- strict: typeof strict;
1065
- AssertionError: typeof AssertionError;
1066
- };
1069
+ }
1070
+ namespace assert {
1071
+ export { strict };
1067
1072
  }
1068
1073
  export = assert;
1069
1074
  }
@@ -830,6 +830,11 @@ declare module "dns" {
830
830
  * @default 4
831
831
  */
832
832
  tries?: number | undefined;
833
+ /**
834
+ * The max retry timeout, in milliseconds.
835
+ * @default 0
836
+ */
837
+ maxTimeout?: number | undefined;
833
838
  }
834
839
  /**
835
840
  * An independent resolver for DNS requests.
@@ -269,6 +269,13 @@ declare module "http" {
269
269
  * @since v18.0.0
270
270
  */
271
271
  keepAliveTimeout?: number | undefined;
272
+ /**
273
+ * An additional buffer time added to the
274
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
275
+ * @since 22.19.0
276
+ * @default 1000
277
+ */
278
+ keepAliveTimeoutBuffer?: number | undefined;
272
279
  /**
273
280
  * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests.
274
281
  * @default 30000
@@ -413,12 +420,18 @@ declare module "http" {
413
420
  /**
414
421
  * The number of milliseconds of inactivity a server needs to wait for additional
415
422
  * incoming data, after it has finished writing the last response, before a socket
416
- * will be destroyed. If the server receives new data before the keep-alive
417
- * timeout has fired, it will reset the regular inactivity timeout, i.e., `server.timeout`.
423
+ * will be destroyed.
424
+ *
425
+ * This timeout value is combined with the
426
+ * `server.keepAliveTimeoutBuffer` option to determine the actual socket
427
+ * timeout, calculated as:
428
+ * socketTimeout = keepAliveTimeout + keepAliveTimeoutBuffer
429
+ * If the server receives new data before the keep-alive timeout has fired, it
430
+ * will reset the regular inactivity timeout, i.e., `server.timeout`.
418
431
  *
419
432
  * A value of `0` will disable the keep-alive timeout behavior on incoming
420
433
  * connections.
421
- * A value of `0` makes the http server behave similarly to Node.js versions prior
434
+ * A value of `0` makes the HTTP server behave similarly to Node.js versions prior
422
435
  * to 8.0.0, which did not have a keep-alive timeout.
423
436
  *
424
437
  * The socket timeout logic is set up on connection, so changing this value only
@@ -426,6 +439,18 @@ declare module "http" {
426
439
  * @since v8.0.0
427
440
  */
428
441
  keepAliveTimeout: number;
442
+ /**
443
+ * An additional buffer time added to the
444
+ * `server.keepAliveTimeout` to extend the internal socket timeout.
445
+ *
446
+ * This buffer helps reduce connection reset (`ECONNRESET`) errors by increasing
447
+ * the socket timeout slightly beyond the advertised keep-alive timeout.
448
+ *
449
+ * This option applies only to new incoming connections.
450
+ * @since v22.19.0
451
+ * @default 1000
452
+ */
453
+ keepAliveTimeoutBuffer: number;
429
454
  /**
430
455
  * Sets the timeout value in milliseconds for receiving the entire request from
431
456
  * the client.
@@ -62,6 +62,7 @@
62
62
  /// <reference path="http.d.ts" />
63
63
  /// <reference path="http2.d.ts" />
64
64
  /// <reference path="https.d.ts" />
65
+ /// <reference path="inspector.d.ts" />
65
66
  /// <reference path="inspector.generated.d.ts" />
66
67
  /// <reference path="module.d.ts" />
67
68
  /// <reference path="net.d.ts" />
@@ -0,0 +1,253 @@
1
+ /**
2
+ * The `node:inspector` module provides an API for interacting with the V8
3
+ * inspector.
4
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector.js)
5
+ */
6
+ declare module "inspector" {
7
+ import EventEmitter = require("node:events");
8
+ /**
9
+ * The `inspector.Session` is used for dispatching messages to the V8 inspector
10
+ * back-end and receiving message responses and notifications.
11
+ */
12
+ class Session extends EventEmitter {
13
+ /**
14
+ * Create a new instance of the inspector.Session class.
15
+ * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.
16
+ */
17
+ constructor();
18
+ /**
19
+ * Connects a session to the inspector back-end.
20
+ */
21
+ connect(): void;
22
+ /**
23
+ * Connects a session to the inspector back-end.
24
+ * An exception will be thrown if this API was not called on a Worker thread.
25
+ * @since v12.11.0
26
+ */
27
+ connectToMainThread(): void;
28
+ /**
29
+ * Immediately close the session. All pending message callbacks will be called with an error.
30
+ * `session.connect()` will need to be called to be able to send messages again.
31
+ * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.
32
+ */
33
+ disconnect(): void;
34
+ }
35
+ /**
36
+ * Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has
37
+ * started.
38
+ *
39
+ * If wait is `true`, will block until a client has connected to the inspect port
40
+ * and flow control has been passed to the debugger client.
41
+ *
42
+ * See the [security warning](https://nodejs.org/docs/latest-v22.x/api/cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure)
43
+ * regarding the `host` parameter usage.
44
+ * @param port Port to listen on for inspector connections. Defaults to what was specified on the CLI.
45
+ * @param host Host to listen on for inspector connections. Defaults to what was specified on the CLI.
46
+ * @param wait Block until a client has connected. Defaults to what was specified on the CLI.
47
+ * @returns Disposable that calls `inspector.close()`.
48
+ */
49
+ function open(port?: number, host?: string, wait?: boolean): Disposable;
50
+ /**
51
+ * Deactivate the inspector. Blocks until there are no active connections.
52
+ */
53
+ function close(): void;
54
+ /**
55
+ * Return the URL of the active inspector, or `undefined` if there is none.
56
+ *
57
+ * ```console
58
+ * $ node --inspect -p 'inspector.url()'
59
+ * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
60
+ * For help, see: https://nodejs.org/en/docs/inspector
61
+ * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34
62
+ *
63
+ * $ node --inspect=localhost:3000 -p 'inspector.url()'
64
+ * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
65
+ * For help, see: https://nodejs.org/en/docs/inspector
66
+ * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a
67
+ *
68
+ * $ node -p 'inspector.url()'
69
+ * undefined
70
+ * ```
71
+ */
72
+ function url(): string | undefined;
73
+ /**
74
+ * Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command.
75
+ *
76
+ * An exception will be thrown if there is no active inspector.
77
+ * @since v12.7.0
78
+ */
79
+ function waitForDebugger(): void;
80
+ // These methods are exposed by the V8 inspector console API (inspector/v8-console.h).
81
+ // The method signatures differ from those of the Node.js console, and are deliberately
82
+ // typed permissively.
83
+ interface InspectorConsole {
84
+ debug(...data: any[]): void;
85
+ error(...data: any[]): void;
86
+ info(...data: any[]): void;
87
+ log(...data: any[]): void;
88
+ warn(...data: any[]): void;
89
+ dir(...data: any[]): void;
90
+ dirxml(...data: any[]): void;
91
+ table(...data: any[]): void;
92
+ trace(...data: any[]): void;
93
+ group(...data: any[]): void;
94
+ groupCollapsed(...data: any[]): void;
95
+ groupEnd(...data: any[]): void;
96
+ clear(...data: any[]): void;
97
+ count(label?: any): void;
98
+ countReset(label?: any): void;
99
+ assert(value?: any, ...data: any[]): void;
100
+ profile(label?: any): void;
101
+ profileEnd(label?: any): void;
102
+ time(label?: any): void;
103
+ timeLog(label?: any): void;
104
+ timeStamp(label?: any): void;
105
+ }
106
+ /**
107
+ * An object to send messages to the remote inspector console.
108
+ * @since v11.0.0
109
+ */
110
+ const console: InspectorConsole;
111
+ // DevTools protocol event broadcast methods
112
+ namespace Network {
113
+ /**
114
+ * This feature is only available with the `--experimental-network-inspection` flag enabled.
115
+ *
116
+ * Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that
117
+ * the application is about to send an HTTP request.
118
+ * @since v22.6.0
119
+ */
120
+ function requestWillBeSent(params: RequestWillBeSentEventDataType): void;
121
+ /**
122
+ * This feature is only available with the `--experimental-network-inspection` flag enabled.
123
+ *
124
+ * Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if
125
+ * `Network.streamResourceContent` command was not invoked for the given request yet.
126
+ *
127
+ * Also enables `Network.getResponseBody` command to retrieve the response data.
128
+ * @since v22.17.0
129
+ */
130
+ function dataReceived(params: DataReceivedEventDataType): void;
131
+ /**
132
+ * This feature is only available with the `--experimental-network-inspection` flag enabled.
133
+ *
134
+ * Enables `Network.getRequestPostData` command to retrieve the request data.
135
+ * @since v22.18.0
136
+ */
137
+ function dataSent(params: unknown): void;
138
+ /**
139
+ * This feature is only available with the `--experimental-network-inspection` flag enabled.
140
+ *
141
+ * Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that
142
+ * HTTP response is available.
143
+ * @since v22.6.0
144
+ */
145
+ function responseReceived(params: ResponseReceivedEventDataType): void;
146
+ /**
147
+ * This feature is only available with the `--experimental-network-inspection` flag enabled.
148
+ *
149
+ * Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that
150
+ * HTTP request has finished loading.
151
+ * @since v22.6.0
152
+ */
153
+ function loadingFinished(params: LoadingFinishedEventDataType): void;
154
+ /**
155
+ * This feature is only available with the `--experimental-network-inspection` flag enabled.
156
+ *
157
+ * Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that
158
+ * HTTP request has failed to load.
159
+ * @since v22.7.0
160
+ */
161
+ function loadingFailed(params: LoadingFailedEventDataType): void;
162
+ }
163
+ namespace NetworkResources {
164
+ /**
165
+ * This feature is only available with the `--experimental-inspector-network-resource` flag enabled.
166
+ *
167
+ * The inspector.NetworkResources.put method is used to provide a response for a loadNetworkResource
168
+ * request issued via the Chrome DevTools Protocol (CDP).
169
+ * This is typically triggered when a source map is specified by URL, and a DevTools frontend—such as
170
+ * Chrome—requests the resource to retrieve the source map.
171
+ *
172
+ * This method allows developers to predefine the resource content to be served in response to such CDP requests.
173
+ *
174
+ * ```js
175
+ * const inspector = require('node:inspector');
176
+ * // By preemptively calling put to register the resource, a source map can be resolved when
177
+ * // a loadNetworkResource request is made from the frontend.
178
+ * async function setNetworkResources() {
179
+ * const mapUrl = 'http://localhost:3000/dist/app.js.map';
180
+ * const tsUrl = 'http://localhost:3000/src/app.ts';
181
+ * const distAppJsMap = await fetch(mapUrl).then((res) => res.text());
182
+ * const srcAppTs = await fetch(tsUrl).then((res) => res.text());
183
+ * inspector.NetworkResources.put(mapUrl, distAppJsMap);
184
+ * inspector.NetworkResources.put(tsUrl, srcAppTs);
185
+ * };
186
+ * setNetworkResources().then(() => {
187
+ * require('./dist/app');
188
+ * });
189
+ * ```
190
+ *
191
+ * For more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)
192
+ * @since v22.19.0
193
+ * @experimental
194
+ */
195
+ function put(url: string, data: string): void;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * The `node:inspector` module provides an API for interacting with the V8
201
+ * inspector.
202
+ */
203
+ declare module "node:inspector" {
204
+ export * from "inspector";
205
+ }
206
+
207
+ /**
208
+ * The `node:inspector/promises` module provides an API for interacting with the V8
209
+ * inspector.
210
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/inspector/promises.js)
211
+ * @since v19.0.0
212
+ */
213
+ declare module "inspector/promises" {
214
+ import EventEmitter = require("node:events");
215
+ export { close, console, NetworkResources, open, url, waitForDebugger } from "inspector";
216
+ /**
217
+ * The `inspector.Session` is used for dispatching messages to the V8 inspector
218
+ * back-end and receiving message responses and notifications.
219
+ * @since v19.0.0
220
+ */
221
+ export class Session extends EventEmitter {
222
+ /**
223
+ * Create a new instance of the inspector.Session class.
224
+ * The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.
225
+ */
226
+ constructor();
227
+ /**
228
+ * Connects a session to the inspector back-end.
229
+ */
230
+ connect(): void;
231
+ /**
232
+ * Connects a session to the inspector back-end.
233
+ * An exception will be thrown if this API was not called on a Worker thread.
234
+ * @since v12.11.0
235
+ */
236
+ connectToMainThread(): void;
237
+ /**
238
+ * Immediately close the session. All pending message callbacks will be called with an error.
239
+ * `session.connect()` will need to be called to be able to send messages again.
240
+ * Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.
241
+ */
242
+ disconnect(): void;
243
+ }
244
+ }
245
+
246
+ /**
247
+ * The `node:inspector/promises` module provides an API for interacting with the V8
248
+ * inspector.
249
+ * @since v19.0.0
250
+ */
251
+ declare module "node:inspector/promises" {
252
+ export * from "inspector/promises";
253
+ }