@types/node
Advanced tools
Comparing version 16.18.110 to 16.18.111
@@ -234,2 +234,3 @@ /** | ||
* ```js | ||
* import net from 'node:net'; | ||
* if (cluster.isPrimary) { | ||
@@ -252,3 +253,2 @@ * const worker = cluster.fork(); | ||
* } else if (cluster.isWorker) { | ||
* const net = require('node:net'); | ||
* const server = net.createServer((socket) => { | ||
@@ -255,0 +255,0 @@ * // Connections never end |
@@ -9,3 +9,3 @@ /** | ||
* * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstdout) and | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstderr). The global `console` can be used without calling `require('node:console')`. | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v16.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-v16.x/api/process.html#processstdout) and | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v16.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`. | ||
* [`process.stderr`](https://nodejs.org/docs/latest-v16.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'; | ||
* | ||
@@ -134,3 +134,3 @@ * dns.resolve4('archive.org', (err, addresses) => { | ||
* ```js | ||
* const dns = require('node:dns'); | ||
* import dns from 'node:dns'; | ||
* const options = { | ||
@@ -195,3 +195,3 @@ * family: 6, | ||
* ```js | ||
* const dns = require('node:dns'); | ||
* import dns from 'node:dns'; | ||
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { | ||
@@ -773,3 +773,3 @@ * console.log(hostname, service); | ||
* ```js | ||
* const { Resolver } = require('node:dns'); | ||
* import { Resolver } from 'node:dns'; | ||
* const resolver = new Resolver(); | ||
@@ -776,0 +776,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 } 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,4 +100,4 @@ * const options = { | ||
* ```js | ||
* const dnsPromises = require('node:dns').promises; | ||
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => { | ||
* import dns from 'node:dns'; | ||
* dns.promises.lookupService('127.0.0.1', 22).then((result) => { | ||
* console.log(result.hostname, result.service); | ||
@@ -388,3 +388,4 @@ * // Prints: localhost ssh | ||
* ```js | ||
* const { Resolver } = require('node:dns').promises; | ||
* import dns from 'node:dns'; | ||
* const { Resolver } = dns.promises; | ||
* const resolver = new Resolver(); | ||
@@ -391,0 +392,0 @@ * resolver.setServers(['4.4.4.4']); |
@@ -66,4 +66,4 @@ /** | ||
* ```js | ||
* const domain = require('domain'); | ||
* const fs = require('fs'); | ||
* import domain from 'node:domain'; | ||
* import fs from 'node:fs'; | ||
* const d = domain.create(); | ||
@@ -70,0 +70,0 @@ * d.on('error', (er) => { |
@@ -25,3 +25,3 @@ /** | ||
* ```js | ||
* const EventEmitter = require('events'); | ||
* import EventEmitter from 'node:events'; | ||
* | ||
@@ -83,3 +83,3 @@ * class MyEmitter extends EventEmitter {} | ||
* ```js | ||
* const EventEmitter = require('events'); | ||
* import EventEmitter from 'node:events'; | ||
* ``` | ||
@@ -108,3 +108,3 @@ * | ||
* ```js | ||
* const { once, EventEmitter } = require('events'); | ||
* import { once, EventEmitter } from 'node:events'; | ||
* | ||
@@ -141,3 +141,3 @@ * async function run() { | ||
* ```js | ||
* const { EventEmitter, once } = require('events'); | ||
* import { EventEmitter, once } from 'node:events'; | ||
* | ||
@@ -158,3 +158,3 @@ * const ee = new EventEmitter(); | ||
* ```js | ||
* const { EventEmitter, once } = require('events'); | ||
* import { EventEmitter, once } from 'node:events'; | ||
* | ||
@@ -191,3 +191,3 @@ * const ee = new EventEmitter(); | ||
* ```js | ||
* const { on, EventEmitter } = require('events'); | ||
* import { on, EventEmitter } from 'node:events'; | ||
* | ||
@@ -221,3 +221,3 @@ * (async () => { | ||
* ```js | ||
* const { on, EventEmitter } = require('events'); | ||
* import { on, EventEmitter } from 'node:events'; | ||
* const ac = new AbortController(); | ||
@@ -258,3 +258,3 @@ * | ||
* ```js | ||
* const { EventEmitter, listenerCount } = require('events'); | ||
* import { EventEmitter, listenerCount } from 'node:events'; | ||
* const myEmitter = new EventEmitter(); | ||
@@ -282,3 +282,3 @@ * myEmitter.on('event', () => {}); | ||
* ```js | ||
* const { getEventListeners, EventEmitter } = require('events'); | ||
* import { getEventListeners, EventEmitter } from 'node:events'; | ||
* | ||
@@ -303,6 +303,6 @@ * { | ||
* ```js | ||
* const { | ||
* import { | ||
* setMaxListeners, | ||
* EventEmitter | ||
* } = require('events'); | ||
* } from 'node:events'; | ||
* | ||
@@ -623,3 +623,3 @@ * const target = new EventTarget(); | ||
* ```js | ||
* const EventEmitter = require('events'); | ||
* import EventEmitter from 'node:events'; | ||
* const myEmitter = new EventEmitter(); | ||
@@ -703,3 +703,3 @@ * | ||
* ```js | ||
* const EventEmitter = require('events'); | ||
* import EventEmitter from 'node:events'; | ||
* const myEE = new EventEmitter(); | ||
@@ -706,0 +706,0 @@ * myEE.on('foo', () => {}); |
@@ -833,3 +833,3 @@ /** | ||
* platform-specific path separator | ||
* (`require('path').sep`). | ||
* (`import { sep } from 'node:path'`). | ||
* @since v10.0.0 | ||
@@ -1054,3 +1054,3 @@ * @return Fulfills with a string containing the filesystem path of the newly created temporary directory. | ||
* ```js | ||
* const { watch } = require('fs/promises'); | ||
* import { watch } from 'node:fs/promises'; | ||
* | ||
@@ -1057,0 +1057,0 @@ * const ac = new AbortController(); |
@@ -263,4 +263,4 @@ /** | ||
* // curl -k https://localhost:8000/ | ||
* const https = require('https'); | ||
* const fs = require('fs'); | ||
* import https from 'node:https'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -281,4 +281,4 @@ * const options = { | ||
* ```js | ||
* const https = require('https'); | ||
* const fs = require('fs'); | ||
* import https from 'node:https'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -323,3 +323,3 @@ * const options = { | ||
* ```js | ||
* const https = require('https'); | ||
* import https from 'node:https'; | ||
* | ||
@@ -397,5 +397,5 @@ * const options = { | ||
* ```js | ||
* const tls = require('tls'); | ||
* const https = require('https'); | ||
* const crypto = require('crypto'); | ||
* import tls from 'node:tls'; | ||
* import https from 'node:https'; | ||
* import crypto from 'node:crypto'; | ||
* | ||
@@ -508,3 +508,3 @@ * function sha256(s) { | ||
* ```js | ||
* const https = require('https'); | ||
* import https from 'node:https'; | ||
* | ||
@@ -511,0 +511,0 @@ * https.get('https://encrypted.google.com/', (res) => { |
@@ -14,5 +14,5 @@ /** | ||
* ```js | ||
* const fs = require('fs'); | ||
* const assert = require('assert'); | ||
* const { syncBuiltinESMExports } = require('module'); | ||
* import fs from 'node:fs'; | ||
* import assert from 'node:assert'; | ||
* import { syncBuiltinESMExports } from 'node:module'; | ||
* | ||
@@ -19,0 +19,0 @@ * fs.readFile = newAPI; |
@@ -11,3 +11,3 @@ /** | ||
* ```js | ||
* const net = require('net'); | ||
* import net from 'node:net'; | ||
* ``` | ||
@@ -721,3 +721,3 @@ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/net.js) | ||
* ```js | ||
* const net = require('net'); | ||
* import net from 'node:net'; | ||
* const server = net.createServer((c) => { | ||
@@ -724,0 +724,0 @@ * // 'connection' listener. |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* const os = require('os'); | ||
* import os from 'node:os'; | ||
* ``` | ||
@@ -9,0 +9,0 @@ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/os.js) |
{ | ||
"name": "@types/node", | ||
"version": "16.18.110", | ||
"version": "16.18.111", | ||
"description": "TypeScript definitions for node", | ||
@@ -213,4 +213,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "0d691889c6bd85ef024ca5b209d46b2aaa88c7dd918ac667cd6f508ac8a35f9d", | ||
"typesPublisherContentHash": "695b15dada90139e7b7288801affaa6ee9bb9602189ec574e64ab886a3061550", | ||
"typeScriptVersion": "4.8" | ||
} |
@@ -14,3 +14,3 @@ declare module "path/posix" { | ||
* ```js | ||
* const path = require('path'); | ||
* import path from 'node:path'; | ||
* ``` | ||
@@ -17,0 +17,0 @@ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/path.js) |
@@ -12,3 +12,3 @@ /** | ||
* ```js | ||
* const { PerformanceObserver, performance } = require('perf_hooks'); | ||
* import { PerformanceObserver, performance } from 'node:perf_hooks'; | ||
* | ||
@@ -311,6 +311,6 @@ * const obs = new PerformanceObserver((items) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver | ||
* } = require('perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -351,6 +351,6 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver | ||
* } = require('perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -398,6 +398,6 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver | ||
* } = require('perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -445,6 +445,6 @@ * const obs = new PerformanceObserver((perfObserverList, observer) => { | ||
* ```js | ||
* const { | ||
* import { | ||
* performance, | ||
* PerformanceObserver | ||
* } = require('perf_hooks'); | ||
* } from 'node:perf_hooks'; | ||
* | ||
@@ -679,3 +679,3 @@ * const obs = new PerformanceObserver((list, observer) => { | ||
* ```js | ||
* const { monitorEventLoopDelay } = require('perf_hooks'); | ||
* import { monitorEventLoopDelay } from 'node:perf_hooks'; | ||
* const h = monitorEventLoopDelay({ resolution: 20 }); | ||
@@ -722,3 +722,3 @@ * h.enable(); | ||
/** | ||
* `performance` is a global reference for `require('perf_hooks').performance` | ||
* `performance` is a global reference for `import { performance } from 'node:perf_hooks'` | ||
* https://nodejs.org/api/globals.html#performance | ||
@@ -725,0 +725,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('querystring'); | ||
* import querystring from 'node:querystring'; | ||
* ``` | ||
@@ -9,0 +9,0 @@ * |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* const readline = require('readline'); | ||
* import readline from 'node:readline'; | ||
* ``` | ||
@@ -13,3 +13,3 @@ * | ||
* ```js | ||
* const readline = require('readline'); | ||
* import readline from 'node:readline'; | ||
* | ||
@@ -181,3 +181,3 @@ * const rl = readline.createInterface({ | ||
* ```js | ||
* const util = require('util'); | ||
* import util from 'node:util'; | ||
* const question = util.promisify(rl.question).bind(rl); | ||
@@ -355,3 +355,3 @@ * | ||
* ```js | ||
* const readline = require('readline'); | ||
* import readline from 'node:readline'; | ||
* const rl = readline.createInterface({ | ||
@@ -453,3 +453,3 @@ * input: process.stdin, | ||
* ```js | ||
* const readline = require('readline'); | ||
* import readline from 'node:readline'; | ||
* const rl = readline.createInterface({ | ||
@@ -486,4 +486,4 @@ * input: process.stdin, | ||
* ```js | ||
* const fs = require('fs'); | ||
* const readline = require('readline'); | ||
* import fs from 'node:fs'; | ||
* import readline from 'node:readline'; | ||
* | ||
@@ -512,4 +512,4 @@ * async function processLineByLine() { | ||
* ```js | ||
* const fs = require('fs'); | ||
* const readline = require('readline'); | ||
* import fs from 'node:fs'; | ||
* import readline from 'node:readline'; | ||
* | ||
@@ -529,5 +529,5 @@ * const rl = readline.createInterface({ | ||
* ```js | ||
* const { once } = require('events'); | ||
* const { createReadStream } = require('fs'); | ||
* const { createInterface } = require('readline'); | ||
* import { once } from 'node:events'; | ||
* import { createReadStream } from 'node:fs'; | ||
* import { createInterface } from 'node:readline'; | ||
* | ||
@@ -534,0 +534,0 @@ * (async function processLineByLine() { |
@@ -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: none | ||
@@ -14,0 +14,0 @@ |
@@ -7,3 +7,3 @@ /** | ||
* ```js | ||
* const repl = require('repl'); | ||
* import repl from 'node:repl'; | ||
* ``` | ||
@@ -134,3 +134,3 @@ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/repl.js) | ||
* ```js | ||
* const repl = require('repl'); | ||
* import repl from 'node:repl'; | ||
* | ||
@@ -262,3 +262,3 @@ * const options = { useColors: true }; | ||
* ```js | ||
* const repl = require('repl'); | ||
* import repl from 'node:repl'; | ||
* | ||
@@ -413,3 +413,3 @@ * const replServer = repl.start({ prompt: '> ' }); | ||
* ```js | ||
* const repl = require('repl'); | ||
* import repl from 'node:repl'; | ||
* | ||
@@ -416,0 +416,0 @@ * // a Unix style prompt |
@@ -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('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('timers/promises')`. | ||
* that return `Promise` objects. The API is accessible via `import timersPromises from 'node:timers/promises'`. | ||
* | ||
@@ -5,0 +5,0 @@ * ```js |
@@ -7,3 +7,3 @@ /** | ||
* ```js | ||
* const tls = require('tls'); | ||
* import tls from 'node:tls'; | ||
* ``` | ||
@@ -909,4 +909,4 @@ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/tls.js) | ||
* ```js | ||
* const tls = require('tls'); | ||
* const fs = require('fs'); | ||
* import tls from 'node:tls'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -956,4 +956,4 @@ * const options = { | ||
* // Assumes an echo server that is listening on port 8000. | ||
* const tls = require('tls'); | ||
* const fs = require('fs'); | ||
* import tls from 'node:tls'; | ||
* import fs from 'node:fs'; | ||
* | ||
@@ -960,0 +960,0 @@ * const options = { |
@@ -49,3 +49,3 @@ /** | ||
* ```js | ||
* const trace_events = require('trace_events'); | ||
* import trace_events from 'node:trace_events'; | ||
* const tracing = trace_events.createTracing({ categories: ['node.perf'] }); | ||
@@ -126,3 +126,3 @@ * tracing.enable(); // Enable trace event capture for the 'node.perf' category | ||
* ```js | ||
* const trace_events = require('trace_events'); | ||
* import trace_events from 'node:trace_events'; | ||
* const categories = ['node.perf', 'node.async_hooks']; | ||
@@ -147,3 +147,3 @@ * const tracing = trace_events.createTracing({ categories }); | ||
* ```js | ||
* const trace_events = require('trace_events'); | ||
* import trace_events from 'node:trace_events'; | ||
* const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); | ||
@@ -150,0 +150,0 @@ * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); |
@@ -7,3 +7,3 @@ /** | ||
* ```js | ||
* const tty = require('tty'); | ||
* import tty from 'node:tty'; | ||
* ``` | ||
@@ -10,0 +10,0 @@ * |
@@ -110,3 +110,3 @@ /** | ||
* ```js | ||
* const url = require('node:url'); | ||
* import url from 'node:url'; | ||
* url.format({ | ||
@@ -176,3 +176,3 @@ * protocol: 'https', | ||
* ```js | ||
* const url = require('node:url'); | ||
* import url from 'node:url'; | ||
* url.resolve('/one/two/three', 'four'); // '/one/two/four' | ||
@@ -359,6 +359,6 @@ * url.resolve('http://example.com/', '/one'); // 'http://example.com/one' | ||
* ```js | ||
* const { | ||
* import { | ||
* Blob, | ||
* resolveObjectURL, | ||
* } = require('node:buffer'); | ||
* } from 'node:buffer'; | ||
* | ||
@@ -867,3 +867,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 'node:url'` | ||
* https://nodejs.org/api/url.html#the-whatwg-url-api | ||
@@ -877,3 +877,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 | ||
@@ -880,0 +880,0 @@ * @since v10.0.0 |
@@ -5,3 +5,3 @@ /** | ||
* ```js | ||
* const v8 = require('node:v8'); | ||
* import v8 from 'node:v8'; | ||
* ``` | ||
@@ -168,3 +168,3 @@ * @see [source](https://github.com/nodejs/node/blob/v16.20.2/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'); | ||
@@ -192,3 +192,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(); | ||
@@ -218,8 +218,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'; | ||
* | ||
@@ -561,8 +561,8 @@ * if (isMainThread) { | ||
* | ||
* 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'; | ||
* | ||
@@ -569,0 +569,0 @@ * class BookShelf { |
@@ -18,3 +18,3 @@ /** | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -170,3 +170,3 @@ * const x = 1; | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -207,3 +207,3 @@ * const context = { | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -233,3 +233,3 @@ * const script = new vm.Script('globalVar = "set"'); | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -287,3 +287,3 @@ * global.globalVar = 0; | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -335,3 +335,3 @@ * global.globalVar = 3; | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -365,3 +365,3 @@ * const contextObject = { globalVar: 1 }; | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
@@ -394,3 +394,3 @@ * const contextObject = { | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* let localVar = 'initial value'; | ||
@@ -422,8 +422,7 @@ * | ||
* 'use strict'; | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* | ||
* const code = ` | ||
* ((require) => { | ||
* const http = require('http'); | ||
* | ||
* const http = require('node:http'); | ||
* http.createServer((request, response) => { | ||
@@ -470,3 +469,3 @@ * response.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
* ```js | ||
* const vm = require('vm'); | ||
* import vm from 'node:vm'; | ||
* // Measure the memory used by the main context. | ||
@@ -473,0 +472,0 @@ * vm.measureMemory({ mode: 'summary' }) |
@@ -6,3 +6,3 @@ /** | ||
* ```js | ||
* const worker = require('worker_threads'); | ||
* import worker from 'node:worker_threads'; | ||
* ``` | ||
@@ -18,5 +18,6 @@ * | ||
* ```js | ||
* const { | ||
* import { | ||
* Worker, isMainThread, parentPort, workerData | ||
* } = require('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('worker_threads'); | ||
* import { MessageChannel } from 'node:worker_threads'; | ||
* | ||
@@ -128,3 +128,3 @@ * const { port1, port2 } = new MessageChannel(); | ||
* ```js | ||
* const { MessageChannel } = require('worker_threads'); | ||
* import { MessageChannel } from 'node:worker_threads'; | ||
* const { port1, port2 } = new MessageChannel(); | ||
@@ -151,3 +151,3 @@ * | ||
* ```js | ||
* const { MessageChannel } = require('worker_threads'); | ||
* import { MessageChannel } from 'node:worker_threads'; | ||
* const { port1, port2 } = new MessageChannel(); | ||
@@ -301,4 +301,4 @@ * | ||
* * The `process.stdin`, `process.stdout` and `process.stderr` may be redirected by the parent thread. | ||
* * The `require('worker_threads').isMainThread` property is set to `false`. | ||
* * The `require('worker_threads').parentPort` message port is available. | ||
* * The `import { isMainThread } from 'node:worker_threads'` property 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, | ||
@@ -337,6 +337,6 @@ * and `process.abort()` is not available. | ||
* ```js | ||
* const assert = require('assert'); | ||
* const { | ||
* import assert from 'node:assert'; | ||
* import { | ||
* Worker, MessageChannel, MessagePort, isMainThread, parentPort | ||
* } = require('worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* if (isMainThread) { | ||
@@ -381,3 +381,3 @@ * const worker = new Worker(__filename); | ||
* An integer identifier for the referenced thread. Inside the worker thread, | ||
* it is available as `require('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. | ||
@@ -500,7 +500,7 @@ * @since v10.5.0 | ||
* | ||
* const { | ||
* import { | ||
* isMainThread, | ||
* BroadcastChannel, | ||
* Worker | ||
* } = require('worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* | ||
@@ -560,3 +560,3 @@ * const bc = new BroadcastChannel('hello'); | ||
* ```js | ||
* const { MessageChannel, markAsUntransferable } = require('worker_threads'); | ||
* import { MessageChannel, markAsUntransferable } from 'node:worker_threads'; | ||
* | ||
@@ -606,3 +606,3 @@ * const pooledBuffer = new ArrayBuffer(8); | ||
* ```js | ||
* const { MessageChannel, receiveMessageOnPort } = require('worker_threads'); | ||
* import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads'; | ||
* const { port1, port2 } = new MessageChannel(); | ||
@@ -633,3 +633,3 @@ * port1.postMessage({ hello: 'world' }); | ||
* ```js | ||
* const { | ||
* import { | ||
* Worker, | ||
@@ -639,3 +639,3 @@ * isMainThread, | ||
* getEnvironmentData, | ||
* } = require('worker_threads'); | ||
* } from 'node:worker_threads'; | ||
* | ||
@@ -642,0 +642,0 @@ * if (isMainThread) { |
@@ -8,3 +8,3 @@ /** | ||
* ```js | ||
* const zlib = require('zlib'); | ||
* import zlib from 'node:zlib'; | ||
* ``` | ||
@@ -19,8 +19,8 @@ * | ||
* ```js | ||
* const { createGzip } = require('zlib'); | ||
* const { pipeline } = require('stream'); | ||
* const { | ||
* import { createGzip } from 'node:zlib'; | ||
* import { pipeline } from 'node:stream'; | ||
* import { | ||
* createReadStream, | ||
* createWriteStream | ||
* } = require('fs'); | ||
* } from 'node:fs'; | ||
* | ||
@@ -40,3 +40,3 @@ * const gzip = createGzip(); | ||
* | ||
* const { promisify } = require('util'); | ||
* import { promisify } from 'node:util'; | ||
* const pipe = promisify(pipeline); | ||
@@ -61,3 +61,3 @@ * | ||
* ```js | ||
* const { deflate, unzip } = require('zlib'); | ||
* import { deflate, unzip } from 'node:zlib'; | ||
* | ||
@@ -84,3 +84,3 @@ * const input = '.................................'; | ||
* | ||
* const { promisify } = require('util'); | ||
* import { promisify } from 'node:util'; | ||
* const do_unzip = promisify(unzip); | ||
@@ -87,0 +87,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
1812308
40615