@types/node
Advanced tools
Comparing version 22.7.1 to 22.7.2
@@ -80,3 +80,3 @@ /** | ||
* createHook, | ||
* } from 'async_hooks'; | ||
* } from 'node:async_hooks'; | ||
* const sym = Symbol('state'); // Private symbol to avoid pollution | ||
@@ -83,0 +83,0 @@ * |
@@ -234,2 +234,4 @@ /** | ||
* ```js | ||
* import net from 'node:net'; | ||
* | ||
* if (cluster.isPrimary) { | ||
@@ -252,3 +254,2 @@ * const worker = cluster.fork(); | ||
* } else if (cluster.isWorker) { | ||
* const net = require('node:net'); | ||
* const server = net.createServer((socket) => { | ||
@@ -255,0 +256,0 @@ * // Connections never end |
@@ -9,3 +9,3 @@ /** | ||
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('node:console')`. | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. | ||
* | ||
@@ -366,3 +366,3 @@ * _**Warning**_: The global console object's methods are neither consistently | ||
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`. | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. | ||
* | ||
@@ -369,0 +369,0 @@ * _**Warning**_: The global console object's methods are neither consistently |
@@ -12,3 +12,3 @@ /** | ||
* ```js | ||
* const dns = require('node:dns'); | ||
* import dns from 'node:dns'; | ||
* | ||
@@ -27,3 +27,3 @@ * dns.lookup('example.org', (err, address, family) => { | ||
* ```js | ||
* const dns = require('node:dns'); | ||
* import dns from 'node:dns'; | ||
* | ||
@@ -144,3 +144,3 @@ * dns.resolve4('archive.org', (err, addresses) => { | ||
* ```js | ||
* const dns = require('node:dns'); | ||
* import dns from 'node:dns'; | ||
* const options = { | ||
@@ -205,3 +205,3 @@ * family: 6, | ||
* ```js | ||
* const dns = require('node:dns'); | ||
* import dns from 'node:dns'; | ||
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { | ||
@@ -794,3 +794,3 @@ * console.log(hostname, service); | ||
* ```js | ||
* const { Resolver } = require('node:dns'); | ||
* import { Resolver } from 'node:dns'; | ||
* const resolver = new Resolver(); | ||
@@ -797,0 +797,0 @@ * resolver.setServers(['4.4.4.4']); |
/** | ||
* The `dns.promises` API provides an alternative set of asynchronous DNS methods | ||
* that return `Promise` objects rather than using callbacks. The API is accessible | ||
* via `require('node:dns').promises` or `require('node:dns/promises')`. | ||
* via `import { promises as dnsPromises } from 'node:dns'` or `import dnsPromises from 'node:dns/promises'`. | ||
* @since v10.6.0 | ||
@@ -63,3 +63,3 @@ */ | ||
* ```js | ||
* const dns = require('node:dns'); | ||
* import dns from 'node:dns'; | ||
* const dnsPromises = dns.promises; | ||
@@ -100,3 +100,3 @@ * const options = { | ||
* ```js | ||
* const dnsPromises = require('node:dns').promises; | ||
* import dnsPromises from 'node:dns'; | ||
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => { | ||
@@ -399,4 +399,4 @@ * console.log(result.hostname, result.service); | ||
* ```js | ||
* const { Resolver } = require('node:dns').promises; | ||
* const resolver = new Resolver(); | ||
* import { promises } from 'node:dns'; | ||
* const resolver = new promises.Resolver(); | ||
* resolver.setServers(['4.4.4.4']); | ||
@@ -403,0 +403,0 @@ * |
@@ -66,4 +66,4 @@ /** | ||
* ```js | ||
* const domain = require('node:domain'); | ||
* const fs = require('node:fs'); | ||
* import domain from 'node:domain'; | ||
* import fs from 'node:fs'; | ||
* const d = domain.create(); | ||
@@ -70,0 +70,0 @@ * d.on('error', (er) => { |
@@ -935,3 +935,3 @@ /** | ||
* platform-specific path separator | ||
* (`require('node:path').sep`). | ||
* (`import { sep } from 'node:path'`). | ||
* @since v10.0.0 | ||
@@ -1178,3 +1178,3 @@ * @return Fulfills with a string containing the file system path of the newly created temporary directory. | ||
* ```js | ||
* const { watch } = require('node:fs/promises'); | ||
* import { watch } from 'node:fs/promises'; | ||
* | ||
@@ -1181,0 +1181,0 @@ * const ac = new AbortController(); |
@@ -273,4 +273,4 @@ /** | ||
* // curl -k https://localhost:8000/ | ||
* const https = require('node:https'); | ||
* const fs = require('node:fs'); | ||
* import https from 'node:https'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -291,4 +291,4 @@ * const options = { | ||
* ```js | ||
* const https = require('node:https'); | ||
* const fs = require('node:fs'); | ||
* import https from 'node:https'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -333,3 +333,3 @@ * const options = { | ||
* ```js | ||
* const https = require('node:https'); | ||
* import https from 'node:https'; | ||
* | ||
@@ -407,5 +407,5 @@ * const options = { | ||
* ```js | ||
* const tls = require('node:tls'); | ||
* const https = require('node:https'); | ||
* const crypto = require('node:crypto'); | ||
* import tls from 'node:tls'; | ||
* import https from 'node:https'; | ||
* import crypto from 'node:crypto'; | ||
* | ||
@@ -518,3 +518,3 @@ * function sha256(s) { | ||
* ```js | ||
* const https = require('node:https'); | ||
* import https from 'node:https'; | ||
* | ||
@@ -521,0 +521,0 @@ * https.get('https://encrypted.google.com/', (res) => { |
@@ -15,5 +15,5 @@ /** | ||
* ```js | ||
* const fs = require('node:fs'); | ||
* const assert = require('node:assert'); | ||
* const { syncBuiltinESMExports } = require('node:module'); | ||
* import fs from 'node:fs'; | ||
* import assert from 'node:assert'; | ||
* import { syncBuiltinESMExports } from 'node:module'; | ||
* | ||
@@ -20,0 +20,0 @@ * fs.readFile = newAPI; |
@@ -11,3 +11,3 @@ /** | ||
* ```js | ||
* const net = require('node:net'); | ||
* import net from 'node:net'; | ||
* ``` | ||
@@ -812,3 +812,3 @@ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/net.js) | ||
* ```js | ||
* const net = require('node:net'); | ||
* import net from 'node:net'; | ||
* const server = net.createServer((c) => { | ||
@@ -815,0 +815,0 @@ * // 'connection' listener. |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* const os = require('node:os'); | ||
* import os from 'node:os'; | ||
* ``` | ||
@@ -9,0 +9,0 @@ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/os.js) |
{ | ||
"name": "@types/node", | ||
"version": "22.7.1", | ||
"version": "22.7.2", | ||
"description": "TypeScript definitions for node", | ||
@@ -215,4 +215,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
}, | ||
"typesPublisherContentHash": "6eac2c2113a7d5f58f871a8766de0fec4c086f9b704d46c70434588cb5f8b35d", | ||
"typesPublisherContentHash": "8376ea7c8f7b17e938afe6a3333c3c4901e0574831c87341327c713768249c73", | ||
"typeScriptVersion": "4.8" | ||
} |
@@ -14,3 +14,3 @@ declare module "path/posix" { | ||
* ```js | ||
* const path = require('node:path'); | ||
* import path from 'node:path'; | ||
* ``` | ||
@@ -17,0 +17,0 @@ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/path.js) |
@@ -13,3 +13,3 @@ /** | ||
* ```js | ||
* const { PerformanceObserver, performance } = require('node:perf_hooks'); | ||
* import { PerformanceObserver, performance } from 'node:perf_hooks'; | ||
* | ||
@@ -359,6 +359,6 @@ * const obs = new PerformanceObserver((items) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver, | ||
* } = require('node:perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -402,6 +402,6 @@ * function someFunction() { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver, | ||
* } = require('node:perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -446,6 +446,6 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver, | ||
* } = require('node:perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -498,6 +498,6 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver, | ||
* } = require('node:perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -552,6 +552,6 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver, | ||
* } = require('node:perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -825,3 +825,3 @@ * const obs = new PerformanceObserver((list, observer) => { | ||
* ```js | ||
* const { monitorEventLoopDelay } = require('node:perf_hooks'); | ||
* import { monitorEventLoopDelay } from 'node:perf_hooks'; | ||
* const h = monitorEventLoopDelay({ resolution: 20 }); | ||
@@ -875,3 +875,3 @@ * h.enable(); | ||
/** | ||
* `PerformanceEntry` is a global reference for `require('node:perf_hooks').PerformanceEntry` | ||
* `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'` | ||
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceentry | ||
@@ -886,3 +886,3 @@ * @since v19.0.0 | ||
/** | ||
* `PerformanceMark` is a global reference for `require('node:perf_hooks').PerformanceMark` | ||
* `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'` | ||
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemark | ||
@@ -897,3 +897,3 @@ * @since v19.0.0 | ||
/** | ||
* `PerformanceMeasure` is a global reference for `require('node:perf_hooks').PerformanceMeasure` | ||
* `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'` | ||
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemeasure | ||
@@ -908,3 +908,3 @@ * @since v19.0.0 | ||
/** | ||
* `PerformanceObserver` is a global reference for `require('node:perf_hooks').PerformanceObserver` | ||
* `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'` | ||
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserver | ||
@@ -919,3 +919,3 @@ * @since v19.0.0 | ||
/** | ||
* `PerformanceObserverEntryList` is a global reference for `require('node:perf_hooks').PerformanceObserverEntryList` | ||
* `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'` | ||
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserverentrylist | ||
@@ -930,3 +930,3 @@ * @since v19.0.0 | ||
/** | ||
* `PerformanceResourceTiming` is a global reference for `require('node:perf_hooks').PerformanceResourceTiming` | ||
* `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'` | ||
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceresourcetiming | ||
@@ -941,3 +941,3 @@ * @since v19.0.0 | ||
/** | ||
* `performance` is a global reference for `require('node:perf_hooks').performance` | ||
* `performance` is a global reference for `import { performance } from 'node:perf_hooks'` | ||
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performance | ||
@@ -944,0 +944,0 @@ * @since v16.0.0 |
@@ -11,3 +11,3 @@ /** | ||
* ```js | ||
* const punycode = require('punycode'); | ||
* import punycode from 'node:punycode'; | ||
* ``` | ||
@@ -14,0 +14,0 @@ * |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* const querystring = require('node:querystring'); | ||
* import querystring from 'node:querystring'; | ||
* ``` | ||
@@ -9,0 +9,0 @@ * |
@@ -345,3 +345,3 @@ /** | ||
* ```js | ||
* const readline = require('node:readline'); | ||
* import readline from 'node:readline'; | ||
* const rl = readline.createInterface({ | ||
@@ -402,3 +402,3 @@ * input: process.stdin, | ||
* ```js | ||
* const readline = require('node:readline'); | ||
* import readline from 'node:readline'; | ||
* const rl = readline.createInterface({ | ||
@@ -435,4 +435,4 @@ * input: process.stdin, | ||
* ```js | ||
* const fs = require('node:fs'); | ||
* const readline = require('node:readline'); | ||
* import fs from 'node:fs'; | ||
* import readline from 'node:readline'; | ||
* | ||
@@ -461,4 +461,4 @@ * async function processLineByLine() { | ||
* ```js | ||
* const fs = require('node:fs'); | ||
* const readline = require('node:readline'); | ||
* import fs from 'node:fs'; | ||
* import readline from 'node:readline'; | ||
* | ||
@@ -478,5 +478,5 @@ * const rl = readline.createInterface({ | ||
* ```js | ||
* const { once } = require('node:events'); | ||
* const { createReadStream } = require('node:fs'); | ||
* const { createInterface } = require('node:readline'); | ||
* import { once } from 'node:events'; | ||
* import { createReadStream } from 'node:fs'; | ||
* import { createInterface } from 'node:readline'; | ||
* | ||
@@ -483,0 +483,0 @@ * (async function processLineByLine() { |
@@ -118,3 +118,3 @@ /** | ||
* ```js | ||
* const readlinePromises = require('node:readline/promises'); | ||
* import readlinePromises from 'node:readline/promises'; | ||
* const rl = readlinePromises.createInterface({ | ||
@@ -121,0 +121,0 @@ * input: process.stdin, |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Wed, 25 Sep 2024 17:36:54 GMT | ||
* Last updated: Wed, 25 Sep 2024 22:07:42 GMT | ||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types) | ||
@@ -14,0 +14,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
* ```js | ||
* const repl = require('node:repl'); | ||
* import repl from 'node:repl'; | ||
* ``` | ||
@@ -134,3 +134,3 @@ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/repl.js) | ||
* ```js | ||
* const repl = require('node:repl'); | ||
* import repl from 'node:repl'; | ||
* | ||
@@ -262,3 +262,3 @@ * const options = { useColors: true }; | ||
* ```js | ||
* const repl = require('node:repl'); | ||
* import repl from 'node:repl'; | ||
* | ||
@@ -413,3 +413,3 @@ * const replServer = repl.start({ prompt: '> ' }); | ||
* ```js | ||
* const repl = require('node:repl'); | ||
* import repl from 'node:repl'; | ||
* | ||
@@ -416,0 +416,0 @@ * // a Unix style prompt |
@@ -13,3 +13,3 @@ /** | ||
* ```js | ||
* import sqlite from 'sqlite'; | ||
* import sqlite from 'node:sqlite'; | ||
* ``` | ||
@@ -16,0 +16,0 @@ * |
@@ -421,3 +421,3 @@ type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {} | ||
/** | ||
* `ByteLengthQueuingStrategy` class is a global reference for `require('stream/web').ByteLengthQueuingStrategy`. | ||
* `ByteLengthQueuingStrategy` class is a global reference for `import { ByteLengthQueuingStrategy } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-bytelengthqueuingstrategy | ||
@@ -432,3 +432,3 @@ * @since v18.0.0 | ||
/** | ||
* `CompressionStream` class is a global reference for `require('stream/web').CompressionStream`. | ||
* `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-compressionstream | ||
@@ -453,3 +453,3 @@ * @since v18.0.0 | ||
/** | ||
* `CountQueuingStrategy` class is a global reference for `require('stream/web').CountQueuingStrategy`. | ||
* `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-countqueuingstrategy | ||
@@ -463,3 +463,3 @@ * @since v18.0.0 | ||
/** | ||
* `DecompressionStream` class is a global reference for `require('stream/web').DecompressionStream`. | ||
* `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-decompressionstream | ||
@@ -484,3 +484,3 @@ * @since v18.0.0 | ||
/** | ||
* `ReadableByteStreamController` class is a global reference for `require('stream/web').ReadableByteStreamController`. | ||
* `ReadableByteStreamController` class is a global reference for `import { ReadableByteStreamController } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-readablebytestreamcontroller | ||
@@ -495,3 +495,3 @@ * @since v18.0.0 | ||
/** | ||
* `ReadableStream` class is a global reference for `require('stream/web').ReadableStream`. | ||
* `ReadableStream` class is a global reference for `import { ReadableStream } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-readablestream | ||
@@ -505,3 +505,3 @@ * @since v18.0.0 | ||
/** | ||
* `ReadableStreamBYOBReader` class is a global reference for `require('stream/web').ReadableStreamBYOBReader`. | ||
* `ReadableStreamBYOBReader` class is a global reference for `import { ReadableStreamBYOBReader } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-readablestreambyobreader | ||
@@ -516,3 +516,3 @@ * @since v18.0.0 | ||
/** | ||
* `ReadableStreamBYOBRequest` class is a global reference for `require('stream/web').ReadableStreamBYOBRequest`. | ||
* `ReadableStreamBYOBRequest` class is a global reference for `import { ReadableStreamBYOBRequest } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-readablestreambyobrequest | ||
@@ -527,3 +527,3 @@ * @since v18.0.0 | ||
/** | ||
* `ReadableStreamDefaultController` class is a global reference for `require('stream/web').ReadableStreamDefaultController`. | ||
* `ReadableStreamDefaultController` class is a global reference for `import { ReadableStreamDefaultController } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-readablestreamdefaultcontroller | ||
@@ -538,3 +538,3 @@ * @since v18.0.0 | ||
/** | ||
* `ReadableStreamDefaultReader` class is a global reference for `require('stream/web').ReadableStreamDefaultReader`. | ||
* `ReadableStreamDefaultReader` class is a global reference for `import { ReadableStreamDefaultReader } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-readablestreamdefaultreader | ||
@@ -549,3 +549,3 @@ * @since v18.0.0 | ||
/** | ||
* `TextDecoderStream` class is a global reference for `require('stream/web').TextDecoderStream`. | ||
* `TextDecoderStream` class is a global reference for `import { TextDecoderStream } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-textdecoderstream | ||
@@ -559,3 +559,3 @@ * @since v18.0.0 | ||
/** | ||
* `TextEncoderStream` class is a global reference for `require('stream/web').TextEncoderStream`. | ||
* `TextEncoderStream` class is a global reference for `import { TextEncoderStream } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-textencoderstream | ||
@@ -569,3 +569,3 @@ * @since v18.0.0 | ||
/** | ||
* `TransformStream` class is a global reference for `require('stream/web').TransformStream`. | ||
* `TransformStream` class is a global reference for `import { TransformStream } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-transformstream | ||
@@ -579,3 +579,3 @@ * @since v18.0.0 | ||
/** | ||
* `TransformStreamDefaultController` class is a global reference for `require('stream/web').TransformStreamDefaultController`. | ||
* `TransformStreamDefaultController` class is a global reference for `import { TransformStreamDefaultController } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-transformstreamdefaultcontroller | ||
@@ -590,3 +590,3 @@ * @since v18.0.0 | ||
/** | ||
* `WritableStream` class is a global reference for `require('stream/web').WritableStream`. | ||
* `WritableStream` class is a global reference for `import { WritableStream } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-writablestream | ||
@@ -600,3 +600,3 @@ * @since v18.0.0 | ||
/** | ||
* `WritableStreamDefaultController` class is a global reference for `require('stream/web').WritableStreamDefaultController`. | ||
* `WritableStreamDefaultController` class is a global reference for `import { WritableStreamDefaultController } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-writablestreamdefaultcontroller | ||
@@ -611,3 +611,3 @@ * @since v18.0.0 | ||
/** | ||
* `WritableStreamDefaultWriter` class is a global reference for `require('stream/web').WritableStreamDefaultWriter`. | ||
* `WritableStreamDefaultWriter` class is a global reference for `import { WritableStreamDefaultWriter } from 'node:stream/web'`. | ||
* https://nodejs.org/api/globals.html#class-writablestreamdefaultwriter | ||
@@ -614,0 +614,0 @@ * @since v18.0.0 |
@@ -7,3 +7,3 @@ /** | ||
* ```js | ||
* const { StringDecoder } = require('node:string_decoder'); | ||
* import { StringDecoder } from 'node:string_decoder'; | ||
* ``` | ||
@@ -14,3 +14,3 @@ * | ||
* ```js | ||
* const { StringDecoder } = require('node:string_decoder'); | ||
* import { StringDecoder } from 'node:string_decoder'; | ||
* const decoder = new StringDecoder('utf8'); | ||
@@ -34,3 +34,3 @@ * | ||
* ```js | ||
* const { StringDecoder } = require('node:string_decoder'); | ||
* import { StringDecoder } from 'node:string_decoder'; | ||
* const decoder = new StringDecoder('utf8'); | ||
@@ -37,0 +37,0 @@ * |
/** | ||
* The `timer` module exposes a global API for scheduling functions to | ||
* be called at some future period of time. Because the timer functions are | ||
* globals, there is no need to call `require('node:timers')` to use the API. | ||
* globals, there is no need to import `node:timers` to use the API. | ||
* | ||
@@ -6,0 +6,0 @@ * The timer functions within Node.js implement a similar API as the timers API |
/** | ||
* The `timers/promises` API provides an alternative set of timer functions | ||
* that return `Promise` objects. The API is accessible via `require('node:timers/promises')`. | ||
* that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`. | ||
* | ||
@@ -10,3 +10,3 @@ * ```js | ||
* setInterval, | ||
* } from 'timers/promises'; | ||
* } from 'node:timers/promises'; | ||
* ``` | ||
@@ -21,3 +21,3 @@ * @since v15.0.0 | ||
* setTimeout, | ||
* } from 'timers/promises'; | ||
* } from 'node:timers/promises'; | ||
* | ||
@@ -37,3 +37,3 @@ * const res = await setTimeout(100, 'result'); | ||
* setImmediate, | ||
* } from 'timers/promises'; | ||
* } from 'node:timers/promises'; | ||
* | ||
@@ -56,3 +56,3 @@ * const res = await setImmediate('result'); | ||
* setInterval, | ||
* } from 'timers/promises'; | ||
* } from 'node:timers/promises'; | ||
* | ||
@@ -59,0 +59,0 @@ * const interval = 100; |
@@ -7,3 +7,3 @@ /** | ||
* ```js | ||
* const tls = require('node:tls'); | ||
* import tls from 'node:tls'; | ||
* ``` | ||
@@ -1007,4 +1007,4 @@ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/tls.js) | ||
* ```js | ||
* const tls = require('node:tls'); | ||
* const fs = require('node:fs'); | ||
* import tls from 'node:tls'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -1054,4 +1054,4 @@ * const options = { | ||
* // Assumes an echo server that is listening on port 8000. | ||
* const tls = require('node:tls'); | ||
* const fs = require('node:fs'); | ||
* import tls from 'node:tls'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -1058,0 +1058,0 @@ * const options = { |
@@ -56,3 +56,3 @@ /** | ||
* ```js | ||
* const trace_events = require('node:trace_events'); | ||
* import trace_events from 'node:trace_events'; | ||
* const tracing = trace_events.createTracing({ categories: ['node.perf'] }); | ||
@@ -122,3 +122,3 @@ * tracing.enable(); // Enable trace event capture for the 'node.perf' category | ||
* ```js | ||
* const trace_events = require('node:trace_events'); | ||
* import trace_events from 'node:trace_events'; | ||
* const t1 = trace_events.createTracing({ categories: ['node', 'v8'] }); | ||
@@ -164,3 +164,3 @@ * const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] }); | ||
* ```js | ||
* const trace_events = require('node:trace_events'); | ||
* import trace_events from 'node:trace_events'; | ||
* const categories = ['node.perf', 'node.async_hooks']; | ||
@@ -184,3 +184,3 @@ * const tracing = trace_events.createTracing({ categories }); | ||
* ```js | ||
* const trace_events = require('node:trace_events'); | ||
* import trace_events from 'node:trace_events'; | ||
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); | ||
@@ -187,0 +187,0 @@ * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* const tty = require('node:tty'); | ||
* import tty from 'node:tty'; | ||
* ``` | ||
@@ -9,0 +9,0 @@ * |
@@ -96,3 +96,3 @@ /** | ||
* ```js | ||
* const url = require('node:url'); | ||
* import url from 'node:url'; | ||
* url.format({ | ||
@@ -161,3 +161,3 @@ * protocol: 'https', | ||
* ```js | ||
* const url = require('node:url'); | ||
* import url from 'node:url'; | ||
* url.format({ | ||
@@ -227,3 +227,3 @@ * protocol: 'https', | ||
* ```js | ||
* const url = require('node:url'); | ||
* import url from 'node:url'; | ||
* url.resolve('/one/two/three', 'four'); // '/one/two/four' | ||
@@ -406,6 +406,6 @@ * url.resolve('http://example.com/', '/one'); // 'http://example.com/one' | ||
* ```js | ||
* const { | ||
* import { | ||
* Blob, | ||
* resolveObjectURL, | ||
* } = require('node:buffer'); | ||
* } from 'node:buffer'; | ||
* | ||
@@ -950,3 +950,3 @@ * const blob = new Blob(['hello']); | ||
/** | ||
* `URL` class is a global reference for `require('url').URL` | ||
* `URL` class is a global reference for `import { URL } from 'url'` | ||
* https://nodejs.org/api/url.html#the-whatwg-url-api | ||
@@ -961,3 +961,3 @@ * @since v10.0.0 | ||
/** | ||
* `URLSearchParams` class is a global reference for `require('url').URLSearchParams` | ||
* `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'` | ||
* https://nodejs.org/api/url.html#class-urlsearchparams | ||
@@ -964,0 +964,0 @@ * @since v10.0.0 |
@@ -5,3 +5,3 @@ /** | ||
* ```js | ||
* const v8 = require('node:v8'); | ||
* import v8 from 'node:v8'; | ||
* ``` | ||
@@ -180,3 +180,3 @@ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/v8.js) | ||
* // Print GC events to stdout for one minute. | ||
* const v8 = require('node:v8'); | ||
* import v8 from 'node:v8'; | ||
* v8.setFlagsFromString('--trace_gc'); | ||
@@ -248,3 +248,3 @@ * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3); | ||
* // Print heap snapshot to the console | ||
* const v8 = require('node:v8'); | ||
* import v8 from 'node:v8'; | ||
* const stream = v8.getHeapSnapshot(); | ||
@@ -274,8 +274,8 @@ * stream.pipe(process.stdout); | ||
* ```js | ||
* const { writeHeapSnapshot } = require('node:v8'); | ||
* const { | ||
* import { writeHeapSnapshot } from 'node:v8'; | ||
* import { | ||
* Worker, | ||
* isMainThread, | ||
* parentPort, | ||
* } = require('node:worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* | ||
@@ -557,3 +557,3 @@ * if (isMainThread) { | ||
* ```js | ||
* const { GCProfiler } = require('v8'); | ||
* import { GCProfiler } from 'node:v8'; | ||
* const profiler = new GCProfiler(); | ||
@@ -744,8 +744,8 @@ * profiler.start(); | ||
* | ||
* const fs = require('node:fs'); | ||
* const zlib = require('node:zlib'); | ||
* const path = require('node:path'); | ||
* const assert = require('node:assert'); | ||
* import fs from 'node:fs'; | ||
* import zlib from 'node:zlib'; | ||
* import path from 'node:path'; | ||
* import assert from 'node:assert'; | ||
* | ||
* const v8 = require('node:v8'); | ||
* import v8 from 'node:v8'; | ||
* | ||
@@ -752,0 +752,0 @@ * class BookShelf { |
@@ -20,3 +20,3 @@ /** | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -207,3 +207,3 @@ * const x = 1; | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -244,3 +244,3 @@ * const context = { | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -270,3 +270,3 @@ * const script = new vm.Script('globalVar = "set"'); | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -364,3 +364,3 @@ * global.globalVar = 0; | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -412,3 +412,3 @@ * global.globalVar = 3; | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -442,3 +442,3 @@ * const contextObject = { globalVar: 1 }; | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -475,3 +475,3 @@ * const contextObject = { | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* let localVar = 'initial value'; | ||
@@ -498,3 +498,3 @@ * | ||
* In order to run a simple web server using the `node:http` module the code passed | ||
* to the context must either call `require('node:http')` on its own, or have a | ||
* 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: | ||
@@ -504,7 +504,7 @@ * | ||
* 'use strict'; | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
* const code = ` | ||
* ((require) => { | ||
* const http = require('node:http'); | ||
* const http = require('node:http'); | ||
* | ||
@@ -560,3 +560,3 @@ * http.createServer((request, response) => { | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* // Measure the memory used by the main context. | ||
@@ -867,3 +867,3 @@ * vm.measureMemory({ mode: 'summary' }) | ||
* ```js | ||
* const vm = require('node:vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -870,0 +870,0 @@ * const source = '{ "a": 1 }'; |
@@ -12,3 +12,3 @@ /** | ||
* import { readFile } from 'node:fs/promises'; | ||
* import { WASI } from 'wasi'; | ||
* import { WASI } from 'node:wasi'; | ||
* import { argv, env } from 'node:process'; | ||
@@ -15,0 +15,0 @@ * |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* const worker = require('node:worker_threads'); | ||
* import worker from 'node:worker_threads'; | ||
* ``` | ||
@@ -18,5 +18,6 @@ * | ||
* ```js | ||
* const { | ||
* import { | ||
* Worker, isMainThread, parentPort, workerData, | ||
* } = require('node:worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* import { parse } from 'some-js-parsing-library'; | ||
* | ||
@@ -38,3 +39,2 @@ * if (isMainThread) { | ||
* } else { | ||
* const { parse } = require('some-js-parsing-library'); | ||
* const script = workerData; | ||
@@ -78,3 +78,3 @@ * parentPort.postMessage(parse(script)); | ||
* ```js | ||
* const { MessageChannel } = require('node:worker_threads'); | ||
* import { MessageChannel } from 'node:worker_threads'; | ||
* | ||
@@ -128,3 +128,3 @@ * const { port1, port2 } = new MessageChannel(); | ||
* ```js | ||
* const { MessageChannel } = require('node:worker_threads'); | ||
* import { MessageChannel } from 'node:worker_threads'; | ||
* const { port1, port2 } = new MessageChannel(); | ||
@@ -151,3 +151,3 @@ * | ||
* ```js | ||
* const { MessageChannel } = require('node:worker_threads'); | ||
* import { MessageChannel } from 'node:worker_threads'; | ||
* const { port1, port2 } = new MessageChannel(); | ||
@@ -307,4 +307,4 @@ * | ||
* * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread. | ||
* * The `require('node:worker_threads').isMainThread` property is set to `false`. | ||
* * The `require('node:worker_threads').parentPort` message port is available. | ||
* * The `import { isMainThread } from 'node:worker_threads'` variable is set to `false`. | ||
* * The `import { parentPort } from 'node:worker_threads'` message port is available. | ||
* * `process.exit()` does not stop the whole program, just the single thread, | ||
@@ -344,6 +344,6 @@ * and `process.abort()` is not available. | ||
* ```js | ||
* const assert = require('node:assert'); | ||
* const { | ||
* import assert from 'node:assert'; | ||
* import { | ||
* Worker, MessageChannel, MessagePort, isMainThread, parentPort, | ||
* } = require('node:worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* if (isMainThread) { | ||
@@ -388,3 +388,3 @@ * const worker = new Worker(__filename); | ||
* An integer identifier for the referenced thread. Inside the worker thread, | ||
* it is available as `require('node:worker_threads').threadId`. | ||
* it is available as `import { threadId } from 'node:worker_threads'`. | ||
* This value is unique for each `Worker` instance inside a single process. | ||
@@ -525,7 +525,7 @@ * @since v10.5.0 | ||
* | ||
* const { | ||
* import { | ||
* isMainThread, | ||
* BroadcastChannel, | ||
* Worker, | ||
* } = require('node:worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* | ||
@@ -584,3 +584,3 @@ * const bc = new BroadcastChannel('hello'); | ||
* ```js | ||
* const { MessageChannel, markAsUntransferable } = require('node:worker_threads'); | ||
* import { MessageChannel, markAsUntransferable } from 'node:worker_threads'; | ||
* | ||
@@ -630,3 +630,3 @@ * const pooledBuffer = new ArrayBuffer(8); | ||
* ```js | ||
* const { MessageChannel, receiveMessageOnPort } = require('node:worker_threads'); | ||
* import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads'; | ||
* const { port1, port2 } = new MessageChannel(); | ||
@@ -657,3 +657,3 @@ * port1.postMessage({ hello: 'world' }); | ||
* ```js | ||
* const { | ||
* import { | ||
* Worker, | ||
@@ -663,3 +663,3 @@ * isMainThread, | ||
* getEnvironmentData, | ||
* } = require('node:worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* | ||
@@ -693,3 +693,3 @@ * if (isMainThread) { | ||
/** | ||
* `BroadcastChannel` class is a global reference for `require('worker_threads').BroadcastChannel` | ||
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'worker_threads'` | ||
* https://nodejs.org/api/globals.html#broadcastchannel | ||
@@ -704,3 +704,3 @@ * @since v18.0.0 | ||
/** | ||
* `MessageChannel` class is a global reference for `require('worker_threads').MessageChannel` | ||
* `MessageChannel` class is a global reference for `import { MessageChannel } from 'worker_threads'` | ||
* https://nodejs.org/api/globals.html#messagechannel | ||
@@ -715,3 +715,3 @@ * @since v15.0.0 | ||
/** | ||
* `MessagePort` class is a global reference for `require('worker_threads').MessagePort` | ||
* `MessagePort` class is a global reference for `import { MessagePort } from 'worker_threads'` | ||
* https://nodejs.org/api/globals.html#messageport | ||
@@ -718,0 +718,0 @@ * @since v15.0.0 |
@@ -8,3 +8,3 @@ /** | ||
* ```js | ||
* const zlib = require('node:zlib'); | ||
* import zlib from 'node:zlib'; | ||
* ``` | ||
@@ -20,8 +20,8 @@ * | ||
* ```js | ||
* const { createGzip } = require('node:zlib'); | ||
* const { pipeline } = require('node:stream'); | ||
* const { | ||
* import { createGzip } from 'node:zlib'; | ||
* import { pipeline } from 'node:stream'; | ||
* import { | ||
* createReadStream, | ||
* createWriteStream, | ||
* } = require('node:fs'); | ||
* } from 'node:fs'; | ||
* | ||
@@ -41,3 +41,3 @@ * const gzip = createGzip(); | ||
* | ||
* const { promisify } = require('node:util'); | ||
* import { promisify } from 'node:util'; | ||
* const pipe = promisify(pipeline); | ||
@@ -62,3 +62,3 @@ * | ||
* ```js | ||
* const { deflate, unzip } = require('node:zlib'); | ||
* import { deflate, unzip } from 'node:zlib'; | ||
* | ||
@@ -85,3 +85,3 @@ * const input = '.................................'; | ||
* | ||
* const { promisify } = require('node:util'); | ||
* import { promisify } from 'node:util'; | ||
* const do_unzip = promisify(unzip); | ||
@@ -88,0 +88,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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49418
2229766