@types/node
Advanced tools
+6
-9
@@ -531,11 +531,8 @@ declare module "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](); | ||
| * } | ||
| * signal.addEventListener('abort', (e) => e.stopImmediatePropagation()); | ||
| * // addAbortListener() returns a disposable, so the `using` keyword ensures | ||
| * // the abort listener is automatically removed when this scope exits. | ||
| * using _ = addAbortListener(signal, (e) => { | ||
| * // Do something when signal is aborted. | ||
| * }); | ||
| * } | ||
@@ -542,0 +539,0 @@ * ``` |
@@ -805,2 +805,3 @@ declare module "node:fs/promises" { | ||
| */ | ||
| function stat(path: PathLike): Promise<Stats>; | ||
| function stat( | ||
@@ -810,2 +811,3 @@ path: PathLike, | ||
| bigint?: false | undefined; | ||
| throwIfNoEntry?: true | undefined; | ||
| }, | ||
@@ -817,5 +819,26 @@ ): Promise<Stats>; | ||
| bigint: true; | ||
| throwIfNoEntry?: true | undefined; | ||
| }, | ||
| ): Promise<BigIntStats>; | ||
| function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>; | ||
| function stat( | ||
| path: PathLike, | ||
| opts: StatOptions & { | ||
| bigint?: false | undefined; | ||
| throwIfNoEntry: false; | ||
| }, | ||
| ): Promise<Stats | undefined>; | ||
| function stat( | ||
| path: PathLike, | ||
| opts: StatOptions & { | ||
| bigint: true; | ||
| throwIfNoEntry: false; | ||
| }, | ||
| ): Promise<BigIntStats | undefined>; | ||
| function stat( | ||
| path: PathLike, | ||
| opts: StatOptions & { | ||
| throwIfNoEntry?: true | undefined; | ||
| }, | ||
| ): Promise<Stats | BigIntStats>; | ||
| function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats | undefined>; | ||
| /** | ||
@@ -822,0 +845,0 @@ * @since v19.6.0, v18.15.0 |
| { | ||
| "name": "@types/node", | ||
| "version": "25.6.2", | ||
| "version": "25.7.0", | ||
| "description": "TypeScript definitions for node", | ||
@@ -150,7 +150,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
| "dependencies": { | ||
| "undici-types": "~7.19.0" | ||
| "undici-types": "~7.21.0" | ||
| }, | ||
| "peerDependencies": {}, | ||
| "typesPublisherContentHash": "89af6b1f98f4dcf78863724bff751d6099486220dae09983e7b6430b0be61ac2", | ||
| "typesPublisherContentHash": "eddf50137d03f63ae7f6e4766ed9b825cc70a85ef2f7d5c89290fba06040ceed", | ||
| "typeScriptVersion": "5.3" | ||
| } |
+1
-1
@@ -11,3 +11,3 @@ # Installation | ||
| ### Additional Details | ||
| * Last updated: Thu, 07 May 2026 22:21:35 GMT | ||
| * Last updated: Mon, 11 May 2026 20:06:09 GMT | ||
| * Dependencies: [undici-types](https://npmjs.com/package/undici-types) | ||
@@ -14,0 +14,0 @@ |
@@ -11,2 +11,3 @@ declare module "node:test/reporters" { | ||
| | { type: "test:fail"; data: EventData.TestFail } | ||
| | { type: "test:interrupted"; data: EventData.TestInterrupted } | ||
| | { type: "test:pass"; data: EventData.TestPass } | ||
@@ -13,0 +14,0 @@ | { type: "test:plan"; data: EventData.TestPlan } |
+24
-2
@@ -232,6 +232,28 @@ declare module "node:url" { | ||
| * @legacy Use the WHATWG URL API instead. | ||
| * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. | ||
| * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). | ||
| */ | ||
| function format(urlObject: UrlObject | string): string; | ||
| function format(urlObject: UrlObject): string; | ||
| /** | ||
| * `url.format(urlString)` is shorthand for `url.format(url.parse(urlString))`. | ||
| * | ||
| * Because it invokes the deprecated `url.parse()`, passing a string argument | ||
| * to `url.format()` is itself deprecated. | ||
| * | ||
| * Canonicalizing a URL string can be performed using the WHATWG URL API, by | ||
| * constructing a new URL object and calling `url.toString()`. | ||
| * | ||
| * ```js | ||
| * import { URL } from 'node:url'; | ||
| * | ||
| * const unformatted = 'http://[fe80:0:0:0:0:0:0:1]:/a/b?a=b#abc'; | ||
| * const formatted = new URL(unformatted).toString(); | ||
| * | ||
| * console.log(formatted); // Prints: http://[fe80::1]/a/b?a=b#abc | ||
| * ``` | ||
| * @since v0.1.25 | ||
| * @deprecated Use the WHATWG URL API instead. | ||
| * @param urlString A string that will be passed to `url.parse()` and then formatted. | ||
| */ | ||
| function format(urlString: string): string; | ||
| /** | ||
| * The `url.resolve()` method resolves a target URL relative to a base URL in a | ||
@@ -238,0 +260,0 @@ * manner similar to that of a web browser resolving an anchor tag. |
+50
-85
@@ -203,3 +203,3 @@ declare module "node:vm" { | ||
| * ```js | ||
| * import vm from 'node:vm'; | ||
| * import { createContext, Script } from 'node:vm'; | ||
| * | ||
@@ -211,5 +211,5 @@ * const context = { | ||
| * | ||
| * const script = new vm.Script('count += 1; name = "kitty";'); | ||
| * const script = new Script('count += 1; name = "kitty";'); | ||
| * | ||
| * vm.createContext(context); | ||
| * createContext(context); | ||
| * for (let i = 0; i < 10; ++i) { | ||
@@ -248,5 +248,5 @@ * script.runInContext(context); | ||
| * ```js | ||
| * const vm = require('node:vm'); | ||
| * import { constants, Script } from 'node:vm'; | ||
| * | ||
| * const script = new vm.Script('globalVar = "set"'); | ||
| * const script = new Script('globalVar = "set"'); | ||
| * | ||
@@ -262,6 +262,6 @@ * const contexts = [{}, {}, {}]; | ||
| * // This would throw if the context is created from a contextified object. | ||
| * // vm.constants.DONT_CONTEXTIFY allows creating contexts with ordinary | ||
| * // constants.DONT_CONTEXTIFY allows creating contexts with ordinary | ||
| * // global objects that can be frozen. | ||
| * const freezeScript = new vm.Script('Object.freeze(globalThis); globalThis;'); | ||
| * const frozenContext = freezeScript.runInNewContext(vm.constants.DONT_CONTEXTIFY); | ||
| * const freezeScript = new Script('Object.freeze(globalThis); globalThis;'); | ||
| * const frozenContext = freezeScript.runInNewContext(constants.DONT_CONTEXTIFY); | ||
| * ``` | ||
@@ -285,7 +285,7 @@ * @since v0.3.1 | ||
| * ```js | ||
| * import vm from 'node:vm'; | ||
| * import { Script } from 'node:vm'; | ||
| * | ||
| * global.globalVar = 0; | ||
| * | ||
| * const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' }); | ||
| * const script = new Script('globalVar += 1', { filename: 'myfile.vm' }); | ||
| * | ||
@@ -379,3 +379,3 @@ * for (let i = 0; i < 1000; ++i) { | ||
| * ```js | ||
| * const vm = require('node:vm'); | ||
| * import { createContext, runInContext } from 'node:vm'; | ||
| * | ||
@@ -385,5 +385,5 @@ * global.globalVar = 3; | ||
| * const context = { globalVar: 1 }; | ||
| * vm.createContext(context); | ||
| * createContext(context); | ||
| * | ||
| * vm.runInContext('globalVar *= 2;', context); | ||
| * runInContext('globalVar *= 2;', context); | ||
| * | ||
@@ -439,9 +439,9 @@ * console.log(context); | ||
| * ```js | ||
| * import vm from 'node:vm'; | ||
| * import { createContext, runInContext } from 'node:vm'; | ||
| * | ||
| * const contextObject = { globalVar: 1 }; | ||
| * vm.createContext(contextObject); | ||
| * createContext(contextObject); | ||
| * | ||
| * for (let i = 0; i < 10; ++i) { | ||
| * vm.runInContext('globalVar *= 2;', contextObject); | ||
| * runInContext('globalVar *= 2;', contextObject); | ||
| * } | ||
@@ -477,3 +477,3 @@ * console.log(contextObject); | ||
| * ```js | ||
| * const vm = require('node:vm'); | ||
| * import { runInNewContext, constants } from 'node:vm'; | ||
| * | ||
@@ -485,3 +485,3 @@ * const contextObject = { | ||
| * | ||
| * vm.runInNewContext('count += 1; name = "kitty"', contextObject); | ||
| * runInNewContext('count += 1; name = "kitty"', contextObject); | ||
| * console.log(contextObject); | ||
@@ -493,3 +493,6 @@ * // Prints: { animal: 'cat', count: 3, name: 'kitty' } | ||
| * // can be frozen. | ||
| * const frozenContext = vm.runInNewContext('Object.freeze(globalThis); globalThis;', vm.constants.DONT_CONTEXTIFY); | ||
| * const frozenContext = runInNewContext( | ||
| * 'Object.freeze(globalThis); globalThis;', | ||
| * constants.DONT_CONTEXTIFY, | ||
| * ); | ||
| * ``` | ||
@@ -518,6 +521,6 @@ * @since v0.3.1 | ||
| * ```js | ||
| * import vm from 'node:vm'; | ||
| * import { runInThisContext } from 'node:vm'; | ||
| * let localVar = 'initial value'; | ||
| * | ||
| * const vmResult = vm.runInThisContext('localVar = "vm";'); | ||
| * const vmResult = runInThisContext('localVar = "vm";'); | ||
| * console.log(`vmResult: '${vmResult}', localVar: '${localVar}'`); | ||
@@ -534,34 +537,2 @@ * // Prints: vmResult: 'vm', localVar: 'initial value' | ||
| * local scope, so the value `localVar` is changed. In this way `vm.runInThisContext()` is much like an [indirect `eval()` call](https://es5.github.io/#x10.4.2), e.g.`(0,eval)('code')`. | ||
| * | ||
| * ## Example: Running an HTTP server within a VM | ||
| * | ||
| * When using either `script.runInThisContext()` or {@link runInThisContext}, the code is executed within the current V8 global | ||
| * context. The code passed to this VM context will have its own isolated scope. | ||
| * | ||
| * In order to run a simple web server using the `node:http` module the code passed | ||
| * to the context must either import `node:http` on its own, or have a | ||
| * reference to the `node:http` module passed to it. For instance: | ||
| * | ||
| * ```js | ||
| * 'use strict'; | ||
| * import vm from 'node:vm'; | ||
| * | ||
| * const code = ` | ||
| * ((require) => { | ||
| * const http = require('node:http'); | ||
| * | ||
| * http.createServer((request, response) => { | ||
| * response.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
| * response.end('Hello World\\n'); | ||
| * }).listen(8124); | ||
| * | ||
| * console.log('Server running at http://127.0.0.1:8124/'); | ||
| * })`; | ||
| * | ||
| * vm.runInThisContext(code)(require); | ||
| * ``` | ||
| * | ||
| * The `require()` in the above case shares the state with the context it is | ||
| * passed from. This may introduce risks when untrusted code is executed, e.g. | ||
| * altering objects in the context in unwanted ways. | ||
| * @since v0.3.1 | ||
@@ -598,5 +569,5 @@ * @param code The JavaScript code to compile and run. | ||
| * ```js | ||
| * import vm from 'node:vm'; | ||
| * import { createContext, measureMemory } from 'node:vm'; | ||
| * // Measure the memory used by the main context. | ||
| * vm.measureMemory({ mode: 'summary' }) | ||
| * measureMemory({ mode: 'summary' }) | ||
| * // This is the same as vm.measureMemory() | ||
@@ -606,5 +577,4 @@ * .then((result) => { | ||
| * // { | ||
| * // total: { | ||
| * // jsMemoryEstimate: 2418479, jsMemoryRange: [ 2418479, 2745799 ] | ||
| * // } | ||
| * // total: { jsMemoryEstimate: 1601828, jsMemoryRange: [1601828, 5275288] }, | ||
| * // WebAssembly: { code: 0, metadata: 33962 }, | ||
| * // } | ||
@@ -614,26 +584,15 @@ * console.log(result); | ||
| * | ||
| * const context = vm.createContext({ a: 1 }); | ||
| * vm.measureMemory({ mode: 'detailed', execution: 'eager' }) | ||
| * .then((result) => { | ||
| * // Reference the context here so that it won't be GC'ed | ||
| * // until the measurement is complete. | ||
| * console.log(context.a); | ||
| * // { | ||
| * // total: { | ||
| * // jsMemoryEstimate: 2574732, | ||
| * // jsMemoryRange: [ 2574732, 2904372 ] | ||
| * // }, | ||
| * // current: { | ||
| * // jsMemoryEstimate: 2438996, | ||
| * // jsMemoryRange: [ 2438996, 2768636 ] | ||
| * // }, | ||
| * // other: [ | ||
| * // { | ||
| * // jsMemoryEstimate: 135736, | ||
| * // jsMemoryRange: [ 135736, 465376 ] | ||
| * // } | ||
| * // ] | ||
| * // } | ||
| * console.log(result); | ||
| * }); | ||
| * const context = createContext({ a: 1 }); | ||
| * measureMemory({ mode: 'detailed', execution: 'eager' }).then((result) => { | ||
| * // Reference the context here so that it won't be GC'ed | ||
| * // until the measurement is complete. | ||
| * console.log('Context:', context.a); | ||
| * // { | ||
| * // total: { jsMemoryEstimate: 1767100, jsMemoryRange: [1767100, 5440560] }, | ||
| * // WebAssembly: { code: 0, metadata: 33962 }, | ||
| * // current: { jsMemoryEstimate: 1601828, jsMemoryRange: [1601828, 5275288] }, | ||
| * // other: [{ jsMemoryEstimate: 165272, jsMemoryRange: [Array] }], | ||
| * // } | ||
| * console.log(result); | ||
| * }); | ||
| * ``` | ||
@@ -1111,6 +1070,6 @@ * @since v13.10.0 | ||
| * ```js | ||
| * import vm from 'node:vm'; | ||
| * import { SyntheticModule } from 'node:vm'; | ||
| * | ||
| * const source = '{ "a": 1 }'; | ||
| * const module = new vm.SyntheticModule(['default'], function() { | ||
| * const syntheticModule = new SyntheticModule(['default'], function() { | ||
| * const obj = JSON.parse(source); | ||
@@ -1120,3 +1079,9 @@ * this.setExport('default', obj); | ||
| * | ||
| * // Use `module` in linking... | ||
| * // Use `syntheticModule` in linking | ||
| * (async () => { | ||
| * await syntheticModule.link(() => {}); | ||
| * await syntheticModule.evaluate(); | ||
| * | ||
| * console.log('Default export:', syntheticModule.namespace.default); | ||
| * })(); | ||
| * ``` | ||
@@ -1123,0 +1088,0 @@ * @since v13.0.0, v12.16.0 |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
2355934
0.24%52282
0.3%305
0.66%+ Added
- Removed
Updated