@types/node 20.5.9 → 20.6.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/async_hooks.d.ts +1 -0
- node/fs.d.ts +12 -7
- node/http.d.ts +40 -8
- node/index.d.ts +1 -1
- node/inspector.d.ts +2 -1
- node/module.d.ts +29 -4
- node/package.json +2 -2
- node/process.d.ts +3 -2
- node/ts4.8/async_hooks.d.ts +1 -0
- node/ts4.8/fs.d.ts +12 -7
- node/ts4.8/http.d.ts +40 -8
- node/ts4.8/inspector.d.ts +2 -1
- node/ts4.8/module.d.ts +29 -4
- node/ts4.8/process.d.ts +3 -2
- node/ts4.8/worker_threads.d.ts +2 -1
- node/worker_threads.d.ts +2 -1
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (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:
|
|
11
|
+
* Last updated: Fri, 08 Sep 2023 21:33:18 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
|
|
14
14
|
|
node/async_hooks.d.ts
CHANGED
node/fs.d.ts
CHANGED
|
@@ -3924,17 +3924,22 @@ declare module 'fs' {
|
|
|
3924
3924
|
}
|
|
3925
3925
|
|
|
3926
3926
|
/**
|
|
3927
|
-
* Returns a Blob whose data is backed by the given file.
|
|
3927
|
+
* Returns a `Blob` whose data is backed by the given file.
|
|
3928
3928
|
*
|
|
3929
|
-
* The file must not be modified after the `Blob` is created.
|
|
3930
|
-
*
|
|
3931
|
-
* Synchronous stat operations on the file when the `Blob` is created, and before
|
|
3929
|
+
* The file must not be modified after the `Blob` is created. Any modifications
|
|
3930
|
+
* will cause reading the `Blob` data to fail with a `DOMException` error.
|
|
3931
|
+
* Synchronous stat operations on the file when the `Blob` is created, and before
|
|
3932
|
+
* each read in order to detect whether the file data has been modified on disk.
|
|
3932
3933
|
*
|
|
3933
|
-
*
|
|
3934
|
-
*
|
|
3934
|
+
* ```js
|
|
3935
|
+
* import { openAsBlob } from 'node:fs';
|
|
3935
3936
|
*
|
|
3936
|
-
*
|
|
3937
|
+
* const blob = await openAsBlob('the.file.txt');
|
|
3938
|
+
* const ab = await blob.arrayBuffer();
|
|
3939
|
+
* blob.stream();
|
|
3940
|
+
* ```
|
|
3937
3941
|
* @since v19.8.0
|
|
3942
|
+
* @experimental
|
|
3938
3943
|
*/
|
|
3939
3944
|
export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
|
|
3940
3945
|
|
node/http.d.ts
CHANGED
|
@@ -803,7 +803,7 @@ declare module 'http' {
|
|
|
803
803
|
* may run into a 'ECONNRESET' error.
|
|
804
804
|
*
|
|
805
805
|
* ```js
|
|
806
|
-
*
|
|
806
|
+
* import http from 'node:http';
|
|
807
807
|
*
|
|
808
808
|
* // Server has a 5 seconds keep-alive timeout by default
|
|
809
809
|
* http
|
|
@@ -827,7 +827,7 @@ declare module 'http' {
|
|
|
827
827
|
* automatic error retry base on it.
|
|
828
828
|
*
|
|
829
829
|
* ```js
|
|
830
|
-
*
|
|
830
|
+
* import http from 'node:http';
|
|
831
831
|
* const agent = new http.Agent({ keepAlive: true });
|
|
832
832
|
*
|
|
833
833
|
* function retriableRequest() {
|
|
@@ -1375,6 +1375,37 @@ declare module 'http' {
|
|
|
1375
1375
|
*
|
|
1376
1376
|
* The `requestListener` is a function which is automatically
|
|
1377
1377
|
* added to the `'request'` event.
|
|
1378
|
+
*
|
|
1379
|
+
* ```js
|
|
1380
|
+
* import http from 'node:http';
|
|
1381
|
+
*
|
|
1382
|
+
* // Create a local server to receive data from
|
|
1383
|
+
* const server = http.createServer((req, res) => {
|
|
1384
|
+
* res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1385
|
+
* res.end(JSON.stringify({
|
|
1386
|
+
* data: 'Hello World!',
|
|
1387
|
+
* }));
|
|
1388
|
+
* });
|
|
1389
|
+
*
|
|
1390
|
+
* server.listen(8000);
|
|
1391
|
+
* ```
|
|
1392
|
+
*
|
|
1393
|
+
* ```js
|
|
1394
|
+
* import http from 'node:http';
|
|
1395
|
+
*
|
|
1396
|
+
* // Create a local server to receive data from
|
|
1397
|
+
* const server = http.createServer();
|
|
1398
|
+
*
|
|
1399
|
+
* // Listen to the request event
|
|
1400
|
+
* server.on('request', (request, res) => {
|
|
1401
|
+
* res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1402
|
+
* res.end(JSON.stringify({
|
|
1403
|
+
* data: 'Hello World!',
|
|
1404
|
+
* }));
|
|
1405
|
+
* });
|
|
1406
|
+
*
|
|
1407
|
+
* server.listen(8000);
|
|
1408
|
+
* ```
|
|
1378
1409
|
* @since v0.1.13
|
|
1379
1410
|
*/
|
|
1380
1411
|
function createServer<
|
|
@@ -1409,7 +1440,8 @@ declare module 'http' {
|
|
|
1409
1440
|
* upload a file with a POST request, then write to the `ClientRequest` object.
|
|
1410
1441
|
*
|
|
1411
1442
|
* ```js
|
|
1412
|
-
*
|
|
1443
|
+
* import http from 'node:http';
|
|
1444
|
+
* import { Buffer } from 'node:buffer';
|
|
1413
1445
|
*
|
|
1414
1446
|
* const postData = JSON.stringify({
|
|
1415
1447
|
* 'msg': 'Hello World!',
|
|
@@ -1582,8 +1614,8 @@ declare module 'http' {
|
|
|
1582
1614
|
function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1583
1615
|
/**
|
|
1584
1616
|
* Since most requests are GET requests without bodies, Node.js provides this
|
|
1585
|
-
* convenience method. The only difference between this method and {@link request} is that it sets the method to GET and calls `req.end()`automatically. The callback must take care to
|
|
1586
|
-
* response
|
|
1617
|
+
* convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()`automatically. The callback must take care to
|
|
1618
|
+
* consume the response
|
|
1587
1619
|
* data for reasons stated in {@link ClientRequest} section.
|
|
1588
1620
|
*
|
|
1589
1621
|
* The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}.
|
|
@@ -1638,7 +1670,7 @@ declare module 'http' {
|
|
|
1638
1670
|
* server.listen(8000);
|
|
1639
1671
|
* ```
|
|
1640
1672
|
* @since v0.3.6
|
|
1641
|
-
* @param options Accepts the same `options` as {@link request}, with the
|
|
1673
|
+
* @param options Accepts the same `options` as {@link request}, with the method set to GET by default.
|
|
1642
1674
|
*/
|
|
1643
1675
|
function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1644
1676
|
function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
@@ -1655,7 +1687,7 @@ declare module 'http' {
|
|
|
1655
1687
|
* Example:
|
|
1656
1688
|
*
|
|
1657
1689
|
* ```js
|
|
1658
|
-
*
|
|
1690
|
+
* import { validateHeaderName } from 'node:http';
|
|
1659
1691
|
*
|
|
1660
1692
|
* try {
|
|
1661
1693
|
* validateHeaderName('');
|
|
@@ -1683,7 +1715,7 @@ declare module 'http' {
|
|
|
1683
1715
|
* Examples:
|
|
1684
1716
|
*
|
|
1685
1717
|
* ```js
|
|
1686
|
-
*
|
|
1718
|
+
* import { validateHeaderValue } from 'node:http';
|
|
1687
1719
|
*
|
|
1688
1720
|
* try {
|
|
1689
1721
|
* validateHeaderValue('x-my-header', undefined);
|
node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 20.
|
|
1
|
+
// Type definitions for non-npm package Node.js 20.6
|
|
2
2
|
// Project: https://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
node/inspector.d.ts
CHANGED
|
@@ -2705,8 +2705,9 @@ declare module 'inspector' {
|
|
|
2705
2705
|
* @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional.
|
|
2706
2706
|
* @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional.
|
|
2707
2707
|
* @param [wait=false] Block until a client has connected. Optional.
|
|
2708
|
+
* @returns Disposable that calls `inspector.close()`.
|
|
2708
2709
|
*/
|
|
2709
|
-
function open(port?: number, host?: string, wait?: boolean):
|
|
2710
|
+
function open(port?: number, host?: string, wait?: boolean): Disposable;
|
|
2710
2711
|
/**
|
|
2711
2712
|
* Deactivate the inspector. Blocks until there are no active connections.
|
|
2712
2713
|
*/
|
node/module.d.ts
CHANGED
|
@@ -102,6 +102,9 @@ declare module 'module' {
|
|
|
102
102
|
port: MessagePort;
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
+
* @deprecated This hook will be removed in a future version.
|
|
106
|
+
* Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
|
|
107
|
+
*
|
|
105
108
|
* Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
|
|
106
109
|
* This hook allows the return of a string that is run as a sloppy-mode script on startup.
|
|
107
110
|
*
|
|
@@ -109,6 +112,14 @@ declare module 'module' {
|
|
|
109
112
|
* @return Code to run before application startup
|
|
110
113
|
*/
|
|
111
114
|
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
|
|
115
|
+
/**
|
|
116
|
+
* The `initialize` hook provides a way to define a custom function that runs in the loader's thread
|
|
117
|
+
* when the loader is initialized. Initialization happens when the loader is registered via `register`
|
|
118
|
+
* or registered via the `--experimental-loader` command line option.
|
|
119
|
+
*
|
|
120
|
+
* This hook can send and receive data from a `register` invocation, including ports and other transferrable objects.
|
|
121
|
+
*/
|
|
122
|
+
type InitializeHook<Data = any, ReturnType = any> = (data: Data) => ReturnType;
|
|
112
123
|
interface ResolveHookContext {
|
|
113
124
|
/**
|
|
114
125
|
* Export conditions of the relevant `package.json`
|
|
@@ -196,6 +207,11 @@ declare module 'module' {
|
|
|
196
207
|
nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>
|
|
197
208
|
) => LoadFnOutput | Promise<LoadFnOutput>;
|
|
198
209
|
}
|
|
210
|
+
interface RegisterOptions<Data> {
|
|
211
|
+
parentURL: string;
|
|
212
|
+
data?: Data | undefined;
|
|
213
|
+
transferList?: any[] | undefined;
|
|
214
|
+
}
|
|
199
215
|
interface Module extends NodeModule {}
|
|
200
216
|
class Module {
|
|
201
217
|
static runMain(): void;
|
|
@@ -204,13 +220,22 @@ declare module 'module' {
|
|
|
204
220
|
static builtinModules: string[];
|
|
205
221
|
static isBuiltin(moduleName: string): boolean;
|
|
206
222
|
static Module: typeof Module;
|
|
223
|
+
static register<Data = any, ReturnType = any>(specifier: string, parentURL?: string, options?: RegisterOptions<Data>): ReturnType;
|
|
224
|
+
static register<Data = any, ReturnType = any>(specifier: string, options?: RegisterOptions<Data>): ReturnType;
|
|
207
225
|
constructor(id: string, parent?: Module);
|
|
208
226
|
}
|
|
209
227
|
global {
|
|
210
228
|
interface ImportMeta {
|
|
211
229
|
url: string;
|
|
212
230
|
/**
|
|
213
|
-
*
|
|
231
|
+
* Provides a module-relative resolution function scoped to each module, returning
|
|
232
|
+
* the URL string.
|
|
233
|
+
*
|
|
234
|
+
* @param specified The module specifier to resolve relative to the current module.
|
|
235
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
236
|
+
*/
|
|
237
|
+
resolve(specified: string): string;
|
|
238
|
+
/**
|
|
214
239
|
* This feature is only available with the `--experimental-import-meta-resolve`
|
|
215
240
|
* command flag enabled.
|
|
216
241
|
*
|
|
@@ -218,10 +243,10 @@ declare module 'module' {
|
|
|
218
243
|
* the URL string.
|
|
219
244
|
*
|
|
220
245
|
* @param specified The module specifier to resolve relative to `parent`.
|
|
221
|
-
* @param parent The absolute parent module URL to resolve from.
|
|
222
|
-
*
|
|
246
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
247
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
223
248
|
*/
|
|
224
|
-
resolve
|
|
249
|
+
resolve(specified: string, parent: string | URL): string;
|
|
225
250
|
}
|
|
226
251
|
}
|
|
227
252
|
export = Module;
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.6.0",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -227,6 +227,6 @@
|
|
|
227
227
|
},
|
|
228
228
|
"scripts": {},
|
|
229
229
|
"dependencies": {},
|
|
230
|
-
"typesPublisherContentHash": "
|
|
230
|
+
"typesPublisherContentHash": "70cf00335399b8a54dc9af673836cb1cc5d7c049940d67d8c9db01bd10ee989f",
|
|
231
231
|
"typeScriptVersion": "4.3"
|
|
232
232
|
}
|
node/process.d.ts
CHANGED
|
@@ -546,7 +546,8 @@ declare module 'process' {
|
|
|
546
546
|
* parent thread's `process.env`, or whatever was specified as the `env` option
|
|
547
547
|
* to the `Worker` constructor. Changes to `process.env` will not be visible
|
|
548
548
|
* across `Worker` threads, and only the main thread can make changes that
|
|
549
|
-
* are visible to the operating system or to native add-ons.
|
|
549
|
+
* are visible to the operating system or to native add-ons. On Windows, a copy of`process.env` on a `Worker` instance operates in a case-sensitive manner
|
|
550
|
+
* unlike the main thread.
|
|
550
551
|
* @since v0.1.27
|
|
551
552
|
*/
|
|
552
553
|
env: ProcessEnv;
|
|
@@ -1275,7 +1276,7 @@ declare module 'process' {
|
|
|
1275
1276
|
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
|
|
1276
1277
|
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
|
|
1277
1278
|
*
|
|
1278
|
-
* If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`.
|
|
1279
|
+
* If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`.
|
|
1279
1280
|
*
|
|
1280
1281
|
* The message goes through serialization and parsing. The resulting message might
|
|
1281
1282
|
* not be the same as what is originally sent.
|
node/ts4.8/async_hooks.d.ts
CHANGED
node/ts4.8/fs.d.ts
CHANGED
|
@@ -3924,17 +3924,22 @@ declare module 'fs' {
|
|
|
3924
3924
|
}
|
|
3925
3925
|
|
|
3926
3926
|
/**
|
|
3927
|
-
* Returns a Blob whose data is backed by the given file.
|
|
3927
|
+
* Returns a `Blob` whose data is backed by the given file.
|
|
3928
3928
|
*
|
|
3929
|
-
* The file must not be modified after the `Blob` is created.
|
|
3930
|
-
*
|
|
3931
|
-
* Synchronous stat operations on the file when the `Blob` is created, and before
|
|
3929
|
+
* The file must not be modified after the `Blob` is created. Any modifications
|
|
3930
|
+
* will cause reading the `Blob` data to fail with a `DOMException` error.
|
|
3931
|
+
* Synchronous stat operations on the file when the `Blob` is created, and before
|
|
3932
|
+
* each read in order to detect whether the file data has been modified on disk.
|
|
3932
3933
|
*
|
|
3933
|
-
*
|
|
3934
|
-
*
|
|
3934
|
+
* ```js
|
|
3935
|
+
* import { openAsBlob } from 'node:fs';
|
|
3935
3936
|
*
|
|
3936
|
-
*
|
|
3937
|
+
* const blob = await openAsBlob('the.file.txt');
|
|
3938
|
+
* const ab = await blob.arrayBuffer();
|
|
3939
|
+
* blob.stream();
|
|
3940
|
+
* ```
|
|
3937
3941
|
* @since v19.8.0
|
|
3942
|
+
* @experimental
|
|
3938
3943
|
*/
|
|
3939
3944
|
export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
|
|
3940
3945
|
|
node/ts4.8/http.d.ts
CHANGED
|
@@ -803,7 +803,7 @@ declare module 'http' {
|
|
|
803
803
|
* may run into a 'ECONNRESET' error.
|
|
804
804
|
*
|
|
805
805
|
* ```js
|
|
806
|
-
*
|
|
806
|
+
* import http from 'node:http';
|
|
807
807
|
*
|
|
808
808
|
* // Server has a 5 seconds keep-alive timeout by default
|
|
809
809
|
* http
|
|
@@ -827,7 +827,7 @@ declare module 'http' {
|
|
|
827
827
|
* automatic error retry base on it.
|
|
828
828
|
*
|
|
829
829
|
* ```js
|
|
830
|
-
*
|
|
830
|
+
* import http from 'node:http';
|
|
831
831
|
* const agent = new http.Agent({ keepAlive: true });
|
|
832
832
|
*
|
|
833
833
|
* function retriableRequest() {
|
|
@@ -1375,6 +1375,37 @@ declare module 'http' {
|
|
|
1375
1375
|
*
|
|
1376
1376
|
* The `requestListener` is a function which is automatically
|
|
1377
1377
|
* added to the `'request'` event.
|
|
1378
|
+
*
|
|
1379
|
+
* ```js
|
|
1380
|
+
* import http from 'node:http';
|
|
1381
|
+
*
|
|
1382
|
+
* // Create a local server to receive data from
|
|
1383
|
+
* const server = http.createServer((req, res) => {
|
|
1384
|
+
* res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1385
|
+
* res.end(JSON.stringify({
|
|
1386
|
+
* data: 'Hello World!',
|
|
1387
|
+
* }));
|
|
1388
|
+
* });
|
|
1389
|
+
*
|
|
1390
|
+
* server.listen(8000);
|
|
1391
|
+
* ```
|
|
1392
|
+
*
|
|
1393
|
+
* ```js
|
|
1394
|
+
* import http from 'node:http';
|
|
1395
|
+
*
|
|
1396
|
+
* // Create a local server to receive data from
|
|
1397
|
+
* const server = http.createServer();
|
|
1398
|
+
*
|
|
1399
|
+
* // Listen to the request event
|
|
1400
|
+
* server.on('request', (request, res) => {
|
|
1401
|
+
* res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1402
|
+
* res.end(JSON.stringify({
|
|
1403
|
+
* data: 'Hello World!',
|
|
1404
|
+
* }));
|
|
1405
|
+
* });
|
|
1406
|
+
*
|
|
1407
|
+
* server.listen(8000);
|
|
1408
|
+
* ```
|
|
1378
1409
|
* @since v0.1.13
|
|
1379
1410
|
*/
|
|
1380
1411
|
function createServer<
|
|
@@ -1409,7 +1440,8 @@ declare module 'http' {
|
|
|
1409
1440
|
* upload a file with a POST request, then write to the `ClientRequest` object.
|
|
1410
1441
|
*
|
|
1411
1442
|
* ```js
|
|
1412
|
-
*
|
|
1443
|
+
* import http from 'node:http';
|
|
1444
|
+
* import { Buffer } from 'node:buffer';
|
|
1413
1445
|
*
|
|
1414
1446
|
* const postData = JSON.stringify({
|
|
1415
1447
|
* 'msg': 'Hello World!',
|
|
@@ -1582,8 +1614,8 @@ declare module 'http' {
|
|
|
1582
1614
|
function request(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1583
1615
|
/**
|
|
1584
1616
|
* Since most requests are GET requests without bodies, Node.js provides this
|
|
1585
|
-
* convenience method. The only difference between this method and {@link request} is that it sets the method to GET and calls `req.end()`automatically. The callback must take care to
|
|
1586
|
-
* response
|
|
1617
|
+
* convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()`automatically. The callback must take care to
|
|
1618
|
+
* consume the response
|
|
1587
1619
|
* data for reasons stated in {@link ClientRequest} section.
|
|
1588
1620
|
*
|
|
1589
1621
|
* The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}.
|
|
@@ -1638,7 +1670,7 @@ declare module 'http' {
|
|
|
1638
1670
|
* server.listen(8000);
|
|
1639
1671
|
* ```
|
|
1640
1672
|
* @since v0.3.6
|
|
1641
|
-
* @param options Accepts the same `options` as {@link request}, with the
|
|
1673
|
+
* @param options Accepts the same `options` as {@link request}, with the method set to GET by default.
|
|
1642
1674
|
*/
|
|
1643
1675
|
function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
1644
1676
|
function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
|
@@ -1655,7 +1687,7 @@ declare module 'http' {
|
|
|
1655
1687
|
* Example:
|
|
1656
1688
|
*
|
|
1657
1689
|
* ```js
|
|
1658
|
-
*
|
|
1690
|
+
* import { validateHeaderName } from 'node:http';
|
|
1659
1691
|
*
|
|
1660
1692
|
* try {
|
|
1661
1693
|
* validateHeaderName('');
|
|
@@ -1683,7 +1715,7 @@ declare module 'http' {
|
|
|
1683
1715
|
* Examples:
|
|
1684
1716
|
*
|
|
1685
1717
|
* ```js
|
|
1686
|
-
*
|
|
1718
|
+
* import { validateHeaderValue } from 'node:http';
|
|
1687
1719
|
*
|
|
1688
1720
|
* try {
|
|
1689
1721
|
* validateHeaderValue('x-my-header', undefined);
|
node/ts4.8/inspector.d.ts
CHANGED
|
@@ -2705,8 +2705,9 @@ declare module 'inspector' {
|
|
|
2705
2705
|
* @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional.
|
|
2706
2706
|
* @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional.
|
|
2707
2707
|
* @param [wait=false] Block until a client has connected. Optional.
|
|
2708
|
+
* @returns Disposable that calls `inspector.close()`.
|
|
2708
2709
|
*/
|
|
2709
|
-
function open(port?: number, host?: string, wait?: boolean):
|
|
2710
|
+
function open(port?: number, host?: string, wait?: boolean): Disposable;
|
|
2710
2711
|
/**
|
|
2711
2712
|
* Deactivate the inspector. Blocks until there are no active connections.
|
|
2712
2713
|
*/
|
node/ts4.8/module.d.ts
CHANGED
|
@@ -102,6 +102,9 @@ declare module 'module' {
|
|
|
102
102
|
port: MessagePort;
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
+
* @deprecated This hook will be removed in a future version.
|
|
106
|
+
* Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
|
|
107
|
+
*
|
|
105
108
|
* Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
|
|
106
109
|
* This hook allows the return of a string that is run as a sloppy-mode script on startup.
|
|
107
110
|
*
|
|
@@ -109,6 +112,14 @@ declare module 'module' {
|
|
|
109
112
|
* @return Code to run before application startup
|
|
110
113
|
*/
|
|
111
114
|
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
|
|
115
|
+
/**
|
|
116
|
+
* The `initialize` hook provides a way to define a custom function that runs in the loader's thread
|
|
117
|
+
* when the loader is initialized. Initialization happens when the loader is registered via `register`
|
|
118
|
+
* or registered via the `--experimental-loader` command line option.
|
|
119
|
+
*
|
|
120
|
+
* This hook can send and receive data from a `register` invocation, including ports and other transferrable objects.
|
|
121
|
+
*/
|
|
122
|
+
type InitializeHook<Data = any, ReturnType = any> = (data: Data) => ReturnType;
|
|
112
123
|
interface ResolveHookContext {
|
|
113
124
|
/**
|
|
114
125
|
* Export conditions of the relevant `package.json`
|
|
@@ -196,6 +207,11 @@ declare module 'module' {
|
|
|
196
207
|
nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>
|
|
197
208
|
) => LoadFnOutput | Promise<LoadFnOutput>;
|
|
198
209
|
}
|
|
210
|
+
interface RegisterOptions<Data> {
|
|
211
|
+
parentURL: string;
|
|
212
|
+
data?: Data | undefined;
|
|
213
|
+
transferList?: any[] | undefined;
|
|
214
|
+
}
|
|
199
215
|
interface Module extends NodeModule {}
|
|
200
216
|
class Module {
|
|
201
217
|
static runMain(): void;
|
|
@@ -204,13 +220,22 @@ declare module 'module' {
|
|
|
204
220
|
static builtinModules: string[];
|
|
205
221
|
static isBuiltin(moduleName: string): boolean;
|
|
206
222
|
static Module: typeof Module;
|
|
223
|
+
static register<Data = any, ReturnType = any>(specifier: string, parentURL?: string, options?: RegisterOptions<Data>): ReturnType;
|
|
224
|
+
static register<Data = any, ReturnType = any>(specifier: string, options?: RegisterOptions<Data>): ReturnType;
|
|
207
225
|
constructor(id: string, parent?: Module);
|
|
208
226
|
}
|
|
209
227
|
global {
|
|
210
228
|
interface ImportMeta {
|
|
211
229
|
url: string;
|
|
212
230
|
/**
|
|
213
|
-
*
|
|
231
|
+
* Provides a module-relative resolution function scoped to each module, returning
|
|
232
|
+
* the URL string.
|
|
233
|
+
*
|
|
234
|
+
* @param specified The module specifier to resolve relative to the current module.
|
|
235
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
236
|
+
*/
|
|
237
|
+
resolve(specified: string): string;
|
|
238
|
+
/**
|
|
214
239
|
* This feature is only available with the `--experimental-import-meta-resolve`
|
|
215
240
|
* command flag enabled.
|
|
216
241
|
*
|
|
@@ -218,10 +243,10 @@ declare module 'module' {
|
|
|
218
243
|
* the URL string.
|
|
219
244
|
*
|
|
220
245
|
* @param specified The module specifier to resolve relative to `parent`.
|
|
221
|
-
* @param parent The absolute parent module URL to resolve from.
|
|
222
|
-
*
|
|
246
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
247
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
223
248
|
*/
|
|
224
|
-
resolve
|
|
249
|
+
resolve(specified: string, parent: string | URL): string;
|
|
225
250
|
}
|
|
226
251
|
}
|
|
227
252
|
export = Module;
|
node/ts4.8/process.d.ts
CHANGED
|
@@ -546,7 +546,8 @@ declare module 'process' {
|
|
|
546
546
|
* parent thread's `process.env`, or whatever was specified as the `env` option
|
|
547
547
|
* to the `Worker` constructor. Changes to `process.env` will not be visible
|
|
548
548
|
* across `Worker` threads, and only the main thread can make changes that
|
|
549
|
-
* are visible to the operating system or to native add-ons.
|
|
549
|
+
* are visible to the operating system or to native add-ons. On Windows, a copy of`process.env` on a `Worker` instance operates in a case-sensitive manner
|
|
550
|
+
* unlike the main thread.
|
|
550
551
|
* @since v0.1.27
|
|
551
552
|
*/
|
|
552
553
|
env: ProcessEnv;
|
|
@@ -1275,7 +1276,7 @@ declare module 'process' {
|
|
|
1275
1276
|
* If Node.js is spawned with an IPC channel, the `process.send()` method can be
|
|
1276
1277
|
* used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object.
|
|
1277
1278
|
*
|
|
1278
|
-
* If Node.js was not spawned with an IPC channel, `process.send` will be`undefined`.
|
|
1279
|
+
* If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`.
|
|
1279
1280
|
*
|
|
1280
1281
|
* The message goes through serialization and parsing. The resulting message might
|
|
1281
1282
|
* not be the same as what is originally sent.
|
node/ts4.8/worker_threads.d.ts
CHANGED
|
@@ -303,7 +303,8 @@ declare module 'worker_threads' {
|
|
|
303
303
|
* are not available.
|
|
304
304
|
* * `process.env` is a copy of the parent thread's environment variables,
|
|
305
305
|
* unless otherwise specified. Changes to one copy are not visible in other
|
|
306
|
-
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor).
|
|
306
|
+
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor). On Windows, unlike the main thread, a copy of the
|
|
307
|
+
* environment variables operates in a case-sensitive manner.
|
|
307
308
|
* * `process.title` cannot be modified.
|
|
308
309
|
* * Signals are not delivered through `process.on('...')`.
|
|
309
310
|
* * Execution may stop at any point as a result of `worker.terminate()` being invoked.
|
node/worker_threads.d.ts
CHANGED
|
@@ -303,7 +303,8 @@ declare module 'worker_threads' {
|
|
|
303
303
|
* are not available.
|
|
304
304
|
* * `process.env` is a copy of the parent thread's environment variables,
|
|
305
305
|
* unless otherwise specified. Changes to one copy are not visible in other
|
|
306
|
-
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor).
|
|
306
|
+
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor). On Windows, unlike the main thread, a copy of the
|
|
307
|
+
* environment variables operates in a case-sensitive manner.
|
|
307
308
|
* * `process.title` cannot be modified.
|
|
308
309
|
* * Signals are not delivered through `process.on('...')`.
|
|
309
310
|
* * Execution may stop at any point as a result of `worker.terminate()` being invoked.
|