@types/node 25.8.0 → 25.9.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 +108 -0
- node/crypto.d.ts +14 -3
- node/fs/promises.d.ts +126 -0
- node/fs.d.ts +4 -2
- node/index.d.ts +2 -0
- node/inspector.generated.d.ts +5 -0
- node/module.d.ts +1 -0
- node/package.json +2 -2
- node/process.d.ts +25 -1
- node/quic.d.ts +2 -2
- node/repl.d.ts +15 -0
- node/stream/iter.d.ts +298 -0
- node/test.d.ts +38 -12
- node/ts5.6/index.d.ts +2 -0
- node/ts5.7/index.d.ts +2 -0
- node/vm.d.ts +5 -4
- node/zlib/iter.d.ts +131 -0
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 18 May 2026 12:43:58 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
node/async_hooks.d.ts
CHANGED
|
@@ -491,6 +491,75 @@ declare module "node:async_hooks" {
|
|
|
491
491
|
* @experimental
|
|
492
492
|
*/
|
|
493
493
|
exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
|
|
494
|
+
/**
|
|
495
|
+
* Creates a disposable scope that enters the given store and automatically
|
|
496
|
+
* restores the previous store value when the scope is disposed. This method is
|
|
497
|
+
* designed to work with JavaScript's explicit resource management (`using` syntax).
|
|
498
|
+
*
|
|
499
|
+
* Example:
|
|
500
|
+
*
|
|
501
|
+
* ```js
|
|
502
|
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
|
503
|
+
*
|
|
504
|
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
|
505
|
+
*
|
|
506
|
+
* {
|
|
507
|
+
* using _ = asyncLocalStorage.withScope('my-store');
|
|
508
|
+
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
|
|
509
|
+
* }
|
|
510
|
+
*
|
|
511
|
+
* console.log(asyncLocalStorage.getStore()); // Prints: undefined
|
|
512
|
+
* ```
|
|
513
|
+
*
|
|
514
|
+
* The `withScope()` method is particularly useful for managing context in
|
|
515
|
+
* synchronous code where you want to ensure the previous store value is restored
|
|
516
|
+
* when exiting a block, even if an error is thrown.
|
|
517
|
+
*
|
|
518
|
+
* ```js
|
|
519
|
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
|
520
|
+
*
|
|
521
|
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
|
522
|
+
*
|
|
523
|
+
* try {
|
|
524
|
+
* using _ = asyncLocalStorage.withScope('my-store');
|
|
525
|
+
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
|
|
526
|
+
* throw new Error('test');
|
|
527
|
+
* } catch (e) {
|
|
528
|
+
* // Store is automatically restored even after error
|
|
529
|
+
* console.log(asyncLocalStorage.getStore()); // Prints: undefined
|
|
530
|
+
* }
|
|
531
|
+
* ```
|
|
532
|
+
*
|
|
533
|
+
* **Important:** When using `withScope()` in async functions before the first
|
|
534
|
+
* `await`, be aware that the scope change will affect the caller's context. The
|
|
535
|
+
* synchronous portion of an async function (before the first `await`) runs
|
|
536
|
+
* immediately when called, and when it reaches the first `await`, it returns the
|
|
537
|
+
* promise to the caller. At that point, the scope change becomes visible in the
|
|
538
|
+
* caller's context and will persist in subsequent synchronous code until something
|
|
539
|
+
* else changes the scope value. For async operations, prefer using `run()` which
|
|
540
|
+
* properly isolates context across async boundaries.
|
|
541
|
+
*
|
|
542
|
+
* ```js
|
|
543
|
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
|
544
|
+
*
|
|
545
|
+
* const asyncLocalStorage = new AsyncLocalStorage();
|
|
546
|
+
*
|
|
547
|
+
* async function example() {
|
|
548
|
+
* using _ = asyncLocalStorage.withScope('my-store');
|
|
549
|
+
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
|
|
550
|
+
* await someAsyncOperation(); // Function pauses here and returns promise
|
|
551
|
+
* console.log(asyncLocalStorage.getStore()); // Prints: my-store
|
|
552
|
+
* }
|
|
553
|
+
*
|
|
554
|
+
* // Calling without await
|
|
555
|
+
* example(); // Synchronous portion runs, then pauses at first await
|
|
556
|
+
* // After the promise is returned, the scope 'my-store' is now active in caller!
|
|
557
|
+
* console.log(asyncLocalStorage.getStore()); // Prints: my-store (unexpected!)
|
|
558
|
+
* ```
|
|
559
|
+
* @since v25.9.0
|
|
560
|
+
* @experimental
|
|
561
|
+
*/
|
|
562
|
+
withScope(store: T): RunScope;
|
|
494
563
|
/**
|
|
495
564
|
* Transitions into the context for the remainder of the current
|
|
496
565
|
* synchronous execution and then persists the store through any following
|
|
@@ -533,6 +602,45 @@ declare module "node:async_hooks" {
|
|
|
533
602
|
*/
|
|
534
603
|
enterWith(store: T): void;
|
|
535
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* A disposable scope returned by `asyncLocalStorage.withScope()` that
|
|
607
|
+
* automatically restores the previous store value when disposed. This class
|
|
608
|
+
* implements the [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management) protocol and is designed to work
|
|
609
|
+
* with JavaScript's `using` syntax.
|
|
610
|
+
*
|
|
611
|
+
* The scope automatically restores the previous store value when the `using` block
|
|
612
|
+
* exits, whether through normal completion or by throwing an error.
|
|
613
|
+
* @since v25.9.0
|
|
614
|
+
* @experimental
|
|
615
|
+
*/
|
|
616
|
+
interface RunScope extends Disposable {
|
|
617
|
+
/**
|
|
618
|
+
* Explicitly ends the scope and restores the previous store value. This method
|
|
619
|
+
* is idempotent: calling it multiple times has the same effect as calling it once.
|
|
620
|
+
*
|
|
621
|
+
* The `[Symbol.dispose]()` method defers to `dispose()`.
|
|
622
|
+
*
|
|
623
|
+
* If `withScope()` is called without the `using` keyword, `dispose()` must be
|
|
624
|
+
* called manually to restore the previous store value. Forgetting to call
|
|
625
|
+
* `dispose()` will cause the store value to persist for the remainder of the
|
|
626
|
+
* current execution context:
|
|
627
|
+
*
|
|
628
|
+
* ```js
|
|
629
|
+
* import { AsyncLocalStorage } from 'node:async_hooks';
|
|
630
|
+
*
|
|
631
|
+
* const storage = new AsyncLocalStorage();
|
|
632
|
+
*
|
|
633
|
+
* // Without using, the scope must be disposed manually
|
|
634
|
+
* const scope = storage.withScope('my-store');
|
|
635
|
+
* // storage.getStore() === 'my-store' here
|
|
636
|
+
*
|
|
637
|
+
* scope.dispose(); // Restore previous value
|
|
638
|
+
* // storage.getStore() === undefined here
|
|
639
|
+
* ```
|
|
640
|
+
* @since v25.9.0
|
|
641
|
+
*/
|
|
642
|
+
dispose(): void;
|
|
643
|
+
}
|
|
536
644
|
/**
|
|
537
645
|
* @since v17.2.0, v16.14.0
|
|
538
646
|
* @return A map of provider types to the corresponding numeric id.
|
node/crypto.d.ts
CHANGED
|
@@ -3778,7 +3778,7 @@ declare module "node:crypto" {
|
|
|
3778
3778
|
interface CShakeParams extends Algorithm {
|
|
3779
3779
|
customization?: NodeJS.BufferSource;
|
|
3780
3780
|
functionName?: NodeJS.BufferSource;
|
|
3781
|
-
|
|
3781
|
+
outputLength: number;
|
|
3782
3782
|
}
|
|
3783
3783
|
interface ContextParams extends Algorithm {
|
|
3784
3784
|
context?: NodeJS.BufferSource;
|
|
@@ -3815,6 +3815,10 @@ declare module "node:crypto" {
|
|
|
3815
3815
|
hash: HashAlgorithmIdentifier;
|
|
3816
3816
|
length?: number;
|
|
3817
3817
|
}
|
|
3818
|
+
interface KangarooTwelveParams {
|
|
3819
|
+
customization?: NodeJS.BufferSource;
|
|
3820
|
+
outputLength: number;
|
|
3821
|
+
}
|
|
3818
3822
|
interface JsonWebKey {
|
|
3819
3823
|
alg?: string;
|
|
3820
3824
|
crv?: string;
|
|
@@ -3849,7 +3853,7 @@ declare module "node:crypto" {
|
|
|
3849
3853
|
}
|
|
3850
3854
|
interface KmacParams extends Algorithm {
|
|
3851
3855
|
customization?: NodeJS.BufferSource;
|
|
3852
|
-
|
|
3856
|
+
outputLength: number;
|
|
3853
3857
|
}
|
|
3854
3858
|
interface Pbkdf2Params extends Algorithm {
|
|
3855
3859
|
hash: HashAlgorithmIdentifier;
|
|
@@ -3884,6 +3888,10 @@ declare module "node:crypto" {
|
|
|
3884
3888
|
interface RsaPssParams extends Algorithm {
|
|
3885
3889
|
saltLength: number;
|
|
3886
3890
|
}
|
|
3891
|
+
interface TurboShakeParams {
|
|
3892
|
+
domainSeparation?: number;
|
|
3893
|
+
outputLength: number;
|
|
3894
|
+
}
|
|
3887
3895
|
interface Crypto {
|
|
3888
3896
|
readonly subtle: SubtleCrypto;
|
|
3889
3897
|
getRandomValues<
|
|
@@ -3945,7 +3953,10 @@ declare module "node:crypto" {
|
|
|
3945
3953
|
extractable: boolean,
|
|
3946
3954
|
keyUsages: readonly KeyUsage[],
|
|
3947
3955
|
): Promise<CryptoKey>;
|
|
3948
|
-
digest(
|
|
3956
|
+
digest(
|
|
3957
|
+
algorithm: AlgorithmIdentifier | CShakeParams | TurboShakeParams | KangarooTwelveParams,
|
|
3958
|
+
data: NodeJS.BufferSource,
|
|
3959
|
+
): Promise<ArrayBuffer>;
|
|
3949
3960
|
encapsulateBits(
|
|
3950
3961
|
encapsulationAlgorithm: AlgorithmIdentifier,
|
|
3951
3962
|
encapsulationKey: CryptoKey,
|
node/fs/promises.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare module "node:fs/promises" {
|
|
|
37
37
|
WriteVResult,
|
|
38
38
|
} from "node:fs";
|
|
39
39
|
import { Stream } from "node:stream";
|
|
40
|
+
import { ByteReadableStream, Transform, Writer } from "node:stream/iter";
|
|
40
41
|
import { ReadableStream } from "node:stream/web";
|
|
41
42
|
interface FileChangeInfo<T extends string | Buffer> {
|
|
42
43
|
eventType: WatchEventType;
|
|
@@ -85,6 +86,57 @@ declare module "node:fs/promises" {
|
|
|
85
86
|
interface ReadableWebStreamOptions {
|
|
86
87
|
autoClose?: boolean | undefined;
|
|
87
88
|
}
|
|
89
|
+
interface PullOptions extends Abortable {
|
|
90
|
+
/**
|
|
91
|
+
* Close the file handle when the stream ends.
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
autoClose?: boolean | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Byte offset to begin reading from. When specified,
|
|
97
|
+
* reads use explicit positioning (`pread` semantics).
|
|
98
|
+
*/
|
|
99
|
+
start?: number | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Maximum number of bytes to read before ending the
|
|
102
|
+
* iterator. Reads stop when `limit` bytes have been delivered or EOF is
|
|
103
|
+
* reached, whichever comes first.
|
|
104
|
+
*/
|
|
105
|
+
limit?: number | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Size in bytes of the buffer allocated for each
|
|
108
|
+
* read operation.
|
|
109
|
+
* @default 131072
|
|
110
|
+
*/
|
|
111
|
+
chunkSize?: number | undefined;
|
|
112
|
+
}
|
|
113
|
+
interface WriterOptions {
|
|
114
|
+
/**
|
|
115
|
+
* Close the file handle when the writer ends or fails.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
autoClose?: boolean | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Byte offset to start writing at. When specified,
|
|
121
|
+
* writes use explicit positioning.
|
|
122
|
+
*/
|
|
123
|
+
start?: number | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Maximum number of bytes the writer will accept.
|
|
126
|
+
* Async writes (`write()`, `writev()`) that would exceed the limit reject
|
|
127
|
+
* with `ERR_OUT_OF_RANGE`. Sync writes (`writeSync()`, `writevSync()`)
|
|
128
|
+
* return `false`.
|
|
129
|
+
*/
|
|
130
|
+
limit?: number | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Maximum chunk size in bytes for synchronous write
|
|
133
|
+
* operations. Writes larger than this threshold fall back to async I/O.
|
|
134
|
+
* Set this to match the reader's `chunkSize` for optimal `pipeTo()`
|
|
135
|
+
* performance.
|
|
136
|
+
* @default 131072
|
|
137
|
+
*/
|
|
138
|
+
chunkSize?: number | undefined;
|
|
139
|
+
}
|
|
88
140
|
// TODO: Add `EventEmitter` close
|
|
89
141
|
interface FileHandle {
|
|
90
142
|
/**
|
|
@@ -202,6 +254,41 @@ declare module "node:fs/promises" {
|
|
|
202
254
|
* @return Fulfills with `undefined` upon success.
|
|
203
255
|
*/
|
|
204
256
|
datasync(): Promise<void>;
|
|
257
|
+
/**
|
|
258
|
+
* Return the file contents as an async iterable using the
|
|
259
|
+
* [`node:stream/iter`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html) pull model. Reads are performed in `chunkSize`-byte
|
|
260
|
+
* chunks (default 128 KB). If transforms are provided, they are applied
|
|
261
|
+
* via [`stream/iter pull()`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html#pullsource-transforms-options).
|
|
262
|
+
*
|
|
263
|
+
* The file handle is locked while the iterable is being consumed and unlocked
|
|
264
|
+
* when iteration completes, an error occurs, or the consumer breaks.
|
|
265
|
+
*
|
|
266
|
+
* This function is only available when the `--experimental-stream-iter` flag is
|
|
267
|
+
* enabled.
|
|
268
|
+
*
|
|
269
|
+
* ```js
|
|
270
|
+
* import { open } from 'node:fs/promises';
|
|
271
|
+
* import { text } from 'node:stream/iter';
|
|
272
|
+
* import { compressGzip } from 'node:zlib/iter';
|
|
273
|
+
*
|
|
274
|
+
* const fh = await open('input.txt', 'r');
|
|
275
|
+
*
|
|
276
|
+
* // Read as text
|
|
277
|
+
* console.log(await text(fh.pull({ autoClose: true })));
|
|
278
|
+
*
|
|
279
|
+
* // Read 1 KB starting at byte 100
|
|
280
|
+
* const fh2 = await open('input.txt', 'r');
|
|
281
|
+
* console.log(await text(fh2.pull({ start: 100, limit: 1024, autoClose: true })));
|
|
282
|
+
*
|
|
283
|
+
* // Read with compression
|
|
284
|
+
* const fh3 = await open('input.txt', 'r');
|
|
285
|
+
* const compressed = fh3.pull(compressGzip(), { autoClose: true });
|
|
286
|
+
* ```
|
|
287
|
+
* @since v25.9.0
|
|
288
|
+
* @experimental
|
|
289
|
+
*/
|
|
290
|
+
pull(...transforms: Transform[]): ByteReadableStream;
|
|
291
|
+
pull(...args: [...transforms: Transform[], options: PullOptions]): ByteReadableStream;
|
|
205
292
|
/**
|
|
206
293
|
* Request that all data for the open file descriptor is flushed to the storage
|
|
207
294
|
* device. The specific implementation is operating system and device specific.
|
|
@@ -450,6 +537,45 @@ declare module "node:fs/promises" {
|
|
|
450
537
|
buffers: TBuffers,
|
|
451
538
|
position?: number,
|
|
452
539
|
): Promise<WriteVResult<TBuffers>>;
|
|
540
|
+
/**
|
|
541
|
+
* Return a [`node:stream/iter`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html) writer backed by this file handle.
|
|
542
|
+
*
|
|
543
|
+
* The writer supports both `Symbol.asyncDispose` and `Symbol.dispose`:
|
|
544
|
+
*
|
|
545
|
+
* * `await using w = fh.writer()` — if the writer is still open (no `end()`
|
|
546
|
+
* called), `asyncDispose` calls `fail()`. If `end()` is pending, it waits
|
|
547
|
+
* for it to complete.
|
|
548
|
+
* * `using w = fh.writer()` — calls `fail()` unconditionally.
|
|
549
|
+
*
|
|
550
|
+
* The `writeSync()` and `writevSync()` methods enable the try-sync fast path
|
|
551
|
+
* used by [`stream/iter pipeTo()`](https://nodejs.org/docs/latest-v25.x/api/stream_iter.html#pipetosource-transforms-writer). When the reader's chunk size matches the
|
|
552
|
+
* writer's `chunkSize`, all writes in a `pipeTo()` pipeline complete
|
|
553
|
+
* synchronously with zero promise overhead.
|
|
554
|
+
*
|
|
555
|
+
* This function is only available when the `--experimental-stream-iter` flag is
|
|
556
|
+
* enabled.
|
|
557
|
+
*
|
|
558
|
+
* ```js
|
|
559
|
+
* import { open } from 'node:fs/promises';
|
|
560
|
+
* import { from, pipeTo } from 'node:stream/iter';
|
|
561
|
+
* import { compressGzip } from 'node:zlib/iter';
|
|
562
|
+
*
|
|
563
|
+
* // Async pipeline
|
|
564
|
+
* const fh = await open('output.gz', 'w');
|
|
565
|
+
* await pipeTo(from('Hello!'), compressGzip(), fh.writer({ autoClose: true }));
|
|
566
|
+
*
|
|
567
|
+
* // Sync pipeline with limit
|
|
568
|
+
* const src = await open('input.txt', 'r');
|
|
569
|
+
* const dst = await open('output.txt', 'w');
|
|
570
|
+
* const w = dst.writer({ limit: 1024 * 1024 }); // Max 1 MB
|
|
571
|
+
* await pipeTo(src.pull({ autoClose: true }), w);
|
|
572
|
+
* await w.end();
|
|
573
|
+
* await dst.close();
|
|
574
|
+
* ```
|
|
575
|
+
* @since v25.9.0
|
|
576
|
+
* @experimental
|
|
577
|
+
*/
|
|
578
|
+
writer(options?: WriterOptions): Writer;
|
|
453
579
|
/**
|
|
454
580
|
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
|
|
455
581
|
* @since v13.13.0, v12.17.0
|
node/fs.d.ts
CHANGED
|
@@ -380,7 +380,8 @@ declare module "node:fs" {
|
|
|
380
380
|
"ready": [];
|
|
381
381
|
}
|
|
382
382
|
/**
|
|
383
|
-
* Instances of `fs.ReadStream`
|
|
383
|
+
* Instances of `fs.ReadStream` cannot be constructed directly. They are created and
|
|
384
|
+
* returned using the `fs.createReadStream()` function.
|
|
384
385
|
* @since v0.1.93
|
|
385
386
|
*/
|
|
386
387
|
class ReadStream extends stream.Readable {
|
|
@@ -643,7 +644,8 @@ declare module "node:fs" {
|
|
|
643
644
|
"ready": [];
|
|
644
645
|
}
|
|
645
646
|
/**
|
|
646
|
-
* Instances of `fs.WriteStream`
|
|
647
|
+
* Instances of `fs.WriteStream` cannot be constructed directly. They are created and
|
|
648
|
+
* returned using the `fs.createWriteStream()` function.
|
|
647
649
|
* @since v0.1.93
|
|
648
650
|
*/
|
|
649
651
|
class WriteStream extends stream.Writable {
|
node/index.d.ts
CHANGED
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
/// <reference path="sqlite.d.ts" />
|
|
96
96
|
/// <reference path="stream.d.ts" />
|
|
97
97
|
/// <reference path="stream/consumers.d.ts" />
|
|
98
|
+
/// <reference path="stream/iter.d.ts" />
|
|
98
99
|
/// <reference path="stream/promises.d.ts" />
|
|
99
100
|
/// <reference path="stream/web.d.ts" />
|
|
100
101
|
/// <reference path="string_decoder.d.ts" />
|
|
@@ -113,3 +114,4 @@
|
|
|
113
114
|
/// <reference path="wasi.d.ts" />
|
|
114
115
|
/// <reference path="worker_threads.d.ts" />
|
|
115
116
|
/// <reference path="zlib.d.ts" />
|
|
117
|
+
/// <reference path="zlib/iter.d.ts" />
|
node/inspector.generated.d.ts
CHANGED
|
@@ -2035,6 +2035,9 @@ declare module "node:inspector" {
|
|
|
2035
2035
|
autoAttach: boolean;
|
|
2036
2036
|
waitForDebuggerOnStart: boolean;
|
|
2037
2037
|
}
|
|
2038
|
+
interface GetTargetsReturnType {
|
|
2039
|
+
targetInfos: TargetInfo[];
|
|
2040
|
+
}
|
|
2038
2041
|
interface TargetCreatedEventDataType {
|
|
2039
2042
|
targetInfo: TargetInfo;
|
|
2040
2043
|
}
|
|
@@ -2506,6 +2509,7 @@ declare module "node:inspector" {
|
|
|
2506
2509
|
*/
|
|
2507
2510
|
post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void;
|
|
2508
2511
|
post(method: "NodeWorker.detach", callback?: (err: Error | null) => void): void;
|
|
2512
|
+
post(method: "Target.getTargets", callback?: (err: Error | null, params: Target.GetTargetsReturnType) => void): void;
|
|
2509
2513
|
post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType, callback?: (err: Error | null) => void): void;
|
|
2510
2514
|
post(method: "Target.setAutoAttach", callback?: (err: Error | null) => void): void;
|
|
2511
2515
|
post(method: "DOMStorage.clear", params?: DOMStorage.ClearParameterType, callback?: (err: Error | null) => void): void;
|
|
@@ -3642,6 +3646,7 @@ declare module "node:inspector/promises" {
|
|
|
3642
3646
|
* Detached from the worker with given sessionId.
|
|
3643
3647
|
*/
|
|
3644
3648
|
post(method: "NodeWorker.detach", params?: NodeWorker.DetachParameterType): Promise<void>;
|
|
3649
|
+
post(method: "Target.getTargets"): Promise<Target.GetTargetsReturnType>;
|
|
3645
3650
|
post(method: "Target.setAutoAttach", params?: Target.SetAutoAttachParameterType): Promise<void>;
|
|
3646
3651
|
post(method: "DOMStorage.clear", params?: DOMStorage.ClearParameterType): Promise<void>;
|
|
3647
3652
|
/**
|
node/module.d.ts
CHANGED
|
@@ -218,6 +218,7 @@ declare module "node:module" {
|
|
|
218
218
|
* This feature requires `--allow-worker` if used with the
|
|
219
219
|
* [Permission Model](https://nodejs.org/docs/latest-v25.x/api/permissions.html#permission-model).
|
|
220
220
|
* @since v20.6.0, v18.19.0
|
|
221
|
+
* @deprecated Use `module.registerHooks()` instead.
|
|
221
222
|
* @param specifier Customization hooks to be registered; this should be
|
|
222
223
|
* the same string that would be passed to `import()`, except that if it is
|
|
223
224
|
* relative, it is resolved relative to `parentURL`.
|
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.9.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.24.0 <7.24.7"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {},
|
|
153
|
-
"typesPublisherContentHash": "
|
|
153
|
+
"typesPublisherContentHash": "2c46dd4d6ce51acbd418cda854101b97987beaea870ba7b8c1a22436b4a0a28c",
|
|
154
154
|
"typeScriptVersion": "5.3"
|
|
155
155
|
}
|
node/process.d.ts
CHANGED
|
@@ -822,6 +822,28 @@ declare module "node:process" {
|
|
|
822
822
|
* @since v0.7.0
|
|
823
823
|
*/
|
|
824
824
|
abort(): never;
|
|
825
|
+
/**
|
|
826
|
+
* The `process.addUncaughtExceptionCaptureCallback()` function adds a callback
|
|
827
|
+
* that will be invoked when an uncaught exception occurs, receiving the exception
|
|
828
|
+
* value as its first argument.
|
|
829
|
+
*
|
|
830
|
+
* Unlike `process.setUncaughtExceptionCaptureCallback()`, this function allows
|
|
831
|
+
* multiple callbacks to be registered and does not conflict with the
|
|
832
|
+
* [`domain`](https://nodejs.org/docs/latest-v25.x/api/domain.html) module. Callbacks are called in reverse order of registration
|
|
833
|
+
* (most recent first). If a callback returns `true`, subsequent callbacks
|
|
834
|
+
* and the default uncaught exception handling are skipped.
|
|
835
|
+
*
|
|
836
|
+
* ```js
|
|
837
|
+
* import process from 'node:process';
|
|
838
|
+
*
|
|
839
|
+
* process.addUncaughtExceptionCaptureCallback((err) => {
|
|
840
|
+
* console.error('Caught exception:', err.message);
|
|
841
|
+
* return true; // Indicates exception was handled
|
|
842
|
+
* });
|
|
843
|
+
* ```
|
|
844
|
+
* @since v25.9.0
|
|
845
|
+
*/
|
|
846
|
+
addUncaughtExceptionCaptureCallback(fn: (err: unknown) => boolean): void;
|
|
825
847
|
/**
|
|
826
848
|
* The `process.chdir()` method changes the current working directory of the
|
|
827
849
|
* Node.js process or throws an exception if doing so fails (for instance, if
|
|
@@ -1418,9 +1440,11 @@ declare module "node:process" {
|
|
|
1418
1440
|
* method with a non-`null` argument while another capture function is set will
|
|
1419
1441
|
* throw an error.
|
|
1420
1442
|
*
|
|
1421
|
-
*
|
|
1443
|
+
* To register multiple callbacks that can coexist, use
|
|
1444
|
+
* `process.addUncaughtExceptionCaptureCallback()` instead.
|
|
1422
1445
|
* @since v9.3.0
|
|
1423
1446
|
*/
|
|
1447
|
+
// TODO: callback parameter should be `unknown`
|
|
1424
1448
|
setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
|
1425
1449
|
/**
|
|
1426
1450
|
* Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}.
|
node/quic.d.ts
CHANGED
|
@@ -179,7 +179,7 @@ declare module "node:quic" {
|
|
|
179
179
|
* The TLS crypto keys to use for sessions.
|
|
180
180
|
* @since v23.8.0
|
|
181
181
|
*/
|
|
182
|
-
keys?: KeyObject |
|
|
182
|
+
keys?: KeyObject | readonly KeyObject[] | undefined;
|
|
183
183
|
/**
|
|
184
184
|
* Specifies the maximum UDP packet payload size.
|
|
185
185
|
* @since v23.8.0
|
|
@@ -653,7 +653,7 @@ declare module "node:quic" {
|
|
|
653
653
|
/**
|
|
654
654
|
* Sends an unreliable datagram to the remote peer, returning the datagram ID.
|
|
655
655
|
* If the datagram payload is specified as an `ArrayBufferView`, then ownership of
|
|
656
|
-
* that view will be
|
|
656
|
+
* that view will be transferred to the underlying stream.
|
|
657
657
|
* @since v23.8.0
|
|
658
658
|
*/
|
|
659
659
|
sendDatagram(datagram: string | NodeJS.ArrayBufferView): bigint;
|
node/repl.d.ts
CHANGED
|
@@ -86,6 +86,21 @@ declare module "node:repl" {
|
|
|
86
86
|
* @default false
|
|
87
87
|
*/
|
|
88
88
|
breakEvalOnSigint?: boolean | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* This function customizes error handling in the REPL.
|
|
91
|
+
* It receives the thrown exception as its first argument and must return one
|
|
92
|
+
* of the following values synchronously:
|
|
93
|
+
* * `'print'` to print the error to the output stream (default behavior).
|
|
94
|
+
* * `'ignore'` to skip all remaining error handling.
|
|
95
|
+
* * `'unhandled'` to treat the exception as fully unhandled. In this case,
|
|
96
|
+
* the error will be passed to process-wide exception handlers, such as
|
|
97
|
+
* the `'uncaughtException'` event.
|
|
98
|
+
* The `'unhandled'` value may or may not be desirable in situations
|
|
99
|
+
* where the `REPLServer` instance has been closed, depending on the particular
|
|
100
|
+
* use case.
|
|
101
|
+
* @since v25.9.0
|
|
102
|
+
*/
|
|
103
|
+
handleError?: ((err: unknown) => "print" | "ignore" | "unhandled") | undefined;
|
|
89
104
|
}
|
|
90
105
|
type REPLEval = (
|
|
91
106
|
this: REPLServer,
|
node/stream/iter.d.ts
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
declare module "node:stream/iter" {
|
|
2
|
+
// Symbols and custom typedefs
|
|
3
|
+
const broadcastProtocol: unique symbol;
|
|
4
|
+
const drainableProtocol: unique symbol;
|
|
5
|
+
const shareProtocol: unique symbol;
|
|
6
|
+
const shareSyncProtocol: unique symbol;
|
|
7
|
+
const toAsyncStreamable: unique symbol;
|
|
8
|
+
const toStreamable: unique symbol;
|
|
9
|
+
type Source =
|
|
10
|
+
| string
|
|
11
|
+
| ArrayBufferLike
|
|
12
|
+
| ArrayBufferView
|
|
13
|
+
| Iterable<SyncSource>
|
|
14
|
+
| AsyncIterable<Source>
|
|
15
|
+
| Streamable
|
|
16
|
+
| AsyncStreamable;
|
|
17
|
+
type SyncSource = string | ArrayBufferLike | ArrayBufferView | Iterable<SyncSource> | Streamable;
|
|
18
|
+
type Transform = StatelessTransformFn | StatefulTransform;
|
|
19
|
+
type SyncTransform = SyncStatelessTransformFn | SyncStatefulTransform;
|
|
20
|
+
type TransformResult =
|
|
21
|
+
| string
|
|
22
|
+
| ArrayBufferLike
|
|
23
|
+
| ArrayBufferView
|
|
24
|
+
| Iterable<SyncTransformResult>
|
|
25
|
+
| AsyncIterable<TransformResult>;
|
|
26
|
+
type SyncTransformResult = string | ArrayBufferLike | ArrayBufferView | Iterable<SyncTransformResult>;
|
|
27
|
+
interface AsyncStreamable {
|
|
28
|
+
[toAsyncStreamable](): Source;
|
|
29
|
+
}
|
|
30
|
+
interface Broadcastable {
|
|
31
|
+
[broadcastProtocol](options: BroadcastOptions): Broadcast;
|
|
32
|
+
}
|
|
33
|
+
interface Drainable {
|
|
34
|
+
[drainableProtocol](): Promise<boolean> | null;
|
|
35
|
+
}
|
|
36
|
+
interface Shareable {
|
|
37
|
+
[shareProtocol](options: ShareOptions): Share;
|
|
38
|
+
}
|
|
39
|
+
interface Streamable {
|
|
40
|
+
[toStreamable](): SyncSource;
|
|
41
|
+
}
|
|
42
|
+
interface SyncShareable {
|
|
43
|
+
[shareSyncProtocol](options: ShareSyncOptions): SyncShare;
|
|
44
|
+
}
|
|
45
|
+
// IDL dictionaries, enums, typedefs
|
|
46
|
+
type BackpressurePolicy = "strict" | "block" | "drop-oldest" | "drop-newest";
|
|
47
|
+
type ByteReadableStream = AsyncIterable<Uint8Array[]>;
|
|
48
|
+
type SyncByteReadableStream = Iterable<Uint8Array[]>;
|
|
49
|
+
interface WriteOptions {
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
}
|
|
52
|
+
interface PushStreamOptions {
|
|
53
|
+
highWaterMark?: number;
|
|
54
|
+
backpressure?: BackpressurePolicy;
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
}
|
|
57
|
+
interface PullOptions {
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
}
|
|
60
|
+
interface PipeToOptions {
|
|
61
|
+
signal?: AbortSignal;
|
|
62
|
+
preventClose?: boolean;
|
|
63
|
+
preventFail?: boolean;
|
|
64
|
+
}
|
|
65
|
+
interface PipeToSyncOptions {
|
|
66
|
+
preventClose?: boolean;
|
|
67
|
+
preventFail?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface ConsumeOptions {
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
limit?: number;
|
|
72
|
+
}
|
|
73
|
+
interface ConsumeSyncOptions {
|
|
74
|
+
limit?: number;
|
|
75
|
+
}
|
|
76
|
+
interface TextConsumeOptions extends ConsumeOptions {
|
|
77
|
+
encoding?: string;
|
|
78
|
+
}
|
|
79
|
+
interface TextConsumeSyncOptions extends ConsumeSyncOptions {
|
|
80
|
+
encoding?: string;
|
|
81
|
+
}
|
|
82
|
+
interface MergeOptions {
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
}
|
|
85
|
+
interface BroadcastOptions {
|
|
86
|
+
highWaterMark?: number;
|
|
87
|
+
backpressure?: BackpressurePolicy;
|
|
88
|
+
signal?: AbortSignal;
|
|
89
|
+
}
|
|
90
|
+
interface ShareOptions {
|
|
91
|
+
highWaterMark?: number;
|
|
92
|
+
backpressure?: BackpressurePolicy;
|
|
93
|
+
signal?: AbortSignal;
|
|
94
|
+
}
|
|
95
|
+
interface ShareSyncOptions {
|
|
96
|
+
highWaterMark?: number;
|
|
97
|
+
backpressure?: BackpressurePolicy;
|
|
98
|
+
}
|
|
99
|
+
interface DuplexDirectionOptions {
|
|
100
|
+
highWaterMark?: number;
|
|
101
|
+
backpressure?: BackpressurePolicy;
|
|
102
|
+
}
|
|
103
|
+
interface DuplexOptions {
|
|
104
|
+
highWaterMark?: number;
|
|
105
|
+
backpressure?: BackpressurePolicy;
|
|
106
|
+
a?: DuplexDirectionOptions;
|
|
107
|
+
b?: DuplexDirectionOptions;
|
|
108
|
+
signal?: AbortSignal;
|
|
109
|
+
}
|
|
110
|
+
interface TransformCallbackOptions {
|
|
111
|
+
signal: AbortSignal;
|
|
112
|
+
}
|
|
113
|
+
interface StatelessTransformFn {
|
|
114
|
+
(chunks: Uint8Array[] | null, options: TransformCallbackOptions): TransformResult | null;
|
|
115
|
+
}
|
|
116
|
+
interface SyncStatelessTransformFn {
|
|
117
|
+
(chunks: Uint8Array[] | null): SyncTransformResult | null;
|
|
118
|
+
}
|
|
119
|
+
interface StatefulTransform {
|
|
120
|
+
transform(
|
|
121
|
+
source: AsyncIterable<Uint8Array[] | null>,
|
|
122
|
+
options: TransformCallbackOptions,
|
|
123
|
+
): AsyncIterable<TransformResult>;
|
|
124
|
+
}
|
|
125
|
+
interface SyncStatefulTransform {
|
|
126
|
+
transform(source: Iterable<Uint8Array[] | null>): Iterable<SyncTransformResult>;
|
|
127
|
+
}
|
|
128
|
+
// IDL interfaces
|
|
129
|
+
interface PushWriter extends Writer, Drainable {}
|
|
130
|
+
interface PushStreamResult {
|
|
131
|
+
writer: PushWriter;
|
|
132
|
+
readable: ByteReadableStream;
|
|
133
|
+
}
|
|
134
|
+
interface BroadcastWriter extends Writer, Drainable {}
|
|
135
|
+
interface BroadcastResult {
|
|
136
|
+
writer: BroadcastWriter;
|
|
137
|
+
broadcast: Broadcast;
|
|
138
|
+
}
|
|
139
|
+
interface Writer extends Disposable, AsyncDisposable {
|
|
140
|
+
readonly desiredSize: number | null;
|
|
141
|
+
write(chunk: Uint8Array | string, options?: WriteOptions): Promise<void>;
|
|
142
|
+
writev(chunks: Array<Uint8Array | string>, options?: WriteOptions): Promise<void>;
|
|
143
|
+
writeSync(chunk: Uint8Array | string): boolean;
|
|
144
|
+
writevSync(chunks: Array<Uint8Array | string>): boolean;
|
|
145
|
+
end(options?: WriteOptions): Promise<number>;
|
|
146
|
+
endSync(): number;
|
|
147
|
+
fail(reason?: any): void;
|
|
148
|
+
}
|
|
149
|
+
interface PartialWriter extends Partial<Writer> {
|
|
150
|
+
write(chunk: Uint8Array | string, options?: WriteOptions): Promise<void>;
|
|
151
|
+
}
|
|
152
|
+
interface SyncWriter extends Disposable {
|
|
153
|
+
readonly desiredSize: number | null;
|
|
154
|
+
writeSync(chunk: Uint8Array | string): number;
|
|
155
|
+
writevSync(chunks: Array<Uint8Array | string>): number;
|
|
156
|
+
endSync(): number;
|
|
157
|
+
fail(reason?: any): void;
|
|
158
|
+
}
|
|
159
|
+
interface PartialSyncWriter extends Partial<SyncWriter> {
|
|
160
|
+
writeSync(chunk: Uint8Array | string): number;
|
|
161
|
+
}
|
|
162
|
+
interface Broadcast extends Disposable {
|
|
163
|
+
readonly consumerCount: number;
|
|
164
|
+
readonly bufferSize: number;
|
|
165
|
+
push(...args: any[]): ByteReadableStream;
|
|
166
|
+
cancel(reason?: any): void;
|
|
167
|
+
}
|
|
168
|
+
interface Share extends Disposable {
|
|
169
|
+
readonly consumerCount: number;
|
|
170
|
+
readonly bufferSize: number;
|
|
171
|
+
pull(...args: any[]): ByteReadableStream;
|
|
172
|
+
cancel(reason?: any): void;
|
|
173
|
+
}
|
|
174
|
+
interface SyncShare extends Disposable {
|
|
175
|
+
readonly consumerCount: number;
|
|
176
|
+
readonly bufferSize: number;
|
|
177
|
+
pull(...args: any): SyncByteReadableStream;
|
|
178
|
+
cancel(reason?: any): void;
|
|
179
|
+
}
|
|
180
|
+
interface DuplexChannel extends AsyncDisposable {
|
|
181
|
+
readonly writer: Writer;
|
|
182
|
+
readonly readable: ByteReadableStream;
|
|
183
|
+
close(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
// Push stream creation
|
|
186
|
+
function push(...transforms: Transform[]): PushStreamResult;
|
|
187
|
+
function push(...args: [...transforms: Transform[], options: PushStreamOptions]): PushStreamResult;
|
|
188
|
+
// Stream factories
|
|
189
|
+
function from(input: Source): ByteReadableStream;
|
|
190
|
+
function fromSync(input: SyncSource): SyncByteReadableStream;
|
|
191
|
+
// Pull pipelines
|
|
192
|
+
function pull(source: Source, ...transforms: Transform[]): ByteReadableStream;
|
|
193
|
+
function pull(
|
|
194
|
+
source: Source,
|
|
195
|
+
...args: [...transforms: Transform[], options: PullOptions]
|
|
196
|
+
): ByteReadableStream;
|
|
197
|
+
function pullSync(source: SyncSource, ...transforms: SyncTransform[]): SyncByteReadableStream;
|
|
198
|
+
// Pipe operations
|
|
199
|
+
function pipeTo(source: Source, writer: PartialWriter, options?: PipeToOptions): Promise<number>;
|
|
200
|
+
function pipeTo(source: Source, ...args: [...transforms: Transform[], writer: PartialWriter]): Promise<number>;
|
|
201
|
+
function pipeTo(
|
|
202
|
+
source: Source,
|
|
203
|
+
...args: [...transforms: Transform[], writer: PartialWriter, options: PipeToOptions]
|
|
204
|
+
): Promise<number>;
|
|
205
|
+
function pipeToSync(source: SyncSource, writer: PartialSyncWriter, options?: PipeToSyncOptions): number;
|
|
206
|
+
function pipeToSync(
|
|
207
|
+
source: SyncSource,
|
|
208
|
+
...args: [...transforms: SyncTransform[], writer: PartialSyncWriter]
|
|
209
|
+
): number;
|
|
210
|
+
function pipeToSync(
|
|
211
|
+
source: SyncSource,
|
|
212
|
+
...args: [...transforms: SyncTransform[], writer: PartialSyncWriter, options: PipeToSyncOptions]
|
|
213
|
+
): number;
|
|
214
|
+
// Consumers
|
|
215
|
+
function bytes(source: Source, options?: ConsumeOptions): Promise<Uint8Array>;
|
|
216
|
+
function bytesSync(source: SyncSource, options?: ConsumeSyncOptions): Uint8Array;
|
|
217
|
+
function text(source: Source, options?: TextConsumeOptions): Promise<string>;
|
|
218
|
+
function textSync(source: SyncSource, options?: TextConsumeSyncOptions): string;
|
|
219
|
+
function arrayBuffer(source: Source, options?: ConsumeOptions): Promise<ArrayBuffer>;
|
|
220
|
+
function arrayBufferSync(source: SyncSource, options?: ConsumeSyncOptions): ArrayBuffer;
|
|
221
|
+
function array(source: Source, options?: ConsumeOptions): Promise<Uint8Array[]>;
|
|
222
|
+
function arraySync(source: SyncSource, options?: ConsumeSyncOptions): Uint8Array[];
|
|
223
|
+
// Utilities
|
|
224
|
+
function tap(callback: StatelessTransformFn): StatelessTransformFn;
|
|
225
|
+
function tapSync(callback: SyncStatelessTransformFn): SyncStatelessTransformFn;
|
|
226
|
+
function merge(...sources: Source[]): ByteReadableStream;
|
|
227
|
+
function merge(...args: [...sources: Source[], options: MergeOptions]): ByteReadableStream;
|
|
228
|
+
function ondrain(drainable: any): Promise<boolean> | null;
|
|
229
|
+
// Multi-consumer
|
|
230
|
+
function broadcast(options?: BroadcastOptions): BroadcastResult;
|
|
231
|
+
function share(source: Source, options?: ShareOptions): Share;
|
|
232
|
+
function shareSync(source: SyncSource, options?: ShareSyncOptions): SyncShare;
|
|
233
|
+
// Duplex
|
|
234
|
+
function duplex(options?: DuplexOptions): [DuplexChannel, DuplexChannel];
|
|
235
|
+
// Node.js-specific extensions
|
|
236
|
+
namespace Broadcast {
|
|
237
|
+
/**
|
|
238
|
+
* Create a `Broadcast` from an existing source. The source is consumed
|
|
239
|
+
* automatically and pushed to all subscribers.
|
|
240
|
+
* @since v25.9.0
|
|
241
|
+
* @param options Same as `broadcast()`.
|
|
242
|
+
*/
|
|
243
|
+
function from(
|
|
244
|
+
input: ByteReadableStream | SyncByteReadableStream | Broadcastable,
|
|
245
|
+
options?: BroadcastOptions,
|
|
246
|
+
): BroadcastResult;
|
|
247
|
+
}
|
|
248
|
+
namespace Share {
|
|
249
|
+
/**
|
|
250
|
+
* Create a `Share` from an existing source.
|
|
251
|
+
* @since v25.9.0
|
|
252
|
+
* @param options Same as `share()`.
|
|
253
|
+
*/
|
|
254
|
+
function from(input: ByteReadableStream | SyncByteReadableStream | Shareable, options?: ShareOptions): Share;
|
|
255
|
+
}
|
|
256
|
+
namespace SyncShare {
|
|
257
|
+
/**
|
|
258
|
+
* @since v25.9.0
|
|
259
|
+
*/
|
|
260
|
+
function from(input: SyncByteReadableStream | SyncShareable, options?: ShareSyncOptions): SyncShare;
|
|
261
|
+
}
|
|
262
|
+
namespace Stream {
|
|
263
|
+
export {
|
|
264
|
+
array,
|
|
265
|
+
arrayBuffer,
|
|
266
|
+
arrayBufferSync,
|
|
267
|
+
arraySync,
|
|
268
|
+
broadcast,
|
|
269
|
+
broadcastProtocol,
|
|
270
|
+
bytes,
|
|
271
|
+
bytesSync,
|
|
272
|
+
drainableProtocol,
|
|
273
|
+
duplex,
|
|
274
|
+
from,
|
|
275
|
+
fromSync,
|
|
276
|
+
merge,
|
|
277
|
+
ondrain,
|
|
278
|
+
pipeTo,
|
|
279
|
+
pipeToSync,
|
|
280
|
+
pull,
|
|
281
|
+
pullSync,
|
|
282
|
+
push,
|
|
283
|
+
share,
|
|
284
|
+
shareProtocol,
|
|
285
|
+
shareSync,
|
|
286
|
+
shareSyncProtocol,
|
|
287
|
+
tap,
|
|
288
|
+
tapSync,
|
|
289
|
+
text,
|
|
290
|
+
textSync,
|
|
291
|
+
toAsyncStreamable,
|
|
292
|
+
toStreamable,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
declare module "stream/iter" {
|
|
297
|
+
export * from "node:stream/iter";
|
|
298
|
+
}
|
node/test.d.ts
CHANGED
|
@@ -1479,19 +1479,40 @@ declare module "node:test" {
|
|
|
1479
1479
|
*/
|
|
1480
1480
|
cache?: boolean | undefined;
|
|
1481
1481
|
/**
|
|
1482
|
-
*
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1485
|
-
*
|
|
1486
|
-
* If
|
|
1482
|
+
* Optional mocked exports. The `default` property, if
|
|
1483
|
+
* provided, is used as the mocked module's default export. All other own
|
|
1484
|
+
* enumerable properties are used as named exports.
|
|
1485
|
+
* **This option cannot be used with `defaultExport` or `namedExports`.**
|
|
1486
|
+
* * If the mock is a CommonJS or builtin module, `exports.default` is used as
|
|
1487
|
+
* the value of `module.exports`.
|
|
1488
|
+
* * If `exports.default` is not provided for a CommonJS or builtin mock,
|
|
1489
|
+
* `module.exports` defaults to an empty object.
|
|
1490
|
+
* * If named exports are provided with a non-object default export, the mock
|
|
1491
|
+
* throws an exception when used as a CommonJS or builtin module.
|
|
1492
|
+
*/
|
|
1493
|
+
exports?: object | undefined;
|
|
1494
|
+
/**
|
|
1495
|
+
* An optional value used as the mocked module's default
|
|
1496
|
+
* export. If this value is not provided, ESM mocks do not include a default
|
|
1497
|
+
* export. If the mock is a CommonJS or builtin module, this setting is used as
|
|
1498
|
+
* the value of `module.exports`. If this value is not provided, CJS and builtin
|
|
1499
|
+
* mocks use an empty object as the value of `module.exports`.
|
|
1500
|
+
* **This option cannot be used with `options.exports`.**
|
|
1501
|
+
* This option is deprecated and will be removed in a later version.
|
|
1502
|
+
* Prefer `options.exports.default`.
|
|
1503
|
+
* @deprecated
|
|
1487
1504
|
*/
|
|
1488
1505
|
defaultExport?: any;
|
|
1489
1506
|
/**
|
|
1490
|
-
* An object whose keys and values are used to
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1507
|
+
* An optional object whose keys and values are used to
|
|
1508
|
+
* create the named exports of the mock module. If the mock is a CommonJS or
|
|
1509
|
+
* builtin module, these values are copied onto `module.exports`. Therefore, if a
|
|
1510
|
+
* mock is created with both named exports and a non-object default export, the
|
|
1511
|
+
* mock will throw an exception when used as a CJS or builtin module.
|
|
1512
|
+
* **This option cannot be used with `options.exports`.**
|
|
1513
|
+
* This option is deprecated and will be removed in a later version.
|
|
1514
|
+
* Prefer `options.exports`.
|
|
1515
|
+
* @deprecated
|
|
1495
1516
|
*/
|
|
1496
1517
|
namedExports?: object | undefined;
|
|
1497
1518
|
}
|
|
@@ -1666,14 +1687,19 @@ declare module "node:test" {
|
|
|
1666
1687
|
* [`--experimental-test-module-mocks`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--experimental-test-module-mocks)
|
|
1667
1688
|
* command-line flag.
|
|
1668
1689
|
*
|
|
1690
|
+
* **Note**: [module customization hooks](https://nodejs.org/docs/latest-v25.x/api/module.html#customization-hooks) registered via the **synchronous** API effect resolution of
|
|
1691
|
+
* the `specifier` provided to `mock.module`. Customization hooks registered via the **asynchronous**
|
|
1692
|
+
* API are currently ignored (because the test runner's loader is synchronous, and node does not
|
|
1693
|
+
* support multi-chain / cross-chain loading).
|
|
1694
|
+
*
|
|
1669
1695
|
* The following example demonstrates how a mock is created for a module.
|
|
1670
1696
|
*
|
|
1671
1697
|
* ```js
|
|
1672
1698
|
* test('mocks a builtin module in both module systems', async (t) => {
|
|
1673
|
-
* // Create a mock of 'node:readline' with a named export named '
|
|
1699
|
+
* // Create a mock of 'node:readline' with a named export named 'foo', which
|
|
1674
1700
|
* // does not exist in the original 'node:readline' module.
|
|
1675
1701
|
* const mock = t.mock.module('node:readline', {
|
|
1676
|
-
*
|
|
1702
|
+
* exports: { foo: () => 42 },
|
|
1677
1703
|
* });
|
|
1678
1704
|
*
|
|
1679
1705
|
* let esmImpl = await import('node:readline');
|
node/ts5.6/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
/// <reference path="../sqlite.d.ts" />
|
|
98
98
|
/// <reference path="../stream.d.ts" />
|
|
99
99
|
/// <reference path="../stream/consumers.d.ts" />
|
|
100
|
+
/// <reference path="../stream/iter.d.ts" />
|
|
100
101
|
/// <reference path="../stream/promises.d.ts" />
|
|
101
102
|
/// <reference path="../stream/web.d.ts" />
|
|
102
103
|
/// <reference path="../string_decoder.d.ts" />
|
|
@@ -115,3 +116,4 @@
|
|
|
115
116
|
/// <reference path="../wasi.d.ts" />
|
|
116
117
|
/// <reference path="../worker_threads.d.ts" />
|
|
117
118
|
/// <reference path="../zlib.d.ts" />
|
|
119
|
+
/// <reference path="../zlib/iter.d.ts" />
|
node/ts5.7/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
/// <reference path="../sqlite.d.ts" />
|
|
98
98
|
/// <reference path="../stream.d.ts" />
|
|
99
99
|
/// <reference path="../stream/consumers.d.ts" />
|
|
100
|
+
/// <reference path="../stream/iter.d.ts" />
|
|
100
101
|
/// <reference path="../stream/promises.d.ts" />
|
|
101
102
|
/// <reference path="../stream/web.d.ts" />
|
|
102
103
|
/// <reference path="../string_decoder.d.ts" />
|
|
@@ -115,3 +116,4 @@
|
|
|
115
116
|
/// <reference path="../wasi.d.ts" />
|
|
116
117
|
/// <reference path="../worker_threads.d.ts" />
|
|
117
118
|
/// <reference path="../zlib.d.ts" />
|
|
119
|
+
/// <reference path="../zlib/iter.d.ts" />
|
node/vm.d.ts
CHANGED
|
@@ -232,11 +232,12 @@ declare module "node:vm" {
|
|
|
232
232
|
*
|
|
233
233
|
* 1. Creates a new context.
|
|
234
234
|
* 2. If `contextObject` is an object, contextifies it with the new context.
|
|
235
|
-
* If
|
|
235
|
+
* If `contextObject` is undefined, creates a new object and contextifies it.
|
|
236
236
|
* If `contextObject` is `vm.constants.DONT_CONTEXTIFY`, don't contextify anything.
|
|
237
|
-
* 3.
|
|
238
|
-
*
|
|
239
|
-
*
|
|
237
|
+
* 3. Compiles the code as a `vm.Script`
|
|
238
|
+
* 4. Runs the compiled code within the created context. The code does not have access to the scope in
|
|
239
|
+
* which this method is called.
|
|
240
|
+
* 5. Returns the result.
|
|
240
241
|
*
|
|
241
242
|
* The following example compiles code that sets a global variable, then executes
|
|
242
243
|
* the code multiple times in different contexts. The globals are set on and
|
node/zlib/iter.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
declare module "node:zlib/iter" {
|
|
2
|
+
import { StatefulTransform, SyncStatefulTransform } from "node:stream/iter";
|
|
3
|
+
interface BrotliOptions {
|
|
4
|
+
chunkSize?: number | undefined;
|
|
5
|
+
params?: { [key: number]: number | boolean } | undefined;
|
|
6
|
+
dictionary?: NodeJS.ArrayBufferView | undefined;
|
|
7
|
+
}
|
|
8
|
+
interface ZlibOptions {
|
|
9
|
+
chunkSize?: number | undefined;
|
|
10
|
+
windowBits?: number | undefined;
|
|
11
|
+
dictionary?: NodeJS.ArrayBufferView | undefined;
|
|
12
|
+
}
|
|
13
|
+
interface ZlibCompressionOptions extends ZlibOptions {
|
|
14
|
+
level?: number | undefined;
|
|
15
|
+
memLevel?: number | undefined;
|
|
16
|
+
strategy?: number | undefined;
|
|
17
|
+
}
|
|
18
|
+
interface ZstdOptions {
|
|
19
|
+
chunkSize?: number | undefined;
|
|
20
|
+
params?: { [key: number]: number | boolean } | undefined;
|
|
21
|
+
dictionary?: NodeJS.ArrayBufferView | undefined;
|
|
22
|
+
}
|
|
23
|
+
interface ZstdCompressionOptions extends ZstdOptions {
|
|
24
|
+
pledgedSrcSize?: number | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a Brotli compression transform. Output is compatible with
|
|
28
|
+
* `zlib.brotliDecompress()` and `decompressBrotli()`/`decompressBrotliSync()`.
|
|
29
|
+
* @since v25.9.0
|
|
30
|
+
* @returns A stateful transform.
|
|
31
|
+
*/
|
|
32
|
+
function compressBrotli(options?: BrotliOptions): StatefulTransform;
|
|
33
|
+
/**
|
|
34
|
+
* Create a Brotli compression transform. Output is compatible with
|
|
35
|
+
* `zlib.brotliDecompress()` and `decompressBrotli()`/`decompressBrotliSync()`.
|
|
36
|
+
* @since v25.9.0
|
|
37
|
+
* @returns A stateful transform.
|
|
38
|
+
*/
|
|
39
|
+
function compressBrotliSync(options?: BrotliOptions): SyncStatefulTransform;
|
|
40
|
+
/**
|
|
41
|
+
* Create a deflate compression transform. Output is compatible with
|
|
42
|
+
* `zlib.inflate()` and `decompressDeflate()`/`decompressDeflateSync()`.
|
|
43
|
+
* @since v25.9.0
|
|
44
|
+
* @returns A stateful transform.
|
|
45
|
+
*/
|
|
46
|
+
function compressDeflate(options?: ZlibCompressionOptions): StatefulTransform;
|
|
47
|
+
/**
|
|
48
|
+
* Create a deflate compression transform. Output is compatible with
|
|
49
|
+
* `zlib.inflate()` and `decompressDeflate()`/`decompressDeflateSync()`.
|
|
50
|
+
* @since v25.9.0
|
|
51
|
+
* @returns A stateful transform.
|
|
52
|
+
*/
|
|
53
|
+
function compressDeflateSync(options?: ZlibCompressionOptions): SyncStatefulTransform;
|
|
54
|
+
/**
|
|
55
|
+
* Create a gzip compression transform. Output is compatible with `zlib.gunzip()`
|
|
56
|
+
* and `decompressGzip()`/`decompressGzipSync()`.
|
|
57
|
+
* @returns A stateful transform.
|
|
58
|
+
*/
|
|
59
|
+
function compressGzip(options?: ZlibCompressionOptions): StatefulTransform;
|
|
60
|
+
/**
|
|
61
|
+
* Create a gzip compression transform. Output is compatible with `zlib.gunzip()`
|
|
62
|
+
* and `decompressGzip()`/`decompressGzipSync()`.
|
|
63
|
+
* @returns A stateful transform.
|
|
64
|
+
*/
|
|
65
|
+
function compressGzipSync(options?: ZlibCompressionOptions): SyncStatefulTransform;
|
|
66
|
+
/**
|
|
67
|
+
* Create a Zstandard compression transform. Output is compatible with
|
|
68
|
+
* `zlib.zstdDecompress()` and `decompressZstd()`/`decompressZstdSync()`.
|
|
69
|
+
* @since v25.9.0
|
|
70
|
+
* @returns A stateful transform.
|
|
71
|
+
*/
|
|
72
|
+
function compressZstd(options?: ZstdCompressionOptions): StatefulTransform;
|
|
73
|
+
/**
|
|
74
|
+
* Create a Zstandard compression transform. Output is compatible with
|
|
75
|
+
* `zlib.zstdDecompress()` and `decompressZstd()`/`decompressZstdSync()`.
|
|
76
|
+
* @since v25.9.0
|
|
77
|
+
* @returns A stateful transform.
|
|
78
|
+
*/
|
|
79
|
+
function compressZstdSync(options?: ZstdCompressionOptions): SyncStatefulTransform;
|
|
80
|
+
/**
|
|
81
|
+
* Create a Brotli decompression transform.
|
|
82
|
+
* @since v25.9.0
|
|
83
|
+
* @returns A stateful transform.
|
|
84
|
+
*/
|
|
85
|
+
function decompressBrotli(options?: BrotliOptions): StatefulTransform;
|
|
86
|
+
/**
|
|
87
|
+
* Create a Brotli decompression transform.
|
|
88
|
+
* @since v25.9.0
|
|
89
|
+
* @returns A stateful transform.
|
|
90
|
+
*/
|
|
91
|
+
function decompressBrotliSync(options?: BrotliOptions): SyncStatefulTransform;
|
|
92
|
+
/**
|
|
93
|
+
* Create a deflate decompression transform.
|
|
94
|
+
* @since v25.9.0
|
|
95
|
+
* @returns A stateful transform.
|
|
96
|
+
*/
|
|
97
|
+
function decompressDeflate(options?: ZlibOptions): StatefulTransform;
|
|
98
|
+
/**
|
|
99
|
+
* Create a deflate decompression transform.
|
|
100
|
+
* @since v25.9.0
|
|
101
|
+
* @returns A stateful transform.
|
|
102
|
+
*/
|
|
103
|
+
function decompressDeflateSync(options?: ZlibOptions): SyncStatefulTransform;
|
|
104
|
+
/**
|
|
105
|
+
* Create a gzip decompression transform.
|
|
106
|
+
* @since v25.9.0
|
|
107
|
+
* @returns A stateful transform.
|
|
108
|
+
*/
|
|
109
|
+
function decompressGzip(options?: ZlibOptions): StatefulTransform;
|
|
110
|
+
/**
|
|
111
|
+
* Create a gzip decompression transform.
|
|
112
|
+
* @since v25.9.0
|
|
113
|
+
* @returns A stateful transform.
|
|
114
|
+
*/
|
|
115
|
+
function decompressGzipSync(options?: ZlibOptions): SyncStatefulTransform;
|
|
116
|
+
/**
|
|
117
|
+
* Create a Zstandard decompression transform.
|
|
118
|
+
* @since v25.9.0
|
|
119
|
+
* @returns A stateful transform.
|
|
120
|
+
*/
|
|
121
|
+
function decompressZstd(options?: ZstdOptions): StatefulTransform;
|
|
122
|
+
/**
|
|
123
|
+
* Create a Zstandard decompression transform.
|
|
124
|
+
* @since v25.9.0
|
|
125
|
+
* @returns A stateful transform.
|
|
126
|
+
*/
|
|
127
|
+
function decompressZstdSync(options?: ZstdOptions): SyncStatefulTransform;
|
|
128
|
+
}
|
|
129
|
+
declare module "zlib/iter" {
|
|
130
|
+
export * from "node:zlib/iter";
|
|
131
|
+
}
|