@types/node 15.6.2 → 15.12.2

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/fs.d.ts CHANGED
@@ -276,9 +276,7 @@ declare module 'fs' {
276
276
  /**
277
277
  * Asynchronous rename(2) - Change the name or location of a file or directory.
278
278
  * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
279
- * URL support is _experimental_.
280
279
  * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
281
- * URL support is _experimental_.
282
280
  */
283
281
  export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
284
282
 
@@ -297,9 +295,7 @@ declare module 'fs' {
297
295
  /**
298
296
  * Synchronous rename(2) - Change the name or location of a file or directory.
299
297
  * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
300
- * URL support is _experimental_.
301
298
  * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
302
- * URL support is _experimental_.
303
299
  */
304
300
  export function renameSync(oldPath: PathLike, newPath: PathLike): void;
305
301
 
@@ -313,7 +309,6 @@ declare module 'fs' {
313
309
  /**
314
310
  * Asynchronous truncate(2) - Truncate a file to a specified length.
315
311
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
316
- * URL support is _experimental_.
317
312
  */
318
313
  export function truncate(path: PathLike, callback: NoParamCallback): void;
319
314
 
@@ -1242,7 +1237,7 @@ declare module 'fs' {
1242
1237
  * Asynchronous close(2) - close a file descriptor.
1243
1238
  * @param fd A file descriptor.
1244
1239
  */
1245
- export function close(fd: number, callback: NoParamCallback): void;
1240
+ export function close(fd: number, callback?: NoParamCallback): void;
1246
1241
 
1247
1242
  // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1248
1243
  export namespace close {
@@ -1487,6 +1482,8 @@ declare module 'fs' {
1487
1482
  */
1488
1483
  export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number;
1489
1484
 
1485
+ export type ReadPosition = number | bigint;
1486
+
1490
1487
  /**
1491
1488
  * Asynchronously reads data from the file referenced by the supplied file descriptor.
1492
1489
  * @param fd A file descriptor.
@@ -1500,7 +1497,7 @@ declare module 'fs' {
1500
1497
  buffer: TBuffer,
1501
1498
  offset: number,
1502
1499
  length: number,
1503
- position: number | null,
1500
+ position: ReadPosition | null,
1504
1501
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
1505
1502
  ): void;
1506
1503
 
@@ -1534,7 +1531,7 @@ declare module 'fs' {
1534
1531
  /**
1535
1532
  * @default null
1536
1533
  */
1537
- position?: number | null;
1534
+ position?: ReadPosition | null;
1538
1535
  }
1539
1536
 
1540
1537
  /**
@@ -1545,7 +1542,7 @@ declare module 'fs' {
1545
1542
  * @param length The number of bytes to read.
1546
1543
  * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
1547
1544
  */
1548
- export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
1545
+ export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: ReadPosition | null): number;
1549
1546
 
1550
1547
  /**
1551
1548
  * Similar to the above `fs.readSync` function, this version takes an optional `options` object.
@@ -1569,7 +1566,6 @@ declare module 'fs' {
1569
1566
  /**
1570
1567
  * Asynchronously reads the entire contents of a file.
1571
1568
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1572
- * URL support is _experimental_.
1573
1569
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1574
1570
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1575
1571
  * If a flag is not provided, it defaults to `'r'`.
@@ -1583,7 +1579,6 @@ declare module 'fs' {
1583
1579
  /**
1584
1580
  * Asynchronously reads the entire contents of a file.
1585
1581
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1586
- * URL support is _experimental_.
1587
1582
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1588
1583
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1589
1584
  * If a flag is not provided, it defaults to `'r'`.
@@ -1637,7 +1632,6 @@ declare module 'fs' {
1637
1632
  /**
1638
1633
  * Synchronously reads the entire contents of a file.
1639
1634
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1640
- * URL support is _experimental_.
1641
1635
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1642
1636
  * @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
1643
1637
  */
@@ -1646,7 +1640,6 @@ declare module 'fs' {
1646
1640
  /**
1647
1641
  * Synchronously reads the entire contents of a file.
1648
1642
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1649
- * URL support is _experimental_.
1650
1643
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1651
1644
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1652
1645
  * If a flag is not provided, it defaults to `'r'`.
@@ -1656,7 +1649,6 @@ declare module 'fs' {
1656
1649
  /**
1657
1650
  * Synchronously reads the entire contents of a file.
1658
1651
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1659
- * URL support is _experimental_.
1660
1652
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1661
1653
  * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
1662
1654
  * If a flag is not provided, it defaults to `'r'`.
@@ -1668,7 +1660,6 @@ declare module 'fs' {
1668
1660
  /**
1669
1661
  * Asynchronously writes data to a file, replacing the file if it already exists.
1670
1662
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1671
- * URL support is _experimental_.
1672
1663
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1673
1664
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1674
1665
  * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
@@ -1682,7 +1673,6 @@ declare module 'fs' {
1682
1673
  /**
1683
1674
  * Asynchronously writes data to a file, replacing the file if it already exists.
1684
1675
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1685
- * URL support is _experimental_.
1686
1676
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1687
1677
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1688
1678
  */
@@ -1708,7 +1698,6 @@ declare module 'fs' {
1708
1698
  /**
1709
1699
  * Synchronously writes data to a file, replacing the file if it already exists.
1710
1700
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1711
- * URL support is _experimental_.
1712
1701
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1713
1702
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1714
1703
  * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
@@ -1722,7 +1711,6 @@ declare module 'fs' {
1722
1711
  /**
1723
1712
  * Asynchronously append data to a file, creating the file if it does not exist.
1724
1713
  * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
1725
- * URL support is _experimental_.
1726
1714
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1727
1715
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1728
1716
  * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
@@ -1736,7 +1724,6 @@ declare module 'fs' {
1736
1724
  /**
1737
1725
  * Asynchronously append data to a file, creating the file if it does not exist.
1738
1726
  * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
1739
- * URL support is _experimental_.
1740
1727
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1741
1728
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1742
1729
  */
@@ -1762,7 +1749,6 @@ declare module 'fs' {
1762
1749
  /**
1763
1750
  * Synchronously append data to a file, creating the file if it does not exist.
1764
1751
  * @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
1765
- * URL support is _experimental_.
1766
1752
  * If a file descriptor is provided, the underlying file will _not_ be closed automatically.
1767
1753
  * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
1768
1754
  * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
@@ -1781,36 +1767,36 @@ declare module 'fs' {
1781
1767
  /**
1782
1768
  * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
1783
1769
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1784
- * URL support is _experimental_.
1785
1770
  */
1786
1771
  export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
1787
1772
 
1788
1773
  /**
1789
1774
  * Stop watching for changes on `filename`.
1790
1775
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1791
- * URL support is _experimental_.
1792
1776
  */
1793
1777
  export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
1794
1778
 
1779
+ export interface WatchOptions extends Abortable {
1780
+ encoding?: BufferEncoding | "buffer";
1781
+ persistent?: boolean;
1782
+ recursive?: boolean;
1783
+ }
1784
+
1785
+ export type WatchListener<T> = (event: "rename" | "change", filename: T) => void;
1786
+
1795
1787
  /**
1796
1788
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1797
1789
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1798
- * URL support is _experimental_.
1799
1790
  * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1800
1791
  * If `encoding` is not supplied, the default of `'utf8'` is used.
1801
1792
  * If `persistent` is not supplied, the default of `true` is used.
1802
1793
  * If `recursive` is not supplied, the default of `false` is used.
1803
1794
  */
1804
- export function watch(
1805
- filename: PathLike,
1806
- options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null,
1807
- listener?: (event: "rename" | "change", filename: string) => void,
1808
- ): FSWatcher;
1795
+ export function watch(filename: PathLike, options: WatchOptions & { encoding: "buffer" } | "buffer", listener?: WatchListener<Buffer>): FSWatcher;
1809
1796
 
1810
1797
  /**
1811
1798
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1812
1799
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1813
- * URL support is _experimental_.
1814
1800
  * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1815
1801
  * If `encoding` is not supplied, the default of `'utf8'` is used.
1816
1802
  * If `persistent` is not supplied, the default of `true` is used.
@@ -1818,37 +1804,30 @@ declare module 'fs' {
1818
1804
  */
1819
1805
  export function watch(
1820
1806
  filename: PathLike,
1821
- options: { encoding: "buffer", persistent?: boolean, recursive?: boolean; } | "buffer",
1822
- listener?: (event: "rename" | "change", filename: Buffer) => void
1807
+ options?: WatchOptions | BufferEncoding | null,
1808
+ listener?: WatchListener<string>,
1823
1809
  ): FSWatcher;
1824
1810
 
1825
1811
  /**
1826
1812
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1827
1813
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1828
- * URL support is _experimental_.
1829
1814
  * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
1830
1815
  * If `encoding` is not supplied, the default of `'utf8'` is used.
1831
1816
  * If `persistent` is not supplied, the default of `true` is used.
1832
1817
  * If `recursive` is not supplied, the default of `false` is used.
1833
1818
  */
1834
- export function watch(
1835
- filename: PathLike,
1836
- options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | string | null,
1837
- listener?: (event: "rename" | "change", filename: string | Buffer) => void,
1838
- ): FSWatcher;
1819
+ export function watch(filename: PathLike, options: WatchOptions | string, listener?: WatchListener<string | Buffer>): FSWatcher;
1839
1820
 
1840
1821
  /**
1841
1822
  * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
1842
1823
  * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1843
- * URL support is _experimental_.
1844
1824
  */
1845
- export function watch(filename: PathLike, listener?: (event: "rename" | "change", filename: string) => any): FSWatcher;
1825
+ export function watch(filename: PathLike, listener?: WatchListener<string>): FSWatcher;
1846
1826
 
1847
1827
  /**
1848
1828
  * Asynchronously tests whether or not the given path exists by checking with the file system.
1849
1829
  * @deprecated since v1.0.0 Use `fs.stat()` or `fs.access()` instead
1850
1830
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1851
- * URL support is _experimental_.
1852
1831
  */
1853
1832
  export function exists(path: PathLike, callback: (exists: boolean) => void): void;
1854
1833
 
@@ -1864,7 +1843,6 @@ declare module 'fs' {
1864
1843
  /**
1865
1844
  * Synchronously tests whether or not the given path exists by checking with the file system.
1866
1845
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
1867
- * URL support is _experimental_.
1868
1846
  */
1869
1847
  export function existsSync(path: PathLike): boolean;
1870
1848
 
@@ -2034,14 +2012,12 @@ declare module 'fs' {
2034
2012
  /**
2035
2013
  * Asynchronously tests a user's permissions for the file specified by path.
2036
2014
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2037
- * URL support is _experimental_.
2038
2015
  */
2039
2016
  export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
2040
2017
 
2041
2018
  /**
2042
2019
  * Asynchronously tests a user's permissions for the file specified by path.
2043
2020
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2044
- * URL support is _experimental_.
2045
2021
  */
2046
2022
  export function access(path: PathLike, callback: NoParamCallback): void;
2047
2023
 
@@ -2058,7 +2034,6 @@ declare module 'fs' {
2058
2034
  /**
2059
2035
  * Synchronously tests a user's permissions for the file specified by path.
2060
2036
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
2061
- * URL support is _experimental_.
2062
2037
  */
2063
2038
  export function accessSync(path: PathLike, mode?: number): void;
2064
2039
 
@@ -2083,14 +2058,12 @@ declare module 'fs' {
2083
2058
  /**
2084
2059
  * Returns a new `ReadStream` object.
2085
2060
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2086
- * URL support is _experimental_.
2087
2061
  */
2088
2062
  export function createReadStream(path: PathLike, options?: string | ReadStreamOptions): ReadStream;
2089
2063
 
2090
2064
  /**
2091
2065
  * Returns a new `WriteStream` object.
2092
2066
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2093
- * URL support is _experimental_.
2094
2067
  */
2095
2068
  export function createWriteStream(path: PathLike, options?: string | StreamOptions): WriteStream;
2096
2069
 
node/globals.d.ts CHANGED
@@ -37,9 +37,9 @@ interface ImportMeta {
37
37
  ------------------------------------------------*/
38
38
 
39
39
  // For backwards compability
40
- interface NodeRequire extends NodeJS.Require {}
41
- interface RequireResolve extends NodeJS.RequireResolve {}
42
- interface NodeModule extends NodeJS.Module {}
40
+ interface NodeRequire extends NodeJS.Require { }
41
+ interface RequireResolve extends NodeJS.RequireResolve { }
42
+ interface NodeModule extends NodeJS.Module { }
43
43
 
44
44
  declare var process: NodeJS.Process;
45
45
  declare var console: Console;
@@ -318,6 +318,7 @@ interface AbortController {
318
318
  /**
319
319
  * Returns the AbortSignal object associated with this object.
320
320
  */
321
+
321
322
  readonly signal: AbortSignal;
322
323
  /**
323
324
  * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
@@ -341,6 +342,7 @@ declare var AbortController: {
341
342
  declare var AbortSignal: {
342
343
  prototype: AbortSignal;
343
344
  new(): AbortSignal;
345
+ // TODO: Add abort() static
344
346
  };
345
347
  //#endregion borrowed
346
348
 
node/http.d.ts CHANGED
@@ -107,7 +107,7 @@ declare module 'http' {
107
107
  ServerResponse?: typeof ServerResponse;
108
108
  /**
109
109
  * Optionally overrides the value of
110
- * [`--max-http-header-size`][] for requests received by this server, i.e.
110
+ * `--max-http-header-size` for requests received by this server, i.e.
111
111
  * the maximum length of request headers in bytes.
112
112
  * @default 8192
113
113
  */
@@ -156,7 +156,8 @@ declare module 'http' {
156
156
 
157
157
  // https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
158
158
  class OutgoingMessage extends stream.Writable {
159
- upgrading: boolean;
159
+ readonly req: IncomingMessage;
160
+
160
161
  chunkedEncoding: boolean;
161
162
  shouldKeepAlive: boolean;
162
163
  useChunkedEncodingByDefault: boolean;
@@ -165,12 +166,12 @@ declare module 'http' {
165
166
  * @deprecated Use `writableEnded` instead.
166
167
  */
167
168
  finished: boolean;
168
- headersSent: boolean;
169
+ readonly headersSent: boolean;
169
170
  /**
170
171
  * @deprecated Use `socket` instead.
171
172
  */
172
- connection: Socket | null;
173
- socket: Socket | null;
173
+ readonly connection: Socket | null;
174
+ readonly socket: Socket | null;
174
175
 
175
176
  constructor();
176
177
 
@@ -420,7 +421,14 @@ declare module 'http' {
420
421
 
421
422
  /**
422
423
  * Read-only property specifying the maximum allowed size of HTTP headers in bytes.
423
- * Defaults to 16KB. Configurable using the [`--max-http-header-size`][] CLI option.
424
+ * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
424
425
  */
425
426
  const maxHeaderSize: number;
427
+
428
+ /**
429
+ *
430
+ * This utility function converts a URL object into an ordinary options object as
431
+ * expected by the `http.request()` and `https.request()` APIs.
432
+ */
433
+ function urlToHttpOptions(url: URL): ClientRequestArgs;
426
434
  }
node/http2.d.ts CHANGED
@@ -438,6 +438,13 @@ declare module 'http2' {
438
438
  paddingStrategy?: number;
439
439
  peerMaxConcurrentStreams?: number;
440
440
  settings?: Settings;
441
+ /**
442
+ * Specifies a timeout in milliseconds that
443
+ * a server should wait when an [`'unknownProtocol'`][] is emitted. If the
444
+ * socket has not been destroyed by that time the server will destroy it.
445
+ * @default 100000
446
+ */
447
+ unknownProtocolTimeout?: number;
441
448
 
442
449
  selectPadding?(frameLen: number, maxFrameLen: number): number;
443
450
  createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex;
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 15.6
1
+ // Type definitions for non-npm package Node.js 15.12
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
@@ -50,9 +50,9 @@
50
50
 
51
51
  // NOTE: TypeScript version-specific augmentations can be found in the following paths:
52
52
  // - ~/base.d.ts - Shared definitions common to all TypeScript versions
53
- // - ~/index.d.ts - Definitions specific to TypeScript 2.8
54
- // - ~/ts3.5/index.d.ts - Definitions specific to TypeScript 3.5
53
+ // - ~/index.d.ts - Definitions specific to TypeScript 3.7
54
+ // - ~/ts3.6/index.d.ts - Definitions specific to TypeScript 3.6
55
55
 
56
- // NOTE: Augmentations for TypeScript 3.5 and later should use individual files for overrides
57
- // within the respective ~/ts3.5 (or later) folder. However, this is disallowed for versions
58
- // prior to TypeScript 3.5, so the older definitions will be found here.
56
+ // NOTE: Augmentations for TypeScript 3.6 and later should use individual files for overrides
57
+ // within the respective ~/ts3.6 (or later) folder. However, this is disallowed for versions
58
+ // prior to TypeScript 3.6, so the older definitions will be found here.
node/os.d.ts CHANGED
@@ -212,7 +212,7 @@ declare module 'os' {
212
212
  /**
213
213
  * Returns a string identifying the kernel version.
214
214
  * On POSIX systems, the operating system release is determined by calling
215
- * [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available,
215
+ * uname(3). On Windows, `pRtlGetVersion` is used, and if it is not available,
216
216
  * `GetVersionExW()` will be used. See
217
217
  * https://en.wikipedia.org/wiki/Uname#Examples for more information.
218
218
  */
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "15.6.2",
3
+ "version": "15.12.2",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "f62422deccbd466260cb63740d207022259eb7fc7b6e7c406be463b9d1b0cd19",
230
+ "typesPublisherContentHash": "9713490f7bb15f02ab4ef68c39e2ec33cdecadbc39062c33ca86f9e4d8018d9b",
231
231
  "typeScriptVersion": "3.6"
232
232
  }
node/perf_hooks.d.ts CHANGED
@@ -3,7 +3,8 @@ declare module 'perf_hooks' {
3
3
 
4
4
  type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
5
5
 
6
- interface PerformanceEntry {
6
+ class PerformanceEntry {
7
+ protected constructor();
7
8
  /**
8
9
  * The total number of milliseconds elapsed for this entry.
9
10
  * This value will not be meaningful for all Performance Entry types.
@@ -41,7 +42,7 @@ declare module 'perf_hooks' {
41
42
  readonly flags?: number;
42
43
  }
43
44
 
44
- interface PerformanceNodeTiming extends PerformanceEntry {
45
+ class PerformanceNodeTiming extends PerformanceEntry {
45
46
  /**
46
47
  * The high resolution millisecond timestamp at which the Node.js process completed bootstrap.
47
48
  */
@@ -221,15 +222,36 @@ declare module 'perf_hooks' {
221
222
  resolution?: number;
222
223
  }
223
224
 
224
- interface EventLoopDelayMonitor {
225
+ interface Histogram {
225
226
  /**
226
- * Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started.
227
+ * A `Map` object detailing the accumulated percentile distribution.
227
228
  */
228
- enable(): boolean;
229
+ readonly percentiles: Map<number, number>;
230
+
229
231
  /**
230
- * Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped.
232
+ * The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold.
231
233
  */
232
- disable(): boolean;
234
+ readonly exceeds: number;
235
+
236
+ /**
237
+ * The minimum recorded event loop delay.
238
+ */
239
+ readonly min: number;
240
+
241
+ /**
242
+ * The maximum recorded event loop delay.
243
+ */
244
+ readonly max: number;
245
+
246
+ /**
247
+ * The mean of the recorded event loop delays.
248
+ */
249
+ readonly mean: number;
250
+
251
+ /**
252
+ * The standard deviation of the recorded event loop delays.
253
+ */
254
+ readonly stddev: number;
233
255
 
234
256
  /**
235
257
  * Resets the collected histogram data.
@@ -241,37 +263,48 @@ declare module 'perf_hooks' {
241
263
  * @param percentile A percentile value between 1 and 100.
242
264
  */
243
265
  percentile(percentile: number): number;
266
+ }
244
267
 
268
+ interface IntervalHistogram extends Histogram {
245
269
  /**
246
- * A `Map` object detailing the accumulated percentile distribution.
270
+ * Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started.
247
271
  */
248
- readonly percentiles: Map<number, number>;
249
-
272
+ enable(): boolean;
250
273
  /**
251
- * The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold.
274
+ * Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped.
252
275
  */
253
- readonly exceeds: number;
276
+ disable(): boolean;
277
+ }
278
+
279
+ interface RecordableHistogram extends Histogram {
280
+ record(val: number | bigint): void;
254
281
 
255
282
  /**
256
- * The minimum recorded event loop delay.
283
+ * Calculates the amount of time (in nanoseconds) that has passed since the previous call to recordDelta() and records that amount in the histogram.
257
284
  */
258
- readonly min: number;
285
+ recordDelta(): void;
286
+ }
287
+
288
+ function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
259
289
 
290
+ interface CreateHistogramOptions {
260
291
  /**
261
- * The maximum recorded event loop delay.
292
+ * The minimum recordable value. Must be an integer value greater than 0.
293
+ * @default 1
262
294
  */
263
- readonly max: number;
295
+ min?: number | bigint;
264
296
 
265
297
  /**
266
- * The mean of the recorded event loop delays.
298
+ * The maximum recordable value. Must be an integer value greater than min.
299
+ * @default Number.MAX_SAFE_INTEGER
267
300
  */
268
- readonly mean: number;
269
-
301
+ max?: number | bigint;
270
302
  /**
271
- * The standard deviation of the recorded event loop delays.
303
+ * The number of accuracy digits. Must be a number between 1 and 5.
304
+ * @default 3
272
305
  */
273
- readonly stddev: number;
306
+ figures?: number;
274
307
  }
275
308
 
276
- function monitorEventLoopDelay(options?: EventLoopMonitorOptions): EventLoopDelayMonitor;
309
+ function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
277
310
  }
node/process.d.ts CHANGED
@@ -336,7 +336,7 @@ declare module 'process' {
336
336
 
337
337
  /**
338
338
  * The `process.allowedNodeEnvironmentFlags` property is a special,
339
- * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][]
339
+ * read-only `Set` of flags allowable within the `NODE_OPTIONS`
340
340
  * environment variable.
341
341
  */
342
342
  allowedNodeEnvironmentFlags: ReadonlySet<string>;
node/readline.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module 'readline' {
2
- import EventEmitter = require('events');
2
+ import { Abortable, EventEmitter } from 'events';
3
3
 
4
4
  interface Key {
5
5
  sequence?: string;
@@ -42,6 +42,7 @@ declare module 'readline' {
42
42
  setPrompt(prompt: string): void;
43
43
  prompt(preserveCursor?: boolean): void;
44
44
  question(query: string, callback: (answer: string) => void): void;
45
+ question(query: string, options: Abortable, callback: (answer: string) => void): void;
45
46
  pause(): this;
46
47
  resume(): this;
47
48
  close(): void;
@@ -63,8 +64,8 @@ declare module 'readline' {
63
64
  * 5. SIGCONT
64
65
  * 6. SIGINT
65
66
  * 7. SIGTSTP
67
+ * 8. history
66
68
  */
67
-
68
69
  addListener(event: string, listener: (...args: any[]) => void): this;
69
70
  addListener(event: "close", listener: () => void): this;
70
71
  addListener(event: "line", listener: (input: string) => void): this;
@@ -73,6 +74,7 @@ declare module 'readline' {
73
74
  addListener(event: "SIGCONT", listener: () => void): this;
74
75
  addListener(event: "SIGINT", listener: () => void): this;
75
76
  addListener(event: "SIGTSTP", listener: () => void): this;
77
+ addListener(event: "history", listener: (history: string[]) => void): this;
76
78
 
77
79
  emit(event: string | symbol, ...args: any[]): boolean;
78
80
  emit(event: "close"): boolean;
@@ -82,6 +84,7 @@ declare module 'readline' {
82
84
  emit(event: "SIGCONT"): boolean;
83
85
  emit(event: "SIGINT"): boolean;
84
86
  emit(event: "SIGTSTP"): boolean;
87
+ emit(event: "history", history: string[]): boolean;
85
88
 
86
89
  on(event: string, listener: (...args: any[]) => void): this;
87
90
  on(event: "close", listener: () => void): this;
@@ -91,6 +94,7 @@ declare module 'readline' {
91
94
  on(event: "SIGCONT", listener: () => void): this;
92
95
  on(event: "SIGINT", listener: () => void): this;
93
96
  on(event: "SIGTSTP", listener: () => void): this;
97
+ on(event: "history", listener: (history: string[]) => void): this;
94
98
 
95
99
  once(event: string, listener: (...args: any[]) => void): this;
96
100
  once(event: "close", listener: () => void): this;
@@ -100,6 +104,7 @@ declare module 'readline' {
100
104
  once(event: "SIGCONT", listener: () => void): this;
101
105
  once(event: "SIGINT", listener: () => void): this;
102
106
  once(event: "SIGTSTP", listener: () => void): this;
107
+ once(event: "history", listener: (history: string[]) => void): this;
103
108
 
104
109
  prependListener(event: string, listener: (...args: any[]) => void): this;
105
110
  prependListener(event: "close", listener: () => void): this;
@@ -109,6 +114,7 @@ declare module 'readline' {
109
114
  prependListener(event: "SIGCONT", listener: () => void): this;
110
115
  prependListener(event: "SIGINT", listener: () => void): this;
111
116
  prependListener(event: "SIGTSTP", listener: () => void): this;
117
+ prependListener(event: "history", listener: (history: string[]) => void): this;
112
118
 
113
119
  prependOnceListener(event: string, listener: (...args: any[]) => void): this;
114
120
  prependOnceListener(event: "close", listener: () => void): this;
@@ -118,6 +124,8 @@ declare module 'readline' {
118
124
  prependOnceListener(event: "SIGCONT", listener: () => void): this;
119
125
  prependOnceListener(event: "SIGINT", listener: () => void): this;
120
126
  prependOnceListener(event: "SIGTSTP", listener: () => void): this;
127
+ prependOnceListener(event: "history", listener: (history: string[]) => void): this;
128
+
121
129
  [Symbol.asyncIterator](): AsyncIterableIterator<string>;
122
130
  }
123
131
 
@@ -133,9 +141,22 @@ declare module 'readline' {
133
141
  output?: NodeJS.WritableStream;
134
142
  completer?: Completer | AsyncCompleter;
135
143
  terminal?: boolean;
144
+ /**
145
+ * Initial list of history lines. This option makes sense
146
+ * only if `terminal` is set to `true` by the user or by an internal `output`
147
+ * check, otherwise the history caching mechanism is not initialized at all.
148
+ * @default []
149
+ */
150
+ history?: string[];
136
151
  historySize?: number;
137
152
  prompt?: string;
138
153
  crlfDelay?: number;
154
+ /**
155
+ * If `true`, when a new input line added
156
+ * to the history list duplicates an older one, this removes the older line
157
+ * from the list.
158
+ * @default false
159
+ */
139
160
  removeHistoryDuplicates?: boolean;
140
161
  escapeCodeTimeout?: number;
141
162
  tabSize?: number;