@types/node 24.11.1 → 24.12.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 v24.11 → node v24.12}/README.md +1 -1
- {node v24.11 → node v24.12}/child_process.d.ts +6 -6
- {node v24.11 → node v24.12}/crypto.d.ts +8 -8
- {node v24.11 → node v24.12}/http.d.ts +31 -11
- {node v24.11 → node v24.12}/https.d.ts +6 -0
- {node v24.11 → node v24.12}/module.d.ts +27 -16
- {node v24.11 → node v24.12}/package.json +2 -2
- {node v24.11 → node v24.12}/perf_hooks.d.ts +125 -65
- {node v24.11 → node v24.12}/process.d.ts +1 -1
- {node v24.11 → node v24.12}/sqlite.d.ts +23 -0
- {node v24.11 → node v24.12}/util.d.ts +9 -1
- {node v24.11 → node v24.12}/v8.d.ts +26 -0
- {node v24.11 → node v24.12}/worker_threads.d.ts +3 -5
- {node v24.11 → node v24.12}/LICENSE +0 -0
- {node v24.11 → node v24.12}/assert/strict.d.ts +0 -0
- {node v24.11 → node v24.12}/assert.d.ts +0 -0
- {node v24.11 → node v24.12}/async_hooks.d.ts +0 -0
- {node v24.11 → node v24.12}/buffer.buffer.d.ts +0 -0
- {node v24.11 → node v24.12}/buffer.d.ts +0 -0
- {node v24.11 → node v24.12}/cluster.d.ts +0 -0
- {node v24.11 → node v24.12}/compatibility/iterators.d.ts +0 -0
- {node v24.11 → node v24.12}/console.d.ts +0 -0
- {node v24.11 → node v24.12}/constants.d.ts +0 -0
- {node v24.11 → node v24.12}/dgram.d.ts +0 -0
- {node v24.11 → node v24.12}/diagnostics_channel.d.ts +0 -0
- {node v24.11 → node v24.12}/dns/promises.d.ts +0 -0
- {node v24.11 → node v24.12}/dns.d.ts +0 -0
- {node v24.11 → node v24.12}/domain.d.ts +0 -0
- {node v24.11 → node v24.12}/events.d.ts +0 -0
- {node v24.11 → node v24.12}/fs/promises.d.ts +0 -0
- {node v24.11 → node v24.12}/fs.d.ts +0 -0
- {node v24.11 → node v24.12}/globals.d.ts +0 -0
- {node v24.11 → node v24.12}/globals.typedarray.d.ts +0 -0
- {node v24.11 → node v24.12}/http2.d.ts +0 -0
- {node v24.11 → node v24.12}/index.d.ts +0 -0
- {node v24.11 → node v24.12}/inspector.d.ts +0 -0
- {node v24.11 → node v24.12}/inspector.generated.d.ts +0 -0
- {node v24.11 → node v24.12}/net.d.ts +0 -0
- {node v24.11 → node v24.12}/os.d.ts +0 -0
- {node v24.11 → node v24.12}/path.d.ts +0 -0
- {node v24.11 → node v24.12}/punycode.d.ts +0 -0
- {node v24.11 → node v24.12}/querystring.d.ts +0 -0
- {node v24.11 → node v24.12}/readline/promises.d.ts +0 -0
- {node v24.11 → node v24.12}/readline.d.ts +0 -0
- {node v24.11 → node v24.12}/repl.d.ts +0 -0
- {node v24.11 → node v24.12}/sea.d.ts +0 -0
- {node v24.11 → node v24.12}/stream/consumers.d.ts +0 -0
- {node v24.11 → node v24.12}/stream/promises.d.ts +0 -0
- {node v24.11 → node v24.12}/stream/web.d.ts +0 -0
- {node v24.11 → node v24.12}/stream.d.ts +0 -0
- {node v24.11 → node v24.12}/string_decoder.d.ts +0 -0
- {node v24.11 → node v24.12}/test.d.ts +0 -0
- {node v24.11 → node v24.12}/timers/promises.d.ts +0 -0
- {node v24.11 → node v24.12}/timers.d.ts +0 -0
- {node v24.11 → node v24.12}/tls.d.ts +0 -0
- {node v24.11 → node v24.12}/trace_events.d.ts +0 -0
- {node v24.11 → node v24.12}/ts5.6/buffer.buffer.d.ts +0 -0
- {node v24.11 → node v24.12}/ts5.6/compatibility/float16array.d.ts +0 -0
- {node v24.11 → node v24.12}/ts5.6/globals.typedarray.d.ts +0 -0
- {node v24.11 → node v24.12}/ts5.6/index.d.ts +0 -0
- {node v24.11 → node v24.12}/ts5.7/compatibility/float16array.d.ts +0 -0
- {node v24.11 → node v24.12}/ts5.7/index.d.ts +0 -0
- {node v24.11 → node v24.12}/tty.d.ts +0 -0
- {node v24.11 → node v24.12}/url.d.ts +0 -0
- {node v24.11 → node v24.12}/vm.d.ts +0 -0
- {node v24.11 → node v24.12}/wasi.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/abortcontroller.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/crypto.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/domexception.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/events.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/fetch.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/navigator.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/storage.d.ts +0 -0
- {node v24.11 → node v24.12}/web-globals/streams.d.ts +0 -0
- {node v24.11 → node v24.12}/zlib.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/v24.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Fri, 06 Mar 2026 05:19:15 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ```js
|
|
7
7
|
* import { spawn } from 'node:child_process';
|
|
8
|
+
* import { once } from 'node:events';
|
|
8
9
|
* const ls = spawn('ls', ['-lh', '/usr']);
|
|
9
10
|
*
|
|
10
11
|
* ls.stdout.on('data', (data) => {
|
|
@@ -15,9 +16,8 @@
|
|
|
15
16
|
* console.error(`stderr: ${data}`);
|
|
16
17
|
* });
|
|
17
18
|
*
|
|
18
|
-
* ls
|
|
19
|
-
*
|
|
20
|
-
* });
|
|
19
|
+
* const [code] = await once(ls, 'close');
|
|
20
|
+
* console.log(`child process exited with code ${code}`);
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
* By default, pipes for `stdin`, `stdout`, and `stderr` are established between
|
|
@@ -719,6 +719,7 @@ declare module "child_process" {
|
|
|
719
719
|
*
|
|
720
720
|
* ```js
|
|
721
721
|
* import { spawn } from 'node:child_process';
|
|
722
|
+
* import { once } from 'node:events';
|
|
722
723
|
* const ls = spawn('ls', ['-lh', '/usr']);
|
|
723
724
|
*
|
|
724
725
|
* ls.stdout.on('data', (data) => {
|
|
@@ -729,9 +730,8 @@ declare module "child_process" {
|
|
|
729
730
|
* console.error(`stderr: ${data}`);
|
|
730
731
|
* });
|
|
731
732
|
*
|
|
732
|
-
* ls
|
|
733
|
-
*
|
|
734
|
-
* });
|
|
733
|
+
* const [code] = await once(ls, 'close');
|
|
734
|
+
* console.log(`child process exited with code ${code}`);
|
|
735
735
|
* ```
|
|
736
736
|
*
|
|
737
737
|
* Example: A very elaborate way to run `ps ax | grep ssh`
|
|
@@ -2709,12 +2709,12 @@ declare module "crypto" {
|
|
|
2709
2709
|
privateKey: T2;
|
|
2710
2710
|
}
|
|
2711
2711
|
/**
|
|
2712
|
-
* Generates a new asymmetric key pair of the given `type`.
|
|
2713
|
-
*
|
|
2712
|
+
* Generates a new asymmetric key pair of the given `type`.
|
|
2713
|
+
* See the supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
2714
2714
|
*
|
|
2715
2715
|
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
|
|
2716
|
-
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
|
|
2717
|
-
* the respective part of the key is returned as a `KeyObject
|
|
2716
|
+
* behaves as if {@link KeyObject.export `keyObject.export()`} had been called on its result. Otherwise,
|
|
2717
|
+
* the respective part of the key is returned as a {@link KeyObject `KeyObject`}.
|
|
2718
2718
|
*
|
|
2719
2719
|
* When encoding public keys, it is recommended to use `'spki'`. When encoding
|
|
2720
2720
|
* private keys, it is recommended to use `'pkcs8'` with a strong passphrase,
|
|
@@ -3007,12 +3007,12 @@ declare module "crypto" {
|
|
|
3007
3007
|
options?: SLHDSAKeyPairKeyObjectOptions,
|
|
3008
3008
|
): KeyPairKeyObjectResult;
|
|
3009
3009
|
/**
|
|
3010
|
-
* Generates a new asymmetric key pair of the given `type`.
|
|
3011
|
-
*
|
|
3010
|
+
* Generates a new asymmetric key pair of the given `type`.
|
|
3011
|
+
* See the supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
3012
3012
|
*
|
|
3013
3013
|
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
|
|
3014
|
-
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
|
|
3015
|
-
* the respective part of the key is returned as a `KeyObject
|
|
3014
|
+
* behaves as if {@link KeyObject.export `keyObject.export()`} had been called on its result. Otherwise,
|
|
3015
|
+
* the respective part of the key is returned as a {@link KeyObject `KeyObject`}.
|
|
3016
3016
|
*
|
|
3017
3017
|
* It is recommended to encode public keys as `'spki'` and private keys as `'pkcs8'` with encryption for long-term storage:
|
|
3018
3018
|
*
|
|
@@ -357,6 +357,14 @@ declare module "http" {
|
|
|
357
357
|
* @since v18.17.0, v20.2.0
|
|
358
358
|
*/
|
|
359
359
|
rejectNonStandardBodyWrites?: boolean | undefined;
|
|
360
|
+
/**
|
|
361
|
+
* If set to `true`, requests without `Content-Length` or `Transfer-Encoding` headers (indicating no body)
|
|
362
|
+
* will be initialized with an already-ended body stream, so they will never emit any stream events
|
|
363
|
+
* (like `'data'` or `'end'`). You can use `req.readableEnded` to detect this case.
|
|
364
|
+
* @default false
|
|
365
|
+
* @since v24.12.0
|
|
366
|
+
*/
|
|
367
|
+
optimizeEmptyRequests?: boolean | undefined;
|
|
360
368
|
}
|
|
361
369
|
type RequestListener<
|
|
362
370
|
Request extends typeof IncomingMessage = typeof IncomingMessage,
|
|
@@ -939,7 +947,7 @@ declare module "http" {
|
|
|
939
947
|
* been transmitted are equal or not.
|
|
940
948
|
*
|
|
941
949
|
* Attempting to set a header field name or value that contains invalid characters
|
|
942
|
-
* will result in a
|
|
950
|
+
* will result in a `Error` being thrown.
|
|
943
951
|
* @since v0.1.30
|
|
944
952
|
*/
|
|
945
953
|
writeHead(
|
|
@@ -1020,6 +1028,7 @@ declare module "http" {
|
|
|
1020
1028
|
*
|
|
1021
1029
|
* ```js
|
|
1022
1030
|
* import http from 'node:http';
|
|
1031
|
+
* const agent = new http.Agent({ keepAlive: true });
|
|
1023
1032
|
*
|
|
1024
1033
|
* // Server has a 5 seconds keep-alive timeout by default
|
|
1025
1034
|
* http
|
|
@@ -1661,20 +1670,31 @@ declare module "http" {
|
|
|
1661
1670
|
/**
|
|
1662
1671
|
* Produces a socket/stream to be used for HTTP requests.
|
|
1663
1672
|
*
|
|
1664
|
-
* By default, this function
|
|
1665
|
-
*
|
|
1673
|
+
* By default, this function behaves identically to `net.createConnection()`, synchronously
|
|
1674
|
+
* returning the created socket. The optional `callback` parameter in the signature is not
|
|
1675
|
+
* used by this default implementation.
|
|
1666
1676
|
*
|
|
1667
|
-
*
|
|
1668
|
-
*
|
|
1677
|
+
* However, custom agents may override this method to provide greater flexibility,
|
|
1678
|
+
* for example, to create sockets asynchronously. When overriding `createConnection`:
|
|
1669
1679
|
*
|
|
1670
|
-
*
|
|
1671
|
-
*
|
|
1672
|
-
*
|
|
1680
|
+
* 1. **Synchronous socket creation**: The overriding method can return the socket/stream directly.
|
|
1681
|
+
* 2. **Asynchronous socket creation**: The overriding method can accept the `callback` and pass
|
|
1682
|
+
* the created socket/stream to it (e.g., `callback(null, newSocket)`). If an error occurs during
|
|
1683
|
+
* socket creation, it should be passed as the first argument to the `callback` (e.g., `callback(err)`).
|
|
1673
1684
|
*
|
|
1674
|
-
* `
|
|
1685
|
+
* The agent will call the provided `createConnection` function with `options` and this internal
|
|
1686
|
+
* `callback`. The `callback` provided by the agent has a signature of `(err, stream)`.
|
|
1675
1687
|
* @since v0.11.4
|
|
1676
|
-
* @param options Options containing connection details. Check `createConnection`
|
|
1677
|
-
*
|
|
1688
|
+
* @param options Options containing connection details. Check `net.createConnection()`
|
|
1689
|
+
* for the format of the options. For custom agents, this object is passed
|
|
1690
|
+
* to the custom `createConnection` function.
|
|
1691
|
+
* @param callback (Optional, primarily for custom agents) A function to be called by a custom
|
|
1692
|
+
* `createConnection` implementation when the socket is created, especially for
|
|
1693
|
+
* asynchronous operations.
|
|
1694
|
+
* @returns `stream.Duplex` The created socket. This is returned by the default implementation
|
|
1695
|
+
* or by a custom synchronous `createConnection` implementation. If a
|
|
1696
|
+
* custom `createConnection` uses the `callback` for asynchronous operation,
|
|
1697
|
+
* this return value might not be the primary way to obtain the socket.
|
|
1678
1698
|
*/
|
|
1679
1699
|
createConnection(
|
|
1680
1700
|
options: ClientRequestArgs,
|
|
@@ -25,6 +25,12 @@ declare module "https" {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
|
|
28
|
+
*
|
|
29
|
+
* Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden to customize
|
|
30
|
+
* how TLS connections are established.
|
|
31
|
+
*
|
|
32
|
+
* > See [`agent.createConnection()`](https://nodejs.org/docs/latest-v24.x/api/http.html#agentcreateconnectionoptions-callback)
|
|
33
|
+
* for details on overriding this method, including asynchronous socket creation with a callback.
|
|
28
34
|
* @since v0.4.5
|
|
29
35
|
*/
|
|
30
36
|
class Agent extends http.Agent {
|
|
@@ -80,37 +80,48 @@ declare module "module" {
|
|
|
80
80
|
*/
|
|
81
81
|
directory?: string;
|
|
82
82
|
}
|
|
83
|
+
interface EnableCompileCacheOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Optional. Directory to store the compile cache. If not specified, the directory specified by
|
|
86
|
+
* the [`NODE_COMPILE_CACHE=dir`](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cachedir)
|
|
87
|
+
* environment variable will be used if it's set, or `path.join(os.tmpdir(), 'node-compile-cache')` otherwise.
|
|
88
|
+
* @since v24.12.0
|
|
89
|
+
*/
|
|
90
|
+
directory?: string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Optional. If `true`, enables portable compile cache so that the cache can be reused even if the project directory
|
|
93
|
+
* is moved. This is a best-effort feature. If not specified, it will depend on whether the environment variable
|
|
94
|
+
* [NODE_COMPILE_CACHE_PORTABLE=1](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cache_portable1) is set.
|
|
95
|
+
* @since v24.12.0
|
|
96
|
+
*/
|
|
97
|
+
portable?: boolean | undefined;
|
|
98
|
+
}
|
|
83
99
|
/**
|
|
84
100
|
* Enable [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
|
|
85
101
|
* in the current Node.js instance.
|
|
86
102
|
*
|
|
87
|
-
*
|
|
88
|
-
* `
|
|
89
|
-
* `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's
|
|
90
|
-
* recommended to call `module.enableCompileCache()` without specifying the `cacheDir`,
|
|
91
|
-
* so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
|
|
103
|
+
* For general use cases, it's recommended to call `module.enableCompileCache()` without specifying the
|
|
104
|
+
* `options.directory`, so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
|
|
92
105
|
* variable when necessary.
|
|
93
106
|
*
|
|
94
|
-
* Since compile cache is supposed to be a
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* field in the returned object would be one of the `module.constants.compileCacheStatus`
|
|
101
|
-
* values to indicate the result of the attempt to enable the
|
|
107
|
+
* Since compile cache is supposed to be a optimization that is not mission critical, this method is
|
|
108
|
+
* designed to not throw any exception when the compile cache cannot be enabled. Instead, it will return
|
|
109
|
+
* an object containing an error message in the `message` field to aid debugging. If compile cache is
|
|
110
|
+
* enabled successfully, the `directory` field in the returned object contains the path to the directory
|
|
111
|
+
* where the compile cache is stored. The `status` field in the returned object would be one of the
|
|
112
|
+
* `module.constants.compileCacheStatus` values to indicate the result of the attempt to enable the
|
|
102
113
|
* [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).
|
|
103
114
|
*
|
|
104
115
|
* This method only affects the current Node.js instance. To enable it in child worker threads,
|
|
105
116
|
* either call this method in child worker threads too, or set the
|
|
106
117
|
* `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can
|
|
107
118
|
* be inherited into the child workers. The directory can be obtained either from the
|
|
108
|
-
* `directory` field returned by this method, or with {@link getCompileCacheDir}.
|
|
119
|
+
* `directory` field returned by this method, or with {@link getCompileCacheDir `module.getCompileCacheDir()`}.
|
|
109
120
|
* @since v22.8.0
|
|
110
|
-
* @param
|
|
121
|
+
* @param options Optional. If a string is passed, it is considered to be `options.directory`.
|
|
111
122
|
* will be stored/retrieved.
|
|
112
123
|
*/
|
|
113
|
-
function enableCompileCache(
|
|
124
|
+
function enableCompileCache(options?: string | EnableCompileCacheOptions): EnableCompileCacheResult;
|
|
114
125
|
/**
|
|
115
126
|
* Flush the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
|
|
116
127
|
* accumulated from modules already loaded
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.12.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.16.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {},
|
|
153
|
-
"typesPublisherContentHash": "
|
|
153
|
+
"typesPublisherContentHash": "2bd5c87e6ae2c44201cb3aab9e54edcee1ed9555c740d1b7788d5f9e9defded9",
|
|
154
154
|
"typeScriptVersion": "5.2"
|
|
155
155
|
}
|
|
@@ -200,14 +200,6 @@ declare module "perf_hooks" {
|
|
|
200
200
|
active: number;
|
|
201
201
|
utilization: number;
|
|
202
202
|
}
|
|
203
|
-
/**
|
|
204
|
-
* @param utilization1 The result of a previous call to `eventLoopUtilization()`.
|
|
205
|
-
* @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
|
|
206
|
-
*/
|
|
207
|
-
type EventLoopUtilityFunction = (
|
|
208
|
-
utilization1?: EventLoopUtilization,
|
|
209
|
-
utilization2?: EventLoopUtilization,
|
|
210
|
-
) => EventLoopUtilization;
|
|
211
203
|
interface MarkOptions {
|
|
212
204
|
/**
|
|
213
205
|
* Additional optional detail to include with the mark.
|
|
@@ -264,11 +256,19 @@ declare module "perf_hooks" {
|
|
|
264
256
|
*/
|
|
265
257
|
clearResourceTimings(name?: string): void;
|
|
266
258
|
/**
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
259
|
+
* This is an alias of `perf_hooks.eventLoopUtilization()`.
|
|
260
|
+
*
|
|
261
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
262
|
+
* @since v14.10.0, v12.19.0
|
|
263
|
+
* @param utilization1 The result of a previous call to
|
|
264
|
+
* `eventLoopUtilization()`.
|
|
265
|
+
* @param utilization2 The result of a previous call to
|
|
266
|
+
* `eventLoopUtilization()` prior to `utilization1`.
|
|
270
267
|
*/
|
|
271
|
-
eventLoopUtilization
|
|
268
|
+
eventLoopUtilization(
|
|
269
|
+
utilization1?: EventLoopUtilization,
|
|
270
|
+
utilization2?: EventLoopUtilization,
|
|
271
|
+
): EventLoopUtilization;
|
|
272
272
|
/**
|
|
273
273
|
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
|
|
274
274
|
* If you are only interested in performance entries of certain types or that have certain names, see
|
|
@@ -371,41 +371,12 @@ declare module "perf_hooks" {
|
|
|
371
371
|
*/
|
|
372
372
|
readonly timeOrigin: number;
|
|
373
373
|
/**
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
* Wraps a function within a new function that measures the running time of the wrapped function.
|
|
377
|
-
* A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed.
|
|
378
|
-
*
|
|
379
|
-
* ```js
|
|
380
|
-
* import {
|
|
381
|
-
* performance,
|
|
382
|
-
* PerformanceObserver,
|
|
383
|
-
* } from 'node:perf_hooks';
|
|
384
|
-
*
|
|
385
|
-
* function someFunction() {
|
|
386
|
-
* console.log('hello world');
|
|
387
|
-
* }
|
|
388
|
-
*
|
|
389
|
-
* const wrapped = performance.timerify(someFunction);
|
|
390
|
-
*
|
|
391
|
-
* const obs = new PerformanceObserver((list) => {
|
|
392
|
-
* console.log(list.getEntries()[0].duration);
|
|
393
|
-
*
|
|
394
|
-
* performance.clearMarks();
|
|
395
|
-
* performance.clearMeasures();
|
|
396
|
-
* obs.disconnect();
|
|
397
|
-
* });
|
|
398
|
-
* obs.observe({ entryTypes: ['function'] });
|
|
399
|
-
*
|
|
400
|
-
* // A performance timeline entry will be created
|
|
401
|
-
* wrapped();
|
|
402
|
-
* ```
|
|
374
|
+
* This is an alias of `perf_hooks.timerify()`.
|
|
403
375
|
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* @param fn
|
|
376
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
377
|
+
* @since v8.5.0
|
|
407
378
|
*/
|
|
408
|
-
timerify<T extends (...
|
|
379
|
+
timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
|
409
380
|
/**
|
|
410
381
|
* An object which is JSON representation of the performance object. It is similar to
|
|
411
382
|
* [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers.
|
|
@@ -844,6 +815,83 @@ declare module "perf_hooks" {
|
|
|
844
815
|
*/
|
|
845
816
|
add(other: RecordableHistogram): void;
|
|
846
817
|
}
|
|
818
|
+
interface CreateHistogramOptions {
|
|
819
|
+
/**
|
|
820
|
+
* The lowest discernible value. Must be an integer value greater than 0.
|
|
821
|
+
* @default 1
|
|
822
|
+
*/
|
|
823
|
+
lowest?: number | bigint | undefined;
|
|
824
|
+
/**
|
|
825
|
+
* The highest recordable value. Must be an integer value that is equal to
|
|
826
|
+
* or greater than two times `lowest`.
|
|
827
|
+
* @default Number.MAX_SAFE_INTEGER
|
|
828
|
+
*/
|
|
829
|
+
highest?: number | bigint | undefined;
|
|
830
|
+
/**
|
|
831
|
+
* The number of accuracy digits. Must be a number between `1` and `5`.
|
|
832
|
+
* @default 3
|
|
833
|
+
*/
|
|
834
|
+
figures?: number | undefined;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Returns a {@link RecordableHistogram `RecordableHistogram`}.
|
|
838
|
+
* @since v15.9.0, v14.18.0
|
|
839
|
+
*/
|
|
840
|
+
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
|
841
|
+
/**
|
|
842
|
+
* The `eventLoopUtilization()` function returns an object that contains the
|
|
843
|
+
* cumulative duration of time the event loop has been both idle and active as a
|
|
844
|
+
* high resolution milliseconds timer. The `utilization` value is the calculated
|
|
845
|
+
* Event Loop Utilization (ELU).
|
|
846
|
+
*
|
|
847
|
+
* If bootstrapping has not yet finished on the main thread the properties have
|
|
848
|
+
* the value of `0`. The ELU is immediately available on
|
|
849
|
+
* [Worker threads](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#worker-threads)
|
|
850
|
+
* since bootstrap happens within the event loop.
|
|
851
|
+
*
|
|
852
|
+
* Both `utilization1` and `utilization2` are optional parameters.
|
|
853
|
+
*
|
|
854
|
+
* If `utilization1` is passed, then the delta between the current call's `active`
|
|
855
|
+
* and `idle` times, as well as the corresponding `utilization` value are
|
|
856
|
+
* calculated and returned (similar to `process.hrtime()`).
|
|
857
|
+
*
|
|
858
|
+
* If `utilization1` and `utilization2` are both passed, then the delta is
|
|
859
|
+
* calculated between the two arguments. This is a convenience option because,
|
|
860
|
+
* unlike `process.hrtime()`, calculating the ELU is more complex than a
|
|
861
|
+
* single subtraction.
|
|
862
|
+
*
|
|
863
|
+
* ELU is similar to CPU utilization, except that it only measures event loop
|
|
864
|
+
* statistics and not CPU usage. It represents the percentage of time the event
|
|
865
|
+
* loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
|
|
866
|
+
* No other CPU idle time is taken into consideration. The following is an example
|
|
867
|
+
* of how a mostly idle process will have a high ELU.
|
|
868
|
+
*
|
|
869
|
+
* ```js
|
|
870
|
+
* import { eventLoopUtilization } from 'node:perf_hooks';
|
|
871
|
+
* import { spawnSync } from 'node:child_process';
|
|
872
|
+
*
|
|
873
|
+
* setImmediate(() => {
|
|
874
|
+
* const elu = eventLoopUtilization();
|
|
875
|
+
* spawnSync('sleep', ['5']);
|
|
876
|
+
* console.log(eventLoopUtilization(elu).utilization);
|
|
877
|
+
* });
|
|
878
|
+
* ```
|
|
879
|
+
*
|
|
880
|
+
* Although the CPU is mostly idle while running this script, the value of `utilization`
|
|
881
|
+
* is `1`. This is because the call to `child_process.spawnSync()` blocks the event loop
|
|
882
|
+
* from proceeding.
|
|
883
|
+
*
|
|
884
|
+
* Passing in a user-defined object instead of the result of a previous call to
|
|
885
|
+
* `eventLoopUtilization()` will lead to undefined behavior. The return values are not
|
|
886
|
+
* guaranteed to reflect any correct state of the event loop.
|
|
887
|
+
* @since v24.12.0
|
|
888
|
+
* @param utilization1 The result of a previous call to `eventLoopUtilization()`.
|
|
889
|
+
* @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
|
|
890
|
+
*/
|
|
891
|
+
function eventLoopUtilization(
|
|
892
|
+
utilization1?: EventLoopUtilization,
|
|
893
|
+
utilization2?: EventLoopUtilization,
|
|
894
|
+
): EventLoopUtilization;
|
|
847
895
|
/**
|
|
848
896
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
849
897
|
*
|
|
@@ -873,28 +921,40 @@ declare module "perf_hooks" {
|
|
|
873
921
|
* @since v11.10.0
|
|
874
922
|
*/
|
|
875
923
|
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
|
|
876
|
-
interface CreateHistogramOptions {
|
|
877
|
-
/**
|
|
878
|
-
* The minimum recordable value. Must be an integer value greater than 0.
|
|
879
|
-
* @default 1
|
|
880
|
-
*/
|
|
881
|
-
lowest?: number | bigint | undefined;
|
|
882
|
-
/**
|
|
883
|
-
* The maximum recordable value. Must be an integer value greater than min.
|
|
884
|
-
* @default Number.MAX_SAFE_INTEGER
|
|
885
|
-
*/
|
|
886
|
-
highest?: number | bigint | undefined;
|
|
887
|
-
/**
|
|
888
|
-
* The number of accuracy digits. Must be a number between 1 and 5.
|
|
889
|
-
* @default 3
|
|
890
|
-
*/
|
|
891
|
-
figures?: number | undefined;
|
|
892
|
-
}
|
|
893
924
|
/**
|
|
894
|
-
*
|
|
895
|
-
*
|
|
925
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
926
|
+
*
|
|
927
|
+
* Wraps a function within a new function that measures the running time of the
|
|
928
|
+
* wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
|
|
929
|
+
* event type in order for the timing details to be accessed.
|
|
930
|
+
*
|
|
931
|
+
* ```js
|
|
932
|
+
* import { timerify, performance, PerformanceObserver } from 'node:perf_hooks';
|
|
933
|
+
*
|
|
934
|
+
* function someFunction() {
|
|
935
|
+
* console.log('hello world');
|
|
936
|
+
* }
|
|
937
|
+
*
|
|
938
|
+
* const wrapped = timerify(someFunction);
|
|
939
|
+
*
|
|
940
|
+
* const obs = new PerformanceObserver((list) => {
|
|
941
|
+
* console.log(list.getEntries()[0].duration);
|
|
942
|
+
*
|
|
943
|
+
* performance.clearMarks();
|
|
944
|
+
* performance.clearMeasures();
|
|
945
|
+
* obs.disconnect();
|
|
946
|
+
* });
|
|
947
|
+
* obs.observe({ entryTypes: ['function'] });
|
|
948
|
+
*
|
|
949
|
+
* // A performance timeline entry will be created
|
|
950
|
+
* wrapped();
|
|
951
|
+
* ```
|
|
952
|
+
*
|
|
953
|
+
* If the wrapped function returns a promise, a finally handler will be attached
|
|
954
|
+
* to the promise and the duration will be reported once the finally handler is invoked.
|
|
955
|
+
* @since v24.12.0
|
|
896
956
|
*/
|
|
897
|
-
function
|
|
957
|
+
function timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
|
898
958
|
import {
|
|
899
959
|
performance as _performance,
|
|
900
960
|
PerformanceEntry as _PerformanceEntry,
|
|
@@ -235,7 +235,7 @@ declare module "process" {
|
|
|
235
235
|
/**
|
|
236
236
|
* A value that is `"strip"` by default,
|
|
237
237
|
* `"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
|
|
238
|
-
* Node.js is run with `--no-
|
|
238
|
+
* Node.js is run with `--no-strip-types`.
|
|
239
239
|
* @since v22.10.0
|
|
240
240
|
*/
|
|
241
241
|
readonly typescript: "strip" | "transform" | false;
|
|
@@ -118,6 +118,14 @@ declare module "node:sqlite" {
|
|
|
118
118
|
* @default false
|
|
119
119
|
*/
|
|
120
120
|
allowUnknownNamedParameters?: boolean | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* If `true`, enables the defensive flag. When the defensive flag is enabled,
|
|
123
|
+
* language features that allow ordinary SQL to deliberately corrupt the database
|
|
124
|
+
* file are disabled. The defensive flag can also be set using `enableDefensive()`.
|
|
125
|
+
* @since v24.12.0
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
defensive?: boolean | undefined;
|
|
121
129
|
}
|
|
122
130
|
interface CreateSessionOptions {
|
|
123
131
|
/**
|
|
@@ -289,6 +297,16 @@ declare module "node:sqlite" {
|
|
|
289
297
|
* @param allow Whether to allow loading extensions.
|
|
290
298
|
*/
|
|
291
299
|
enableLoadExtension(allow: boolean): void;
|
|
300
|
+
/**
|
|
301
|
+
* Enables or disables the defensive flag. When the defensive flag is active,
|
|
302
|
+
* language features that allow ordinary SQL to deliberately corrupt the
|
|
303
|
+
* database file are disabled.
|
|
304
|
+
* See [`SQLITE_DBCONFIG_DEFENSIVE`](https://www.sqlite.org/c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive)
|
|
305
|
+
* in the SQLite documentation for details.
|
|
306
|
+
* @since v24.12.0
|
|
307
|
+
* @param active Whether to set the defensive flag.
|
|
308
|
+
*/
|
|
309
|
+
enableDefensive(active: boolean): void;
|
|
292
310
|
/**
|
|
293
311
|
* This method is a wrapper around [`sqlite3_db_filename()`](https://sqlite.org/c3ref/db_filename.html)
|
|
294
312
|
* @since v24.0.0
|
|
@@ -523,6 +541,11 @@ declare module "node:sqlite" {
|
|
|
523
541
|
* [`sqlite3session_delete()`](https://www.sqlite.org/session/sqlite3session_delete.html).
|
|
524
542
|
*/
|
|
525
543
|
close(): void;
|
|
544
|
+
/**
|
|
545
|
+
* Closes the session. If the session is already closed, does nothing.
|
|
546
|
+
* @since v24.9.0
|
|
547
|
+
*/
|
|
548
|
+
[Symbol.dispose](): void;
|
|
526
549
|
}
|
|
527
550
|
/**
|
|
528
551
|
* This class represents a single LRU (Least Recently Used) cache for storing
|
|
@@ -792,6 +792,14 @@ declare module "util" {
|
|
|
792
792
|
*/
|
|
793
793
|
export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
|
|
794
794
|
export { debuglog as debug };
|
|
795
|
+
export interface DeprecateOptions {
|
|
796
|
+
/**
|
|
797
|
+
* When false do not change the prototype of object while emitting the deprecation warning.
|
|
798
|
+
* @since v24.12.0
|
|
799
|
+
* @default true
|
|
800
|
+
*/
|
|
801
|
+
modifyPrototype?: boolean | undefined;
|
|
802
|
+
}
|
|
795
803
|
/**
|
|
796
804
|
* The `util.deprecate()` method wraps `fn` (which may be a function or class) in
|
|
797
805
|
* such a way that it is marked as deprecated.
|
|
@@ -852,7 +860,7 @@ declare module "util" {
|
|
|
852
860
|
* @param code A deprecation code. See the `list of deprecated APIs` for a list of codes.
|
|
853
861
|
* @return The deprecated function wrapped to emit a warning.
|
|
854
862
|
*/
|
|
855
|
-
export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
|
|
863
|
+
export function deprecate<T extends Function>(fn: T, msg: string, code?: string, options?: DeprecateOptions): T;
|
|
856
864
|
export interface IsDeepStrictEqualOptions {
|
|
857
865
|
/**
|
|
858
866
|
* If `true`, prototype and constructor
|
|
@@ -401,6 +401,21 @@ declare module "v8" {
|
|
|
401
401
|
* @since v12.8.0
|
|
402
402
|
*/
|
|
403
403
|
function getHeapCodeStatistics(): HeapCodeStatistics;
|
|
404
|
+
/**
|
|
405
|
+
* @since v24.12.0
|
|
406
|
+
*/
|
|
407
|
+
interface SyncCPUProfileHandle {
|
|
408
|
+
/**
|
|
409
|
+
* Stopping collecting the profile and return the profile data.
|
|
410
|
+
* @since v24.12.0
|
|
411
|
+
*/
|
|
412
|
+
stop(): string;
|
|
413
|
+
/**
|
|
414
|
+
* Stopping collecting the profile and the profile will be discarded.
|
|
415
|
+
* @since v24.12.0
|
|
416
|
+
*/
|
|
417
|
+
[Symbol.dispose](): void;
|
|
418
|
+
}
|
|
404
419
|
/**
|
|
405
420
|
* @since v24.8.0
|
|
406
421
|
*/
|
|
@@ -466,6 +481,17 @@ declare module "v8" {
|
|
|
466
481
|
* @since v23.10.0, v22.15.0
|
|
467
482
|
*/
|
|
468
483
|
function isStringOneByteRepresentation(content: string): boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Starting a CPU profile then return a `SyncCPUProfileHandle` object. This API supports `using` syntax.
|
|
486
|
+
*
|
|
487
|
+
* ```js
|
|
488
|
+
* const handle = v8.startCpuProfile();
|
|
489
|
+
* const profile = handle.stop();
|
|
490
|
+
* console.log(profile);
|
|
491
|
+
* ```
|
|
492
|
+
* @since v24.12.0
|
|
493
|
+
*/
|
|
494
|
+
function startCpuProfile(): SyncCPUProfileHandle;
|
|
469
495
|
/**
|
|
470
496
|
* @since v8.0.0
|
|
471
497
|
*/
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
declare module "worker_threads" {
|
|
58
58
|
import { Context } from "node:vm";
|
|
59
59
|
import { EventEmitter, NodeEventTarget } from "node:events";
|
|
60
|
-
import { EventLoopUtilityFunction } from "node:perf_hooks";
|
|
61
60
|
import { FileHandle } from "node:fs/promises";
|
|
61
|
+
import { Performance } from "node:perf_hooks";
|
|
62
62
|
import { Readable, Writable } from "node:stream";
|
|
63
63
|
import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
|
|
64
64
|
import { URL } from "node:url";
|
|
@@ -91,9 +91,7 @@ declare module "worker_threads" {
|
|
|
91
91
|
readonly port1: MessagePort;
|
|
92
92
|
readonly port2: MessagePort;
|
|
93
93
|
}
|
|
94
|
-
interface WorkerPerformance {
|
|
95
|
-
eventLoopUtilization: EventLoopUtilityFunction;
|
|
96
|
-
}
|
|
94
|
+
interface WorkerPerformance extends Pick<Performance, "eventLoopUtilization"> {}
|
|
97
95
|
type Transferable =
|
|
98
96
|
| ArrayBuffer
|
|
99
97
|
| MessagePort
|
|
@@ -410,7 +408,7 @@ declare module "worker_threads" {
|
|
|
410
408
|
readonly resourceLimits?: ResourceLimits | undefined;
|
|
411
409
|
/**
|
|
412
410
|
* An object that can be used to query performance information from a worker
|
|
413
|
-
* instance.
|
|
411
|
+
* instance.
|
|
414
412
|
* @since v15.1.0, v14.17.0, v12.22.0
|
|
415
413
|
*/
|
|
416
414
|
readonly performance: WorkerPerformance;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|