Socket
Socket
Sign inDemoInstall

@types/node

Package Overview
Dependencies
Maintainers
1
Versions
1895
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/node - npm Package Compare versions

Comparing version 20.4.5 to 20.6.2

6

node/assert.d.ts

@@ -6,3 +6,3 @@ /**

*/
declare module 'assert' {
declare module 'node:assert' {
/**

@@ -970,5 +970,5 @@ * An alias of {@link ok}.

}
declare module 'node:assert' {
import assert = require('assert');
declare module 'assert' {
import assert = require('node:assert');
export = assert;
}

@@ -17,3 +17,3 @@ /**

*/
declare module 'async_hooks' {
declare module 'node:async_hooks' {
/**

@@ -25,2 +25,3 @@ * ```js

* console.log(executionAsyncId()); // 1 - bootstrap
* const path = '.';
* fs.open(path, 'r', (err, fd) => {

@@ -457,2 +458,3 @@ * console.log(executionAsyncId()); // 6 - open()

*/
run<R>(store: T, callback: () => R): R;
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;

@@ -531,4 +533,4 @@ /**

}
declare module 'node:async_hooks' {
export * from 'async_hooks';
declare module 'async_hooks' {
export * from 'node:async_hooks';
}

@@ -55,3 +55,3 @@ /**

*/
declare module 'cluster' {
declare module 'node:cluster' {
import * as child from 'node:child_process';

@@ -412,5 +412,5 @@ import EventEmitter = require('node:events');

}
declare module 'node:cluster' {
export * from 'cluster';
export { default as default } from 'cluster';
declare module 'cluster' {
export * from 'node:cluster';
export { default as default } from 'node:cluster';
}
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
declare module 'constants' {
declare module 'node:constants' {
import { constants as osConstants, SignalConstants } from 'node:os';

@@ -15,5 +15,5 @@ import { constants as cryptoConstants } from 'node:crypto';

declare module 'node:constants' {
import constants = require('constants');
declare module 'constants' {
import constants = require('node:constants');
export = constants;
}

@@ -28,3 +28,3 @@ /**

*/
declare module 'dgram' {
declare module 'node:dgram' {
import { AddressInfo } from 'node:net';

@@ -542,6 +542,11 @@ import * as dns from 'node:dns';

prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
/**
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
}
declare module 'node:dgram' {
export * from 'dgram';
declare module 'dgram' {
export * from 'node:dgram';
}

@@ -25,3 +25,3 @@ /**

*/
declare module 'diagnostics_channel' {
declare module 'node:diagnostics_channel' {
/**

@@ -190,4 +190,4 @@ * Check if there are active subscribers to the named channel. This is helpful if

}
declare module 'node:diagnostics_channel' {
export * from 'diagnostics_channel';
declare module 'diagnostics_channel' {
export * from 'node:diagnostics_channel';
}

@@ -47,3 +47,3 @@ /**

*/
declare module 'dns' {
declare module 'node:dns' {
import * as dnsPromises from 'node:dns/promises';

@@ -667,4 +667,4 @@ // Supported getaddrinfo flags.

}
declare module 'node:dns' {
export * from 'dns';
declare module 'dns' {
export * from 'node:dns';
}

@@ -7,3 +7,3 @@ /**

*/
declare module 'dns/promises' {
declare module 'node:dns/promises' {
import {

@@ -413,4 +413,4 @@ LookupAddress,

}
declare module 'node:dns/promises' {
export * from 'dns/promises';
declare module 'dns/promises' {
export * from 'node:dns/promises';
}

@@ -17,3 +17,3 @@ /**

*/
declare module 'domain' {
declare module 'node:domain' {
import EventEmitter = require('node:events');

@@ -169,4 +169,4 @@ /**

}
declare module 'node:domain' {
export * from 'domain';
declare module 'domain' {
export * from 'node:domain';
}

@@ -37,3 +37,3 @@ /**

*/
declare module 'events' {
declare module 'node:events' {
// NOTE: This class is in the docs but is **not actually exported** by Node.

@@ -343,2 +343,37 @@ // If https://github.com/nodejs/node/issues/39903 gets resolved and Node

/**
* Listens once to the `abort` event on the provided `signal`.
*
* Listening to the `abort` event on abort signals is unsafe and may
* lead to resource leaks since another third party with the signal can
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
* this since it would violate the web standard. Additionally, the original
* API makes it easy to forget to remove listeners.
*
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
* two issues by listening to the event such that `stopImmediatePropagation` does
* not prevent the listener from running.
*
* Returns a disposable so that it may be unsubscribed from more easily.
*
* ```js
* import { addAbortListener } from 'node:events';
*
* function example(signal) {
* let disposable;
* try {
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
* disposable = addAbortListener(signal, (e) => {
* // Do something when signal is aborted.
* });
* } finally {
* disposable?.[Symbol.dispose]();
* }
* }
* ```
* @since v20.5.0
* @experimental
* @return that removes the `abort` listener.
*/
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
/**
* This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.

@@ -752,5 +787,5 @@ *

}
declare module 'node:events' {
import events = require('events');
declare module 'events' {
import events = require('node:events');
export = events;
}

@@ -11,3 +11,3 @@ /**

*/
declare module 'fs/promises' {
declare module 'node:fs/promises' {
import { Abortable } from 'node:events';

@@ -85,2 +85,3 @@ import { Stream } from 'node:stream';

start?: number | undefined;
highWaterMark?: number | undefined;
}

@@ -461,2 +462,7 @@ interface ReadableWebStreamOptions {

close(): Promise<void>;
/**
* An alias for {@link FileHandle.close()}.
* @since v20.4.0
*/
[Symbol.asyncDispose](): Promise<void>;
}

@@ -1198,4 +1204,4 @@ const constants: typeof fsConstants;

}
declare module 'node:fs/promises' {
export * from 'fs/promises';
declare module 'fs/promises' {
export * from 'node:fs/promises';
}

@@ -87,2 +87,24 @@ // Declare "static" methods in Error

//#region Disposable
interface SymbolConstructor {
/**
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
*/
readonly dispose: unique symbol;
/**
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
*/
readonly asyncDispose: unique symbol;
}
interface Disposable {
[Symbol.dispose](): void;
}
interface AsyncDisposable {
[Symbol.asyncDispose](): PromiseLike<void>;
}
//#endregion Disposable
//#region ArrayLike.at()

@@ -89,0 +111,0 @@ interface RelativeIndexable<T> {

@@ -6,3 +6,3 @@ /**

*/
declare module 'https' {
declare module 'node:https' {
import { Duplex } from 'node:stream';

@@ -440,4 +440,4 @@ import * as tls from 'node:tls';

}
declare module 'node:https' {
export * from 'https';
declare module 'https' {
export * from 'node:https';
}

@@ -1,2 +0,2 @@

// Type definitions for non-npm package Node.js 20.4
// Type definitions for non-npm package Node.js 20.6
// Project: https://nodejs.org/

@@ -24,3 +24,2 @@ // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>

// Sebastian Silbermann <https://github.com/eps1lon>
// Simon Schick <https://github.com/SimonSchick>
// Thomas den Hollander <https://github.com/ThomasdenH>

@@ -27,0 +26,0 @@ // Wilco Bakker <https://github.com/WilcoBakker>

/**
* @since v0.3.7
*/
declare module 'module' {
declare module 'node:module' {
import { URL } from 'node:url';
import { MessagePort } from 'node:worker_threads';
namespace Module {

@@ -95,3 +96,121 @@ /**

}
interface ImportAssertions extends NodeJS.Dict<string> {
type?: string | undefined;
}
type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
interface GlobalPreloadContext {
port: MessagePort;
}
/**
* @deprecated This hook will be removed in a future version.
* Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
*
* Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
* This hook allows the return of a string that is run as a sloppy-mode script on startup.
*
* @param context Information to assist the preload code
* @return Code to run before application startup
*/
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
/**
* The `initialize` hook provides a way to define a custom function that runs in the loader's thread
* when the loader is initialized. Initialization happens when the loader is registered via `register`
* or registered via the `--experimental-loader` command line option.
*
* This hook can send and receive data from a `register` invocation, including ports and other transferrable objects.
*/
type InitializeHook<Data = any, ReturnType = any> = (data: Data) => ReturnType;
interface ResolveHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAssertions: ImportAssertions;
/**
* The module importing this one, or undefined if this is the Node.js entry point
*/
parentURL: string | undefined;
}
interface ResolveFnOutput {
/**
* A hint to the load hook (it might be ignored)
*/
format?: ModuleFormat | null | undefined;
/**
* The import assertions to use when caching the module (optional; if excluded the input will be used)
*/
importAssertions?: ImportAssertions | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The absolute URL to which this input resolves
*/
url: string;
}
/**
* The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook.
* If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`);
* if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
*
* @param specifier The specified URL path of the module to be resolved
* @param context
* @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
*/
type ResolveHook = (
specifier: string,
context: ResolveHookContext,
nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput | Promise<ResolveFnOutput>
) => ResolveFnOutput | Promise<ResolveFnOutput>;
interface LoadHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* The format optionally supplied by the `resolve` hook chain
*/
format: ModuleFormat;
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAssertions: ImportAssertions;
}
interface LoadFnOutput {
format: ModuleFormat;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The source for Node.js to evaluate
*/
source?: ModuleSource;
}
/**
* The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
* It is also in charge of validating the import assertion.
*
* @param url The URL/path of the module to be loaded
* @param context Metadata about the module
* @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
*/
type LoadHook = (
url: string,
context: LoadHookContext,
nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>
) => LoadFnOutput | Promise<LoadFnOutput>;
}
interface RegisterOptions<Data> {
parentURL: string;
data?: Data | undefined;
transferList?: any[] | undefined;
}
interface Module extends NodeModule {}

@@ -105,2 +224,4 @@ class Module {

static Module: typeof Module;
static register<Data = any, ReturnType = any>(specifier: string, parentURL?: string, options?: RegisterOptions<Data>): ReturnType;
static register<Data = any, ReturnType = any>(specifier: string, options?: RegisterOptions<Data>): ReturnType;
constructor(id: string, parent?: Module);

@@ -112,3 +233,10 @@ }

/**
* @experimental
* Provides a module-relative resolution function scoped to each module, returning
* the URL string.
*
* @param specified The module specifier to resolve relative to the current module.
* @returns The absolute (`file:`) URL string for the resolved module.
*/
resolve(specified: string): string;
/**
* This feature is only available with the `--experimental-import-meta-resolve`

@@ -121,6 +249,6 @@ * command flag enabled.

* @param specified The module specifier to resolve relative to `parent`.
* @param parent The absolute parent module URL to resolve from. If none
* is specified, the value of `import.meta.url` is used as the default.
* @param parent The absolute parent module URL to resolve from.
* @returns The absolute (`file:`) URL string for the resolved module.
*/
resolve?(specified: string, parent?: string | URL): Promise<string>;
resolve(specified: string, parent: string | URL): string;
}

@@ -130,5 +258,5 @@ }

}
declare module 'node:module' {
import module = require('module');
declare module 'module' {
import module = require('node:module');
export = module;
}

@@ -15,3 +15,3 @@ /**

*/
declare module 'net' {
declare module 'node:net' {
import * as stream from 'node:stream';

@@ -643,2 +643,7 @@ import { Abortable, EventEmitter } from 'node:events';

prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
/**
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}

@@ -888,4 +893,4 @@ type IPVersion = 'ipv4' | 'ipv6';

}
declare module 'node:net' {
export * from 'net';
declare module 'net' {
export * from 'node:net';
}

@@ -10,3 +10,3 @@ /**

*/
declare module 'os' {
declare module 'node:os' {
interface CpuInfo {

@@ -476,4 +476,4 @@ model: string;

}
declare module 'node:os' {
export * from 'os';
declare module 'os' {
export * from 'node:os';
}
{
"name": "@types/node",
"version": "20.4.5",
"version": "20.6.2",
"description": "TypeScript definitions for Node.js",

@@ -114,7 +114,2 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",

{
"name": "Simon Schick",
"url": "https://github.com/SimonSchick",
"githubUsername": "SimonSchick"
},
{
"name": "Thomas den Hollander",

@@ -236,4 +231,4 @@ "url": "https://github.com/ThomasdenH",

"dependencies": {},
"typesPublisherContentHash": "523c3ee141fe5d8696506d030b2c0e0644b83109eda0aa80f163ea11d9339469",
"typeScriptVersion": "4.3"
"typesPublisherContentHash": "666d6ac9c6061bdb566c308767b3da161cec6ddb4cee15a88eaa8419321130a9",
"typeScriptVersion": "4.5"
}
declare module 'path/posix' {
import path = require('path');
import path = require('node:path');
export = path;
}
declare module 'path/win32' {
import path = require('path');
import path = require('node:path');
export = path;

@@ -18,3 +18,3 @@ }

*/
declare module 'path' {
declare module 'node:path' {
namespace path {

@@ -181,4 +181,4 @@ /**

}
declare module 'node:path' {
import path = require('path');
declare module 'path' {
import path = require('node:path');
export = path;

@@ -185,0 +185,0 @@ }

@@ -32,5 +32,5 @@ /**

*/
declare module 'perf_hooks' {
declare module 'node:perf_hooks' {
import { AsyncResource } from 'node:async_hooks';
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http' | 'dns';
interface NodeGCPerformanceDetail {

@@ -637,4 +637,4 @@ /**

}
declare module 'node:perf_hooks' {
export * from 'perf_hooks';
declare module 'perf_hooks' {
export * from 'node:perf_hooks';
}

@@ -29,3 +29,3 @@ /**

*/
declare module 'punycode' {
declare module 'node:punycode' {
/**

@@ -116,4 +116,4 @@ * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only

}
declare module 'node:punycode' {
export * from 'punycode';
declare module 'punycode' {
export * from 'node:punycode';
}

@@ -14,3 +14,3 @@ /**

*/
declare module 'querystring' {
declare module 'node:querystring' {
interface StringifyOptions {

@@ -130,4 +130,4 @@ encodeURIComponent?: ((str: string) => string) | undefined;

}
declare module 'node:querystring' {
export * from 'querystring';
declare module 'querystring' {
export * from 'node:querystring';
}

@@ -35,3 +35,3 @@ /**

*/
declare module 'readline' {
declare module 'node:readline' {
import { Abortable, EventEmitter } from 'node:events';

@@ -525,4 +525,4 @@ import * as promises from 'node:readline/promises';

}
declare module 'node:readline' {
export * from 'readline';
declare module 'readline' {
export * from 'node:readline';
}

@@ -5,3 +5,3 @@ /**

*/
declare module 'readline/promises' {
declare module 'node:readline/promises' {
import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';

@@ -144,4 +144,4 @@ import { Abortable } from 'node:events';

}
declare module 'node:readline/promises' {
export * from 'readline/promises';
declare module 'readline/promises' {
export * from 'node:readline/promises';
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Tue, 25 Jul 2023 19:02:55 GMT
* Last updated: Sat, 16 Sep 2023 06:34:52 GMT
* Dependencies: none

@@ -17,2 +17,2 @@ * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`

# Credits
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).

@@ -11,3 +11,3 @@ /**

*/
declare module 'repl' {
declare module 'node:repl' {
import { Interface, Completer, AsyncCompleter } from 'node:readline';

@@ -423,4 +423,4 @@ import { Context } from 'node:vm';

}
declare module 'node:repl' {
export * from 'repl';
declare module 'repl' {
export * from 'node:repl';
}

@@ -1,2 +0,2 @@

declare module 'stream/consumers' {
declare module 'node:stream/consumers' {
import { Blob as NodeBlob } from 'node:buffer';

@@ -10,4 +10,4 @@ import { Readable } from 'node:stream';

}
declare module 'node:stream/consumers' {
export * from 'stream/consumers';
declare module 'stream/consumers' {
export * from 'node:stream/consumers';
}

@@ -1,2 +0,2 @@

declare module 'stream/promises' {
declare module 'node:stream/promises' {
import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';

@@ -40,4 +40,4 @@ function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;

}
declare module 'node:stream/promises' {
export * from 'stream/promises';
declare module 'stream/promises' {
export * from 'node:stream/promises';
}

@@ -1,2 +0,2 @@

declare module 'stream/web' {
declare module 'node:stream/web' {
// stub module, pending copy&paste from .d.ts or manual impl

@@ -328,4 +328,4 @@ // copy from lib.dom.d.ts

}
declare module 'node:stream/web' {
export * from 'stream/web';
declare module 'stream/web' {
export * from 'node:stream/web';
}

@@ -41,3 +41,3 @@ /**

*/
declare module 'string_decoder' {
declare module 'node:string_decoder' {
class StringDecoder {

@@ -66,4 +66,4 @@ constructor(encoding?: BufferEncoding);

}
declare module 'node:string_decoder' {
export * from 'string_decoder';
declare module 'string_decoder' {
export * from 'node:string_decoder';
}

@@ -79,6 +79,7 @@ /**

* @since v18.0.0, v16.17.0
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test.js)
* @see [source](https://github.com/nodejs/node/blob/v20.4.0/lib/test.js)
*/
declare module 'node:test' {
import { Readable } from 'node:stream';
import { AsyncResource } from 'node:async_hooks';
/**

@@ -259,5 +260,14 @@ * ```js

* The type of a function under Suite.
* If the test uses callbacks, the callback function is passed as an argument
*/
type SuiteFn = (s: SuiteContext) => void | Promise<void>;
interface TestShard {
/**
* A positive integer between 1 and `<total>` that specifies the index of the shard to run.
*/
index: number;
/**
* A positive integer that specifies the total number of shards to split the test files to.
*/
total: number;
}
interface RunOptions {

@@ -300,3 +310,26 @@ /**

testNamePatterns?: string | RegExp | string[] | RegExp[];
/**
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
*/
setup?: (root: Test) => void | Promise<void>;
/**
* Whether to run in watch mode or not.
* @default false
*/
watch?: boolean | undefined;
/**
* Running tests in a specific shard.
* @default undefined
*/
shard?: TestShard | undefined;
}
class Test extends AsyncResource {
concurrency: number;
nesting: number;
only: boolean;
reporter: TestsStream;
runOnlySubtests: boolean;
testNumber: number;
timeout: number | null;
}
/**

@@ -621,3 +654,3 @@ * A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.`TestsStream` will emit events, in the

*/
type HookFn = (done: (result?: any) => void) => any;
type HookFn = (s: SuiteContext, done: (result?: any) => void) => any;
/**

@@ -1199,2 +1232,6 @@ * Configuration options for hooks.

runAll(): void;
/**
* Calls {@link MockTimers.reset()}.
*/
[Symbol.dispose](): void;
}

@@ -1226,3 +1263,3 @@ export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo };

*/
duration: number;
duration_ms: number;
/**

@@ -1232,2 +1269,7 @@ * The error thrown by the test.

error: Error;
/**
* The type of the test, used to denote whether this is a suite.
* @since 20.0.0, 19.9.0, 18.17.0
*/
type?: 'suite';
};

@@ -1267,3 +1309,8 @@ /**

*/
duration: number;
duration_ms: number;
/**
* The type of the test, used to denote whether this is a suite.
* @since 20.0.0, 19.9.0, 18.17.0
*/
type?: 'suite';
};

@@ -1343,2 +1390,30 @@ /**

}
interface TestEnqueue {
/**
* The test name
*/
name: string;
/**
* The path of the test file, undefined if test is not ran through a file.
*/
file?: string;
/**
* The nesting level of the test.
*/
nesting: number;
}
interface TestDequeue {
/**
* The test name
*/
name: string;
/**
* The path of the test file, undefined if test is not ran through a file.
*/
file?: string;
/**
* The nesting level of the test.
*/
nesting: number;
}

@@ -1372,3 +1447,6 @@ /**

| { type: 'test:stderr', data: TestStderr }
| { type: 'test:stdout', data: TestStdout };
| { type: 'test:stdout', data: TestStdout }
| { type: 'test:enqueue', data: TestEnqueue }
| { type: 'test:dequeue', data: TestDequeue }
| { type: 'test:watch:drained' };
type TestEventGenerator = AsyncGenerator<TestEvent, void>;

@@ -1392,3 +1470,3 @@

}
export { dot, tap, Spec as spec };
export { dot, tap, Spec as spec, TestEvent };
}

@@ -11,3 +11,3 @@ /**

*/
declare module 'timers' {
declare module 'node:timers' {
import { Abortable } from 'node:events';

@@ -72,2 +72,7 @@ import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';

_onImmediate: Function; // to distinguish it from the Timeout class
/**
* Cancels the immediate. This is similar to calling `clearImmediate()`.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}

@@ -119,2 +124,7 @@ /**

[Symbol.toPrimitive](): number;
/**
* Cancels the timeout.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}

@@ -169,6 +179,6 @@ }

*/
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
// util.promisify no rest args compability
// tslint:disable-next-line void-return
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
namespace setInterval {

@@ -217,4 +227,4 @@ const __promisify__: typeof setIntervalPromise;

}
declare module 'node:timers' {
export * from 'timers';
declare module 'timers' {
export * from 'node:timers';
}

@@ -14,3 +14,3 @@ /**

*/
declare module 'timers/promises' {
declare module 'node:timers/promises' {
import { TimerOptions } from 'node:timers';

@@ -92,4 +92,4 @@ /**

}
declare module 'node:timers/promises' {
export * from 'timers/promises';
declare module 'timers/promises' {
export * from 'node:timers/promises';
}

@@ -11,3 +11,3 @@ /**

*/
declare module 'tls' {
declare module 'node:tls' {
import { X509Certificate } from 'node:crypto';

@@ -1129,4 +1129,4 @@ import * as net from 'node:net';

}
declare module 'node:tls' {
export * from 'tls';
declare module 'tls' {
export * from 'node:tls';
}

@@ -99,3 +99,3 @@ /**

*/
declare module 'trace_events' {
declare module 'node:trace_events' {
/**

@@ -181,4 +181,4 @@ * The `Tracing` object is used to enable or disable tracing for sets of

}
declare module 'node:trace_events' {
export * from 'trace_events';
declare module 'trace_events' {
export * from 'node:trace_events';
}

@@ -6,3 +6,3 @@ /**

*/
declare module 'assert' {
declare module 'node:assert' {
/**

@@ -970,5 +970,5 @@ * An alias of {@link ok}.

}
declare module 'node:assert' {
import assert = require('assert');
declare module 'assert' {
import assert = require('node:assert');
export = assert;
}

@@ -17,3 +17,3 @@ /**

*/
declare module 'async_hooks' {
declare module 'node:async_hooks' {
/**

@@ -25,2 +25,3 @@ * ```js

* console.log(executionAsyncId()); // 1 - bootstrap
* const path = '.';
* fs.open(path, 'r', (err, fd) => {

@@ -457,2 +458,3 @@ * console.log(executionAsyncId()); // 6 - open()

*/
run<R>(store: T, callback: () => R): R;
run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;

@@ -531,4 +533,4 @@ /**

}
declare module 'node:async_hooks' {
export * from 'async_hooks';
declare module 'async_hooks' {
export * from 'node:async_hooks';
}

@@ -55,3 +55,3 @@ /**

*/
declare module 'cluster' {
declare module 'node:cluster' {
import * as child from 'node:child_process';

@@ -412,5 +412,5 @@ import EventEmitter = require('node:events');

}
declare module 'node:cluster' {
export * from 'cluster';
export { default as default } from 'cluster';
declare module 'cluster' {
export * from 'node:cluster';
export { default as default } from 'node:cluster';
}
/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
declare module 'constants' {
declare module 'node:constants' {
import { constants as osConstants, SignalConstants } from 'node:os';

@@ -15,5 +15,5 @@ import { constants as cryptoConstants } from 'node:crypto';

declare module 'node:constants' {
import constants = require('constants');
declare module 'constants' {
import constants = require('node:constants');
export = constants;
}

@@ -28,3 +28,3 @@ /**

*/
declare module 'dgram' {
declare module 'node:dgram' {
import { AddressInfo } from 'node:net';

@@ -542,6 +542,11 @@ import * as dns from 'node:dns';

prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
/**
* Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}
}
declare module 'node:dgram' {
export * from 'dgram';
declare module 'dgram' {
export * from 'node:dgram';
}

@@ -25,3 +25,3 @@ /**

*/
declare module 'diagnostics_channel' {
declare module 'node:diagnostics_channel' {
/**

@@ -190,4 +190,4 @@ * Check if there are active subscribers to the named channel. This is helpful if

}
declare module 'node:diagnostics_channel' {
export * from 'diagnostics_channel';
declare module 'diagnostics_channel' {
export * from 'node:diagnostics_channel';
}

@@ -47,3 +47,3 @@ /**

*/
declare module 'dns' {
declare module 'node:dns' {
import * as dnsPromises from 'node:dns/promises';

@@ -667,4 +667,4 @@ // Supported getaddrinfo flags.

}
declare module 'node:dns' {
export * from 'dns';
declare module 'dns' {
export * from 'node:dns';
}

@@ -7,3 +7,3 @@ /**

*/
declare module 'dns/promises' {
declare module 'node:dns/promises' {
import {

@@ -413,4 +413,4 @@ LookupAddress,

}
declare module 'node:dns/promises' {
export * from 'dns/promises';
declare module 'dns/promises' {
export * from 'node:dns/promises';
}

@@ -17,3 +17,3 @@ /**

*/
declare module 'domain' {
declare module 'node:domain' {
import EventEmitter = require('node:events');

@@ -169,4 +169,4 @@ /**

}
declare module 'node:domain' {
export * from 'domain';
declare module 'domain' {
export * from 'node:domain';
}

@@ -37,3 +37,3 @@ /**

*/
declare module 'events' {
declare module 'node:events' {
// NOTE: This class is in the docs but is **not actually exported** by Node.

@@ -343,2 +343,37 @@ // If https://github.com/nodejs/node/issues/39903 gets resolved and Node

/**
* Listens once to the `abort` event on the provided `signal`.
*
* Listening to the `abort` event on abort signals is unsafe and may
* lead to resource leaks since another third party with the signal can
* call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change
* this since it would violate the web standard. Additionally, the original
* API makes it easy to forget to remove listeners.
*
* This API allows safely using `AbortSignal`s in Node.js APIs by solving these
* two issues by listening to the event such that `stopImmediatePropagation` does
* not prevent the listener from running.
*
* Returns a disposable so that it may be unsubscribed from more easily.
*
* ```js
* import { addAbortListener } from 'node:events';
*
* function example(signal) {
* let disposable;
* try {
* signal.addEventListener('abort', (e) => e.stopImmediatePropagation());
* disposable = addAbortListener(signal, (e) => {
* // Do something when signal is aborted.
* });
* } finally {
* disposable?.[Symbol.dispose]();
* }
* }
* ```
* @since v20.5.0
* @experimental
* @return that removes the `abort` listener.
*/
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
/**
* This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.

@@ -752,5 +787,5 @@ *

}
declare module 'node:events' {
import events = require('events');
declare module 'events' {
import events = require('node:events');
export = events;
}

@@ -11,3 +11,3 @@ /**

*/
declare module 'fs/promises' {
declare module 'node:fs/promises' {
import { Abortable } from 'node:events';

@@ -85,2 +85,3 @@ import { Stream } from 'node:stream';

start?: number | undefined;
highWaterMark?: number | undefined;
}

@@ -461,2 +462,7 @@ interface ReadableWebStreamOptions {

close(): Promise<void>;
/**
* An alias for {@link FileHandle.close()}.
* @since v20.4.0
*/
[Symbol.asyncDispose](): Promise<void>;
}

@@ -1198,4 +1204,4 @@ const constants: typeof fsConstants;

}
declare module 'node:fs/promises' {
export * from 'fs/promises';
declare module 'fs/promises' {
export * from 'node:fs/promises';
}

@@ -87,2 +87,24 @@ // Declare "static" methods in Error

//#region Disposable
interface SymbolConstructor {
/**
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
*/
readonly dispose: unique symbol;
/**
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
*/
readonly asyncDispose: unique symbol;
}
interface Disposable {
[Symbol.dispose](): void;
}
interface AsyncDisposable {
[Symbol.asyncDispose](): PromiseLike<void>;
}
//#endregion Disposable
//#region ArrayLike.at()

@@ -89,0 +111,0 @@ interface RelativeIndexable<T> {

@@ -6,3 +6,3 @@ /**

*/
declare module 'https' {
declare module 'node:https' {
import { Duplex } from 'node:stream';

@@ -440,4 +440,4 @@ import * as tls from 'node:tls';

}
declare module 'node:https' {
export * from 'https';
declare module 'https' {
export * from 'node:https';
}
/**
* @since v0.3.7
*/
declare module 'module' {
declare module 'node:module' {
import { URL } from 'node:url';
import { MessagePort } from 'node:worker_threads';
namespace Module {

@@ -95,3 +96,121 @@ /**

}
interface ImportAssertions extends NodeJS.Dict<string> {
type?: string | undefined;
}
type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
interface GlobalPreloadContext {
port: MessagePort;
}
/**
* @deprecated This hook will be removed in a future version.
* Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
*
* Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
* This hook allows the return of a string that is run as a sloppy-mode script on startup.
*
* @param context Information to assist the preload code
* @return Code to run before application startup
*/
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
/**
* The `initialize` hook provides a way to define a custom function that runs in the loader's thread
* when the loader is initialized. Initialization happens when the loader is registered via `register`
* or registered via the `--experimental-loader` command line option.
*
* This hook can send and receive data from a `register` invocation, including ports and other transferrable objects.
*/
type InitializeHook<Data = any, ReturnType = any> = (data: Data) => ReturnType;
interface ResolveHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAssertions: ImportAssertions;
/**
* The module importing this one, or undefined if this is the Node.js entry point
*/
parentURL: string | undefined;
}
interface ResolveFnOutput {
/**
* A hint to the load hook (it might be ignored)
*/
format?: ModuleFormat | null | undefined;
/**
* The import assertions to use when caching the module (optional; if excluded the input will be used)
*/
importAssertions?: ImportAssertions | undefined;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The absolute URL to which this input resolves
*/
url: string;
}
/**
* The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook.
* If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`);
* if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
*
* @param specifier The specified URL path of the module to be resolved
* @param context
* @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
*/
type ResolveHook = (
specifier: string,
context: ResolveHookContext,
nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput | Promise<ResolveFnOutput>
) => ResolveFnOutput | Promise<ResolveFnOutput>;
interface LoadHookContext {
/**
* Export conditions of the relevant `package.json`
*/
conditions: string[];
/**
* The format optionally supplied by the `resolve` hook chain
*/
format: ModuleFormat;
/**
* An object whose key-value pairs represent the assertions for the module to import
*/
importAssertions: ImportAssertions;
}
interface LoadFnOutput {
format: ModuleFormat;
/**
* A signal that this hook intends to terminate the chain of `resolve` hooks.
* @default false
*/
shortCircuit?: boolean | undefined;
/**
* The source for Node.js to evaluate
*/
source?: ModuleSource;
}
/**
* The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
* It is also in charge of validating the import assertion.
*
* @param url The URL/path of the module to be loaded
* @param context Metadata about the module
* @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
*/
type LoadHook = (
url: string,
context: LoadHookContext,
nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>
) => LoadFnOutput | Promise<LoadFnOutput>;
}
interface RegisterOptions<Data> {
parentURL: string;
data?: Data | undefined;
transferList?: any[] | undefined;
}
interface Module extends NodeModule {}

@@ -105,2 +224,4 @@ class Module {

static Module: typeof Module;
static register<Data = any, ReturnType = any>(specifier: string, parentURL?: string, options?: RegisterOptions<Data>): ReturnType;
static register<Data = any, ReturnType = any>(specifier: string, options?: RegisterOptions<Data>): ReturnType;
constructor(id: string, parent?: Module);

@@ -112,3 +233,10 @@ }

/**
* @experimental
* Provides a module-relative resolution function scoped to each module, returning
* the URL string.
*
* @param specified The module specifier to resolve relative to the current module.
* @returns The absolute (`file:`) URL string for the resolved module.
*/
resolve(specified: string): string;
/**
* This feature is only available with the `--experimental-import-meta-resolve`

@@ -121,6 +249,6 @@ * command flag enabled.

* @param specified The module specifier to resolve relative to `parent`.
* @param parent The absolute parent module URL to resolve from. If none
* is specified, the value of `import.meta.url` is used as the default.
* @param parent The absolute parent module URL to resolve from.
* @returns The absolute (`file:`) URL string for the resolved module.
*/
resolve?(specified: string, parent?: string | URL): Promise<string>;
resolve(specified: string, parent: string | URL): string;
}

@@ -130,5 +258,5 @@ }

}
declare module 'node:module' {
import module = require('module');
declare module 'module' {
import module = require('node:module');
export = module;
}

@@ -15,3 +15,3 @@ /**

*/
declare module 'net' {
declare module 'node:net' {
import * as stream from 'node:stream';

@@ -643,2 +643,7 @@ import { Abortable, EventEmitter } from 'node:events';

prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
/**
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
* @since v20.5.0
*/
[Symbol.asyncDispose](): Promise<void>;
}

@@ -888,4 +893,4 @@ type IPVersion = 'ipv4' | 'ipv6';

}
declare module 'node:net' {
export * from 'net';
declare module 'net' {
export * from 'node:net';
}

@@ -10,3 +10,3 @@ /**

*/
declare module 'os' {
declare module 'node:os' {
interface CpuInfo {

@@ -476,4 +476,4 @@ model: string;

}
declare module 'node:os' {
export * from 'os';
declare module 'os' {
export * from 'node:os';
}
declare module 'path/posix' {
import path = require('path');
import path = require('node:path');
export = path;
}
declare module 'path/win32' {
import path = require('path');
import path = require('node:path');
export = path;

@@ -18,3 +18,3 @@ }

*/
declare module 'path' {
declare module 'node:path' {
namespace path {

@@ -181,4 +181,4 @@ /**

}
declare module 'node:path' {
import path = require('path');
declare module 'path' {
import path = require('node:path');
export = path;

@@ -185,0 +185,0 @@ }

@@ -32,3 +32,3 @@ /**

*/
declare module 'perf_hooks' {
declare module 'node:perf_hooks' {
import { AsyncResource } from 'node:async_hooks';

@@ -637,4 +637,4 @@ type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';

}
declare module 'node:perf_hooks' {
export * from 'perf_hooks';
declare module 'perf_hooks' {
export * from 'node:perf_hooks';
}

@@ -29,3 +29,3 @@ /**

*/
declare module 'punycode' {
declare module 'node:punycode' {
/**

@@ -116,4 +116,4 @@ * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only

}
declare module 'node:punycode' {
export * from 'punycode';
declare module 'punycode' {
export * from 'node:punycode';
}

@@ -14,3 +14,3 @@ /**

*/
declare module 'querystring' {
declare module 'node:querystring' {
interface StringifyOptions {

@@ -130,4 +130,4 @@ encodeURIComponent?: ((str: string) => string) | undefined;

}
declare module 'node:querystring' {
export * from 'querystring';
declare module 'querystring' {
export * from 'node:querystring';
}

@@ -35,3 +35,3 @@ /**

*/
declare module 'readline' {
declare module 'node:readline' {
import { Abortable, EventEmitter } from 'node:events';

@@ -525,4 +525,4 @@ import * as promises from 'node:readline/promises';

}
declare module 'node:readline' {
export * from 'readline';
declare module 'readline' {
export * from 'node:readline';
}

@@ -5,3 +5,3 @@ /**

*/
declare module 'readline/promises' {
declare module 'node:readline/promises' {
import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';

@@ -144,4 +144,4 @@ import { Abortable } from 'node:events';

}
declare module 'node:readline/promises' {
export * from 'readline/promises';
declare module 'readline/promises' {
export * from 'node:readline/promises';
}

@@ -11,3 +11,3 @@ /**

*/
declare module 'repl' {
declare module 'node:repl' {
import { Interface, Completer, AsyncCompleter } from 'node:readline';

@@ -423,4 +423,4 @@ import { Context } from 'node:vm';

}
declare module 'node:repl' {
export * from 'repl';
declare module 'repl' {
export * from 'node:repl';
}

@@ -1,2 +0,2 @@

declare module 'stream/consumers' {
declare module 'node:stream/consumers' {
import { Blob as NodeBlob } from 'node:buffer';

@@ -10,4 +10,4 @@ import { Readable } from 'node:stream';

}
declare module 'node:stream/consumers' {
export * from 'stream/consumers';
declare module 'stream/consumers' {
export * from 'node:stream/consumers';
}

@@ -1,2 +0,2 @@

declare module 'stream/promises' {
declare module 'node:stream/promises' {
import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';

@@ -40,4 +40,4 @@ function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;

}
declare module 'node:stream/promises' {
export * from 'stream/promises';
declare module 'stream/promises' {
export * from 'node:stream/promises';
}

@@ -1,2 +0,2 @@

declare module 'stream/web' {
declare module 'node:stream/web' {
// stub module, pending copy&paste from .d.ts or manual impl

@@ -328,4 +328,4 @@ // copy from lib.dom.d.ts

}
declare module 'node:stream/web' {
export * from 'stream/web';
declare module 'stream/web' {
export * from 'node:stream/web';
}

@@ -41,3 +41,3 @@ /**

*/
declare module 'string_decoder' {
declare module 'node:string_decoder' {
class StringDecoder {

@@ -66,4 +66,4 @@ constructor(encoding?: BufferEncoding);

}
declare module 'node:string_decoder' {
export * from 'string_decoder';
declare module 'string_decoder' {
export * from 'node:string_decoder';
}

@@ -83,2 +83,3 @@ /**

import { Readable } from 'node:stream';
import { AsyncResource } from 'node:async_hooks';
/**

@@ -165,6 +166,6 @@ * ```js

*/
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
function describe(name?: string, fn?: SuiteFn): void;
function describe(options?: TestOptions, fn?: SuiteFn): void;
function describe(fn?: SuiteFn): void;
function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
function describe(name?: string, fn?: SuiteFn): Promise<void>;
function describe(options?: TestOptions, fn?: SuiteFn): Promise<void>;
function describe(fn?: SuiteFn): Promise<void>;
namespace describe {

@@ -174,13 +175,13 @@ /**

*/
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): void;
function skip(name?: string, fn?: SuiteFn): void;
function skip(options?: TestOptions, fn?: SuiteFn): void;
function skip(fn?: SuiteFn): void;
function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
function skip(name?: string, fn?: SuiteFn): Promise<void>;
function skip(options?: TestOptions, fn?: SuiteFn): Promise<void>;
function skip(fn?: SuiteFn): Promise<void>;
/**
* Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`.
*/
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): void;
function todo(name?: string, fn?: SuiteFn): void;
function todo(options?: TestOptions, fn?: SuiteFn): void;
function todo(fn?: SuiteFn): void;
function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
function todo(name?: string, fn?: SuiteFn): Promise<void>;
function todo(options?: TestOptions, fn?: SuiteFn): Promise<void>;
function todo(fn?: SuiteFn): Promise<void>;
/**

@@ -190,6 +191,6 @@ * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`.

*/
function only(name?: string, options?: TestOptions, fn?: SuiteFn): void;
function only(name?: string, fn?: SuiteFn): void;
function only(options?: TestOptions, fn?: SuiteFn): void;
function only(fn?: SuiteFn): void;
function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise<void>;
function only(name?: string, fn?: SuiteFn): Promise<void>;
function only(options?: TestOptions, fn?: SuiteFn): Promise<void>;
function only(fn?: SuiteFn): Promise<void>;
}

@@ -202,6 +203,6 @@ /**

*/
function it(name?: string, options?: TestOptions, fn?: TestFn): void;
function it(name?: string, fn?: TestFn): void;
function it(options?: TestOptions, fn?: TestFn): void;
function it(fn?: TestFn): void;
function it(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function it(name?: string, fn?: TestFn): Promise<void>;
function it(options?: TestOptions, fn?: TestFn): Promise<void>;
function it(fn?: TestFn): Promise<void>;
namespace it {

@@ -211,13 +212,13 @@ /**

*/
function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
function skip(name?: string, fn?: TestFn): void;
function skip(options?: TestOptions, fn?: TestFn): void;
function skip(fn?: TestFn): void;
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function skip(name?: string, fn?: TestFn): Promise<void>;
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
function skip(fn?: TestFn): Promise<void>;
/**
* Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`.
*/
function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
function todo(name?: string, fn?: TestFn): void;
function todo(options?: TestOptions, fn?: TestFn): void;
function todo(fn?: TestFn): void;
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function todo(name?: string, fn?: TestFn): Promise<void>;
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
function todo(fn?: TestFn): Promise<void>;
/**

@@ -227,6 +228,6 @@ * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`.

*/
function only(name?: string, options?: TestOptions, fn?: TestFn): void;
function only(name?: string, fn?: TestFn): void;
function only(options?: TestOptions, fn?: TestFn): void;
function only(fn?: TestFn): void;
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function only(name?: string, fn?: TestFn): Promise<void>;
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
function only(fn?: TestFn): Promise<void>;
}

@@ -237,6 +238,6 @@ /**

*/
function skip(name?: string, options?: TestOptions, fn?: TestFn): void;
function skip(name?: string, fn?: TestFn): void;
function skip(options?: TestOptions, fn?: TestFn): void;
function skip(fn?: TestFn): void;
function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function skip(name?: string, fn?: TestFn): Promise<void>;
function skip(options?: TestOptions, fn?: TestFn): Promise<void>;
function skip(fn?: TestFn): Promise<void>;
/**

@@ -246,6 +247,6 @@ * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`.

*/
function todo(name?: string, options?: TestOptions, fn?: TestFn): void;
function todo(name?: string, fn?: TestFn): void;
function todo(options?: TestOptions, fn?: TestFn): void;
function todo(fn?: TestFn): void;
function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function todo(name?: string, fn?: TestFn): Promise<void>;
function todo(options?: TestOptions, fn?: TestFn): Promise<void>;
function todo(fn?: TestFn): Promise<void>;
/**

@@ -255,6 +256,6 @@ * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`.

*/
function only(name?: string, options?: TestOptions, fn?: TestFn): void;
function only(name?: string, fn?: TestFn): void;
function only(options?: TestOptions, fn?: TestFn): void;
function only(fn?: TestFn): void;
function only(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
function only(name?: string, fn?: TestFn): Promise<void>;
function only(options?: TestOptions, fn?: TestFn): Promise<void>;
function only(fn?: TestFn): Promise<void>;
/**

@@ -265,8 +266,17 @@ * The type of a function under test. The first argument to this function is a

*/
type TestFn = (t: TestContext, done: (result?: any) => void) => any;
type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise<void>;
/**
* The type of a function under Suite.
* If the test uses callbacks, the callback function is passed as an argument
*/
type SuiteFn = (done: (result?: any) => void) => void;
type SuiteFn = (s: SuiteContext) => void | Promise<void>;
interface TestShard {
/**
* A positive integer between 1 and `<total>` that specifies the index of the shard to run.
*/
index: number;
/**
* A positive integer that specifies the total number of shards to split the test files to.
*/
total: number;
}
interface RunOptions {

@@ -309,3 +319,26 @@ /**

testNamePatterns?: string | RegExp | string[] | RegExp[];
/**
* A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
*/
setup?: (root: unknown) => void | Promise<void>;
/**
* Whether to run in watch mode or not.
* @default false
*/
watch?: boolean | undefined;
/**
* Running tests in a specific shard.
* @default undefined
*/
shard?: TestShard | undefined;
}
class Test extends AsyncResource {
concurrency: number;
nesting: number;
only: boolean;
reporter: TestsStream;
runOnlySubtests: boolean;
testNumber: number;
timeout: number | null;
}
/**

@@ -501,2 +534,20 @@ * A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.`TestsStream` will emit events, in the

}
/**
* An instance of `SuiteContext` is passed to each suite function in order to
* interact with the test runner. However, the `SuiteContext` constructor is not
* exposed as part of the API.
* @since v18.7.0, v16.17.0
*/
class SuiteContext {
/**
* The name of the suite.
* @since v18.8.0, v16.18.0
*/
readonly name: string;
/**
* Can be used to abort test subtasks when the test has been aborted.
* @since v18.7.0, v16.17.0
*/
readonly signal: AbortSignal;
}
interface TestOptions {

@@ -613,3 +664,3 @@ /**

*/
type HookFn = (done: (result?: any) => void) => any;
type HookFn = (s: SuiteContext, done: (result?: any) => void) => any;
/**

@@ -1191,2 +1242,6 @@ * Configuration options for hooks.

runAll(): void;
/**
* Calls {@link MockTimers.reset()}.
*/
[Symbol.dispose](): void;
}

@@ -1218,3 +1273,3 @@ export { test as default, run, test, describe, it, before, after, beforeEach, afterEach, mock, skip, only, todo };

*/
duration: number;
duration_ms: number;
/**

@@ -1224,2 +1279,7 @@ * The error thrown by the test.

error: Error;
/**
* The type of the test, used to denote whether this is a suite.
* @since 20.0.0, 19.9.0, 18.17.0
*/
type?: 'suite';
};

@@ -1259,3 +1319,8 @@ /**

*/
duration: number;
duration_ms: number;
/**
* The type of the test, used to denote whether this is a suite.
* @since 20.0.0, 19.9.0, 18.17.0
*/
type?: 'suite';
};

@@ -1335,2 +1400,30 @@ /**

}
interface TestEnqueue {
/**
* The test name
*/
name: string;
/**
* The path of the test file, undefined if test is not ran through a file.
*/
file?: string;
/**
* The nesting level of the test.
*/
nesting: number;
}
interface TestDequeue {
/**
* The test name
*/
name: string;
/**
* The path of the test file, undefined if test is not ran through a file.
*/
file?: string;
/**
* The nesting level of the test.
*/
nesting: number;
}

@@ -1364,3 +1457,6 @@ /**

| { type: 'test:stderr', data: TestStderr }
| { type: 'test:stdout', data: TestStdout };
| { type: 'test:stdout', data: TestStdout }
| { type: 'test:enqueue', data: TestEnqueue }
| { type: 'test:dequeue', data: TestDequeue }
| { type: 'test:watch:drained' };
type TestEventGenerator = AsyncGenerator<TestEvent, void>;

@@ -1384,3 +1480,3 @@

}
export { dot, tap, Spec as spec };
export { dot, tap, Spec as spec, TestEvent };
}

@@ -11,3 +11,3 @@ /**

*/
declare module 'timers' {
declare module 'node:timers' {
import { Abortable } from 'node:events';

@@ -72,2 +72,7 @@ import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';

_onImmediate: Function; // to distinguish it from the Timeout class
/**
* Cancels the immediate. This is similar to calling `clearImmediate()`.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}

@@ -119,2 +124,7 @@ /**

[Symbol.toPrimitive](): number;
/**
* Cancels the timeout.
* @since v20.5.0
*/
[Symbol.dispose](): void;
}

@@ -169,6 +179,6 @@ }

*/
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
// util.promisify no rest args compability
// tslint:disable-next-line void-return
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
namespace setInterval {

@@ -217,4 +227,4 @@ const __promisify__: typeof setIntervalPromise;

}
declare module 'node:timers' {
export * from 'timers';
declare module 'timers' {
export * from 'node:timers';
}

@@ -14,3 +14,3 @@ /**

*/
declare module 'timers/promises' {
declare module 'node:timers/promises' {
import { TimerOptions } from 'node:timers';

@@ -92,4 +92,4 @@ /**

}
declare module 'node:timers/promises' {
export * from 'timers/promises';
declare module 'timers/promises' {
export * from 'node:timers/promises';
}

@@ -11,3 +11,3 @@ /**

*/
declare module 'tls' {
declare module 'node:tls' {
import { X509Certificate } from 'node:crypto';

@@ -1129,4 +1129,4 @@ import * as net from 'node:net';

}
declare module 'node:tls' {
export * from 'tls';
declare module 'tls' {
export * from 'node:tls';
}

@@ -99,3 +99,3 @@ /**

*/
declare module 'trace_events' {
declare module 'node:trace_events' {
/**

@@ -181,4 +181,4 @@ * The `Tracing` object is used to enable or disable tracing for sets of

}
declare module 'node:trace_events' {
export * from 'trace_events';
declare module 'trace_events' {
export * from 'node:trace_events';
}

@@ -26,3 +26,3 @@ /**

*/
declare module 'tty' {
declare module 'node:tty' {
import * as net from 'node:net';

@@ -207,4 +207,4 @@ /**

}
declare module 'node:tty' {
export * from 'tty';
declare module 'tty' {
export * from 'node:tty';
}

@@ -10,3 +10,3 @@ /**

*/
declare module 'url' {
declare module 'node:url' {
import { Blob as NodeBlob } from 'node:buffer';

@@ -914,4 +914,4 @@ import { ClientRequestArgs } from 'node:http';

}
declare module 'node:url' {
export * from 'url';
declare module 'url' {
export * from 'node:url';
}

@@ -9,3 +9,3 @@ /**

*/
declare module 'v8' {
declare module 'node:v8' {
import { Readable } from 'node:stream';

@@ -634,4 +634,4 @@ interface HeapSpaceInfo {

}
declare module 'node:v8' {
export * from 'v8';
declare module 'v8' {
export * from 'node:v8';
}

@@ -39,3 +39,4 @@ /**

*/
declare module 'vm' {
declare module 'node:vm' {
import { ImportAssertions } from 'node:module';
interface Context extends NodeJS.Dict<any> {}

@@ -70,3 +71,3 @@ interface BaseOptions {

*/
importModuleDynamically?: ((specifier: string, script: Script, importAssertions: Object) => Module) | undefined;
importModuleDynamically?: ((specifier: string, script: Script, importAssertions: ImportAssertions) => Module) | undefined;
}

@@ -894,4 +895,4 @@ interface RunningScriptOptions extends BaseOptions {

}
declare module 'node:vm' {
export * from 'vm';
declare module 'vm' {
export * from 'node:vm';
}

@@ -67,3 +67,3 @@ /**

*/
declare module 'wasi' {
declare module 'node:wasi' {
interface WASIOptions {

@@ -151,4 +151,4 @@ /**

}
declare module 'node:wasi' {
export * from 'wasi';
declare module 'wasi' {
export * from 'node:wasi';
}

@@ -54,3 +54,3 @@ /**

*/
declare module 'worker_threads' {
declare module 'node:worker_threads' {
import { Blob } from 'node:buffer';

@@ -307,3 +307,4 @@ import { Context } from 'node:vm';

* unless otherwise specified. Changes to one copy are not visible in other
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor).
* 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
* environment variables operates in a case-sensitive manner.
* * `process.title` cannot be modified.

@@ -693,4 +694,4 @@ * * Signals are not delivered through `process.on('...')`.

}
declare module 'node:worker_threads' {
export * from 'worker_threads';
declare module 'worker_threads' {
export * from 'node:worker_threads';
}

@@ -93,3 +93,3 @@ /**

*/
declare module 'zlib' {
declare module 'node:zlib' {
import * as stream from 'node:stream';

@@ -516,4 +516,4 @@ interface ZlibOptions {

}
declare module 'node:zlib' {
export * from 'zlib';
declare module 'zlib' {
export * from 'node:zlib';
}

@@ -26,3 +26,3 @@ /**

*/
declare module 'tty' {
declare module 'node:tty' {
import * as net from 'node:net';

@@ -207,4 +207,4 @@ /**

}
declare module 'node:tty' {
export * from 'tty';
declare module 'tty' {
export * from 'node:tty';
}

@@ -10,3 +10,3 @@ /**

*/
declare module 'url' {
declare module 'node:url' {
import { Blob as NodeBlob } from 'node:buffer';

@@ -914,4 +914,4 @@ import { ClientRequestArgs } from 'node:http';

}
declare module 'node:url' {
export * from 'url';
declare module 'url' {
export * from 'node:url';
}

@@ -9,3 +9,3 @@ /**

*/
declare module 'v8' {
declare module 'node:v8' {
import { Readable } from 'node:stream';

@@ -634,4 +634,4 @@ interface HeapSpaceInfo {

}
declare module 'node:v8' {
export * from 'v8';
declare module 'v8' {
export * from 'node:v8';
}

@@ -39,3 +39,4 @@ /**

*/
declare module 'vm' {
declare module 'node:vm' {
import { ImportAssertions } from 'node:module';
interface Context extends NodeJS.Dict<any> {}

@@ -70,3 +71,3 @@ interface BaseOptions {

*/
importModuleDynamically?: ((specifier: string, script: Script, importAssertions: Object) => Module) | undefined;
importModuleDynamically?: ((specifier: string, script: Script, importAssertions: ImportAssertions) => Module) | undefined;
}

@@ -894,4 +895,4 @@ interface RunningScriptOptions extends BaseOptions {

}
declare module 'node:vm' {
export * from 'vm';
declare module 'vm' {
export * from 'node:vm';
}

@@ -67,3 +67,3 @@ /**

*/
declare module 'wasi' {
declare module 'node:wasi' {
interface WASIOptions {

@@ -151,4 +151,4 @@ /**

}
declare module 'node:wasi' {
export * from 'wasi';
declare module 'wasi' {
export * from 'node:wasi';
}

@@ -54,3 +54,3 @@ /**

*/
declare module 'worker_threads' {
declare module 'node:worker_threads' {
import { Blob } from 'node:buffer';

@@ -307,3 +307,4 @@ import { Context } from 'node:vm';

* unless otherwise specified. Changes to one copy are not visible in other
* threads, and are not visible to native add-ons (unless `worker.SHARE_ENV` is passed as the `env` option to the `Worker` constructor).
* 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
* environment variables operates in a case-sensitive manner.
* * `process.title` cannot be modified.

@@ -693,4 +694,4 @@ * * Signals are not delivered through `process.on('...')`.

}
declare module 'node:worker_threads' {
export * from 'worker_threads';
declare module 'worker_threads' {
export * from 'node:worker_threads';
}

@@ -93,3 +93,3 @@ /**

*/
declare module 'zlib' {
declare module 'node:zlib' {
import * as stream from 'node:stream';

@@ -516,4 +516,4 @@ interface ZlibOptions {

}
declare module 'node:zlib' {
export * from 'zlib';
declare module 'zlib' {
export * from 'node:zlib';
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc