@types/node 18.19.70 → 18.19.72
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/README.md +1 -1
- node v18.19/package.json +2 -2
- node v18.19/perf_hooks.d.ts +149 -42
- node v18.19/process.d.ts +52 -0
node v18.19/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v18.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Wed, 22 Jan 2025 23:32:17 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
node v18.19/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.19.
|
|
3
|
+
"version": "18.19.72",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -220,6 +220,6 @@
|
|
|
220
220
|
"undici-types": "~5.26.4"
|
|
221
221
|
},
|
|
222
222
|
"peerDependencies": {},
|
|
223
|
-
"typesPublisherContentHash": "
|
|
223
|
+
"typesPublisherContentHash": "4ace8ddb500f644dc7ea0d53a0f5140b9389270a2c1d535b385302c502ba3038",
|
|
224
224
|
"typeScriptVersion": "5.0"
|
|
225
225
|
}
|
node v18.19/perf_hooks.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* performance.measure('A to B', 'A', 'B');
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
29
|
-
* @see [source](https://github.com/nodejs/node/blob/v18.
|
|
29
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.20.5/lib/perf_hooks.js)
|
|
30
30
|
*/
|
|
31
31
|
declare module "perf_hooks" {
|
|
32
32
|
import { AsyncResource } from "node:async_hooks";
|
|
@@ -148,6 +148,11 @@ declare module "perf_hooks" {
|
|
|
148
148
|
* @since v8.5.0
|
|
149
149
|
*/
|
|
150
150
|
readonly loopStart: number;
|
|
151
|
+
/**
|
|
152
|
+
* The high resolution millisecond timestamp at which the Node.js process was initialized.
|
|
153
|
+
* @since v8.5.0
|
|
154
|
+
*/
|
|
155
|
+
readonly nodeStart: number;
|
|
151
156
|
/**
|
|
152
157
|
* The high resolution millisecond timestamp at which the V8 platform was
|
|
153
158
|
* initialized.
|
|
@@ -161,12 +166,12 @@ declare module "perf_hooks" {
|
|
|
161
166
|
utilization: number;
|
|
162
167
|
}
|
|
163
168
|
/**
|
|
164
|
-
* @param
|
|
165
|
-
* @param
|
|
169
|
+
* @param utilization1 The result of a previous call to `eventLoopUtilization()`.
|
|
170
|
+
* @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
|
|
166
171
|
*/
|
|
167
172
|
type EventLoopUtilityFunction = (
|
|
168
|
-
|
|
169
|
-
|
|
173
|
+
utilization1?: EventLoopUtilization,
|
|
174
|
+
utilization2?: EventLoopUtilization,
|
|
170
175
|
) => EventLoopUtilization;
|
|
171
176
|
interface MarkOptions {
|
|
172
177
|
/**
|
|
@@ -175,7 +180,7 @@ declare module "perf_hooks" {
|
|
|
175
180
|
detail?: unknown | undefined;
|
|
176
181
|
/**
|
|
177
182
|
* An optional timestamp to be used as the mark time.
|
|
178
|
-
* @default `performance.now()
|
|
183
|
+
* @default `performance.now()`
|
|
179
184
|
*/
|
|
180
185
|
startTime?: number | undefined;
|
|
181
186
|
}
|
|
@@ -199,26 +204,38 @@ declare module "perf_hooks" {
|
|
|
199
204
|
}
|
|
200
205
|
interface TimerifyOptions {
|
|
201
206
|
/**
|
|
202
|
-
* A histogram object created using
|
|
203
|
-
*
|
|
204
|
-
* nanoseconds.
|
|
207
|
+
* A histogram object created using `perf_hooks.createHistogram()` that will record runtime
|
|
208
|
+
* durations in nanoseconds.
|
|
205
209
|
*/
|
|
206
210
|
histogram?: RecordableHistogram | undefined;
|
|
207
211
|
}
|
|
208
212
|
interface Performance {
|
|
209
213
|
/**
|
|
210
|
-
* If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
|
|
211
|
-
* If name is provided, removes only the named mark.
|
|
214
|
+
* If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline.
|
|
215
|
+
* If `name` is provided, removes only the named mark.
|
|
212
216
|
* @param name
|
|
217
|
+
* @since v8.5.0
|
|
213
218
|
*/
|
|
214
219
|
clearMarks(name?: string): void;
|
|
215
220
|
/**
|
|
216
|
-
* If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
|
|
217
|
-
* If name is provided, removes only the named measure.
|
|
221
|
+
* If `name` is not provided, removes all `PerformanceMeasure` objects from the Performance Timeline.
|
|
222
|
+
* If `name` is provided, removes only the named measure.
|
|
218
223
|
* @param name
|
|
219
224
|
* @since v16.7.0
|
|
220
225
|
*/
|
|
221
226
|
clearMeasures(name?: string): void;
|
|
227
|
+
/**
|
|
228
|
+
* If `name` is not provided, removes all `PerformanceResourceTiming` objects from the Resource Timeline.
|
|
229
|
+
* If `name` is provided, removes only the named resource.
|
|
230
|
+
* @since v18.2.0, v16.17.0
|
|
231
|
+
*/
|
|
232
|
+
clearResourceTimings(name?: string): void;
|
|
233
|
+
/**
|
|
234
|
+
* eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
|
|
235
|
+
* It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
|
|
236
|
+
* No other CPU idle time is taken into consideration.
|
|
237
|
+
*/
|
|
238
|
+
eventLoopUtilization: EventLoopUtilityFunction;
|
|
222
239
|
/**
|
|
223
240
|
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
|
|
224
241
|
* If you are only interested in performance entries of certain types or that have certain names, see
|
|
@@ -242,14 +259,18 @@ declare module "perf_hooks" {
|
|
|
242
259
|
*/
|
|
243
260
|
getEntriesByType(type: EntryType): PerformanceEntry[];
|
|
244
261
|
/**
|
|
245
|
-
* Creates a new PerformanceMark entry in the Performance Timeline.
|
|
246
|
-
* A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark'
|
|
247
|
-
* and whose performanceEntry.duration is always 0
|
|
262
|
+
* Creates a new `PerformanceMark` entry in the Performance Timeline.
|
|
263
|
+
* A `PerformanceMark` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'mark'`,
|
|
264
|
+
* and whose `performanceEntry.duration` is always `0`.
|
|
248
265
|
* Performance marks are used to mark specific significant moments in the Performance Timeline.
|
|
266
|
+
*
|
|
267
|
+
* The created `PerformanceMark` entry is put in the global Performance Timeline and can be queried with
|
|
268
|
+
* `performance.getEntries`, `performance.getEntriesByName`, and `performance.getEntriesByType`. When the observation is
|
|
269
|
+
* performed, the entries should be cleared from the global Performance Timeline manually with `performance.clearMarks`.
|
|
249
270
|
* @param name
|
|
250
271
|
* @return The PerformanceMark entry that was created
|
|
251
272
|
*/
|
|
252
|
-
mark(name
|
|
273
|
+
mark(name: string, options?: MarkOptions): PerformanceMark;
|
|
253
274
|
/**
|
|
254
275
|
* Creates a new `PerformanceResourceTiming` entry in the Resource Timeline.
|
|
255
276
|
* A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`.
|
|
@@ -287,31 +308,85 @@ declare module "perf_hooks" {
|
|
|
287
308
|
measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
|
|
288
309
|
measure(name: string, options: MeasureOptions): PerformanceMeasure;
|
|
289
310
|
/**
|
|
290
|
-
*
|
|
311
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
312
|
+
*
|
|
313
|
+
* An instance of the `PerformanceNodeTiming` class that provides performance metrics for specific Node.js operational milestones.
|
|
314
|
+
* @since v8.5.0
|
|
291
315
|
*/
|
|
292
316
|
readonly nodeTiming: PerformanceNodeTiming;
|
|
293
317
|
/**
|
|
294
|
-
*
|
|
318
|
+
* Returns the current high resolution millisecond timestamp, where 0 represents the start of the current `node` process.
|
|
319
|
+
* @since v8.5.0
|
|
295
320
|
*/
|
|
296
321
|
now(): number;
|
|
297
322
|
/**
|
|
298
|
-
*
|
|
323
|
+
* Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects.
|
|
324
|
+
*
|
|
325
|
+
* By default the max buffer size is set to 250.
|
|
326
|
+
* @since v18.8.0
|
|
327
|
+
*/
|
|
328
|
+
setResourceTimingBufferSize(maxSize: number): void;
|
|
329
|
+
/**
|
|
330
|
+
* The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp
|
|
331
|
+
* at which the current `node` process began, measured in Unix time.
|
|
332
|
+
* @since v8.5.0
|
|
333
|
+
* Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects.
|
|
334
|
+
*
|
|
335
|
+
* By default the max buffer size is set to 250.
|
|
336
|
+
* @since v18.8.0
|
|
337
|
+
*/
|
|
338
|
+
setResourceTimingBufferSize(maxSize: number): void;
|
|
339
|
+
/**
|
|
340
|
+
* The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp
|
|
341
|
+
* at which the current `node` process began, measured in Unix time.
|
|
342
|
+
* @since v8.5.0
|
|
343
|
+
/**
|
|
299
344
|
*/
|
|
300
345
|
readonly timeOrigin: number;
|
|
301
346
|
/**
|
|
347
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
348
|
+
*
|
|
302
349
|
* Wraps a function within a new function that measures the running time of the wrapped function.
|
|
303
|
-
* A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed.
|
|
350
|
+
* A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed.
|
|
351
|
+
*
|
|
352
|
+
* ```js
|
|
353
|
+
* const {
|
|
354
|
+
* performance,
|
|
355
|
+
* PerformanceObserver,
|
|
356
|
+
* } = require('node:perf_hooks');
|
|
357
|
+
*
|
|
358
|
+
* function someFunction() {
|
|
359
|
+
* console.log('hello world');
|
|
360
|
+
* }
|
|
361
|
+
*
|
|
362
|
+
* const wrapped = performance.timerify(someFunction);
|
|
363
|
+
*
|
|
364
|
+
* const obs = new PerformanceObserver((list) => {
|
|
365
|
+
* console.log(list.getEntries()[0].duration);
|
|
366
|
+
*
|
|
367
|
+
* performance.clearMarks();
|
|
368
|
+
* performance.clearMeasures();
|
|
369
|
+
* obs.disconnect();
|
|
370
|
+
* });
|
|
371
|
+
* obs.observe({ entryTypes: ['function'] });
|
|
372
|
+
*
|
|
373
|
+
* // A performance timeline entry will be created
|
|
374
|
+
* wrapped();
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported
|
|
378
|
+
* once the finally handler is invoked.
|
|
304
379
|
* @param fn
|
|
305
380
|
*/
|
|
306
381
|
timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
|
307
382
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
383
|
+
* An object which is JSON representation of the performance object. It is similar to
|
|
384
|
+
* [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers.
|
|
385
|
+
* @since v16.1.0
|
|
311
386
|
*/
|
|
312
|
-
|
|
387
|
+
toJSON(): any;
|
|
313
388
|
}
|
|
314
|
-
|
|
389
|
+
class PerformanceObserverEntryList {
|
|
315
390
|
/**
|
|
316
391
|
* Returns a list of `PerformanceEntry` objects in chronological order
|
|
317
392
|
* with respect to `performanceEntry.startTime`.
|
|
@@ -489,7 +564,6 @@ declare module "perf_hooks" {
|
|
|
489
564
|
* @since v18.2.0, v16.17.0
|
|
490
565
|
*/
|
|
491
566
|
class PerformanceResourceTiming extends PerformanceEntry {
|
|
492
|
-
readonly entryType: "resource";
|
|
493
567
|
protected constructor();
|
|
494
568
|
/**
|
|
495
569
|
* The high resolution millisecond timestamp at immediately before dispatching the `fetch`
|
|
@@ -580,7 +654,6 @@ declare module "perf_hooks" {
|
|
|
580
654
|
*/
|
|
581
655
|
toJSON(): any;
|
|
582
656
|
}
|
|
583
|
-
|
|
584
657
|
namespace constants {
|
|
585
658
|
const NODE_PERFORMANCE_GC_MAJOR: number;
|
|
586
659
|
const NODE_PERFORMANCE_GC_MINOR: number;
|
|
@@ -605,10 +678,15 @@ declare module "perf_hooks" {
|
|
|
605
678
|
}
|
|
606
679
|
interface Histogram {
|
|
607
680
|
/**
|
|
608
|
-
*
|
|
609
|
-
* @since
|
|
681
|
+
* The number of samples recorded by the histogram.
|
|
682
|
+
* @since v17.4.0, v16.14.0
|
|
610
683
|
*/
|
|
611
|
-
readonly
|
|
684
|
+
readonly count: number;
|
|
685
|
+
/**
|
|
686
|
+
* The number of samples recorded by the histogram.
|
|
687
|
+
* v17.4.0, v16.14.0
|
|
688
|
+
*/
|
|
689
|
+
readonly countBigInt: bigint;
|
|
612
690
|
/**
|
|
613
691
|
* The number of times the event loop delay exceeded the maximum 1 hour event
|
|
614
692
|
* loop delay threshold.
|
|
@@ -616,36 +694,67 @@ declare module "perf_hooks" {
|
|
|
616
694
|
*/
|
|
617
695
|
readonly exceeds: number;
|
|
618
696
|
/**
|
|
619
|
-
* The
|
|
620
|
-
* @since
|
|
697
|
+
* The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold.
|
|
698
|
+
* @since v17.4.0, v16.14.0
|
|
621
699
|
*/
|
|
622
|
-
readonly
|
|
700
|
+
readonly exceedsBigInt: bigint;
|
|
623
701
|
/**
|
|
624
702
|
* The maximum recorded event loop delay.
|
|
625
703
|
* @since v11.10.0
|
|
626
704
|
*/
|
|
627
705
|
readonly max: number;
|
|
706
|
+
/**
|
|
707
|
+
* The maximum recorded event loop delay.
|
|
708
|
+
* v17.4.0, v16.14.0
|
|
709
|
+
*/
|
|
710
|
+
readonly maxBigInt: number;
|
|
628
711
|
/**
|
|
629
712
|
* The mean of the recorded event loop delays.
|
|
630
713
|
* @since v11.10.0
|
|
631
714
|
*/
|
|
632
715
|
readonly mean: number;
|
|
633
716
|
/**
|
|
634
|
-
* The
|
|
717
|
+
* The minimum recorded event loop delay.
|
|
635
718
|
* @since v11.10.0
|
|
636
719
|
*/
|
|
637
|
-
readonly
|
|
720
|
+
readonly min: number;
|
|
638
721
|
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
722
|
+
* The minimum recorded event loop delay.
|
|
723
|
+
* v17.4.0, v16.14.0
|
|
641
724
|
*/
|
|
642
|
-
|
|
725
|
+
readonly minBigInt: bigint;
|
|
643
726
|
/**
|
|
644
727
|
* Returns the value at the given percentile.
|
|
645
728
|
* @since v11.10.0
|
|
646
729
|
* @param percentile A percentile value in the range (0, 100].
|
|
647
730
|
*/
|
|
648
731
|
percentile(percentile: number): number;
|
|
732
|
+
/**
|
|
733
|
+
* Returns the value at the given percentile.
|
|
734
|
+
* @since v17.4.0, v16.14.0
|
|
735
|
+
* @param percentile A percentile value in the range (0, 100].
|
|
736
|
+
*/
|
|
737
|
+
percentileBigInt(percentile: number): bigint;
|
|
738
|
+
/**
|
|
739
|
+
* Returns a `Map` object detailing the accumulated percentile distribution.
|
|
740
|
+
* @since v11.10.0
|
|
741
|
+
*/
|
|
742
|
+
readonly percentiles: Map<number, number>;
|
|
743
|
+
/**
|
|
744
|
+
* Returns a `Map` object detailing the accumulated percentile distribution.
|
|
745
|
+
* @since v17.4.0, v16.14.0
|
|
746
|
+
*/
|
|
747
|
+
readonly percentilesBigInt: Map<bigint, bigint>;
|
|
748
|
+
/**
|
|
749
|
+
* Resets the collected histogram data.
|
|
750
|
+
* @since v11.10.0
|
|
751
|
+
*/
|
|
752
|
+
reset(): void;
|
|
753
|
+
/**
|
|
754
|
+
* The standard deviation of the recorded event loop delays.
|
|
755
|
+
* @since v11.10.0
|
|
756
|
+
*/
|
|
757
|
+
readonly stddev: number;
|
|
649
758
|
}
|
|
650
759
|
interface IntervalHistogram extends Histogram {
|
|
651
760
|
/**
|
|
@@ -670,8 +779,6 @@ declare module "perf_hooks" {
|
|
|
670
779
|
/**
|
|
671
780
|
* Calculates the amount of time (in nanoseconds) that has passed since the
|
|
672
781
|
* previous call to `recordDelta()` and records that amount in the histogram.
|
|
673
|
-
*
|
|
674
|
-
* ## Examples
|
|
675
782
|
* @since v15.9.0, v14.18.0
|
|
676
783
|
*/
|
|
677
784
|
recordDelta(): void;
|
|
@@ -738,7 +845,7 @@ declare module "perf_hooks" {
|
|
|
738
845
|
global {
|
|
739
846
|
/**
|
|
740
847
|
* `performance` is a global reference for `import { performance } from 'node:perf_hooks'`
|
|
741
|
-
* https://nodejs.org/api/globals.html#performance
|
|
848
|
+
* @see https://nodejs.org/docs/latest-v18.x/api/globals.html#performance
|
|
742
849
|
* @since v16.0.0
|
|
743
850
|
*/
|
|
744
851
|
var performance: typeof globalThis extends {
|
node v18.19/process.d.ts
CHANGED
|
@@ -141,7 +141,59 @@ declare module "process" {
|
|
|
141
141
|
TZ?: string;
|
|
142
142
|
}
|
|
143
143
|
interface HRTime {
|
|
144
|
+
/**
|
|
145
|
+
* This is the legacy version of {@link process.hrtime.bigint()}
|
|
146
|
+
* before bigint was introduced in JavaScript.
|
|
147
|
+
*
|
|
148
|
+
* The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`,
|
|
149
|
+
* where `nanoseconds` is the remaining part of the real time that can't be represented in second precision.
|
|
150
|
+
*
|
|
151
|
+
* `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time.
|
|
152
|
+
* If the parameter passed in is not a tuple `Array`, a TypeError will be thrown.
|
|
153
|
+
* Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior.
|
|
154
|
+
*
|
|
155
|
+
* These times are relative to an arbitrary time in the past,
|
|
156
|
+
* and not related to the time of day and therefore not subject to clock drift.
|
|
157
|
+
* The primary use is for measuring performance between intervals:
|
|
158
|
+
* ```js
|
|
159
|
+
* const { hrtime } = require('node:process');
|
|
160
|
+
* const NS_PER_SEC = 1e9;
|
|
161
|
+
* const time = hrtime();
|
|
162
|
+
* // [ 1800216, 25 ]
|
|
163
|
+
*
|
|
164
|
+
* setTimeout(() => {
|
|
165
|
+
* const diff = hrtime(time);
|
|
166
|
+
* // [ 1, 552 ]
|
|
167
|
+
*
|
|
168
|
+
* console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
|
|
169
|
+
* // Benchmark took 1000000552 nanoseconds
|
|
170
|
+
* }, 1000);
|
|
171
|
+
* ```
|
|
172
|
+
* @since 0.7.6
|
|
173
|
+
* @legacy Use {@link process.hrtime.bigint()} instead.
|
|
174
|
+
* @param time The result of a previous call to `process.hrtime()`
|
|
175
|
+
*/
|
|
144
176
|
(time?: [number, number]): [number, number];
|
|
177
|
+
/**
|
|
178
|
+
* The `bigint` version of the {@link process.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`.
|
|
179
|
+
*
|
|
180
|
+
* Unlike {@link process.hrtime()}, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
|
|
181
|
+
* ```js
|
|
182
|
+
* import { hrtime } from 'node:process';
|
|
183
|
+
*
|
|
184
|
+
* const start = hrtime.bigint();
|
|
185
|
+
* // 191051479007711n
|
|
186
|
+
*
|
|
187
|
+
* setTimeout(() => {
|
|
188
|
+
* const end = hrtime.bigint();
|
|
189
|
+
* // 191052633396993n
|
|
190
|
+
*
|
|
191
|
+
* console.log(`Benchmark took ${end - start} nanoseconds`);
|
|
192
|
+
* // Benchmark took 1154389282 nanoseconds
|
|
193
|
+
* }, 1000);
|
|
194
|
+
* ```
|
|
195
|
+
* @since v10.7.0
|
|
196
|
+
*/
|
|
145
197
|
bigint(): bigint;
|
|
146
198
|
}
|
|
147
199
|
interface ProcessReport {
|