@types/node 18.19.51 → 18.19.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node v18.19/http2.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * It can be accessed using:
4
4
  *
5
5
  * ```js
6
- * const http2 = require('http2');
6
+ * import http2 from 'node:http2';
7
7
  * ```
8
8
  * @since v8.4.0
9
9
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/http2.js)
@@ -157,7 +157,7 @@ declare module "http2" {
157
157
  priority(options: StreamPriorityOptions): void;
158
158
  /**
159
159
  * ```js
160
- * const http2 = require('http2');
160
+ * import http2 from 'node:http2';
161
161
  * const client = http2.connect('http://example.org:8000');
162
162
  * const { NGHTTP2_CANCEL } = http2.constants;
163
163
  * const req = client.request({ ':path': '/' });
@@ -177,7 +177,7 @@ declare module "http2" {
177
177
  * trailers can be sent.
178
178
  *
179
179
  * ```js
180
- * const http2 = require('http2');
180
+ * import http2 from 'node:http2';
181
181
  * const server = http2.createServer();
182
182
  * server.on('stream', (stream) => {
183
183
  * stream.respond(undefined, { waitForTrailers: true });
@@ -368,7 +368,7 @@ declare module "http2" {
368
368
  * Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument.
369
369
  *
370
370
  * ```js
371
- * const http2 = require('http2');
371
+ * import http2 from 'node:http2';
372
372
  * const server = http2.createServer();
373
373
  * server.on('stream', (stream) => {
374
374
  * stream.respond({ ':status': 200 });
@@ -400,7 +400,7 @@ declare module "http2" {
400
400
  ): void;
401
401
  /**
402
402
  * ```js
403
- * const http2 = require('http2');
403
+ * import http2 from 'node:http2';
404
404
  * const server = http2.createServer();
405
405
  * server.on('stream', (stream) => {
406
406
  * stream.respond({ ':status': 200 });
@@ -416,7 +416,7 @@ declare module "http2" {
416
416
  * close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`.
417
417
  *
418
418
  * ```js
419
- * const http2 = require('http2');
419
+ * import http2 from 'node:http2';
420
420
  * const server = http2.createServer();
421
421
  * server.on('stream', (stream) => {
422
422
  * stream.respond({ ':status': 200 }, { waitForTrailers: true });
@@ -439,8 +439,8 @@ declare module "http2" {
439
439
  * automatically.
440
440
  *
441
441
  * ```js
442
- * const http2 = require('http2');
443
- * const fs = require('fs');
442
+ * import http2 from 'node:http2';
443
+ * import fs from 'node:fs';
444
444
  *
445
445
  * const server = http2.createServer();
446
446
  * server.on('stream', (stream) => {
@@ -482,8 +482,8 @@ declare module "http2" {
482
482
  * or `http2stream.close()` to close the `Http2Stream`.
483
483
  *
484
484
  * ```js
485
- * const http2 = require('http2');
486
- * const fs = require('fs');
485
+ * import http2 from 'node:http2';
486
+ * import fs from 'node:fs';
487
487
  *
488
488
  * const server = http2.createServer();
489
489
  * server.on('stream', (stream) => {
@@ -529,7 +529,7 @@ declare module "http2" {
529
529
  * Example using a file path:
530
530
  *
531
531
  * ```js
532
- * const http2 = require('http2');
532
+ * import http2 from 'node:http2';
533
533
  * const server = http2.createServer();
534
534
  * server.on('stream', (stream) => {
535
535
  * function statCheck(stat, headers) {
@@ -563,7 +563,7 @@ declare module "http2" {
563
563
  * results to determine if the file has been modified to return an appropriate `304` response:
564
564
  *
565
565
  * ```js
566
- * const http2 = require('http2');
566
+ * import http2 from 'node:http2';
567
567
  * const server = http2.createServer();
568
568
  * server.on('stream', (stream) => {
569
569
  * function statCheck(stat, headers) {
@@ -596,7 +596,7 @@ declare module "http2" {
596
596
  * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`.
597
597
  *
598
598
  * ```js
599
- * const http2 = require('http2');
599
+ * import http2 from 'node:http2';
600
600
  * const server = http2.createServer();
601
601
  * server.on('stream', (stream) => {
602
602
  * stream.respondWithFile('/some/file',
@@ -805,7 +805,7 @@ declare module "http2" {
805
805
  * the delta.
806
806
  *
807
807
  * ```js
808
- * const http2 = require('http2');
808
+ * import http2 from 'node:http2';
809
809
  *
810
810
  * const server = http2.createServer();
811
811
  * const expectedWindowSize = 2 ** 20;
@@ -932,7 +932,7 @@ declare module "http2" {
932
932
  * This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2_SESSION_CLIENT`.
933
933
  *
934
934
  * ```js
935
- * const http2 = require('http2');
935
+ * import http2 from 'node:http2';
936
936
  * const clientSession = http2.connect('https://localhost:1234');
937
937
  * const {
938
938
  * HTTP2_HEADER_PATH,
@@ -1065,7 +1065,7 @@ declare module "http2" {
1065
1065
  * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client.
1066
1066
  *
1067
1067
  * ```js
1068
- * const http2 = require('http2');
1068
+ * import http2 from 'node:http2';
1069
1069
  *
1070
1070
  * const server = http2.createServer();
1071
1071
  * server.on('session', (session) => {
@@ -1106,7 +1106,7 @@ declare module "http2" {
1106
1106
  * authoritative responses.
1107
1107
  *
1108
1108
  * ```js
1109
- * const http2 = require('http2');
1109
+ * import http2 from 'node:http2';
1110
1110
  * const options = getSecureOptionsSomehow();
1111
1111
  * const server = http2.createSecureServer(options);
1112
1112
  * server.on('stream', (stream) => {
@@ -1132,7 +1132,7 @@ declare module "http2" {
1132
1132
  * server using the `http2.createSecureServer()` method:
1133
1133
  *
1134
1134
  * ```js
1135
- * const http2 = require('http2');
1135
+ * import http2 from 'node:http2';
1136
1136
  * const options = getSecureOptionsSomehow();
1137
1137
  * options.origins = ['https://example.com', 'https://example.org'];
1138
1138
  * const server = http2.createSecureServer(options);
@@ -1812,7 +1812,7 @@ declare module "http2" {
1812
1812
  * All other interactions will be routed directly to the socket.
1813
1813
  *
1814
1814
  * ```js
1815
- * const http2 = require('http2');
1815
+ * import http2 from 'node:http2';
1816
1816
  * const server = http2.createServer((req, res) => {
1817
1817
  * const ip = req.socket.remoteAddress;
1818
1818
  * const port = req.socket.remotePort;
@@ -2388,7 +2388,7 @@ declare module "http2" {
2388
2388
  * for use with the `HTTP2-Settings` header field.
2389
2389
  *
2390
2390
  * ```js
2391
- * const http2 = require('http2');
2391
+ * import http2 from 'node:http2';
2392
2392
  *
2393
2393
  * const packed = http2.getPackedSettings({ enablePush: false });
2394
2394
  *
@@ -2413,7 +2413,7 @@ declare module "http2" {
2413
2413
  * with browser clients.
2414
2414
  *
2415
2415
  * ```js
2416
- * const http2 = require('http2');
2416
+ * import http2 from 'node:http2';
2417
2417
  *
2418
2418
  * // Create an unencrypted HTTP/2 server.
2419
2419
  * // Since there are no browsers known that support
@@ -2450,8 +2450,8 @@ declare module "http2" {
2450
2450
  * Returns a `tls.Server` instance that creates and manages `Http2Session` instances.
2451
2451
  *
2452
2452
  * ```js
2453
- * const http2 = require('http2');
2454
- * const fs = require('fs');
2453
+ * import http2 from 'node:http2';
2454
+ * import fs from 'node:fs';
2455
2455
  *
2456
2456
  * const options = {
2457
2457
  * key: fs.readFileSync('server-key.pem'),
@@ -2490,7 +2490,7 @@ declare module "http2" {
2490
2490
  * Returns a `ClientHttp2Session` instance.
2491
2491
  *
2492
2492
  * ```js
2493
- * const http2 = require('http2');
2493
+ * import http2 from 'node:http2';
2494
2494
  * const client = http2.connect('https://localhost:1234');
2495
2495
  *
2496
2496
  * // Use the client
node v18.19/https.d.ts CHANGED
@@ -270,8 +270,8 @@ declare module "https" {
270
270
  /**
271
271
  * ```js
272
272
  * // curl -k https://localhost:8000/
273
- * const https = require('https');
274
- * const fs = require('fs');
273
+ * import https from 'node:https';
274
+ * import fs from 'node:fs';
275
275
  *
276
276
  * const options = {
277
277
  * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
@@ -287,8 +287,8 @@ declare module "https" {
287
287
  * Or
288
288
  *
289
289
  * ```js
290
- * const https = require('https');
291
- * const fs = require('fs');
290
+ * import https from 'node:https';
291
+ * import fs from 'node:fs';
292
292
  *
293
293
  * const options = {
294
294
  * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
@@ -328,7 +328,7 @@ declare module "https" {
328
328
  * upload a file with a POST request, then write to the `ClientRequest` object.
329
329
  *
330
330
  * ```js
331
- * const https = require('https');
331
+ * import https from 'node:https';
332
332
  *
333
333
  * const options = {
334
334
  * hostname: 'encrypted.google.com',
@@ -401,9 +401,9 @@ declare module "https" {
401
401
  * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
402
402
  *
403
403
  * ```js
404
- * const tls = require('tls');
405
- * const https = require('https');
406
- * const crypto = require('crypto');
404
+ * import tls from 'node:tls';
405
+ * import https from 'node:https';
406
+ * import crypto from 'node:crypto';
407
407
  *
408
408
  * function sha256(s) {
409
409
  * return crypto.createHash('sha256').update(s).digest('base64');
@@ -511,7 +511,7 @@ declare module "https" {
511
511
  * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
512
512
  *
513
513
  * ```js
514
- * const https = require('https');
514
+ * import https from 'node:https';
515
515
  *
516
516
  * https.get('https://encrypted.google.com/', (res) => {
517
517
  * console.log('statusCode:', res.statusCode);
@@ -11,7 +11,7 @@
11
11
  * It can be accessed using:
12
12
  *
13
13
  * ```js
14
- * const inspector = require('inspector');
14
+ * import inspector from 'node:inspector';
15
15
  * ```
16
16
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/inspector.js)
17
17
  */
node v18.19/module.d.ts CHANGED
@@ -11,9 +11,9 @@ declare module "module" {
11
11
  * does not add or remove exported names from the `ES Modules`.
12
12
  *
13
13
  * ```js
14
- * const fs = require('fs');
15
- * const assert = require('assert');
16
- * const { syncBuiltinESMExports } = require('module');
14
+ * import fs from 'node:fs';
15
+ * import assert from 'node:assert';
16
+ * import { syncBuiltinESMExports } from 'node:module';
17
17
  *
18
18
  * fs.readFile = newAPI;
19
19
  *
node v18.19/net.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * It can be accessed using:
9
9
  *
10
10
  * ```js
11
- * const net = require('net');
11
+ * import net from 'node:net';
12
12
  * ```
13
13
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/net.js)
14
14
  */
@@ -757,7 +757,7 @@ declare module "net" {
757
757
  * on port 8124:
758
758
  *
759
759
  * ```js
760
- * const net = require('net');
760
+ * import net from 'node:net';
761
761
  * const server = net.createServer((c) => {
762
762
  * // 'connection' listener.
763
763
  * console.log('client connected');
node v18.19/os.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * properties. It can be accessed using:
4
4
  *
5
5
  * ```js
6
- * const os = require('os');
6
+ * import os from 'node:os';
7
7
  * ```
8
8
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/os.js)
9
9
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "18.19.51",
3
+ "version": "18.19.53",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -217,6 +217,6 @@
217
217
  "dependencies": {
218
218
  "undici-types": "~5.26.4"
219
219
  },
220
- "typesPublisherContentHash": "3f2c9f0fc2f4642d5fa85bb2709a86e174b8b756a1a4d37778ae338ad1cd7dbd",
220
+ "typesPublisherContentHash": "41ccfad405961eeef1c4165ac01bdba89d0475d6fea7f5e076f48beb5c684d84",
221
221
  "typeScriptVersion": "4.8"
222
222
  }
node v18.19/path.d.ts CHANGED
@@ -11,7 +11,7 @@ declare module "path/win32" {
11
11
  * It can be accessed using:
12
12
  *
13
13
  * ```js
14
- * const path = require('path');
14
+ * import path from 'node:path';
15
15
  * ```
16
16
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/path.js)
17
17
  */
@@ -9,7 +9,7 @@
9
9
  * * [User Timing](https://www.w3.org/TR/user-timing/)
10
10
  *
11
11
  * ```js
12
- * const { PerformanceObserver, performance } = require('perf_hooks');
12
+ * import { PerformanceObserver, performance } from 'node:perf_hooks';
13
13
  *
14
14
  * const obs = new PerformanceObserver((items) => {
15
15
  * console.log(items.getEntries()[0].duration);
@@ -317,10 +317,10 @@ declare module "perf_hooks" {
317
317
  * with respect to `performanceEntry.startTime`.
318
318
  *
319
319
  * ```js
320
- * const {
320
+ * import {
321
321
  * performance,
322
322
  * PerformanceObserver
323
- * } = require('perf_hooks');
323
+ * } from 'node:perf_hooks';
324
324
  *
325
325
  * const obs = new PerformanceObserver((perfObserverList, observer) => {
326
326
  * console.log(perfObserverList.getEntries());
@@ -358,10 +358,10 @@ declare module "perf_hooks" {
358
358
  * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
359
359
  *
360
360
  * ```js
361
- * const {
361
+ * import {
362
362
  * performance,
363
363
  * PerformanceObserver
364
- * } = require('perf_hooks');
364
+ * } from 'node:perf_hooks';
365
365
  *
366
366
  * const obs = new PerformanceObserver((perfObserverList, observer) => {
367
367
  * console.log(perfObserverList.getEntriesByName('meow'));
@@ -407,10 +407,10 @@ declare module "perf_hooks" {
407
407
  * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`.
408
408
  *
409
409
  * ```js
410
- * const {
410
+ * import {
411
411
  * performance,
412
412
  * PerformanceObserver
413
- * } = require('perf_hooks');
413
+ * } from 'node:perf_hooks';
414
414
  *
415
415
  * const obs = new PerformanceObserver((perfObserverList, observer) => {
416
416
  * console.log(perfObserverList.getEntriesByType('mark'));
@@ -455,10 +455,10 @@ declare module "perf_hooks" {
455
455
  * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`:
456
456
  *
457
457
  * ```js
458
- * const {
458
+ * import {
459
459
  * performance,
460
460
  * PerformanceObserver
461
- * } = require('perf_hooks');
461
+ * } from 'node:perf_hooks';
462
462
  *
463
463
  * const obs = new PerformanceObserver((list, observer) => {
464
464
  * // Called once asynchronously. `list` contains three items.
@@ -695,7 +695,7 @@ declare module "perf_hooks" {
695
695
  * detect.
696
696
  *
697
697
  * ```js
698
- * const { monitorEventLoopDelay } = require('perf_hooks');
698
+ * import { monitorEventLoopDelay } from 'node:perf_hooks';
699
699
  * const h = monitorEventLoopDelay({ resolution: 20 });
700
700
  * h.enable();
701
701
  * // Do something.
@@ -737,7 +737,7 @@ declare module "perf_hooks" {
737
737
  import { performance as _performance } from "perf_hooks";
738
738
  global {
739
739
  /**
740
- * `performance` is a global reference for `require('perf_hooks').performance`
740
+ * `performance` is a global reference for `import { performance } from 'node:perf_hooks'`
741
741
  * https://nodejs.org/api/globals.html#performance
742
742
  * @since v16.0.0
743
743
  */
@@ -8,7 +8,7 @@
8
8
  * can be accessed using:
9
9
  *
10
10
  * ```js
11
- * const punycode = require('punycode');
11
+ * import punycode from 'node:punycode';
12
12
  * ```
13
13
  *
14
14
  * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is
@@ -3,7 +3,7 @@
3
3
  * query strings. It can be accessed using:
4
4
  *
5
5
  * ```js
6
- * const querystring = require('querystring');
6
+ * import querystring from 'node:querystring';
7
7
  * ```
8
8
  *
9
9
  * `querystring` is more performant than `URLSearchParams` but is not a
@@ -85,7 +85,7 @@ declare module "readline/promises" {
85
85
  * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
86
86
  *
87
87
  * ```js
88
- * const readlinePromises = require('node:readline/promises');
88
+ * import readlinePromises from 'node:readline/promises';
89
89
  * const rl = readlinePromises.createInterface({
90
90
  * input: process.stdin,
91
91
  * output: process.stdout
@@ -183,7 +183,7 @@ declare module "readline" {
183
183
  * an `AbortController` it will reject with an `AbortError`.
184
184
  *
185
185
  * ```js
186
- * const util = require('util');
186
+ * import util from 'node:util';
187
187
  * const question = util.promisify(rl.question).bind(rl);
188
188
  *
189
189
  * async function questionExample() {
@@ -359,7 +359,7 @@ declare module "readline" {
359
359
  * The `readline.createInterface()` method creates a new `readline.Interface`instance.
360
360
  *
361
361
  * ```js
362
- * const readline = require('readline');
362
+ * import readline from 'node:readline';
363
363
  * const rl = readline.createInterface({
364
364
  * input: process.stdin,
365
365
  * output: process.stdout
@@ -421,7 +421,7 @@ declare module "readline" {
421
421
  * implement a small command-line interface:
422
422
  *
423
423
  * ```js
424
- * const readline = require('readline');
424
+ * import readline from 'node:readline';
425
425
  * const rl = readline.createInterface({
426
426
  * input: process.stdin,
427
427
  * output: process.stdout,
@@ -453,8 +453,8 @@ declare module "readline" {
453
453
  * well as a `for await...of` loop:
454
454
  *
455
455
  * ```js
456
- * const fs = require('fs');
457
- * const readline = require('readline');
456
+ * import fs from 'node:fs';
457
+ * import readline from 'node:readline';
458
458
  *
459
459
  * async function processLineByLine() {
460
460
  * const fileStream = fs.createReadStream('input.txt');
@@ -478,8 +478,8 @@ declare module "readline" {
478
478
  * Alternatively, one could use the `'line'` event:
479
479
  *
480
480
  * ```js
481
- * const fs = require('fs');
482
- * const readline = require('readline');
481
+ * import fs from 'node:fs';
482
+ * import readline from 'node:readline';
483
483
  *
484
484
  * const rl = readline.createInterface({
485
485
  * input: fs.createReadStream('sample.txt'),
@@ -494,9 +494,9 @@ declare module "readline" {
494
494
  * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
495
495
  *
496
496
  * ```js
497
- * const { once } = require('events');
498
- * const { createReadStream } = require('fs');
499
- * const { createInterface } = require('readline');
497
+ * import { once } from 'node:events';
498
+ * import { createReadStream } from 'node:fs';
499
+ * import { createInterface } from 'node:readline';
500
500
  *
501
501
  * (async function processLineByLine() {
502
502
  * try {
@@ -559,7 +559,7 @@ declare module "readline" {
559
559
  * implement a small command-line interface:
560
560
  *
561
561
  * ```js
562
- * const readline = require('readline');
562
+ * import readline from 'node:readline';
563
563
  * const rl = readline.createInterface({
564
564
  * input: process.stdin,
565
565
  * output: process.stdout,
@@ -591,8 +591,8 @@ declare module "readline" {
591
591
  * well as a `for await...of` loop:
592
592
  *
593
593
  * ```js
594
- * const fs = require('fs');
595
- * const readline = require('readline');
594
+ * import fs from 'node:fs';
595
+ * import readline from 'node:readline';
596
596
  *
597
597
  * async function processLineByLine() {
598
598
  * const fileStream = fs.createReadStream('input.txt');
@@ -616,8 +616,8 @@ declare module "readline" {
616
616
  * Alternatively, one could use the `'line'` event:
617
617
  *
618
618
  * ```js
619
- * const fs = require('fs');
620
- * const readline = require('readline');
619
+ * import fs from 'node:fs';
620
+ * import readline from 'node:readline';
621
621
  *
622
622
  * const rl = readline.createInterface({
623
623
  * input: fs.createReadStream('sample.txt'),
@@ -632,9 +632,9 @@ declare module "readline" {
632
632
  * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
633
633
  *
634
634
  * ```js
635
- * const { once } = require('events');
636
- * const { createReadStream } = require('fs');
637
- * const { createInterface } = require('readline');
635
+ * import { once } from 'node:events';
636
+ * import { createReadStream } from 'node:fs';
637
+ * import { createInterface } from 'node:readline';
638
638
  *
639
639
  * (async function processLineByLine() {
640
640
  * try {
node v18.19/repl.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * It can be accessed using:
5
5
  *
6
6
  * ```js
7
- * const repl = require('repl');
7
+ * import repl from 'node:repl';
8
8
  * ```
9
9
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/repl.js)
10
10
  */
@@ -130,7 +130,7 @@ declare module "repl" {
130
130
  * or directly using the JavaScript `new` keyword.
131
131
  *
132
132
  * ```js
133
- * const repl = require('repl');
133
+ * import repl from 'node:repl';
134
134
  *
135
135
  * const options = { useColors: true };
136
136
  *
@@ -257,7 +257,7 @@ declare module "repl" {
257
257
  * The following example shows two new commands added to the REPL instance:
258
258
  *
259
259
  * ```js
260
- * const repl = require('repl');
260
+ * import repl from 'node:repl';
261
261
  *
262
262
  * const replServer = repl.start({ prompt: '> ' });
263
263
  * replServer.defineCommand('sayhello', {
@@ -407,7 +407,7 @@ declare module "repl" {
407
407
  * If `options` is a string, then it specifies the input prompt:
408
408
  *
409
409
  * ```js
410
- * const repl = require('repl');
410
+ * import repl from 'node:repl';
411
411
  *
412
412
  * // a Unix style prompt
413
413
  * repl.start('$ ');