@anthropic-ai/claude-code 0.2.14 → 0.2.18

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.
Files changed (103) hide show
  1. package/cli.mjs +483 -468
  2. package/package.json +3 -5
  3. package/scripts/preinstall.js +15 -0
  4. package/vendor/sdk/node_modules/@types/node/LICENSE +0 -21
  5. package/vendor/sdk/node_modules/@types/node/README.md +0 -15
  6. package/vendor/sdk/node_modules/@types/node/assert/strict.d.ts +0 -8
  7. package/vendor/sdk/node_modules/@types/node/assert.d.ts +0 -985
  8. package/vendor/sdk/node_modules/@types/node/async_hooks.d.ts +0 -522
  9. package/vendor/sdk/node_modules/@types/node/buffer.buffer.d.ts +0 -385
  10. package/vendor/sdk/node_modules/@types/node/buffer.d.ts +0 -1903
  11. package/vendor/sdk/node_modules/@types/node/child_process.d.ts +0 -1549
  12. package/vendor/sdk/node_modules/@types/node/cluster.d.ts +0 -578
  13. package/vendor/sdk/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  14. package/vendor/sdk/node_modules/@types/node/compatibility/index.d.ts +0 -9
  15. package/vendor/sdk/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  16. package/vendor/sdk/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
  17. package/vendor/sdk/node_modules/@types/node/console.d.ts +0 -452
  18. package/vendor/sdk/node_modules/@types/node/constants.d.ts +0 -19
  19. package/vendor/sdk/node_modules/@types/node/crypto.d.ts +0 -4453
  20. package/vendor/sdk/node_modules/@types/node/dgram.d.ts +0 -596
  21. package/vendor/sdk/node_modules/@types/node/diagnostics_channel.d.ts +0 -546
  22. package/vendor/sdk/node_modules/@types/node/dns/promises.d.ts +0 -475
  23. package/vendor/sdk/node_modules/@types/node/dns.d.ts +0 -853
  24. package/vendor/sdk/node_modules/@types/node/dom-events.d.ts +0 -124
  25. package/vendor/sdk/node_modules/@types/node/domain.d.ts +0 -170
  26. package/vendor/sdk/node_modules/@types/node/events.d.ts +0 -819
  27. package/vendor/sdk/node_modules/@types/node/fs/promises.d.ts +0 -1205
  28. package/vendor/sdk/node_modules/@types/node/fs.d.ts +0 -4237
  29. package/vendor/sdk/node_modules/@types/node/globals.d.ts +0 -442
  30. package/vendor/sdk/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  31. package/vendor/sdk/node_modules/@types/node/http.d.ts +0 -1839
  32. package/vendor/sdk/node_modules/@types/node/http2.d.ts +0 -2517
  33. package/vendor/sdk/node_modules/@types/node/https.d.ts +0 -544
  34. package/vendor/sdk/node_modules/@types/node/index.d.ts +0 -90
  35. package/vendor/sdk/node_modules/@types/node/inspector.d.ts +0 -2775
  36. package/vendor/sdk/node_modules/@types/node/module.d.ts +0 -291
  37. package/vendor/sdk/node_modules/@types/node/net.d.ts +0 -924
  38. package/vendor/sdk/node_modules/@types/node/os.d.ts +0 -473
  39. package/vendor/sdk/node_modules/@types/node/package.json +0 -225
  40. package/vendor/sdk/node_modules/@types/node/path.d.ts +0 -191
  41. package/vendor/sdk/node_modules/@types/node/perf_hooks.d.ts +0 -753
  42. package/vendor/sdk/node_modules/@types/node/process.d.ts +0 -1553
  43. package/vendor/sdk/node_modules/@types/node/punycode.d.ts +0 -117
  44. package/vendor/sdk/node_modules/@types/node/querystring.d.ts +0 -141
  45. package/vendor/sdk/node_modules/@types/node/readline/promises.d.ts +0 -154
  46. package/vendor/sdk/node_modules/@types/node/readline.d.ts +0 -715
  47. package/vendor/sdk/node_modules/@types/node/repl.d.ts +0 -430
  48. package/vendor/sdk/node_modules/@types/node/stream/consumers.d.ts +0 -12
  49. package/vendor/sdk/node_modules/@types/node/stream/promises.d.ts +0 -90
  50. package/vendor/sdk/node_modules/@types/node/stream/web.d.ts +0 -523
  51. package/vendor/sdk/node_modules/@types/node/stream.d.ts +0 -1731
  52. package/vendor/sdk/node_modules/@types/node/string_decoder.d.ts +0 -67
  53. package/vendor/sdk/node_modules/@types/node/test.d.ts +0 -1245
  54. package/vendor/sdk/node_modules/@types/node/timers/promises.d.ts +0 -93
  55. package/vendor/sdk/node_modules/@types/node/timers.d.ts +0 -126
  56. package/vendor/sdk/node_modules/@types/node/tls.d.ts +0 -1203
  57. package/vendor/sdk/node_modules/@types/node/trace_events.d.ts +0 -171
  58. package/vendor/sdk/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -385
  59. package/vendor/sdk/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  60. package/vendor/sdk/node_modules/@types/node/ts5.6/index.d.ts +0 -90
  61. package/vendor/sdk/node_modules/@types/node/tty.d.ts +0 -206
  62. package/vendor/sdk/node_modules/@types/node/url.d.ts +0 -957
  63. package/vendor/sdk/node_modules/@types/node/util.d.ts +0 -2083
  64. package/vendor/sdk/node_modules/@types/node/v8.d.ts +0 -753
  65. package/vendor/sdk/node_modules/@types/node/vm.d.ts +0 -666
  66. package/vendor/sdk/node_modules/@types/node/wasi.d.ts +0 -160
  67. package/vendor/sdk/node_modules/@types/node/worker_threads.d.ts +0 -695
  68. package/vendor/sdk/node_modules/@types/node/zlib.d.ts +0 -517
  69. package/vendor/sdk/node_modules/undici-types/README.md +0 -6
  70. package/vendor/sdk/node_modules/undici-types/agent.d.ts +0 -31
  71. package/vendor/sdk/node_modules/undici-types/api.d.ts +0 -43
  72. package/vendor/sdk/node_modules/undici-types/balanced-pool.d.ts +0 -18
  73. package/vendor/sdk/node_modules/undici-types/cache.d.ts +0 -36
  74. package/vendor/sdk/node_modules/undici-types/client.d.ts +0 -97
  75. package/vendor/sdk/node_modules/undici-types/connector.d.ts +0 -34
  76. package/vendor/sdk/node_modules/undici-types/content-type.d.ts +0 -21
  77. package/vendor/sdk/node_modules/undici-types/cookies.d.ts +0 -28
  78. package/vendor/sdk/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  79. package/vendor/sdk/node_modules/undici-types/dispatcher.d.ts +0 -241
  80. package/vendor/sdk/node_modules/undici-types/errors.d.ts +0 -128
  81. package/vendor/sdk/node_modules/undici-types/fetch.d.ts +0 -209
  82. package/vendor/sdk/node_modules/undici-types/file.d.ts +0 -39
  83. package/vendor/sdk/node_modules/undici-types/filereader.d.ts +0 -54
  84. package/vendor/sdk/node_modules/undici-types/formdata.d.ts +0 -108
  85. package/vendor/sdk/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  86. package/vendor/sdk/node_modules/undici-types/global-origin.d.ts +0 -7
  87. package/vendor/sdk/node_modules/undici-types/handlers.d.ts +0 -9
  88. package/vendor/sdk/node_modules/undici-types/header.d.ts +0 -4
  89. package/vendor/sdk/node_modules/undici-types/index.d.ts +0 -63
  90. package/vendor/sdk/node_modules/undici-types/interceptors.d.ts +0 -5
  91. package/vendor/sdk/node_modules/undici-types/mock-agent.d.ts +0 -50
  92. package/vendor/sdk/node_modules/undici-types/mock-client.d.ts +0 -25
  93. package/vendor/sdk/node_modules/undici-types/mock-errors.d.ts +0 -12
  94. package/vendor/sdk/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  95. package/vendor/sdk/node_modules/undici-types/mock-pool.d.ts +0 -25
  96. package/vendor/sdk/node_modules/undici-types/package.json +0 -55
  97. package/vendor/sdk/node_modules/undici-types/patch.d.ts +0 -71
  98. package/vendor/sdk/node_modules/undici-types/pool-stats.d.ts +0 -19
  99. package/vendor/sdk/node_modules/undici-types/pool.d.ts +0 -28
  100. package/vendor/sdk/node_modules/undici-types/proxy-agent.d.ts +0 -30
  101. package/vendor/sdk/node_modules/undici-types/readable.d.ts +0 -61
  102. package/vendor/sdk/node_modules/undici-types/webidl.d.ts +0 -220
  103. package/vendor/sdk/node_modules/undici-types/websocket.d.ts +0 -131
@@ -1,753 +0,0 @@
1
- /**
2
- * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
3
- * Node.js-specific performance measurements.
4
- *
5
- * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):
6
- *
7
- * * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
8
- * * [Performance Timeline](https://w3c.github.io/performance-timeline/)
9
- * * [User Timing](https://www.w3.org/TR/user-timing/)
10
- *
11
- * ```js
12
- * import { PerformanceObserver, performance } from 'node:perf_hooks';
13
- *
14
- * const obs = new PerformanceObserver((items) => {
15
- * console.log(items.getEntries()[0].duration);
16
- * performance.clearMarks();
17
- * });
18
- * obs.observe({ type: 'measure' });
19
- * performance.measure('Start to Now');
20
- *
21
- * performance.mark('A');
22
- * doSomeLongRunningProcess(() => {
23
- * performance.measure('A to Now', 'A');
24
- *
25
- * performance.mark('B');
26
- * performance.measure('A to B', 'A', 'B');
27
- * });
28
- * ```
29
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/perf_hooks.js)
30
- */
31
- declare module "perf_hooks" {
32
- import { AsyncResource } from "node:async_hooks";
33
- type EntryType =
34
- | "dns" // Node.js only
35
- | "function" // Node.js only
36
- | "gc" // Node.js only
37
- | "http2" // Node.js only
38
- | "http" // Node.js only
39
- | "mark" // available on the Web
40
- | "measure" // available on the Web
41
- | "net" // Node.js only
42
- | "node" // Node.js only
43
- | "resource"; // available on the Web
44
- interface NodeGCPerformanceDetail {
45
- /**
46
- * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
47
- * the type of garbage collection operation that occurred.
48
- * See perf_hooks.constants for valid values.
49
- */
50
- readonly kind?: number | undefined;
51
- /**
52
- * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
53
- * property contains additional information about garbage collection operation.
54
- * See perf_hooks.constants for valid values.
55
- */
56
- readonly flags?: number | undefined;
57
- }
58
- /**
59
- * @since v8.5.0
60
- */
61
- class PerformanceEntry {
62
- protected constructor();
63
- /**
64
- * The total number of milliseconds elapsed for this entry. This value will not
65
- * be meaningful for all Performance Entry types.
66
- * @since v8.5.0
67
- */
68
- readonly duration: number;
69
- /**
70
- * The name of the performance entry.
71
- * @since v8.5.0
72
- */
73
- readonly name: string;
74
- /**
75
- * The high resolution millisecond timestamp marking the starting time of the
76
- * Performance Entry.
77
- * @since v8.5.0
78
- */
79
- readonly startTime: number;
80
- /**
81
- * The type of the performance entry. It may be one of:
82
- *
83
- * * `'node'` (Node.js only)
84
- * * `'mark'` (available on the Web)
85
- * * `'measure'` (available on the Web)
86
- * * `'gc'` (Node.js only)
87
- * * `'function'` (Node.js only)
88
- * * `'http2'` (Node.js only)
89
- * * `'http'` (Node.js only)
90
- * @since v8.5.0
91
- */
92
- readonly entryType: EntryType;
93
- /**
94
- * Additional detail specific to the `entryType`.
95
- * @since v16.0.0
96
- */
97
- readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
98
- toJSON(): any;
99
- }
100
- class PerformanceMark extends PerformanceEntry {
101
- readonly duration: 0;
102
- readonly entryType: "mark";
103
- }
104
- class PerformanceMeasure extends PerformanceEntry {
105
- readonly entryType: "measure";
106
- }
107
- /**
108
- * _This property is an extension by Node.js. It is not available in Web browsers._
109
- *
110
- * Provides timing details for Node.js itself. The constructor of this class
111
- * is not exposed to users.
112
- * @since v8.5.0
113
- */
114
- class PerformanceNodeTiming extends PerformanceEntry {
115
- /**
116
- * The high resolution millisecond timestamp at which the Node.js process
117
- * completed bootstrapping. If bootstrapping has not yet finished, the property
118
- * has the value of -1.
119
- * @since v8.5.0
120
- */
121
- readonly bootstrapComplete: number;
122
- /**
123
- * The high resolution millisecond timestamp at which the Node.js environment was
124
- * initialized.
125
- * @since v8.5.0
126
- */
127
- readonly environment: number;
128
- /**
129
- * The high resolution millisecond timestamp of the amount of time the event loop
130
- * has been idle within the event loop's event provider (e.g. `epoll_wait`). This
131
- * does not take CPU usage into consideration. If the event loop has not yet
132
- * started (e.g., in the first tick of the main script), the property has the
133
- * value of 0.
134
- * @since v14.10.0, v12.19.0
135
- */
136
- readonly idleTime: number;
137
- /**
138
- * The high resolution millisecond timestamp at which the Node.js event loop
139
- * exited. If the event loop has not yet exited, the property has the value of -1\.
140
- * It can only have a value of not -1 in a handler of the `'exit'` event.
141
- * @since v8.5.0
142
- */
143
- readonly loopExit: number;
144
- /**
145
- * The high resolution millisecond timestamp at which the Node.js event loop
146
- * started. If the event loop has not yet started (e.g., in the first tick of the
147
- * main script), the property has the value of -1.
148
- * @since v8.5.0
149
- */
150
- readonly loopStart: number;
151
- /**
152
- * The high resolution millisecond timestamp at which the V8 platform was
153
- * initialized.
154
- * @since v8.5.0
155
- */
156
- readonly v8Start: number;
157
- }
158
- interface EventLoopUtilization {
159
- idle: number;
160
- active: number;
161
- utilization: number;
162
- }
163
- /**
164
- * @param util1 The result of a previous call to eventLoopUtilization()
165
- * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
166
- */
167
- type EventLoopUtilityFunction = (
168
- util1?: EventLoopUtilization,
169
- util2?: EventLoopUtilization,
170
- ) => EventLoopUtilization;
171
- interface MarkOptions {
172
- /**
173
- * Additional optional detail to include with the mark.
174
- */
175
- detail?: unknown | undefined;
176
- /**
177
- * An optional timestamp to be used as the mark time.
178
- * @default `performance.now()`.
179
- */
180
- startTime?: number | undefined;
181
- }
182
- interface MeasureOptions {
183
- /**
184
- * Additional optional detail to include with the mark.
185
- */
186
- detail?: unknown | undefined;
187
- /**
188
- * Duration between start and end times.
189
- */
190
- duration?: number | undefined;
191
- /**
192
- * Timestamp to be used as the end time, or a string identifying a previously recorded mark.
193
- */
194
- end?: number | string | undefined;
195
- /**
196
- * Timestamp to be used as the start time, or a string identifying a previously recorded mark.
197
- */
198
- start?: number | string | undefined;
199
- }
200
- interface TimerifyOptions {
201
- /**
202
- * A histogram object created using
203
- * `perf_hooks.createHistogram()` that will record runtime durations in
204
- * nanoseconds.
205
- */
206
- histogram?: RecordableHistogram | undefined;
207
- }
208
- interface Performance {
209
- /**
210
- * If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
211
- * If name is provided, removes only the named mark.
212
- * @param name
213
- */
214
- clearMarks(name?: string): void;
215
- /**
216
- * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
217
- * If name is provided, removes only the named measure.
218
- * @param name
219
- * @since v16.7.0
220
- */
221
- clearMeasures(name?: string): void;
222
- /**
223
- * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
224
- * If you are only interested in performance entries of certain types or that have certain names, see
225
- * `performance.getEntriesByType()` and `performance.getEntriesByName()`.
226
- * @since v16.7.0
227
- */
228
- getEntries(): PerformanceEntry[];
229
- /**
230
- * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
231
- * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
232
- * @param name
233
- * @param type
234
- * @since v16.7.0
235
- */
236
- getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
237
- /**
238
- * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
239
- * whose `performanceEntry.entryType` is equal to `type`.
240
- * @param type
241
- * @since v16.7.0
242
- */
243
- getEntriesByType(type: EntryType): PerformanceEntry[];
244
- /**
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.
248
- * Performance marks are used to mark specific significant moments in the Performance Timeline.
249
- * @param name
250
- * @return The PerformanceMark entry that was created
251
- */
252
- mark(name?: string, options?: MarkOptions): PerformanceMark;
253
- /**
254
- * Creates a new `PerformanceResourceTiming` entry in the Resource Timeline.
255
- * A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`.
256
- * Performance resources are used to mark moments in the Resource Timeline.
257
- * @param timingInfo [Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info)
258
- * @param requestedUrl The resource url
259
- * @param initiatorType The initiator name, e.g: 'fetch'
260
- * @param global
261
- * @param cacheMode The cache mode must be an empty string ('') or 'local'
262
- * @since v18.2.0, v16.17.0
263
- */
264
- markResourceTiming(
265
- timingInfo: object,
266
- requestedUrl: string,
267
- initiatorType: string,
268
- global: object,
269
- cacheMode: "" | "local",
270
- ): PerformanceResourceTiming;
271
- /**
272
- * Creates a new PerformanceMeasure entry in the Performance Timeline.
273
- * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
274
- * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark.
275
- *
276
- * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify
277
- * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist,
278
- * then startMark is set to timeOrigin by default.
279
- *
280
- * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp
281
- * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown.
282
- * @param name
283
- * @param startMark
284
- * @param endMark
285
- * @return The PerformanceMeasure entry that was created
286
- */
287
- measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
288
- measure(name: string, options: MeasureOptions): PerformanceMeasure;
289
- /**
290
- * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
291
- */
292
- readonly nodeTiming: PerformanceNodeTiming;
293
- /**
294
- * @return the current high resolution millisecond timestamp
295
- */
296
- now(): number;
297
- /**
298
- * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured.
299
- */
300
- readonly timeOrigin: number;
301
- /**
302
- * 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.
304
- * @param fn
305
- */
306
- timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
307
- /**
308
- * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
309
- * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
310
- * No other CPU idle time is taken into consideration.
311
- */
312
- eventLoopUtilization: EventLoopUtilityFunction;
313
- }
314
- interface PerformanceObserverEntryList {
315
- /**
316
- * Returns a list of `PerformanceEntry` objects in chronological order
317
- * with respect to `performanceEntry.startTime`.
318
- *
319
- * ```js
320
- * import {
321
- * performance,
322
- * PerformanceObserver
323
- * } from 'node:perf_hooks';
324
- *
325
- * const obs = new PerformanceObserver((perfObserverList, observer) => {
326
- * console.log(perfObserverList.getEntries());
327
- *
328
- * * [
329
- * * PerformanceEntry {
330
- * * name: 'test',
331
- * * entryType: 'mark',
332
- * * startTime: 81.465639,
333
- * * duration: 0
334
- * * },
335
- * * PerformanceEntry {
336
- * * name: 'meow',
337
- * * entryType: 'mark',
338
- * * startTime: 81.860064,
339
- * * duration: 0
340
- * * }
341
- * * ]
342
- *
343
- * performance.clearMarks();
344
- * performance.clearMeasures();
345
- * observer.disconnect();
346
- * });
347
- * obs.observe({ type: 'mark' });
348
- *
349
- * performance.mark('test');
350
- * performance.mark('meow');
351
- * ```
352
- * @since v8.5.0
353
- */
354
- getEntries(): PerformanceEntry[];
355
- /**
356
- * Returns a list of `PerformanceEntry` objects in chronological order
357
- * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
358
- * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
359
- *
360
- * ```js
361
- * import {
362
- * performance,
363
- * PerformanceObserver
364
- * } from 'node:perf_hooks';
365
- *
366
- * const obs = new PerformanceObserver((perfObserverList, observer) => {
367
- * console.log(perfObserverList.getEntriesByName('meow'));
368
- *
369
- * * [
370
- * * PerformanceEntry {
371
- * * name: 'meow',
372
- * * entryType: 'mark',
373
- * * startTime: 98.545991,
374
- * * duration: 0
375
- * * }
376
- * * ]
377
- *
378
- * console.log(perfObserverList.getEntriesByName('nope')); // []
379
- *
380
- * console.log(perfObserverList.getEntriesByName('test', 'mark'));
381
- *
382
- * * [
383
- * * PerformanceEntry {
384
- * * name: 'test',
385
- * * entryType: 'mark',
386
- * * startTime: 63.518931,
387
- * * duration: 0
388
- * * }
389
- * * ]
390
- *
391
- * console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
392
- *
393
- * performance.clearMarks();
394
- * performance.clearMeasures();
395
- * observer.disconnect();
396
- * });
397
- * obs.observe({ entryTypes: ['mark', 'measure'] });
398
- *
399
- * performance.mark('test');
400
- * performance.mark('meow');
401
- * ```
402
- * @since v8.5.0
403
- */
404
- getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
405
- /**
406
- * Returns a list of `PerformanceEntry` objects in chronological order
407
- * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`.
408
- *
409
- * ```js
410
- * import {
411
- * performance,
412
- * PerformanceObserver
413
- * } from 'node:perf_hooks';
414
- *
415
- * const obs = new PerformanceObserver((perfObserverList, observer) => {
416
- * console.log(perfObserverList.getEntriesByType('mark'));
417
- *
418
- * * [
419
- * * PerformanceEntry {
420
- * * name: 'test',
421
- * * entryType: 'mark',
422
- * * startTime: 55.897834,
423
- * * duration: 0
424
- * * },
425
- * * PerformanceEntry {
426
- * * name: 'meow',
427
- * * entryType: 'mark',
428
- * * startTime: 56.350146,
429
- * * duration: 0
430
- * * }
431
- * * ]
432
- *
433
- * performance.clearMarks();
434
- * performance.clearMeasures();
435
- * observer.disconnect();
436
- * });
437
- * obs.observe({ type: 'mark' });
438
- *
439
- * performance.mark('test');
440
- * performance.mark('meow');
441
- * ```
442
- * @since v8.5.0
443
- */
444
- getEntriesByType(type: EntryType): PerformanceEntry[];
445
- }
446
- type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
447
- class PerformanceObserver extends AsyncResource {
448
- constructor(callback: PerformanceObserverCallback);
449
- /**
450
- * Disconnects the `PerformanceObserver` instance from all notifications.
451
- * @since v8.5.0
452
- */
453
- disconnect(): void;
454
- /**
455
- * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`:
456
- *
457
- * ```js
458
- * import {
459
- * performance,
460
- * PerformanceObserver
461
- * } from 'node:perf_hooks';
462
- *
463
- * const obs = new PerformanceObserver((list, observer) => {
464
- * // Called once asynchronously. `list` contains three items.
465
- * });
466
- * obs.observe({ type: 'mark' });
467
- *
468
- * for (let n = 0; n < 3; n++)
469
- * performance.mark(`test${n}`);
470
- * ```
471
- * @since v8.5.0
472
- */
473
- observe(
474
- options:
475
- | {
476
- entryTypes: readonly EntryType[];
477
- buffered?: boolean | undefined;
478
- }
479
- | {
480
- type: EntryType;
481
- buffered?: boolean | undefined;
482
- },
483
- ): void;
484
- }
485
- /**
486
- * Provides detailed network timing data regarding the loading of an application's resources.
487
- *
488
- * The constructor of this class is not exposed to users directly.
489
- * @since v18.2.0, v16.17.0
490
- */
491
- class PerformanceResourceTiming extends PerformanceEntry {
492
- readonly entryType: "resource";
493
- protected constructor();
494
- /**
495
- * The high resolution millisecond timestamp at immediately before dispatching the `fetch`
496
- * request. If the resource is not intercepted by a worker the property will always return 0.
497
- * @since v18.2.0, v16.17.0
498
- */
499
- readonly workerStart: number;
500
- /**
501
- * The high resolution millisecond timestamp that represents the start time of the fetch which
502
- * initiates the redirect.
503
- * @since v18.2.0, v16.17.0
504
- */
505
- readonly redirectStart: number;
506
- /**
507
- * The high resolution millisecond timestamp that will be created immediately after receiving
508
- * the last byte of the response of the last redirect.
509
- * @since v18.2.0, v16.17.0
510
- */
511
- readonly redirectEnd: number;
512
- /**
513
- * The high resolution millisecond timestamp immediately before the Node.js starts to fetch the resource.
514
- * @since v18.2.0, v16.17.0
515
- */
516
- readonly fetchStart: number;
517
- /**
518
- * The high resolution millisecond timestamp immediately before the Node.js starts the domain name lookup
519
- * for the resource.
520
- * @since v18.2.0, v16.17.0
521
- */
522
- readonly domainLookupStart: number;
523
- /**
524
- * The high resolution millisecond timestamp representing the time immediately after the Node.js finished
525
- * the domain name lookup for the resource.
526
- * @since v18.2.0, v16.17.0
527
- */
528
- readonly domainLookupEnd: number;
529
- /**
530
- * The high resolution millisecond timestamp representing the time immediately before Node.js starts to
531
- * establish the connection to the server to retrieve the resource.
532
- * @since v18.2.0, v16.17.0
533
- */
534
- readonly connectStart: number;
535
- /**
536
- * The high resolution millisecond timestamp representing the time immediately after Node.js finishes
537
- * establishing the connection to the server to retrieve the resource.
538
- * @since v18.2.0, v16.17.0
539
- */
540
- readonly connectEnd: number;
541
- /**
542
- * The high resolution millisecond timestamp representing the time immediately before Node.js starts the
543
- * handshake process to secure the current connection.
544
- * @since v18.2.0, v16.17.0
545
- */
546
- readonly secureConnectionStart: number;
547
- /**
548
- * The high resolution millisecond timestamp representing the time immediately before Node.js receives the
549
- * first byte of the response from the server.
550
- * @since v18.2.0, v16.17.0
551
- */
552
- readonly requestStart: number;
553
- /**
554
- * The high resolution millisecond timestamp representing the time immediately after Node.js receives the
555
- * last byte of the resource or immediately before the transport connection is closed, whichever comes first.
556
- * @since v18.2.0, v16.17.0
557
- */
558
- readonly responseEnd: number;
559
- /**
560
- * A number representing the size (in octets) of the fetched resource. The size includes the response header
561
- * fields plus the response payload body.
562
- * @since v18.2.0, v16.17.0
563
- */
564
- readonly transferSize: number;
565
- /**
566
- * A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before
567
- * removing any applied content-codings.
568
- * @since v18.2.0, v16.17.0
569
- */
570
- readonly encodedBodySize: number;
571
- /**
572
- * A number representing the size (in octets) received from the fetch (HTTP or cache), of the message body, after
573
- * removing any applied content-codings.
574
- * @since v18.2.0, v16.17.0
575
- */
576
- readonly decodedBodySize: number;
577
- /**
578
- * Returns a `object` that is the JSON representation of the `PerformanceResourceTiming` object
579
- * @since v18.2.0, v16.17.0
580
- */
581
- toJSON(): any;
582
- }
583
-
584
- namespace constants {
585
- const NODE_PERFORMANCE_GC_MAJOR: number;
586
- const NODE_PERFORMANCE_GC_MINOR: number;
587
- const NODE_PERFORMANCE_GC_INCREMENTAL: number;
588
- const NODE_PERFORMANCE_GC_WEAKCB: number;
589
- const NODE_PERFORMANCE_GC_FLAGS_NO: number;
590
- const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
591
- const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
592
- const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
593
- const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
594
- const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
595
- const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
596
- }
597
- const performance: Performance;
598
- interface EventLoopMonitorOptions {
599
- /**
600
- * The sampling rate in milliseconds.
601
- * Must be greater than zero.
602
- * @default 10
603
- */
604
- resolution?: number | undefined;
605
- }
606
- interface Histogram {
607
- /**
608
- * Returns a `Map` object detailing the accumulated percentile distribution.
609
- * @since v11.10.0
610
- */
611
- readonly percentiles: Map<number, number>;
612
- /**
613
- * The number of times the event loop delay exceeded the maximum 1 hour event
614
- * loop delay threshold.
615
- * @since v11.10.0
616
- */
617
- readonly exceeds: number;
618
- /**
619
- * The minimum recorded event loop delay.
620
- * @since v11.10.0
621
- */
622
- readonly min: number;
623
- /**
624
- * The maximum recorded event loop delay.
625
- * @since v11.10.0
626
- */
627
- readonly max: number;
628
- /**
629
- * The mean of the recorded event loop delays.
630
- * @since v11.10.0
631
- */
632
- readonly mean: number;
633
- /**
634
- * The standard deviation of the recorded event loop delays.
635
- * @since v11.10.0
636
- */
637
- readonly stddev: number;
638
- /**
639
- * Resets the collected histogram data.
640
- * @since v11.10.0
641
- */
642
- reset(): void;
643
- /**
644
- * Returns the value at the given percentile.
645
- * @since v11.10.0
646
- * @param percentile A percentile value in the range (0, 100].
647
- */
648
- percentile(percentile: number): number;
649
- }
650
- interface IntervalHistogram extends Histogram {
651
- /**
652
- * Enables the update interval timer. Returns `true` if the timer was
653
- * started, `false` if it was already started.
654
- * @since v11.10.0
655
- */
656
- enable(): boolean;
657
- /**
658
- * Disables the update interval timer. Returns `true` if the timer was
659
- * stopped, `false` if it was already stopped.
660
- * @since v11.10.0
661
- */
662
- disable(): boolean;
663
- }
664
- interface RecordableHistogram extends Histogram {
665
- /**
666
- * @since v15.9.0, v14.18.0
667
- * @param val The amount to record in the histogram.
668
- */
669
- record(val: number | bigint): void;
670
- /**
671
- * Calculates the amount of time (in nanoseconds) that has passed since the
672
- * previous call to `recordDelta()` and records that amount in the histogram.
673
- *
674
- * ## Examples
675
- * @since v15.9.0, v14.18.0
676
- */
677
- recordDelta(): void;
678
- /**
679
- * Adds the values from other to this histogram.
680
- * @since v17.4.0, v16.14.0
681
- * @param other Recordable Histogram to combine with
682
- */
683
- add(other: RecordableHistogram): void;
684
- }
685
- /**
686
- * _This property is an extension by Node.js. It is not available in Web browsers._
687
- *
688
- * Creates an `IntervalHistogram` object that samples and reports the event loop
689
- * delay over time. The delays will be reported in nanoseconds.
690
- *
691
- * Using a timer to detect approximate event loop delay works because the
692
- * execution of timers is tied specifically to the lifecycle of the libuv
693
- * event loop. That is, a delay in the loop will cause a delay in the execution
694
- * of the timer, and those delays are specifically what this API is intended to
695
- * detect.
696
- *
697
- * ```js
698
- * import { monitorEventLoopDelay } from 'node:perf_hooks';
699
- * const h = monitorEventLoopDelay({ resolution: 20 });
700
- * h.enable();
701
- * // Do something.
702
- * h.disable();
703
- * console.log(h.min);
704
- * console.log(h.max);
705
- * console.log(h.mean);
706
- * console.log(h.stddev);
707
- * console.log(h.percentiles);
708
- * console.log(h.percentile(50));
709
- * console.log(h.percentile(99));
710
- * ```
711
- * @since v11.10.0
712
- */
713
- function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
714
- interface CreateHistogramOptions {
715
- /**
716
- * The minimum recordable value. Must be an integer value greater than 0.
717
- * @default 1
718
- */
719
- min?: number | bigint | undefined;
720
- /**
721
- * The maximum recordable value. Must be an integer value greater than min.
722
- * @default Number.MAX_SAFE_INTEGER
723
- */
724
- max?: number | bigint | undefined;
725
- /**
726
- * The number of accuracy digits. Must be a number between 1 and 5.
727
- * @default 3
728
- */
729
- figures?: number | undefined;
730
- }
731
- /**
732
- * Returns a `RecordableHistogram`.
733
- * @since v15.9.0, v14.18.0
734
- */
735
- function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
736
-
737
- import { performance as _performance } from "perf_hooks";
738
- global {
739
- /**
740
- * `performance` is a global reference for `import { performance } from 'node:perf_hooks'`
741
- * https://nodejs.org/api/globals.html#performance
742
- * @since v16.0.0
743
- */
744
- var performance: typeof globalThis extends {
745
- onmessage: any;
746
- performance: infer T;
747
- } ? T
748
- : typeof _performance;
749
- }
750
- }
751
- declare module "node:perf_hooks" {
752
- export * from "perf_hooks";
753
- }