@node-red/editor-client 3.0.2 → 3.1.0-beta.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.
Files changed (127) hide show
  1. package/locales/de/editor.json +2 -0
  2. package/locales/de/infotips.json +0 -0
  3. package/locales/de/jsonata.json +0 -0
  4. package/locales/en-US/editor.json +37 -6
  5. package/locales/en-US/infotips.json +0 -0
  6. package/locales/en-US/jsonata.json +0 -0
  7. package/locales/fr/editor.json +1238 -0
  8. package/locales/fr/infotips.json +23 -0
  9. package/locales/fr/jsonata.json +274 -0
  10. package/locales/ja/editor.json +48 -9
  11. package/locales/ko/editor.json +233 -31
  12. package/locales/ko/infotips.json +0 -0
  13. package/locales/ko/jsonata.json +0 -0
  14. package/locales/pt-BR/editor.json +1208 -0
  15. package/locales/pt-BR/infotips.json +23 -0
  16. package/locales/pt-BR/jsonata.json +274 -0
  17. package/locales/ru/editor.json +2 -0
  18. package/locales/ru/infotips.json +0 -0
  19. package/locales/ru/jsonata.json +0 -0
  20. package/locales/zh-CN/editor.json +1175 -1049
  21. package/locales/zh-TW/editor.json +3 -0
  22. package/package.json +1 -1
  23. package/public/red/about +140 -0
  24. package/public/red/red.js +2699 -1397
  25. package/public/red/red.min.js +4 -3
  26. package/public/red/style.min.css +1 -1
  27. package/public/red/tours/3.0/images/context-menu.png +0 -0
  28. package/public/red/tours/3.0/welcome.js +155 -0
  29. package/public/red/tours/images/context-menu.png +0 -0
  30. package/public/red/tours/images/global-env-vars.png +0 -0
  31. package/public/red/tours/images/hiding-flows.png +0 -0
  32. package/public/red/tours/images/locking-flows.png +0 -0
  33. package/public/red/tours/images/mermaid.png +0 -0
  34. package/public/red/tours/images/node-help.png +0 -0
  35. package/public/red/tours/images/tab-changes.png +0 -0
  36. package/public/red/tours/welcome.js +111 -94
  37. package/public/types/node/assert/strict.d.ts +11 -0
  38. package/public/types/node/assert.d.ts +898 -64
  39. package/public/types/node/async_hooks.d.ts +362 -94
  40. package/public/types/node/buffer.d.ts +2158 -14
  41. package/public/types/node/child_process.d.ts +1109 -257
  42. package/public/types/node/cluster.d.ts +349 -200
  43. package/public/types/node/console.d.ts +313 -43
  44. package/public/types/node/crypto.d.ts +3329 -656
  45. package/public/types/node/dgram.d.ts +459 -58
  46. package/public/types/node/diagnostics_channel.d.ts +155 -0
  47. package/public/types/node/dns/promises.d.ts +371 -0
  48. package/public/types/node/dns.d.ts +532 -265
  49. package/public/types/node/domain.d.ts +159 -16
  50. package/public/types/node/events.d.ts +589 -30
  51. package/public/types/node/fs/promises.d.ts +1097 -0
  52. package/public/types/node/fs.d.ts +2484 -958
  53. package/public/types/node/globals.d.ts +43 -503
  54. package/public/types/node/http.d.ts +1156 -145
  55. package/public/types/node/http2.d.ts +1610 -470
  56. package/public/types/node/https.d.ts +462 -72
  57. package/public/types/node/module.d.ts +72 -13
  58. package/public/types/node/net.d.ts +663 -131
  59. package/public/types/node/os.d.ts +238 -25
  60. package/public/types/node/path.d.ts +57 -23
  61. package/public/types/node/perf_hooks.d.ts +424 -112
  62. package/public/types/node/process.d.ts +1261 -193
  63. package/public/types/node/querystring.d.ts +107 -7
  64. package/public/types/node/readline.d.ts +443 -74
  65. package/public/types/node/stream/consumers.d.ts +15 -0
  66. package/public/types/node/stream/promises.d.ts +45 -0
  67. package/public/types/node/stream/web.d.ts +395 -0
  68. package/public/types/node/stream.d.ts +1081 -177
  69. package/public/types/node/string_decoder.d.ts +57 -0
  70. package/public/types/node/test.d.ts +193 -0
  71. package/public/types/node/timers/promises.d.ts +96 -0
  72. package/public/types/node/timers.d.ts +87 -12
  73. package/public/types/node/tls.d.ts +457 -222
  74. package/public/types/node/trace_events.d.ts +107 -10
  75. package/public/types/node/tty.d.ts +158 -23
  76. package/public/types/node/url.d.ts +734 -28
  77. package/public/types/node/util.d.ts +1542 -164
  78. package/public/types/node/v8.d.ts +261 -73
  79. package/public/types/node/vm.d.ts +384 -32
  80. package/public/types/node/wasi.d.ts +92 -23
  81. package/public/types/node/worker_threads.d.ts +531 -123
  82. package/public/types/node/zlib.d.ts +216 -63
  83. package/public/types/node-red/func.d.ts +3 -0
  84. package/public/vendor/jquery/css/base/images/ui-icons_444444_256x240.png +0 -0
  85. package/public/vendor/jquery/css/base/images/ui-icons_555555_256x240.png +0 -0
  86. package/public/vendor/jquery/css/base/images/ui-icons_777620_256x240.png +0 -0
  87. package/public/vendor/jquery/css/base/images/ui-icons_777777_256x240.png +0 -0
  88. package/public/vendor/jquery/css/base/images/ui-icons_cc0000_256x240.png +0 -0
  89. package/public/vendor/jquery/css/base/images/ui-icons_ffffff_256x240.png +0 -0
  90. package/public/vendor/jquery/css/base/jquery-ui.min.css +4 -4
  91. package/public/vendor/mermaid/mermaid.min.js +1284 -0
  92. package/public/vendor/monaco/dist/{ade705761eb7e702770d.ttf → 7064e66c3890a12c47b4.ttf} +0 -0
  93. package/public/vendor/monaco/dist/css.worker.js +1 -1
  94. package/public/vendor/monaco/dist/css.worker.js.LICENSE.txt +1 -1
  95. package/public/vendor/monaco/dist/editor.js +1 -1
  96. package/public/vendor/monaco/dist/editor.js.LICENSE.txt +5 -1
  97. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  98. package/public/vendor/monaco/dist/html.worker.js +1 -1
  99. package/public/vendor/monaco/dist/html.worker.js.LICENSE.txt +1 -1
  100. package/public/vendor/monaco/dist/json.worker.js +1 -1
  101. package/public/vendor/monaco/dist/json.worker.js.LICENSE.txt +1 -1
  102. package/public/vendor/monaco/dist/locale/cs.js +319 -71
  103. package/public/vendor/monaco/dist/locale/de.js +323 -75
  104. package/public/vendor/monaco/dist/locale/es.js +318 -70
  105. package/public/vendor/monaco/dist/locale/fr.js +327 -79
  106. package/public/vendor/monaco/dist/locale/it.js +325 -77
  107. package/public/vendor/monaco/dist/locale/ja.js +337 -89
  108. package/public/vendor/monaco/dist/locale/ko.js +324 -76
  109. package/public/vendor/monaco/dist/locale/pl.js +322 -74
  110. package/public/vendor/monaco/dist/locale/pt-br.js +321 -73
  111. package/public/vendor/monaco/dist/locale/qps-ploc.js +1580 -1332
  112. package/public/vendor/monaco/dist/locale/ru.js +324 -76
  113. package/public/vendor/monaco/dist/locale/tr.js +326 -78
  114. package/public/vendor/monaco/dist/locale/zh-hans.js +328 -80
  115. package/public/vendor/monaco/dist/locale/zh-hant.js +321 -73
  116. package/public/vendor/monaco/dist/theme/forge.json +236 -0
  117. package/public/vendor/monaco/dist/theme/github-dark.json +348 -0
  118. package/public/vendor/monaco/dist/theme/github-light.json +348 -0
  119. package/public/vendor/monaco/dist/theme/nord.json +93 -0
  120. package/public/vendor/monaco/dist/ts.worker.js +1 -1
  121. package/public/vendor/monaco/dist/ts.worker.js.LICENSE.txt +14 -6
  122. package/public/vendor/vendor.js +9 -15
  123. /package/public/red/tours/{images → 3.0/images}/continuous-search.png +0 -0
  124. /package/public/red/tours/{images → 3.0/images}/debug-path-tooltip.png +0 -0
  125. /package/public/red/tours/{images → 3.0/images}/junction-quick-add.png +0 -0
  126. /package/public/red/tours/{images → 3.0/images}/junction-slice.gif +0 -0
  127. /package/public/red/tours/{images → 3.0/images}/split-wire-with-links.gif +0 -0
@@ -1,92 +1,192 @@
1
1
 
2
2
  /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/Steve-Mcl/monaco-editor-esm-i18n */
3
3
 
4
+ /**
5
+ * 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
6
+ * Node.js-specific performance measurements.
7
+ *
8
+ * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):
9
+ *
10
+ * * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
11
+ * * [Performance Timeline](https://w3c.github.io/performance-timeline/)
12
+ * * [User Timing](https://www.w3.org/TR/user-timing/)
13
+ *
14
+ * ```js
15
+ * const { PerformanceObserver, performance } = require('perf_hooks');
16
+ *
17
+ * const obs = new PerformanceObserver((items) => {
18
+ * console.log(items.getEntries()[0].duration);
19
+ * performance.clearMarks();
20
+ * });
21
+ * obs.observe({ type: 'measure' });
22
+ * performance.measure('Start to Now');
23
+ *
24
+ * performance.mark('A');
25
+ * doSomeLongRunningProcess(() => {
26
+ * performance.measure('A to Now', 'A');
27
+ *
28
+ * performance.mark('B');
29
+ * performance.measure('A to B', 'A', 'B');
30
+ * });
31
+ * ```
32
+ * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/perf_hooks.js)
33
+ */
4
34
  declare module 'perf_hooks' {
5
- import { AsyncResource } from 'async_hooks';
6
-
35
+ import { AsyncResource } from 'node:async_hooks';
7
36
  type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
8
-
9
- interface PerformanceEntry {
37
+ interface NodeGCPerformanceDetail {
38
+ /**
39
+ * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
40
+ * the type of garbage collection operation that occurred.
41
+ * See perf_hooks.constants for valid values.
42
+ */
43
+ readonly kind?: number | undefined;
44
+ /**
45
+ * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
46
+ * property contains additional information about garbage collection operation.
47
+ * See perf_hooks.constants for valid values.
48
+ */
49
+ readonly flags?: number | undefined;
50
+ }
51
+ /**
52
+ * @since v8.5.0
53
+ */
54
+ class PerformanceEntry {
55
+ protected constructor();
10
56
  /**
11
- * The total number of milliseconds elapsed for this entry.
12
- * This value will not be meaningful for all Performance Entry types.
57
+ * The total number of milliseconds elapsed for this entry. This value will not
58
+ * be meaningful for all Performance Entry types.
59
+ * @since v8.5.0
13
60
  */
14
61
  readonly duration: number;
15
-
16
62
  /**
17
63
  * The name of the performance entry.
64
+ * @since v8.5.0
18
65
  */
19
66
  readonly name: string;
20
-
21
67
  /**
22
- * The high resolution millisecond timestamp marking the starting time of the Performance Entry.
68
+ * The high resolution millisecond timestamp marking the starting time of the
69
+ * Performance Entry.
70
+ * @since v8.5.0
23
71
  */
24
72
  readonly startTime: number;
25
-
26
73
  /**
27
- * The type of the performance entry.
28
- * Currently it may be one of: 'node', 'mark', 'measure', 'gc', or 'function'.
74
+ * The type of the performance entry. It may be one of:
75
+ *
76
+ * * `'node'` (Node.js only)
77
+ * * `'mark'` (available on the Web)
78
+ * * `'measure'` (available on the Web)
79
+ * * `'gc'` (Node.js only)
80
+ * * `'function'` (Node.js only)
81
+ * * `'http2'` (Node.js only)
82
+ * * `'http'` (Node.js only)
83
+ * @since v8.5.0
29
84
  */
30
85
  readonly entryType: EntryType;
31
-
32
86
  /**
33
- * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
34
- * the type of garbage collection operation that occurred.
35
- * See perf_hooks.constants for valid values.
36
- */
37
- readonly kind?: number | undefined;
38
-
39
- /**
40
- * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
41
- * property contains additional information about garbage collection operation.
42
- * See perf_hooks.constants for valid values.
87
+ * Additional detail specific to the `entryType`.
88
+ * @since v16.0.0
43
89
  */
44
- readonly flags?: number | undefined;
90
+ readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
45
91
  }
46
-
47
- interface PerformanceNodeTiming extends PerformanceEntry {
48
- /**
49
- * The high resolution millisecond timestamp at which the Node.js process completed bootstrap.
92
+ /**
93
+ * _This property is an extension by Node.js. It is not available in Web browsers._
94
+ *
95
+ * Provides timing details for Node.js itself. The constructor of this class
96
+ * is not exposed to users.
97
+ * @since v8.5.0
98
+ */
99
+ class PerformanceNodeTiming extends PerformanceEntry {
100
+ /**
101
+ * The high resolution millisecond timestamp at which the Node.js process
102
+ * completed bootstrapping. If bootstrapping has not yet finished, the property
103
+ * has the value of -1.
104
+ * @since v8.5.0
50
105
  */
51
106
  readonly bootstrapComplete: number;
52
-
53
107
  /**
54
- * The high resolution millisecond timestamp at which the Node.js process completed bootstrapping.
55
- * If bootstrapping has not yet finished, the property has the value of -1.
108
+ * The high resolution millisecond timestamp at which the Node.js environment was
109
+ * initialized.
110
+ * @since v8.5.0
56
111
  */
57
112
  readonly environment: number;
58
-
59
113
  /**
60
- * The high resolution millisecond timestamp at which the Node.js environment was initialized.
114
+ * The high resolution millisecond timestamp of the amount of time the event loop
115
+ * has been idle within the event loop's event provider (e.g. `epoll_wait`). This
116
+ * does not take CPU usage into consideration. If the event loop has not yet
117
+ * started (e.g., in the first tick of the main script), the property has the
118
+ * value of 0.
119
+ * @since v14.10.0, v12.19.0
61
120
  */
62
121
  readonly idleTime: number;
63
-
64
122
  /**
65
- * The high resolution millisecond timestamp of the amount of time the event loop has been idle
66
- * within the event loop's event provider (e.g. `epoll_wait`). This does not take CPU usage
67
- * into consideration. If the event loop has not yet started (e.g., in the first tick of the main script),
68
- * the property has the value of 0.
123
+ * The high resolution millisecond timestamp at which the Node.js event loop
124
+ * exited. If the event loop has not yet exited, the property has the value of -1\.
125
+ * It can only have a value of not -1 in a handler of the `'exit'` event.
126
+ * @since v8.5.0
69
127
  */
70
128
  readonly loopExit: number;
71
-
72
129
  /**
73
- * The high resolution millisecond timestamp at which the Node.js event loop started.
74
- * If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of -1.
130
+ * The high resolution millisecond timestamp at which the Node.js event loop
131
+ * started. If the event loop has not yet started (e.g., in the first tick of the
132
+ * main script), the property has the value of -1.
133
+ * @since v8.5.0
75
134
  */
76
135
  readonly loopStart: number;
77
-
78
136
  /**
79
- * The high resolution millisecond timestamp at which the V8 platform was initialized.
137
+ * The high resolution millisecond timestamp at which the V8 platform was
138
+ * initialized.
139
+ * @since v8.5.0
80
140
  */
81
141
  readonly v8Start: number;
82
142
  }
83
-
84
143
  interface EventLoopUtilization {
85
144
  idle: number;
86
145
  active: number;
87
146
  utilization: number;
88
147
  }
89
-
148
+ /**
149
+ * @param util1 The result of a previous call to eventLoopUtilization()
150
+ * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
151
+ */
152
+ type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
153
+ interface MarkOptions {
154
+ /**
155
+ * Additional optional detail to include with the mark.
156
+ */
157
+ detail?: unknown | undefined;
158
+ /**
159
+ * An optional timestamp to be used as the mark time.
160
+ * @default `performance.now()`.
161
+ */
162
+ startTime?: number | undefined;
163
+ }
164
+ interface MeasureOptions {
165
+ /**
166
+ * Additional optional detail to include with the mark.
167
+ */
168
+ detail?: unknown | undefined;
169
+ /**
170
+ * Duration between start and end times.
171
+ */
172
+ duration?: number | undefined;
173
+ /**
174
+ * Timestamp to be used as the end time, or a string identifying a previously recorded mark.
175
+ */
176
+ end?: number | string | undefined;
177
+ /**
178
+ * Timestamp to be used as the start time, or a string identifying a previously recorded mark.
179
+ */
180
+ start?: number | string | undefined;
181
+ }
182
+ interface TimerifyOptions {
183
+ /**
184
+ * A histogram object created using
185
+ * `perf_hooks.createHistogram()` that will record runtime durations in
186
+ * nanoseconds.
187
+ */
188
+ histogram?: RecordableHistogram | undefined;
189
+ }
90
190
  interface Performance {
91
191
  /**
92
192
  * If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
@@ -94,7 +194,35 @@ declare module 'perf_hooks' {
94
194
  * @param name
95
195
  */
96
196
  clearMarks(name?: string): void;
97
-
197
+ /**
198
+ * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
199
+ * If name is provided, removes only the named measure.
200
+ * @param name
201
+ * @since v16.7.0
202
+ */
203
+ clearMeasures(name?: string): void;
204
+ /**
205
+ * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
206
+ * If you are only interested in performance entries of certain types or that have certain names, see
207
+ * `performance.getEntriesByType()` and `performance.getEntriesByName()`.
208
+ * @since v16.7.0
209
+ */
210
+ getEntries(): PerformanceEntry[];
211
+ /**
212
+ * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
213
+ * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
214
+ * @param name
215
+ * @param type
216
+ * @since v16.7.0
217
+ */
218
+ getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
219
+ /**
220
+ * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
221
+ * whose `performanceEntry.entryType` is equal to `type`.
222
+ * @param type
223
+ * @since v16.7.0
224
+ */
225
+ getEntriesByType(type: EntryType): PerformanceEntry[];
98
226
  /**
99
227
  * Creates a new PerformanceMark entry in the Performance Timeline.
100
228
  * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark',
@@ -102,8 +230,7 @@ declare module 'perf_hooks' {
102
230
  * Performance marks are used to mark specific significant moments in the Performance Timeline.
103
231
  * @param name
104
232
  */
105
- mark(name?: string): void;
106
-
233
+ mark(name?: string, options?: MarkOptions): void;
107
234
  /**
108
235
  * Creates a new PerformanceMeasure entry in the Performance Timeline.
109
236
  * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
@@ -120,84 +247,201 @@ declare module 'perf_hooks' {
120
247
  * @param endMark
121
248
  */
122
249
  measure(name: string, startMark?: string, endMark?: string): void;
123
-
250
+ measure(name: string, options: MeasureOptions): void;
124
251
  /**
125
252
  * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
126
253
  */
127
254
  readonly nodeTiming: PerformanceNodeTiming;
128
-
129
255
  /**
130
256
  * @return the current high resolution millisecond timestamp
131
257
  */
132
258
  now(): number;
133
-
134
259
  /**
135
260
  * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured.
136
261
  */
137
262
  readonly timeOrigin: number;
138
-
139
263
  /**
140
264
  * Wraps a function within a new function that measures the running time of the wrapped function.
141
265
  * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed.
142
266
  * @param fn
143
267
  */
144
- timerify<T extends (...optionalParams: any[]) => any>(fn: T): T;
145
-
268
+ timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
146
269
  /**
147
270
  * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
148
271
  * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
149
272
  * No other CPU idle time is taken into consideration.
150
- *
151
- * @param util1 The result of a previous call to eventLoopUtilization()
152
- * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
153
273
  */
154
- eventLoopUtilization(util1?: EventLoopUtilization, util2?: EventLoopUtilization): EventLoopUtilization;
274
+ eventLoopUtilization: EventLoopUtilityFunction;
155
275
  }
156
-
157
276
  interface PerformanceObserverEntryList {
158
277
  /**
159
- * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime.
278
+ * Returns a list of `PerformanceEntry` objects in chronological order
279
+ * with respect to `performanceEntry.startTime`.
280
+ *
281
+ * ```js
282
+ * const {
283
+ * performance,
284
+ * PerformanceObserver
285
+ * } = require('perf_hooks');
286
+ *
287
+ * const obs = new PerformanceObserver((perfObserverList, observer) => {
288
+ * console.log(perfObserverList.getEntries());
289
+ *
290
+ * * [
291
+ * * PerformanceEntry {
292
+ * * name: 'test',
293
+ * * entryType: 'mark',
294
+ * * startTime: 81.465639,
295
+ * * duration: 0
296
+ * * },
297
+ * * PerformanceEntry {
298
+ * * name: 'meow',
299
+ * * entryType: 'mark',
300
+ * * startTime: 81.860064,
301
+ * * duration: 0
302
+ * * }
303
+ * * ]
304
+ *
305
+ * observer.disconnect();
306
+ * });
307
+ * obs.observe({ type: 'mark' });
308
+ *
309
+ * performance.mark('test');
310
+ * performance.mark('meow');
311
+ * ```
312
+ * @since v8.5.0
160
313
  */
161
314
  getEntries(): PerformanceEntry[];
162
-
163
315
  /**
164
- * @return a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
165
- * whose performanceEntry.name is equal to name, and optionally, whose performanceEntry.entryType is equal to type.
316
+ * Returns a list of `PerformanceEntry` objects in chronological order
317
+ * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
318
+ * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
319
+ *
320
+ * ```js
321
+ * const {
322
+ * performance,
323
+ * PerformanceObserver
324
+ * } = require('perf_hooks');
325
+ *
326
+ * const obs = new PerformanceObserver((perfObserverList, observer) => {
327
+ * console.log(perfObserverList.getEntriesByName('meow'));
328
+ *
329
+ * * [
330
+ * * PerformanceEntry {
331
+ * * name: 'meow',
332
+ * * entryType: 'mark',
333
+ * * startTime: 98.545991,
334
+ * * duration: 0
335
+ * * }
336
+ * * ]
337
+ *
338
+ * console.log(perfObserverList.getEntriesByName('nope')); // []
339
+ *
340
+ * console.log(perfObserverList.getEntriesByName('test', 'mark'));
341
+ *
342
+ * * [
343
+ * * PerformanceEntry {
344
+ * * name: 'test',
345
+ * * entryType: 'mark',
346
+ * * startTime: 63.518931,
347
+ * * duration: 0
348
+ * * }
349
+ * * ]
350
+ *
351
+ * console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
352
+ * observer.disconnect();
353
+ * });
354
+ * obs.observe({ entryTypes: ['mark', 'measure'] });
355
+ *
356
+ * performance.mark('test');
357
+ * performance.mark('meow');
358
+ * ```
359
+ * @since v8.5.0
166
360
  */
167
361
  getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
168
-
169
362
  /**
170
- * @return Returns a list of PerformanceEntry objects in chronological order with respect to performanceEntry.startTime
171
- * whose performanceEntry.entryType is equal to type.
363
+ * Returns a list of `PerformanceEntry` objects in chronological order
364
+ * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`.
365
+ *
366
+ * ```js
367
+ * const {
368
+ * performance,
369
+ * PerformanceObserver
370
+ * } = require('perf_hooks');
371
+ *
372
+ * const obs = new PerformanceObserver((perfObserverList, observer) => {
373
+ * console.log(perfObserverList.getEntriesByType('mark'));
374
+ *
375
+ * * [
376
+ * * PerformanceEntry {
377
+ * * name: 'test',
378
+ * * entryType: 'mark',
379
+ * * startTime: 55.897834,
380
+ * * duration: 0
381
+ * * },
382
+ * * PerformanceEntry {
383
+ * * name: 'meow',
384
+ * * entryType: 'mark',
385
+ * * startTime: 56.350146,
386
+ * * duration: 0
387
+ * * }
388
+ * * ]
389
+ *
390
+ * observer.disconnect();
391
+ * });
392
+ * obs.observe({ type: 'mark' });
393
+ *
394
+ * performance.mark('test');
395
+ * performance.mark('meow');
396
+ * ```
397
+ * @since v8.5.0
172
398
  */
173
399
  getEntriesByType(type: EntryType): PerformanceEntry[];
174
400
  }
175
-
176
401
  type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
177
-
178
402
  class PerformanceObserver extends AsyncResource {
179
403
  constructor(callback: PerformanceObserverCallback);
180
-
181
404
  /**
182
- * Disconnects the PerformanceObserver instance from all notifications.
405
+ * Disconnects the `PerformanceObserver` instance from all notifications.
406
+ * @since v8.5.0
183
407
  */
184
408
  disconnect(): void;
185
-
186
409
  /**
187
- * Subscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified by options.entryTypes.
188
- * When options.buffered is false, the callback will be invoked once for every PerformanceEntry instance.
189
- * Property buffered defaults to false.
190
- * @param options
191
- */
192
- observe(options: { entryTypes: ReadonlyArray<EntryType>; buffered?: boolean | undefined }): void;
410
+ * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`:
411
+ *
412
+ * ```js
413
+ * const {
414
+ * performance,
415
+ * PerformanceObserver
416
+ * } = require('perf_hooks');
417
+ *
418
+ * const obs = new PerformanceObserver((list, observer) => {
419
+ * // Called three times synchronously. `list` contains one item.
420
+ * });
421
+ * obs.observe({ type: 'mark' });
422
+ *
423
+ * for (let n = 0; n < 3; n++)
424
+ * performance.mark(`test${n}`);
425
+ * ```
426
+ * @since v8.5.0
427
+ */
428
+ observe(
429
+ options:
430
+ | {
431
+ entryTypes: ReadonlyArray<EntryType>;
432
+ buffered?: boolean | undefined;
433
+ }
434
+ | {
435
+ type: EntryType;
436
+ buffered?: boolean | undefined;
437
+ }
438
+ ): void;
193
439
  }
194
-
195
440
  namespace constants {
196
441
  const NODE_PERFORMANCE_GC_MAJOR: number;
197
442
  const NODE_PERFORMANCE_GC_MINOR: number;
198
443
  const NODE_PERFORMANCE_GC_INCREMENTAL: number;
199
444
  const NODE_PERFORMANCE_GC_WEAKCB: number;
200
-
201
445
  const NODE_PERFORMANCE_GC_FLAGS_NO: number;
202
446
  const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
203
447
  const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
@@ -206,9 +450,7 @@ declare module 'perf_hooks' {
206
450
  const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
207
451
  const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
208
452
  }
209
-
210
453
  const performance: Performance;
211
-
212
454
  interface EventLoopMonitorOptions {
213
455
  /**
214
456
  * The sampling rate in milliseconds.
@@ -217,60 +459,130 @@ declare module 'perf_hooks' {
217
459
  */
218
460
  resolution?: number | undefined;
219
461
  }
220
-
221
- interface EventLoopDelayMonitor {
222
- /**
223
- * Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started.
224
- */
225
- enable(): boolean;
226
- /**
227
- * Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped.
228
- */
229
- disable(): boolean;
230
-
231
- /**
232
- * Resets the collected histogram data.
233
- */
234
- reset(): void;
235
-
236
- /**
237
- * Returns the value at the given percentile.
238
- * @param percentile A percentile value between 1 and 100.
239
- */
240
- percentile(percentile: number): number;
241
-
462
+ interface Histogram {
242
463
  /**
243
- * A `Map` object detailing the accumulated percentile distribution.
464
+ * Returns a `Map` object detailing the accumulated percentile distribution.
465
+ * @since v11.10.0
244
466
  */
245
467
  readonly percentiles: Map<number, number>;
246
-
247
468
  /**
248
- * The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold.
469
+ * The number of times the event loop delay exceeded the maximum 1 hour event
470
+ * loop delay threshold.
471
+ * @since v11.10.0
249
472
  */
250
473
  readonly exceeds: number;
251
-
252
474
  /**
253
475
  * The minimum recorded event loop delay.
476
+ * @since v11.10.0
254
477
  */
255
478
  readonly min: number;
256
-
257
479
  /**
258
480
  * The maximum recorded event loop delay.
481
+ * @since v11.10.0
259
482
  */
260
483
  readonly max: number;
261
-
262
484
  /**
263
485
  * The mean of the recorded event loop delays.
486
+ * @since v11.10.0
264
487
  */
265
488
  readonly mean: number;
266
-
267
489
  /**
268
490
  * The standard deviation of the recorded event loop delays.
491
+ * @since v11.10.0
269
492
  */
270
493
  readonly stddev: number;
494
+ /**
495
+ * Resets the collected histogram data.
496
+ * @since v11.10.0
497
+ */
498
+ reset(): void;
499
+ /**
500
+ * Returns the value at the given percentile.
501
+ * @since v11.10.0
502
+ * @param percentile A percentile value in the range (0, 100].
503
+ */
504
+ percentile(percentile: number): number;
271
505
  }
272
-
273
- function monitorEventLoopDelay(options?: EventLoopMonitorOptions): EventLoopDelayMonitor;
506
+ interface IntervalHistogram extends Histogram {
507
+ /**
508
+ * Enables the update interval timer. Returns `true` if the timer was
509
+ * started, `false` if it was already started.
510
+ * @since v11.10.0
511
+ */
512
+ enable(): boolean;
513
+ /**
514
+ * Disables the update interval timer. Returns `true` if the timer was
515
+ * stopped, `false` if it was already stopped.
516
+ * @since v11.10.0
517
+ */
518
+ disable(): boolean;
519
+ }
520
+ interface RecordableHistogram extends Histogram {
521
+ /**
522
+ * @since v15.9.0
523
+ * @param val The amount to record in the histogram.
524
+ */
525
+ record(val: number | bigint): void;
526
+ /**
527
+ * Calculates the amount of time (in nanoseconds) that has passed since the
528
+ * previous call to `recordDelta()` and records that amount in the histogram.
529
+ *
530
+ * ## Examples
531
+ * @since v15.9.0
532
+ */
533
+ recordDelta(): void;
534
+ }
535
+ /**
536
+ * _This property is an extension by Node.js. It is not available in Web browsers._
537
+ *
538
+ * Creates an `IntervalHistogram` object that samples and reports the event loop
539
+ * delay over time. The delays will be reported in nanoseconds.
540
+ *
541
+ * Using a timer to detect approximate event loop delay works because the
542
+ * execution of timers is tied specifically to the lifecycle of the libuv
543
+ * event loop. That is, a delay in the loop will cause a delay in the execution
544
+ * of the timer, and those delays are specifically what this API is intended to
545
+ * detect.
546
+ *
547
+ * ```js
548
+ * const { monitorEventLoopDelay } = require('perf_hooks');
549
+ * const h = monitorEventLoopDelay({ resolution: 20 });
550
+ * h.enable();
551
+ * // Do something.
552
+ * h.disable();
553
+ * console.log(h.min);
554
+ * console.log(h.max);
555
+ * console.log(h.mean);
556
+ * console.log(h.stddev);
557
+ * console.log(h.percentiles);
558
+ * console.log(h.percentile(50));
559
+ * console.log(h.percentile(99));
560
+ * ```
561
+ * @since v11.10.0
562
+ */
563
+ function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
564
+ interface CreateHistogramOptions {
565
+ /**
566
+ * The minimum recordable value. Must be an integer value greater than 0.
567
+ * @default 1
568
+ */
569
+ min?: number | bigint | undefined;
570
+ /**
571
+ * The maximum recordable value. Must be an integer value greater than min.
572
+ * @default Number.MAX_SAFE_INTEGER
573
+ */
574
+ max?: number | bigint | undefined;
575
+ /**
576
+ * The number of accuracy digits. Must be a number between 1 and 5.
577
+ * @default 3
578
+ */
579
+ figures?: number | undefined;
580
+ }
581
+ /**
582
+ * Returns a `RecordableHistogram`.
583
+ * @since v15.9.0
584
+ */
585
+ function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
274
586
  }
275
587
  declare module 'node:perf_hooks' {
276
588
  export * from 'perf_hooks';