瀏覽代碼

Initial nodered configuration

dashboard2
Dirk Alders 1 年之前
父節點
當前提交
6b28a8b302
共有 100 個文件被更改,包括 79973 次插入0 次删除
  1. 798
    0
      .config.nodes.json
  2. 798
    0
      .config.nodes.json.backup
  3. 3
    0
      .config.runtime.json
  4. 26
    0
      .config.users.json
  5. 26
    0
      .config.users.json.backup
  6. 10252
    0
      .flows.json.backup
  7. 3
    0
      .flows_cred.json.backup
  8. 3
    0
      .gitignore
  9. 10252
    0
      flows.json
  10. 3
    0
      flows_cred.json
  11. 44
    0
      lib/functions/Heatfunction.js
  12. 1
    0
      node_modules/.bin/mime
  13. 617
    0
      node_modules/.package-lock.json
  14. 24
    0
      node_modules/@socket.io/component-emitter/LICENSE
  15. 74
    0
      node_modules/@socket.io/component-emitter/Readme.md
  16. 179
    0
      node_modules/@socket.io/component-emitter/index.d.ts
  17. 176
    0
      node_modules/@socket.io/component-emitter/index.js
  18. 169
    0
      node_modules/@socket.io/component-emitter/index.mjs
  19. 31
    0
      node_modules/@socket.io/component-emitter/package.json
  20. 21
    0
      node_modules/@types/cookie/LICENSE
  21. 16
    0
      node_modules/@types/cookie/README.md
  22. 135
    0
      node_modules/@types/cookie/index.d.ts
  23. 30
    0
      node_modules/@types/cookie/package.json
  24. 21
    0
      node_modules/@types/cors/LICENSE
  25. 78
    0
      node_modules/@types/cors/README.md
  26. 58
    0
      node_modules/@types/cors/index.d.ts
  27. 30
    0
      node_modules/@types/cors/package.json
  28. 21
    0
      node_modules/@types/node/LICENSE
  29. 16
    0
      node_modules/@types/node/README.md
  30. 911
    0
      node_modules/@types/node/assert.d.ts
  31. 8
    0
      node_modules/@types/node/assert/strict.d.ts
  32. 501
    0
      node_modules/@types/node/async_hooks.d.ts
  33. 2258
    0
      node_modules/@types/node/buffer.d.ts
  34. 1369
    0
      node_modules/@types/node/child_process.d.ts
  35. 410
    0
      node_modules/@types/node/cluster.d.ts
  36. 412
    0
      node_modules/@types/node/console.d.ts
  37. 18
    0
      node_modules/@types/node/constants.d.ts
  38. 3964
    0
      node_modules/@types/node/crypto.d.ts
  39. 545
    0
      node_modules/@types/node/dgram.d.ts
  40. 153
    0
      node_modules/@types/node/diagnostics_channel.d.ts
  41. 659
    0
      node_modules/@types/node/dns.d.ts
  42. 370
    0
      node_modules/@types/node/dns/promises.d.ts
  43. 126
    0
      node_modules/@types/node/dom-events.d.ts
  44. 170
    0
      node_modules/@types/node/domain.d.ts
  45. 678
    0
      node_modules/@types/node/events.d.ts
  46. 3872
    0
      node_modules/@types/node/fs.d.ts
  47. 1138
    0
      node_modules/@types/node/fs/promises.d.ts
  48. 296
    0
      node_modules/@types/node/globals.d.ts
  49. 1
    0
      node_modules/@types/node/globals.global.d.ts
  50. 1607
    0
      node_modules/@types/node/http.d.ts
  51. 2134
    0
      node_modules/@types/node/http2.d.ts
  52. 541
    0
      node_modules/@types/node/https.d.ts
  53. 133
    0
      node_modules/@types/node/index.d.ts
  54. 2741
    0
      node_modules/@types/node/inspector.d.ts
  55. 114
    0
      node_modules/@types/node/module.d.ts
  56. 869
    0
      node_modules/@types/node/net.d.ts
  57. 466
    0
      node_modules/@types/node/os.d.ts
  58. 232
    0
      node_modules/@types/node/package.json
  59. 191
    0
      node_modules/@types/node/path.d.ts
  60. 625
    0
      node_modules/@types/node/perf_hooks.d.ts
  61. 1482
    0
      node_modules/@types/node/process.d.ts
  62. 117
    0
      node_modules/@types/node/punycode.d.ts
  63. 131
    0
      node_modules/@types/node/querystring.d.ts
  64. 653
    0
      node_modules/@types/node/readline.d.ts
  65. 143
    0
      node_modules/@types/node/readline/promises.d.ts
  66. 424
    0
      node_modules/@types/node/repl.d.ts
  67. 1340
    0
      node_modules/@types/node/stream.d.ts
  68. 12
    0
      node_modules/@types/node/stream/consumers.d.ts
  69. 42
    0
      node_modules/@types/node/stream/promises.d.ts
  70. 330
    0
      node_modules/@types/node/stream/web.d.ts
  71. 67
    0
      node_modules/@types/node/string_decoder.d.ts
  72. 314
    0
      node_modules/@types/node/test.d.ts
  73. 94
    0
      node_modules/@types/node/timers.d.ts
  74. 68
    0
      node_modules/@types/node/timers/promises.d.ts
  75. 1028
    0
      node_modules/@types/node/tls.d.ts
  76. 171
    0
      node_modules/@types/node/trace_events.d.ts
  77. 911
    0
      node_modules/@types/node/ts4.8/assert.d.ts
  78. 8
    0
      node_modules/@types/node/ts4.8/assert/strict.d.ts
  79. 501
    0
      node_modules/@types/node/ts4.8/async_hooks.d.ts
  80. 2259
    0
      node_modules/@types/node/ts4.8/buffer.d.ts
  81. 1369
    0
      node_modules/@types/node/ts4.8/child_process.d.ts
  82. 410
    0
      node_modules/@types/node/ts4.8/cluster.d.ts
  83. 412
    0
      node_modules/@types/node/ts4.8/console.d.ts
  84. 18
    0
      node_modules/@types/node/ts4.8/constants.d.ts
  85. 3964
    0
      node_modules/@types/node/ts4.8/crypto.d.ts
  86. 545
    0
      node_modules/@types/node/ts4.8/dgram.d.ts
  87. 153
    0
      node_modules/@types/node/ts4.8/diagnostics_channel.d.ts
  88. 659
    0
      node_modules/@types/node/ts4.8/dns.d.ts
  89. 370
    0
      node_modules/@types/node/ts4.8/dns/promises.d.ts
  90. 126
    0
      node_modules/@types/node/ts4.8/dom-events.d.ts
  91. 170
    0
      node_modules/@types/node/ts4.8/domain.d.ts
  92. 678
    0
      node_modules/@types/node/ts4.8/events.d.ts
  93. 3872
    0
      node_modules/@types/node/ts4.8/fs.d.ts
  94. 1138
    0
      node_modules/@types/node/ts4.8/fs/promises.d.ts
  95. 294
    0
      node_modules/@types/node/ts4.8/globals.d.ts
  96. 1
    0
      node_modules/@types/node/ts4.8/globals.global.d.ts
  97. 1607
    0
      node_modules/@types/node/ts4.8/http.d.ts
  98. 2134
    0
      node_modules/@types/node/ts4.8/http2.d.ts
  99. 541
    0
      node_modules/@types/node/ts4.8/https.d.ts
  100. 0
    0
      node_modules/@types/node/ts4.8/index.d.ts

+ 798
- 0
.config.nodes.json 查看文件

@@ -0,0 +1,798 @@
1
+{
2
+    "node-red": {
3
+        "name": "node-red",
4
+        "version": "3.0.2",
5
+        "local": false,
6
+        "user": false,
7
+        "nodes": {
8
+            "junction": {
9
+                "name": "junction",
10
+                "types": [
11
+                    "junction"
12
+                ],
13
+                "enabled": true,
14
+                "local": false,
15
+                "user": false,
16
+                "module": "node-red",
17
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/05-junction.js"
18
+            },
19
+            "inject": {
20
+                "name": "inject",
21
+                "types": [
22
+                    "inject"
23
+                ],
24
+                "enabled": true,
25
+                "local": false,
26
+                "user": false,
27
+                "module": "node-red",
28
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/20-inject.js"
29
+            },
30
+            "debug": {
31
+                "name": "debug",
32
+                "types": [
33
+                    "debug"
34
+                ],
35
+                "enabled": true,
36
+                "local": false,
37
+                "user": false,
38
+                "module": "node-red",
39
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/21-debug.js"
40
+            },
41
+            "complete": {
42
+                "name": "complete",
43
+                "types": [
44
+                    "complete"
45
+                ],
46
+                "enabled": true,
47
+                "local": false,
48
+                "user": false,
49
+                "module": "node-red",
50
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/24-complete.js"
51
+            },
52
+            "catch": {
53
+                "name": "catch",
54
+                "types": [
55
+                    "catch"
56
+                ],
57
+                "enabled": true,
58
+                "local": false,
59
+                "user": false,
60
+                "module": "node-red",
61
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/25-catch.js"
62
+            },
63
+            "status": {
64
+                "name": "status",
65
+                "types": [
66
+                    "status"
67
+                ],
68
+                "enabled": true,
69
+                "local": false,
70
+                "user": false,
71
+                "module": "node-red",
72
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/25-status.js"
73
+            },
74
+            "link": {
75
+                "name": "link",
76
+                "types": [
77
+                    "link in",
78
+                    "link out",
79
+                    "link call"
80
+                ],
81
+                "enabled": true,
82
+                "local": false,
83
+                "user": false,
84
+                "module": "node-red",
85
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/60-link.js"
86
+            },
87
+            "comment": {
88
+                "name": "comment",
89
+                "types": [
90
+                    "comment"
91
+                ],
92
+                "enabled": true,
93
+                "local": false,
94
+                "user": false,
95
+                "module": "node-red",
96
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/90-comment.js"
97
+            },
98
+            "unknown": {
99
+                "name": "unknown",
100
+                "types": [
101
+                    "unknown"
102
+                ],
103
+                "enabled": true,
104
+                "local": false,
105
+                "user": false,
106
+                "module": "node-red",
107
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/common/98-unknown.js"
108
+            },
109
+            "function": {
110
+                "name": "function",
111
+                "types": [
112
+                    "function"
113
+                ],
114
+                "enabled": true,
115
+                "local": false,
116
+                "user": false,
117
+                "module": "node-red",
118
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/10-function.js"
119
+            },
120
+            "switch": {
121
+                "name": "switch",
122
+                "types": [
123
+                    "switch"
124
+                ],
125
+                "enabled": true,
126
+                "local": false,
127
+                "user": false,
128
+                "module": "node-red",
129
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/10-switch.js"
130
+            },
131
+            "change": {
132
+                "name": "change",
133
+                "types": [
134
+                    "change"
135
+                ],
136
+                "enabled": true,
137
+                "local": false,
138
+                "user": false,
139
+                "module": "node-red",
140
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/15-change.js"
141
+            },
142
+            "range": {
143
+                "name": "range",
144
+                "types": [
145
+                    "range"
146
+                ],
147
+                "enabled": true,
148
+                "local": false,
149
+                "user": false,
150
+                "module": "node-red",
151
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/16-range.js"
152
+            },
153
+            "template": {
154
+                "name": "template",
155
+                "types": [
156
+                    "template"
157
+                ],
158
+                "enabled": true,
159
+                "local": false,
160
+                "user": false,
161
+                "module": "node-red",
162
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/80-template.js"
163
+            },
164
+            "delay": {
165
+                "name": "delay",
166
+                "types": [
167
+                    "delay"
168
+                ],
169
+                "enabled": true,
170
+                "local": false,
171
+                "user": false,
172
+                "module": "node-red",
173
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/89-delay.js"
174
+            },
175
+            "trigger": {
176
+                "name": "trigger",
177
+                "types": [
178
+                    "trigger"
179
+                ],
180
+                "enabled": true,
181
+                "local": false,
182
+                "user": false,
183
+                "module": "node-red",
184
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/89-trigger.js"
185
+            },
186
+            "exec": {
187
+                "name": "exec",
188
+                "types": [
189
+                    "exec"
190
+                ],
191
+                "enabled": true,
192
+                "local": false,
193
+                "user": false,
194
+                "module": "node-red",
195
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/90-exec.js"
196
+            },
197
+            "rbe": {
198
+                "name": "rbe",
199
+                "types": [
200
+                    "rbe"
201
+                ],
202
+                "enabled": true,
203
+                "local": false,
204
+                "user": false,
205
+                "module": "node-red",
206
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/function/rbe.js"
207
+            },
208
+            "tls": {
209
+                "name": "tls",
210
+                "types": [
211
+                    "tls-config"
212
+                ],
213
+                "enabled": true,
214
+                "local": false,
215
+                "user": false,
216
+                "module": "node-red",
217
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/05-tls.js"
218
+            },
219
+            "httpproxy": {
220
+                "name": "httpproxy",
221
+                "types": [
222
+                    "http proxy"
223
+                ],
224
+                "enabled": true,
225
+                "local": false,
226
+                "user": false,
227
+                "module": "node-red",
228
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/06-httpproxy.js"
229
+            },
230
+            "mqtt": {
231
+                "name": "mqtt",
232
+                "types": [
233
+                    "mqtt in",
234
+                    "mqtt out",
235
+                    "mqtt-broker"
236
+                ],
237
+                "enabled": true,
238
+                "local": false,
239
+                "user": false,
240
+                "module": "node-red",
241
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js"
242
+            },
243
+            "httpin": {
244
+                "name": "httpin",
245
+                "types": [
246
+                    "http in",
247
+                    "http response"
248
+                ],
249
+                "enabled": true,
250
+                "local": false,
251
+                "user": false,
252
+                "module": "node-red",
253
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/21-httpin.js"
254
+            },
255
+            "httprequest": {
256
+                "name": "httprequest",
257
+                "types": [
258
+                    "http request"
259
+                ],
260
+                "enabled": true,
261
+                "local": false,
262
+                "user": false,
263
+                "module": "node-red",
264
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/21-httprequest.js"
265
+            },
266
+            "websocket": {
267
+                "name": "websocket",
268
+                "types": [
269
+                    "websocket in",
270
+                    "websocket out",
271
+                    "websocket-listener",
272
+                    "websocket-client"
273
+                ],
274
+                "enabled": true,
275
+                "local": false,
276
+                "user": false,
277
+                "module": "node-red",
278
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/22-websocket.js"
279
+            },
280
+            "tcpin": {
281
+                "name": "tcpin",
282
+                "types": [
283
+                    "tcp in",
284
+                    "tcp out",
285
+                    "tcp request"
286
+                ],
287
+                "enabled": true,
288
+                "local": false,
289
+                "user": false,
290
+                "module": "node-red",
291
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/31-tcpin.js"
292
+            },
293
+            "udp": {
294
+                "name": "udp",
295
+                "types": [
296
+                    "udp in",
297
+                    "udp out"
298
+                ],
299
+                "enabled": true,
300
+                "local": false,
301
+                "user": false,
302
+                "module": "node-red",
303
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/network/32-udp.js"
304
+            },
305
+            "CSV": {
306
+                "name": "CSV",
307
+                "types": [
308
+                    "csv"
309
+                ],
310
+                "enabled": true,
311
+                "local": false,
312
+                "user": false,
313
+                "module": "node-red",
314
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-CSV.js"
315
+            },
316
+            "HTML": {
317
+                "name": "HTML",
318
+                "types": [
319
+                    "html"
320
+                ],
321
+                "enabled": true,
322
+                "local": false,
323
+                "user": false,
324
+                "module": "node-red",
325
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-HTML.js"
326
+            },
327
+            "JSON": {
328
+                "name": "JSON",
329
+                "types": [
330
+                    "json"
331
+                ],
332
+                "enabled": true,
333
+                "local": false,
334
+                "user": false,
335
+                "module": "node-red",
336
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-JSON.js"
337
+            },
338
+            "XML": {
339
+                "name": "XML",
340
+                "types": [
341
+                    "xml"
342
+                ],
343
+                "enabled": true,
344
+                "local": false,
345
+                "user": false,
346
+                "module": "node-red",
347
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-XML.js"
348
+            },
349
+            "YAML": {
350
+                "name": "YAML",
351
+                "types": [
352
+                    "yaml"
353
+                ],
354
+                "enabled": true,
355
+                "local": false,
356
+                "user": false,
357
+                "module": "node-red",
358
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/parsers/70-YAML.js"
359
+            },
360
+            "split": {
361
+                "name": "split",
362
+                "types": [
363
+                    "split",
364
+                    "join"
365
+                ],
366
+                "enabled": true,
367
+                "local": false,
368
+                "user": false,
369
+                "module": "node-red",
370
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/sequence/17-split.js"
371
+            },
372
+            "sort": {
373
+                "name": "sort",
374
+                "types": [
375
+                    "sort"
376
+                ],
377
+                "enabled": true,
378
+                "local": false,
379
+                "user": false,
380
+                "module": "node-red",
381
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/sequence/18-sort.js"
382
+            },
383
+            "batch": {
384
+                "name": "batch",
385
+                "types": [
386
+                    "batch"
387
+                ],
388
+                "enabled": true,
389
+                "local": false,
390
+                "user": false,
391
+                "module": "node-red",
392
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/sequence/19-batch.js"
393
+            },
394
+            "file": {
395
+                "name": "file",
396
+                "types": [
397
+                    "file",
398
+                    "file in"
399
+                ],
400
+                "enabled": true,
401
+                "local": false,
402
+                "user": false,
403
+                "module": "node-red",
404
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/storage/10-file.js"
405
+            },
406
+            "watch": {
407
+                "name": "watch",
408
+                "types": [
409
+                    "watch"
410
+                ],
411
+                "enabled": true,
412
+                "local": false,
413
+                "user": false,
414
+                "module": "node-red",
415
+                "file": "/usr/src/node-red/node_modules/@node-red/nodes/core/storage/23-watch.js"
416
+            }
417
+        }
418
+    },
419
+    "node-red-dashboard": {
420
+        "name": "node-red-dashboard",
421
+        "version": "3.2.0",
422
+        "local": true,
423
+        "user": true,
424
+        "nodes": {
425
+            "ui_base": {
426
+                "name": "ui_base",
427
+                "types": [
428
+                    "ui_base"
429
+                ],
430
+                "enabled": true,
431
+                "local": true,
432
+                "user": false,
433
+                "module": "node-red-dashboard",
434
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_base.js"
435
+            },
436
+            "ui_button": {
437
+                "name": "ui_button",
438
+                "types": [
439
+                    "ui_button"
440
+                ],
441
+                "enabled": true,
442
+                "local": true,
443
+                "user": false,
444
+                "module": "node-red-dashboard",
445
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_button.js"
446
+            },
447
+            "ui_dropdown": {
448
+                "name": "ui_dropdown",
449
+                "types": [
450
+                    "ui_dropdown"
451
+                ],
452
+                "enabled": true,
453
+                "local": true,
454
+                "user": false,
455
+                "module": "node-red-dashboard",
456
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_dropdown.js"
457
+            },
458
+            "ui_switch": {
459
+                "name": "ui_switch",
460
+                "types": [
461
+                    "ui_switch"
462
+                ],
463
+                "enabled": true,
464
+                "local": true,
465
+                "user": false,
466
+                "module": "node-red-dashboard",
467
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_switch.js"
468
+            },
469
+            "ui_slider": {
470
+                "name": "ui_slider",
471
+                "types": [
472
+                    "ui_slider"
473
+                ],
474
+                "enabled": true,
475
+                "local": true,
476
+                "user": false,
477
+                "module": "node-red-dashboard",
478
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_slider.js"
479
+            },
480
+            "ui_numeric": {
481
+                "name": "ui_numeric",
482
+                "types": [
483
+                    "ui_numeric"
484
+                ],
485
+                "enabled": true,
486
+                "local": true,
487
+                "user": false,
488
+                "module": "node-red-dashboard",
489
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_numeric.js"
490
+            },
491
+            "ui_text_input": {
492
+                "name": "ui_text_input",
493
+                "types": [
494
+                    "ui_text_input"
495
+                ],
496
+                "enabled": true,
497
+                "local": true,
498
+                "user": false,
499
+                "module": "node-red-dashboard",
500
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_text_input.js"
501
+            },
502
+            "ui_date_picker": {
503
+                "name": "ui_date_picker",
504
+                "types": [
505
+                    "ui_date_picker"
506
+                ],
507
+                "enabled": true,
508
+                "local": true,
509
+                "user": false,
510
+                "module": "node-red-dashboard",
511
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_date_picker.js"
512
+            },
513
+            "ui_colour_picker": {
514
+                "name": "ui_colour_picker",
515
+                "types": [
516
+                    "ui_colour_picker"
517
+                ],
518
+                "enabled": true,
519
+                "local": true,
520
+                "user": false,
521
+                "module": "node-red-dashboard",
522
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_colour_picker.js"
523
+            },
524
+            "ui_form": {
525
+                "name": "ui_form",
526
+                "types": [
527
+                    "ui_form"
528
+                ],
529
+                "enabled": true,
530
+                "local": true,
531
+                "user": false,
532
+                "module": "node-red-dashboard",
533
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_form.js"
534
+            },
535
+            "ui_text": {
536
+                "name": "ui_text",
537
+                "types": [
538
+                    "ui_text"
539
+                ],
540
+                "enabled": true,
541
+                "local": true,
542
+                "user": false,
543
+                "module": "node-red-dashboard",
544
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_text.js"
545
+            },
546
+            "ui_gauge": {
547
+                "name": "ui_gauge",
548
+                "types": [
549
+                    "ui_gauge"
550
+                ],
551
+                "enabled": true,
552
+                "local": true,
553
+                "user": false,
554
+                "module": "node-red-dashboard",
555
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_gauge.js"
556
+            },
557
+            "ui_chart": {
558
+                "name": "ui_chart",
559
+                "types": [
560
+                    "ui_chart"
561
+                ],
562
+                "enabled": true,
563
+                "local": true,
564
+                "user": false,
565
+                "module": "node-red-dashboard",
566
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_chart.js"
567
+            },
568
+            "ui_audio": {
569
+                "name": "ui_audio",
570
+                "types": [
571
+                    "ui_audio"
572
+                ],
573
+                "enabled": true,
574
+                "local": true,
575
+                "user": false,
576
+                "module": "node-red-dashboard",
577
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_audio.js"
578
+            },
579
+            "ui_toast": {
580
+                "name": "ui_toast",
581
+                "types": [
582
+                    "ui_toast"
583
+                ],
584
+                "enabled": true,
585
+                "local": true,
586
+                "user": false,
587
+                "module": "node-red-dashboard",
588
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_toast.js"
589
+            },
590
+            "ui_ui_control": {
591
+                "name": "ui_ui_control",
592
+                "types": [
593
+                    "ui_ui_control"
594
+                ],
595
+                "enabled": true,
596
+                "local": true,
597
+                "user": false,
598
+                "module": "node-red-dashboard",
599
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_ui_control.js"
600
+            },
601
+            "ui_template": {
602
+                "name": "ui_template",
603
+                "types": [
604
+                    "ui_template"
605
+                ],
606
+                "enabled": true,
607
+                "local": true,
608
+                "user": false,
609
+                "module": "node-red-dashboard",
610
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_template.js"
611
+            },
612
+            "ui_link": {
613
+                "name": "ui_link",
614
+                "types": [
615
+                    "ui_link"
616
+                ],
617
+                "enabled": true,
618
+                "local": true,
619
+                "user": false,
620
+                "module": "node-red-dashboard",
621
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_link.js"
622
+            },
623
+            "ui_tab": {
624
+                "name": "ui_tab",
625
+                "types": [
626
+                    "ui_tab"
627
+                ],
628
+                "enabled": true,
629
+                "local": true,
630
+                "user": false,
631
+                "module": "node-red-dashboard",
632
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_tab.js"
633
+            },
634
+            "ui_group": {
635
+                "name": "ui_group",
636
+                "types": [
637
+                    "ui_group"
638
+                ],
639
+                "enabled": true,
640
+                "local": true,
641
+                "user": false,
642
+                "module": "node-red-dashboard",
643
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_group.js"
644
+            },
645
+            "ui_spacer": {
646
+                "name": "ui_spacer",
647
+                "types": [
648
+                    "ui_spacer"
649
+                ],
650
+                "enabled": true,
651
+                "local": true,
652
+                "user": false,
653
+                "module": "node-red-dashboard",
654
+                "file": "/data/node_modules/node-red-dashboard/nodes/ui_spacer.js"
655
+            }
656
+        }
657
+    },
658
+    "node-red-contrib-calc": {
659
+        "name": "node-red-contrib-calc",
660
+        "version": "1.0.5",
661
+        "local": true,
662
+        "user": true,
663
+        "nodes": {
664
+            "math": {
665
+                "name": "math",
666
+                "types": [
667
+                    "calculator"
668
+                ],
669
+                "enabled": true,
670
+                "local": true,
671
+                "user": false,
672
+                "module": "node-red-contrib-calc",
673
+                "file": "/data/node_modules/node-red-contrib-calc/math.js"
674
+            }
675
+        }
676
+    },
677
+    "node-red-contrib-boolean-logic": {
678
+        "name": "node-red-contrib-boolean-logic",
679
+        "version": "0.0.3",
680
+        "local": true,
681
+        "user": true,
682
+        "nodes": {
683
+            "BooleanLogic": {
684
+                "name": "BooleanLogic",
685
+                "types": [
686
+                    "BooleanLogic"
687
+                ],
688
+                "enabled": true,
689
+                "local": true,
690
+                "user": false,
691
+                "module": "node-red-contrib-boolean-logic",
692
+                "file": "/data/node_modules/node-red-contrib-boolean-logic/boolean-logic/BooleanLogic.js"
693
+            },
694
+            "Invert": {
695
+                "name": "Invert",
696
+                "types": [
697
+                    "Invert"
698
+                ],
699
+                "enabled": true,
700
+                "local": true,
701
+                "user": false,
702
+                "module": "node-red-contrib-boolean-logic",
703
+                "file": "/data/node_modules/node-red-contrib-boolean-logic/boolean-logic/Invert.js"
704
+            },
705
+            "BDebug": {
706
+                "name": "BDebug",
707
+                "types": [
708
+                    "BDebug"
709
+                ],
710
+                "enabled": true,
711
+                "local": true,
712
+                "user": false,
713
+                "module": "node-red-contrib-boolean-logic",
714
+                "file": "/data/node_modules/node-red-contrib-boolean-logic/boolean-logic/BDebug.js"
715
+            }
716
+        }
717
+    },
718
+    "node-red-contrib-ui-led": {
719
+        "name": "node-red-contrib-ui-led",
720
+        "version": "0.4.11",
721
+        "local": true,
722
+        "user": true,
723
+        "nodes": {
724
+            "ui_led": {
725
+                "name": "ui_led",
726
+                "types": [
727
+                    "ui_led"
728
+                ],
729
+                "enabled": true,
730
+                "local": true,
731
+                "user": false,
732
+                "module": "node-red-contrib-ui-led",
733
+                "file": "/data/node_modules/node-red-contrib-ui-led/dist/nodes/ui_led/ui_led.js"
734
+            }
735
+        }
736
+    },
737
+    "node-red-node-snmp": {
738
+        "name": "node-red-node-snmp",
739
+        "version": "1.0.5",
740
+        "local": true,
741
+        "user": true,
742
+        "nodes": {
743
+            "snmp": {
744
+                "name": "snmp",
745
+                "types": [
746
+                    "snmp",
747
+                    "snmp set",
748
+                    "snmp table",
749
+                    "snmp subtree",
750
+                    "snmp walker"
751
+                ],
752
+                "enabled": true,
753
+                "local": true,
754
+                "user": false,
755
+                "module": "node-red-node-snmp",
756
+                "file": "/data/node_modules/node-red-node-snmp/snmp.js"
757
+            }
758
+        }
759
+    },
760
+    "node-red-contrib-suncron": {
761
+        "name": "node-red-contrib-suncron",
762
+        "version": "1.6.2",
763
+        "local": true,
764
+        "user": true,
765
+        "nodes": {
766
+            "suncron": {
767
+                "name": "suncron",
768
+                "types": [
769
+                    "suncron"
770
+                ],
771
+                "enabled": true,
772
+                "local": true,
773
+                "user": false,
774
+                "module": "node-red-contrib-suncron",
775
+                "file": "/data/node_modules/node-red-contrib-suncron/suncron.js"
776
+            }
777
+        }
778
+    },
779
+    "node-red-contrib-logger": {
780
+        "name": "node-red-contrib-logger",
781
+        "version": "0.0.6",
782
+        "local": true,
783
+        "user": true,
784
+        "nodes": {
785
+            "loggerNode": {
786
+                "name": "loggerNode",
787
+                "types": [
788
+                    "Logger"
789
+                ],
790
+                "enabled": true,
791
+                "local": true,
792
+                "user": false,
793
+                "module": "node-red-contrib-logger",
794
+                "file": "/data/node_modules/node-red-contrib-logger/loggerNode.js"
795
+            }
796
+        }
797
+    }
798
+}

+ 798
- 0
.config.nodes.json.backup 查看文件

@@ -0,0 +1,798 @@
1
+{
2
+    "node-red": {
3
+        "name": "node-red",
4
+        "version": "3.0.2",
5
+        "local": false,
6
+        "user": false,
7
+        "nodes": {
8
+            "junction": {
9
+                "name": "junction",
10
+                "types": [
11
+                    "junction"
12
+                ],
13
+                "enabled": true,
14
+                "local": false,
15
+                "user": false,
16
+                "module": "node-red",
17
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/05-junction.js"
18
+            },
19
+            "inject": {
20
+                "name": "inject",
21
+                "types": [
22
+                    "inject"
23
+                ],
24
+                "enabled": true,
25
+                "local": false,
26
+                "user": false,
27
+                "module": "node-red",
28
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/20-inject.js"
29
+            },
30
+            "debug": {
31
+                "name": "debug",
32
+                "types": [
33
+                    "debug"
34
+                ],
35
+                "enabled": true,
36
+                "local": false,
37
+                "user": false,
38
+                "module": "node-red",
39
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/21-debug.js"
40
+            },
41
+            "complete": {
42
+                "name": "complete",
43
+                "types": [
44
+                    "complete"
45
+                ],
46
+                "enabled": true,
47
+                "local": false,
48
+                "user": false,
49
+                "module": "node-red",
50
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/24-complete.js"
51
+            },
52
+            "catch": {
53
+                "name": "catch",
54
+                "types": [
55
+                    "catch"
56
+                ],
57
+                "enabled": true,
58
+                "local": false,
59
+                "user": false,
60
+                "module": "node-red",
61
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/25-catch.js"
62
+            },
63
+            "status": {
64
+                "name": "status",
65
+                "types": [
66
+                    "status"
67
+                ],
68
+                "enabled": true,
69
+                "local": false,
70
+                "user": false,
71
+                "module": "node-red",
72
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/25-status.js"
73
+            },
74
+            "link": {
75
+                "name": "link",
76
+                "types": [
77
+                    "link in",
78
+                    "link out",
79
+                    "link call"
80
+                ],
81
+                "enabled": true,
82
+                "local": false,
83
+                "user": false,
84
+                "module": "node-red",
85
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/60-link.js"
86
+            },
87
+            "comment": {
88
+                "name": "comment",
89
+                "types": [
90
+                    "comment"
91
+                ],
92
+                "enabled": true,
93
+                "local": false,
94
+                "user": false,
95
+                "module": "node-red",
96
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/90-comment.js"
97
+            },
98
+            "unknown": {
99
+                "name": "unknown",
100
+                "types": [
101
+                    "unknown"
102
+                ],
103
+                "enabled": true,
104
+                "local": false,
105
+                "user": false,
106
+                "module": "node-red",
107
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/common/98-unknown.js"
108
+            },
109
+            "function": {
110
+                "name": "function",
111
+                "types": [
112
+                    "function"
113
+                ],
114
+                "enabled": true,
115
+                "local": false,
116
+                "user": false,
117
+                "module": "node-red",
118
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/10-function.js"
119
+            },
120
+            "switch": {
121
+                "name": "switch",
122
+                "types": [
123
+                    "switch"
124
+                ],
125
+                "enabled": true,
126
+                "local": false,
127
+                "user": false,
128
+                "module": "node-red",
129
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/10-switch.js"
130
+            },
131
+            "change": {
132
+                "name": "change",
133
+                "types": [
134
+                    "change"
135
+                ],
136
+                "enabled": true,
137
+                "local": false,
138
+                "user": false,
139
+                "module": "node-red",
140
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/15-change.js"
141
+            },
142
+            "range": {
143
+                "name": "range",
144
+                "types": [
145
+                    "range"
146
+                ],
147
+                "enabled": true,
148
+                "local": false,
149
+                "user": false,
150
+                "module": "node-red",
151
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/16-range.js"
152
+            },
153
+            "template": {
154
+                "name": "template",
155
+                "types": [
156
+                    "template"
157
+                ],
158
+                "enabled": true,
159
+                "local": false,
160
+                "user": false,
161
+                "module": "node-red",
162
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/80-template.js"
163
+            },
164
+            "delay": {
165
+                "name": "delay",
166
+                "types": [
167
+                    "delay"
168
+                ],
169
+                "enabled": true,
170
+                "local": false,
171
+                "user": false,
172
+                "module": "node-red",
173
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/89-delay.js"
174
+            },
175
+            "trigger": {
176
+                "name": "trigger",
177
+                "types": [
178
+                    "trigger"
179
+                ],
180
+                "enabled": true,
181
+                "local": false,
182
+                "user": false,
183
+                "module": "node-red",
184
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/89-trigger.js"
185
+            },
186
+            "exec": {
187
+                "name": "exec",
188
+                "types": [
189
+                    "exec"
190
+                ],
191
+                "enabled": true,
192
+                "local": false,
193
+                "user": false,
194
+                "module": "node-red",
195
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/90-exec.js"
196
+            },
197
+            "rbe": {
198
+                "name": "rbe",
199
+                "types": [
200
+                    "rbe"
201
+                ],
202
+                "enabled": true,
203
+                "local": false,
204
+                "user": false,
205
+                "module": "node-red",
206
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/rbe.js"
207
+            },
208
+            "tls": {
209
+                "name": "tls",
210
+                "types": [
211
+                    "tls-config"
212
+                ],
213
+                "enabled": true,
214
+                "local": false,
215
+                "user": false,
216
+                "module": "node-red",
217
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/05-tls.js"
218
+            },
219
+            "httpproxy": {
220
+                "name": "httpproxy",
221
+                "types": [
222
+                    "http proxy"
223
+                ],
224
+                "enabled": true,
225
+                "local": false,
226
+                "user": false,
227
+                "module": "node-red",
228
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/06-httpproxy.js"
229
+            },
230
+            "mqtt": {
231
+                "name": "mqtt",
232
+                "types": [
233
+                    "mqtt in",
234
+                    "mqtt out",
235
+                    "mqtt-broker"
236
+                ],
237
+                "enabled": true,
238
+                "local": false,
239
+                "user": false,
240
+                "module": "node-red",
241
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/10-mqtt.js"
242
+            },
243
+            "httpin": {
244
+                "name": "httpin",
245
+                "types": [
246
+                    "http in",
247
+                    "http response"
248
+                ],
249
+                "enabled": true,
250
+                "local": false,
251
+                "user": false,
252
+                "module": "node-red",
253
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/21-httpin.js"
254
+            },
255
+            "httprequest": {
256
+                "name": "httprequest",
257
+                "types": [
258
+                    "http request"
259
+                ],
260
+                "enabled": true,
261
+                "local": false,
262
+                "user": false,
263
+                "module": "node-red",
264
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/21-httprequest.js"
265
+            },
266
+            "websocket": {
267
+                "name": "websocket",
268
+                "types": [
269
+                    "websocket in",
270
+                    "websocket out",
271
+                    "websocket-listener",
272
+                    "websocket-client"
273
+                ],
274
+                "enabled": true,
275
+                "local": false,
276
+                "user": false,
277
+                "module": "node-red",
278
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/22-websocket.js"
279
+            },
280
+            "tcpin": {
281
+                "name": "tcpin",
282
+                "types": [
283
+                    "tcp in",
284
+                    "tcp out",
285
+                    "tcp request"
286
+                ],
287
+                "enabled": true,
288
+                "local": false,
289
+                "user": false,
290
+                "module": "node-red",
291
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/31-tcpin.js"
292
+            },
293
+            "udp": {
294
+                "name": "udp",
295
+                "types": [
296
+                    "udp in",
297
+                    "udp out"
298
+                ],
299
+                "enabled": true,
300
+                "local": false,
301
+                "user": false,
302
+                "module": "node-red",
303
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network/32-udp.js"
304
+            },
305
+            "CSV": {
306
+                "name": "CSV",
307
+                "types": [
308
+                    "csv"
309
+                ],
310
+                "enabled": true,
311
+                "local": false,
312
+                "user": false,
313
+                "module": "node-red",
314
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/parsers/70-CSV.js"
315
+            },
316
+            "HTML": {
317
+                "name": "HTML",
318
+                "types": [
319
+                    "html"
320
+                ],
321
+                "enabled": true,
322
+                "local": false,
323
+                "user": false,
324
+                "module": "node-red",
325
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/parsers/70-HTML.js"
326
+            },
327
+            "JSON": {
328
+                "name": "JSON",
329
+                "types": [
330
+                    "json"
331
+                ],
332
+                "enabled": true,
333
+                "local": false,
334
+                "user": false,
335
+                "module": "node-red",
336
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/parsers/70-JSON.js"
337
+            },
338
+            "XML": {
339
+                "name": "XML",
340
+                "types": [
341
+                    "xml"
342
+                ],
343
+                "enabled": true,
344
+                "local": false,
345
+                "user": false,
346
+                "module": "node-red",
347
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/parsers/70-XML.js"
348
+            },
349
+            "YAML": {
350
+                "name": "YAML",
351
+                "types": [
352
+                    "yaml"
353
+                ],
354
+                "enabled": true,
355
+                "local": false,
356
+                "user": false,
357
+                "module": "node-red",
358
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/parsers/70-YAML.js"
359
+            },
360
+            "split": {
361
+                "name": "split",
362
+                "types": [
363
+                    "split",
364
+                    "join"
365
+                ],
366
+                "enabled": true,
367
+                "local": false,
368
+                "user": false,
369
+                "module": "node-red",
370
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/sequence/17-split.js"
371
+            },
372
+            "sort": {
373
+                "name": "sort",
374
+                "types": [
375
+                    "sort"
376
+                ],
377
+                "enabled": true,
378
+                "local": false,
379
+                "user": false,
380
+                "module": "node-red",
381
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/sequence/18-sort.js"
382
+            },
383
+            "batch": {
384
+                "name": "batch",
385
+                "types": [
386
+                    "batch"
387
+                ],
388
+                "enabled": true,
389
+                "local": false,
390
+                "user": false,
391
+                "module": "node-red",
392
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/sequence/19-batch.js"
393
+            },
394
+            "file": {
395
+                "name": "file",
396
+                "types": [
397
+                    "file",
398
+                    "file in"
399
+                ],
400
+                "enabled": true,
401
+                "local": false,
402
+                "user": false,
403
+                "module": "node-red",
404
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/storage/10-file.js"
405
+            },
406
+            "watch": {
407
+                "name": "watch",
408
+                "types": [
409
+                    "watch"
410
+                ],
411
+                "enabled": true,
412
+                "local": false,
413
+                "user": false,
414
+                "module": "node-red",
415
+                "file": "/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/storage/23-watch.js"
416
+            }
417
+        }
418
+    },
419
+    "node-red-dashboard": {
420
+        "name": "node-red-dashboard",
421
+        "version": "3.2.0",
422
+        "local": true,
423
+        "user": true,
424
+        "nodes": {
425
+            "ui_base": {
426
+                "name": "ui_base",
427
+                "types": [
428
+                    "ui_base"
429
+                ],
430
+                "enabled": true,
431
+                "local": true,
432
+                "user": false,
433
+                "module": "node-red-dashboard",
434
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_base.js"
435
+            },
436
+            "ui_button": {
437
+                "name": "ui_button",
438
+                "types": [
439
+                    "ui_button"
440
+                ],
441
+                "enabled": true,
442
+                "local": true,
443
+                "user": false,
444
+                "module": "node-red-dashboard",
445
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_button.js"
446
+            },
447
+            "ui_dropdown": {
448
+                "name": "ui_dropdown",
449
+                "types": [
450
+                    "ui_dropdown"
451
+                ],
452
+                "enabled": true,
453
+                "local": true,
454
+                "user": false,
455
+                "module": "node-red-dashboard",
456
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_dropdown.js"
457
+            },
458
+            "ui_switch": {
459
+                "name": "ui_switch",
460
+                "types": [
461
+                    "ui_switch"
462
+                ],
463
+                "enabled": true,
464
+                "local": true,
465
+                "user": false,
466
+                "module": "node-red-dashboard",
467
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_switch.js"
468
+            },
469
+            "ui_slider": {
470
+                "name": "ui_slider",
471
+                "types": [
472
+                    "ui_slider"
473
+                ],
474
+                "enabled": true,
475
+                "local": true,
476
+                "user": false,
477
+                "module": "node-red-dashboard",
478
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_slider.js"
479
+            },
480
+            "ui_numeric": {
481
+                "name": "ui_numeric",
482
+                "types": [
483
+                    "ui_numeric"
484
+                ],
485
+                "enabled": true,
486
+                "local": true,
487
+                "user": false,
488
+                "module": "node-red-dashboard",
489
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_numeric.js"
490
+            },
491
+            "ui_text_input": {
492
+                "name": "ui_text_input",
493
+                "types": [
494
+                    "ui_text_input"
495
+                ],
496
+                "enabled": true,
497
+                "local": true,
498
+                "user": false,
499
+                "module": "node-red-dashboard",
500
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_text_input.js"
501
+            },
502
+            "ui_date_picker": {
503
+                "name": "ui_date_picker",
504
+                "types": [
505
+                    "ui_date_picker"
506
+                ],
507
+                "enabled": true,
508
+                "local": true,
509
+                "user": false,
510
+                "module": "node-red-dashboard",
511
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_date_picker.js"
512
+            },
513
+            "ui_colour_picker": {
514
+                "name": "ui_colour_picker",
515
+                "types": [
516
+                    "ui_colour_picker"
517
+                ],
518
+                "enabled": true,
519
+                "local": true,
520
+                "user": false,
521
+                "module": "node-red-dashboard",
522
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_colour_picker.js"
523
+            },
524
+            "ui_form": {
525
+                "name": "ui_form",
526
+                "types": [
527
+                    "ui_form"
528
+                ],
529
+                "enabled": true,
530
+                "local": true,
531
+                "user": false,
532
+                "module": "node-red-dashboard",
533
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_form.js"
534
+            },
535
+            "ui_text": {
536
+                "name": "ui_text",
537
+                "types": [
538
+                    "ui_text"
539
+                ],
540
+                "enabled": true,
541
+                "local": true,
542
+                "user": false,
543
+                "module": "node-red-dashboard",
544
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_text.js"
545
+            },
546
+            "ui_gauge": {
547
+                "name": "ui_gauge",
548
+                "types": [
549
+                    "ui_gauge"
550
+                ],
551
+                "enabled": true,
552
+                "local": true,
553
+                "user": false,
554
+                "module": "node-red-dashboard",
555
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_gauge.js"
556
+            },
557
+            "ui_chart": {
558
+                "name": "ui_chart",
559
+                "types": [
560
+                    "ui_chart"
561
+                ],
562
+                "enabled": true,
563
+                "local": true,
564
+                "user": false,
565
+                "module": "node-red-dashboard",
566
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_chart.js"
567
+            },
568
+            "ui_audio": {
569
+                "name": "ui_audio",
570
+                "types": [
571
+                    "ui_audio"
572
+                ],
573
+                "enabled": true,
574
+                "local": true,
575
+                "user": false,
576
+                "module": "node-red-dashboard",
577
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_audio.js"
578
+            },
579
+            "ui_toast": {
580
+                "name": "ui_toast",
581
+                "types": [
582
+                    "ui_toast"
583
+                ],
584
+                "enabled": true,
585
+                "local": true,
586
+                "user": false,
587
+                "module": "node-red-dashboard",
588
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_toast.js"
589
+            },
590
+            "ui_ui_control": {
591
+                "name": "ui_ui_control",
592
+                "types": [
593
+                    "ui_ui_control"
594
+                ],
595
+                "enabled": true,
596
+                "local": true,
597
+                "user": false,
598
+                "module": "node-red-dashboard",
599
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_ui_control.js"
600
+            },
601
+            "ui_template": {
602
+                "name": "ui_template",
603
+                "types": [
604
+                    "ui_template"
605
+                ],
606
+                "enabled": true,
607
+                "local": true,
608
+                "user": false,
609
+                "module": "node-red-dashboard",
610
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_template.js"
611
+            },
612
+            "ui_link": {
613
+                "name": "ui_link",
614
+                "types": [
615
+                    "ui_link"
616
+                ],
617
+                "enabled": true,
618
+                "local": true,
619
+                "user": false,
620
+                "module": "node-red-dashboard",
621
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_link.js"
622
+            },
623
+            "ui_tab": {
624
+                "name": "ui_tab",
625
+                "types": [
626
+                    "ui_tab"
627
+                ],
628
+                "enabled": true,
629
+                "local": true,
630
+                "user": false,
631
+                "module": "node-red-dashboard",
632
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_tab.js"
633
+            },
634
+            "ui_group": {
635
+                "name": "ui_group",
636
+                "types": [
637
+                    "ui_group"
638
+                ],
639
+                "enabled": true,
640
+                "local": true,
641
+                "user": false,
642
+                "module": "node-red-dashboard",
643
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_group.js"
644
+            },
645
+            "ui_spacer": {
646
+                "name": "ui_spacer",
647
+                "types": [
648
+                    "ui_spacer"
649
+                ],
650
+                "enabled": true,
651
+                "local": true,
652
+                "user": false,
653
+                "module": "node-red-dashboard",
654
+                "file": "/home/dirk/.node-red/node_modules/node-red-dashboard/nodes/ui_spacer.js"
655
+            }
656
+        }
657
+    },
658
+    "node-red-contrib-calc": {
659
+        "name": "node-red-contrib-calc",
660
+        "version": "1.0.5",
661
+        "local": true,
662
+        "user": true,
663
+        "nodes": {
664
+            "math": {
665
+                "name": "math",
666
+                "types": [
667
+                    "calculator"
668
+                ],
669
+                "enabled": true,
670
+                "local": true,
671
+                "user": false,
672
+                "module": "node-red-contrib-calc",
673
+                "file": "/home/dirk/.node-red/node_modules/node-red-contrib-calc/math.js"
674
+            }
675
+        }
676
+    },
677
+    "node-red-contrib-boolean-logic": {
678
+        "name": "node-red-contrib-boolean-logic",
679
+        "version": "0.0.3",
680
+        "local": true,
681
+        "user": true,
682
+        "nodes": {
683
+            "BooleanLogic": {
684
+                "name": "BooleanLogic",
685
+                "types": [
686
+                    "BooleanLogic"
687
+                ],
688
+                "enabled": true,
689
+                "local": true,
690
+                "user": false,
691
+                "module": "node-red-contrib-boolean-logic",
692
+                "file": "/home/dirk/.node-red/node_modules/node-red-contrib-boolean-logic/boolean-logic/BooleanLogic.js"
693
+            },
694
+            "Invert": {
695
+                "name": "Invert",
696
+                "types": [
697
+                    "Invert"
698
+                ],
699
+                "enabled": true,
700
+                "local": true,
701
+                "user": false,
702
+                "module": "node-red-contrib-boolean-logic",
703
+                "file": "/home/dirk/.node-red/node_modules/node-red-contrib-boolean-logic/boolean-logic/Invert.js"
704
+            },
705
+            "BDebug": {
706
+                "name": "BDebug",
707
+                "types": [
708
+                    "BDebug"
709
+                ],
710
+                "enabled": true,
711
+                "local": true,
712
+                "user": false,
713
+                "module": "node-red-contrib-boolean-logic",
714
+                "file": "/home/dirk/.node-red/node_modules/node-red-contrib-boolean-logic/boolean-logic/BDebug.js"
715
+            }
716
+        }
717
+    },
718
+    "node-red-contrib-ui-led": {
719
+        "name": "node-red-contrib-ui-led",
720
+        "version": "0.4.11",
721
+        "local": true,
722
+        "user": true,
723
+        "nodes": {
724
+            "ui_led": {
725
+                "name": "ui_led",
726
+                "types": [
727
+                    "ui_led"
728
+                ],
729
+                "enabled": true,
730
+                "local": true,
731
+                "user": false,
732
+                "module": "node-red-contrib-ui-led",
733
+                "file": "/home/dirk/.node-red/node_modules/node-red-contrib-ui-led/dist/nodes/ui_led/ui_led.js"
734
+            }
735
+        }
736
+    },
737
+    "node-red-node-snmp": {
738
+        "name": "node-red-node-snmp",
739
+        "version": "1.0.5",
740
+        "local": true,
741
+        "user": true,
742
+        "nodes": {
743
+            "snmp": {
744
+                "name": "snmp",
745
+                "types": [
746
+                    "snmp",
747
+                    "snmp set",
748
+                    "snmp table",
749
+                    "snmp subtree",
750
+                    "snmp walker"
751
+                ],
752
+                "enabled": true,
753
+                "local": true,
754
+                "user": false,
755
+                "module": "node-red-node-snmp",
756
+                "file": "/home/dirk/.node-red/node_modules/node-red-node-snmp/snmp.js"
757
+            }
758
+        }
759
+    },
760
+    "node-red-contrib-suncron": {
761
+        "name": "node-red-contrib-suncron",
762
+        "version": "1.6.2",
763
+        "local": true,
764
+        "user": true,
765
+        "nodes": {
766
+            "suncron": {
767
+                "name": "suncron",
768
+                "types": [
769
+                    "suncron"
770
+                ],
771
+                "enabled": true,
772
+                "local": true,
773
+                "user": false,
774
+                "module": "node-red-contrib-suncron",
775
+                "file": "/home/dirk/.node-red/node_modules/node-red-contrib-suncron/suncron.js"
776
+            }
777
+        }
778
+    },
779
+    "node-red-contrib-logger": {
780
+        "name": "node-red-contrib-logger",
781
+        "version": "0.0.6",
782
+        "local": true,
783
+        "user": true,
784
+        "nodes": {
785
+            "loggerNode": {
786
+                "name": "loggerNode",
787
+                "types": [
788
+                    "Logger"
789
+                ],
790
+                "enabled": true,
791
+                "local": true,
792
+                "user": false,
793
+                "module": "node-red-contrib-logger",
794
+                "file": "/home/dirk/.node-red/node_modules/node-red-contrib-logger/loggerNode.js"
795
+            }
796
+        }
797
+    }
798
+}

+ 3
- 0
.config.runtime.json 查看文件

@@ -0,0 +1,3 @@
1
+{
2
+    "_credentialSecret": "037613100ea02be376a956261db027ae877bcde8df33cf058d668e3484329bd9"
3
+}

+ 26
- 0
.config.users.json 查看文件

@@ -0,0 +1,26 @@
1
+{
2
+    "_": {
3
+        "editor": {
4
+            "view": {
5
+                "view-show-grid": true,
6
+                "view-snap-grid": true,
7
+                "view-grid-size": "20",
8
+                "view-node-status": true,
9
+                "view-node-show-label": true,
10
+                "view-show-tips": true,
11
+                "view-show-welcome-tours": true,
12
+                "view-store-position": true,
13
+                "view-store-zoom": false
14
+            },
15
+            "tours": {
16
+                "welcome": "3.0.2"
17
+            }
18
+        },
19
+        "debug": {
20
+            "filter": "filterCurrent",
21
+            "filteredNodes": []
22
+        },
23
+        "menu-menu-item-sidebar": true,
24
+        "menu-menu-item-palette": true
25
+    }
26
+}

+ 26
- 0
.config.users.json.backup 查看文件

@@ -0,0 +1,26 @@
1
+{
2
+    "_": {
3
+        "editor": {
4
+            "view": {
5
+                "view-show-grid": true,
6
+                "view-snap-grid": true,
7
+                "view-grid-size": "20",
8
+                "view-node-status": true,
9
+                "view-node-show-label": true,
10
+                "view-show-tips": true,
11
+                "view-show-welcome-tours": true,
12
+                "view-store-position": true,
13
+                "view-store-zoom": false
14
+            },
15
+            "tours": {
16
+                "welcome": "3.0.2"
17
+            }
18
+        },
19
+        "debug": {
20
+            "filter": "filterCurrent",
21
+            "filteredNodes": []
22
+        },
23
+        "menu-menu-item-sidebar": false,
24
+        "menu-menu-item-palette": true
25
+    }
26
+}

+ 10252
- 0
.flows.json.backup
文件差異過大導致無法顯示
查看文件


+ 3
- 0
.flows_cred.json.backup 查看文件

@@ -0,0 +1,3 @@
1
+{
2
+    "$": "6546b09f4f721381c655f755cefd52a8Eu7Vs98iaIVbUqnnMzve+EbNV8AbMT1R5DF1AOfLHTBvC96LgHQ+u7oUiTqF0k6l0AuOxvj5vS4c9MNVwZXaHde1UlDKStsHDv300wiS0G/9XcuXPM+rCE/U0sTAKC5WUwk2USZfbxOSYhQByDp+Taqf8xANnk2y/IILuTrrIRdlGNxlybWvZVQrMAWsEzHOmUF7dyvsj8ri+2eL5w0h7/k/8ur8bPl7MRr0l7DdIQiUM8GyYu2dzjIoKw=="
3
+}

+ 3
- 0
.gitignore 查看文件

@@ -1,3 +1,6 @@
1
+# Nodered
2
+.npm/_logs*
3
+
1 4
 # ---> Linux
2 5
 *~
3 6
 

+ 10252
- 0
flows.json
文件差異過大導致無法顯示
查看文件


+ 3
- 0
flows_cred.json 查看文件

@@ -0,0 +1,3 @@
1
+{
2
+    "$": "a1ce433e866c142a6cf45a4fa1cf966fONhrBZfaNQe8erPiGsRRzj3EYeGqbiowlxWg5YgFYS92ov+roVOySbE9fWiJDjNRml25MSNjaRERacNcpNmzaDaoXweJ9zwi93iUm20Lw7PIaeAP3yE6+TD7gn8C0WBD/Q=="
3
+}

+ 44
- 0
lib/functions/Heatfunction.js 查看文件

@@ -0,0 +1,44 @@
1
+// name: Heatfunction
2
+// outputs: 3
3
+// initialize: DEBUG = false;\n\nkey_user_setpoint = "user_setpoint_sleep_madi"
4
+// finalize: // Der Code hier wird ausgeführt,\n// wenn der Node gestoppt wird\n
5
+// info: 
6
+if (DEBUG)
7
+{
8
+    node.warn(msg)
9
+}
10
+
11
+out_1 = null;
12
+out_2 = null;
13
+out_3 = null;
14
+
15
+user_setpoint = flow.get(key_user_setpoint)
16
+
17
+if (msg.topic == "valve_setpoint")
18
+{
19
+    if (user_setpoint == undefined)
20
+    {
21
+        flow.set(key_user_setpoint, msg.payload)
22
+    }
23
+}
24
+else if (msg.topic == "user_setpoint")
25
+{
26
+    flow.set(key_user_setpoint, msg.payload)
27
+    out_1 = {topic: "new_setpoint", payload: {"current_heating_setpoint": msg.payload}};
28
+    out_2 = {topic: "trigger", reset: true};
29
+}
30
+else if (msg.topic == "boost")
31
+{
32
+    if (user_setpoint != undefined)
33
+    {
34
+        out_1 = {topic: "boost_setpoint", payload: {"current_heating_setpoint": user_setpoint + 5}};
35
+        out_2 = {topic: "trigger", payload: null};
36
+        out_3 = {topic: "boost_state", payload: true};
37
+    }
38
+}
39
+else if (msg.topic == "trigger")
40
+{
41
+    out_1 = {topic: "user_setpoint", payload: {"current_heating_setpoint": user_setpoint}};
42
+    out_3 = {topic: "boost_state", payload: false};
43
+}
44
+return [out_1, out_2, out_3];

+ 1
- 0
node_modules/.bin/mime 查看文件

@@ -0,0 +1 @@
1
+../mime/cli.js

+ 617
- 0
node_modules/.package-lock.json 查看文件

@@ -0,0 +1,617 @@
1
+{
2
+    "name": "node-red-project",
3
+    "version": "0.0.1",
4
+    "lockfileVersion": 2,
5
+    "requires": true,
6
+    "packages": {
7
+        "node_modules/@socket.io/component-emitter": {
8
+            "version": "3.1.0",
9
+            "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
10
+            "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg=="
11
+        },
12
+        "node_modules/@types/cookie": {
13
+            "version": "0.4.1",
14
+            "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
15
+            "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q=="
16
+        },
17
+        "node_modules/@types/cors": {
18
+            "version": "2.8.12",
19
+            "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.12.tgz",
20
+            "integrity": "sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw=="
21
+        },
22
+        "node_modules/@types/node": {
23
+            "version": "18.11.0",
24
+            "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.0.tgz",
25
+            "integrity": "sha512-IOXCvVRToe7e0ny7HpT/X9Rb2RYtElG1a+VshjwT00HxrM2dWBApHQoqsI6WiY7Q03vdf2bCrIGzVrkF/5t10w=="
26
+        },
27
+        "node_modules/accepts": {
28
+            "version": "1.3.8",
29
+            "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
30
+            "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
31
+            "dependencies": {
32
+                "mime-types": "~2.1.34",
33
+                "negotiator": "0.6.3"
34
+            },
35
+            "engines": {
36
+                "node": ">= 0.6"
37
+            }
38
+        },
39
+        "node_modules/asn1-ber": {
40
+            "version": "1.2.2",
41
+            "resolved": "https://registry.npmjs.org/asn1-ber/-/asn1-ber-1.2.2.tgz",
42
+            "integrity": "sha512-CbNem/7hxrjSiOAOOTX4iZxu+0m3jiLqlsERQwwPM1IDR/22M8IPpA1VVndCLw5KtjRYyRODbvAEIfuTogNDng=="
43
+        },
44
+        "node_modules/base64id": {
45
+            "version": "2.0.0",
46
+            "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
47
+            "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
48
+            "engines": {
49
+                "node": "^4.5.0 || >= 5.9"
50
+            }
51
+        },
52
+        "node_modules/bytes": {
53
+            "version": "3.0.0",
54
+            "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
55
+            "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==",
56
+            "engines": {
57
+                "node": ">= 0.8"
58
+            }
59
+        },
60
+        "node_modules/compressible": {
61
+            "version": "2.0.18",
62
+            "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz",
63
+            "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==",
64
+            "dependencies": {
65
+                "mime-db": ">= 1.43.0 < 2"
66
+            },
67
+            "engines": {
68
+                "node": ">= 0.6"
69
+            }
70
+        },
71
+        "node_modules/compression": {
72
+            "version": "1.7.4",
73
+            "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz",
74
+            "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==",
75
+            "dependencies": {
76
+                "accepts": "~1.3.5",
77
+                "bytes": "3.0.0",
78
+                "compressible": "~2.0.16",
79
+                "debug": "2.6.9",
80
+                "on-headers": "~1.0.2",
81
+                "safe-buffer": "5.1.2",
82
+                "vary": "~1.1.2"
83
+            },
84
+            "engines": {
85
+                "node": ">= 0.8.0"
86
+            }
87
+        },
88
+        "node_modules/cookie": {
89
+            "version": "0.4.2",
90
+            "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
91
+            "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
92
+            "engines": {
93
+                "node": ">= 0.6"
94
+            }
95
+        },
96
+        "node_modules/cors": {
97
+            "version": "2.8.5",
98
+            "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
99
+            "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
100
+            "dependencies": {
101
+                "object-assign": "^4",
102
+                "vary": "^1"
103
+            },
104
+            "engines": {
105
+                "node": ">= 0.10"
106
+            }
107
+        },
108
+        "node_modules/cron": {
109
+            "version": "1.8.2",
110
+            "resolved": "https://registry.npmjs.org/cron/-/cron-1.8.2.tgz",
111
+            "integrity": "sha512-Gk2c4y6xKEO8FSAUTklqtfSr7oTq0CiPQeLBG5Fl0qoXpZyMcj1SG59YL+hqq04bu6/IuEA7lMkYDAplQNKkyg==",
112
+            "dependencies": {
113
+                "moment-timezone": "^0.5.x"
114
+            }
115
+        },
116
+        "node_modules/dayjs": {
117
+            "version": "1.11.6",
118
+            "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.6.tgz",
119
+            "integrity": "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ=="
120
+        },
121
+        "node_modules/debug": {
122
+            "version": "2.6.9",
123
+            "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
124
+            "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
125
+            "dependencies": {
126
+                "ms": "2.0.0"
127
+            }
128
+        },
129
+        "node_modules/depd": {
130
+            "version": "2.0.0",
131
+            "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
132
+            "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
133
+            "engines": {
134
+                "node": ">= 0.8"
135
+            }
136
+        },
137
+        "node_modules/destroy": {
138
+            "version": "1.2.0",
139
+            "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
140
+            "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
141
+            "engines": {
142
+                "node": ">= 0.8",
143
+                "npm": "1.2.8000 || >= 1.4.16"
144
+            }
145
+        },
146
+        "node_modules/ee-first": {
147
+            "version": "1.1.1",
148
+            "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
149
+            "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
150
+        },
151
+        "node_modules/encodeurl": {
152
+            "version": "1.0.2",
153
+            "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
154
+            "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
155
+            "engines": {
156
+                "node": ">= 0.8"
157
+            }
158
+        },
159
+        "node_modules/engine.io": {
160
+            "version": "6.2.0",
161
+            "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz",
162
+            "integrity": "sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==",
163
+            "dependencies": {
164
+                "@types/cookie": "^0.4.1",
165
+                "@types/cors": "^2.8.12",
166
+                "@types/node": ">=10.0.0",
167
+                "accepts": "~1.3.4",
168
+                "base64id": "2.0.0",
169
+                "cookie": "~0.4.1",
170
+                "cors": "~2.8.5",
171
+                "debug": "~4.3.1",
172
+                "engine.io-parser": "~5.0.3",
173
+                "ws": "~8.2.3"
174
+            },
175
+            "engines": {
176
+                "node": ">=10.0.0"
177
+            }
178
+        },
179
+        "node_modules/engine.io-parser": {
180
+            "version": "5.0.4",
181
+            "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.4.tgz",
182
+            "integrity": "sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg==",
183
+            "engines": {
184
+                "node": ">=10.0.0"
185
+            }
186
+        },
187
+        "node_modules/engine.io/node_modules/debug": {
188
+            "version": "4.3.4",
189
+            "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
190
+            "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
191
+            "dependencies": {
192
+                "ms": "2.1.2"
193
+            },
194
+            "engines": {
195
+                "node": ">=6.0"
196
+            },
197
+            "peerDependenciesMeta": {
198
+                "supports-color": {
199
+                    "optional": true
200
+                }
201
+            }
202
+        },
203
+        "node_modules/engine.io/node_modules/ms": {
204
+            "version": "2.1.2",
205
+            "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
206
+            "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
207
+        },
208
+        "node_modules/escape-html": {
209
+            "version": "1.0.3",
210
+            "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
211
+            "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
212
+        },
213
+        "node_modules/etag": {
214
+            "version": "1.8.1",
215
+            "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
216
+            "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
217
+            "engines": {
218
+                "node": ">= 0.6"
219
+            }
220
+        },
221
+        "node_modules/fresh": {
222
+            "version": "0.5.2",
223
+            "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
224
+            "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
225
+            "engines": {
226
+                "node": ">= 0.6"
227
+            }
228
+        },
229
+        "node_modules/gridstack": {
230
+            "version": "0.6.4",
231
+            "resolved": "https://registry.npmjs.org/gridstack/-/gridstack-0.6.4.tgz",
232
+            "integrity": "sha512-4ToCnneNg5Uw+ms3xHtPVvsNXdvwQhngdlyNgGkARwvooQu+gLL6xkwPqLU59TsZP/LVvofb2QhEuXyh/ocL8w==",
233
+            "dependencies": {
234
+                "jquery": "^1.8 || 2 || 3"
235
+            }
236
+        },
237
+        "node_modules/http-errors": {
238
+            "version": "2.0.0",
239
+            "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
240
+            "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
241
+            "dependencies": {
242
+                "depd": "2.0.0",
243
+                "inherits": "2.0.4",
244
+                "setprototypeof": "1.2.0",
245
+                "statuses": "2.0.1",
246
+                "toidentifier": "1.0.1"
247
+            },
248
+            "engines": {
249
+                "node": ">= 0.8"
250
+            }
251
+        },
252
+        "node_modules/inherits": {
253
+            "version": "2.0.4",
254
+            "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
255
+            "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
256
+        },
257
+        "node_modules/jquery": {
258
+            "version": "3.6.0",
259
+            "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
260
+            "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw=="
261
+        },
262
+        "node_modules/mime": {
263
+            "version": "1.6.0",
264
+            "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
265
+            "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
266
+            "bin": {
267
+                "mime": "cli.js"
268
+            },
269
+            "engines": {
270
+                "node": ">=4"
271
+            }
272
+        },
273
+        "node_modules/mime-db": {
274
+            "version": "1.52.0",
275
+            "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
276
+            "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
277
+            "engines": {
278
+                "node": ">= 0.6"
279
+            }
280
+        },
281
+        "node_modules/mime-types": {
282
+            "version": "2.1.35",
283
+            "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
284
+            "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
285
+            "dependencies": {
286
+                "mime-db": "1.52.0"
287
+            },
288
+            "engines": {
289
+                "node": ">= 0.6"
290
+            }
291
+        },
292
+        "node_modules/moment": {
293
+            "version": "2.29.4",
294
+            "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
295
+            "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
296
+            "engines": {
297
+                "node": "*"
298
+            }
299
+        },
300
+        "node_modules/moment-timezone": {
301
+            "version": "0.5.39",
302
+            "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.39.tgz",
303
+            "integrity": "sha512-hoB6suq4ISDj7BDgctiOy6zljBsdYT0++0ZzZm9rtxIvJhIbQ3nmbgSWe7dNFGurl6/7b1OUkHlmN9JWgXVz7w==",
304
+            "dependencies": {
305
+                "moment": ">= 2.9.0"
306
+            },
307
+            "engines": {
308
+                "node": "*"
309
+            }
310
+        },
311
+        "node_modules/ms": {
312
+            "version": "2.0.0",
313
+            "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
314
+            "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
315
+        },
316
+        "node_modules/negotiator": {
317
+            "version": "0.6.3",
318
+            "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
319
+            "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
320
+            "engines": {
321
+                "node": ">= 0.6"
322
+            }
323
+        },
324
+        "node_modules/net-snmp": {
325
+            "version": "3.8.3",
326
+            "resolved": "https://registry.npmjs.org/net-snmp/-/net-snmp-3.8.3.tgz",
327
+            "integrity": "sha512-oEbQziGHrDSc0hFOrBteNsn9hPwEsHuQkXAfBhvRnMKU/mkR8I+cK1P5M0z9Wz8pmnwoYvtaPt6ppIfwyL2NdQ==",
328
+            "dependencies": {
329
+                "asn1-ber": "^1.2.1",
330
+                "smart-buffer": "^4.1.0"
331
+            }
332
+        },
333
+        "node_modules/node-red-contrib-boolean-logic": {
334
+            "version": "0.0.3",
335
+            "resolved": "https://registry.npmjs.org/node-red-contrib-boolean-logic/-/node-red-contrib-boolean-logic-0.0.3.tgz",
336
+            "integrity": "sha512-OGOXZf6reukjSMI5lD70uu1WlccpQOJF28KusxTEeiq8fqdSBhcyUsr93lXxfsa7g7uHvhpWHM8HgE3PYvRu2Q=="
337
+        },
338
+        "node_modules/node-red-contrib-calc": {
339
+            "version": "1.0.5",
340
+            "resolved": "https://registry.npmjs.org/node-red-contrib-calc/-/node-red-contrib-calc-1.0.5.tgz",
341
+            "integrity": "sha512-1A8L8JpIwRGhot9we3KvT1/YviAlFquGEWbzKsHHiXoM0wB4nyxGUzC5gID5dUKg06YE+XA/4hhltvVlFocoVw=="
342
+        },
343
+        "node_modules/node-red-contrib-logger": {
344
+            "version": "0.0.6",
345
+            "resolved": "https://registry.npmjs.org/node-red-contrib-logger/-/node-red-contrib-logger-0.0.6.tgz",
346
+            "integrity": "sha512-/VeazTBwl7lmPYKq3pIQ/gyj/NcWZ22oVeuVgWhuQ1IOIyiRPleuXF/+rd1oE4xllkfld6RLdpU/XOX83Yzt3g=="
347
+        },
348
+        "node_modules/node-red-contrib-suncron": {
349
+            "version": "1.6.2",
350
+            "resolved": "https://registry.npmjs.org/node-red-contrib-suncron/-/node-red-contrib-suncron-1.6.2.tgz",
351
+            "integrity": "sha512-R/ABlQHKDmxltqLsCrPhuCkedzVmfVP0PSkpS56WaLahRGQs6E5vI85szwRiHDcGxJ9gO1sdKYyWiDoEs1RV9g==",
352
+            "dependencies": {
353
+                "cron": "^1.8.2",
354
+                "dayjs": "^1.10.5",
355
+                "suncalc": "^1.8.0"
356
+            }
357
+        },
358
+        "node_modules/node-red-contrib-ui-led": {
359
+            "version": "0.4.11",
360
+            "resolved": "https://registry.npmjs.org/node-red-contrib-ui-led/-/node-red-contrib-ui-led-0.4.11.tgz",
361
+            "integrity": "sha512-7utTG2vy8uLYhExVJ7Q7VVcs1T/3AIvZJatClwn8URxx6XD+AnMXVLUAWfDr4kau+TNVhCkm+fD+rSWCeOyLAQ==",
362
+            "peerDependencies": {
363
+                "node-red-dashboard": ">=2.23.3"
364
+            }
365
+        },
366
+        "node_modules/node-red-dashboard": {
367
+            "version": "3.2.0",
368
+            "resolved": "https://registry.npmjs.org/node-red-dashboard/-/node-red-dashboard-3.2.0.tgz",
369
+            "integrity": "sha512-8QmwnC39TDgyy1liF5edH7bvpw+IenDY2Yen/mqklJfpft2/ieInHqR3rSJ3RJBtEjkDf6JNriQssgzZrIyqkw==",
370
+            "dependencies": {
371
+                "compression": "^1.7.4",
372
+                "gridstack": "^0.6.4",
373
+                "serve-static": "^1.15.0",
374
+                "socket.io": "^4.5.2"
375
+            },
376
+            "engines": {
377
+                "node": ">=12"
378
+            }
379
+        },
380
+        "node_modules/node-red-node-snmp": {
381
+            "version": "1.0.5",
382
+            "resolved": "https://registry.npmjs.org/node-red-node-snmp/-/node-red-node-snmp-1.0.5.tgz",
383
+            "integrity": "sha512-Kgv2ciqFnKF7Je2ni7890XGrR9Y0yz2CcSzpox7U9aLvJl92pQLUTP7dbL713lpvY0cJWSrNHAw7YyD8Pe1zhQ==",
384
+            "dependencies": {
385
+                "net-snmp": "^3.8.2"
386
+            }
387
+        },
388
+        "node_modules/object-assign": {
389
+            "version": "4.1.1",
390
+            "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
391
+            "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
392
+            "engines": {
393
+                "node": ">=0.10.0"
394
+            }
395
+        },
396
+        "node_modules/on-finished": {
397
+            "version": "2.4.1",
398
+            "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
399
+            "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
400
+            "dependencies": {
401
+                "ee-first": "1.1.1"
402
+            },
403
+            "engines": {
404
+                "node": ">= 0.8"
405
+            }
406
+        },
407
+        "node_modules/on-headers": {
408
+            "version": "1.0.2",
409
+            "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
410
+            "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
411
+            "engines": {
412
+                "node": ">= 0.8"
413
+            }
414
+        },
415
+        "node_modules/parseurl": {
416
+            "version": "1.3.3",
417
+            "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
418
+            "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
419
+            "engines": {
420
+                "node": ">= 0.8"
421
+            }
422
+        },
423
+        "node_modules/range-parser": {
424
+            "version": "1.2.1",
425
+            "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
426
+            "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
427
+            "engines": {
428
+                "node": ">= 0.6"
429
+            }
430
+        },
431
+        "node_modules/safe-buffer": {
432
+            "version": "5.1.2",
433
+            "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
434
+            "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
435
+        },
436
+        "node_modules/send": {
437
+            "version": "0.18.0",
438
+            "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
439
+            "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
440
+            "dependencies": {
441
+                "debug": "2.6.9",
442
+                "depd": "2.0.0",
443
+                "destroy": "1.2.0",
444
+                "encodeurl": "~1.0.2",
445
+                "escape-html": "~1.0.3",
446
+                "etag": "~1.8.1",
447
+                "fresh": "0.5.2",
448
+                "http-errors": "2.0.0",
449
+                "mime": "1.6.0",
450
+                "ms": "2.1.3",
451
+                "on-finished": "2.4.1",
452
+                "range-parser": "~1.2.1",
453
+                "statuses": "2.0.1"
454
+            },
455
+            "engines": {
456
+                "node": ">= 0.8.0"
457
+            }
458
+        },
459
+        "node_modules/send/node_modules/ms": {
460
+            "version": "2.1.3",
461
+            "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
462
+            "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
463
+        },
464
+        "node_modules/serve-static": {
465
+            "version": "1.15.0",
466
+            "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
467
+            "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
468
+            "dependencies": {
469
+                "encodeurl": "~1.0.2",
470
+                "escape-html": "~1.0.3",
471
+                "parseurl": "~1.3.3",
472
+                "send": "0.18.0"
473
+            },
474
+            "engines": {
475
+                "node": ">= 0.8.0"
476
+            }
477
+        },
478
+        "node_modules/setprototypeof": {
479
+            "version": "1.2.0",
480
+            "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
481
+            "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
482
+        },
483
+        "node_modules/smart-buffer": {
484
+            "version": "4.2.0",
485
+            "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
486
+            "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
487
+            "engines": {
488
+                "node": ">= 6.0.0",
489
+                "npm": ">= 3.0.0"
490
+            }
491
+        },
492
+        "node_modules/socket.io": {
493
+            "version": "4.5.3",
494
+            "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.3.tgz",
495
+            "integrity": "sha512-zdpnnKU+H6mOp7nYRXH4GNv1ux6HL6+lHL8g7Ds7Lj8CkdK1jJK/dlwsKDculbyOHifcJ0Pr/yeXnZQ5GeFrcg==",
496
+            "dependencies": {
497
+                "accepts": "~1.3.4",
498
+                "base64id": "~2.0.0",
499
+                "debug": "~4.3.2",
500
+                "engine.io": "~6.2.0",
501
+                "socket.io-adapter": "~2.4.0",
502
+                "socket.io-parser": "~4.2.0"
503
+            },
504
+            "engines": {
505
+                "node": ">=10.0.0"
506
+            }
507
+        },
508
+        "node_modules/socket.io-adapter": {
509
+            "version": "2.4.0",
510
+            "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz",
511
+            "integrity": "sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg=="
512
+        },
513
+        "node_modules/socket.io-parser": {
514
+            "version": "4.2.1",
515
+            "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.1.tgz",
516
+            "integrity": "sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g==",
517
+            "dependencies": {
518
+                "@socket.io/component-emitter": "~3.1.0",
519
+                "debug": "~4.3.1"
520
+            },
521
+            "engines": {
522
+                "node": ">=10.0.0"
523
+            }
524
+        },
525
+        "node_modules/socket.io-parser/node_modules/debug": {
526
+            "version": "4.3.4",
527
+            "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
528
+            "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
529
+            "dependencies": {
530
+                "ms": "2.1.2"
531
+            },
532
+            "engines": {
533
+                "node": ">=6.0"
534
+            },
535
+            "peerDependenciesMeta": {
536
+                "supports-color": {
537
+                    "optional": true
538
+                }
539
+            }
540
+        },
541
+        "node_modules/socket.io-parser/node_modules/ms": {
542
+            "version": "2.1.2",
543
+            "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
544
+            "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
545
+        },
546
+        "node_modules/socket.io/node_modules/debug": {
547
+            "version": "4.3.4",
548
+            "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
549
+            "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
550
+            "dependencies": {
551
+                "ms": "2.1.2"
552
+            },
553
+            "engines": {
554
+                "node": ">=6.0"
555
+            },
556
+            "peerDependenciesMeta": {
557
+                "supports-color": {
558
+                    "optional": true
559
+                }
560
+            }
561
+        },
562
+        "node_modules/socket.io/node_modules/ms": {
563
+            "version": "2.1.2",
564
+            "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
565
+            "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
566
+        },
567
+        "node_modules/statuses": {
568
+            "version": "2.0.1",
569
+            "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
570
+            "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
571
+            "engines": {
572
+                "node": ">= 0.8"
573
+            }
574
+        },
575
+        "node_modules/suncalc": {
576
+            "version": "1.9.0",
577
+            "resolved": "https://registry.npmjs.org/suncalc/-/suncalc-1.9.0.tgz",
578
+            "integrity": "sha512-vMJ8Byp1uIPoj+wb9c1AdK4jpkSKVAywgHX0lqY7zt6+EWRRC3Z+0Ucfjy/0yxTVO1hwwchZe4uoFNqrIC24+A=="
579
+        },
580
+        "node_modules/toidentifier": {
581
+            "version": "1.0.1",
582
+            "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
583
+            "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
584
+            "engines": {
585
+                "node": ">=0.6"
586
+            }
587
+        },
588
+        "node_modules/vary": {
589
+            "version": "1.1.2",
590
+            "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
591
+            "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
592
+            "engines": {
593
+                "node": ">= 0.8"
594
+            }
595
+        },
596
+        "node_modules/ws": {
597
+            "version": "8.2.3",
598
+            "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
599
+            "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==",
600
+            "engines": {
601
+                "node": ">=10.0.0"
602
+            },
603
+            "peerDependencies": {
604
+                "bufferutil": "^4.0.1",
605
+                "utf-8-validate": "^5.0.2"
606
+            },
607
+            "peerDependenciesMeta": {
608
+                "bufferutil": {
609
+                    "optional": true
610
+                },
611
+                "utf-8-validate": {
612
+                    "optional": true
613
+                }
614
+            }
615
+        }
616
+    }
617
+}

+ 24
- 0
node_modules/@socket.io/component-emitter/LICENSE 查看文件

@@ -0,0 +1,24 @@
1
+(The MIT License)
2
+
3
+Copyright (c) 2014 Component contributors <dev@component.io>
4
+
5
+Permission is hereby granted, free of charge, to any person
6
+obtaining a copy of this software and associated documentation
7
+files (the "Software"), to deal in the Software without
8
+restriction, including without limitation the rights to use,
9
+copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+copies of the Software, and to permit persons to whom the
11
+Software is furnished to do so, subject to the following
12
+conditions:
13
+
14
+The above copyright notice and this permission notice shall be
15
+included in all copies or substantial portions of the Software.
16
+
17
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+OTHER DEALINGS IN THE SOFTWARE.

+ 74
- 0
node_modules/@socket.io/component-emitter/Readme.md 查看文件

@@ -0,0 +1,74 @@
1
+# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter)
2
+
3
+  Event emitter component.
4
+
5
+## Installation
6
+
7
+```
8
+$ component install component/emitter
9
+```
10
+
11
+## API
12
+
13
+### Emitter(obj)
14
+
15
+  The `Emitter` may also be used as a mixin. For example
16
+  a "plain" object may become an emitter, or you may
17
+  extend an existing prototype.
18
+
19
+  As an `Emitter` instance:
20
+
21
+```js
22
+var Emitter = require('emitter');
23
+var emitter = new Emitter;
24
+emitter.emit('something');
25
+```
26
+
27
+  As a mixin:
28
+
29
+```js
30
+var Emitter = require('emitter');
31
+var user = { name: 'tobi' };
32
+Emitter(user);
33
+
34
+user.emit('im a user');
35
+```
36
+
37
+  As a prototype mixin:
38
+
39
+```js
40
+var Emitter = require('emitter');
41
+Emitter(User.prototype);
42
+```
43
+
44
+### Emitter#on(event, fn)
45
+
46
+  Register an `event` handler `fn`.
47
+
48
+### Emitter#once(event, fn)
49
+
50
+  Register a single-shot `event` handler `fn`,
51
+  removed immediately after it is invoked the
52
+  first time.
53
+
54
+### Emitter#off(event, fn)
55
+
56
+  * Pass `event` and `fn` to remove a listener.
57
+  * Pass `event` to remove all listeners on that event.
58
+  * Pass nothing to remove all listeners on all events.
59
+
60
+### Emitter#emit(event, ...)
61
+
62
+  Emit an `event` with variable option args.
63
+
64
+### Emitter#listeners(event)
65
+
66
+  Return an array of callbacks, or an empty array.
67
+
68
+### Emitter#hasListeners(event)
69
+
70
+  Check if this emitter has `event` handlers.
71
+
72
+## License
73
+
74
+MIT

+ 179
- 0
node_modules/@socket.io/component-emitter/index.d.ts 查看文件

@@ -0,0 +1,179 @@
1
+/**
2
+ * An events map is an interface that maps event names to their value, which
3
+ * represents the type of the `on` listener.
4
+ */
5
+export interface EventsMap {
6
+    [event: string]: any;
7
+}
8
+
9
+/**
10
+ * The default events map, used if no EventsMap is given. Using this EventsMap
11
+ * is equivalent to accepting all event names, and any data.
12
+ */
13
+export interface DefaultEventsMap {
14
+    [event: string]: (...args: any[]) => void;
15
+}
16
+
17
+/**
18
+ * Returns a union type containing all the keys of an event map.
19
+ */
20
+export type EventNames<Map extends EventsMap> = keyof Map & (string | symbol);
21
+
22
+/** The tuple type representing the parameters of an event listener */
23
+export type EventParams<
24
+    Map extends EventsMap,
25
+    Ev extends EventNames<Map>
26
+    > = Parameters<Map[Ev]>;
27
+
28
+/**
29
+ * The event names that are either in ReservedEvents or in UserEvents
30
+ */
31
+export type ReservedOrUserEventNames<
32
+    ReservedEventsMap extends EventsMap,
33
+    UserEvents extends EventsMap
34
+    > = EventNames<ReservedEventsMap> | EventNames<UserEvents>;
35
+
36
+/**
37
+ * Type of a listener of a user event or a reserved event. If `Ev` is in
38
+ * `ReservedEvents`, the reserved event listener is returned.
39
+ */
40
+export type ReservedOrUserListener<
41
+    ReservedEvents extends EventsMap,
42
+    UserEvents extends EventsMap,
43
+    Ev extends ReservedOrUserEventNames<ReservedEvents, UserEvents>
44
+    > = FallbackToUntypedListener<
45
+    Ev extends EventNames<ReservedEvents>
46
+        ? ReservedEvents[Ev]
47
+        : Ev extends EventNames<UserEvents>
48
+        ? UserEvents[Ev]
49
+        : never
50
+    >;
51
+
52
+/**
53
+ * Returns an untyped listener type if `T` is `never`; otherwise, returns `T`.
54
+ *
55
+ * This is a hack to mitigate https://github.com/socketio/socket.io/issues/3833.
56
+ * Needed because of https://github.com/microsoft/TypeScript/issues/41778
57
+ */
58
+type FallbackToUntypedListener<T> = [T] extends [never]
59
+    ? (...args: any[]) => void | Promise<void>
60
+    : T;
61
+
62
+/**
63
+ * Strictly typed version of an `EventEmitter`. A `TypedEventEmitter` takes type
64
+ * parameters for mappings of event names to event data types, and strictly
65
+ * types method calls to the `EventEmitter` according to these event maps.
66
+ *
67
+ * @typeParam ListenEvents - `EventsMap` of user-defined events that can be
68
+ * listened to with `on` or `once`
69
+ * @typeParam EmitEvents - `EventsMap` of user-defined events that can be
70
+ * emitted with `emit`
71
+ * @typeParam ReservedEvents - `EventsMap` of reserved events, that can be
72
+ * emitted by socket.io with `emitReserved`, and can be listened to with
73
+ * `listen`.
74
+ */
75
+export class Emitter<
76
+    ListenEvents extends EventsMap,
77
+    EmitEvents extends EventsMap,
78
+    ReservedEvents extends EventsMap = {}
79
+    > {
80
+    /**
81
+     * Adds the `listener` function as an event listener for `ev`.
82
+     *
83
+     * @param ev Name of the event
84
+     * @param listener Callback function
85
+     */
86
+    on<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
87
+        ev: Ev,
88
+        listener: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
89
+    ): this;
90
+
91
+    /**
92
+     * Adds a one-time `listener` function as an event listener for `ev`.
93
+     *
94
+     * @param ev Name of the event
95
+     * @param listener Callback function
96
+     */
97
+    once<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
98
+        ev: Ev,
99
+        listener: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
100
+    ): this;
101
+
102
+    /**
103
+     * Removes the `listener` function as an event listener for `ev`.
104
+     *
105
+     * @param ev Name of the event
106
+     * @param listener Callback function
107
+     */
108
+    off<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
109
+        ev?: Ev,
110
+        listener?: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
111
+    ): this;
112
+
113
+    /**
114
+     * Emits an event.
115
+     *
116
+     * @param ev Name of the event
117
+     * @param args Values to send to listeners of this event
118
+     */
119
+    emit<Ev extends EventNames<EmitEvents>>(
120
+        ev: Ev,
121
+        ...args: EventParams<EmitEvents, Ev>
122
+    ): this;
123
+
124
+    /**
125
+     * Emits a reserved event.
126
+     *
127
+     * This method is `protected`, so that only a class extending
128
+     * `StrictEventEmitter` can emit its own reserved events.
129
+     *
130
+     * @param ev Reserved event name
131
+     * @param args Arguments to emit along with the event
132
+     */
133
+    protected emitReserved<Ev extends EventNames<ReservedEvents>>(
134
+        ev: Ev,
135
+        ...args: EventParams<ReservedEvents, Ev>
136
+    ): this;
137
+
138
+    /**
139
+     * Returns the listeners listening to an event.
140
+     *
141
+     * @param event Event name
142
+     * @returns Array of listeners subscribed to `event`
143
+     */
144
+    listeners<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
145
+        event: Ev
146
+    ): ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>[];
147
+
148
+    /**
149
+     * Returns true if there is a listener for this event.
150
+     *
151
+     * @param event Event name
152
+     * @returns boolean
153
+     */
154
+    hasListeners<
155
+        Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
156
+        >(event: Ev): boolean;
157
+
158
+    /**
159
+     * Removes the `listener` function as an event listener for `ev`.
160
+     *
161
+     * @param ev Name of the event
162
+     * @param listener Callback function
163
+     */
164
+    removeListener<
165
+        Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
166
+        >(
167
+        ev?: Ev,
168
+        listener?: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
169
+    ): this;
170
+
171
+    /**
172
+     * Removes all `listener` function as an event listener for `ev`.
173
+     *
174
+     * @param ev Name of the event
175
+     */
176
+    removeAllListeners<
177
+        Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
178
+        >(ev?: Ev): this;
179
+}

+ 176
- 0
node_modules/@socket.io/component-emitter/index.js 查看文件

@@ -0,0 +1,176 @@
1
+
2
+/**
3
+ * Expose `Emitter`.
4
+ */
5
+
6
+exports.Emitter = Emitter;
7
+
8
+/**
9
+ * Initialize a new `Emitter`.
10
+ *
11
+ * @api public
12
+ */
13
+
14
+function Emitter(obj) {
15
+  if (obj) return mixin(obj);
16
+}
17
+
18
+/**
19
+ * Mixin the emitter properties.
20
+ *
21
+ * @param {Object} obj
22
+ * @return {Object}
23
+ * @api private
24
+ */
25
+
26
+function mixin(obj) {
27
+  for (var key in Emitter.prototype) {
28
+    obj[key] = Emitter.prototype[key];
29
+  }
30
+  return obj;
31
+}
32
+
33
+/**
34
+ * Listen on the given `event` with `fn`.
35
+ *
36
+ * @param {String} event
37
+ * @param {Function} fn
38
+ * @return {Emitter}
39
+ * @api public
40
+ */
41
+
42
+Emitter.prototype.on =
43
+Emitter.prototype.addEventListener = function(event, fn){
44
+  this._callbacks = this._callbacks || {};
45
+  (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
46
+    .push(fn);
47
+  return this;
48
+};
49
+
50
+/**
51
+ * Adds an `event` listener that will be invoked a single
52
+ * time then automatically removed.
53
+ *
54
+ * @param {String} event
55
+ * @param {Function} fn
56
+ * @return {Emitter}
57
+ * @api public
58
+ */
59
+
60
+Emitter.prototype.once = function(event, fn){
61
+  function on() {
62
+    this.off(event, on);
63
+    fn.apply(this, arguments);
64
+  }
65
+
66
+  on.fn = fn;
67
+  this.on(event, on);
68
+  return this;
69
+};
70
+
71
+/**
72
+ * Remove the given callback for `event` or all
73
+ * registered callbacks.
74
+ *
75
+ * @param {String} event
76
+ * @param {Function} fn
77
+ * @return {Emitter}
78
+ * @api public
79
+ */
80
+
81
+Emitter.prototype.off =
82
+Emitter.prototype.removeListener =
83
+Emitter.prototype.removeAllListeners =
84
+Emitter.prototype.removeEventListener = function(event, fn){
85
+  this._callbacks = this._callbacks || {};
86
+
87
+  // all
88
+  if (0 == arguments.length) {
89
+    this._callbacks = {};
90
+    return this;
91
+  }
92
+
93
+  // specific event
94
+  var callbacks = this._callbacks['$' + event];
95
+  if (!callbacks) return this;
96
+
97
+  // remove all handlers
98
+  if (1 == arguments.length) {
99
+    delete this._callbacks['$' + event];
100
+    return this;
101
+  }
102
+
103
+  // remove specific handler
104
+  var cb;
105
+  for (var i = 0; i < callbacks.length; i++) {
106
+    cb = callbacks[i];
107
+    if (cb === fn || cb.fn === fn) {
108
+      callbacks.splice(i, 1);
109
+      break;
110
+    }
111
+  }
112
+
113
+  // Remove event specific arrays for event types that no
114
+  // one is subscribed for to avoid memory leak.
115
+  if (callbacks.length === 0) {
116
+    delete this._callbacks['$' + event];
117
+  }
118
+
119
+  return this;
120
+};
121
+
122
+/**
123
+ * Emit `event` with the given args.
124
+ *
125
+ * @param {String} event
126
+ * @param {Mixed} ...
127
+ * @return {Emitter}
128
+ */
129
+
130
+Emitter.prototype.emit = function(event){
131
+  this._callbacks = this._callbacks || {};
132
+
133
+  var args = new Array(arguments.length - 1)
134
+    , callbacks = this._callbacks['$' + event];
135
+
136
+  for (var i = 1; i < arguments.length; i++) {
137
+    args[i - 1] = arguments[i];
138
+  }
139
+
140
+  if (callbacks) {
141
+    callbacks = callbacks.slice(0);
142
+    for (var i = 0, len = callbacks.length; i < len; ++i) {
143
+      callbacks[i].apply(this, args);
144
+    }
145
+  }
146
+
147
+  return this;
148
+};
149
+
150
+// alias used for reserved events (protected method)
151
+Emitter.prototype.emitReserved = Emitter.prototype.emit;
152
+
153
+/**
154
+ * Return array of callbacks for `event`.
155
+ *
156
+ * @param {String} event
157
+ * @return {Array}
158
+ * @api public
159
+ */
160
+
161
+Emitter.prototype.listeners = function(event){
162
+  this._callbacks = this._callbacks || {};
163
+  return this._callbacks['$' + event] || [];
164
+};
165
+
166
+/**
167
+ * Check if this emitter has `event` handlers.
168
+ *
169
+ * @param {String} event
170
+ * @return {Boolean}
171
+ * @api public
172
+ */
173
+
174
+Emitter.prototype.hasListeners = function(event){
175
+  return !! this.listeners(event).length;
176
+};

+ 169
- 0
node_modules/@socket.io/component-emitter/index.mjs 查看文件

@@ -0,0 +1,169 @@
1
+/**
2
+ * Initialize a new `Emitter`.
3
+ *
4
+ * @api public
5
+ */
6
+
7
+export function Emitter(obj) {
8
+  if (obj) return mixin(obj);
9
+}
10
+
11
+/**
12
+ * Mixin the emitter properties.
13
+ *
14
+ * @param {Object} obj
15
+ * @return {Object}
16
+ * @api private
17
+ */
18
+
19
+function mixin(obj) {
20
+  for (var key in Emitter.prototype) {
21
+    obj[key] = Emitter.prototype[key];
22
+  }
23
+  return obj;
24
+}
25
+
26
+/**
27
+ * Listen on the given `event` with `fn`.
28
+ *
29
+ * @param {String} event
30
+ * @param {Function} fn
31
+ * @return {Emitter}
32
+ * @api public
33
+ */
34
+
35
+Emitter.prototype.on =
36
+Emitter.prototype.addEventListener = function(event, fn){
37
+  this._callbacks = this._callbacks || {};
38
+  (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
39
+    .push(fn);
40
+  return this;
41
+};
42
+
43
+/**
44
+ * Adds an `event` listener that will be invoked a single
45
+ * time then automatically removed.
46
+ *
47
+ * @param {String} event
48
+ * @param {Function} fn
49
+ * @return {Emitter}
50
+ * @api public
51
+ */
52
+
53
+Emitter.prototype.once = function(event, fn){
54
+  function on() {
55
+    this.off(event, on);
56
+    fn.apply(this, arguments);
57
+  }
58
+
59
+  on.fn = fn;
60
+  this.on(event, on);
61
+  return this;
62
+};
63
+
64
+/**
65
+ * Remove the given callback for `event` or all
66
+ * registered callbacks.
67
+ *
68
+ * @param {String} event
69
+ * @param {Function} fn
70
+ * @return {Emitter}
71
+ * @api public
72
+ */
73
+
74
+Emitter.prototype.off =
75
+Emitter.prototype.removeListener =
76
+Emitter.prototype.removeAllListeners =
77
+Emitter.prototype.removeEventListener = function(event, fn){
78
+  this._callbacks = this._callbacks || {};
79
+
80
+  // all
81
+  if (0 == arguments.length) {
82
+    this._callbacks = {};
83
+    return this;
84
+  }
85
+
86
+  // specific event
87
+  var callbacks = this._callbacks['$' + event];
88
+  if (!callbacks) return this;
89
+
90
+  // remove all handlers
91
+  if (1 == arguments.length) {
92
+    delete this._callbacks['$' + event];
93
+    return this;
94
+  }
95
+
96
+  // remove specific handler
97
+  var cb;
98
+  for (var i = 0; i < callbacks.length; i++) {
99
+    cb = callbacks[i];
100
+    if (cb === fn || cb.fn === fn) {
101
+      callbacks.splice(i, 1);
102
+      break;
103
+    }
104
+  }
105
+
106
+  // Remove event specific arrays for event types that no
107
+  // one is subscribed for to avoid memory leak.
108
+  if (callbacks.length === 0) {
109
+    delete this._callbacks['$' + event];
110
+  }
111
+
112
+  return this;
113
+};
114
+
115
+/**
116
+ * Emit `event` with the given args.
117
+ *
118
+ * @param {String} event
119
+ * @param {Mixed} ...
120
+ * @return {Emitter}
121
+ */
122
+
123
+Emitter.prototype.emit = function(event){
124
+  this._callbacks = this._callbacks || {};
125
+
126
+  var args = new Array(arguments.length - 1)
127
+    , callbacks = this._callbacks['$' + event];
128
+
129
+  for (var i = 1; i < arguments.length; i++) {
130
+    args[i - 1] = arguments[i];
131
+  }
132
+
133
+  if (callbacks) {
134
+    callbacks = callbacks.slice(0);
135
+    for (var i = 0, len = callbacks.length; i < len; ++i) {
136
+      callbacks[i].apply(this, args);
137
+    }
138
+  }
139
+
140
+  return this;
141
+};
142
+
143
+// alias used for reserved events (protected method)
144
+Emitter.prototype.emitReserved = Emitter.prototype.emit;
145
+
146
+/**
147
+ * Return array of callbacks for `event`.
148
+ *
149
+ * @param {String} event
150
+ * @return {Array}
151
+ * @api public
152
+ */
153
+
154
+Emitter.prototype.listeners = function(event){
155
+  this._callbacks = this._callbacks || {};
156
+  return this._callbacks['$' + event] || [];
157
+};
158
+
159
+/**
160
+ * Check if this emitter has `event` handlers.
161
+ *
162
+ * @param {String} event
163
+ * @return {Boolean}
164
+ * @api public
165
+ */
166
+
167
+Emitter.prototype.hasListeners = function(event){
168
+  return !! this.listeners(event).length;
169
+};

+ 31
- 0
node_modules/@socket.io/component-emitter/package.json 查看文件

@@ -0,0 +1,31 @@
1
+{
2
+  "name": "@socket.io/component-emitter",
3
+  "description": "Event emitter",
4
+  "version": "3.1.0",
5
+  "license": "MIT",
6
+  "devDependencies": {
7
+    "mocha": "*",
8
+    "should": "*"
9
+  },
10
+  "component": {
11
+    "scripts": {
12
+      "emitter/index.js": "index.js"
13
+    }
14
+  },
15
+  "main": "index.js",
16
+  "module": "index.mjs",
17
+  "types": "index.d.ts",
18
+  "repository": {
19
+    "type": "git",
20
+    "url": "https://github.com/socketio/emitter.git"
21
+  },
22
+  "scripts": {
23
+    "test": "make test"
24
+  },
25
+  "files": [
26
+    "index.js",
27
+    "index.mjs",
28
+    "index.d.ts",
29
+    "LICENSE"
30
+  ]
31
+}

+ 21
- 0
node_modules/@types/cookie/LICENSE 查看文件

@@ -0,0 +1,21 @@
1
+    MIT License
2
+
3
+    Copyright (c) Microsoft Corporation.
4
+
5
+    Permission is hereby granted, free of charge, to any person obtaining a copy
6
+    of this software and associated documentation files (the "Software"), to deal
7
+    in the Software without restriction, including without limitation the rights
8
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+    copies of the Software, and to permit persons to whom the Software is
10
+    furnished to do so, subject to the following conditions:
11
+
12
+    The above copyright notice and this permission notice shall be included in all
13
+    copies or substantial portions of the Software.
14
+
15
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+    SOFTWARE

+ 16
- 0
node_modules/@types/cookie/README.md 查看文件

@@ -0,0 +1,16 @@
1
+# Installation
2
+> `npm install --save @types/cookie`
3
+
4
+# Summary
5
+This package contains type definitions for cookie (https://github.com/jshttp/cookie).
6
+
7
+# Details
8
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie.
9
+
10
+### Additional Details
11
+ * Last updated: Tue, 06 Jul 2021 20:32:30 GMT
12
+ * Dependencies: none
13
+ * Global values: none
14
+
15
+# Credits
16
+These definitions were written by [Pine Mizune](https://github.com/pine), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).

+ 135
- 0
node_modules/@types/cookie/index.d.ts 查看文件

@@ -0,0 +1,135 @@
1
+// Type definitions for cookie 0.4
2
+// Project: https://github.com/jshttp/cookie
3
+// Definitions by: Pine Mizune <https://github.com/pine>
4
+//                 Piotr Błażejewicz <https://github.com/peterblazejewicz>
5
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
+
7
+/**
8
+ * Basic HTTP cookie parser and serializer for HTTP servers.
9
+ */
10
+
11
+/**
12
+ * Additional serialization options
13
+ */
14
+export interface CookieSerializeOptions {
15
+    /**
16
+     * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3|Domain Set-Cookie attribute}. By default, no
17
+     * domain is set, and most clients will consider the cookie to apply to only
18
+     * the current domain.
19
+     */
20
+    domain?: string | undefined;
21
+
22
+    /**
23
+     * Specifies a function that will be used to encode a cookie's value. Since
24
+     * value of a cookie has a limited character set (and must be a simple
25
+     * string), this function can be used to encode a value into a string suited
26
+     * for a cookie's value.
27
+     *
28
+     * The default function is the global `encodeURIComponent`, which will
29
+     * encode a JavaScript string into UTF-8 byte sequences and then URL-encode
30
+     * any that fall outside of the cookie range.
31
+     */
32
+    encode?(value: string): string;
33
+
34
+    /**
35
+     * Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1|`Expires` `Set-Cookie` attribute}. By default,
36
+     * no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete
37
+     * it on a condition like exiting a web browser application.
38
+     *
39
+     * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
40
+     * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
41
+     * possible not all clients by obey this, so if both are set, they should
42
+     * point to the same date and time.
43
+     */
44
+    expires?: Date | undefined;
45
+    /**
46
+     * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6|`HttpOnly` `Set-Cookie` attribute}.
47
+     * When truthy, the `HttpOnly` attribute is set, otherwise it is not. By
48
+     * default, the `HttpOnly` attribute is not set.
49
+     *
50
+     * *Note* be careful when setting this to true, as compliant clients will
51
+     * not allow client-side JavaScript to see the cookie in `document.cookie`.
52
+     */
53
+    httpOnly?: boolean | undefined;
54
+    /**
55
+     * Specifies the number (in seconds) to be the value for the `Max-Age`
56
+     * `Set-Cookie` attribute. The given number will be converted to an integer
57
+     * by rounding down. By default, no maximum age is set.
58
+     *
59
+     * *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification}
60
+     * states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is
61
+     * possible not all clients by obey this, so if both are set, they should
62
+     * point to the same date and time.
63
+     */
64
+    maxAge?: number | undefined;
65
+    /**
66
+     * Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}.
67
+     * By default, the path is considered the "default path".
68
+     */
69
+    path?: string | undefined;
70
+    /**
71
+     * Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}.
72
+     *
73
+     * - `true` will set the `SameSite` attribute to `Strict` for strict same
74
+     * site enforcement.
75
+     * - `false` will not set the `SameSite` attribute.
76
+     * - `'lax'` will set the `SameSite` attribute to Lax for lax same site
77
+     * enforcement.
78
+     * - `'strict'` will set the `SameSite` attribute to Strict for strict same
79
+     * site enforcement.
80
+     *  - `'none'` will set the SameSite attribute to None for an explicit
81
+     *  cross-site cookie.
82
+     *
83
+     * More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}.
84
+     *
85
+     * *note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.
86
+     */
87
+    sameSite?: true | false | 'lax' | 'strict' | 'none' | undefined;
88
+    /**
89
+     * Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5|`Secure` `Set-Cookie` attribute}. When truthy, the
90
+     * `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
91
+     *
92
+     * *Note* be careful when setting this to `true`, as compliant clients will
93
+     * not send the cookie back to the server in the future if the browser does
94
+     * not have an HTTPS connection.
95
+     */
96
+    secure?: boolean | undefined;
97
+}
98
+
99
+/**
100
+ * Additional parsing options
101
+ */
102
+export interface CookieParseOptions {
103
+    /**
104
+     * Specifies a function that will be used to decode a cookie's value. Since
105
+     * the value of a cookie has a limited character set (and must be a simple
106
+     * string), this function can be used to decode a previously-encoded cookie
107
+     * value into a JavaScript string or other object.
108
+     *
109
+     * The default function is the global `decodeURIComponent`, which will decode
110
+     * any URL-encoded sequences into their byte representations.
111
+     *
112
+     * *Note* if an error is thrown from this function, the original, non-decoded
113
+     * cookie value will be returned as the cookie's value.
114
+     */
115
+    decode?(value: string): string;
116
+}
117
+
118
+/**
119
+ * Parse an HTTP Cookie header string and returning an object of all cookie
120
+ * name-value pairs.
121
+ *
122
+ * @param str the string representing a `Cookie` header value
123
+ * @param [options] object containing parsing options
124
+ */
125
+export function parse(str: string, options?: CookieParseOptions): { [key: string]: string };
126
+
127
+/**
128
+ * Serialize a cookie name-value pair into a `Set-Cookie` header string.
129
+ *
130
+ * @param name the name for the cookie
131
+ * @param value value to set the cookie to
132
+ * @param [options] object containing serialization options
133
+ * @throws {TypeError} when `maxAge` options is invalid
134
+ */
135
+export function serialize(name: string, value: string, options?: CookieSerializeOptions): string;

+ 30
- 0
node_modules/@types/cookie/package.json 查看文件

@@ -0,0 +1,30 @@
1
+{
2
+    "name": "@types/cookie",
3
+    "version": "0.4.1",
4
+    "description": "TypeScript definitions for cookie",
5
+    "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie",
6
+    "license": "MIT",
7
+    "contributors": [
8
+        {
9
+            "name": "Pine Mizune",
10
+            "url": "https://github.com/pine",
11
+            "githubUsername": "pine"
12
+        },
13
+        {
14
+            "name": "Piotr Błażejewicz",
15
+            "url": "https://github.com/peterblazejewicz",
16
+            "githubUsername": "peterblazejewicz"
17
+        }
18
+    ],
19
+    "main": "",
20
+    "types": "index.d.ts",
21
+    "repository": {
22
+        "type": "git",
23
+        "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
24
+        "directory": "types/cookie"
25
+    },
26
+    "scripts": {},
27
+    "dependencies": {},
28
+    "typesPublisherContentHash": "7d4a6dd505c896319459ae131b5fa8fc0a2ed25552db53dac87946119bb21559",
29
+    "typeScriptVersion": "3.6"
30
+}

+ 21
- 0
node_modules/@types/cors/LICENSE 查看文件

@@ -0,0 +1,21 @@
1
+    MIT License
2
+
3
+    Copyright (c) Microsoft Corporation.
4
+
5
+    Permission is hereby granted, free of charge, to any person obtaining a copy
6
+    of this software and associated documentation files (the "Software"), to deal
7
+    in the Software without restriction, including without limitation the rights
8
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+    copies of the Software, and to permit persons to whom the Software is
10
+    furnished to do so, subject to the following conditions:
11
+
12
+    The above copyright notice and this permission notice shall be included in all
13
+    copies or substantial portions of the Software.
14
+
15
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+    SOFTWARE

+ 78
- 0
node_modules/@types/cors/README.md 查看文件

@@ -0,0 +1,78 @@
1
+# Installation
2
+> `npm install --save @types/cors`
3
+
4
+# Summary
5
+This package contains type definitions for cors (https://github.com/expressjs/cors/).
6
+
7
+# Details
8
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors.
9
+## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors/index.d.ts)
10
+````ts
11
+// Type definitions for cors 2.8
12
+// Project: https://github.com/expressjs/cors/
13
+// Definitions by: Alan Plum <https://github.com/pluma>
14
+//                 Gaurav Sharma <https://github.com/gtpan77>
15
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
16
+// TypeScript Version: 2.3
17
+
18
+import { IncomingHttpHeaders } from 'http';
19
+
20
+type StaticOrigin = boolean | string | RegExp | (boolean | string | RegExp)[];
21
+
22
+type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
23
+
24
+declare namespace e {
25
+    interface CorsRequest {
26
+        method?: string | undefined;
27
+        headers: IncomingHttpHeaders;
28
+    }
29
+    interface CorsOptions {
30
+        /**
31
+         * @default '*''
32
+         */
33
+        origin?: StaticOrigin | CustomOrigin | undefined;
34
+        /**
35
+         * @default 'GET,HEAD,PUT,PATCH,POST,DELETE'
36
+         */
37
+        methods?: string | string[] | undefined;
38
+        allowedHeaders?: string | string[] | undefined;
39
+        exposedHeaders?: string | string[] | undefined;
40
+        credentials?: boolean | undefined;
41
+        maxAge?: number | undefined;
42
+        /**
43
+         * @default false
44
+         */
45
+        preflightContinue?: boolean | undefined;
46
+        /**
47
+         * @default 204
48
+         */
49
+        optionsSuccessStatus?: number | undefined;
50
+    }
51
+    type CorsOptionsDelegate<T extends CorsRequest = CorsRequest> = (
52
+        req: T,
53
+        callback: (err: Error | null, options?: CorsOptions) => void,
54
+    ) => void;
55
+}
56
+
57
+declare function e<T extends e.CorsRequest = e.CorsRequest>(
58
+    options?: e.CorsOptions | e.CorsOptionsDelegate<T>,
59
+): (
60
+    req: T,
61
+    res: {
62
+        statusCode?: number | undefined;
63
+        setHeader(key: string, value: string): any;
64
+        end(): any;
65
+    },
66
+    next: (err?: any) => any,
67
+) => void;
68
+export = e;
69
+
70
+````
71
+
72
+### Additional Details
73
+ * Last updated: Fri, 09 Jul 2021 07:31:29 GMT
74
+ * Dependencies: none
75
+ * Global values: none
76
+
77
+# Credits
78
+These definitions were written by [Alan Plum](https://github.com/pluma), and [Gaurav Sharma](https://github.com/gtpan77).

+ 58
- 0
node_modules/@types/cors/index.d.ts 查看文件

@@ -0,0 +1,58 @@
1
+// Type definitions for cors 2.8
2
+// Project: https://github.com/expressjs/cors/
3
+// Definitions by: Alan Plum <https://github.com/pluma>
4
+//                 Gaurav Sharma <https://github.com/gtpan77>
5
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
+// TypeScript Version: 2.3
7
+
8
+import { IncomingHttpHeaders } from 'http';
9
+
10
+type StaticOrigin = boolean | string | RegExp | (boolean | string | RegExp)[];
11
+
12
+type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
13
+
14
+declare namespace e {
15
+    interface CorsRequest {
16
+        method?: string | undefined;
17
+        headers: IncomingHttpHeaders;
18
+    }
19
+    interface CorsOptions {
20
+        /**
21
+         * @default '*''
22
+         */
23
+        origin?: StaticOrigin | CustomOrigin | undefined;
24
+        /**
25
+         * @default 'GET,HEAD,PUT,PATCH,POST,DELETE'
26
+         */
27
+        methods?: string | string[] | undefined;
28
+        allowedHeaders?: string | string[] | undefined;
29
+        exposedHeaders?: string | string[] | undefined;
30
+        credentials?: boolean | undefined;
31
+        maxAge?: number | undefined;
32
+        /**
33
+         * @default false
34
+         */
35
+        preflightContinue?: boolean | undefined;
36
+        /**
37
+         * @default 204
38
+         */
39
+        optionsSuccessStatus?: number | undefined;
40
+    }
41
+    type CorsOptionsDelegate<T extends CorsRequest = CorsRequest> = (
42
+        req: T,
43
+        callback: (err: Error | null, options?: CorsOptions) => void,
44
+    ) => void;
45
+}
46
+
47
+declare function e<T extends e.CorsRequest = e.CorsRequest>(
48
+    options?: e.CorsOptions | e.CorsOptionsDelegate<T>,
49
+): (
50
+    req: T,
51
+    res: {
52
+        statusCode?: number | undefined;
53
+        setHeader(key: string, value: string): any;
54
+        end(): any;
55
+    },
56
+    next: (err?: any) => any,
57
+) => void;
58
+export = e;

+ 30
- 0
node_modules/@types/cors/package.json 查看文件

@@ -0,0 +1,30 @@
1
+{
2
+    "name": "@types/cors",
3
+    "version": "2.8.12",
4
+    "description": "TypeScript definitions for cors",
5
+    "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cors",
6
+    "license": "MIT",
7
+    "contributors": [
8
+        {
9
+            "name": "Alan Plum",
10
+            "url": "https://github.com/pluma",
11
+            "githubUsername": "pluma"
12
+        },
13
+        {
14
+            "name": "Gaurav Sharma",
15
+            "url": "https://github.com/gtpan77",
16
+            "githubUsername": "gtpan77"
17
+        }
18
+    ],
19
+    "main": "",
20
+    "types": "index.d.ts",
21
+    "repository": {
22
+        "type": "git",
23
+        "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
24
+        "directory": "types/cors"
25
+    },
26
+    "scripts": {},
27
+    "dependencies": {},
28
+    "typesPublisherContentHash": "53ea51a6543d58d3c1b9035a9c361d8f06d7be01973be2895820b2fb7ad9563a",
29
+    "typeScriptVersion": "3.6"
30
+}

+ 21
- 0
node_modules/@types/node/LICENSE 查看文件

@@ -0,0 +1,21 @@
1
+    MIT License
2
+
3
+    Copyright (c) Microsoft Corporation.
4
+
5
+    Permission is hereby granted, free of charge, to any person obtaining a copy
6
+    of this software and associated documentation files (the "Software"), to deal
7
+    in the Software without restriction, including without limitation the rights
8
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+    copies of the Software, and to permit persons to whom the Software is
10
+    furnished to do so, subject to the following conditions:
11
+
12
+    The above copyright notice and this permission notice shall be included in all
13
+    copies or substantial portions of the Software.
14
+
15
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+    SOFTWARE

+ 16
- 0
node_modules/@types/node/README.md 查看文件

@@ -0,0 +1,16 @@
1
+# Installation
2
+> `npm install --save @types/node`
3
+
4
+# Summary
5
+This package contains type definitions for Node.js (https://nodejs.org/).
6
+
7
+# Details
8
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
+
10
+### Additional Details
11
+ * Last updated: Fri, 14 Oct 2022 20:32:59 GMT
12
+ * Dependencies: none
13
+ * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
+
15
+# Credits
16
+These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), and [Matteo Collina](https://github.com/mcollina).

+ 911
- 0
node_modules/@types/node/assert.d.ts 查看文件

@@ -0,0 +1,911 @@
1
+/**
2
+ * The `assert` module provides a set of assertion functions for verifying
3
+ * invariants.
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
5
+ */
6
+declare module 'assert' {
7
+    /**
8
+     * An alias of {@link ok}.
9
+     * @since v0.5.9
10
+     * @param value The input that is checked for being truthy.
11
+     */
12
+    function assert(value: unknown, message?: string | Error): asserts value;
13
+    namespace assert {
14
+        /**
15
+         * Indicates the failure of an assertion. All errors thrown by the `assert` module
16
+         * will be instances of the `AssertionError` class.
17
+         */
18
+        class AssertionError extends Error {
19
+            actual: unknown;
20
+            expected: unknown;
21
+            operator: string;
22
+            generatedMessage: boolean;
23
+            code: 'ERR_ASSERTION';
24
+            constructor(options?: {
25
+                /** If provided, the error message is set to this value. */
26
+                message?: string | undefined;
27
+                /** The `actual` property on the error instance. */
28
+                actual?: unknown | undefined;
29
+                /** The `expected` property on the error instance. */
30
+                expected?: unknown | undefined;
31
+                /** The `operator` property on the error instance. */
32
+                operator?: string | undefined;
33
+                /** If provided, the generated stack trace omits frames before this function. */
34
+                // tslint:disable-next-line:ban-types
35
+                stackStartFn?: Function | undefined;
36
+            });
37
+        }
38
+        /**
39
+         * This feature is currently experimental and behavior might still change.
40
+         * @since v14.2.0, v12.19.0
41
+         * @experimental
42
+         */
43
+        class CallTracker {
44
+            /**
45
+             * The wrapper function is expected to be called exactly `exact` times. If the
46
+             * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
47
+             * error.
48
+             *
49
+             * ```js
50
+             * import assert from 'assert';
51
+             *
52
+             * // Creates call tracker.
53
+             * const tracker = new assert.CallTracker();
54
+             *
55
+             * function func() {}
56
+             *
57
+             * // Returns a function that wraps func() that must be called exact times
58
+             * // before tracker.verify().
59
+             * const callsfunc = tracker.calls(func);
60
+             * ```
61
+             * @since v14.2.0, v12.19.0
62
+             * @param [fn='A no-op function']
63
+             * @param [exact=1]
64
+             * @return that wraps `fn`.
65
+             */
66
+            calls(exact?: number): () => void;
67
+            calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
68
+            /**
69
+             * The arrays contains information about the expected and actual number of calls of
70
+             * the functions that have not been called the expected number of times.
71
+             *
72
+             * ```js
73
+             * import assert from 'assert';
74
+             *
75
+             * // Creates call tracker.
76
+             * const tracker = new assert.CallTracker();
77
+             *
78
+             * function func() {}
79
+             *
80
+             * function foo() {}
81
+             *
82
+             * // Returns a function that wraps func() that must be called exact times
83
+             * // before tracker.verify().
84
+             * const callsfunc = tracker.calls(func, 2);
85
+             *
86
+             * // Returns an array containing information on callsfunc()
87
+             * tracker.report();
88
+             * // [
89
+             * //  {
90
+             * //    message: 'Expected the func function to be executed 2 time(s) but was
91
+             * //    executed 0 time(s).',
92
+             * //    actual: 0,
93
+             * //    expected: 2,
94
+             * //    operator: 'func',
95
+             * //    stack: stack trace
96
+             * //  }
97
+             * // ]
98
+             * ```
99
+             * @since v14.2.0, v12.19.0
100
+             * @return of objects containing information about the wrapper functions returned by `calls`.
101
+             */
102
+            report(): CallTrackerReportInformation[];
103
+            /**
104
+             * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
105
+             * have not been called the expected number of times.
106
+             *
107
+             * ```js
108
+             * import assert from 'assert';
109
+             *
110
+             * // Creates call tracker.
111
+             * const tracker = new assert.CallTracker();
112
+             *
113
+             * function func() {}
114
+             *
115
+             * // Returns a function that wraps func() that must be called exact times
116
+             * // before tracker.verify().
117
+             * const callsfunc = tracker.calls(func, 2);
118
+             *
119
+             * callsfunc();
120
+             *
121
+             * // Will throw an error since callsfunc() was only called once.
122
+             * tracker.verify();
123
+             * ```
124
+             * @since v14.2.0, v12.19.0
125
+             */
126
+            verify(): void;
127
+        }
128
+        interface CallTrackerReportInformation {
129
+            message: string;
130
+            /** The actual number of times the function was called. */
131
+            actual: number;
132
+            /** The number of times the function was expected to be called. */
133
+            expected: number;
134
+            /** The name of the function that is wrapped. */
135
+            operator: string;
136
+            /** A stack trace of the function. */
137
+            stack: object;
138
+        }
139
+        type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
140
+        /**
141
+         * Throws an `AssertionError` with the provided error message or a default
142
+         * error message. If the `message` parameter is an instance of an `Error` then
143
+         * it will be thrown instead of the `AssertionError`.
144
+         *
145
+         * ```js
146
+         * import assert from 'assert/strict';
147
+         *
148
+         * assert.fail();
149
+         * // AssertionError [ERR_ASSERTION]: Failed
150
+         *
151
+         * assert.fail('boom');
152
+         * // AssertionError [ERR_ASSERTION]: boom
153
+         *
154
+         * assert.fail(new TypeError('need array'));
155
+         * // TypeError: need array
156
+         * ```
157
+         *
158
+         * Using `assert.fail()` with more than two arguments is possible but deprecated.
159
+         * See below for further details.
160
+         * @since v0.1.21
161
+         * @param [message='Failed']
162
+         */
163
+        function fail(message?: string | Error): never;
164
+        /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
165
+        function fail(
166
+            actual: unknown,
167
+            expected: unknown,
168
+            message?: string | Error,
169
+            operator?: string,
170
+            // tslint:disable-next-line:ban-types
171
+            stackStartFn?: Function
172
+        ): never;
173
+        /**
174
+         * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
175
+         *
176
+         * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
177
+         * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
178
+         * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
179
+         *
180
+         * Be aware that in the `repl` the error message will be different to the one
181
+         * thrown in a file! See below for further details.
182
+         *
183
+         * ```js
184
+         * import assert from 'assert/strict';
185
+         *
186
+         * assert.ok(true);
187
+         * // OK
188
+         * assert.ok(1);
189
+         * // OK
190
+         *
191
+         * assert.ok();
192
+         * // AssertionError: No value argument passed to `assert.ok()`
193
+         *
194
+         * assert.ok(false, 'it\'s false');
195
+         * // AssertionError: it's false
196
+         *
197
+         * // In the repl:
198
+         * assert.ok(typeof 123 === 'string');
199
+         * // AssertionError: false == true
200
+         *
201
+         * // In a file (e.g. test.js):
202
+         * assert.ok(typeof 123 === 'string');
203
+         * // AssertionError: The expression evaluated to a falsy value:
204
+         * //
205
+         * //   assert.ok(typeof 123 === 'string')
206
+         *
207
+         * assert.ok(false);
208
+         * // AssertionError: The expression evaluated to a falsy value:
209
+         * //
210
+         * //   assert.ok(false)
211
+         *
212
+         * assert.ok(0);
213
+         * // AssertionError: The expression evaluated to a falsy value:
214
+         * //
215
+         * //   assert.ok(0)
216
+         * ```
217
+         *
218
+         * ```js
219
+         * import assert from 'assert/strict';
220
+         *
221
+         * // Using `assert()` works the same:
222
+         * assert(0);
223
+         * // AssertionError: The expression evaluated to a falsy value:
224
+         * //
225
+         * //   assert(0)
226
+         * ```
227
+         * @since v0.1.21
228
+         */
229
+        function ok(value: unknown, message?: string | Error): asserts value;
230
+        /**
231
+         * **Strict assertion mode**
232
+         *
233
+         * An alias of {@link strictEqual}.
234
+         *
235
+         * **Legacy assertion mode**
236
+         *
237
+         * > Stability: 3 - Legacy: Use {@link strictEqual} instead.
238
+         *
239
+         * Tests shallow, coercive equality between the `actual` and `expected` parameters
240
+         * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
241
+         * and treated as being identical if both sides are `NaN`.
242
+         *
243
+         * ```js
244
+         * import assert from 'assert';
245
+         *
246
+         * assert.equal(1, 1);
247
+         * // OK, 1 == 1
248
+         * assert.equal(1, '1');
249
+         * // OK, 1 == '1'
250
+         * assert.equal(NaN, NaN);
251
+         * // OK
252
+         *
253
+         * assert.equal(1, 2);
254
+         * // AssertionError: 1 == 2
255
+         * assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
256
+         * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
257
+         * ```
258
+         *
259
+         * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
260
+         * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
261
+         * @since v0.1.21
262
+         */
263
+        function equal(actual: unknown, expected: unknown, message?: string | Error): void;
264
+        /**
265
+         * **Strict assertion mode**
266
+         *
267
+         * An alias of {@link notStrictEqual}.
268
+         *
269
+         * **Legacy assertion mode**
270
+         *
271
+         * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
272
+         *
273
+         * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
274
+         * specially handled and treated as being identical if both sides are `NaN`.
275
+         *
276
+         * ```js
277
+         * import assert from 'assert';
278
+         *
279
+         * assert.notEqual(1, 2);
280
+         * // OK
281
+         *
282
+         * assert.notEqual(1, 1);
283
+         * // AssertionError: 1 != 1
284
+         *
285
+         * assert.notEqual(1, '1');
286
+         * // AssertionError: 1 != '1'
287
+         * ```
288
+         *
289
+         * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
290
+         * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
291
+         * @since v0.1.21
292
+         */
293
+        function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
294
+        /**
295
+         * **Strict assertion mode**
296
+         *
297
+         * An alias of {@link deepStrictEqual}.
298
+         *
299
+         * **Legacy assertion mode**
300
+         *
301
+         * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
302
+         *
303
+         * Tests for deep equality between the `actual` and `expected` parameters. Consider
304
+         * using {@link deepStrictEqual} instead. {@link deepEqual} can have
305
+         * surprising results.
306
+         *
307
+         * _Deep equality_ means that the enumerable "own" properties of child objects
308
+         * are also recursively evaluated by the following rules.
309
+         * @since v0.1.21
310
+         */
311
+        function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
312
+        /**
313
+         * **Strict assertion mode**
314
+         *
315
+         * An alias of {@link notDeepStrictEqual}.
316
+         *
317
+         * **Legacy assertion mode**
318
+         *
319
+         * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
320
+         *
321
+         * Tests for any deep inequality. Opposite of {@link deepEqual}.
322
+         *
323
+         * ```js
324
+         * import assert from 'assert';
325
+         *
326
+         * const obj1 = {
327
+         *   a: {
328
+         *     b: 1
329
+         *   }
330
+         * };
331
+         * const obj2 = {
332
+         *   a: {
333
+         *     b: 2
334
+         *   }
335
+         * };
336
+         * const obj3 = {
337
+         *   a: {
338
+         *     b: 1
339
+         *   }
340
+         * };
341
+         * const obj4 = Object.create(obj1);
342
+         *
343
+         * assert.notDeepEqual(obj1, obj1);
344
+         * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
345
+         *
346
+         * assert.notDeepEqual(obj1, obj2);
347
+         * // OK
348
+         *
349
+         * assert.notDeepEqual(obj1, obj3);
350
+         * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
351
+         *
352
+         * assert.notDeepEqual(obj1, obj4);
353
+         * // OK
354
+         * ```
355
+         *
356
+         * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
357
+         * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
358
+         * instead of the `AssertionError`.
359
+         * @since v0.1.21
360
+         */
361
+        function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
362
+        /**
363
+         * Tests strict equality between the `actual` and `expected` parameters as
364
+         * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
365
+         *
366
+         * ```js
367
+         * import assert from 'assert/strict';
368
+         *
369
+         * assert.strictEqual(1, 2);
370
+         * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
371
+         * //
372
+         * // 1 !== 2
373
+         *
374
+         * assert.strictEqual(1, 1);
375
+         * // OK
376
+         *
377
+         * assert.strictEqual('Hello foobar', 'Hello World!');
378
+         * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
379
+         * // + actual - expected
380
+         * //
381
+         * // + 'Hello foobar'
382
+         * // - 'Hello World!'
383
+         * //          ^
384
+         *
385
+         * const apples = 1;
386
+         * const oranges = 2;
387
+         * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
388
+         * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
389
+         *
390
+         * assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
391
+         * // TypeError: Inputs are not identical
392
+         * ```
393
+         *
394
+         * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
395
+         * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
396
+         * instead of the `AssertionError`.
397
+         * @since v0.1.21
398
+         */
399
+        function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
400
+        /**
401
+         * Tests strict inequality between the `actual` and `expected` parameters as
402
+         * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
403
+         *
404
+         * ```js
405
+         * import assert from 'assert/strict';
406
+         *
407
+         * assert.notStrictEqual(1, 2);
408
+         * // OK
409
+         *
410
+         * assert.notStrictEqual(1, 1);
411
+         * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
412
+         * //
413
+         * // 1
414
+         *
415
+         * assert.notStrictEqual(1, '1');
416
+         * // OK
417
+         * ```
418
+         *
419
+         * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
420
+         * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
421
+         * instead of the `AssertionError`.
422
+         * @since v0.1.21
423
+         */
424
+        function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
425
+        /**
426
+         * Tests for deep equality between the `actual` and `expected` parameters.
427
+         * "Deep" equality means that the enumerable "own" properties of child objects
428
+         * are recursively evaluated also by the following rules.
429
+         * @since v1.2.0
430
+         */
431
+        function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
432
+        /**
433
+         * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
434
+         *
435
+         * ```js
436
+         * import assert from 'assert/strict';
437
+         *
438
+         * assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
439
+         * // OK
440
+         * ```
441
+         *
442
+         * If the values are deeply and strictly equal, an `AssertionError` is thrown
443
+         * with a `message` property set equal to the value of the `message` parameter. If
444
+         * the `message` parameter is undefined, a default error message is assigned. If
445
+         * the `message` parameter is an instance of an `Error` then it will be thrown
446
+         * instead of the `AssertionError`.
447
+         * @since v1.2.0
448
+         */
449
+        function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
450
+        /**
451
+         * Expects the function `fn` to throw an error.
452
+         *
453
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
454
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
455
+         * a validation object where each property will be tested for strict deep equality,
456
+         * or an instance of error where each property will be tested for strict deep
457
+         * equality including the non-enumerable `message` and `name` properties. When
458
+         * using an object, it is also possible to use a regular expression, when
459
+         * validating against a string property. See below for examples.
460
+         *
461
+         * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
462
+         * fails.
463
+         *
464
+         * Custom validation object/error instance:
465
+         *
466
+         * ```js
467
+         * import assert from 'assert/strict';
468
+         *
469
+         * const err = new TypeError('Wrong value');
470
+         * err.code = 404;
471
+         * err.foo = 'bar';
472
+         * err.info = {
473
+         *   nested: true,
474
+         *   baz: 'text'
475
+         * };
476
+         * err.reg = /abc/i;
477
+         *
478
+         * assert.throws(
479
+         *   () => {
480
+         *     throw err;
481
+         *   },
482
+         *   {
483
+         *     name: 'TypeError',
484
+         *     message: 'Wrong value',
485
+         *     info: {
486
+         *       nested: true,
487
+         *       baz: 'text'
488
+         *     }
489
+         *     // Only properties on the validation object will be tested for.
490
+         *     // Using nested objects requires all properties to be present. Otherwise
491
+         *     // the validation is going to fail.
492
+         *   }
493
+         * );
494
+         *
495
+         * // Using regular expressions to validate error properties:
496
+         * throws(
497
+         *   () => {
498
+         *     throw err;
499
+         *   },
500
+         *   {
501
+         *     // The `name` and `message` properties are strings and using regular
502
+         *     // expressions on those will match against the string. If they fail, an
503
+         *     // error is thrown.
504
+         *     name: /^TypeError$/,
505
+         *     message: /Wrong/,
506
+         *     foo: 'bar',
507
+         *     info: {
508
+         *       nested: true,
509
+         *       // It is not possible to use regular expressions for nested properties!
510
+         *       baz: 'text'
511
+         *     },
512
+         *     // The `reg` property contains a regular expression and only if the
513
+         *     // validation object contains an identical regular expression, it is going
514
+         *     // to pass.
515
+         *     reg: /abc/i
516
+         *   }
517
+         * );
518
+         *
519
+         * // Fails due to the different `message` and `name` properties:
520
+         * throws(
521
+         *   () => {
522
+         *     const otherErr = new Error('Not found');
523
+         *     // Copy all enumerable properties from `err` to `otherErr`.
524
+         *     for (const [key, value] of Object.entries(err)) {
525
+         *       otherErr[key] = value;
526
+         *     }
527
+         *     throw otherErr;
528
+         *   },
529
+         *   // The error's `message` and `name` properties will also be checked when using
530
+         *   // an error as validation object.
531
+         *   err
532
+         * );
533
+         * ```
534
+         *
535
+         * Validate instanceof using constructor:
536
+         *
537
+         * ```js
538
+         * import assert from 'assert/strict';
539
+         *
540
+         * assert.throws(
541
+         *   () => {
542
+         *     throw new Error('Wrong value');
543
+         *   },
544
+         *   Error
545
+         * );
546
+         * ```
547
+         *
548
+         * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
549
+         *
550
+         * Using a regular expression runs `.toString` on the error object, and will
551
+         * therefore also include the error name.
552
+         *
553
+         * ```js
554
+         * import assert from 'assert/strict';
555
+         *
556
+         * assert.throws(
557
+         *   () => {
558
+         *     throw new Error('Wrong value');
559
+         *   },
560
+         *   /^Error: Wrong value$/
561
+         * );
562
+         * ```
563
+         *
564
+         * Custom error validation:
565
+         *
566
+         * The function must return `true` to indicate all internal validations passed.
567
+         * It will otherwise fail with an `AssertionError`.
568
+         *
569
+         * ```js
570
+         * import assert from 'assert/strict';
571
+         *
572
+         * assert.throws(
573
+         *   () => {
574
+         *     throw new Error('Wrong value');
575
+         *   },
576
+         *   (err) => {
577
+         *     assert(err instanceof Error);
578
+         *     assert(/value/.test(err));
579
+         *     // Avoid returning anything from validation functions besides `true`.
580
+         *     // Otherwise, it's not clear what part of the validation failed. Instead,
581
+         *     // throw an error about the specific validation that failed (as done in this
582
+         *     // example) and add as much helpful debugging information to that error as
583
+         *     // possible.
584
+         *     return true;
585
+         *   },
586
+         *   'unexpected error'
587
+         * );
588
+         * ```
589
+         *
590
+         * `error` cannot be a string. If a string is provided as the second
591
+         * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
592
+         * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
593
+         * a string as the second argument gets considered:
594
+         *
595
+         * ```js
596
+         * import assert from 'assert/strict';
597
+         *
598
+         * function throwingFirst() {
599
+         *   throw new Error('First');
600
+         * }
601
+         *
602
+         * function throwingSecond() {
603
+         *   throw new Error('Second');
604
+         * }
605
+         *
606
+         * function notThrowing() {}
607
+         *
608
+         * // The second argument is a string and the input function threw an Error.
609
+         * // The first case will not throw as it does not match for the error message
610
+         * // thrown by the input function!
611
+         * assert.throws(throwingFirst, 'Second');
612
+         * // In the next example the message has no benefit over the message from the
613
+         * // error and since it is not clear if the user intended to actually match
614
+         * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
615
+         * assert.throws(throwingSecond, 'Second');
616
+         * // TypeError [ERR_AMBIGUOUS_ARGUMENT]
617
+         *
618
+         * // The string is only used (as message) in case the function does not throw:
619
+         * assert.throws(notThrowing, 'Second');
620
+         * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
621
+         *
622
+         * // If it was intended to match for the error message do this instead:
623
+         * // It does not throw because the error messages match.
624
+         * assert.throws(throwingSecond, /Second$/);
625
+         *
626
+         * // If the error message does not match, an AssertionError is thrown.
627
+         * assert.throws(throwingFirst, /Second$/);
628
+         * // AssertionError [ERR_ASSERTION]
629
+         * ```
630
+         *
631
+         * Due to the confusing error-prone notation, avoid a string as the second
632
+         * argument.
633
+         * @since v0.1.21
634
+         */
635
+        function throws(block: () => unknown, message?: string | Error): void;
636
+        function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
637
+        /**
638
+         * Asserts that the function `fn` does not throw an error.
639
+         *
640
+         * Using `assert.doesNotThrow()` is actually not useful because there
641
+         * is no benefit in catching an error and then rethrowing it. Instead, consider
642
+         * adding a comment next to the specific code path that should not throw and keep
643
+         * error messages as expressive as possible.
644
+         *
645
+         * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
646
+         *
647
+         * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
648
+         * different type, or if the `error` parameter is undefined, the error is
649
+         * propagated back to the caller.
650
+         *
651
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
652
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
653
+         * function. See {@link throws} for more details.
654
+         *
655
+         * The following, for instance, will throw the `TypeError` because there is no
656
+         * matching error type in the assertion:
657
+         *
658
+         * ```js
659
+         * import assert from 'assert/strict';
660
+         *
661
+         * assert.doesNotThrow(
662
+         *   () => {
663
+         *     throw new TypeError('Wrong value');
664
+         *   },
665
+         *   SyntaxError
666
+         * );
667
+         * ```
668
+         *
669
+         * However, the following will result in an `AssertionError` with the message
670
+         * 'Got unwanted exception...':
671
+         *
672
+         * ```js
673
+         * import assert from 'assert/strict';
674
+         *
675
+         * assert.doesNotThrow(
676
+         *   () => {
677
+         *     throw new TypeError('Wrong value');
678
+         *   },
679
+         *   TypeError
680
+         * );
681
+         * ```
682
+         *
683
+         * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
684
+         *
685
+         * ```js
686
+         * import assert from 'assert/strict';
687
+         *
688
+         * assert.doesNotThrow(
689
+         *   () => {
690
+         *     throw new TypeError('Wrong value');
691
+         *   },
692
+         *   /Wrong value/,
693
+         *   'Whoops'
694
+         * );
695
+         * // Throws: AssertionError: Got unwanted exception: Whoops
696
+         * ```
697
+         * @since v0.1.21
698
+         */
699
+        function doesNotThrow(block: () => unknown, message?: string | Error): void;
700
+        function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
701
+        /**
702
+         * Throws `value` if `value` is not `undefined` or `null`. This is useful when
703
+         * testing the `error` argument in callbacks. The stack trace contains all frames
704
+         * from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
705
+         *
706
+         * ```js
707
+         * import assert from 'assert/strict';
708
+         *
709
+         * assert.ifError(null);
710
+         * // OK
711
+         * assert.ifError(0);
712
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
713
+         * assert.ifError('error');
714
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
715
+         * assert.ifError(new Error());
716
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
717
+         *
718
+         * // Create some random error frames.
719
+         * let err;
720
+         * (function errorFrame() {
721
+         *   err = new Error('test error');
722
+         * })();
723
+         *
724
+         * (function ifErrorFrame() {
725
+         *   assert.ifError(err);
726
+         * })();
727
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
728
+         * //     at ifErrorFrame
729
+         * //     at errorFrame
730
+         * ```
731
+         * @since v0.1.97
732
+         */
733
+        function ifError(value: unknown): asserts value is null | undefined;
734
+        /**
735
+         * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
736
+         * calls the function and awaits the returned promise to complete. It will then
737
+         * check that the promise is rejected.
738
+         *
739
+         * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
740
+         * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
741
+         * handler is skipped.
742
+         *
743
+         * Besides the async nature to await the completion behaves identically to {@link throws}.
744
+         *
745
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
746
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
747
+         * an object where each property will be tested for, or an instance of error where
748
+         * each property will be tested for including the non-enumerable `message` and`name` properties.
749
+         *
750
+         * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
751
+         *
752
+         * ```js
753
+         * import assert from 'assert/strict';
754
+         *
755
+         * await assert.rejects(
756
+         *   async () => {
757
+         *     throw new TypeError('Wrong value');
758
+         *   },
759
+         *   {
760
+         *     name: 'TypeError',
761
+         *     message: 'Wrong value'
762
+         *   }
763
+         * );
764
+         * ```
765
+         *
766
+         * ```js
767
+         * import assert from 'assert/strict';
768
+         *
769
+         * await assert.rejects(
770
+         *   async () => {
771
+         *     throw new TypeError('Wrong value');
772
+         *   },
773
+         *   (err) => {
774
+         *     assert.strictEqual(err.name, 'TypeError');
775
+         *     assert.strictEqual(err.message, 'Wrong value');
776
+         *     return true;
777
+         *   }
778
+         * );
779
+         * ```
780
+         *
781
+         * ```js
782
+         * import assert from 'assert/strict';
783
+         *
784
+         * assert.rejects(
785
+         *   Promise.reject(new Error('Wrong value')),
786
+         *   Error
787
+         * ).then(() => {
788
+         *   // ...
789
+         * });
790
+         * ```
791
+         *
792
+         * `error` cannot be a string. If a string is provided as the second
793
+         * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
794
+         * example in {@link throws} carefully if using a string as the second
795
+         * argument gets considered.
796
+         * @since v10.0.0
797
+         */
798
+        function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
799
+        function rejects(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
800
+        /**
801
+         * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
802
+         * calls the function and awaits the returned promise to complete. It will then
803
+         * check that the promise is not rejected.
804
+         *
805
+         * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
806
+         * the function does not return a promise, `assert.doesNotReject()` will return a
807
+         * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
808
+         * the error handler is skipped.
809
+         *
810
+         * Using `assert.doesNotReject()` is actually not useful because there is little
811
+         * benefit in catching a rejection and then rejecting it again. Instead, consider
812
+         * adding a comment next to the specific code path that should not reject and keep
813
+         * error messages as expressive as possible.
814
+         *
815
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
816
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
817
+         * function. See {@link throws} for more details.
818
+         *
819
+         * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
820
+         *
821
+         * ```js
822
+         * import assert from 'assert/strict';
823
+         *
824
+         * await assert.doesNotReject(
825
+         *   async () => {
826
+         *     throw new TypeError('Wrong value');
827
+         *   },
828
+         *   SyntaxError
829
+         * );
830
+         * ```
831
+         *
832
+         * ```js
833
+         * import assert from 'assert/strict';
834
+         *
835
+         * assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
836
+         *   .then(() => {
837
+         *     // ...
838
+         *   });
839
+         * ```
840
+         * @since v10.0.0
841
+         */
842
+        function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
843
+        function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
844
+        /**
845
+         * Expects the `string` input to match the regular expression.
846
+         *
847
+         * ```js
848
+         * import assert from 'assert/strict';
849
+         *
850
+         * assert.match('I will fail', /pass/);
851
+         * // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
852
+         *
853
+         * assert.match(123, /pass/);
854
+         * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
855
+         *
856
+         * assert.match('I will pass', /pass/);
857
+         * // OK
858
+         * ```
859
+         *
860
+         * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
861
+         * to the value of the `message` parameter. If the `message` parameter is
862
+         * undefined, a default error message is assigned. If the `message` parameter is an
863
+         * instance of an `Error` then it will be thrown instead of the `AssertionError`.
864
+         * @since v13.6.0, v12.16.0
865
+         */
866
+        function match(value: string, regExp: RegExp, message?: string | Error): void;
867
+        /**
868
+         * Expects the `string` input not to match the regular expression.
869
+         *
870
+         * ```js
871
+         * import assert from 'assert/strict';
872
+         *
873
+         * assert.doesNotMatch('I will fail', /fail/);
874
+         * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
875
+         *
876
+         * assert.doesNotMatch(123, /pass/);
877
+         * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
878
+         *
879
+         * assert.doesNotMatch('I will pass', /different/);
880
+         * // OK
881
+         * ```
882
+         *
883
+         * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
884
+         * to the value of the `message` parameter. If the `message` parameter is
885
+         * undefined, a default error message is assigned. If the `message` parameter is an
886
+         * instance of an `Error` then it will be thrown instead of the `AssertionError`.
887
+         * @since v13.6.0, v12.16.0
888
+         */
889
+        function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
890
+        const strict: Omit<typeof assert, 'equal' | 'notEqual' | 'deepEqual' | 'notDeepEqual' | 'ok' | 'strictEqual' | 'deepStrictEqual' | 'ifError' | 'strict'> & {
891
+            (value: unknown, message?: string | Error): asserts value;
892
+            equal: typeof strictEqual;
893
+            notEqual: typeof notStrictEqual;
894
+            deepEqual: typeof deepStrictEqual;
895
+            notDeepEqual: typeof notDeepStrictEqual;
896
+            // Mapped types and assertion functions are incompatible?
897
+            // TS2775: Assertions require every name in the call target
898
+            // to be declared with an explicit type annotation.
899
+            ok: typeof ok;
900
+            strictEqual: typeof strictEqual;
901
+            deepStrictEqual: typeof deepStrictEqual;
902
+            ifError: typeof ifError;
903
+            strict: typeof strict;
904
+        };
905
+    }
906
+    export = assert;
907
+}
908
+declare module 'node:assert' {
909
+    import assert = require('assert');
910
+    export = assert;
911
+}

+ 8
- 0
node_modules/@types/node/assert/strict.d.ts 查看文件

@@ -0,0 +1,8 @@
1
+declare module 'assert/strict' {
2
+    import { strict } from 'node:assert';
3
+    export = strict;
4
+}
5
+declare module 'node:assert/strict' {
6
+    import { strict } from 'node:assert';
7
+    export = strict;
8
+}

+ 501
- 0
node_modules/@types/node/async_hooks.d.ts 查看文件

@@ -0,0 +1,501 @@
1
+/**
2
+ * The `async_hooks` module provides an API to track asynchronous resources. It
3
+ * can be accessed using:
4
+ *
5
+ * ```js
6
+ * import async_hooks from 'async_hooks';
7
+ * ```
8
+ * @experimental
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/async_hooks.js)
10
+ */
11
+declare module 'async_hooks' {
12
+    /**
13
+     * ```js
14
+     * import { executionAsyncId } from 'async_hooks';
15
+     *
16
+     * console.log(executionAsyncId());  // 1 - bootstrap
17
+     * fs.open(path, 'r', (err, fd) => {
18
+     *   console.log(executionAsyncId());  // 6 - open()
19
+     * });
20
+     * ```
21
+     *
22
+     * The ID returned from `executionAsyncId()` is related to execution timing, not
23
+     * causality (which is covered by `triggerAsyncId()`):
24
+     *
25
+     * ```js
26
+     * const server = net.createServer((conn) => {
27
+     *   // Returns the ID of the server, not of the new connection, because the
28
+     *   // callback runs in the execution scope of the server's MakeCallback().
29
+     *   async_hooks.executionAsyncId();
30
+     *
31
+     * }).listen(port, () => {
32
+     *   // Returns the ID of a TickObject (process.nextTick()) because all
33
+     *   // callbacks passed to .listen() are wrapped in a nextTick().
34
+     *   async_hooks.executionAsyncId();
35
+     * });
36
+     * ```
37
+     *
38
+     * Promise contexts may not get precise `executionAsyncIds` by default.
39
+     * See the section on `promise execution tracking`.
40
+     * @since v8.1.0
41
+     * @return The `asyncId` of the current execution context. Useful to track when something calls.
42
+     */
43
+    function executionAsyncId(): number;
44
+    /**
45
+     * Resource objects returned by `executionAsyncResource()` are most often internal
46
+     * Node.js handle objects with undocumented APIs. Using any functions or properties
47
+     * on the object is likely to crash your application and should be avoided.
48
+     *
49
+     * Using `executionAsyncResource()` in the top-level execution context will
50
+     * return an empty object as there is no handle or request object to use,
51
+     * but having an object representing the top-level can be helpful.
52
+     *
53
+     * ```js
54
+     * import { open } from 'fs';
55
+     * import { executionAsyncId, executionAsyncResource } from 'async_hooks';
56
+     *
57
+     * console.log(executionAsyncId(), executionAsyncResource());  // 1 {}
58
+     * open(new URL(import.meta.url), 'r', (err, fd) => {
59
+     *   console.log(executionAsyncId(), executionAsyncResource());  // 7 FSReqWrap
60
+     * });
61
+     * ```
62
+     *
63
+     * This can be used to implement continuation local storage without the
64
+     * use of a tracking `Map` to store the metadata:
65
+     *
66
+     * ```js
67
+     * import { createServer } from 'http';
68
+     * import {
69
+     *   executionAsyncId,
70
+     *   executionAsyncResource,
71
+     *   createHook
72
+     * } from 'async_hooks';
73
+     * const sym = Symbol('state'); // Private symbol to avoid pollution
74
+     *
75
+     * createHook({
76
+     *   init(asyncId, type, triggerAsyncId, resource) {
77
+     *     const cr = executionAsyncResource();
78
+     *     if (cr) {
79
+     *       resource[sym] = cr[sym];
80
+     *     }
81
+     *   }
82
+     * }).enable();
83
+     *
84
+     * const server = createServer((req, res) => {
85
+     *   executionAsyncResource()[sym] = { state: req.url };
86
+     *   setTimeout(function() {
87
+     *     res.end(JSON.stringify(executionAsyncResource()[sym]));
88
+     *   }, 100);
89
+     * }).listen(3000);
90
+     * ```
91
+     * @since v13.9.0, v12.17.0
92
+     * @return The resource representing the current execution. Useful to store data within the resource.
93
+     */
94
+    function executionAsyncResource(): object;
95
+    /**
96
+     * ```js
97
+     * const server = net.createServer((conn) => {
98
+     *   // The resource that caused (or triggered) this callback to be called
99
+     *   // was that of the new connection. Thus the return value of triggerAsyncId()
100
+     *   // is the asyncId of "conn".
101
+     *   async_hooks.triggerAsyncId();
102
+     *
103
+     * }).listen(port, () => {
104
+     *   // Even though all callbacks passed to .listen() are wrapped in a nextTick()
105
+     *   // the callback itself exists because the call to the server's .listen()
106
+     *   // was made. So the return value would be the ID of the server.
107
+     *   async_hooks.triggerAsyncId();
108
+     * });
109
+     * ```
110
+     *
111
+     * Promise contexts may not get valid `triggerAsyncId`s by default. See
112
+     * the section on `promise execution tracking`.
113
+     * @return The ID of the resource responsible for calling the callback that is currently being executed.
114
+     */
115
+    function triggerAsyncId(): number;
116
+    interface HookCallbacks {
117
+        /**
118
+         * Called when a class is constructed that has the possibility to emit an asynchronous event.
119
+         * @param asyncId a unique ID for the async resource
120
+         * @param type the type of the async resource
121
+         * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
122
+         * @param resource reference to the resource representing the async operation, needs to be released during destroy
123
+         */
124
+        init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
125
+        /**
126
+         * When an asynchronous operation is initiated or completes a callback is called to notify the user.
127
+         * The before callback is called just before said callback is executed.
128
+         * @param asyncId the unique identifier assigned to the resource about to execute the callback.
129
+         */
130
+        before?(asyncId: number): void;
131
+        /**
132
+         * Called immediately after the callback specified in before is completed.
133
+         * @param asyncId the unique identifier assigned to the resource which has executed the callback.
134
+         */
135
+        after?(asyncId: number): void;
136
+        /**
137
+         * Called when a promise has resolve() called. This may not be in the same execution id
138
+         * as the promise itself.
139
+         * @param asyncId the unique id for the promise that was resolve()d.
140
+         */
141
+        promiseResolve?(asyncId: number): void;
142
+        /**
143
+         * Called after the resource corresponding to asyncId is destroyed
144
+         * @param asyncId a unique ID for the async resource
145
+         */
146
+        destroy?(asyncId: number): void;
147
+    }
148
+    interface AsyncHook {
149
+        /**
150
+         * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
151
+         */
152
+        enable(): this;
153
+        /**
154
+         * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
155
+         */
156
+        disable(): this;
157
+    }
158
+    /**
159
+     * Registers functions to be called for different lifetime events of each async
160
+     * operation.
161
+     *
162
+     * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
163
+     * respective asynchronous event during a resource's lifetime.
164
+     *
165
+     * All callbacks are optional. For example, if only resource cleanup needs to
166
+     * be tracked, then only the `destroy` callback needs to be passed. The
167
+     * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
168
+     *
169
+     * ```js
170
+     * import { createHook } from 'async_hooks';
171
+     *
172
+     * const asyncHook = createHook({
173
+     *   init(asyncId, type, triggerAsyncId, resource) { },
174
+     *   destroy(asyncId) { }
175
+     * });
176
+     * ```
177
+     *
178
+     * The callbacks will be inherited via the prototype chain:
179
+     *
180
+     * ```js
181
+     * class MyAsyncCallbacks {
182
+     *   init(asyncId, type, triggerAsyncId, resource) { }
183
+     *   destroy(asyncId) {}
184
+     * }
185
+     *
186
+     * class MyAddedCallbacks extends MyAsyncCallbacks {
187
+     *   before(asyncId) { }
188
+     *   after(asyncId) { }
189
+     * }
190
+     *
191
+     * const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
192
+     * ```
193
+     *
194
+     * Because promises are asynchronous resources whose lifecycle is tracked
195
+     * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
196
+     * @since v8.1.0
197
+     * @param callbacks The `Hook Callbacks` to register
198
+     * @return Instance used for disabling and enabling hooks
199
+     */
200
+    function createHook(callbacks: HookCallbacks): AsyncHook;
201
+    interface AsyncResourceOptions {
202
+        /**
203
+         * The ID of the execution context that created this async event.
204
+         * @default executionAsyncId()
205
+         */
206
+        triggerAsyncId?: number | undefined;
207
+        /**
208
+         * Disables automatic `emitDestroy` when the object is garbage collected.
209
+         * This usually does not need to be set (even if `emitDestroy` is called
210
+         * manually), unless the resource's `asyncId` is retrieved and the
211
+         * sensitive API's `emitDestroy` is called with it.
212
+         * @default false
213
+         */
214
+        requireManualDestroy?: boolean | undefined;
215
+    }
216
+    /**
217
+     * The class `AsyncResource` is designed to be extended by the embedder's async
218
+     * resources. Using this, users can easily trigger the lifetime events of their
219
+     * own resources.
220
+     *
221
+     * The `init` hook will trigger when an `AsyncResource` is instantiated.
222
+     *
223
+     * The following is an overview of the `AsyncResource` API.
224
+     *
225
+     * ```js
226
+     * import { AsyncResource, executionAsyncId } from 'async_hooks';
227
+     *
228
+     * // AsyncResource() is meant to be extended. Instantiating a
229
+     * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
230
+     * // async_hook.executionAsyncId() is used.
231
+     * const asyncResource = new AsyncResource(
232
+     *   type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
233
+     * );
234
+     *
235
+     * // Run a function in the execution context of the resource. This will
236
+     * // * establish the context of the resource
237
+     * // * trigger the AsyncHooks before callbacks
238
+     * // * call the provided function `fn` with the supplied arguments
239
+     * // * trigger the AsyncHooks after callbacks
240
+     * // * restore the original execution context
241
+     * asyncResource.runInAsyncScope(fn, thisArg, ...args);
242
+     *
243
+     * // Call AsyncHooks destroy callbacks.
244
+     * asyncResource.emitDestroy();
245
+     *
246
+     * // Return the unique ID assigned to the AsyncResource instance.
247
+     * asyncResource.asyncId();
248
+     *
249
+     * // Return the trigger ID for the AsyncResource instance.
250
+     * asyncResource.triggerAsyncId();
251
+     * ```
252
+     */
253
+    class AsyncResource {
254
+        /**
255
+         * AsyncResource() is meant to be extended. Instantiating a
256
+         * new AsyncResource() also triggers init. If triggerAsyncId is omitted then
257
+         * async_hook.executionAsyncId() is used.
258
+         * @param type The type of async event.
259
+         * @param triggerAsyncId The ID of the execution context that created
260
+         *   this async event (default: `executionAsyncId()`), or an
261
+         *   AsyncResourceOptions object (since v9.3.0)
262
+         */
263
+        constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
264
+        /**
265
+         * Binds the given function to the current execution context.
266
+         *
267
+         * The returned function will have an `asyncResource` property referencing
268
+         * the `AsyncResource` to which the function is bound.
269
+         * @since v14.8.0, v12.19.0
270
+         * @param fn The function to bind to the current execution context.
271
+         * @param type An optional name to associate with the underlying `AsyncResource`.
272
+         */
273
+        static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
274
+            fn: Func,
275
+            type?: string,
276
+            thisArg?: ThisArg
277
+        ): Func & {
278
+            asyncResource: AsyncResource;
279
+        };
280
+        /**
281
+         * Binds the given function to execute to this `AsyncResource`'s scope.
282
+         *
283
+         * The returned function will have an `asyncResource` property referencing
284
+         * the `AsyncResource` to which the function is bound.
285
+         * @since v14.8.0, v12.19.0
286
+         * @param fn The function to bind to the current `AsyncResource`.
287
+         */
288
+        bind<Func extends (...args: any[]) => any>(
289
+            fn: Func
290
+        ): Func & {
291
+            asyncResource: AsyncResource;
292
+        };
293
+        /**
294
+         * Call the provided function with the provided arguments in the execution context
295
+         * of the async resource. This will establish the context, trigger the AsyncHooks
296
+         * before callbacks, call the function, trigger the AsyncHooks after callbacks, and
297
+         * then restore the original execution context.
298
+         * @since v9.6.0
299
+         * @param fn The function to call in the execution context of this async resource.
300
+         * @param thisArg The receiver to be used for the function call.
301
+         * @param args Optional arguments to pass to the function.
302
+         */
303
+        runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
304
+        /**
305
+         * Call all `destroy` hooks. This should only ever be called once. An error will
306
+         * be thrown if it is called more than once. This **must** be manually called. If
307
+         * the resource is left to be collected by the GC then the `destroy` hooks will
308
+         * never be called.
309
+         * @return A reference to `asyncResource`.
310
+         */
311
+        emitDestroy(): this;
312
+        /**
313
+         * @return The unique `asyncId` assigned to the resource.
314
+         */
315
+        asyncId(): number;
316
+        /**
317
+         *
318
+         * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
319
+         */
320
+        triggerAsyncId(): number;
321
+    }
322
+    /**
323
+     * This class creates stores that stay coherent through asynchronous operations.
324
+     *
325
+     * While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
326
+     * implementation that involves significant optimizations that are non-obvious to
327
+     * implement.
328
+     *
329
+     * The following example uses `AsyncLocalStorage` to build a simple logger
330
+     * that assigns IDs to incoming HTTP requests and includes them in messages
331
+     * logged within each request.
332
+     *
333
+     * ```js
334
+     * import http from 'http';
335
+     * import { AsyncLocalStorage } from 'async_hooks';
336
+     *
337
+     * const asyncLocalStorage = new AsyncLocalStorage();
338
+     *
339
+     * function logWithId(msg) {
340
+     *   const id = asyncLocalStorage.getStore();
341
+     *   console.log(`${id !== undefined ? id : '-'}:`, msg);
342
+     * }
343
+     *
344
+     * let idSeq = 0;
345
+     * http.createServer((req, res) => {
346
+     *   asyncLocalStorage.run(idSeq++, () => {
347
+     *     logWithId('start');
348
+     *     // Imagine any chain of async operations here
349
+     *     setImmediate(() => {
350
+     *       logWithId('finish');
351
+     *       res.end();
352
+     *     });
353
+     *   });
354
+     * }).listen(8080);
355
+     *
356
+     * http.get('http://localhost:8080');
357
+     * http.get('http://localhost:8080');
358
+     * // Prints:
359
+     * //   0: start
360
+     * //   1: start
361
+     * //   0: finish
362
+     * //   1: finish
363
+     * ```
364
+     *
365
+     * Each instance of `AsyncLocalStorage` maintains an independent storage context.
366
+     * Multiple instances can safely exist simultaneously without risk of interfering
367
+     * with each other's data.
368
+     * @since v13.10.0, v12.17.0
369
+     */
370
+    class AsyncLocalStorage<T> {
371
+        /**
372
+         * Disables the instance of `AsyncLocalStorage`. All subsequent calls
373
+         * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
374
+         *
375
+         * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
376
+         * instance will be exited.
377
+         *
378
+         * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
379
+         * provided by the `asyncLocalStorage`, as those objects are garbage collected
380
+         * along with the corresponding async resources.
381
+         *
382
+         * Use this method when the `asyncLocalStorage` is not in use anymore
383
+         * in the current process.
384
+         * @since v13.10.0, v12.17.0
385
+         * @experimental
386
+         */
387
+        disable(): void;
388
+        /**
389
+         * Returns the current store.
390
+         * If called outside of an asynchronous context initialized by
391
+         * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
392
+         * returns `undefined`.
393
+         * @since v13.10.0, v12.17.0
394
+         */
395
+        getStore(): T | undefined;
396
+        /**
397
+         * Runs a function synchronously within a context and returns its
398
+         * return value. The store is not accessible outside of the callback function.
399
+         * The store is accessible to any asynchronous operations created within the
400
+         * callback.
401
+         *
402
+         * The optional `args` are passed to the callback function.
403
+         *
404
+         * If the callback function throws an error, the error is thrown by `run()` too.
405
+         * The stacktrace is not impacted by this call and the context is exited.
406
+         *
407
+         * Example:
408
+         *
409
+         * ```js
410
+         * const store = { id: 2 };
411
+         * try {
412
+         *   asyncLocalStorage.run(store, () => {
413
+         *     asyncLocalStorage.getStore(); // Returns the store object
414
+         *     setTimeout(() => {
415
+         *       asyncLocalStorage.getStore(); // Returns the store object
416
+         *     }, 200);
417
+         *     throw new Error();
418
+         *   });
419
+         * } catch (e) {
420
+         *   asyncLocalStorage.getStore(); // Returns undefined
421
+         *   // The error will be caught here
422
+         * }
423
+         * ```
424
+         * @since v13.10.0, v12.17.0
425
+         */
426
+        run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
427
+        /**
428
+         * Runs a function synchronously outside of a context and returns its
429
+         * return value. The store is not accessible within the callback function or
430
+         * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
431
+         *
432
+         * The optional `args` are passed to the callback function.
433
+         *
434
+         * If the callback function throws an error, the error is thrown by `exit()` too.
435
+         * The stacktrace is not impacted by this call and the context is re-entered.
436
+         *
437
+         * Example:
438
+         *
439
+         * ```js
440
+         * // Within a call to run
441
+         * try {
442
+         *   asyncLocalStorage.getStore(); // Returns the store object or value
443
+         *   asyncLocalStorage.exit(() => {
444
+         *     asyncLocalStorage.getStore(); // Returns undefined
445
+         *     throw new Error();
446
+         *   });
447
+         * } catch (e) {
448
+         *   asyncLocalStorage.getStore(); // Returns the same object or value
449
+         *   // The error will be caught here
450
+         * }
451
+         * ```
452
+         * @since v13.10.0, v12.17.0
453
+         * @experimental
454
+         */
455
+        exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
456
+        /**
457
+         * Transitions into the context for the remainder of the current
458
+         * synchronous execution and then persists the store through any following
459
+         * asynchronous calls.
460
+         *
461
+         * Example:
462
+         *
463
+         * ```js
464
+         * const store = { id: 1 };
465
+         * // Replaces previous store with the given store object
466
+         * asyncLocalStorage.enterWith(store);
467
+         * asyncLocalStorage.getStore(); // Returns the store object
468
+         * someAsyncOperation(() => {
469
+         *   asyncLocalStorage.getStore(); // Returns the same object
470
+         * });
471
+         * ```
472
+         *
473
+         * This transition will continue for the _entire_ synchronous execution.
474
+         * This means that if, for example, the context is entered within an event
475
+         * handler subsequent event handlers will also run within that context unless
476
+         * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
477
+         * to use the latter method.
478
+         *
479
+         * ```js
480
+         * const store = { id: 1 };
481
+         *
482
+         * emitter.on('my-event', () => {
483
+         *   asyncLocalStorage.enterWith(store);
484
+         * });
485
+         * emitter.on('my-event', () => {
486
+         *   asyncLocalStorage.getStore(); // Returns the same object
487
+         * });
488
+         *
489
+         * asyncLocalStorage.getStore(); // Returns undefined
490
+         * emitter.emit('my-event');
491
+         * asyncLocalStorage.getStore(); // Returns the same object
492
+         * ```
493
+         * @since v13.11.0, v12.17.0
494
+         * @experimental
495
+         */
496
+        enterWith(store: T): void;
497
+    }
498
+}
499
+declare module 'node:async_hooks' {
500
+    export * from 'async_hooks';
501
+}

+ 2258
- 0
node_modules/@types/node/buffer.d.ts
文件差異過大導致無法顯示
查看文件


+ 1369
- 0
node_modules/@types/node/child_process.d.ts
文件差異過大導致無法顯示
查看文件


+ 410
- 0
node_modules/@types/node/cluster.d.ts 查看文件

@@ -0,0 +1,410 @@
1
+/**
2
+ * Clusters of Node.js processes can be used to run multiple instances of Node.js
3
+ * that can distribute workloads among their application threads. When process
4
+ * isolation is not needed, use the `worker_threads` module instead, which
5
+ * allows running multiple application threads within a single Node.js instance.
6
+ *
7
+ * The cluster module allows easy creation of child processes that all share
8
+ * server ports.
9
+ *
10
+ * ```js
11
+ * import cluster from 'cluster';
12
+ * import http from 'http';
13
+ * import { cpus } from 'os';
14
+ * import process from 'process';
15
+ *
16
+ * const numCPUs = cpus().length;
17
+ *
18
+ * if (cluster.isPrimary) {
19
+ *   console.log(`Primary ${process.pid} is running`);
20
+ *
21
+ *   // Fork workers.
22
+ *   for (let i = 0; i < numCPUs; i++) {
23
+ *     cluster.fork();
24
+ *   }
25
+ *
26
+ *   cluster.on('exit', (worker, code, signal) => {
27
+ *     console.log(`worker ${worker.process.pid} died`);
28
+ *   });
29
+ * } else {
30
+ *   // Workers can share any TCP connection
31
+ *   // In this case it is an HTTP server
32
+ *   http.createServer((req, res) => {
33
+ *     res.writeHead(200);
34
+ *     res.end('hello world\n');
35
+ *   }).listen(8000);
36
+ *
37
+ *   console.log(`Worker ${process.pid} started`);
38
+ * }
39
+ * ```
40
+ *
41
+ * Running Node.js will now share port 8000 between the workers:
42
+ *
43
+ * ```console
44
+ * $ node server.js
45
+ * Primary 3596 is running
46
+ * Worker 4324 started
47
+ * Worker 4520 started
48
+ * Worker 6056 started
49
+ * Worker 5644 started
50
+ * ```
51
+ *
52
+ * On Windows, it is not yet possible to set up a named pipe server in a worker.
53
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
54
+ */
55
+declare module 'cluster' {
56
+    import * as child from 'node:child_process';
57
+    import EventEmitter = require('node:events');
58
+    import * as net from 'node:net';
59
+    export interface ClusterSettings {
60
+        execArgv?: string[] | undefined; // default: process.execArgv
61
+        exec?: string | undefined;
62
+        args?: string[] | undefined;
63
+        silent?: boolean | undefined;
64
+        stdio?: any[] | undefined;
65
+        uid?: number | undefined;
66
+        gid?: number | undefined;
67
+        inspectPort?: number | (() => number) | undefined;
68
+    }
69
+    export interface Address {
70
+        address: string;
71
+        port: number;
72
+        addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
73
+    }
74
+    /**
75
+     * A `Worker` object contains all public information and method about a worker.
76
+     * In the primary it can be obtained using `cluster.workers`. In a worker
77
+     * it can be obtained using `cluster.worker`.
78
+     * @since v0.7.0
79
+     */
80
+    export class Worker extends EventEmitter {
81
+        /**
82
+         * Each new worker is given its own unique id, this id is stored in the`id`.
83
+         *
84
+         * While a worker is alive, this is the key that indexes it in`cluster.workers`.
85
+         * @since v0.8.0
86
+         */
87
+        id: number;
88
+        /**
89
+         * All workers are created using `child_process.fork()`, the returned object
90
+         * from this function is stored as `.process`. In a worker, the global `process`is stored.
91
+         *
92
+         * See: `Child Process module`.
93
+         *
94
+         * Workers will call `process.exit(0)` if the `'disconnect'` event occurs
95
+         * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
96
+         * accidental disconnection.
97
+         * @since v0.7.0
98
+         */
99
+        process: child.ChildProcess;
100
+        /**
101
+         * Send a message to a worker or primary, optionally with a handle.
102
+         *
103
+         * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
104
+         *
105
+         * In a worker, this sends a message to the primary. It is identical to`process.send()`.
106
+         *
107
+         * This example will echo back all messages from the primary:
108
+         *
109
+         * ```js
110
+         * if (cluster.isPrimary) {
111
+         *   const worker = cluster.fork();
112
+         *   worker.send('hi there');
113
+         *
114
+         * } else if (cluster.isWorker) {
115
+         *   process.on('message', (msg) => {
116
+         *     process.send(msg);
117
+         *   });
118
+         * }
119
+         * ```
120
+         * @since v0.7.0
121
+         * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
122
+         */
123
+        send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
124
+        send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
125
+        send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
126
+        /**
127
+         * This function will kill the worker. In the primary worker, it does this by
128
+         * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
129
+         *
130
+         * The `kill()` function kills the worker process without waiting for a graceful
131
+         * disconnect, it has the same behavior as `worker.process.kill()`.
132
+         *
133
+         * This method is aliased as `worker.destroy()` for backwards compatibility.
134
+         *
135
+         * In a worker, `process.kill()` exists, but it is not this function;
136
+         * it is `kill()`.
137
+         * @since v0.9.12
138
+         * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
139
+         */
140
+        kill(signal?: string): void;
141
+        destroy(signal?: string): void;
142
+        /**
143
+         * In a worker, this function will close all servers, wait for the `'close'` event
144
+         * on those servers, and then disconnect the IPC channel.
145
+         *
146
+         * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
147
+         *
148
+         * Causes `.exitedAfterDisconnect` to be set.
149
+         *
150
+         * After a server is closed, it will no longer accept new connections,
151
+         * but connections may be accepted by any other listening worker. Existing
152
+         * connections will be allowed to close as usual. When no more connections exist,
153
+         * see `server.close()`, the IPC channel to the worker will close allowing it
154
+         * to die gracefully.
155
+         *
156
+         * The above applies _only_ to server connections, client connections are not
157
+         * automatically closed by workers, and disconnect does not wait for them to close
158
+         * before exiting.
159
+         *
160
+         * In a worker, `process.disconnect` exists, but it is not this function;
161
+         * it is `disconnect()`.
162
+         *
163
+         * Because long living server connections may block workers from disconnecting, it
164
+         * may be useful to send a message, so application specific actions may be taken to
165
+         * close them. It also may be useful to implement a timeout, killing a worker if
166
+         * the `'disconnect'` event has not been emitted after some time.
167
+         *
168
+         * ```js
169
+         * if (cluster.isPrimary) {
170
+         *   const worker = cluster.fork();
171
+         *   let timeout;
172
+         *
173
+         *   worker.on('listening', (address) => {
174
+         *     worker.send('shutdown');
175
+         *     worker.disconnect();
176
+         *     timeout = setTimeout(() => {
177
+         *       worker.kill();
178
+         *     }, 2000);
179
+         *   });
180
+         *
181
+         *   worker.on('disconnect', () => {
182
+         *     clearTimeout(timeout);
183
+         *   });
184
+         *
185
+         * } else if (cluster.isWorker) {
186
+         *   const net = require('net');
187
+         *   const server = net.createServer((socket) => {
188
+         *     // Connections never end
189
+         *   });
190
+         *
191
+         *   server.listen(8000);
192
+         *
193
+         *   process.on('message', (msg) => {
194
+         *     if (msg === 'shutdown') {
195
+         *       // Initiate graceful close of any connections to server
196
+         *     }
197
+         *   });
198
+         * }
199
+         * ```
200
+         * @since v0.7.7
201
+         * @return A reference to `worker`.
202
+         */
203
+        disconnect(): void;
204
+        /**
205
+         * This function returns `true` if the worker is connected to its primary via its
206
+         * IPC channel, `false` otherwise. A worker is connected to its primary after it
207
+         * has been created. It is disconnected after the `'disconnect'` event is emitted.
208
+         * @since v0.11.14
209
+         */
210
+        isConnected(): boolean;
211
+        /**
212
+         * This function returns `true` if the worker's process has terminated (either
213
+         * because of exiting or being signaled). Otherwise, it returns `false`.
214
+         *
215
+         * ```js
216
+         * import cluster from 'cluster';
217
+         * import http from 'http';
218
+         * import { cpus } from 'os';
219
+         * import process from 'process';
220
+         *
221
+         * const numCPUs = cpus().length;
222
+         *
223
+         * if (cluster.isPrimary) {
224
+         *   console.log(`Primary ${process.pid} is running`);
225
+         *
226
+         *   // Fork workers.
227
+         *   for (let i = 0; i < numCPUs; i++) {
228
+         *     cluster.fork();
229
+         *   }
230
+         *
231
+         *   cluster.on('fork', (worker) => {
232
+         *     console.log('worker is dead:', worker.isDead());
233
+         *   });
234
+         *
235
+         *   cluster.on('exit', (worker, code, signal) => {
236
+         *     console.log('worker is dead:', worker.isDead());
237
+         *   });
238
+         * } else {
239
+         *   // Workers can share any TCP connection. In this case, it is an HTTP server.
240
+         *   http.createServer((req, res) => {
241
+         *     res.writeHead(200);
242
+         *     res.end(`Current process\n ${process.pid}`);
243
+         *     process.kill(process.pid);
244
+         *   }).listen(8000);
245
+         * }
246
+         * ```
247
+         * @since v0.11.14
248
+         */
249
+        isDead(): boolean;
250
+        /**
251
+         * This property is `true` if the worker exited due to `.disconnect()`.
252
+         * If the worker exited any other way, it is `false`. If the
253
+         * worker has not exited, it is `undefined`.
254
+         *
255
+         * The boolean `worker.exitedAfterDisconnect` allows distinguishing between
256
+         * voluntary and accidental exit, the primary may choose not to respawn a worker
257
+         * based on this value.
258
+         *
259
+         * ```js
260
+         * cluster.on('exit', (worker, code, signal) => {
261
+         *   if (worker.exitedAfterDisconnect === true) {
262
+         *     console.log('Oh, it was just voluntary – no need to worry');
263
+         *   }
264
+         * });
265
+         *
266
+         * // kill worker
267
+         * worker.kill();
268
+         * ```
269
+         * @since v6.0.0
270
+         */
271
+        exitedAfterDisconnect: boolean;
272
+        /**
273
+         * events.EventEmitter
274
+         *   1. disconnect
275
+         *   2. error
276
+         *   3. exit
277
+         *   4. listening
278
+         *   5. message
279
+         *   6. online
280
+         */
281
+        addListener(event: string, listener: (...args: any[]) => void): this;
282
+        addListener(event: 'disconnect', listener: () => void): this;
283
+        addListener(event: 'error', listener: (error: Error) => void): this;
284
+        addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
285
+        addListener(event: 'listening', listener: (address: Address) => void): this;
286
+        addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
287
+        addListener(event: 'online', listener: () => void): this;
288
+        emit(event: string | symbol, ...args: any[]): boolean;
289
+        emit(event: 'disconnect'): boolean;
290
+        emit(event: 'error', error: Error): boolean;
291
+        emit(event: 'exit', code: number, signal: string): boolean;
292
+        emit(event: 'listening', address: Address): boolean;
293
+        emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
294
+        emit(event: 'online'): boolean;
295
+        on(event: string, listener: (...args: any[]) => void): this;
296
+        on(event: 'disconnect', listener: () => void): this;
297
+        on(event: 'error', listener: (error: Error) => void): this;
298
+        on(event: 'exit', listener: (code: number, signal: string) => void): this;
299
+        on(event: 'listening', listener: (address: Address) => void): this;
300
+        on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
301
+        on(event: 'online', listener: () => void): this;
302
+        once(event: string, listener: (...args: any[]) => void): this;
303
+        once(event: 'disconnect', listener: () => void): this;
304
+        once(event: 'error', listener: (error: Error) => void): this;
305
+        once(event: 'exit', listener: (code: number, signal: string) => void): this;
306
+        once(event: 'listening', listener: (address: Address) => void): this;
307
+        once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
308
+        once(event: 'online', listener: () => void): this;
309
+        prependListener(event: string, listener: (...args: any[]) => void): this;
310
+        prependListener(event: 'disconnect', listener: () => void): this;
311
+        prependListener(event: 'error', listener: (error: Error) => void): this;
312
+        prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
313
+        prependListener(event: 'listening', listener: (address: Address) => void): this;
314
+        prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
315
+        prependListener(event: 'online', listener: () => void): this;
316
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
317
+        prependOnceListener(event: 'disconnect', listener: () => void): this;
318
+        prependOnceListener(event: 'error', listener: (error: Error) => void): this;
319
+        prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
320
+        prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
321
+        prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
322
+        prependOnceListener(event: 'online', listener: () => void): this;
323
+    }
324
+    export interface Cluster extends EventEmitter {
325
+        disconnect(callback?: () => void): void;
326
+        fork(env?: any): Worker;
327
+        /** @deprecated since v16.0.0 - use isPrimary. */
328
+        readonly isMaster: boolean;
329
+        readonly isPrimary: boolean;
330
+        readonly isWorker: boolean;
331
+        schedulingPolicy: number;
332
+        readonly settings: ClusterSettings;
333
+        /** @deprecated since v16.0.0 - use setupPrimary. */
334
+        setupMaster(settings?: ClusterSettings): void;
335
+        /**
336
+         * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
337
+         */
338
+        setupPrimary(settings?: ClusterSettings): void;
339
+        readonly worker?: Worker | undefined;
340
+        readonly workers?: NodeJS.Dict<Worker> | undefined;
341
+        readonly SCHED_NONE: number;
342
+        readonly SCHED_RR: number;
343
+        /**
344
+         * events.EventEmitter
345
+         *   1. disconnect
346
+         *   2. exit
347
+         *   3. fork
348
+         *   4. listening
349
+         *   5. message
350
+         *   6. online
351
+         *   7. setup
352
+         */
353
+        addListener(event: string, listener: (...args: any[]) => void): this;
354
+        addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
355
+        addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
356
+        addListener(event: 'fork', listener: (worker: Worker) => void): this;
357
+        addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
358
+        addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
359
+        addListener(event: 'online', listener: (worker: Worker) => void): this;
360
+        addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
361
+        emit(event: string | symbol, ...args: any[]): boolean;
362
+        emit(event: 'disconnect', worker: Worker): boolean;
363
+        emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
364
+        emit(event: 'fork', worker: Worker): boolean;
365
+        emit(event: 'listening', worker: Worker, address: Address): boolean;
366
+        emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
367
+        emit(event: 'online', worker: Worker): boolean;
368
+        emit(event: 'setup', settings: ClusterSettings): boolean;
369
+        on(event: string, listener: (...args: any[]) => void): this;
370
+        on(event: 'disconnect', listener: (worker: Worker) => void): this;
371
+        on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
372
+        on(event: 'fork', listener: (worker: Worker) => void): this;
373
+        on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
374
+        on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
375
+        on(event: 'online', listener: (worker: Worker) => void): this;
376
+        on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
377
+        once(event: string, listener: (...args: any[]) => void): this;
378
+        once(event: 'disconnect', listener: (worker: Worker) => void): this;
379
+        once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
380
+        once(event: 'fork', listener: (worker: Worker) => void): this;
381
+        once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
382
+        once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
383
+        once(event: 'online', listener: (worker: Worker) => void): this;
384
+        once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
385
+        prependListener(event: string, listener: (...args: any[]) => void): this;
386
+        prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
387
+        prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
388
+        prependListener(event: 'fork', listener: (worker: Worker) => void): this;
389
+        prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
390
+        // the handle is a net.Socket or net.Server object, or undefined.
391
+        prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
392
+        prependListener(event: 'online', listener: (worker: Worker) => void): this;
393
+        prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
394
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
395
+        prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
396
+        prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
397
+        prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
398
+        prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
399
+        // the handle is a net.Socket or net.Server object, or undefined.
400
+        prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
401
+        prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
402
+        prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
403
+    }
404
+    const cluster: Cluster;
405
+    export default cluster;
406
+}
407
+declare module 'node:cluster' {
408
+    export * from 'cluster';
409
+    export { default as default } from 'cluster';
410
+}

+ 412
- 0
node_modules/@types/node/console.d.ts 查看文件

@@ -0,0 +1,412 @@
1
+/**
2
+ * The `console` module provides a simple debugging console that is similar to the
3
+ * JavaScript console mechanism provided by web browsers.
4
+ *
5
+ * The module exports two specific components:
6
+ *
7
+ * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
8
+ * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
9
+ *
10
+ * _**Warning**_: The global console object's methods are neither consistently
11
+ * synchronous like the browser APIs they resemble, nor are they consistently
12
+ * asynchronous like all other Node.js streams. See the `note on process I/O` for
13
+ * more information.
14
+ *
15
+ * Example using the global `console`:
16
+ *
17
+ * ```js
18
+ * console.log('hello world');
19
+ * // Prints: hello world, to stdout
20
+ * console.log('hello %s', 'world');
21
+ * // Prints: hello world, to stdout
22
+ * console.error(new Error('Whoops, something bad happened'));
23
+ * // Prints error message and stack trace to stderr:
24
+ * //   Error: Whoops, something bad happened
25
+ * //     at [eval]:5:15
26
+ * //     at Script.runInThisContext (node:vm:132:18)
27
+ * //     at Object.runInThisContext (node:vm:309:38)
28
+ * //     at node:internal/process/execution:77:19
29
+ * //     at [eval]-wrapper:6:22
30
+ * //     at evalScript (node:internal/process/execution:76:60)
31
+ * //     at node:internal/main/eval_string:23:3
32
+ *
33
+ * const name = 'Will Robinson';
34
+ * console.warn(`Danger ${name}! Danger!`);
35
+ * // Prints: Danger Will Robinson! Danger!, to stderr
36
+ * ```
37
+ *
38
+ * Example using the `Console` class:
39
+ *
40
+ * ```js
41
+ * const out = getStreamSomehow();
42
+ * const err = getStreamSomehow();
43
+ * const myConsole = new console.Console(out, err);
44
+ *
45
+ * myConsole.log('hello world');
46
+ * // Prints: hello world, to out
47
+ * myConsole.log('hello %s', 'world');
48
+ * // Prints: hello world, to out
49
+ * myConsole.error(new Error('Whoops, something bad happened'));
50
+ * // Prints: [Error: Whoops, something bad happened], to err
51
+ *
52
+ * const name = 'Will Robinson';
53
+ * myConsole.warn(`Danger ${name}! Danger!`);
54
+ * // Prints: Danger Will Robinson! Danger!, to err
55
+ * ```
56
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/console.js)
57
+ */
58
+declare module 'console' {
59
+    import console = require('node:console');
60
+    export = console;
61
+}
62
+declare module 'node:console' {
63
+    import { InspectOptions } from 'node:util';
64
+    global {
65
+        // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
66
+        interface Console {
67
+            Console: console.ConsoleConstructor;
68
+            /**
69
+             * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
70
+             * writes a message and does not otherwise affect execution. The output always
71
+             * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`.
72
+             *
73
+             * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
74
+             *
75
+             * ```js
76
+             * console.assert(true, 'does nothing');
77
+             *
78
+             * console.assert(false, 'Whoops %s work', 'didn\'t');
79
+             * // Assertion failed: Whoops didn't work
80
+             *
81
+             * console.assert();
82
+             * // Assertion failed
83
+             * ```
84
+             * @since v0.1.101
85
+             * @param value The value tested for being truthy.
86
+             * @param message All arguments besides `value` are used as error message.
87
+             */
88
+            assert(value: any, message?: string, ...optionalParams: any[]): void;
89
+            /**
90
+             * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
91
+             * TTY. When `stdout` is not a TTY, this method does nothing.
92
+             *
93
+             * The specific operation of `console.clear()` can vary across operating systems
94
+             * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the
95
+             * current terminal viewport for the Node.js
96
+             * binary.
97
+             * @since v8.3.0
98
+             */
99
+            clear(): void;
100
+            /**
101
+             * Maintains an internal counter specific to `label` and outputs to `stdout` the
102
+             * number of times `console.count()` has been called with the given `label`.
103
+             *
104
+             * ```js
105
+             * > console.count()
106
+             * default: 1
107
+             * undefined
108
+             * > console.count('default')
109
+             * default: 2
110
+             * undefined
111
+             * > console.count('abc')
112
+             * abc: 1
113
+             * undefined
114
+             * > console.count('xyz')
115
+             * xyz: 1
116
+             * undefined
117
+             * > console.count('abc')
118
+             * abc: 2
119
+             * undefined
120
+             * > console.count()
121
+             * default: 3
122
+             * undefined
123
+             * >
124
+             * ```
125
+             * @since v8.3.0
126
+             * @param label The display label for the counter.
127
+             */
128
+            count(label?: string): void;
129
+            /**
130
+             * Resets the internal counter specific to `label`.
131
+             *
132
+             * ```js
133
+             * > console.count('abc');
134
+             * abc: 1
135
+             * undefined
136
+             * > console.countReset('abc');
137
+             * undefined
138
+             * > console.count('abc');
139
+             * abc: 1
140
+             * undefined
141
+             * >
142
+             * ```
143
+             * @since v8.3.0
144
+             * @param label The display label for the counter.
145
+             */
146
+            countReset(label?: string): void;
147
+            /**
148
+             * The `console.debug()` function is an alias for {@link log}.
149
+             * @since v8.0.0
150
+             */
151
+            debug(message?: any, ...optionalParams: any[]): void;
152
+            /**
153
+             * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`.
154
+             * This function bypasses any custom `inspect()` function defined on `obj`.
155
+             * @since v0.1.101
156
+             */
157
+            dir(obj: any, options?: InspectOptions): void;
158
+            /**
159
+             * This method calls `console.log()` passing it the arguments received.
160
+             * This method does not produce any XML formatting.
161
+             * @since v8.0.0
162
+             */
163
+            dirxml(...data: any[]): void;
164
+            /**
165
+             * Prints to `stderr` with newline. Multiple arguments can be passed, with the
166
+             * first used as the primary message and all additional used as substitution
167
+             * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
168
+             *
169
+             * ```js
170
+             * const code = 5;
171
+             * console.error('error #%d', code);
172
+             * // Prints: error #5, to stderr
173
+             * console.error('error', code);
174
+             * // Prints: error 5, to stderr
175
+             * ```
176
+             *
177
+             * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string
178
+             * values are concatenated. See `util.format()` for more information.
179
+             * @since v0.1.100
180
+             */
181
+            error(message?: any, ...optionalParams: any[]): void;
182
+            /**
183
+             * Increases indentation of subsequent lines by spaces for `groupIndentation`length.
184
+             *
185
+             * If one or more `label`s are provided, those are printed first without the
186
+             * additional indentation.
187
+             * @since v8.5.0
188
+             */
189
+            group(...label: any[]): void;
190
+            /**
191
+             * An alias for {@link group}.
192
+             * @since v8.5.0
193
+             */
194
+            groupCollapsed(...label: any[]): void;
195
+            /**
196
+             * Decreases indentation of subsequent lines by spaces for `groupIndentation`length.
197
+             * @since v8.5.0
198
+             */
199
+            groupEnd(): void;
200
+            /**
201
+             * The `console.info()` function is an alias for {@link log}.
202
+             * @since v0.1.100
203
+             */
204
+            info(message?: any, ...optionalParams: any[]): void;
205
+            /**
206
+             * Prints to `stdout` with newline. Multiple arguments can be passed, with the
207
+             * first used as the primary message and all additional used as substitution
208
+             * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
209
+             *
210
+             * ```js
211
+             * const count = 5;
212
+             * console.log('count: %d', count);
213
+             * // Prints: count: 5, to stdout
214
+             * console.log('count:', count);
215
+             * // Prints: count: 5, to stdout
216
+             * ```
217
+             *
218
+             * See `util.format()` for more information.
219
+             * @since v0.1.100
220
+             */
221
+            log(message?: any, ...optionalParams: any[]): void;
222
+            /**
223
+             * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
224
+             * logging the argument if it can’t be parsed as tabular.
225
+             *
226
+             * ```js
227
+             * // These can't be parsed as tabular data
228
+             * console.table(Symbol());
229
+             * // Symbol()
230
+             *
231
+             * console.table(undefined);
232
+             * // undefined
233
+             *
234
+             * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
235
+             * // ┌─────────┬─────┬─────┐
236
+             * // │ (index) │  a  │  b  │
237
+             * // ├─────────┼─────┼─────┤
238
+             * // │    0    │  1  │ 'Y' │
239
+             * // │    1    │ 'Z' │  2  │
240
+             * // └─────────┴─────┴─────┘
241
+             *
242
+             * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
243
+             * // ┌─────────┬─────┐
244
+             * // │ (index) │  a  │
245
+             * // ├─────────┼─────┤
246
+             * // │    0    │  1  │
247
+             * // │    1    │ 'Z' │
248
+             * // └─────────┴─────┘
249
+             * ```
250
+             * @since v10.0.0
251
+             * @param properties Alternate properties for constructing the table.
252
+             */
253
+            table(tabularData: any, properties?: ReadonlyArray<string>): void;
254
+            /**
255
+             * Starts a timer that can be used to compute the duration of an operation. Timers
256
+             * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
257
+             * suitable time units to `stdout`. For example, if the elapsed
258
+             * time is 3869ms, `console.timeEnd()` displays "3.869s".
259
+             * @since v0.1.104
260
+             */
261
+            time(label?: string): void;
262
+            /**
263
+             * Stops a timer that was previously started by calling {@link time} and
264
+             * prints the result to `stdout`:
265
+             *
266
+             * ```js
267
+             * console.time('100-elements');
268
+             * for (let i = 0; i < 100; i++) {}
269
+             * console.timeEnd('100-elements');
270
+             * // prints 100-elements: 225.438ms
271
+             * ```
272
+             * @since v0.1.104
273
+             */
274
+            timeEnd(label?: string): void;
275
+            /**
276
+             * For a timer that was previously started by calling {@link time}, prints
277
+             * the elapsed time and other `data` arguments to `stdout`:
278
+             *
279
+             * ```js
280
+             * console.time('process');
281
+             * const value = expensiveProcess1(); // Returns 42
282
+             * console.timeLog('process', value);
283
+             * // Prints "process: 365.227ms 42".
284
+             * doExpensiveProcess2(value);
285
+             * console.timeEnd('process');
286
+             * ```
287
+             * @since v10.7.0
288
+             */
289
+            timeLog(label?: string, ...data: any[]): void;
290
+            /**
291
+             * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code.
292
+             *
293
+             * ```js
294
+             * console.trace('Show me');
295
+             * // Prints: (stack trace will vary based on where trace is called)
296
+             * //  Trace: Show me
297
+             * //    at repl:2:9
298
+             * //    at REPLServer.defaultEval (repl.js:248:27)
299
+             * //    at bound (domain.js:287:14)
300
+             * //    at REPLServer.runBound [as eval] (domain.js:300:12)
301
+             * //    at REPLServer.<anonymous> (repl.js:412:12)
302
+             * //    at emitOne (events.js:82:20)
303
+             * //    at REPLServer.emit (events.js:169:7)
304
+             * //    at REPLServer.Interface._onLine (readline.js:210:10)
305
+             * //    at REPLServer.Interface._line (readline.js:549:8)
306
+             * //    at REPLServer.Interface._ttyWrite (readline.js:826:14)
307
+             * ```
308
+             * @since v0.1.104
309
+             */
310
+            trace(message?: any, ...optionalParams: any[]): void;
311
+            /**
312
+             * The `console.warn()` function is an alias for {@link error}.
313
+             * @since v0.1.100
314
+             */
315
+            warn(message?: any, ...optionalParams: any[]): void;
316
+            // --- Inspector mode only ---
317
+            /**
318
+             * This method does not display anything unless used in the inspector.
319
+             *  Starts a JavaScript CPU profile with an optional label.
320
+             */
321
+            profile(label?: string): void;
322
+            /**
323
+             * This method does not display anything unless used in the inspector.
324
+             *  Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
325
+             */
326
+            profileEnd(label?: string): void;
327
+            /**
328
+             * This method does not display anything unless used in the inspector.
329
+             *  Adds an event with the label `label` to the Timeline panel of the inspector.
330
+             */
331
+            timeStamp(label?: string): void;
332
+        }
333
+        /**
334
+         * The `console` module provides a simple debugging console that is similar to the
335
+         * JavaScript console mechanism provided by web browsers.
336
+         *
337
+         * The module exports two specific components:
338
+         *
339
+         * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
340
+         * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
341
+         *
342
+         * _**Warning**_: The global console object's methods are neither consistently
343
+         * synchronous like the browser APIs they resemble, nor are they consistently
344
+         * asynchronous like all other Node.js streams. See the `note on process I/O` for
345
+         * more information.
346
+         *
347
+         * Example using the global `console`:
348
+         *
349
+         * ```js
350
+         * console.log('hello world');
351
+         * // Prints: hello world, to stdout
352
+         * console.log('hello %s', 'world');
353
+         * // Prints: hello world, to stdout
354
+         * console.error(new Error('Whoops, something bad happened'));
355
+         * // Prints error message and stack trace to stderr:
356
+         * //   Error: Whoops, something bad happened
357
+         * //     at [eval]:5:15
358
+         * //     at Script.runInThisContext (node:vm:132:18)
359
+         * //     at Object.runInThisContext (node:vm:309:38)
360
+         * //     at node:internal/process/execution:77:19
361
+         * //     at [eval]-wrapper:6:22
362
+         * //     at evalScript (node:internal/process/execution:76:60)
363
+         * //     at node:internal/main/eval_string:23:3
364
+         *
365
+         * const name = 'Will Robinson';
366
+         * console.warn(`Danger ${name}! Danger!`);
367
+         * // Prints: Danger Will Robinson! Danger!, to stderr
368
+         * ```
369
+         *
370
+         * Example using the `Console` class:
371
+         *
372
+         * ```js
373
+         * const out = getStreamSomehow();
374
+         * const err = getStreamSomehow();
375
+         * const myConsole = new console.Console(out, err);
376
+         *
377
+         * myConsole.log('hello world');
378
+         * // Prints: hello world, to out
379
+         * myConsole.log('hello %s', 'world');
380
+         * // Prints: hello world, to out
381
+         * myConsole.error(new Error('Whoops, something bad happened'));
382
+         * // Prints: [Error: Whoops, something bad happened], to err
383
+         *
384
+         * const name = 'Will Robinson';
385
+         * myConsole.warn(`Danger ${name}! Danger!`);
386
+         * // Prints: Danger Will Robinson! Danger!, to err
387
+         * ```
388
+         * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js)
389
+         */
390
+        namespace console {
391
+            interface ConsoleConstructorOptions {
392
+                stdout: NodeJS.WritableStream;
393
+                stderr?: NodeJS.WritableStream | undefined;
394
+                ignoreErrors?: boolean | undefined;
395
+                colorMode?: boolean | 'auto' | undefined;
396
+                inspectOptions?: InspectOptions | undefined;
397
+                /**
398
+                 * Set group indentation
399
+                 * @default 2
400
+                 */
401
+                groupIndentation?: number | undefined;
402
+            }
403
+            interface ConsoleConstructor {
404
+                prototype: Console;
405
+                new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
406
+                new (options: ConsoleConstructorOptions): Console;
407
+            }
408
+        }
409
+        var console: Console;
410
+    }
411
+    export = globalThis.console;
412
+}

+ 18
- 0
node_modules/@types/node/constants.d.ts 查看文件

@@ -0,0 +1,18 @@
1
+/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2
+declare module 'constants' {
3
+    import { constants as osConstants, SignalConstants } from 'node:os';
4
+    import { constants as cryptoConstants } from 'node:crypto';
5
+    import { constants as fsConstants } from 'node:fs';
6
+
7
+    const exp: typeof osConstants.errno &
8
+        typeof osConstants.priority &
9
+        SignalConstants &
10
+        typeof cryptoConstants &
11
+        typeof fsConstants;
12
+    export = exp;
13
+}
14
+
15
+declare module 'node:constants' {
16
+    import constants = require('constants');
17
+    export = constants;
18
+}

+ 3964
- 0
node_modules/@types/node/crypto.d.ts
文件差異過大導致無法顯示
查看文件


+ 545
- 0
node_modules/@types/node/dgram.d.ts 查看文件

@@ -0,0 +1,545 @@
1
+/**
2
+ * The `dgram` module provides an implementation of UDP datagram sockets.
3
+ *
4
+ * ```js
5
+ * import dgram from 'dgram';
6
+ *
7
+ * const server = dgram.createSocket('udp4');
8
+ *
9
+ * server.on('error', (err) => {
10
+ *   console.log(`server error:\n${err.stack}`);
11
+ *   server.close();
12
+ * });
13
+ *
14
+ * server.on('message', (msg, rinfo) => {
15
+ *   console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
16
+ * });
17
+ *
18
+ * server.on('listening', () => {
19
+ *   const address = server.address();
20
+ *   console.log(`server listening ${address.address}:${address.port}`);
21
+ * });
22
+ *
23
+ * server.bind(41234);
24
+ * // Prints: server listening 0.0.0.0:41234
25
+ * ```
26
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dgram.js)
27
+ */
28
+declare module 'dgram' {
29
+    import { AddressInfo } from 'node:net';
30
+    import * as dns from 'node:dns';
31
+    import { EventEmitter, Abortable } from 'node:events';
32
+    interface RemoteInfo {
33
+        address: string;
34
+        family: 'IPv4' | 'IPv6';
35
+        port: number;
36
+        size: number;
37
+    }
38
+    interface BindOptions {
39
+        port?: number | undefined;
40
+        address?: string | undefined;
41
+        exclusive?: boolean | undefined;
42
+        fd?: number | undefined;
43
+    }
44
+    type SocketType = 'udp4' | 'udp6';
45
+    interface SocketOptions extends Abortable {
46
+        type: SocketType;
47
+        reuseAddr?: boolean | undefined;
48
+        /**
49
+         * @default false
50
+         */
51
+        ipv6Only?: boolean | undefined;
52
+        recvBufferSize?: number | undefined;
53
+        sendBufferSize?: number | undefined;
54
+        lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
55
+    }
56
+    /**
57
+     * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
58
+     * messages. When `address` and `port` are not passed to `socket.bind()` the
59
+     * method will bind the socket to the "all interfaces" address on a random port
60
+     * (it does the right thing for both `udp4` and `udp6` sockets). The bound address
61
+     * and port can be retrieved using `socket.address().address` and `socket.address().port`.
62
+     *
63
+     * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket:
64
+     *
65
+     * ```js
66
+     * const controller = new AbortController();
67
+     * const { signal } = controller;
68
+     * const server = dgram.createSocket({ type: 'udp4', signal });
69
+     * server.on('message', (msg, rinfo) => {
70
+     *   console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
71
+     * });
72
+     * // Later, when you want to close the server.
73
+     * controller.abort();
74
+     * ```
75
+     * @since v0.11.13
76
+     * @param options Available options are:
77
+     * @param callback Attached as a listener for `'message'` events. Optional.
78
+     */
79
+    function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
80
+    function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
81
+    /**
82
+     * Encapsulates the datagram functionality.
83
+     *
84
+     * New instances of `dgram.Socket` are created using {@link createSocket}.
85
+     * The `new` keyword is not to be used to create `dgram.Socket` instances.
86
+     * @since v0.1.99
87
+     */
88
+    class Socket extends EventEmitter {
89
+        /**
90
+         * Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not
91
+         * specified, the operating system will choose
92
+         * one interface and will add membership to it. To add membership to every
93
+         * available interface, call `addMembership` multiple times, once per interface.
94
+         *
95
+         * When called on an unbound socket, this method will implicitly bind to a random
96
+         * port, listening on all interfaces.
97
+         *
98
+         * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
99
+         *
100
+         * ```js
101
+         * import cluster from 'cluster';
102
+         * import dgram from 'dgram';
103
+         *
104
+         * if (cluster.isPrimary) {
105
+         *   cluster.fork(); // Works ok.
106
+         *   cluster.fork(); // Fails with EADDRINUSE.
107
+         * } else {
108
+         *   const s = dgram.createSocket('udp4');
109
+         *   s.bind(1234, () => {
110
+         *     s.addMembership('224.0.0.114');
111
+         *   });
112
+         * }
113
+         * ```
114
+         * @since v0.6.9
115
+         */
116
+        addMembership(multicastAddress: string, multicastInterface?: string): void;
117
+        /**
118
+         * Returns an object containing the address information for a socket.
119
+         * For UDP sockets, this object will contain `address`, `family` and `port`properties.
120
+         *
121
+         * This method throws `EBADF` if called on an unbound socket.
122
+         * @since v0.1.99
123
+         */
124
+        address(): AddressInfo;
125
+        /**
126
+         * For UDP sockets, causes the `dgram.Socket` to listen for datagram
127
+         * messages on a named `port` and optional `address`. If `port` is not
128
+         * specified or is `0`, the operating system will attempt to bind to a
129
+         * random port. If `address` is not specified, the operating system will
130
+         * attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is
131
+         * called.
132
+         *
133
+         * Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very
134
+         * useful.
135
+         *
136
+         * A bound datagram socket keeps the Node.js process running to receive
137
+         * datagram messages.
138
+         *
139
+         * If binding fails, an `'error'` event is generated. In rare case (e.g.
140
+         * attempting to bind with a closed socket), an `Error` may be thrown.
141
+         *
142
+         * Example of a UDP server listening on port 41234:
143
+         *
144
+         * ```js
145
+         * import dgram from 'dgram';
146
+         *
147
+         * const server = dgram.createSocket('udp4');
148
+         *
149
+         * server.on('error', (err) => {
150
+         *   console.log(`server error:\n${err.stack}`);
151
+         *   server.close();
152
+         * });
153
+         *
154
+         * server.on('message', (msg, rinfo) => {
155
+         *   console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
156
+         * });
157
+         *
158
+         * server.on('listening', () => {
159
+         *   const address = server.address();
160
+         *   console.log(`server listening ${address.address}:${address.port}`);
161
+         * });
162
+         *
163
+         * server.bind(41234);
164
+         * // Prints: server listening 0.0.0.0:41234
165
+         * ```
166
+         * @since v0.1.99
167
+         * @param callback with no parameters. Called when binding is complete.
168
+         */
169
+        bind(port?: number, address?: string, callback?: () => void): this;
170
+        bind(port?: number, callback?: () => void): this;
171
+        bind(callback?: () => void): this;
172
+        bind(options: BindOptions, callback?: () => void): this;
173
+        /**
174
+         * Close the underlying socket and stop listening for data on it. If a callback is
175
+         * provided, it is added as a listener for the `'close'` event.
176
+         * @since v0.1.99
177
+         * @param callback Called when the socket has been closed.
178
+         */
179
+        close(callback?: () => void): this;
180
+        /**
181
+         * Associates the `dgram.Socket` to a remote address and port. Every
182
+         * message sent by this handle is automatically sent to that destination. Also,
183
+         * the socket will only receive messages from that remote peer.
184
+         * Trying to call `connect()` on an already connected socket will result
185
+         * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
186
+         * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
187
+         * will be used by default. Once the connection is complete, a `'connect'` event
188
+         * is emitted and the optional `callback` function is called. In case of failure,
189
+         * the `callback` is called or, failing this, an `'error'` event is emitted.
190
+         * @since v12.0.0
191
+         * @param callback Called when the connection is completed or on error.
192
+         */
193
+        connect(port: number, address?: string, callback?: () => void): void;
194
+        connect(port: number, callback: () => void): void;
195
+        /**
196
+         * A synchronous function that disassociates a connected `dgram.Socket` from
197
+         * its remote address. Trying to call `disconnect()` on an unbound or already
198
+         * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
199
+         * @since v12.0.0
200
+         */
201
+        disconnect(): void;
202
+        /**
203
+         * Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
204
+         * kernel when the socket is closed or the process terminates, so most apps will
205
+         * never have reason to call this.
206
+         *
207
+         * If `multicastInterface` is not specified, the operating system will attempt to
208
+         * drop membership on all valid interfaces.
209
+         * @since v0.6.9
210
+         */
211
+        dropMembership(multicastAddress: string, multicastInterface?: string): void;
212
+        /**
213
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
214
+         * @since v8.7.0
215
+         * @return the `SO_RCVBUF` socket receive buffer size in bytes.
216
+         */
217
+        getRecvBufferSize(): number;
218
+        /**
219
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
220
+         * @since v8.7.0
221
+         * @return the `SO_SNDBUF` socket send buffer size in bytes.
222
+         */
223
+        getSendBufferSize(): number;
224
+        /**
225
+         * By default, binding a socket will cause it to block the Node.js process from
226
+         * exiting as long as the socket is open. The `socket.unref()` method can be used
227
+         * to exclude the socket from the reference counting that keeps the Node.js
228
+         * process active. The `socket.ref()` method adds the socket back to the reference
229
+         * counting and restores the default behavior.
230
+         *
231
+         * Calling `socket.ref()` multiples times will have no additional effect.
232
+         *
233
+         * The `socket.ref()` method returns a reference to the socket so calls can be
234
+         * chained.
235
+         * @since v0.9.1
236
+         */
237
+        ref(): this;
238
+        /**
239
+         * Returns an object containing the `address`, `family`, and `port` of the remote
240
+         * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
241
+         * if the socket is not connected.
242
+         * @since v12.0.0
243
+         */
244
+        remoteAddress(): AddressInfo;
245
+        /**
246
+         * Broadcasts a datagram on the socket.
247
+         * For connectionless sockets, the destination `port` and `address` must be
248
+         * specified. Connected sockets, on the other hand, will use their associated
249
+         * remote endpoint, so the `port` and `address` arguments must not be set.
250
+         *
251
+         * The `msg` argument contains the message to be sent.
252
+         * Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
253
+         * any `TypedArray` or a `DataView`,
254
+         * the `offset` and `length` specify the offset within the `Buffer` where the
255
+         * message begins and the number of bytes in the message, respectively.
256
+         * If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that
257
+         * contain multi-byte characters, `offset` and `length` will be calculated with
258
+         * respect to `byte length` and not the character position.
259
+         * If `msg` is an array, `offset` and `length` must not be specified.
260
+         *
261
+         * The `address` argument is a string. If the value of `address` is a host name,
262
+         * DNS will be used to resolve the address of the host. If `address` is not
263
+         * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
264
+         *
265
+         * If the socket has not been previously bound with a call to `bind`, the socket
266
+         * is assigned a random port number and is bound to the "all interfaces" address
267
+         * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
268
+         *
269
+         * An optional `callback` function may be specified to as a way of reporting
270
+         * DNS errors or for determining when it is safe to reuse the `buf` object.
271
+         * DNS lookups delay the time to send for at least one tick of the
272
+         * Node.js event loop.
273
+         *
274
+         * The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be
275
+         * passed as the first argument to the `callback`. If a `callback` is not given,
276
+         * the error is emitted as an `'error'` event on the `socket` object.
277
+         *
278
+         * Offset and length are optional but both _must_ be set if either are used.
279
+         * They are supported only when the first argument is a `Buffer`, a `TypedArray`,
280
+         * or a `DataView`.
281
+         *
282
+         * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
283
+         *
284
+         * Example of sending a UDP packet to a port on `localhost`;
285
+         *
286
+         * ```js
287
+         * import dgram from 'dgram';
288
+         * import { Buffer } from 'buffer';
289
+         *
290
+         * const message = Buffer.from('Some bytes');
291
+         * const client = dgram.createSocket('udp4');
292
+         * client.send(message, 41234, 'localhost', (err) => {
293
+         *   client.close();
294
+         * });
295
+         * ```
296
+         *
297
+         * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
298
+         *
299
+         * ```js
300
+         * import dgram from 'dgram';
301
+         * import { Buffer } from 'buffer';
302
+         *
303
+         * const buf1 = Buffer.from('Some ');
304
+         * const buf2 = Buffer.from('bytes');
305
+         * const client = dgram.createSocket('udp4');
306
+         * client.send([buf1, buf2], 41234, (err) => {
307
+         *   client.close();
308
+         * });
309
+         * ```
310
+         *
311
+         * Sending multiple buffers might be faster or slower depending on the
312
+         * application and operating system. Run benchmarks to
313
+         * determine the optimal strategy on a case-by-case basis. Generally speaking,
314
+         * however, sending multiple buffers is faster.
315
+         *
316
+         * Example of sending a UDP packet using a socket connected to a port on`localhost`:
317
+         *
318
+         * ```js
319
+         * import dgram from 'dgram';
320
+         * import { Buffer } from 'buffer';
321
+         *
322
+         * const message = Buffer.from('Some bytes');
323
+         * const client = dgram.createSocket('udp4');
324
+         * client.connect(41234, 'localhost', (err) => {
325
+         *   client.send(message, (err) => {
326
+         *     client.close();
327
+         *   });
328
+         * });
329
+         * ```
330
+         * @since v0.1.99
331
+         * @param msg Message to be sent.
332
+         * @param offset Offset in the buffer where the message starts.
333
+         * @param length Number of bytes in the message.
334
+         * @param port Destination port.
335
+         * @param address Destination host name or IP address.
336
+         * @param callback Called when the message has been sent.
337
+         */
338
+        send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
339
+        send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
340
+        send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
341
+        send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
342
+        send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
343
+        send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
344
+        /**
345
+         * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
346
+         * packets may be sent to a local interface's broadcast address.
347
+         *
348
+         * This method throws `EBADF` if called on an unbound socket.
349
+         * @since v0.6.9
350
+         */
351
+        setBroadcast(flag: boolean): void;
352
+        /**
353
+         * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
354
+         * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
355
+         * _with a scope index is written as `'IP%scope'` where scope is an interface name_
356
+         * _or interface number._
357
+         *
358
+         * Sets the default outgoing multicast interface of the socket to a chosen
359
+         * interface or back to system interface selection. The `multicastInterface` must
360
+         * be a valid string representation of an IP from the socket's family.
361
+         *
362
+         * For IPv4 sockets, this should be the IP configured for the desired physical
363
+         * interface. All packets sent to multicast on the socket will be sent on the
364
+         * interface determined by the most recent successful use of this call.
365
+         *
366
+         * For IPv6 sockets, `multicastInterface` should include a scope to indicate the
367
+         * interface as in the examples that follow. In IPv6, individual `send` calls can
368
+         * also use explicit scope in addresses, so only packets sent to a multicast
369
+         * address without specifying an explicit scope are affected by the most recent
370
+         * successful use of this call.
371
+         *
372
+         * This method throws `EBADF` if called on an unbound socket.
373
+         *
374
+         * #### Example: IPv6 outgoing multicast interface
375
+         *
376
+         * On most systems, where scope format uses the interface name:
377
+         *
378
+         * ```js
379
+         * const socket = dgram.createSocket('udp6');
380
+         *
381
+         * socket.bind(1234, () => {
382
+         *   socket.setMulticastInterface('::%eth1');
383
+         * });
384
+         * ```
385
+         *
386
+         * On Windows, where scope format uses an interface number:
387
+         *
388
+         * ```js
389
+         * const socket = dgram.createSocket('udp6');
390
+         *
391
+         * socket.bind(1234, () => {
392
+         *   socket.setMulticastInterface('::%2');
393
+         * });
394
+         * ```
395
+         *
396
+         * #### Example: IPv4 outgoing multicast interface
397
+         *
398
+         * All systems use an IP of the host on the desired physical interface:
399
+         *
400
+         * ```js
401
+         * const socket = dgram.createSocket('udp4');
402
+         *
403
+         * socket.bind(1234, () => {
404
+         *   socket.setMulticastInterface('10.0.0.2');
405
+         * });
406
+         * ```
407
+         * @since v8.6.0
408
+         */
409
+        setMulticastInterface(multicastInterface: string): void;
410
+        /**
411
+         * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
412
+         * multicast packets will also be received on the local interface.
413
+         *
414
+         * This method throws `EBADF` if called on an unbound socket.
415
+         * @since v0.3.8
416
+         */
417
+        setMulticastLoopback(flag: boolean): boolean;
418
+        /**
419
+         * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
420
+         * "Time to Live", in this context it specifies the number of IP hops that a
421
+         * packet is allowed to travel through, specifically for multicast traffic. Each
422
+         * router or gateway that forwards a packet decrements the TTL. If the TTL is
423
+         * decremented to 0 by a router, it will not be forwarded.
424
+         *
425
+         * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
426
+         *
427
+         * This method throws `EBADF` if called on an unbound socket.
428
+         * @since v0.3.8
429
+         */
430
+        setMulticastTTL(ttl: number): number;
431
+        /**
432
+         * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
433
+         * in bytes.
434
+         *
435
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
436
+         * @since v8.7.0
437
+         */
438
+        setRecvBufferSize(size: number): void;
439
+        /**
440
+         * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
441
+         * in bytes.
442
+         *
443
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
444
+         * @since v8.7.0
445
+         */
446
+        setSendBufferSize(size: number): void;
447
+        /**
448
+         * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
449
+         * in this context it specifies the number of IP hops that a packet is allowed to
450
+         * travel through. Each router or gateway that forwards a packet decrements the
451
+         * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
452
+         * Changing TTL values is typically done for network probes or when multicasting.
453
+         *
454
+         * The `ttl` argument may be between 1 and 255\. The default on most systems
455
+         * is 64.
456
+         *
457
+         * This method throws `EBADF` if called on an unbound socket.
458
+         * @since v0.1.101
459
+         */
460
+        setTTL(ttl: number): number;
461
+        /**
462
+         * By default, binding a socket will cause it to block the Node.js process from
463
+         * exiting as long as the socket is open. The `socket.unref()` method can be used
464
+         * to exclude the socket from the reference counting that keeps the Node.js
465
+         * process active, allowing the process to exit even if the socket is still
466
+         * listening.
467
+         *
468
+         * Calling `socket.unref()` multiple times will have no addition effect.
469
+         *
470
+         * The `socket.unref()` method returns a reference to the socket so calls can be
471
+         * chained.
472
+         * @since v0.9.1
473
+         */
474
+        unref(): this;
475
+        /**
476
+         * Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket
477
+         * option. If the `multicastInterface` argument
478
+         * is not specified, the operating system will choose one interface and will add
479
+         * membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface.
480
+         *
481
+         * When called on an unbound socket, this method will implicitly bind to a random
482
+         * port, listening on all interfaces.
483
+         * @since v13.1.0, v12.16.0
484
+         */
485
+        addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
486
+        /**
487
+         * Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is
488
+         * automatically called by the kernel when the
489
+         * socket is closed or the process terminates, so most apps will never have
490
+         * reason to call this.
491
+         *
492
+         * If `multicastInterface` is not specified, the operating system will attempt to
493
+         * drop membership on all valid interfaces.
494
+         * @since v13.1.0, v12.16.0
495
+         */
496
+        dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
497
+        /**
498
+         * events.EventEmitter
499
+         * 1. close
500
+         * 2. connect
501
+         * 3. error
502
+         * 4. listening
503
+         * 5. message
504
+         */
505
+        addListener(event: string, listener: (...args: any[]) => void): this;
506
+        addListener(event: 'close', listener: () => void): this;
507
+        addListener(event: 'connect', listener: () => void): this;
508
+        addListener(event: 'error', listener: (err: Error) => void): this;
509
+        addListener(event: 'listening', listener: () => void): this;
510
+        addListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
511
+        emit(event: string | symbol, ...args: any[]): boolean;
512
+        emit(event: 'close'): boolean;
513
+        emit(event: 'connect'): boolean;
514
+        emit(event: 'error', err: Error): boolean;
515
+        emit(event: 'listening'): boolean;
516
+        emit(event: 'message', msg: Buffer, rinfo: RemoteInfo): boolean;
517
+        on(event: string, listener: (...args: any[]) => void): this;
518
+        on(event: 'close', listener: () => void): this;
519
+        on(event: 'connect', listener: () => void): this;
520
+        on(event: 'error', listener: (err: Error) => void): this;
521
+        on(event: 'listening', listener: () => void): this;
522
+        on(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
523
+        once(event: string, listener: (...args: any[]) => void): this;
524
+        once(event: 'close', listener: () => void): this;
525
+        once(event: 'connect', listener: () => void): this;
526
+        once(event: 'error', listener: (err: Error) => void): this;
527
+        once(event: 'listening', listener: () => void): this;
528
+        once(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
529
+        prependListener(event: string, listener: (...args: any[]) => void): this;
530
+        prependListener(event: 'close', listener: () => void): this;
531
+        prependListener(event: 'connect', listener: () => void): this;
532
+        prependListener(event: 'error', listener: (err: Error) => void): this;
533
+        prependListener(event: 'listening', listener: () => void): this;
534
+        prependListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
535
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
536
+        prependOnceListener(event: 'close', listener: () => void): this;
537
+        prependOnceListener(event: 'connect', listener: () => void): this;
538
+        prependOnceListener(event: 'error', listener: (err: Error) => void): this;
539
+        prependOnceListener(event: 'listening', listener: () => void): this;
540
+        prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
541
+    }
542
+}
543
+declare module 'node:dgram' {
544
+    export * from 'dgram';
545
+}

+ 153
- 0
node_modules/@types/node/diagnostics_channel.d.ts 查看文件

@@ -0,0 +1,153 @@
1
+/**
2
+ * The `diagnostics_channel` module provides an API to create named channels
3
+ * to report arbitrary message data for diagnostics purposes.
4
+ *
5
+ * It can be accessed using:
6
+ *
7
+ * ```js
8
+ * import diagnostics_channel from 'diagnostics_channel';
9
+ * ```
10
+ *
11
+ * It is intended that a module writer wanting to report diagnostics messages
12
+ * will create one or many top-level channels to report messages through.
13
+ * Channels may also be acquired at runtime but it is not encouraged
14
+ * due to the additional overhead of doing so. Channels may be exported for
15
+ * convenience, but as long as the name is known it can be acquired anywhere.
16
+ *
17
+ * If you intend for your module to produce diagnostics data for others to
18
+ * consume it is recommended that you include documentation of what named
19
+ * channels are used along with the shape of the message data. Channel names
20
+ * should generally include the module name to avoid collisions with data from
21
+ * other modules.
22
+ * @experimental
23
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
24
+ */
25
+declare module 'diagnostics_channel' {
26
+    /**
27
+     * Check if there are active subscribers to the named channel. This is helpful if
28
+     * the message you want to send might be expensive to prepare.
29
+     *
30
+     * This API is optional but helpful when trying to publish messages from very
31
+     * performance-sensitive code.
32
+     *
33
+     * ```js
34
+     * import diagnostics_channel from 'diagnostics_channel';
35
+     *
36
+     * if (diagnostics_channel.hasSubscribers('my-channel')) {
37
+     *   // There are subscribers, prepare and publish message
38
+     * }
39
+     * ```
40
+     * @since v15.1.0, v14.17.0
41
+     * @param name The channel name
42
+     * @return If there are active subscribers
43
+     */
44
+    function hasSubscribers(name: string): boolean;
45
+    /**
46
+     * This is the primary entry-point for anyone wanting to interact with a named
47
+     * channel. It produces a channel object which is optimized to reduce overhead at
48
+     * publish time as much as possible.
49
+     *
50
+     * ```js
51
+     * import diagnostics_channel from 'diagnostics_channel';
52
+     *
53
+     * const channel = diagnostics_channel.channel('my-channel');
54
+     * ```
55
+     * @since v15.1.0, v14.17.0
56
+     * @param name The channel name
57
+     * @return The named channel object
58
+     */
59
+    function channel(name: string): Channel;
60
+    type ChannelListener = (message: unknown, name: string) => void;
61
+    /**
62
+     * The class `Channel` represents an individual named channel within the data
63
+     * pipeline. It is use to track subscribers and to publish messages when there
64
+     * are subscribers present. It exists as a separate object to avoid channel
65
+     * lookups at publish time, enabling very fast publish speeds and allowing
66
+     * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
67
+     * with `new Channel(name)` is not supported.
68
+     * @since v15.1.0, v14.17.0
69
+     */
70
+    class Channel {
71
+        readonly name: string;
72
+        /**
73
+         * Check if there are active subscribers to this channel. This is helpful if
74
+         * the message you want to send might be expensive to prepare.
75
+         *
76
+         * This API is optional but helpful when trying to publish messages from very
77
+         * performance-sensitive code.
78
+         *
79
+         * ```js
80
+         * import diagnostics_channel from 'diagnostics_channel';
81
+         *
82
+         * const channel = diagnostics_channel.channel('my-channel');
83
+         *
84
+         * if (channel.hasSubscribers) {
85
+         *   // There are subscribers, prepare and publish message
86
+         * }
87
+         * ```
88
+         * @since v15.1.0, v14.17.0
89
+         */
90
+        readonly hasSubscribers: boolean;
91
+        private constructor(name: string);
92
+        /**
93
+         * Publish a message to any subscribers to the channel. This will
94
+         * trigger message handlers synchronously so they will execute within
95
+         * the same context.
96
+         *
97
+         * ```js
98
+         * import diagnostics_channel from 'diagnostics_channel';
99
+         *
100
+         * const channel = diagnostics_channel.channel('my-channel');
101
+         *
102
+         * channel.publish({
103
+         *   some: 'message'
104
+         * });
105
+         * ```
106
+         * @since v15.1.0, v14.17.0
107
+         * @param message The message to send to the channel subscribers
108
+         */
109
+        publish(message: unknown): void;
110
+        /**
111
+         * Register a message handler to subscribe to this channel. This message handler
112
+         * will be run synchronously whenever a message is published to the channel. Any
113
+         * errors thrown in the message handler will trigger an `'uncaughtException'`.
114
+         *
115
+         * ```js
116
+         * import diagnostics_channel from 'diagnostics_channel';
117
+         *
118
+         * const channel = diagnostics_channel.channel('my-channel');
119
+         *
120
+         * channel.subscribe((message, name) => {
121
+         *   // Received data
122
+         * });
123
+         * ```
124
+         * @since v15.1.0, v14.17.0
125
+         * @param onMessage The handler to receive channel messages
126
+         */
127
+        subscribe(onMessage: ChannelListener): void;
128
+        /**
129
+         * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
130
+         *
131
+         * ```js
132
+         * import diagnostics_channel from 'diagnostics_channel';
133
+         *
134
+         * const channel = diagnostics_channel.channel('my-channel');
135
+         *
136
+         * function onMessage(message, name) {
137
+         *   // Received data
138
+         * }
139
+         *
140
+         * channel.subscribe(onMessage);
141
+         *
142
+         * channel.unsubscribe(onMessage);
143
+         * ```
144
+         * @since v15.1.0, v14.17.0
145
+         * @param onMessage The previous subscribed handler to remove
146
+         * @return `true` if the handler was found, `false` otherwise.
147
+         */
148
+        unsubscribe(onMessage: ChannelListener): void;
149
+    }
150
+}
151
+declare module 'node:diagnostics_channel' {
152
+    export * from 'diagnostics_channel';
153
+}

+ 659
- 0
node_modules/@types/node/dns.d.ts 查看文件

@@ -0,0 +1,659 @@
1
+/**
2
+ * The `dns` module enables name resolution. For example, use it to look up IP
3
+ * addresses of host names.
4
+ *
5
+ * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
6
+ * DNS protocol for lookups. {@link lookup} uses the operating system
7
+ * facilities to perform name resolution. It may not need to perform any network
8
+ * communication. To perform name resolution the way other applications on the same
9
+ * system do, use {@link lookup}.
10
+ *
11
+ * ```js
12
+ * const dns = require('dns');
13
+ *
14
+ * dns.lookup('example.org', (err, address, family) => {
15
+ *   console.log('address: %j family: IPv%s', address, family);
16
+ * });
17
+ * // address: "93.184.216.34" family: IPv4
18
+ * ```
19
+ *
20
+ * All other functions in the `dns` module connect to an actual DNS server to
21
+ * perform name resolution. They will always use the network to perform DNS
22
+ * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
23
+ * DNS queries, bypassing other name-resolution facilities.
24
+ *
25
+ * ```js
26
+ * const dns = require('dns');
27
+ *
28
+ * dns.resolve4('archive.org', (err, addresses) => {
29
+ *   if (err) throw err;
30
+ *
31
+ *   console.log(`addresses: ${JSON.stringify(addresses)}`);
32
+ *
33
+ *   addresses.forEach((a) => {
34
+ *     dns.reverse(a, (err, hostnames) => {
35
+ *       if (err) {
36
+ *         throw err;
37
+ *       }
38
+ *       console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
39
+ *     });
40
+ *   });
41
+ * });
42
+ * ```
43
+ *
44
+ * See the `Implementation considerations section` for more information.
45
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
46
+ */
47
+declare module 'dns' {
48
+    import * as dnsPromises from 'node:dns/promises';
49
+    // Supported getaddrinfo flags.
50
+    export const ADDRCONFIG: number;
51
+    export const V4MAPPED: number;
52
+    /**
53
+     * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
54
+     * well as IPv4 mapped IPv6 addresses.
55
+     */
56
+    export const ALL: number;
57
+    export interface LookupOptions {
58
+        family?: number | undefined;
59
+        hints?: number | undefined;
60
+        all?: boolean | undefined;
61
+        /**
62
+         * @default true
63
+         */
64
+        verbatim?: boolean | undefined;
65
+    }
66
+    export interface LookupOneOptions extends LookupOptions {
67
+        all?: false | undefined;
68
+    }
69
+    export interface LookupAllOptions extends LookupOptions {
70
+        all: true;
71
+    }
72
+    export interface LookupAddress {
73
+        address: string;
74
+        family: number;
75
+    }
76
+    /**
77
+     * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
78
+     * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
79
+     * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
80
+     * and IPv6 addresses are both returned if found.
81
+     *
82
+     * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
83
+     * properties `address` and `family`.
84
+     *
85
+     * On error, `err` is an `Error` object, where `err.code` is the error code.
86
+     * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
87
+     * the host name does not exist but also when the lookup fails in other ways
88
+     * such as no available file descriptors.
89
+     *
90
+     * `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
91
+     * The implementation uses an operating system facility that can associate names
92
+     * with addresses, and vice versa. This implementation can have subtle but
93
+     * important consequences on the behavior of any Node.js program. Please take some
94
+     * time to consult the `Implementation considerations section` before using`dns.lookup()`.
95
+     *
96
+     * Example usage:
97
+     *
98
+     * ```js
99
+     * const dns = require('dns');
100
+     * const options = {
101
+     *   family: 6,
102
+     *   hints: dns.ADDRCONFIG | dns.V4MAPPED,
103
+     * };
104
+     * dns.lookup('example.com', options, (err, address, family) =>
105
+     *   console.log('address: %j family: IPv%s', address, family));
106
+     * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
107
+     *
108
+     * // When options.all is true, the result will be an Array.
109
+     * options.all = true;
110
+     * dns.lookup('example.com', options, (err, addresses) =>
111
+     *   console.log('addresses: %j', addresses));
112
+     * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
113
+     * ```
114
+     *
115
+     * If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
116
+     * @since v0.1.90
117
+     */
118
+    export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
119
+    export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
120
+    export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
121
+    export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
122
+    export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
123
+    export namespace lookup {
124
+        function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
125
+        function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
126
+        function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
127
+    }
128
+    /**
129
+     * Resolves the given `address` and `port` into a host name and service using
130
+     * the operating system's underlying `getnameinfo` implementation.
131
+     *
132
+     * If `address` is not a valid IP address, a `TypeError` will be thrown.
133
+     * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
134
+     *
135
+     * On an error, `err` is an `Error` object, where `err.code` is the error code.
136
+     *
137
+     * ```js
138
+     * const dns = require('dns');
139
+     * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
140
+     *   console.log(hostname, service);
141
+     *   // Prints: localhost ssh
142
+     * });
143
+     * ```
144
+     *
145
+     * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
146
+     * @since v0.11.14
147
+     */
148
+    export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
149
+    export namespace lookupService {
150
+        function __promisify__(
151
+            address: string,
152
+            port: number
153
+        ): Promise<{
154
+            hostname: string;
155
+            service: string;
156
+        }>;
157
+    }
158
+    export interface ResolveOptions {
159
+        ttl: boolean;
160
+    }
161
+    export interface ResolveWithTtlOptions extends ResolveOptions {
162
+        ttl: true;
163
+    }
164
+    export interface RecordWithTtl {
165
+        address: string;
166
+        ttl: number;
167
+    }
168
+    /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
169
+    export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
170
+    export interface AnyARecord extends RecordWithTtl {
171
+        type: 'A';
172
+    }
173
+    export interface AnyAaaaRecord extends RecordWithTtl {
174
+        type: 'AAAA';
175
+    }
176
+    export interface CaaRecord {
177
+        critial: number;
178
+        issue?: string | undefined;
179
+        issuewild?: string | undefined;
180
+        iodef?: string | undefined;
181
+        contactemail?: string | undefined;
182
+        contactphone?: string | undefined;
183
+    }
184
+    export interface MxRecord {
185
+        priority: number;
186
+        exchange: string;
187
+    }
188
+    export interface AnyMxRecord extends MxRecord {
189
+        type: 'MX';
190
+    }
191
+    export interface NaptrRecord {
192
+        flags: string;
193
+        service: string;
194
+        regexp: string;
195
+        replacement: string;
196
+        order: number;
197
+        preference: number;
198
+    }
199
+    export interface AnyNaptrRecord extends NaptrRecord {
200
+        type: 'NAPTR';
201
+    }
202
+    export interface SoaRecord {
203
+        nsname: string;
204
+        hostmaster: string;
205
+        serial: number;
206
+        refresh: number;
207
+        retry: number;
208
+        expire: number;
209
+        minttl: number;
210
+    }
211
+    export interface AnySoaRecord extends SoaRecord {
212
+        type: 'SOA';
213
+    }
214
+    export interface SrvRecord {
215
+        priority: number;
216
+        weight: number;
217
+        port: number;
218
+        name: string;
219
+    }
220
+    export interface AnySrvRecord extends SrvRecord {
221
+        type: 'SRV';
222
+    }
223
+    export interface AnyTxtRecord {
224
+        type: 'TXT';
225
+        entries: string[];
226
+    }
227
+    export interface AnyNsRecord {
228
+        type: 'NS';
229
+        value: string;
230
+    }
231
+    export interface AnyPtrRecord {
232
+        type: 'PTR';
233
+        value: string;
234
+    }
235
+    export interface AnyCnameRecord {
236
+        type: 'CNAME';
237
+        value: string;
238
+    }
239
+    export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord;
240
+    /**
241
+     * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
242
+     * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
243
+     * records. The type and structure of individual results varies based on `rrtype`:
244
+     *
245
+     * <omitted>
246
+     *
247
+     * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
248
+     * @since v0.1.27
249
+     * @param hostname Host name to resolve.
250
+     * @param [rrtype='A'] Resource record type.
251
+     */
252
+    export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
253
+    export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
254
+    export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
255
+    export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
256
+    export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
257
+    export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
258
+    export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
259
+    export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
260
+    export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
261
+    export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
262
+    export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
263
+    export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
264
+    export function resolve(
265
+        hostname: string,
266
+        rrtype: string,
267
+        callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
268
+    ): void;
269
+    export namespace resolve {
270
+        function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise<string[]>;
271
+        function __promisify__(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
272
+        function __promisify__(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
273
+        function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
274
+        function __promisify__(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
275
+        function __promisify__(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
276
+        function __promisify__(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
277
+        function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
278
+    }
279
+    /**
280
+     * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
281
+     * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
282
+     * @since v0.1.16
283
+     * @param hostname Host name to resolve.
284
+     */
285
+    export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
286
+    export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
287
+    export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
288
+    export namespace resolve4 {
289
+        function __promisify__(hostname: string): Promise<string[]>;
290
+        function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
291
+        function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
292
+    }
293
+    /**
294
+     * Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
295
+     * will contain an array of IPv6 addresses.
296
+     * @since v0.1.16
297
+     * @param hostname Host name to resolve.
298
+     */
299
+    export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
300
+    export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
301
+    export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
302
+    export namespace resolve6 {
303
+        function __promisify__(hostname: string): Promise<string[]>;
304
+        function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
305
+        function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
306
+    }
307
+    /**
308
+     * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function
309
+     * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
310
+     * @since v0.3.2
311
+     */
312
+    export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
313
+    export namespace resolveCname {
314
+        function __promisify__(hostname: string): Promise<string[]>;
315
+    }
316
+    /**
317
+     * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
318
+     * will contain an array of certification authority authorization records
319
+     * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
320
+     * @since v15.0.0, v14.17.0
321
+     */
322
+    export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
323
+    export namespace resolveCaa {
324
+        function __promisify__(hostname: string): Promise<CaaRecord[]>;
325
+    }
326
+    /**
327
+     * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
328
+     * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
329
+     * @since v0.1.27
330
+     */
331
+    export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
332
+    export namespace resolveMx {
333
+        function __promisify__(hostname: string): Promise<MxRecord[]>;
334
+    }
335
+    /**
336
+     * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
337
+     * objects with the following properties:
338
+     *
339
+     * * `flags`
340
+     * * `service`
341
+     * * `regexp`
342
+     * * `replacement`
343
+     * * `order`
344
+     * * `preference`
345
+     *
346
+     * ```js
347
+     * {
348
+     *   flags: 's',
349
+     *   service: 'SIP+D2U',
350
+     *   regexp: '',
351
+     *   replacement: '_sip._udp.example.com',
352
+     *   order: 30,
353
+     *   preference: 100
354
+     * }
355
+     * ```
356
+     * @since v0.9.12
357
+     */
358
+    export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
359
+    export namespace resolveNaptr {
360
+        function __promisify__(hostname: string): Promise<NaptrRecord[]>;
361
+    }
362
+    /**
363
+     * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
364
+     * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
365
+     * @since v0.1.90
366
+     */
367
+    export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
368
+    export namespace resolveNs {
369
+        function __promisify__(hostname: string): Promise<string[]>;
370
+    }
371
+    /**
372
+     * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
373
+     * be an array of strings containing the reply records.
374
+     * @since v6.0.0
375
+     */
376
+    export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
377
+    export namespace resolvePtr {
378
+        function __promisify__(hostname: string): Promise<string[]>;
379
+    }
380
+    /**
381
+     * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
382
+     * the `hostname`. The `address` argument passed to the `callback` function will
383
+     * be an object with the following properties:
384
+     *
385
+     * * `nsname`
386
+     * * `hostmaster`
387
+     * * `serial`
388
+     * * `refresh`
389
+     * * `retry`
390
+     * * `expire`
391
+     * * `minttl`
392
+     *
393
+     * ```js
394
+     * {
395
+     *   nsname: 'ns.example.com',
396
+     *   hostmaster: 'root.example.com',
397
+     *   serial: 2013101809,
398
+     *   refresh: 10000,
399
+     *   retry: 2400,
400
+     *   expire: 604800,
401
+     *   minttl: 3600
402
+     * }
403
+     * ```
404
+     * @since v0.11.10
405
+     */
406
+    export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
407
+    export namespace resolveSoa {
408
+        function __promisify__(hostname: string): Promise<SoaRecord>;
409
+    }
410
+    /**
411
+     * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
412
+     * be an array of objects with the following properties:
413
+     *
414
+     * * `priority`
415
+     * * `weight`
416
+     * * `port`
417
+     * * `name`
418
+     *
419
+     * ```js
420
+     * {
421
+     *   priority: 10,
422
+     *   weight: 5,
423
+     *   port: 21223,
424
+     *   name: 'service.example.com'
425
+     * }
426
+     * ```
427
+     * @since v0.1.27
428
+     */
429
+    export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
430
+    export namespace resolveSrv {
431
+        function __promisify__(hostname: string): Promise<SrvRecord[]>;
432
+    }
433
+    /**
434
+     * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a
435
+     * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
436
+     * one record. Depending on the use case, these could be either joined together or
437
+     * treated separately.
438
+     * @since v0.1.27
439
+     */
440
+    export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
441
+    export namespace resolveTxt {
442
+        function __promisify__(hostname: string): Promise<string[][]>;
443
+    }
444
+    /**
445
+     * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
446
+     * The `ret` argument passed to the `callback` function will be an array containing
447
+     * various types of records. Each object has a property `type` that indicates the
448
+     * type of the current record. And depending on the `type`, additional properties
449
+     * will be present on the object:
450
+     *
451
+     * <omitted>
452
+     *
453
+     * Here is an example of the `ret` object passed to the callback:
454
+     *
455
+     * ```js
456
+     * [ { type: 'A', address: '127.0.0.1', ttl: 299 },
457
+     *   { type: 'CNAME', value: 'example.com' },
458
+     *   { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
459
+     *   { type: 'NS', value: 'ns1.example.com' },
460
+     *   { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
461
+     *   { type: 'SOA',
462
+     *     nsname: 'ns1.example.com',
463
+     *     hostmaster: 'admin.example.com',
464
+     *     serial: 156696742,
465
+     *     refresh: 900,
466
+     *     retry: 900,
467
+     *     expire: 1800,
468
+     *     minttl: 60 } ]
469
+     * ```
470
+     *
471
+     * DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
472
+     * 8482](https://tools.ietf.org/html/rfc8482).
473
+     */
474
+    export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
475
+    export namespace resolveAny {
476
+        function __promisify__(hostname: string): Promise<AnyRecord[]>;
477
+    }
478
+    /**
479
+     * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
480
+     * array of host names.
481
+     *
482
+     * On error, `err` is an `Error` object, where `err.code` is
483
+     * one of the `DNS error codes`.
484
+     * @since v0.1.16
485
+     */
486
+    export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
487
+    /**
488
+     * Sets the IP address and port of servers to be used when performing DNS
489
+     * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
490
+     * addresses. If the port is the IANA default DNS port (53) it can be omitted.
491
+     *
492
+     * ```js
493
+     * dns.setServers([
494
+     *   '4.4.4.4',
495
+     *   '[2001:4860:4860::8888]',
496
+     *   '4.4.4.4:1053',
497
+     *   '[2001:4860:4860::8888]:1053',
498
+     * ]);
499
+     * ```
500
+     *
501
+     * An error will be thrown if an invalid address is provided.
502
+     *
503
+     * The `dns.setServers()` method must not be called while a DNS query is in
504
+     * progress.
505
+     *
506
+     * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
507
+     *
508
+     * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
509
+     * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
510
+     * subsequent servers provided. Fallback DNS servers will only be used if the
511
+     * earlier ones time out or result in some other error.
512
+     * @since v0.11.3
513
+     * @param servers array of `RFC 5952` formatted addresses
514
+     */
515
+    export function setServers(servers: ReadonlyArray<string>): void;
516
+    /**
517
+     * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
518
+     * that are currently configured for DNS resolution. A string will include a port
519
+     * section if a custom port is used.
520
+     *
521
+     * ```js
522
+     * [
523
+     *   '4.4.4.4',
524
+     *   '2001:4860:4860::8888',
525
+     *   '4.4.4.4:1053',
526
+     *   '[2001:4860:4860::8888]:1053',
527
+     * ]
528
+     * ```
529
+     * @since v0.11.3
530
+     */
531
+    export function getServers(): string[];
532
+    /**
533
+     * Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
534
+     *
535
+     * * `ipv4first`: sets default `verbatim` `false`.
536
+     * * `verbatim`: sets default `verbatim` `true`.
537
+     *
538
+     * The default is `ipv4first` and {@link setDefaultResultOrder} have higher
539
+     * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default
540
+     * dns orders in workers.
541
+     * @since v16.4.0, v14.18.0
542
+     * @param order must be `'ipv4first'` or `'verbatim'`.
543
+     */
544
+    export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
545
+    // Error codes
546
+    export const NODATA: string;
547
+    export const FORMERR: string;
548
+    export const SERVFAIL: string;
549
+    export const NOTFOUND: string;
550
+    export const NOTIMP: string;
551
+    export const REFUSED: string;
552
+    export const BADQUERY: string;
553
+    export const BADNAME: string;
554
+    export const BADFAMILY: string;
555
+    export const BADRESP: string;
556
+    export const CONNREFUSED: string;
557
+    export const TIMEOUT: string;
558
+    export const EOF: string;
559
+    export const FILE: string;
560
+    export const NOMEM: string;
561
+    export const DESTRUCTION: string;
562
+    export const BADSTR: string;
563
+    export const BADFLAGS: string;
564
+    export const NONAME: string;
565
+    export const BADHINTS: string;
566
+    export const NOTINITIALIZED: string;
567
+    export const LOADIPHLPAPI: string;
568
+    export const ADDRGETNETWORKPARAMS: string;
569
+    export const CANCELLED: string;
570
+    export interface ResolverOptions {
571
+        timeout?: number | undefined;
572
+        /**
573
+         * @default 4
574
+         */
575
+        tries?: number;
576
+    }
577
+    /**
578
+     * An independent resolver for DNS requests.
579
+     *
580
+     * Creating a new resolver uses the default server settings. Setting
581
+     * the servers used for a resolver using `resolver.setServers()` does not affect
582
+     * other resolvers:
583
+     *
584
+     * ```js
585
+     * const { Resolver } = require('dns');
586
+     * const resolver = new Resolver();
587
+     * resolver.setServers(['4.4.4.4']);
588
+     *
589
+     * // This request will use the server at 4.4.4.4, independent of global settings.
590
+     * resolver.resolve4('example.org', (err, addresses) => {
591
+     *   // ...
592
+     * });
593
+     * ```
594
+     *
595
+     * The following methods from the `dns` module are available:
596
+     *
597
+     * * `resolver.getServers()`
598
+     * * `resolver.resolve()`
599
+     * * `resolver.resolve4()`
600
+     * * `resolver.resolve6()`
601
+     * * `resolver.resolveAny()`
602
+     * * `resolver.resolveCaa()`
603
+     * * `resolver.resolveCname()`
604
+     * * `resolver.resolveMx()`
605
+     * * `resolver.resolveNaptr()`
606
+     * * `resolver.resolveNs()`
607
+     * * `resolver.resolvePtr()`
608
+     * * `resolver.resolveSoa()`
609
+     * * `resolver.resolveSrv()`
610
+     * * `resolver.resolveTxt()`
611
+     * * `resolver.reverse()`
612
+     * * `resolver.setServers()`
613
+     * @since v8.3.0
614
+     */
615
+    export class Resolver {
616
+        constructor(options?: ResolverOptions);
617
+        /**
618
+         * Cancel all outstanding DNS queries made by this resolver. The corresponding
619
+         * callbacks will be called with an error with code `ECANCELLED`.
620
+         * @since v8.3.0
621
+         */
622
+        cancel(): void;
623
+        getServers: typeof getServers;
624
+        resolve: typeof resolve;
625
+        resolve4: typeof resolve4;
626
+        resolve6: typeof resolve6;
627
+        resolveAny: typeof resolveAny;
628
+        resolveCname: typeof resolveCname;
629
+        resolveMx: typeof resolveMx;
630
+        resolveNaptr: typeof resolveNaptr;
631
+        resolveNs: typeof resolveNs;
632
+        resolvePtr: typeof resolvePtr;
633
+        resolveSoa: typeof resolveSoa;
634
+        resolveSrv: typeof resolveSrv;
635
+        resolveTxt: typeof resolveTxt;
636
+        reverse: typeof reverse;
637
+        /**
638
+         * The resolver instance will send its requests from the specified IP address.
639
+         * This allows programs to specify outbound interfaces when used on multi-homed
640
+         * systems.
641
+         *
642
+         * If a v4 or v6 address is not specified, it is set to the default, and the
643
+         * operating system will choose a local address automatically.
644
+         *
645
+         * The resolver will use the v4 local address when making requests to IPv4 DNS
646
+         * servers, and the v6 local address when making requests to IPv6 DNS servers.
647
+         * The `rrtype` of resolution requests has no impact on the local address used.
648
+         * @since v15.1.0, v14.17.0
649
+         * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
650
+         * @param [ipv6='::0'] A string representation of an IPv6 address.
651
+         */
652
+        setLocalAddress(ipv4?: string, ipv6?: string): void;
653
+        setServers: typeof setServers;
654
+    }
655
+    export { dnsPromises as promises };
656
+}
657
+declare module 'node:dns' {
658
+    export * from 'dns';
659
+}

+ 370
- 0
node_modules/@types/node/dns/promises.d.ts 查看文件

@@ -0,0 +1,370 @@
1
+/**
2
+ * The `dns.promises` API provides an alternative set of asynchronous DNS methods
3
+ * that return `Promise` objects rather than using callbacks. The API is accessible
4
+ * via `require('dns').promises` or `require('dns/promises')`.
5
+ * @since v10.6.0
6
+ */
7
+declare module 'dns/promises' {
8
+    import {
9
+        LookupAddress,
10
+        LookupOneOptions,
11
+        LookupAllOptions,
12
+        LookupOptions,
13
+        AnyRecord,
14
+        CaaRecord,
15
+        MxRecord,
16
+        NaptrRecord,
17
+        SoaRecord,
18
+        SrvRecord,
19
+        ResolveWithTtlOptions,
20
+        RecordWithTtl,
21
+        ResolveOptions,
22
+        ResolverOptions,
23
+    } from 'node:dns';
24
+    /**
25
+     * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
26
+     * that are currently configured for DNS resolution. A string will include a port
27
+     * section if a custom port is used.
28
+     *
29
+     * ```js
30
+     * [
31
+     *   '4.4.4.4',
32
+     *   '2001:4860:4860::8888',
33
+     *   '4.4.4.4:1053',
34
+     *   '[2001:4860:4860::8888]:1053',
35
+     * ]
36
+     * ```
37
+     * @since v10.6.0
38
+     */
39
+    function getServers(): string[];
40
+    /**
41
+     * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
42
+     * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
43
+     * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
44
+     * and IPv6 addresses are both returned if found.
45
+     *
46
+     * With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`.
47
+     *
48
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
49
+     * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
50
+     * the host name does not exist but also when the lookup fails in other ways
51
+     * such as no available file descriptors.
52
+     *
53
+     * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
54
+     * protocol. The implementation uses an operating system facility that can
55
+     * associate names with addresses, and vice versa. This implementation can have
56
+     * subtle but important consequences on the behavior of any Node.js program. Please
57
+     * take some time to consult the `Implementation considerations section` before
58
+     * using `dnsPromises.lookup()`.
59
+     *
60
+     * Example usage:
61
+     *
62
+     * ```js
63
+     * const dns = require('dns');
64
+     * const dnsPromises = dns.promises;
65
+     * const options = {
66
+     *   family: 6,
67
+     *   hints: dns.ADDRCONFIG | dns.V4MAPPED,
68
+     * };
69
+     *
70
+     * dnsPromises.lookup('example.com', options).then((result) => {
71
+     *   console.log('address: %j family: IPv%s', result.address, result.family);
72
+     *   // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
73
+     * });
74
+     *
75
+     * // When options.all is true, the result will be an Array.
76
+     * options.all = true;
77
+     * dnsPromises.lookup('example.com', options).then((result) => {
78
+     *   console.log('addresses: %j', result);
79
+     *   // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
80
+     * });
81
+     * ```
82
+     * @since v10.6.0
83
+     */
84
+    function lookup(hostname: string, family: number): Promise<LookupAddress>;
85
+    function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
86
+    function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
87
+    function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
88
+    function lookup(hostname: string): Promise<LookupAddress>;
89
+    /**
90
+     * Resolves the given `address` and `port` into a host name and service using
91
+     * the operating system's underlying `getnameinfo` implementation.
92
+     *
93
+     * If `address` is not a valid IP address, a `TypeError` will be thrown.
94
+     * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
95
+     *
96
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
97
+     *
98
+     * ```js
99
+     * const dnsPromises = require('dns').promises;
100
+     * dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
101
+     *   console.log(result.hostname, result.service);
102
+     *   // Prints: localhost ssh
103
+     * });
104
+     * ```
105
+     * @since v10.6.0
106
+     */
107
+    function lookupService(
108
+        address: string,
109
+        port: number
110
+    ): Promise<{
111
+        hostname: string;
112
+        service: string;
113
+    }>;
114
+    /**
115
+     * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
116
+     * of the resource records. When successful, the `Promise` is resolved with an
117
+     * array of resource records. The type and structure of individual results vary
118
+     * based on `rrtype`:
119
+     *
120
+     * <omitted>
121
+     *
122
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
123
+     * @since v10.6.0
124
+     * @param hostname Host name to resolve.
125
+     * @param [rrtype='A'] Resource record type.
126
+     */
127
+    function resolve(hostname: string): Promise<string[]>;
128
+    function resolve(hostname: string, rrtype: 'A'): Promise<string[]>;
129
+    function resolve(hostname: string, rrtype: 'AAAA'): Promise<string[]>;
130
+    function resolve(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
131
+    function resolve(hostname: string, rrtype: 'CAA'): Promise<CaaRecord[]>;
132
+    function resolve(hostname: string, rrtype: 'CNAME'): Promise<string[]>;
133
+    function resolve(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
134
+    function resolve(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
135
+    function resolve(hostname: string, rrtype: 'NS'): Promise<string[]>;
136
+    function resolve(hostname: string, rrtype: 'PTR'): Promise<string[]>;
137
+    function resolve(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
138
+    function resolve(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
139
+    function resolve(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
140
+    function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
141
+    /**
142
+     * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4
143
+     * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
144
+     * @since v10.6.0
145
+     * @param hostname Host name to resolve.
146
+     */
147
+    function resolve4(hostname: string): Promise<string[]>;
148
+    function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
149
+    function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
150
+    /**
151
+     * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6
152
+     * addresses.
153
+     * @since v10.6.0
154
+     * @param hostname Host name to resolve.
155
+     */
156
+    function resolve6(hostname: string): Promise<string[]>;
157
+    function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
158
+    function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
159
+    /**
160
+     * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
161
+     * On success, the `Promise` is resolved with an array containing various types of
162
+     * records. Each object has a property `type` that indicates the type of the
163
+     * current record. And depending on the `type`, additional properties will be
164
+     * present on the object:
165
+     *
166
+     * <omitted>
167
+     *
168
+     * Here is an example of the result object:
169
+     *
170
+     * ```js
171
+     * [ { type: 'A', address: '127.0.0.1', ttl: 299 },
172
+     *   { type: 'CNAME', value: 'example.com' },
173
+     *   { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
174
+     *   { type: 'NS', value: 'ns1.example.com' },
175
+     *   { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
176
+     *   { type: 'SOA',
177
+     *     nsname: 'ns1.example.com',
178
+     *     hostmaster: 'admin.example.com',
179
+     *     serial: 156696742,
180
+     *     refresh: 900,
181
+     *     retry: 900,
182
+     *     expire: 1800,
183
+     *     minttl: 60 } ]
184
+     * ```
185
+     * @since v10.6.0
186
+     */
187
+    function resolveAny(hostname: string): Promise<AnyRecord[]>;
188
+    /**
189
+     * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
190
+     * the `Promise` is resolved with an array of objects containing available
191
+     * certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
192
+     * @since v15.0.0, v14.17.0
193
+     */
194
+    function resolveCaa(hostname: string): Promise<CaaRecord[]>;
195
+    /**
196
+     * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success,
197
+     * the `Promise` is resolved with an array of canonical name records available for
198
+     * the `hostname` (e.g. `['bar.example.com']`).
199
+     * @since v10.6.0
200
+     */
201
+    function resolveCname(hostname: string): Promise<string[]>;
202
+    /**
203
+     * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects
204
+     * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`).
205
+     * @since v10.6.0
206
+     */
207
+    function resolveMx(hostname: string): Promise<MxRecord[]>;
208
+    /**
209
+     * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
210
+     * of objects with the following properties:
211
+     *
212
+     * * `flags`
213
+     * * `service`
214
+     * * `regexp`
215
+     * * `replacement`
216
+     * * `order`
217
+     * * `preference`
218
+     *
219
+     * ```js
220
+     * {
221
+     *   flags: 's',
222
+     *   service: 'SIP+D2U',
223
+     *   regexp: '',
224
+     *   replacement: '_sip._udp.example.com',
225
+     *   order: 30,
226
+     *   preference: 100
227
+     * }
228
+     * ```
229
+     * @since v10.6.0
230
+     */
231
+    function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
232
+    /**
233
+     * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server
234
+     * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`).
235
+     * @since v10.6.0
236
+     */
237
+    function resolveNs(hostname: string): Promise<string[]>;
238
+    /**
239
+     * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings
240
+     * containing the reply records.
241
+     * @since v10.6.0
242
+     */
243
+    function resolvePtr(hostname: string): Promise<string[]>;
244
+    /**
245
+     * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
246
+     * the `hostname`. On success, the `Promise` is resolved with an object with the
247
+     * following properties:
248
+     *
249
+     * * `nsname`
250
+     * * `hostmaster`
251
+     * * `serial`
252
+     * * `refresh`
253
+     * * `retry`
254
+     * * `expire`
255
+     * * `minttl`
256
+     *
257
+     * ```js
258
+     * {
259
+     *   nsname: 'ns.example.com',
260
+     *   hostmaster: 'root.example.com',
261
+     *   serial: 2013101809,
262
+     *   refresh: 10000,
263
+     *   retry: 2400,
264
+     *   expire: 604800,
265
+     *   minttl: 3600
266
+     * }
267
+     * ```
268
+     * @since v10.6.0
269
+     */
270
+    function resolveSoa(hostname: string): Promise<SoaRecord>;
271
+    /**
272
+     * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with
273
+     * the following properties:
274
+     *
275
+     * * `priority`
276
+     * * `weight`
277
+     * * `port`
278
+     * * `name`
279
+     *
280
+     * ```js
281
+     * {
282
+     *   priority: 10,
283
+     *   weight: 5,
284
+     *   port: 21223,
285
+     *   name: 'service.example.com'
286
+     * }
287
+     * ```
288
+     * @since v10.6.0
289
+     */
290
+    function resolveSrv(hostname: string): Promise<SrvRecord[]>;
291
+    /**
292
+     * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array
293
+     * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
294
+     * one record. Depending on the use case, these could be either joined together or
295
+     * treated separately.
296
+     * @since v10.6.0
297
+     */
298
+    function resolveTxt(hostname: string): Promise<string[][]>;
299
+    /**
300
+     * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
301
+     * array of host names.
302
+     *
303
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
304
+     * @since v10.6.0
305
+     */
306
+    function reverse(ip: string): Promise<string[]>;
307
+    /**
308
+     * Sets the IP address and port of servers to be used when performing DNS
309
+     * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
310
+     * addresses. If the port is the IANA default DNS port (53) it can be omitted.
311
+     *
312
+     * ```js
313
+     * dnsPromises.setServers([
314
+     *   '4.4.4.4',
315
+     *   '[2001:4860:4860::8888]',
316
+     *   '4.4.4.4:1053',
317
+     *   '[2001:4860:4860::8888]:1053',
318
+     * ]);
319
+     * ```
320
+     *
321
+     * An error will be thrown if an invalid address is provided.
322
+     *
323
+     * The `dnsPromises.setServers()` method must not be called while a DNS query is in
324
+     * progress.
325
+     *
326
+     * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
327
+     * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
328
+     * subsequent servers provided. Fallback DNS servers will only be used if the
329
+     * earlier ones time out or result in some other error.
330
+     * @since v10.6.0
331
+     * @param servers array of `RFC 5952` formatted addresses
332
+     */
333
+    function setServers(servers: ReadonlyArray<string>): void;
334
+    /**
335
+     * Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:
336
+     *
337
+     * * `ipv4first`: sets default `verbatim` `false`.
338
+     * * `verbatim`: sets default `verbatim` `true`.
339
+     *
340
+     * The default is `ipv4first` and `dnsPromises.setDefaultResultOrder()` have
341
+     * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the
342
+     * default dns orders in workers.
343
+     * @since v16.4.0, v14.18.0
344
+     * @param order must be `'ipv4first'` or `'verbatim'`.
345
+     */
346
+    function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
347
+    class Resolver {
348
+        constructor(options?: ResolverOptions);
349
+        cancel(): void;
350
+        getServers: typeof getServers;
351
+        resolve: typeof resolve;
352
+        resolve4: typeof resolve4;
353
+        resolve6: typeof resolve6;
354
+        resolveAny: typeof resolveAny;
355
+        resolveCname: typeof resolveCname;
356
+        resolveMx: typeof resolveMx;
357
+        resolveNaptr: typeof resolveNaptr;
358
+        resolveNs: typeof resolveNs;
359
+        resolvePtr: typeof resolvePtr;
360
+        resolveSoa: typeof resolveSoa;
361
+        resolveSrv: typeof resolveSrv;
362
+        resolveTxt: typeof resolveTxt;
363
+        reverse: typeof reverse;
364
+        setLocalAddress(ipv4?: string, ipv6?: string): void;
365
+        setServers: typeof setServers;
366
+    }
367
+}
368
+declare module 'node:dns/promises' {
369
+    export * from 'dns/promises';
370
+}

+ 126
- 0
node_modules/@types/node/dom-events.d.ts 查看文件

@@ -0,0 +1,126 @@
1
+export {}; // Don't export anything!
2
+
3
+//// DOM-like Events
4
+// NB: The Event / EventTarget / EventListener implementations below were copied
5
+// from lib.dom.d.ts, then edited to reflect Node's documentation at
6
+// https://nodejs.org/api/events.html#class-eventtarget.
7
+// Please read that link to understand important implementation differences.
8
+
9
+// This conditional type will be the existing global Event in a browser, or
10
+// the copy below in a Node environment.
11
+type __Event = typeof globalThis extends { onmessage: any, Event: infer T }
12
+? T
13
+: {
14
+    /** This is not used in Node.js and is provided purely for completeness. */
15
+    readonly bubbles: boolean;
16
+    /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
17
+    cancelBubble: () => void;
18
+    /** True if the event was created with the cancelable option */
19
+    readonly cancelable: boolean;
20
+    /** This is not used in Node.js and is provided purely for completeness. */
21
+    readonly composed: boolean;
22
+    /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
23
+    composedPath(): [EventTarget?]
24
+    /** Alias for event.target. */
25
+    readonly currentTarget: EventTarget | null;
26
+    /** Is true if cancelable is true and event.preventDefault() has been called. */
27
+    readonly defaultPrevented: boolean;
28
+    /** This is not used in Node.js and is provided purely for completeness. */
29
+    readonly eventPhase: 0 | 2;
30
+    /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
31
+    readonly isTrusted: boolean;
32
+    /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
33
+    preventDefault(): void;
34
+    /** This is not used in Node.js and is provided purely for completeness. */
35
+    returnValue: boolean;
36
+    /** Alias for event.target. */
37
+    readonly srcElement: EventTarget | null;
38
+    /** Stops the invocation of event listeners after the current one completes. */
39
+    stopImmediatePropagation(): void;
40
+    /** This is not used in Node.js and is provided purely for completeness. */
41
+    stopPropagation(): void;
42
+    /** The `EventTarget` dispatching the event */
43
+    readonly target: EventTarget | null;
44
+    /** The millisecond timestamp when the Event object was created. */
45
+    readonly timeStamp: number;
46
+    /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
47
+    readonly type: string;
48
+};
49
+
50
+// See comment above explaining conditional type
51
+type __EventTarget = typeof globalThis extends { onmessage: any, EventTarget: infer T }
52
+? T
53
+: {
54
+    /**
55
+     * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
56
+     *
57
+     * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
58
+     *
59
+     * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
60
+     * Specifically, the `capture` option is used as part of the key when registering a `listener`.
61
+     * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
62
+     */
63
+    addEventListener(
64
+        type: string,
65
+        listener: EventListener | EventListenerObject,
66
+        options?: AddEventListenerOptions | boolean,
67
+    ): void;
68
+    /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
69
+    dispatchEvent(event: Event): boolean;
70
+    /** Removes the event listener in target's event listener list with the same type, callback, and options. */
71
+    removeEventListener(
72
+        type: string,
73
+        listener: EventListener | EventListenerObject,
74
+        options?: EventListenerOptions | boolean,
75
+    ): void;
76
+};
77
+
78
+interface EventInit {
79
+    bubbles?: boolean;
80
+    cancelable?: boolean;
81
+    composed?: boolean;
82
+}
83
+
84
+interface EventListenerOptions {
85
+    /** Not directly used by Node.js. Added for API completeness. Default: `false`. */
86
+    capture?: boolean;
87
+}
88
+
89
+interface AddEventListenerOptions extends EventListenerOptions {
90
+    /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
91
+    once?: boolean;
92
+    /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
93
+    passive?: boolean;
94
+}
95
+
96
+interface EventListener {
97
+    (evt: Event): void;
98
+}
99
+
100
+interface EventListenerObject {
101
+    handleEvent(object: Event): void;
102
+}
103
+
104
+import {} from 'events';    // Make this an ambient declaration
105
+declare global {
106
+    /** An event which takes place in the DOM. */
107
+    interface Event extends __Event {}
108
+    var Event: typeof globalThis extends { onmessage: any, Event: infer T }
109
+        ? T
110
+        : {
111
+            prototype: __Event;
112
+            new (type: string, eventInitDict?: EventInit): __Event;
113
+        };
114
+
115
+    /**
116
+     * EventTarget is a DOM interface implemented by objects that can
117
+     * receive events and may have listeners for them.
118
+     */
119
+    interface EventTarget extends __EventTarget {}
120
+    var EventTarget: typeof globalThis extends { onmessage: any, EventTarget: infer T }
121
+        ? T
122
+        : {
123
+            prototype: __EventTarget;
124
+            new (): __EventTarget;
125
+        };
126
+}

+ 170
- 0
node_modules/@types/node/domain.d.ts 查看文件

@@ -0,0 +1,170 @@
1
+/**
2
+ * **This module is pending deprecation.** Once a replacement API has been
3
+ * finalized, this module will be fully deprecated. Most developers should
4
+ * **not** have cause to use this module. Users who absolutely must have
5
+ * the functionality that domains provide may rely on it for the time being
6
+ * but should expect to have to migrate to a different solution
7
+ * in the future.
8
+ *
9
+ * Domains provide a way to handle multiple different IO operations as a
10
+ * single group. If any of the event emitters or callbacks registered to a
11
+ * domain emit an `'error'` event, or throw an error, then the domain object
12
+ * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
13
+ * exit immediately with an error code.
14
+ * @deprecated Since v1.4.2 - Deprecated
15
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/domain.js)
16
+ */
17
+declare module 'domain' {
18
+    import EventEmitter = require('node:events');
19
+    /**
20
+     * The `Domain` class encapsulates the functionality of routing errors and
21
+     * uncaught exceptions to the active `Domain` object.
22
+     *
23
+     * To handle the errors that it catches, listen to its `'error'` event.
24
+     */
25
+    class Domain extends EventEmitter {
26
+        /**
27
+         * An array of timers and event emitters that have been explicitly added
28
+         * to the domain.
29
+         */
30
+        members: Array<EventEmitter | NodeJS.Timer>;
31
+        /**
32
+         * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
33
+         * pushes the domain onto the domain
34
+         * stack managed by the domain module (see {@link exit} for details on the
35
+         * domain stack). The call to `enter()` delimits the beginning of a chain of
36
+         * asynchronous calls and I/O operations bound to a domain.
37
+         *
38
+         * Calling `enter()` changes only the active domain, and does not alter the domain
39
+         * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
40
+         * single domain.
41
+         */
42
+        enter(): void;
43
+        /**
44
+         * The `exit()` method exits the current domain, popping it off the domain stack.
45
+         * Any time execution is going to switch to the context of a different chain of
46
+         * asynchronous calls, it's important to ensure that the current domain is exited.
47
+         * The call to `exit()` delimits either the end of or an interruption to the chain
48
+         * of asynchronous calls and I/O operations bound to a domain.
49
+         *
50
+         * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain.
51
+         *
52
+         * Calling `exit()` changes only the active domain, and does not alter the domain
53
+         * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
54
+         * single domain.
55
+         */
56
+        exit(): void;
57
+        /**
58
+         * Run the supplied function in the context of the domain, implicitly
59
+         * binding all event emitters, timers, and lowlevel requests that are
60
+         * created in that context. Optionally, arguments can be passed to
61
+         * the function.
62
+         *
63
+         * This is the most basic way to use a domain.
64
+         *
65
+         * ```js
66
+         * const domain = require('domain');
67
+         * const fs = require('fs');
68
+         * const d = domain.create();
69
+         * d.on('error', (er) => {
70
+         *   console.error('Caught error!', er);
71
+         * });
72
+         * d.run(() => {
73
+         *   process.nextTick(() => {
74
+         *     setTimeout(() => { // Simulating some various async stuff
75
+         *       fs.open('non-existent file', 'r', (er, fd) => {
76
+         *         if (er) throw er;
77
+         *         // proceed...
78
+         *       });
79
+         *     }, 100);
80
+         *   });
81
+         * });
82
+         * ```
83
+         *
84
+         * In this example, the `d.on('error')` handler will be triggered, rather
85
+         * than crashing the program.
86
+         */
87
+        run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
88
+        /**
89
+         * Explicitly adds an emitter to the domain. If any event handlers called by
90
+         * the emitter throw an error, or if the emitter emits an `'error'` event, it
91
+         * will be routed to the domain's `'error'` event, just like with implicit
92
+         * binding.
93
+         *
94
+         * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
95
+         * the domain `'error'` handler.
96
+         *
97
+         * If the Timer or `EventEmitter` was already bound to a domain, it is removed
98
+         * from that one, and bound to this one instead.
99
+         * @param emitter emitter or timer to be added to the domain
100
+         */
101
+        add(emitter: EventEmitter | NodeJS.Timer): void;
102
+        /**
103
+         * The opposite of {@link add}. Removes domain handling from the
104
+         * specified emitter.
105
+         * @param emitter emitter or timer to be removed from the domain
106
+         */
107
+        remove(emitter: EventEmitter | NodeJS.Timer): void;
108
+        /**
109
+         * The returned function will be a wrapper around the supplied callback
110
+         * function. When the returned function is called, any errors that are
111
+         * thrown will be routed to the domain's `'error'` event.
112
+         *
113
+         * ```js
114
+         * const d = domain.create();
115
+         *
116
+         * function readSomeFile(filename, cb) {
117
+         *   fs.readFile(filename, 'utf8', d.bind((er, data) => {
118
+         *     // If this throws, it will also be passed to the domain.
119
+         *     return cb(er, data ? JSON.parse(data) : null);
120
+         *   }));
121
+         * }
122
+         *
123
+         * d.on('error', (er) => {
124
+         *   // An error occurred somewhere. If we throw it now, it will crash the program
125
+         *   // with the normal line number and stack message.
126
+         * });
127
+         * ```
128
+         * @param callback The callback function
129
+         * @return The bound function
130
+         */
131
+        bind<T extends Function>(callback: T): T;
132
+        /**
133
+         * This method is almost identical to {@link bind}. However, in
134
+         * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function.
135
+         *
136
+         * In this way, the common `if (err) return callback(err);` pattern can be replaced
137
+         * with a single error handler in a single place.
138
+         *
139
+         * ```js
140
+         * const d = domain.create();
141
+         *
142
+         * function readSomeFile(filename, cb) {
143
+         *   fs.readFile(filename, 'utf8', d.intercept((data) => {
144
+         *     // Note, the first argument is never passed to the
145
+         *     // callback since it is assumed to be the 'Error' argument
146
+         *     // and thus intercepted by the domain.
147
+         *
148
+         *     // If this throws, it will also be passed to the domain
149
+         *     // so the error-handling logic can be moved to the 'error'
150
+         *     // event on the domain instead of being repeated throughout
151
+         *     // the program.
152
+         *     return cb(null, JSON.parse(data));
153
+         *   }));
154
+         * }
155
+         *
156
+         * d.on('error', (er) => {
157
+         *   // An error occurred somewhere. If we throw it now, it will crash the program
158
+         *   // with the normal line number and stack message.
159
+         * });
160
+         * ```
161
+         * @param callback The callback function
162
+         * @return The intercepted function
163
+         */
164
+        intercept<T extends Function>(callback: T): T;
165
+    }
166
+    function create(): Domain;
167
+}
168
+declare module 'node:domain' {
169
+    export * from 'domain';
170
+}

+ 678
- 0
node_modules/@types/node/events.d.ts 查看文件

@@ -0,0 +1,678 @@
1
+/**
2
+ * Much of the Node.js core API is built around an idiomatic asynchronous
3
+ * event-driven architecture in which certain kinds of objects (called "emitters")
4
+ * emit named events that cause `Function` objects ("listeners") to be called.
5
+ *
6
+ * For instance: a `net.Server` object emits an event each time a peer
7
+ * connects to it; a `fs.ReadStream` emits an event when the file is opened;
8
+ * a `stream` emits an event whenever data is available to be read.
9
+ *
10
+ * All objects that emit events are instances of the `EventEmitter` class. These
11
+ * objects expose an `eventEmitter.on()` function that allows one or more
12
+ * functions to be attached to named events emitted by the object. Typically,
13
+ * event names are camel-cased strings but any valid JavaScript property key
14
+ * can be used.
15
+ *
16
+ * When the `EventEmitter` object emits an event, all of the functions attached
17
+ * to that specific event are called _synchronously_. Any values returned by the
18
+ * called listeners are _ignored_ and discarded.
19
+ *
20
+ * The following example shows a simple `EventEmitter` instance with a single
21
+ * listener. The `eventEmitter.on()` method is used to register listeners, while
22
+ * the `eventEmitter.emit()` method is used to trigger the event.
23
+ *
24
+ * ```js
25
+ * const EventEmitter = require('events');
26
+ *
27
+ * class MyEmitter extends EventEmitter {}
28
+ *
29
+ * const myEmitter = new MyEmitter();
30
+ * myEmitter.on('event', () => {
31
+ *   console.log('an event occurred!');
32
+ * });
33
+ * myEmitter.emit('event');
34
+ * ```
35
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/events.js)
36
+ */
37
+declare module 'events' {
38
+    // NOTE: This class is in the docs but is **not actually exported** by Node.
39
+    // If https://github.com/nodejs/node/issues/39903 gets resolved and Node
40
+    // actually starts exporting the class, uncomment below.
41
+
42
+    // import { EventListener, EventListenerObject } from '__dom-events';
43
+    // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
44
+    // interface NodeEventTarget extends EventTarget {
45
+    //     /**
46
+    //      * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
47
+    //      * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
48
+    //      */
49
+    //     addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
50
+    //     /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
51
+    //     eventNames(): string[];
52
+    //     /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
53
+    //     listenerCount(type: string): number;
54
+    //     /** Node.js-specific alias for `eventTarget.removeListener()`. */
55
+    //     off(type: string, listener: EventListener | EventListenerObject): this;
56
+    //     /** Node.js-specific alias for `eventTarget.addListener()`. */
57
+    //     on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
58
+    //     /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */
59
+    //     once(type: string, listener: EventListener | EventListenerObject): this;
60
+    //     /**
61
+    //      * Node.js-specific extension to the `EventTarget` class.
62
+    //      * If `type` is specified, removes all registered listeners for `type`,
63
+    //      * otherwise removes all registered listeners.
64
+    //      */
65
+    //     removeAllListeners(type: string): this;
66
+    //     /**
67
+    //      * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
68
+    //      * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
69
+    //      */
70
+    //     removeListener(type: string, listener: EventListener | EventListenerObject): this;
71
+    // }
72
+
73
+    interface EventEmitterOptions {
74
+        /**
75
+         * Enables automatic capturing of promise rejection.
76
+         */
77
+        captureRejections?: boolean | undefined;
78
+    }
79
+    // Any EventTarget with a Node-style `once` function
80
+    interface _NodeEventTarget {
81
+        once(eventName: string | symbol, listener: (...args: any[]) => void): this;
82
+    }
83
+    // Any EventTarget with a DOM-style `addEventListener`
84
+    interface _DOMEventTarget {
85
+        addEventListener(
86
+            eventName: string,
87
+            listener: (...args: any[]) => void,
88
+            opts?: {
89
+                once: boolean;
90
+            }
91
+        ): any;
92
+    }
93
+    interface StaticEventEmitterOptions {
94
+        signal?: AbortSignal | undefined;
95
+    }
96
+    interface EventEmitter extends NodeJS.EventEmitter {}
97
+    /**
98
+     * The `EventEmitter` class is defined and exposed by the `events` module:
99
+     *
100
+     * ```js
101
+     * const EventEmitter = require('events');
102
+     * ```
103
+     *
104
+     * All `EventEmitter`s emit the event `'newListener'` when new listeners are
105
+     * added and `'removeListener'` when existing listeners are removed.
106
+     *
107
+     * It supports the following option:
108
+     * @since v0.1.26
109
+     */
110
+    class EventEmitter {
111
+        constructor(options?: EventEmitterOptions);
112
+        /**
113
+         * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
114
+         * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
115
+         * The `Promise` will resolve with an array of all the arguments emitted to the
116
+         * given event.
117
+         *
118
+         * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
119
+         * semantics and does not listen to the `'error'` event.
120
+         *
121
+         * ```js
122
+         * const { once, EventEmitter } = require('events');
123
+         *
124
+         * async function run() {
125
+         *   const ee = new EventEmitter();
126
+         *
127
+         *   process.nextTick(() => {
128
+         *     ee.emit('myevent', 42);
129
+         *   });
130
+         *
131
+         *   const [value] = await once(ee, 'myevent');
132
+         *   console.log(value);
133
+         *
134
+         *   const err = new Error('kaboom');
135
+         *   process.nextTick(() => {
136
+         *     ee.emit('error', err);
137
+         *   });
138
+         *
139
+         *   try {
140
+         *     await once(ee, 'myevent');
141
+         *   } catch (err) {
142
+         *     console.log('error happened', err);
143
+         *   }
144
+         * }
145
+         *
146
+         * run();
147
+         * ```
148
+         *
149
+         * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
150
+         * '`error'` event itself, then it is treated as any other kind of event without
151
+         * special handling:
152
+         *
153
+         * ```js
154
+         * const { EventEmitter, once } = require('events');
155
+         *
156
+         * const ee = new EventEmitter();
157
+         *
158
+         * once(ee, 'error')
159
+         *   .then(([err]) => console.log('ok', err.message))
160
+         *   .catch((err) => console.log('error', err.message));
161
+         *
162
+         * ee.emit('error', new Error('boom'));
163
+         *
164
+         * // Prints: ok boom
165
+         * ```
166
+         *
167
+         * An `AbortSignal` can be used to cancel waiting for the event:
168
+         *
169
+         * ```js
170
+         * const { EventEmitter, once } = require('events');
171
+         *
172
+         * const ee = new EventEmitter();
173
+         * const ac = new AbortController();
174
+         *
175
+         * async function foo(emitter, event, signal) {
176
+         *   try {
177
+         *     await once(emitter, event, { signal });
178
+         *     console.log('event emitted!');
179
+         *   } catch (error) {
180
+         *     if (error.name === 'AbortError') {
181
+         *       console.error('Waiting for the event was canceled!');
182
+         *     } else {
183
+         *       console.error('There was an error', error.message);
184
+         *     }
185
+         *   }
186
+         * }
187
+         *
188
+         * foo(ee, 'foo', ac.signal);
189
+         * ac.abort(); // Abort waiting for the event
190
+         * ee.emit('foo'); // Prints: Waiting for the event was canceled!
191
+         * ```
192
+         * @since v11.13.0, v10.16.0
193
+         */
194
+        static once(emitter: _NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
195
+        static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
196
+        /**
197
+         * ```js
198
+         * const { on, EventEmitter } = require('events');
199
+         *
200
+         * (async () => {
201
+         *   const ee = new EventEmitter();
202
+         *
203
+         *   // Emit later on
204
+         *   process.nextTick(() => {
205
+         *     ee.emit('foo', 'bar');
206
+         *     ee.emit('foo', 42);
207
+         *   });
208
+         *
209
+         *   for await (const event of on(ee, 'foo')) {
210
+         *     // The execution of this inner block is synchronous and it
211
+         *     // processes one event at a time (even with await). Do not use
212
+         *     // if concurrent execution is required.
213
+         *     console.log(event); // prints ['bar'] [42]
214
+         *   }
215
+         *   // Unreachable here
216
+         * })();
217
+         * ```
218
+         *
219
+         * Returns an `AsyncIterator` that iterates `eventName` events. It will throw
220
+         * if the `EventEmitter` emits `'error'`. It removes all listeners when
221
+         * exiting the loop. The `value` returned by each iteration is an array
222
+         * composed of the emitted event arguments.
223
+         *
224
+         * An `AbortSignal` can be used to cancel waiting on events:
225
+         *
226
+         * ```js
227
+         * const { on, EventEmitter } = require('events');
228
+         * const ac = new AbortController();
229
+         *
230
+         * (async () => {
231
+         *   const ee = new EventEmitter();
232
+         *
233
+         *   // Emit later on
234
+         *   process.nextTick(() => {
235
+         *     ee.emit('foo', 'bar');
236
+         *     ee.emit('foo', 42);
237
+         *   });
238
+         *
239
+         *   for await (const event of on(ee, 'foo', { signal: ac.signal })) {
240
+         *     // The execution of this inner block is synchronous and it
241
+         *     // processes one event at a time (even with await). Do not use
242
+         *     // if concurrent execution is required.
243
+         *     console.log(event); // prints ['bar'] [42]
244
+         *   }
245
+         *   // Unreachable here
246
+         * })();
247
+         *
248
+         * process.nextTick(() => ac.abort());
249
+         * ```
250
+         * @since v13.6.0, v12.16.0
251
+         * @param eventName The name of the event being listened for
252
+         * @return that iterates `eventName` events emitted by the `emitter`
253
+         */
254
+        static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
255
+        /**
256
+         * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
257
+         *
258
+         * ```js
259
+         * const { EventEmitter, listenerCount } = require('events');
260
+         * const myEmitter = new EventEmitter();
261
+         * myEmitter.on('event', () => {});
262
+         * myEmitter.on('event', () => {});
263
+         * console.log(listenerCount(myEmitter, 'event'));
264
+         * // Prints: 2
265
+         * ```
266
+         * @since v0.9.12
267
+         * @deprecated Since v3.2.0 - Use `listenerCount` instead.
268
+         * @param emitter The emitter to query
269
+         * @param eventName The event name
270
+         */
271
+        static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
272
+        /**
273
+         * Returns a copy of the array of listeners for the event named `eventName`.
274
+         *
275
+         * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
276
+         * the emitter.
277
+         *
278
+         * For `EventTarget`s this is the only way to get the event listeners for the
279
+         * event target. This is useful for debugging and diagnostic purposes.
280
+         *
281
+         * ```js
282
+         * const { getEventListeners, EventEmitter } = require('events');
283
+         *
284
+         * {
285
+         *   const ee = new EventEmitter();
286
+         *   const listener = () => console.log('Events are fun');
287
+         *   ee.on('foo', listener);
288
+         *   getEventListeners(ee, 'foo'); // [listener]
289
+         * }
290
+         * {
291
+         *   const et = new EventTarget();
292
+         *   const listener = () => console.log('Events are fun');
293
+         *   et.addEventListener('foo', listener);
294
+         *   getEventListeners(et, 'foo'); // [listener]
295
+         * }
296
+         * ```
297
+         * @since v15.2.0, v14.17.0
298
+         */
299
+        static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
300
+        /**
301
+         * ```js
302
+         * const {
303
+         *   setMaxListeners,
304
+         *   EventEmitter
305
+         * } = require('events');
306
+         *
307
+         * const target = new EventTarget();
308
+         * const emitter = new EventEmitter();
309
+         *
310
+         * setMaxListeners(5, target, emitter);
311
+         * ```
312
+         * @since v15.4.0
313
+         * @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
314
+         * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
315
+         * objects.
316
+         */
317
+        static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
318
+        /**
319
+         * This symbol shall be used to install a listener for only monitoring `'error'`
320
+         * events. Listeners installed using this symbol are called before the regular
321
+         * `'error'` listeners are called.
322
+         *
323
+         * Installing a listener using this symbol does not change the behavior once an
324
+         * `'error'` event is emitted, therefore the process will still crash if no
325
+         * regular `'error'` listener is installed.
326
+         */
327
+        static readonly errorMonitor: unique symbol;
328
+        static readonly captureRejectionSymbol: unique symbol;
329
+        /**
330
+         * Sets or gets the default captureRejection value for all emitters.
331
+         */
332
+        // TODO: These should be described using static getter/setter pairs:
333
+        static captureRejections: boolean;
334
+        static defaultMaxListeners: number;
335
+    }
336
+    import internal = require('node:events');
337
+    namespace EventEmitter {
338
+        // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
339
+        export { internal as EventEmitter };
340
+        export interface Abortable {
341
+            /**
342
+             * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
343
+             */
344
+            signal?: AbortSignal | undefined;
345
+        }
346
+    }
347
+    global {
348
+        namespace NodeJS {
349
+            interface EventEmitter {
350
+                /**
351
+                 * Alias for `emitter.on(eventName, listener)`.
352
+                 * @since v0.1.26
353
+                 */
354
+                addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
355
+                /**
356
+                 * Adds the `listener` function to the end of the listeners array for the
357
+                 * event named `eventName`. No checks are made to see if the `listener` has
358
+                 * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
359
+                 * times.
360
+                 *
361
+                 * ```js
362
+                 * server.on('connection', (stream) => {
363
+                 *   console.log('someone connected!');
364
+                 * });
365
+                 * ```
366
+                 *
367
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
368
+                 *
369
+                 * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
370
+                 * event listener to the beginning of the listeners array.
371
+                 *
372
+                 * ```js
373
+                 * const myEE = new EventEmitter();
374
+                 * myEE.on('foo', () => console.log('a'));
375
+                 * myEE.prependListener('foo', () => console.log('b'));
376
+                 * myEE.emit('foo');
377
+                 * // Prints:
378
+                 * //   b
379
+                 * //   a
380
+                 * ```
381
+                 * @since v0.1.101
382
+                 * @param eventName The name of the event.
383
+                 * @param listener The callback function
384
+                 */
385
+                on(eventName: string | symbol, listener: (...args: any[]) => void): this;
386
+                /**
387
+                 * Adds a **one-time**`listener` function for the event named `eventName`. The
388
+                 * next time `eventName` is triggered, this listener is removed and then invoked.
389
+                 *
390
+                 * ```js
391
+                 * server.once('connection', (stream) => {
392
+                 *   console.log('Ah, we have our first user!');
393
+                 * });
394
+                 * ```
395
+                 *
396
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
397
+                 *
398
+                 * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
399
+                 * event listener to the beginning of the listeners array.
400
+                 *
401
+                 * ```js
402
+                 * const myEE = new EventEmitter();
403
+                 * myEE.once('foo', () => console.log('a'));
404
+                 * myEE.prependOnceListener('foo', () => console.log('b'));
405
+                 * myEE.emit('foo');
406
+                 * // Prints:
407
+                 * //   b
408
+                 * //   a
409
+                 * ```
410
+                 * @since v0.3.0
411
+                 * @param eventName The name of the event.
412
+                 * @param listener The callback function
413
+                 */
414
+                once(eventName: string | symbol, listener: (...args: any[]) => void): this;
415
+                /**
416
+                 * Removes the specified `listener` from the listener array for the event named`eventName`.
417
+                 *
418
+                 * ```js
419
+                 * const callback = (stream) => {
420
+                 *   console.log('someone connected!');
421
+                 * };
422
+                 * server.on('connection', callback);
423
+                 * // ...
424
+                 * server.removeListener('connection', callback);
425
+                 * ```
426
+                 *
427
+                 * `removeListener()` will remove, at most, one instance of a listener from the
428
+                 * listener array. If any single listener has been added multiple times to the
429
+                 * listener array for the specified `eventName`, then `removeListener()` must be
430
+                 * called multiple times to remove each instance.
431
+                 *
432
+                 * Once an event is emitted, all listeners attached to it at the
433
+                 * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
434
+                 * will not remove them from`emit()` in progress. Subsequent events behave as expected.
435
+                 *
436
+                 * ```js
437
+                 * const myEmitter = new MyEmitter();
438
+                 *
439
+                 * const callbackA = () => {
440
+                 *   console.log('A');
441
+                 *   myEmitter.removeListener('event', callbackB);
442
+                 * };
443
+                 *
444
+                 * const callbackB = () => {
445
+                 *   console.log('B');
446
+                 * };
447
+                 *
448
+                 * myEmitter.on('event', callbackA);
449
+                 *
450
+                 * myEmitter.on('event', callbackB);
451
+                 *
452
+                 * // callbackA removes listener callbackB but it will still be called.
453
+                 * // Internal listener array at time of emit [callbackA, callbackB]
454
+                 * myEmitter.emit('event');
455
+                 * // Prints:
456
+                 * //   A
457
+                 * //   B
458
+                 *
459
+                 * // callbackB is now removed.
460
+                 * // Internal listener array [callbackA]
461
+                 * myEmitter.emit('event');
462
+                 * // Prints:
463
+                 * //   A
464
+                 * ```
465
+                 *
466
+                 * Because listeners are managed using an internal array, calling this will
467
+                 * change the position indices of any listener registered _after_ the listener
468
+                 * being removed. This will not impact the order in which listeners are called,
469
+                 * but it means that any copies of the listener array as returned by
470
+                 * the `emitter.listeners()` method will need to be recreated.
471
+                 *
472
+                 * When a single function has been added as a handler multiple times for a single
473
+                 * event (as in the example below), `removeListener()` will remove the most
474
+                 * recently added instance. In the example the `once('ping')`listener is removed:
475
+                 *
476
+                 * ```js
477
+                 * const ee = new EventEmitter();
478
+                 *
479
+                 * function pong() {
480
+                 *   console.log('pong');
481
+                 * }
482
+                 *
483
+                 * ee.on('ping', pong);
484
+                 * ee.once('ping', pong);
485
+                 * ee.removeListener('ping', pong);
486
+                 *
487
+                 * ee.emit('ping');
488
+                 * ee.emit('ping');
489
+                 * ```
490
+                 *
491
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
492
+                 * @since v0.1.26
493
+                 */
494
+                removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
495
+                /**
496
+                 * Alias for `emitter.removeListener()`.
497
+                 * @since v10.0.0
498
+                 */
499
+                off(eventName: string | symbol, listener: (...args: any[]) => void): this;
500
+                /**
501
+                 * Removes all listeners, or those of the specified `eventName`.
502
+                 *
503
+                 * It is bad practice to remove listeners added elsewhere in the code,
504
+                 * particularly when the `EventEmitter` instance was created by some other
505
+                 * component or module (e.g. sockets or file streams).
506
+                 *
507
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
508
+                 * @since v0.1.26
509
+                 */
510
+                removeAllListeners(event?: string | symbol): this;
511
+                /**
512
+                 * By default `EventEmitter`s will print a warning if more than `10` listeners are
513
+                 * added for a particular event. This is a useful default that helps finding
514
+                 * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
515
+                 * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
516
+                 *
517
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
518
+                 * @since v0.3.5
519
+                 */
520
+                setMaxListeners(n: number): this;
521
+                /**
522
+                 * Returns the current max listener value for the `EventEmitter` which is either
523
+                 * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}.
524
+                 * @since v1.0.0
525
+                 */
526
+                getMaxListeners(): number;
527
+                /**
528
+                 * Returns a copy of the array of listeners for the event named `eventName`.
529
+                 *
530
+                 * ```js
531
+                 * server.on('connection', (stream) => {
532
+                 *   console.log('someone connected!');
533
+                 * });
534
+                 * console.log(util.inspect(server.listeners('connection')));
535
+                 * // Prints: [ [Function] ]
536
+                 * ```
537
+                 * @since v0.1.26
538
+                 */
539
+                listeners(eventName: string | symbol): Function[];
540
+                /**
541
+                 * Returns a copy of the array of listeners for the event named `eventName`,
542
+                 * including any wrappers (such as those created by `.once()`).
543
+                 *
544
+                 * ```js
545
+                 * const emitter = new EventEmitter();
546
+                 * emitter.once('log', () => console.log('log once'));
547
+                 *
548
+                 * // Returns a new Array with a function `onceWrapper` which has a property
549
+                 * // `listener` which contains the original listener bound above
550
+                 * const listeners = emitter.rawListeners('log');
551
+                 * const logFnWrapper = listeners[0];
552
+                 *
553
+                 * // Logs "log once" to the console and does not unbind the `once` event
554
+                 * logFnWrapper.listener();
555
+                 *
556
+                 * // Logs "log once" to the console and removes the listener
557
+                 * logFnWrapper();
558
+                 *
559
+                 * emitter.on('log', () => console.log('log persistently'));
560
+                 * // Will return a new Array with a single function bound by `.on()` above
561
+                 * const newListeners = emitter.rawListeners('log');
562
+                 *
563
+                 * // Logs "log persistently" twice
564
+                 * newListeners[0]();
565
+                 * emitter.emit('log');
566
+                 * ```
567
+                 * @since v9.4.0
568
+                 */
569
+                rawListeners(eventName: string | symbol): Function[];
570
+                /**
571
+                 * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
572
+                 * to each.
573
+                 *
574
+                 * Returns `true` if the event had listeners, `false` otherwise.
575
+                 *
576
+                 * ```js
577
+                 * const EventEmitter = require('events');
578
+                 * const myEmitter = new EventEmitter();
579
+                 *
580
+                 * // First listener
581
+                 * myEmitter.on('event', function firstListener() {
582
+                 *   console.log('Helloooo! first listener');
583
+                 * });
584
+                 * // Second listener
585
+                 * myEmitter.on('event', function secondListener(arg1, arg2) {
586
+                 *   console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
587
+                 * });
588
+                 * // Third listener
589
+                 * myEmitter.on('event', function thirdListener(...args) {
590
+                 *   const parameters = args.join(', ');
591
+                 *   console.log(`event with parameters ${parameters} in third listener`);
592
+                 * });
593
+                 *
594
+                 * console.log(myEmitter.listeners('event'));
595
+                 *
596
+                 * myEmitter.emit('event', 1, 2, 3, 4, 5);
597
+                 *
598
+                 * // Prints:
599
+                 * // [
600
+                 * //   [Function: firstListener],
601
+                 * //   [Function: secondListener],
602
+                 * //   [Function: thirdListener]
603
+                 * // ]
604
+                 * // Helloooo! first listener
605
+                 * // event with parameters 1, 2 in second listener
606
+                 * // event with parameters 1, 2, 3, 4, 5 in third listener
607
+                 * ```
608
+                 * @since v0.1.26
609
+                 */
610
+                emit(eventName: string | symbol, ...args: any[]): boolean;
611
+                /**
612
+                 * Returns the number of listeners listening to the event named `eventName`.
613
+                 * @since v3.2.0
614
+                 * @param eventName The name of the event being listened for
615
+                 */
616
+                listenerCount(eventName: string | symbol): number;
617
+                /**
618
+                 * Adds the `listener` function to the _beginning_ of the listeners array for the
619
+                 * event named `eventName`. No checks are made to see if the `listener` has
620
+                 * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
621
+                 * times.
622
+                 *
623
+                 * ```js
624
+                 * server.prependListener('connection', (stream) => {
625
+                 *   console.log('someone connected!');
626
+                 * });
627
+                 * ```
628
+                 *
629
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
630
+                 * @since v6.0.0
631
+                 * @param eventName The name of the event.
632
+                 * @param listener The callback function
633
+                 */
634
+                prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
635
+                /**
636
+                 * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
637
+                 * listener is removed, and then invoked.
638
+                 *
639
+                 * ```js
640
+                 * server.prependOnceListener('connection', (stream) => {
641
+                 *   console.log('Ah, we have our first user!');
642
+                 * });
643
+                 * ```
644
+                 *
645
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
646
+                 * @since v6.0.0
647
+                 * @param eventName The name of the event.
648
+                 * @param listener The callback function
649
+                 */
650
+                prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
651
+                /**
652
+                 * Returns an array listing the events for which the emitter has registered
653
+                 * listeners. The values in the array are strings or `Symbol`s.
654
+                 *
655
+                 * ```js
656
+                 * const EventEmitter = require('events');
657
+                 * const myEE = new EventEmitter();
658
+                 * myEE.on('foo', () => {});
659
+                 * myEE.on('bar', () => {});
660
+                 *
661
+                 * const sym = Symbol('symbol');
662
+                 * myEE.on(sym, () => {});
663
+                 *
664
+                 * console.log(myEE.eventNames());
665
+                 * // Prints: [ 'foo', 'bar', Symbol(symbol) ]
666
+                 * ```
667
+                 * @since v6.0.0
668
+                 */
669
+                eventNames(): Array<string | symbol>;
670
+            }
671
+        }
672
+    }
673
+    export = EventEmitter;
674
+}
675
+declare module 'node:events' {
676
+    import events = require('events');
677
+    export = events;
678
+}

+ 3872
- 0
node_modules/@types/node/fs.d.ts
文件差異過大導致無法顯示
查看文件


+ 1138
- 0
node_modules/@types/node/fs/promises.d.ts
文件差異過大導致無法顯示
查看文件


+ 296
- 0
node_modules/@types/node/globals.d.ts 查看文件

@@ -0,0 +1,296 @@
1
+// Declare "static" methods in Error
2
+interface ErrorConstructor {
3
+    /** Create .stack property on a target object */
4
+    captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
+
6
+    /**
7
+     * Optional override for formatting stack traces
8
+     *
9
+     * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
10
+     */
11
+    prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
12
+
13
+    stackTraceLimit: number;
14
+}
15
+
16
+/*-----------------------------------------------*
17
+ *                                               *
18
+ *                   GLOBAL                      *
19
+ *                                               *
20
+ ------------------------------------------------*/
21
+
22
+// For backwards compability
23
+interface NodeRequire extends NodeJS.Require { }
24
+interface RequireResolve extends NodeJS.RequireResolve { }
25
+interface NodeModule extends NodeJS.Module { }
26
+
27
+declare var process: NodeJS.Process;
28
+declare var console: Console;
29
+
30
+declare var __filename: string;
31
+declare var __dirname: string;
32
+
33
+declare var require: NodeRequire;
34
+declare var module: NodeModule;
35
+
36
+// Same as module.exports
37
+declare var exports: any;
38
+
39
+/**
40
+ * Only available if `--expose-gc` is passed to the process.
41
+ */
42
+declare var gc: undefined | (() => void);
43
+
44
+//#region borrowed
45
+// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
46
+/** A controller object that allows you to abort one or more DOM requests as and when desired. */
47
+interface AbortController {
48
+    /**
49
+     * Returns the AbortSignal object associated with this object.
50
+     */
51
+
52
+    readonly signal: AbortSignal;
53
+    /**
54
+     * 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.
55
+     */
56
+    abort(): void;
57
+}
58
+
59
+/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
60
+interface AbortSignal extends EventTarget {
61
+    /**
62
+     * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
63
+     */
64
+    readonly aborted: boolean;
65
+}
66
+
67
+declare var AbortController: {
68
+    prototype: AbortController;
69
+    new(): AbortController;
70
+};
71
+
72
+declare var AbortSignal: {
73
+    prototype: AbortSignal;
74
+    new(): AbortSignal;
75
+    // TODO: Add abort() static
76
+    timeout(milliseconds: number): AbortSignal;
77
+};
78
+//#endregion borrowed
79
+
80
+//#region ArrayLike.at()
81
+interface RelativeIndexable<T> {
82
+    /**
83
+     * Takes an integer value and returns the item at that index,
84
+     * allowing for positive and negative integers.
85
+     * Negative integers count back from the last item in the array.
86
+     */
87
+    at(index: number): T | undefined;
88
+}
89
+interface String extends RelativeIndexable<string> {}
90
+interface Array<T> extends RelativeIndexable<T> {}
91
+interface ReadonlyArray<T> extends RelativeIndexable<T> {}
92
+interface Int8Array extends RelativeIndexable<number> {}
93
+interface Uint8Array extends RelativeIndexable<number> {}
94
+interface Uint8ClampedArray extends RelativeIndexable<number> {}
95
+interface Int16Array extends RelativeIndexable<number> {}
96
+interface Uint16Array extends RelativeIndexable<number> {}
97
+interface Int32Array extends RelativeIndexable<number> {}
98
+interface Uint32Array extends RelativeIndexable<number> {}
99
+interface Float32Array extends RelativeIndexable<number> {}
100
+interface Float64Array extends RelativeIndexable<number> {}
101
+interface BigInt64Array extends RelativeIndexable<bigint> {}
102
+interface BigUint64Array extends RelativeIndexable<bigint> {}
103
+//#endregion ArrayLike.at() end
104
+
105
+/**
106
+ * @since v17.0.0
107
+ *
108
+ * Creates a deep clone of an object.
109
+ */
110
+declare function structuredClone<T>(
111
+    value: T,
112
+    transfer?: { transfer: ReadonlyArray<import('worker_threads').TransferListItem> },
113
+): T;
114
+
115
+/*----------------------------------------------*
116
+*                                               *
117
+*               GLOBAL INTERFACES               *
118
+*                                               *
119
+*-----------------------------------------------*/
120
+declare namespace NodeJS {
121
+    interface CallSite {
122
+        /**
123
+         * Value of "this"
124
+         */
125
+        getThis(): unknown;
126
+
127
+        /**
128
+         * Type of "this" as a string.
129
+         * This is the name of the function stored in the constructor field of
130
+         * "this", if available.  Otherwise the object's [[Class]] internal
131
+         * property.
132
+         */
133
+        getTypeName(): string | null;
134
+
135
+        /**
136
+         * Current function
137
+         */
138
+        getFunction(): Function | undefined;
139
+
140
+        /**
141
+         * Name of the current function, typically its name property.
142
+         * If a name property is not available an attempt will be made to try
143
+         * to infer a name from the function's context.
144
+         */
145
+        getFunctionName(): string | null;
146
+
147
+        /**
148
+         * Name of the property [of "this" or one of its prototypes] that holds
149
+         * the current function
150
+         */
151
+        getMethodName(): string | null;
152
+
153
+        /**
154
+         * Name of the script [if this function was defined in a script]
155
+         */
156
+        getFileName(): string | null;
157
+
158
+        /**
159
+         * Current line number [if this function was defined in a script]
160
+         */
161
+        getLineNumber(): number | null;
162
+
163
+        /**
164
+         * Current column number [if this function was defined in a script]
165
+         */
166
+        getColumnNumber(): number | null;
167
+
168
+        /**
169
+         * A call site object representing the location where eval was called
170
+         * [if this function was created using a call to eval]
171
+         */
172
+        getEvalOrigin(): string | undefined;
173
+
174
+        /**
175
+         * Is this a toplevel invocation, that is, is "this" the global object?
176
+         */
177
+        isToplevel(): boolean;
178
+
179
+        /**
180
+         * Does this call take place in code defined by a call to eval?
181
+         */
182
+        isEval(): boolean;
183
+
184
+        /**
185
+         * Is this call in native V8 code?
186
+         */
187
+        isNative(): boolean;
188
+
189
+        /**
190
+         * Is this a constructor call?
191
+         */
192
+        isConstructor(): boolean;
193
+    }
194
+
195
+    interface ErrnoException extends Error {
196
+        errno?: number | undefined;
197
+        code?: string | undefined;
198
+        path?: string | undefined;
199
+        syscall?: string | undefined;
200
+    }
201
+
202
+    interface ReadableStream extends EventEmitter {
203
+        readable: boolean;
204
+        read(size?: number): string | Buffer;
205
+        setEncoding(encoding: BufferEncoding): this;
206
+        pause(): this;
207
+        resume(): this;
208
+        isPaused(): boolean;
209
+        pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
210
+        unpipe(destination?: WritableStream): this;
211
+        unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
212
+        wrap(oldStream: ReadableStream): this;
213
+        [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
214
+    }
215
+
216
+    interface WritableStream extends EventEmitter {
217
+        writable: boolean;
218
+        write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
219
+        write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
220
+        end(cb?: () => void): this;
221
+        end(data: string | Uint8Array, cb?: () => void): this;
222
+        end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
223
+    }
224
+
225
+    interface ReadWriteStream extends ReadableStream, WritableStream { }
226
+
227
+    interface RefCounted {
228
+        ref(): this;
229
+        unref(): this;
230
+    }
231
+
232
+    type TypedArray =
233
+        | Uint8Array
234
+        | Uint8ClampedArray
235
+        | Uint16Array
236
+        | Uint32Array
237
+        | Int8Array
238
+        | Int16Array
239
+        | Int32Array
240
+        | BigUint64Array
241
+        | BigInt64Array
242
+        | Float32Array
243
+        | Float64Array;
244
+    type ArrayBufferView = TypedArray | DataView;
245
+
246
+    interface Require {
247
+        (id: string): any;
248
+        resolve: RequireResolve;
249
+        cache: Dict<NodeModule>;
250
+        /**
251
+         * @deprecated
252
+         */
253
+        extensions: RequireExtensions;
254
+        main: Module | undefined;
255
+    }
256
+
257
+    interface RequireResolve {
258
+        (id: string, options?: { paths?: string[] | undefined; }): string;
259
+        paths(request: string): string[] | null;
260
+    }
261
+
262
+    interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
263
+        '.js': (m: Module, filename: string) => any;
264
+        '.json': (m: Module, filename: string) => any;
265
+        '.node': (m: Module, filename: string) => any;
266
+    }
267
+    interface Module {
268
+        /**
269
+         * `true` if the module is running during the Node.js preload
270
+         */
271
+        isPreloading: boolean;
272
+        exports: any;
273
+        require: Require;
274
+        id: string;
275
+        filename: string;
276
+        loaded: boolean;
277
+        /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
278
+        parent: Module | null | undefined;
279
+        children: Module[];
280
+        /**
281
+         * @since v11.14.0
282
+         *
283
+         * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
284
+         */
285
+        path: string;
286
+        paths: string[];
287
+    }
288
+
289
+    interface Dict<T> {
290
+        [key: string]: T | undefined;
291
+    }
292
+
293
+    interface ReadOnlyDict<T> {
294
+        readonly [key: string]: T | undefined;
295
+    }
296
+}

+ 1
- 0
node_modules/@types/node/globals.global.d.ts 查看文件

@@ -0,0 +1 @@
1
+declare var global: typeof globalThis;

+ 1607
- 0
node_modules/@types/node/http.d.ts
文件差異過大導致無法顯示
查看文件


+ 2134
- 0
node_modules/@types/node/http2.d.ts
文件差異過大導致無法顯示
查看文件


+ 541
- 0
node_modules/@types/node/https.d.ts 查看文件

@@ -0,0 +1,541 @@
1
+/**
2
+ * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
3
+ * separate module.
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/https.js)
5
+ */
6
+declare module 'https' {
7
+    import { Duplex } from 'node:stream';
8
+    import * as tls from 'node:tls';
9
+    import * as http from 'node:http';
10
+    import { URL } from 'node:url';
11
+    type ServerOptions<
12
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
13
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
14
+    > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
15
+    type RequestOptions = http.RequestOptions &
16
+        tls.SecureContextOptions & {
17
+            rejectUnauthorized?: boolean | undefined; // Defaults to true
18
+            servername?: string | undefined; // SNI TLS Extension
19
+        };
20
+    interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
21
+        rejectUnauthorized?: boolean | undefined;
22
+        maxCachedSessions?: number | undefined;
23
+    }
24
+    /**
25
+     * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
26
+     * @since v0.4.5
27
+     */
28
+    class Agent extends http.Agent {
29
+        constructor(options?: AgentOptions);
30
+        options: AgentOptions;
31
+    }
32
+    interface Server<
33
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
34
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
35
+    > extends http.Server<Request, Response> {}
36
+    /**
37
+     * See `http.Server` for more information.
38
+     * @since v0.3.4
39
+     */
40
+    class Server<
41
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
42
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
43
+    > extends tls.Server {
44
+        constructor(requestListener?: http.RequestListener<Request, Response>);
45
+        constructor(
46
+            options: ServerOptions<Request, Response>,
47
+            requestListener?: http.RequestListener<Request, Response>,
48
+        );
49
+        /**
50
+         * Closes all connections connected to this server.
51
+         * @since v18.2.0
52
+         */
53
+        closeAllConnections(): void;
54
+        /**
55
+         * Closes all connections connected to this server which are not sending a request or waiting for a response.
56
+         * @since v18.2.0
57
+         */
58
+        closeIdleConnections(): void;
59
+        addListener(event: string, listener: (...args: any[]) => void): this;
60
+        addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
61
+        addListener(
62
+            event: 'newSession',
63
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
64
+        ): this;
65
+        addListener(
66
+            event: 'OCSPRequest',
67
+            listener: (
68
+                certificate: Buffer,
69
+                issuer: Buffer,
70
+                callback: (err: Error | null, resp: Buffer) => void,
71
+            ) => void,
72
+        ): this;
73
+        addListener(
74
+            event: 'resumeSession',
75
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
76
+        ): this;
77
+        addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
78
+        addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
79
+        addListener(event: 'close', listener: () => void): this;
80
+        addListener(event: 'connection', listener: (socket: Duplex) => void): this;
81
+        addListener(event: 'error', listener: (err: Error) => void): this;
82
+        addListener(event: 'listening', listener: () => void): this;
83
+        addListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
84
+        addListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
85
+        addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
86
+        addListener(
87
+            event: 'connect',
88
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
89
+        ): this;
90
+        addListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
91
+        addListener(
92
+            event: 'upgrade',
93
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
94
+        ): this;
95
+        emit(event: string, ...args: any[]): boolean;
96
+        emit(event: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean;
97
+        emit(
98
+            event: 'newSession',
99
+            sessionId: Buffer,
100
+            sessionData: Buffer,
101
+            callback: (err: Error, resp: Buffer) => void,
102
+        ): boolean;
103
+        emit(
104
+            event: 'OCSPRequest',
105
+            certificate: Buffer,
106
+            issuer: Buffer,
107
+            callback: (err: Error | null, resp: Buffer) => void,
108
+        ): boolean;
109
+        emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
110
+        emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean;
111
+        emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean;
112
+        emit(event: 'close'): boolean;
113
+        emit(event: 'connection', socket: Duplex): boolean;
114
+        emit(event: 'error', err: Error): boolean;
115
+        emit(event: 'listening'): boolean;
116
+        emit(
117
+            event: 'checkContinue',
118
+            req: InstanceType<Request>,
119
+            res: InstanceType<Response> & { req: InstanceType<Request> },
120
+        ): boolean;
121
+        emit(
122
+            event: 'checkExpectation',
123
+            req: InstanceType<Request>,
124
+            res: InstanceType<Response> & { req: InstanceType<Request> },
125
+        ): boolean;
126
+        emit(event: 'clientError', err: Error, socket: Duplex): boolean;
127
+        emit(event: 'connect', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
128
+        emit(
129
+            event: 'request',
130
+            req: InstanceType<Request>,
131
+            res: InstanceType<Response> & { req: InstanceType<Request> },
132
+        ): boolean;
133
+        emit(event: 'upgrade', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
134
+        on(event: string, listener: (...args: any[]) => void): this;
135
+        on(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
136
+        on(
137
+            event: 'newSession',
138
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
139
+        ): this;
140
+        on(
141
+            event: 'OCSPRequest',
142
+            listener: (
143
+                certificate: Buffer,
144
+                issuer: Buffer,
145
+                callback: (err: Error | null, resp: Buffer) => void,
146
+            ) => void,
147
+        ): this;
148
+        on(
149
+            event: 'resumeSession',
150
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
151
+        ): this;
152
+        on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
153
+        on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
154
+        on(event: 'close', listener: () => void): this;
155
+        on(event: 'connection', listener: (socket: Duplex) => void): this;
156
+        on(event: 'error', listener: (err: Error) => void): this;
157
+        on(event: 'listening', listener: () => void): this;
158
+        on(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
159
+        on(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
160
+        on(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
161
+        on(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
162
+        on(event: 'request', listener: http.RequestListener<Request, Response>): this;
163
+        on(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
164
+        once(event: string, listener: (...args: any[]) => void): this;
165
+        once(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
166
+        once(
167
+            event: 'newSession',
168
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
169
+        ): this;
170
+        once(
171
+            event: 'OCSPRequest',
172
+            listener: (
173
+                certificate: Buffer,
174
+                issuer: Buffer,
175
+                callback: (err: Error | null, resp: Buffer) => void,
176
+            ) => void,
177
+        ): this;
178
+        once(
179
+            event: 'resumeSession',
180
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
181
+        ): this;
182
+        once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
183
+        once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
184
+        once(event: 'close', listener: () => void): this;
185
+        once(event: 'connection', listener: (socket: Duplex) => void): this;
186
+        once(event: 'error', listener: (err: Error) => void): this;
187
+        once(event: 'listening', listener: () => void): this;
188
+        once(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
189
+        once(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
190
+        once(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
191
+        once(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
192
+        once(event: 'request', listener: http.RequestListener<Request, Response>): this;
193
+        once(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
194
+        prependListener(event: string, listener: (...args: any[]) => void): this;
195
+        prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
196
+        prependListener(
197
+            event: 'newSession',
198
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
199
+        ): this;
200
+        prependListener(
201
+            event: 'OCSPRequest',
202
+            listener: (
203
+                certificate: Buffer,
204
+                issuer: Buffer,
205
+                callback: (err: Error | null, resp: Buffer) => void,
206
+            ) => void,
207
+        ): this;
208
+        prependListener(
209
+            event: 'resumeSession',
210
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
211
+        ): this;
212
+        prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
213
+        prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
214
+        prependListener(event: 'close', listener: () => void): this;
215
+        prependListener(event: 'connection', listener: (socket: Duplex) => void): this;
216
+        prependListener(event: 'error', listener: (err: Error) => void): this;
217
+        prependListener(event: 'listening', listener: () => void): this;
218
+        prependListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
219
+        prependListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
220
+        prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
221
+        prependListener(
222
+            event: 'connect',
223
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
224
+        ): this;
225
+        prependListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
226
+        prependListener(
227
+            event: 'upgrade',
228
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
229
+        ): this;
230
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
231
+        prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
232
+        prependOnceListener(
233
+            event: 'newSession',
234
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
235
+        ): this;
236
+        prependOnceListener(
237
+            event: 'OCSPRequest',
238
+            listener: (
239
+                certificate: Buffer,
240
+                issuer: Buffer,
241
+                callback: (err: Error | null, resp: Buffer) => void,
242
+            ) => void,
243
+        ): this;
244
+        prependOnceListener(
245
+            event: 'resumeSession',
246
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
247
+        ): this;
248
+        prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
249
+        prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
250
+        prependOnceListener(event: 'close', listener: () => void): this;
251
+        prependOnceListener(event: 'connection', listener: (socket: Duplex) => void): this;
252
+        prependOnceListener(event: 'error', listener: (err: Error) => void): this;
253
+        prependOnceListener(event: 'listening', listener: () => void): this;
254
+        prependOnceListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
255
+        prependOnceListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
256
+        prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
257
+        prependOnceListener(
258
+            event: 'connect',
259
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
260
+        ): this;
261
+        prependOnceListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
262
+        prependOnceListener(
263
+            event: 'upgrade',
264
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
265
+        ): this;
266
+    }
267
+    /**
268
+     * ```js
269
+     * // curl -k https://localhost:8000/
270
+     * const https = require('https');
271
+     * const fs = require('fs');
272
+     *
273
+     * const options = {
274
+     *   key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
275
+     *   cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
276
+     * };
277
+     *
278
+     * https.createServer(options, (req, res) => {
279
+     *   res.writeHead(200);
280
+     *   res.end('hello world\n');
281
+     * }).listen(8000);
282
+     * ```
283
+     *
284
+     * Or
285
+     *
286
+     * ```js
287
+     * const https = require('https');
288
+     * const fs = require('fs');
289
+     *
290
+     * const options = {
291
+     *   pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
292
+     *   passphrase: 'sample'
293
+     * };
294
+     *
295
+     * https.createServer(options, (req, res) => {
296
+     *   res.writeHead(200);
297
+     *   res.end('hello world\n');
298
+     * }).listen(8000);
299
+     * ```
300
+     * @since v0.3.4
301
+     * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`.
302
+     * @param requestListener A listener to be added to the `'request'` event.
303
+     */
304
+    function createServer<
305
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
306
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
307
+    >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
308
+    function createServer<
309
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
310
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
311
+    >(
312
+        options: ServerOptions<Request, Response>,
313
+        requestListener?: http.RequestListener<Request, Response>,
314
+    ): Server<Request, Response>;
315
+    /**
316
+     * Makes a request to a secure web server.
317
+     *
318
+     * The following additional `options` from `tls.connect()` are also accepted:`ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`,`honorCipherOrder`, `key`, `passphrase`,
319
+     * `pfx`, `rejectUnauthorized`,`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`,`highWaterMark`.
320
+     *
321
+     * `options` can be an object, a string, or a `URL` object. If `options` is a
322
+     * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
323
+     *
324
+     * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to
325
+     * upload a file with a POST request, then write to the `ClientRequest` object.
326
+     *
327
+     * ```js
328
+     * const https = require('https');
329
+     *
330
+     * const options = {
331
+     *   hostname: 'encrypted.google.com',
332
+     *   port: 443,
333
+     *   path: '/',
334
+     *   method: 'GET'
335
+     * };
336
+     *
337
+     * const req = https.request(options, (res) => {
338
+     *   console.log('statusCode:', res.statusCode);
339
+     *   console.log('headers:', res.headers);
340
+     *
341
+     *   res.on('data', (d) => {
342
+     *     process.stdout.write(d);
343
+     *   });
344
+     * });
345
+     *
346
+     * req.on('error', (e) => {
347
+     *   console.error(e);
348
+     * });
349
+     * req.end();
350
+     * ```
351
+     *
352
+     * Example using options from `tls.connect()`:
353
+     *
354
+     * ```js
355
+     * const options = {
356
+     *   hostname: 'encrypted.google.com',
357
+     *   port: 443,
358
+     *   path: '/',
359
+     *   method: 'GET',
360
+     *   key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
361
+     *   cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
362
+     * };
363
+     * options.agent = new https.Agent(options);
364
+     *
365
+     * const req = https.request(options, (res) => {
366
+     *   // ...
367
+     * });
368
+     * ```
369
+     *
370
+     * Alternatively, opt out of connection pooling by not using an `Agent`.
371
+     *
372
+     * ```js
373
+     * const options = {
374
+     *   hostname: 'encrypted.google.com',
375
+     *   port: 443,
376
+     *   path: '/',
377
+     *   method: 'GET',
378
+     *   key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
379
+     *   cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
380
+     *   agent: false
381
+     * };
382
+     *
383
+     * const req = https.request(options, (res) => {
384
+     *   // ...
385
+     * });
386
+     * ```
387
+     *
388
+     * Example using a `URL` as `options`:
389
+     *
390
+     * ```js
391
+     * const options = new URL('https://abc:xyz@example.com');
392
+     *
393
+     * const req = https.request(options, (res) => {
394
+     *   // ...
395
+     * });
396
+     * ```
397
+     *
398
+     * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
399
+     *
400
+     * ```js
401
+     * const tls = require('tls');
402
+     * const https = require('https');
403
+     * const crypto = require('crypto');
404
+     *
405
+     * function sha256(s) {
406
+     *   return crypto.createHash('sha256').update(s).digest('base64');
407
+     * }
408
+     * const options = {
409
+     *   hostname: 'github.com',
410
+     *   port: 443,
411
+     *   path: '/',
412
+     *   method: 'GET',
413
+     *   checkServerIdentity: function(host, cert) {
414
+     *     // Make sure the certificate is issued to the host we are connected to
415
+     *     const err = tls.checkServerIdentity(host, cert);
416
+     *     if (err) {
417
+     *       return err;
418
+     *     }
419
+     *
420
+     *     // Pin the public key, similar to HPKP pin-sha25 pinning
421
+     *     const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
422
+     *     if (sha256(cert.pubkey) !== pubkey256) {
423
+     *       const msg = 'Certificate verification error: ' +
424
+     *         `The public key of '${cert.subject.CN}' ` +
425
+     *         'does not match our pinned fingerprint';
426
+     *       return new Error(msg);
427
+     *     }
428
+     *
429
+     *     // Pin the exact certificate, rather than the pub key
430
+     *     const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' +
431
+     *       'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16';
432
+     *     if (cert.fingerprint256 !== cert256) {
433
+     *       const msg = 'Certificate verification error: ' +
434
+     *         `The certificate of '${cert.subject.CN}' ` +
435
+     *         'does not match our pinned fingerprint';
436
+     *       return new Error(msg);
437
+     *     }
438
+     *
439
+     *     // This loop is informational only.
440
+     *     // Print the certificate and public key fingerprints of all certs in the
441
+     *     // chain. Its common to pin the public key of the issuer on the public
442
+     *     // internet, while pinning the public key of the service in sensitive
443
+     *     // environments.
444
+     *     do {
445
+     *       console.log('Subject Common Name:', cert.subject.CN);
446
+     *       console.log('  Certificate SHA256 fingerprint:', cert.fingerprint256);
447
+     *
448
+     *       hash = crypto.createHash('sha256');
449
+     *       console.log('  Public key ping-sha256:', sha256(cert.pubkey));
450
+     *
451
+     *       lastprint256 = cert.fingerprint256;
452
+     *       cert = cert.issuerCertificate;
453
+     *     } while (cert.fingerprint256 !== lastprint256);
454
+     *
455
+     *   },
456
+     * };
457
+     *
458
+     * options.agent = new https.Agent(options);
459
+     * const req = https.request(options, (res) => {
460
+     *   console.log('All OK. Server matched our pinned cert or public key');
461
+     *   console.log('statusCode:', res.statusCode);
462
+     *   // Print the HPKP values
463
+     *   console.log('headers:', res.headers['public-key-pins']);
464
+     *
465
+     *   res.on('data', (d) => {});
466
+     * });
467
+     *
468
+     * req.on('error', (e) => {
469
+     *   console.error(e.message);
470
+     * });
471
+     * req.end();
472
+     * ```
473
+     *
474
+     * Outputs for example:
475
+     *
476
+     * ```text
477
+     * Subject Common Name: github.com
478
+     *   Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16
479
+     *   Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=
480
+     * Subject Common Name: DigiCert SHA2 Extended Validation Server CA
481
+     *   Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A
482
+     *   Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=
483
+     * Subject Common Name: DigiCert High Assurance EV Root CA
484
+     *   Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF
485
+     *   Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18=
486
+     * All OK. Server matched our pinned cert or public key
487
+     * statusCode: 200
488
+     * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=";
489
+     * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4=";
490
+     * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains
491
+     * ```
492
+     * @since v0.3.6
493
+     * @param options Accepts all `options` from `request`, with some differences in default values:
494
+     */
495
+    function request(
496
+        options: RequestOptions | string | URL,
497
+        callback?: (res: http.IncomingMessage) => void,
498
+    ): http.ClientRequest;
499
+    function request(
500
+        url: string | URL,
501
+        options: RequestOptions,
502
+        callback?: (res: http.IncomingMessage) => void,
503
+    ): http.ClientRequest;
504
+    /**
505
+     * Like `http.get()` but for HTTPS.
506
+     *
507
+     * `options` can be an object, a string, or a `URL` object. If `options` is a
508
+     * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
509
+     *
510
+     * ```js
511
+     * const https = require('https');
512
+     *
513
+     * https.get('https://encrypted.google.com/', (res) => {
514
+     *   console.log('statusCode:', res.statusCode);
515
+     *   console.log('headers:', res.headers);
516
+     *
517
+     *   res.on('data', (d) => {
518
+     *     process.stdout.write(d);
519
+     *   });
520
+     *
521
+     * }).on('error', (e) => {
522
+     *   console.error(e);
523
+     * });
524
+     * ```
525
+     * @since v0.3.6
526
+     * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`.
527
+     */
528
+    function get(
529
+        options: RequestOptions | string | URL,
530
+        callback?: (res: http.IncomingMessage) => void,
531
+    ): http.ClientRequest;
532
+    function get(
533
+        url: string | URL,
534
+        options: RequestOptions,
535
+        callback?: (res: http.IncomingMessage) => void,
536
+    ): http.ClientRequest;
537
+    let globalAgent: Agent;
538
+}
539
+declare module 'node:https' {
540
+    export * from 'https';
541
+}

+ 133
- 0
node_modules/@types/node/index.d.ts 查看文件

@@ -0,0 +1,133 @@
1
+// Type definitions for non-npm package Node.js 18.11
2
+// Project: https://nodejs.org/
3
+// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
+//                 DefinitelyTyped <https://github.com/DefinitelyTyped>
5
+//                 Alberto Schiabel <https://github.com/jkomyno>
6
+//                 Alvis HT Tang <https://github.com/alvis>
7
+//                 Andrew Makarov <https://github.com/r3nya>
8
+//                 Benjamin Toueg <https://github.com/btoueg>
9
+//                 Chigozirim C. <https://github.com/smac89>
10
+//                 David Junger <https://github.com/touffy>
11
+//                 Deividas Bakanas <https://github.com/DeividasBakanas>
12
+//                 Eugene Y. Q. Shen <https://github.com/eyqs>
13
+//                 Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>
14
+//                 Huw <https://github.com/hoo29>
15
+//                 Kelvin Jin <https://github.com/kjin>
16
+//                 Klaus Meinhardt <https://github.com/ajafff>
17
+//                 Lishude <https://github.com/islishude>
18
+//                 Mariusz Wiktorczyk <https://github.com/mwiktorczyk>
19
+//                 Mohsen Azimi <https://github.com/mohsen1>
20
+//                 Nicolas Even <https://github.com/n-e>
21
+//                 Nikita Galkin <https://github.com/galkin>
22
+//                 Parambir Singh <https://github.com/parambirs>
23
+//                 Sebastian Silbermann <https://github.com/eps1lon>
24
+//                 Simon Schick <https://github.com/SimonSchick>
25
+//                 Thomas den Hollander <https://github.com/ThomasdenH>
26
+//                 Wilco Bakker <https://github.com/WilcoBakker>
27
+//                 wwwy3y3 <https://github.com/wwwy3y3>
28
+//                 Samuel Ainsworth <https://github.com/samuela>
29
+//                 Kyle Uehlein <https://github.com/kuehlein>
30
+//                 Thanik Bhongbhibhat <https://github.com/bhongy>
31
+//                 Marcin Kopacz <https://github.com/chyzwar>
32
+//                 Trivikram Kamat <https://github.com/trivikr>
33
+//                 Junxiao Shi <https://github.com/yoursunny>
34
+//                 Ilia Baryshnikov <https://github.com/qwelias>
35
+//                 ExE Boss <https://github.com/ExE-Boss>
36
+//                 Piotr Błażejewicz <https://github.com/peterblazejewicz>
37
+//                 Anna Henningsen <https://github.com/addaleax>
38
+//                 Victor Perin <https://github.com/victorperin>
39
+//                 Yongsheng Zhang <https://github.com/ZYSzys>
40
+//                 NodeJS Contributors <https://github.com/NodeJS>
41
+//                 Linus Unnebäck <https://github.com/LinusU>
42
+//                 wafuwafu13 <https://github.com/wafuwafu13>
43
+//                 Matteo Collina <https://github.com/mcollina>
44
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
45
+
46
+/**
47
+ * License for programmatically and manually incorporated
48
+ * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc
49
+ *
50
+ * Copyright Node.js contributors. All rights reserved.
51
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
52
+ * of this software and associated documentation files (the "Software"), to
53
+ * deal in the Software without restriction, including without limitation the
54
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
55
+ * sell copies of the Software, and to permit persons to whom the Software is
56
+ * furnished to do so, subject to the following conditions:
57
+ *
58
+ * The above copyright notice and this permission notice shall be included in
59
+ * all copies or substantial portions of the Software.
60
+ *
61
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
66
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
67
+ * IN THE SOFTWARE.
68
+ */
69
+
70
+// NOTE: These definitions support NodeJS and TypeScript 4.9+.
71
+
72
+// Reference required types from the default lib:
73
+/// <reference lib="es2020" />
74
+/// <reference lib="esnext.asynciterable" />
75
+/// <reference lib="esnext.intl" />
76
+/// <reference lib="esnext.bigint" />
77
+
78
+// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
79
+/// <reference path="assert.d.ts" />
80
+/// <reference path="assert/strict.d.ts" />
81
+/// <reference path="globals.d.ts" />
82
+/// <reference path="async_hooks.d.ts" />
83
+/// <reference path="buffer.d.ts" />
84
+/// <reference path="child_process.d.ts" />
85
+/// <reference path="cluster.d.ts" />
86
+/// <reference path="console.d.ts" />
87
+/// <reference path="constants.d.ts" />
88
+/// <reference path="crypto.d.ts" />
89
+/// <reference path="dgram.d.ts" />
90
+/// <reference path="diagnostics_channel.d.ts" />
91
+/// <reference path="dns.d.ts" />
92
+/// <reference path="dns/promises.d.ts" />
93
+/// <reference path="dns/promises.d.ts" />
94
+/// <reference path="domain.d.ts" />
95
+/// <reference path="dom-events.d.ts" />
96
+/// <reference path="events.d.ts" />
97
+/// <reference path="fs.d.ts" />
98
+/// <reference path="fs/promises.d.ts" />
99
+/// <reference path="http.d.ts" />
100
+/// <reference path="http2.d.ts" />
101
+/// <reference path="https.d.ts" />
102
+/// <reference path="inspector.d.ts" />
103
+/// <reference path="module.d.ts" />
104
+/// <reference path="net.d.ts" />
105
+/// <reference path="os.d.ts" />
106
+/// <reference path="path.d.ts" />
107
+/// <reference path="perf_hooks.d.ts" />
108
+/// <reference path="process.d.ts" />
109
+/// <reference path="punycode.d.ts" />
110
+/// <reference path="querystring.d.ts" />
111
+/// <reference path="readline.d.ts" />
112
+/// <reference path="readline/promises.d.ts" />
113
+/// <reference path="repl.d.ts" />
114
+/// <reference path="stream.d.ts" />
115
+/// <reference path="stream/promises.d.ts" />
116
+/// <reference path="stream/consumers.d.ts" />
117
+/// <reference path="stream/web.d.ts" />
118
+/// <reference path="string_decoder.d.ts" />
119
+/// <reference path="test.d.ts" />
120
+/// <reference path="timers.d.ts" />
121
+/// <reference path="timers/promises.d.ts" />
122
+/// <reference path="tls.d.ts" />
123
+/// <reference path="trace_events.d.ts" />
124
+/// <reference path="tty.d.ts" />
125
+/// <reference path="url.d.ts" />
126
+/// <reference path="util.d.ts" />
127
+/// <reference path="v8.d.ts" />
128
+/// <reference path="vm.d.ts" />
129
+/// <reference path="wasi.d.ts" />
130
+/// <reference path="worker_threads.d.ts" />
131
+/// <reference path="zlib.d.ts" />
132
+
133
+/// <reference path="globals.global.d.ts" />

+ 2741
- 0
node_modules/@types/node/inspector.d.ts
文件差異過大導致無法顯示
查看文件


+ 114
- 0
node_modules/@types/node/module.d.ts 查看文件

@@ -0,0 +1,114 @@
1
+/**
2
+ * @since v0.3.7
3
+ */
4
+declare module 'module' {
5
+    import { URL } from 'node:url';
6
+    namespace Module {
7
+        /**
8
+         * The `module.syncBuiltinESMExports()` method updates all the live bindings for
9
+         * builtin `ES Modules` to match the properties of the `CommonJS` exports. It
10
+         * does not add or remove exported names from the `ES Modules`.
11
+         *
12
+         * ```js
13
+         * const fs = require('fs');
14
+         * const assert = require('assert');
15
+         * const { syncBuiltinESMExports } = require('module');
16
+         *
17
+         * fs.readFile = newAPI;
18
+         *
19
+         * delete fs.readFileSync;
20
+         *
21
+         * function newAPI() {
22
+         *   // ...
23
+         * }
24
+         *
25
+         * fs.newAPI = newAPI;
26
+         *
27
+         * syncBuiltinESMExports();
28
+         *
29
+         * import('fs').then((esmFS) => {
30
+         *   // It syncs the existing readFile property with the new value
31
+         *   assert.strictEqual(esmFS.readFile, newAPI);
32
+         *   // readFileSync has been deleted from the required fs
33
+         *   assert.strictEqual('readFileSync' in fs, false);
34
+         *   // syncBuiltinESMExports() does not remove readFileSync from esmFS
35
+         *   assert.strictEqual('readFileSync' in esmFS, true);
36
+         *   // syncBuiltinESMExports() does not add names
37
+         *   assert.strictEqual(esmFS.newAPI, undefined);
38
+         * });
39
+         * ```
40
+         * @since v12.12.0
41
+         */
42
+        function syncBuiltinESMExports(): void;
43
+        /**
44
+         * `path` is the resolved path for the file for which a corresponding source map
45
+         * should be fetched.
46
+         * @since v13.7.0, v12.17.0
47
+         */
48
+        function findSourceMap(path: string, error?: Error): SourceMap;
49
+        interface SourceMapPayload {
50
+            file: string;
51
+            version: number;
52
+            sources: string[];
53
+            sourcesContent: string[];
54
+            names: string[];
55
+            mappings: string;
56
+            sourceRoot: string;
57
+        }
58
+        interface SourceMapping {
59
+            generatedLine: number;
60
+            generatedColumn: number;
61
+            originalSource: string;
62
+            originalLine: number;
63
+            originalColumn: number;
64
+        }
65
+        /**
66
+         * @since v13.7.0, v12.17.0
67
+         */
68
+        class SourceMap {
69
+            /**
70
+             * Getter for the payload used to construct the `SourceMap` instance.
71
+             */
72
+            readonly payload: SourceMapPayload;
73
+            constructor(payload: SourceMapPayload);
74
+            /**
75
+             * Given a line number and column number in the generated source file, returns
76
+             * an object representing the position in the original file. The object returned
77
+             * consists of the following keys:
78
+             */
79
+            findEntry(line: number, column: number): SourceMapping;
80
+        }
81
+    }
82
+    interface Module extends NodeModule {}
83
+    class Module {
84
+        static runMain(): void;
85
+        static wrap(code: string): string;
86
+        static createRequire(path: string | URL): NodeRequire;
87
+        static builtinModules: string[];
88
+        static Module: typeof Module;
89
+        constructor(id: string, parent?: Module);
90
+    }
91
+    global {
92
+        interface ImportMeta {
93
+            url: string;
94
+            /**
95
+             * @experimental
96
+             * This feature is only available with the `--experimental-import-meta-resolve`
97
+             * command flag enabled.
98
+             *
99
+             * Provides a module-relative resolution function scoped to each module, returning
100
+             * the URL string.
101
+             *
102
+             * @param specified The module specifier to resolve relative to `parent`.
103
+             * @param parent The absolute parent module URL to resolve from. If none
104
+             * is specified, the value of `import.meta.url` is used as the default.
105
+             */
106
+            resolve?(specified: string, parent?: string | URL): Promise<string>;
107
+        }
108
+    }
109
+    export = Module;
110
+}
111
+declare module 'node:module' {
112
+    import module = require('module');
113
+    export = module;
114
+}

+ 869
- 0
node_modules/@types/node/net.d.ts 查看文件

@@ -0,0 +1,869 @@
1
+/**
2
+ * > Stability: 2 - Stable
3
+ *
4
+ * The `net` module provides an asynchronous network API for creating stream-based
5
+ * TCP or `IPC` servers ({@link createServer}) and clients
6
+ * ({@link createConnection}).
7
+ *
8
+ * It can be accessed using:
9
+ *
10
+ * ```js
11
+ * const net = require('net');
12
+ * ```
13
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/net.js)
14
+ */
15
+declare module 'net' {
16
+    import * as stream from 'node:stream';
17
+    import { Abortable, EventEmitter } from 'node:events';
18
+    import * as dns from 'node:dns';
19
+    type LookupFunction = (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
20
+    interface AddressInfo {
21
+        address: string;
22
+        family: string;
23
+        port: number;
24
+    }
25
+    interface SocketConstructorOpts {
26
+        fd?: number | undefined;
27
+        allowHalfOpen?: boolean | undefined;
28
+        readable?: boolean | undefined;
29
+        writable?: boolean | undefined;
30
+        signal?: AbortSignal;
31
+    }
32
+    interface OnReadOpts {
33
+        buffer: Uint8Array | (() => Uint8Array);
34
+        /**
35
+         * This function is called for every chunk of incoming data.
36
+         * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer.
37
+         * Return false from this function to implicitly pause() the socket.
38
+         */
39
+        callback(bytesWritten: number, buf: Uint8Array): boolean;
40
+    }
41
+    interface ConnectOpts {
42
+        /**
43
+         * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket.
44
+         * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will
45
+         * still be emitted as normal and methods like pause() and resume() will also behave as expected.
46
+         */
47
+        onread?: OnReadOpts | undefined;
48
+    }
49
+    interface TcpSocketConnectOpts extends ConnectOpts {
50
+        port: number;
51
+        host?: string | undefined;
52
+        localAddress?: string | undefined;
53
+        localPort?: number | undefined;
54
+        hints?: number | undefined;
55
+        family?: number | undefined;
56
+        lookup?: LookupFunction | undefined;
57
+        noDelay?: boolean | undefined;
58
+        keepAlive?: boolean | undefined;
59
+        keepAliveInitialDelay?: number | undefined;
60
+    }
61
+    interface IpcSocketConnectOpts extends ConnectOpts {
62
+        path: string;
63
+    }
64
+    type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
65
+    type SocketReadyState = 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
66
+    /**
67
+     * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
68
+     * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
69
+     * an `EventEmitter`.
70
+     *
71
+     * A `net.Socket` can be created by the user and used directly to interact with
72
+     * a server. For example, it is returned by {@link createConnection},
73
+     * so the user can use it to talk to the server.
74
+     *
75
+     * It can also be created by Node.js and passed to the user when a connection
76
+     * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use
77
+     * it to interact with the client.
78
+     * @since v0.3.4
79
+     */
80
+    class Socket extends stream.Duplex {
81
+        constructor(options?: SocketConstructorOpts);
82
+        /**
83
+         * Sends data on the socket. The second parameter specifies the encoding in the
84
+         * case of a string. It defaults to UTF8 encoding.
85
+         *
86
+         * Returns `true` if the entire data was flushed successfully to the kernel
87
+         * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free.
88
+         *
89
+         * The optional `callback` parameter will be executed when the data is finally
90
+         * written out, which may not be immediately.
91
+         *
92
+         * See `Writable` stream `write()` method for more
93
+         * information.
94
+         * @since v0.1.90
95
+         * @param [encoding='utf8'] Only used when data is `string`.
96
+         */
97
+        write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
98
+        write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
99
+        /**
100
+         * Initiate a connection on a given socket.
101
+         *
102
+         * Possible signatures:
103
+         *
104
+         * * `socket.connect(options[, connectListener])`
105
+         * * `socket.connect(path[, connectListener])` for `IPC` connections.
106
+         * * `socket.connect(port[, host][, connectListener])` for TCP connections.
107
+         * * Returns: `net.Socket` The socket itself.
108
+         *
109
+         * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting,
110
+         * instead of a `'connect'` event, an `'error'` event will be emitted with
111
+         * the error passed to the `'error'` listener.
112
+         * The last parameter `connectListener`, if supplied, will be added as a listener
113
+         * for the `'connect'` event **once**.
114
+         *
115
+         * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined
116
+         * behavior.
117
+         */
118
+        connect(options: SocketConnectOpts, connectionListener?: () => void): this;
119
+        connect(port: number, host: string, connectionListener?: () => void): this;
120
+        connect(port: number, connectionListener?: () => void): this;
121
+        connect(path: string, connectionListener?: () => void): this;
122
+        /**
123
+         * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information.
124
+         * @since v0.1.90
125
+         * @return The socket itself.
126
+         */
127
+        setEncoding(encoding?: BufferEncoding): this;
128
+        /**
129
+         * Pauses the reading of data. That is, `'data'` events will not be emitted.
130
+         * Useful to throttle back an upload.
131
+         * @return The socket itself.
132
+         */
133
+        pause(): this;
134
+        /**
135
+         * Close the TCP connection by sending an RST packet and destroy the stream.
136
+         * If this TCP socket is in connecting status, it will send an RST packet
137
+         * and destroy this TCP socket once it is connected. Otherwise, it will call
138
+         * `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. If this is not a TCP socket
139
+         * (for example, a pipe), calling this method will immediately throw
140
+         * an `ERR_INVALID_HANDLE_TYPE` Error.
141
+         * @since v18.3.0
142
+         * @return The socket itself.
143
+         */
144
+        resetAndDestroy(): this;
145
+        /**
146
+         * Resumes reading after a call to `socket.pause()`.
147
+         * @return The socket itself.
148
+         */
149
+        resume(): this;
150
+        /**
151
+         * Sets the socket to timeout after `timeout` milliseconds of inactivity on
152
+         * the socket. By default `net.Socket` do not have a timeout.
153
+         *
154
+         * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to
155
+         * end the connection.
156
+         *
157
+         * ```js
158
+         * socket.setTimeout(3000);
159
+         * socket.on('timeout', () => {
160
+         *   console.log('socket timeout');
161
+         *   socket.end();
162
+         * });
163
+         * ```
164
+         *
165
+         * If `timeout` is 0, then the existing idle timeout is disabled.
166
+         *
167
+         * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event.
168
+         * @since v0.1.90
169
+         * @return The socket itself.
170
+         */
171
+        setTimeout(timeout: number, callback?: () => void): this;
172
+        /**
173
+         * Enable/disable the use of Nagle's algorithm.
174
+         *
175
+         * When a TCP connection is created, it will have Nagle's algorithm enabled.
176
+         *
177
+         * Nagle's algorithm delays data before it is sent via the network. It attempts
178
+         * to optimize throughput at the expense of latency.
179
+         *
180
+         * Passing `true` for `noDelay` or not passing an argument will disable Nagle's
181
+         * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's
182
+         * algorithm.
183
+         * @since v0.1.90
184
+         * @param [noDelay=true]
185
+         * @return The socket itself.
186
+         */
187
+        setNoDelay(noDelay?: boolean): this;
188
+        /**
189
+         * Enable/disable keep-alive functionality, and optionally set the initial
190
+         * delay before the first keepalive probe is sent on an idle socket.
191
+         *
192
+         * Set `initialDelay` (in milliseconds) to set the delay between the last
193
+         * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default
194
+         * (or previous) setting.
195
+         *
196
+         * Enabling the keep-alive functionality will set the following socket options:
197
+         *
198
+         * * `SO_KEEPALIVE=1`
199
+         * * `TCP_KEEPIDLE=initialDelay`
200
+         * * `TCP_KEEPCNT=10`
201
+         * * `TCP_KEEPINTVL=1`
202
+         * @since v0.1.92
203
+         * @param [enable=false]
204
+         * @param [initialDelay=0]
205
+         * @return The socket itself.
206
+         */
207
+        setKeepAlive(enable?: boolean, initialDelay?: number): this;
208
+        /**
209
+         * Returns the bound `address`, the address `family` name and `port` of the
210
+         * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
211
+         * @since v0.1.90
212
+         */
213
+        address(): AddressInfo | {};
214
+        /**
215
+         * Calling `unref()` on a socket will allow the program to exit if this is the only
216
+         * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect.
217
+         * @since v0.9.1
218
+         * @return The socket itself.
219
+         */
220
+        unref(): this;
221
+        /**
222
+         * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior).
223
+         * If the socket is `ref`ed calling `ref` again will have no effect.
224
+         * @since v0.9.1
225
+         * @return The socket itself.
226
+         */
227
+        ref(): this;
228
+        /**
229
+         * This property shows the number of characters buffered for writing. The buffer
230
+         * may contain strings whose length after encoding is not yet known. So this number
231
+         * is only an approximation of the number of bytes in the buffer.
232
+         *
233
+         * `net.Socket` has the property that `socket.write()` always works. This is to
234
+         * help users get up and running quickly. The computer cannot always keep up
235
+         * with the amount of data that is written to a socket. The network connection
236
+         * simply might be too slow. Node.js will internally queue up the data written to a
237
+         * socket and send it out over the wire when it is possible.
238
+         *
239
+         * The consequence of this internal buffering is that memory may grow.
240
+         * Users who experience large or growing `bufferSize` should attempt to
241
+         * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`.
242
+         * @since v0.3.8
243
+         * @deprecated Since v14.6.0 - Use `writableLength` instead.
244
+         */
245
+        readonly bufferSize: number;
246
+        /**
247
+         * The amount of received bytes.
248
+         * @since v0.5.3
249
+         */
250
+        readonly bytesRead: number;
251
+        /**
252
+         * The amount of bytes sent.
253
+         * @since v0.5.3
254
+         */
255
+        readonly bytesWritten: number;
256
+        /**
257
+         * If `true`,`socket.connect(options[, connectListener])` was
258
+         * called and has not yet finished. It will stay `true` until the socket becomes
259
+         * connected, then it is set to `false` and the `'connect'` event is emitted. Note
260
+         * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event.
261
+         * @since v6.1.0
262
+         */
263
+        readonly connecting: boolean;
264
+        /**
265
+         * See `writable.destroyed` for further details.
266
+         */
267
+        readonly destroyed: boolean;
268
+        /**
269
+         * The string representation of the local IP address the remote client is
270
+         * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client
271
+         * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`.
272
+         * @since v0.9.6
273
+         */
274
+        readonly localAddress?: string;
275
+        /**
276
+         * The numeric representation of the local port. For example, `80` or `21`.
277
+         * @since v0.9.6
278
+         */
279
+        readonly localPort?: number;
280
+        /**
281
+         * The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
282
+         * @since v18.8.0
283
+         */
284
+        readonly localFamily?: string;
285
+        /**
286
+         * This property represents the state of the connection as a string.
287
+         * @see {https://nodejs.org/api/net.html#socketreadystate}
288
+         * @since v0.5.0
289
+         */
290
+        readonly readyState: SocketReadyState;
291
+        /**
292
+         * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if
293
+         * the socket is destroyed (for example, if the client disconnected).
294
+         * @since v0.5.10
295
+         */
296
+        readonly remoteAddress?: string | undefined;
297
+        /**
298
+         * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`.
299
+         * @since v0.11.14
300
+         */
301
+        readonly remoteFamily?: string | undefined;
302
+        /**
303
+         * The numeric representation of the remote port. For example, `80` or `21`.
304
+         * @since v0.5.10
305
+         */
306
+        readonly remotePort?: number | undefined;
307
+        /**
308
+         * The socket timeout in milliseconds as set by socket.setTimeout(). It is undefined if a timeout has not been set.
309
+         * @since v10.7.0
310
+         */
311
+        readonly timeout?: number | undefined;
312
+        /**
313
+         * Half-closes the socket. i.e., it sends a FIN packet. It is possible the
314
+         * server will still send some data.
315
+         *
316
+         * See `writable.end()` for further details.
317
+         * @since v0.1.90
318
+         * @param [encoding='utf8'] Only used when data is `string`.
319
+         * @param callback Optional callback for when the socket is finished.
320
+         * @return The socket itself.
321
+         */
322
+        end(callback?: () => void): this;
323
+        end(buffer: Uint8Array | string, callback?: () => void): this;
324
+        end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
325
+        /**
326
+         * events.EventEmitter
327
+         *   1. close
328
+         *   2. connect
329
+         *   3. data
330
+         *   4. drain
331
+         *   5. end
332
+         *   6. error
333
+         *   7. lookup
334
+         *   8. ready
335
+         *   9. timeout
336
+         */
337
+        addListener(event: string, listener: (...args: any[]) => void): this;
338
+        addListener(event: 'close', listener: (hadError: boolean) => void): this;
339
+        addListener(event: 'connect', listener: () => void): this;
340
+        addListener(event: 'data', listener: (data: Buffer) => void): this;
341
+        addListener(event: 'drain', listener: () => void): this;
342
+        addListener(event: 'end', listener: () => void): this;
343
+        addListener(event: 'error', listener: (err: Error) => void): this;
344
+        addListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
345
+        addListener(event: 'ready', listener: () => void): this;
346
+        addListener(event: 'timeout', listener: () => void): this;
347
+        emit(event: string | symbol, ...args: any[]): boolean;
348
+        emit(event: 'close', hadError: boolean): boolean;
349
+        emit(event: 'connect'): boolean;
350
+        emit(event: 'data', data: Buffer): boolean;
351
+        emit(event: 'drain'): boolean;
352
+        emit(event: 'end'): boolean;
353
+        emit(event: 'error', err: Error): boolean;
354
+        emit(event: 'lookup', err: Error, address: string, family: string | number, host: string): boolean;
355
+        emit(event: 'ready'): boolean;
356
+        emit(event: 'timeout'): boolean;
357
+        on(event: string, listener: (...args: any[]) => void): this;
358
+        on(event: 'close', listener: (hadError: boolean) => void): this;
359
+        on(event: 'connect', listener: () => void): this;
360
+        on(event: 'data', listener: (data: Buffer) => void): this;
361
+        on(event: 'drain', listener: () => void): this;
362
+        on(event: 'end', listener: () => void): this;
363
+        on(event: 'error', listener: (err: Error) => void): this;
364
+        on(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
365
+        on(event: 'ready', listener: () => void): this;
366
+        on(event: 'timeout', listener: () => void): this;
367
+        once(event: string, listener: (...args: any[]) => void): this;
368
+        once(event: 'close', listener: (hadError: boolean) => void): this;
369
+        once(event: 'connect', listener: () => void): this;
370
+        once(event: 'data', listener: (data: Buffer) => void): this;
371
+        once(event: 'drain', listener: () => void): this;
372
+        once(event: 'end', listener: () => void): this;
373
+        once(event: 'error', listener: (err: Error) => void): this;
374
+        once(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
375
+        once(event: 'ready', listener: () => void): this;
376
+        once(event: 'timeout', listener: () => void): this;
377
+        prependListener(event: string, listener: (...args: any[]) => void): this;
378
+        prependListener(event: 'close', listener: (hadError: boolean) => void): this;
379
+        prependListener(event: 'connect', listener: () => void): this;
380
+        prependListener(event: 'data', listener: (data: Buffer) => void): this;
381
+        prependListener(event: 'drain', listener: () => void): this;
382
+        prependListener(event: 'end', listener: () => void): this;
383
+        prependListener(event: 'error', listener: (err: Error) => void): this;
384
+        prependListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
385
+        prependListener(event: 'ready', listener: () => void): this;
386
+        prependListener(event: 'timeout', listener: () => void): this;
387
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
388
+        prependOnceListener(event: 'close', listener: (hadError: boolean) => void): this;
389
+        prependOnceListener(event: 'connect', listener: () => void): this;
390
+        prependOnceListener(event: 'data', listener: (data: Buffer) => void): this;
391
+        prependOnceListener(event: 'drain', listener: () => void): this;
392
+        prependOnceListener(event: 'end', listener: () => void): this;
393
+        prependOnceListener(event: 'error', listener: (err: Error) => void): this;
394
+        prependOnceListener(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this;
395
+        prependOnceListener(event: 'ready', listener: () => void): this;
396
+        prependOnceListener(event: 'timeout', listener: () => void): this;
397
+    }
398
+    interface ListenOptions extends Abortable {
399
+        port?: number | undefined;
400
+        host?: string | undefined;
401
+        backlog?: number | undefined;
402
+        path?: string | undefined;
403
+        exclusive?: boolean | undefined;
404
+        readableAll?: boolean | undefined;
405
+        writableAll?: boolean | undefined;
406
+        /**
407
+         * @default false
408
+         */
409
+        ipv6Only?: boolean | undefined;
410
+    }
411
+    interface ServerOpts {
412
+        /**
413
+         * Indicates whether half-opened TCP connections are allowed.
414
+         * @default false
415
+         */
416
+        allowHalfOpen?: boolean | undefined;
417
+        /**
418
+         * Indicates whether the socket should be paused on incoming connections.
419
+         * @default false
420
+         */
421
+        pauseOnConnect?: boolean | undefined;
422
+        /**
423
+         * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
424
+         * @default false
425
+         * @since v16.5.0
426
+         */
427
+        noDelay?: boolean | undefined;
428
+        /**
429
+         * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
430
+         * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
431
+         * @default false
432
+         * @since v16.5.0
433
+         */
434
+        keepAlive?: boolean | undefined;
435
+        /**
436
+         * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
437
+         * @default 0
438
+         * @since v16.5.0
439
+         */
440
+        keepAliveInitialDelay?: number | undefined;
441
+    }
442
+    interface DropArgument {
443
+        localAddress?: string;
444
+        localPort?: number;
445
+        localFamily?: string;
446
+        remoteAddress?: string;
447
+        remotePort?: number;
448
+        remoteFamily?: string;
449
+    }
450
+    /**
451
+     * This class is used to create a TCP or `IPC` server.
452
+     * @since v0.1.90
453
+     */
454
+    class Server extends EventEmitter {
455
+        constructor(connectionListener?: (socket: Socket) => void);
456
+        constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
457
+        /**
458
+         * Start a server listening for connections. A `net.Server` can be a TCP or
459
+         * an `IPC` server depending on what it listens to.
460
+         *
461
+         * Possible signatures:
462
+         *
463
+         * * `server.listen(handle[, backlog][, callback])`
464
+         * * `server.listen(options[, callback])`
465
+         * * `server.listen(path[, backlog][, callback])` for `IPC` servers
466
+         * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers
467
+         *
468
+         * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'`
469
+         * event.
470
+         *
471
+         * All `listen()` methods can take a `backlog` parameter to specify the maximum
472
+         * length of the queue of pending connections. The actual length will be determined
473
+         * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn`on Linux. The default value of this parameter is 511 (not 512).
474
+         *
475
+         * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for
476
+         * details).
477
+         *
478
+         * The `server.listen()` method can be called again if and only if there was an
479
+         * error during the first `server.listen()` call or `server.close()` has been
480
+         * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown.
481
+         *
482
+         * One of the most common errors raised when listening is `EADDRINUSE`.
483
+         * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry
484
+         * after a certain amount of time:
485
+         *
486
+         * ```js
487
+         * server.on('error', (e) => {
488
+         *   if (e.code === 'EADDRINUSE') {
489
+         *     console.log('Address in use, retrying...');
490
+         *     setTimeout(() => {
491
+         *       server.close();
492
+         *       server.listen(PORT, HOST);
493
+         *     }, 1000);
494
+         *   }
495
+         * });
496
+         * ```
497
+         */
498
+        listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
499
+        listen(port?: number, hostname?: string, listeningListener?: () => void): this;
500
+        listen(port?: number, backlog?: number, listeningListener?: () => void): this;
501
+        listen(port?: number, listeningListener?: () => void): this;
502
+        listen(path: string, backlog?: number, listeningListener?: () => void): this;
503
+        listen(path: string, listeningListener?: () => void): this;
504
+        listen(options: ListenOptions, listeningListener?: () => void): this;
505
+        listen(handle: any, backlog?: number, listeningListener?: () => void): this;
506
+        listen(handle: any, listeningListener?: () => void): this;
507
+        /**
508
+         * Stops the server from accepting new connections and keeps existing
509
+         * connections. This function is asynchronous, the server is finally closed
510
+         * when all connections are ended and the server emits a `'close'` event.
511
+         * The optional `callback` will be called once the `'close'` event occurs. Unlike
512
+         * that event, it will be called with an `Error` as its only argument if the server
513
+         * was not open when it was closed.
514
+         * @since v0.1.90
515
+         * @param callback Called when the server is closed.
516
+         */
517
+        close(callback?: (err?: Error) => void): this;
518
+        /**
519
+         * Returns the bound `address`, the address `family` name, and `port` of the server
520
+         * as reported by the operating system if listening on an IP socket
521
+         * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.
522
+         *
523
+         * For a server listening on a pipe or Unix domain socket, the name is returned
524
+         * as a string.
525
+         *
526
+         * ```js
527
+         * const server = net.createServer((socket) => {
528
+         *   socket.end('goodbye\n');
529
+         * }).on('error', (err) => {
530
+         *   // Handle errors here.
531
+         *   throw err;
532
+         * });
533
+         *
534
+         * // Grab an arbitrary unused port.
535
+         * server.listen(() => {
536
+         *   console.log('opened server on', server.address());
537
+         * });
538
+         * ```
539
+         *
540
+         * `server.address()` returns `null` before the `'listening'` event has been
541
+         * emitted or after calling `server.close()`.
542
+         * @since v0.1.90
543
+         */
544
+        address(): AddressInfo | string | null;
545
+        /**
546
+         * Asynchronously get the number of concurrent connections on the server. Works
547
+         * when sockets were sent to forks.
548
+         *
549
+         * Callback should take two arguments `err` and `count`.
550
+         * @since v0.9.7
551
+         */
552
+        getConnections(cb: (error: Error | null, count: number) => void): void;
553
+        /**
554
+         * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior).
555
+         * If the server is `ref`ed calling `ref()` again will have no effect.
556
+         * @since v0.9.1
557
+         */
558
+        ref(): this;
559
+        /**
560
+         * Calling `unref()` on a server will allow the program to exit if this is the only
561
+         * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect.
562
+         * @since v0.9.1
563
+         */
564
+        unref(): this;
565
+        /**
566
+         * Set this property to reject connections when the server's connection count gets
567
+         * high.
568
+         *
569
+         * It is not recommended to use this option once a socket has been sent to a child
570
+         * with `child_process.fork()`.
571
+         * @since v0.2.0
572
+         */
573
+        maxConnections: number;
574
+        connections: number;
575
+        /**
576
+         * Indicates whether or not the server is listening for connections.
577
+         * @since v5.7.0
578
+         */
579
+        listening: boolean;
580
+        /**
581
+         * events.EventEmitter
582
+         *   1. close
583
+         *   2. connection
584
+         *   3. error
585
+         *   4. listening
586
+         *   5. drop
587
+         */
588
+        addListener(event: string, listener: (...args: any[]) => void): this;
589
+        addListener(event: 'close', listener: () => void): this;
590
+        addListener(event: 'connection', listener: (socket: Socket) => void): this;
591
+        addListener(event: 'error', listener: (err: Error) => void): this;
592
+        addListener(event: 'listening', listener: () => void): this;
593
+        addListener(event: 'drop', listener: (data?: DropArgument) => void): this;
594
+        emit(event: string | symbol, ...args: any[]): boolean;
595
+        emit(event: 'close'): boolean;
596
+        emit(event: 'connection', socket: Socket): boolean;
597
+        emit(event: 'error', err: Error): boolean;
598
+        emit(event: 'listening'): boolean;
599
+        emit(event: 'drop', data?: DropArgument): boolean;
600
+        on(event: string, listener: (...args: any[]) => void): this;
601
+        on(event: 'close', listener: () => void): this;
602
+        on(event: 'connection', listener: (socket: Socket) => void): this;
603
+        on(event: 'error', listener: (err: Error) => void): this;
604
+        on(event: 'listening', listener: () => void): this;
605
+        on(event: 'drop', listener: (data?: DropArgument) => void): this;
606
+        once(event: string, listener: (...args: any[]) => void): this;
607
+        once(event: 'close', listener: () => void): this;
608
+        once(event: 'connection', listener: (socket: Socket) => void): this;
609
+        once(event: 'error', listener: (err: Error) => void): this;
610
+        once(event: 'listening', listener: () => void): this;
611
+        once(event: 'drop', listener: (data?: DropArgument) => void): this;
612
+        prependListener(event: string, listener: (...args: any[]) => void): this;
613
+        prependListener(event: 'close', listener: () => void): this;
614
+        prependListener(event: 'connection', listener: (socket: Socket) => void): this;
615
+        prependListener(event: 'error', listener: (err: Error) => void): this;
616
+        prependListener(event: 'listening', listener: () => void): this;
617
+        prependListener(event: 'drop', listener: (data?: DropArgument) => void): this;
618
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
619
+        prependOnceListener(event: 'close', listener: () => void): this;
620
+        prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
621
+        prependOnceListener(event: 'error', listener: (err: Error) => void): this;
622
+        prependOnceListener(event: 'listening', listener: () => void): this;
623
+        prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
624
+    }
625
+    type IPVersion = 'ipv4' | 'ipv6';
626
+    /**
627
+     * The `BlockList` object can be used with some network APIs to specify rules for
628
+     * disabling inbound or outbound access to specific IP addresses, IP ranges, or
629
+     * IP subnets.
630
+     * @since v15.0.0, v14.18.0
631
+     */
632
+    class BlockList {
633
+        /**
634
+         * Adds a rule to block the given IP address.
635
+         * @since v15.0.0, v14.18.0
636
+         * @param address An IPv4 or IPv6 address.
637
+         * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
638
+         */
639
+        addAddress(address: string, type?: IPVersion): void;
640
+        addAddress(address: SocketAddress): void;
641
+        /**
642
+         * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
643
+         * @since v15.0.0, v14.18.0
644
+         * @param start The starting IPv4 or IPv6 address in the range.
645
+         * @param end The ending IPv4 or IPv6 address in the range.
646
+         * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
647
+         */
648
+        addRange(start: string, end: string, type?: IPVersion): void;
649
+        addRange(start: SocketAddress, end: SocketAddress): void;
650
+        /**
651
+         * Adds a rule to block a range of IP addresses specified as a subnet mask.
652
+         * @since v15.0.0, v14.18.0
653
+         * @param net The network IPv4 or IPv6 address.
654
+         * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`.
655
+         * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
656
+         */
657
+        addSubnet(net: SocketAddress, prefix: number): void;
658
+        addSubnet(net: string, prefix: number, type?: IPVersion): void;
659
+        /**
660
+         * Returns `true` if the given IP address matches any of the rules added to the`BlockList`.
661
+         *
662
+         * ```js
663
+         * const blockList = new net.BlockList();
664
+         * blockList.addAddress('123.123.123.123');
665
+         * blockList.addRange('10.0.0.1', '10.0.0.10');
666
+         * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6');
667
+         *
668
+         * console.log(blockList.check('123.123.123.123'));  // Prints: true
669
+         * console.log(blockList.check('10.0.0.3'));  // Prints: true
670
+         * console.log(blockList.check('222.111.111.222'));  // Prints: false
671
+         *
672
+         * // IPv6 notation for IPv4 addresses works:
673
+         * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true
674
+         * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true
675
+         * ```
676
+         * @since v15.0.0, v14.18.0
677
+         * @param address The IP address to check
678
+         * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
679
+         */
680
+        check(address: SocketAddress): boolean;
681
+        check(address: string, type?: IPVersion): boolean;
682
+    }
683
+    interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
684
+        timeout?: number | undefined;
685
+    }
686
+    interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts {
687
+        timeout?: number | undefined;
688
+    }
689
+    type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts;
690
+    /**
691
+     * Creates a new TCP or `IPC` server.
692
+     *
693
+     * If `allowHalfOpen` is set to `true`, when the other end of the socket
694
+     * signals the end of transmission, the server will only send back the end of
695
+     * transmission when `socket.end()` is explicitly called. For example, in the
696
+     * context of TCP, when a FIN packed is received, a FIN packed is sent
697
+     * back only when `socket.end()` is explicitly called. Until then the
698
+     * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information.
699
+     *
700
+     * If `pauseOnConnect` is set to `true`, then the socket associated with each
701
+     * incoming connection will be paused, and no data will be read from its handle.
702
+     * This allows connections to be passed between processes without any data being
703
+     * read by the original process. To begin reading data from a paused socket, call `socket.resume()`.
704
+     *
705
+     * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
706
+     *
707
+     * Here is an example of a TCP echo server which listens for connections
708
+     * on port 8124:
709
+     *
710
+     * ```js
711
+     * const net = require('net');
712
+     * const server = net.createServer((c) => {
713
+     *   // 'connection' listener.
714
+     *   console.log('client connected');
715
+     *   c.on('end', () => {
716
+     *     console.log('client disconnected');
717
+     *   });
718
+     *   c.write('hello\r\n');
719
+     *   c.pipe(c);
720
+     * });
721
+     * server.on('error', (err) => {
722
+     *   throw err;
723
+     * });
724
+     * server.listen(8124, () => {
725
+     *   console.log('server bound');
726
+     * });
727
+     * ```
728
+     *
729
+     * Test this by using `telnet`:
730
+     *
731
+     * ```console
732
+     * $ telnet localhost 8124
733
+     * ```
734
+     *
735
+     * To listen on the socket `/tmp/echo.sock`:
736
+     *
737
+     * ```js
738
+     * server.listen('/tmp/echo.sock', () => {
739
+     *   console.log('server bound');
740
+     * });
741
+     * ```
742
+     *
743
+     * Use `nc` to connect to a Unix domain socket server:
744
+     *
745
+     * ```console
746
+     * $ nc -U /tmp/echo.sock
747
+     * ```
748
+     * @since v0.5.0
749
+     * @param connectionListener Automatically set as a listener for the {@link 'connection'} event.
750
+     */
751
+    function createServer(connectionListener?: (socket: Socket) => void): Server;
752
+    function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server;
753
+    /**
754
+     * Aliases to {@link createConnection}.
755
+     *
756
+     * Possible signatures:
757
+     *
758
+     * * {@link connect}
759
+     * * {@link connect} for `IPC` connections.
760
+     * * {@link connect} for TCP connections.
761
+     */
762
+    function connect(options: NetConnectOpts, connectionListener?: () => void): Socket;
763
+    function connect(port: number, host?: string, connectionListener?: () => void): Socket;
764
+    function connect(path: string, connectionListener?: () => void): Socket;
765
+    /**
766
+     * A factory function, which creates a new {@link Socket},
767
+     * immediately initiates connection with `socket.connect()`,
768
+     * then returns the `net.Socket` that starts the connection.
769
+     *
770
+     * When the connection is established, a `'connect'` event will be emitted
771
+     * on the returned socket. The last parameter `connectListener`, if supplied,
772
+     * will be added as a listener for the `'connect'` event **once**.
773
+     *
774
+     * Possible signatures:
775
+     *
776
+     * * {@link createConnection}
777
+     * * {@link createConnection} for `IPC` connections.
778
+     * * {@link createConnection} for TCP connections.
779
+     *
780
+     * The {@link connect} function is an alias to this function.
781
+     */
782
+    function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
783
+    function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
784
+    function createConnection(path: string, connectionListener?: () => void): Socket;
785
+    /**
786
+     * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
787
+     * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
788
+     *
789
+     * ```js
790
+     * net.isIP('::1'); // returns 6
791
+     * net.isIP('127.0.0.1'); // returns 4
792
+     * net.isIP('127.000.000.001'); // returns 0
793
+     * net.isIP('127.0.0.1/24'); // returns 0
794
+     * net.isIP('fhqwhgads'); // returns 0
795
+     * ```
796
+     * @since v0.3.0
797
+     */
798
+    function isIP(input: string): number;
799
+    /**
800
+     * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no
801
+     * leading zeroes. Otherwise, returns `false`.
802
+     *
803
+     * ```js
804
+     * net.isIPv4('127.0.0.1'); // returns true
805
+     * net.isIPv4('127.000.000.001'); // returns false
806
+     * net.isIPv4('127.0.0.1/24'); // returns false
807
+     * net.isIPv4('fhqwhgads'); // returns false
808
+     * ```
809
+     * @since v0.3.0
810
+     */
811
+    function isIPv4(input: string): boolean;
812
+    /**
813
+     * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
814
+     *
815
+     * ```js
816
+     * net.isIPv6('::1'); // returns true
817
+     * net.isIPv6('fhqwhgads'); // returns false
818
+     * ```
819
+     * @since v0.3.0
820
+     */
821
+    function isIPv6(input: string): boolean;
822
+    interface SocketAddressInitOptions {
823
+        /**
824
+         * The network address as either an IPv4 or IPv6 string.
825
+         * @default 127.0.0.1
826
+         */
827
+        address?: string | undefined;
828
+        /**
829
+         * @default `'ipv4'`
830
+         */
831
+        family?: IPVersion | undefined;
832
+        /**
833
+         * An IPv6 flow-label used only if `family` is `'ipv6'`.
834
+         * @default 0
835
+         */
836
+        flowlabel?: number | undefined;
837
+        /**
838
+         * An IP port.
839
+         * @default 0
840
+         */
841
+        port?: number | undefined;
842
+    }
843
+    /**
844
+     * @since v15.14.0, v14.18.0
845
+     */
846
+    class SocketAddress {
847
+        constructor(options: SocketAddressInitOptions);
848
+        /**
849
+         * @since v15.14.0, v14.18.0
850
+         */
851
+        readonly address: string;
852
+        /**
853
+         * Either \`'ipv4'\` or \`'ipv6'\`.
854
+         * @since v15.14.0, v14.18.0
855
+         */
856
+        readonly family: IPVersion;
857
+        /**
858
+         * @since v15.14.0, v14.18.0
859
+         */
860
+        readonly port: number;
861
+        /**
862
+         * @since v15.14.0, v14.18.0
863
+         */
864
+        readonly flowlabel: number;
865
+    }
866
+}
867
+declare module 'node:net' {
868
+    export * from 'net';
869
+}

+ 466
- 0
node_modules/@types/node/os.d.ts 查看文件

@@ -0,0 +1,466 @@
1
+/**
2
+ * The `os` module provides operating system-related utility methods and
3
+ * properties. It can be accessed using:
4
+ *
5
+ * ```js
6
+ * const os = require('os');
7
+ * ```
8
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/os.js)
9
+ */
10
+declare module 'os' {
11
+    interface CpuInfo {
12
+        model: string;
13
+        speed: number;
14
+        times: {
15
+            user: number;
16
+            nice: number;
17
+            sys: number;
18
+            idle: number;
19
+            irq: number;
20
+        };
21
+    }
22
+    interface NetworkInterfaceBase {
23
+        address: string;
24
+        netmask: string;
25
+        mac: string;
26
+        internal: boolean;
27
+        cidr: string | null;
28
+    }
29
+    interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
30
+        family: 'IPv4';
31
+        scopeid?: undefined;
32
+    }
33
+    interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
34
+        family: 'IPv6';
35
+        scopeid: number;
36
+    }
37
+    interface UserInfo<T> {
38
+        username: T;
39
+        uid: number;
40
+        gid: number;
41
+        shell: T;
42
+        homedir: T;
43
+    }
44
+    type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6;
45
+    /**
46
+     * Returns the host name of the operating system as a string.
47
+     * @since v0.3.3
48
+     */
49
+    function hostname(): string;
50
+    /**
51
+     * Returns an array containing the 1, 5, and 15 minute load averages.
52
+     *
53
+     * The load average is a measure of system activity calculated by the operating
54
+     * system and expressed as a fractional number.
55
+     *
56
+     * The load average is a Unix-specific concept. On Windows, the return value is
57
+     * always `[0, 0, 0]`.
58
+     * @since v0.3.3
59
+     */
60
+    function loadavg(): number[];
61
+    /**
62
+     * Returns the system uptime in number of seconds.
63
+     * @since v0.3.3
64
+     */
65
+    function uptime(): number;
66
+    /**
67
+     * Returns the amount of free system memory in bytes as an integer.
68
+     * @since v0.3.3
69
+     */
70
+    function freemem(): number;
71
+    /**
72
+     * Returns the total amount of system memory in bytes as an integer.
73
+     * @since v0.3.3
74
+     */
75
+    function totalmem(): number;
76
+    /**
77
+     * Returns an array of objects containing information about each logical CPU core.
78
+     *
79
+     * The properties included on each object include:
80
+     *
81
+     * ```js
82
+     * [
83
+     *   {
84
+     *     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
85
+     *     speed: 2926,
86
+     *     times: {
87
+     *       user: 252020,
88
+     *       nice: 0,
89
+     *       sys: 30340,
90
+     *       idle: 1070356870,
91
+     *       irq: 0
92
+     *     }
93
+     *   },
94
+     *   {
95
+     *     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
96
+     *     speed: 2926,
97
+     *     times: {
98
+     *       user: 306960,
99
+     *       nice: 0,
100
+     *       sys: 26980,
101
+     *       idle: 1071569080,
102
+     *       irq: 0
103
+     *     }
104
+     *   },
105
+     *   {
106
+     *     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
107
+     *     speed: 2926,
108
+     *     times: {
109
+     *       user: 248450,
110
+     *       nice: 0,
111
+     *       sys: 21750,
112
+     *       idle: 1070919370,
113
+     *       irq: 0
114
+     *     }
115
+     *   },
116
+     *   {
117
+     *     model: 'Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz',
118
+     *     speed: 2926,
119
+     *     times: {
120
+     *       user: 256880,
121
+     *       nice: 0,
122
+     *       sys: 19430,
123
+     *       idle: 1070905480,
124
+     *       irq: 20
125
+     *     }
126
+     *   },
127
+     * ]
128
+     * ```
129
+     *
130
+     * `nice` values are POSIX-only. On Windows, the `nice` values of all processors
131
+     * are always 0.
132
+     * @since v0.3.3
133
+     */
134
+    function cpus(): CpuInfo[];
135
+    /**
136
+     * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it
137
+     * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows.
138
+     *
139
+     * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information
140
+     * about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems.
141
+     * @since v0.3.3
142
+     */
143
+    function type(): string;
144
+    /**
145
+     * Returns the operating system as a string.
146
+     *
147
+     * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See
148
+     * [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
149
+     * @since v0.3.3
150
+     */
151
+    function release(): string;
152
+    /**
153
+     * Returns an object containing network interfaces that have been assigned a
154
+     * network address.
155
+     *
156
+     * Each key on the returned object identifies a network interface. The associated
157
+     * value is an array of objects that each describe an assigned network address.
158
+     *
159
+     * The properties available on the assigned network address object include:
160
+     *
161
+     * ```js
162
+     * {
163
+     *   lo: [
164
+     *     {
165
+     *       address: '127.0.0.1',
166
+     *       netmask: '255.0.0.0',
167
+     *       family: 'IPv4',
168
+     *       mac: '00:00:00:00:00:00',
169
+     *       internal: true,
170
+     *       cidr: '127.0.0.1/8'
171
+     *     },
172
+     *     {
173
+     *       address: '::1',
174
+     *       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
175
+     *       family: 'IPv6',
176
+     *       mac: '00:00:00:00:00:00',
177
+     *       scopeid: 0,
178
+     *       internal: true,
179
+     *       cidr: '::1/128'
180
+     *     }
181
+     *   ],
182
+     *   eth0: [
183
+     *     {
184
+     *       address: '192.168.1.108',
185
+     *       netmask: '255.255.255.0',
186
+     *       family: 'IPv4',
187
+     *       mac: '01:02:03:0a:0b:0c',
188
+     *       internal: false,
189
+     *       cidr: '192.168.1.108/24'
190
+     *     },
191
+     *     {
192
+     *       address: 'fe80::a00:27ff:fe4e:66a1',
193
+     *       netmask: 'ffff:ffff:ffff:ffff::',
194
+     *       family: 'IPv6',
195
+     *       mac: '01:02:03:0a:0b:0c',
196
+     *       scopeid: 1,
197
+     *       internal: false,
198
+     *       cidr: 'fe80::a00:27ff:fe4e:66a1/64'
199
+     *     }
200
+     *   ]
201
+     * }
202
+     * ```
203
+     * @since v0.6.0
204
+     */
205
+    function networkInterfaces(): NodeJS.Dict<NetworkInterfaceInfo[]>;
206
+    /**
207
+     * Returns the string path of the current user's home directory.
208
+     *
209
+     * On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it
210
+     * uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory.
211
+     *
212
+     * On Windows, it uses the `USERPROFILE` environment variable if defined.
213
+     * Otherwise it uses the path to the profile directory of the current user.
214
+     * @since v2.3.0
215
+     */
216
+    function homedir(): string;
217
+    /**
218
+     * Returns information about the currently effective user. On POSIX platforms,
219
+     * this is typically a subset of the password file. The returned object includes
220
+     * the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and`gid` fields are `-1`, and `shell` is `null`.
221
+     *
222
+     * The value of `homedir` returned by `os.userInfo()` is provided by the operating
223
+     * system. This differs from the result of `os.homedir()`, which queries
224
+     * environment variables for the home directory before falling back to the
225
+     * operating system response.
226
+     *
227
+     * Throws a `SystemError` if a user has no `username` or `homedir`.
228
+     * @since v6.0.0
229
+     */
230
+    function userInfo(options: { encoding: 'buffer' }): UserInfo<Buffer>;
231
+    function userInfo(options?: { encoding: BufferEncoding }): UserInfo<string>;
232
+    type SignalConstants = {
233
+        [key in NodeJS.Signals]: number;
234
+    };
235
+    namespace constants {
236
+        const UV_UDP_REUSEADDR: number;
237
+        namespace signals {}
238
+        const signals: SignalConstants;
239
+        namespace errno {
240
+            const E2BIG: number;
241
+            const EACCES: number;
242
+            const EADDRINUSE: number;
243
+            const EADDRNOTAVAIL: number;
244
+            const EAFNOSUPPORT: number;
245
+            const EAGAIN: number;
246
+            const EALREADY: number;
247
+            const EBADF: number;
248
+            const EBADMSG: number;
249
+            const EBUSY: number;
250
+            const ECANCELED: number;
251
+            const ECHILD: number;
252
+            const ECONNABORTED: number;
253
+            const ECONNREFUSED: number;
254
+            const ECONNRESET: number;
255
+            const EDEADLK: number;
256
+            const EDESTADDRREQ: number;
257
+            const EDOM: number;
258
+            const EDQUOT: number;
259
+            const EEXIST: number;
260
+            const EFAULT: number;
261
+            const EFBIG: number;
262
+            const EHOSTUNREACH: number;
263
+            const EIDRM: number;
264
+            const EILSEQ: number;
265
+            const EINPROGRESS: number;
266
+            const EINTR: number;
267
+            const EINVAL: number;
268
+            const EIO: number;
269
+            const EISCONN: number;
270
+            const EISDIR: number;
271
+            const ELOOP: number;
272
+            const EMFILE: number;
273
+            const EMLINK: number;
274
+            const EMSGSIZE: number;
275
+            const EMULTIHOP: number;
276
+            const ENAMETOOLONG: number;
277
+            const ENETDOWN: number;
278
+            const ENETRESET: number;
279
+            const ENETUNREACH: number;
280
+            const ENFILE: number;
281
+            const ENOBUFS: number;
282
+            const ENODATA: number;
283
+            const ENODEV: number;
284
+            const ENOENT: number;
285
+            const ENOEXEC: number;
286
+            const ENOLCK: number;
287
+            const ENOLINK: number;
288
+            const ENOMEM: number;
289
+            const ENOMSG: number;
290
+            const ENOPROTOOPT: number;
291
+            const ENOSPC: number;
292
+            const ENOSR: number;
293
+            const ENOSTR: number;
294
+            const ENOSYS: number;
295
+            const ENOTCONN: number;
296
+            const ENOTDIR: number;
297
+            const ENOTEMPTY: number;
298
+            const ENOTSOCK: number;
299
+            const ENOTSUP: number;
300
+            const ENOTTY: number;
301
+            const ENXIO: number;
302
+            const EOPNOTSUPP: number;
303
+            const EOVERFLOW: number;
304
+            const EPERM: number;
305
+            const EPIPE: number;
306
+            const EPROTO: number;
307
+            const EPROTONOSUPPORT: number;
308
+            const EPROTOTYPE: number;
309
+            const ERANGE: number;
310
+            const EROFS: number;
311
+            const ESPIPE: number;
312
+            const ESRCH: number;
313
+            const ESTALE: number;
314
+            const ETIME: number;
315
+            const ETIMEDOUT: number;
316
+            const ETXTBSY: number;
317
+            const EWOULDBLOCK: number;
318
+            const EXDEV: number;
319
+            const WSAEINTR: number;
320
+            const WSAEBADF: number;
321
+            const WSAEACCES: number;
322
+            const WSAEFAULT: number;
323
+            const WSAEINVAL: number;
324
+            const WSAEMFILE: number;
325
+            const WSAEWOULDBLOCK: number;
326
+            const WSAEINPROGRESS: number;
327
+            const WSAEALREADY: number;
328
+            const WSAENOTSOCK: number;
329
+            const WSAEDESTADDRREQ: number;
330
+            const WSAEMSGSIZE: number;
331
+            const WSAEPROTOTYPE: number;
332
+            const WSAENOPROTOOPT: number;
333
+            const WSAEPROTONOSUPPORT: number;
334
+            const WSAESOCKTNOSUPPORT: number;
335
+            const WSAEOPNOTSUPP: number;
336
+            const WSAEPFNOSUPPORT: number;
337
+            const WSAEAFNOSUPPORT: number;
338
+            const WSAEADDRINUSE: number;
339
+            const WSAEADDRNOTAVAIL: number;
340
+            const WSAENETDOWN: number;
341
+            const WSAENETUNREACH: number;
342
+            const WSAENETRESET: number;
343
+            const WSAECONNABORTED: number;
344
+            const WSAECONNRESET: number;
345
+            const WSAENOBUFS: number;
346
+            const WSAEISCONN: number;
347
+            const WSAENOTCONN: number;
348
+            const WSAESHUTDOWN: number;
349
+            const WSAETOOMANYREFS: number;
350
+            const WSAETIMEDOUT: number;
351
+            const WSAECONNREFUSED: number;
352
+            const WSAELOOP: number;
353
+            const WSAENAMETOOLONG: number;
354
+            const WSAEHOSTDOWN: number;
355
+            const WSAEHOSTUNREACH: number;
356
+            const WSAENOTEMPTY: number;
357
+            const WSAEPROCLIM: number;
358
+            const WSAEUSERS: number;
359
+            const WSAEDQUOT: number;
360
+            const WSAESTALE: number;
361
+            const WSAEREMOTE: number;
362
+            const WSASYSNOTREADY: number;
363
+            const WSAVERNOTSUPPORTED: number;
364
+            const WSANOTINITIALISED: number;
365
+            const WSAEDISCON: number;
366
+            const WSAENOMORE: number;
367
+            const WSAECANCELLED: number;
368
+            const WSAEINVALIDPROCTABLE: number;
369
+            const WSAEINVALIDPROVIDER: number;
370
+            const WSAEPROVIDERFAILEDINIT: number;
371
+            const WSASYSCALLFAILURE: number;
372
+            const WSASERVICE_NOT_FOUND: number;
373
+            const WSATYPE_NOT_FOUND: number;
374
+            const WSA_E_NO_MORE: number;
375
+            const WSA_E_CANCELLED: number;
376
+            const WSAEREFUSED: number;
377
+        }
378
+        namespace priority {
379
+            const PRIORITY_LOW: number;
380
+            const PRIORITY_BELOW_NORMAL: number;
381
+            const PRIORITY_NORMAL: number;
382
+            const PRIORITY_ABOVE_NORMAL: number;
383
+            const PRIORITY_HIGH: number;
384
+            const PRIORITY_HIGHEST: number;
385
+        }
386
+    }
387
+    const devNull: string;
388
+    const EOL: string;
389
+    /**
390
+     * Returns the operating system CPU architecture for which the Node.js binary was
391
+     * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
392
+     *
393
+     * The return value is equivalent to `process.arch`.
394
+     * @since v0.5.0
395
+     */
396
+    function arch(): string;
397
+    /**
398
+     * Returns a string identifying the kernel version.
399
+     *
400
+     * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not
401
+     * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
402
+     * @since v13.11.0, v12.17.0
403
+     */
404
+    function version(): string;
405
+    /**
406
+     * Returns a string identifying the operating system platform for which
407
+     * the Node.js binary was compiled. The value is set at compile time.
408
+     * Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`.
409
+     *
410
+     * The return value is equivalent to `process.platform`.
411
+     *
412
+     * The value `'android'` may also be returned if Node.js is built on the Android
413
+     * operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os).
414
+     * @since v0.5.0
415
+     */
416
+    function platform(): NodeJS.Platform;
417
+    /**
418
+     * Returns the machine type as a string, such as arm, aarch64, mips, mips64, ppc64, ppc64le, s390, s390x, i386, i686, x86_64.
419
+     *
420
+     * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname).
421
+     * On Windows, `RtlGetVersion()` is used, and if it is not available, `GetVersionExW()` will be used.
422
+     * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
423
+     * @since v18.9.0
424
+     */
425
+    function machine(): string;
426
+    /**
427
+     * Returns the operating system's default directory for temporary files as a
428
+     * string.
429
+     * @since v0.9.9
430
+     */
431
+    function tmpdir(): string;
432
+    /**
433
+     * Returns a string identifying the endianness of the CPU for which the Node.js
434
+     * binary was compiled.
435
+     *
436
+     * Possible values are `'BE'` for big endian and `'LE'` for little endian.
437
+     * @since v0.9.4
438
+     */
439
+    function endianness(): 'BE' | 'LE';
440
+    /**
441
+     * Returns the scheduling priority for the process specified by `pid`. If `pid` is
442
+     * not provided or is `0`, the priority of the current process is returned.
443
+     * @since v10.10.0
444
+     * @param [pid=0] The process ID to retrieve scheduling priority for.
445
+     */
446
+    function getPriority(pid?: number): number;
447
+    /**
448
+     * Attempts to set the scheduling priority for the process specified by `pid`. If`pid` is not provided or is `0`, the process ID of the current process is used.
449
+     *
450
+     * The `priority` input must be an integer between `-20` (high priority) and `19`(low priority). Due to differences between Unix priority levels and Windows
451
+     * priority classes, `priority` is mapped to one of six priority constants in`os.constants.priority`. When retrieving a process priority level, this range
452
+     * mapping may cause the return value to be slightly different on Windows. To avoid
453
+     * confusion, set `priority` to one of the priority constants.
454
+     *
455
+     * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user
456
+     * privileges. Otherwise the set priority will be silently reduced to`PRIORITY_HIGH`.
457
+     * @since v10.10.0
458
+     * @param [pid=0] The process ID to set scheduling priority for.
459
+     * @param priority The scheduling priority to assign to the process.
460
+     */
461
+    function setPriority(priority: number): void;
462
+    function setPriority(pid: number, priority: number): void;
463
+}
464
+declare module 'node:os' {
465
+    export * from 'os';
466
+}

+ 232
- 0
node_modules/@types/node/package.json 查看文件

@@ -0,0 +1,232 @@
1
+{
2
+    "name": "@types/node",
3
+    "version": "18.11.0",
4
+    "description": "TypeScript definitions for Node.js",
5
+    "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
+    "license": "MIT",
7
+    "contributors": [
8
+        {
9
+            "name": "Microsoft TypeScript",
10
+            "url": "https://github.com/Microsoft",
11
+            "githubUsername": "Microsoft"
12
+        },
13
+        {
14
+            "name": "DefinitelyTyped",
15
+            "url": "https://github.com/DefinitelyTyped",
16
+            "githubUsername": "DefinitelyTyped"
17
+        },
18
+        {
19
+            "name": "Alberto Schiabel",
20
+            "url": "https://github.com/jkomyno",
21
+            "githubUsername": "jkomyno"
22
+        },
23
+        {
24
+            "name": "Alvis HT Tang",
25
+            "url": "https://github.com/alvis",
26
+            "githubUsername": "alvis"
27
+        },
28
+        {
29
+            "name": "Andrew Makarov",
30
+            "url": "https://github.com/r3nya",
31
+            "githubUsername": "r3nya"
32
+        },
33
+        {
34
+            "name": "Benjamin Toueg",
35
+            "url": "https://github.com/btoueg",
36
+            "githubUsername": "btoueg"
37
+        },
38
+        {
39
+            "name": "Chigozirim C.",
40
+            "url": "https://github.com/smac89",
41
+            "githubUsername": "smac89"
42
+        },
43
+        {
44
+            "name": "David Junger",
45
+            "url": "https://github.com/touffy",
46
+            "githubUsername": "touffy"
47
+        },
48
+        {
49
+            "name": "Deividas Bakanas",
50
+            "url": "https://github.com/DeividasBakanas",
51
+            "githubUsername": "DeividasBakanas"
52
+        },
53
+        {
54
+            "name": "Eugene Y. Q. Shen",
55
+            "url": "https://github.com/eyqs",
56
+            "githubUsername": "eyqs"
57
+        },
58
+        {
59
+            "name": "Hannes Magnusson",
60
+            "url": "https://github.com/Hannes-Magnusson-CK",
61
+            "githubUsername": "Hannes-Magnusson-CK"
62
+        },
63
+        {
64
+            "name": "Huw",
65
+            "url": "https://github.com/hoo29",
66
+            "githubUsername": "hoo29"
67
+        },
68
+        {
69
+            "name": "Kelvin Jin",
70
+            "url": "https://github.com/kjin",
71
+            "githubUsername": "kjin"
72
+        },
73
+        {
74
+            "name": "Klaus Meinhardt",
75
+            "url": "https://github.com/ajafff",
76
+            "githubUsername": "ajafff"
77
+        },
78
+        {
79
+            "name": "Lishude",
80
+            "url": "https://github.com/islishude",
81
+            "githubUsername": "islishude"
82
+        },
83
+        {
84
+            "name": "Mariusz Wiktorczyk",
85
+            "url": "https://github.com/mwiktorczyk",
86
+            "githubUsername": "mwiktorczyk"
87
+        },
88
+        {
89
+            "name": "Mohsen Azimi",
90
+            "url": "https://github.com/mohsen1",
91
+            "githubUsername": "mohsen1"
92
+        },
93
+        {
94
+            "name": "Nicolas Even",
95
+            "url": "https://github.com/n-e",
96
+            "githubUsername": "n-e"
97
+        },
98
+        {
99
+            "name": "Nikita Galkin",
100
+            "url": "https://github.com/galkin",
101
+            "githubUsername": "galkin"
102
+        },
103
+        {
104
+            "name": "Parambir Singh",
105
+            "url": "https://github.com/parambirs",
106
+            "githubUsername": "parambirs"
107
+        },
108
+        {
109
+            "name": "Sebastian Silbermann",
110
+            "url": "https://github.com/eps1lon",
111
+            "githubUsername": "eps1lon"
112
+        },
113
+        {
114
+            "name": "Simon Schick",
115
+            "url": "https://github.com/SimonSchick",
116
+            "githubUsername": "SimonSchick"
117
+        },
118
+        {
119
+            "name": "Thomas den Hollander",
120
+            "url": "https://github.com/ThomasdenH",
121
+            "githubUsername": "ThomasdenH"
122
+        },
123
+        {
124
+            "name": "Wilco Bakker",
125
+            "url": "https://github.com/WilcoBakker",
126
+            "githubUsername": "WilcoBakker"
127
+        },
128
+        {
129
+            "name": "wwwy3y3",
130
+            "url": "https://github.com/wwwy3y3",
131
+            "githubUsername": "wwwy3y3"
132
+        },
133
+        {
134
+            "name": "Samuel Ainsworth",
135
+            "url": "https://github.com/samuela",
136
+            "githubUsername": "samuela"
137
+        },
138
+        {
139
+            "name": "Kyle Uehlein",
140
+            "url": "https://github.com/kuehlein",
141
+            "githubUsername": "kuehlein"
142
+        },
143
+        {
144
+            "name": "Thanik Bhongbhibhat",
145
+            "url": "https://github.com/bhongy",
146
+            "githubUsername": "bhongy"
147
+        },
148
+        {
149
+            "name": "Marcin Kopacz",
150
+            "url": "https://github.com/chyzwar",
151
+            "githubUsername": "chyzwar"
152
+        },
153
+        {
154
+            "name": "Trivikram Kamat",
155
+            "url": "https://github.com/trivikr",
156
+            "githubUsername": "trivikr"
157
+        },
158
+        {
159
+            "name": "Junxiao Shi",
160
+            "url": "https://github.com/yoursunny",
161
+            "githubUsername": "yoursunny"
162
+        },
163
+        {
164
+            "name": "Ilia Baryshnikov",
165
+            "url": "https://github.com/qwelias",
166
+            "githubUsername": "qwelias"
167
+        },
168
+        {
169
+            "name": "ExE Boss",
170
+            "url": "https://github.com/ExE-Boss",
171
+            "githubUsername": "ExE-Boss"
172
+        },
173
+        {
174
+            "name": "Piotr Błażejewicz",
175
+            "url": "https://github.com/peterblazejewicz",
176
+            "githubUsername": "peterblazejewicz"
177
+        },
178
+        {
179
+            "name": "Anna Henningsen",
180
+            "url": "https://github.com/addaleax",
181
+            "githubUsername": "addaleax"
182
+        },
183
+        {
184
+            "name": "Victor Perin",
185
+            "url": "https://github.com/victorperin",
186
+            "githubUsername": "victorperin"
187
+        },
188
+        {
189
+            "name": "Yongsheng Zhang",
190
+            "url": "https://github.com/ZYSzys",
191
+            "githubUsername": "ZYSzys"
192
+        },
193
+        {
194
+            "name": "NodeJS Contributors",
195
+            "url": "https://github.com/NodeJS",
196
+            "githubUsername": "NodeJS"
197
+        },
198
+        {
199
+            "name": "Linus Unnebäck",
200
+            "url": "https://github.com/LinusU",
201
+            "githubUsername": "LinusU"
202
+        },
203
+        {
204
+            "name": "wafuwafu13",
205
+            "url": "https://github.com/wafuwafu13",
206
+            "githubUsername": "wafuwafu13"
207
+        },
208
+        {
209
+            "name": "Matteo Collina",
210
+            "url": "https://github.com/mcollina",
211
+            "githubUsername": "mcollina"
212
+        }
213
+    ],
214
+    "main": "",
215
+    "types": "index.d.ts",
216
+    "typesVersions": {
217
+        "<4.9.0-0": {
218
+            "*": [
219
+                "ts4.8/*"
220
+            ]
221
+        }
222
+    },
223
+    "repository": {
224
+        "type": "git",
225
+        "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
226
+        "directory": "types/node"
227
+    },
228
+    "scripts": {},
229
+    "dependencies": {},
230
+    "typesPublisherContentHash": "bec614c152bf72c7a29b996ba58cf8e86e92e1371bf820fac0654a49a16fce5f",
231
+    "typeScriptVersion": "4.1"
232
+}

+ 191
- 0
node_modules/@types/node/path.d.ts 查看文件

@@ -0,0 +1,191 @@
1
+declare module 'path/posix' {
2
+    import path = require('path');
3
+    export = path;
4
+}
5
+declare module 'path/win32' {
6
+    import path = require('path');
7
+    export = path;
8
+}
9
+/**
10
+ * The `path` module provides utilities for working with file and directory paths.
11
+ * It can be accessed using:
12
+ *
13
+ * ```js
14
+ * const path = require('path');
15
+ * ```
16
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/path.js)
17
+ */
18
+declare module 'path' {
19
+    namespace path {
20
+        /**
21
+         * A parsed path object generated by path.parse() or consumed by path.format().
22
+         */
23
+        interface ParsedPath {
24
+            /**
25
+             * The root of the path such as '/' or 'c:\'
26
+             */
27
+            root: string;
28
+            /**
29
+             * The full directory path such as '/home/user/dir' or 'c:\path\dir'
30
+             */
31
+            dir: string;
32
+            /**
33
+             * The file name including extension (if any) such as 'index.html'
34
+             */
35
+            base: string;
36
+            /**
37
+             * The file extension (if any) such as '.html'
38
+             */
39
+            ext: string;
40
+            /**
41
+             * The file name without extension (if any) such as 'index'
42
+             */
43
+            name: string;
44
+        }
45
+        interface FormatInputPathObject {
46
+            /**
47
+             * The root of the path such as '/' or 'c:\'
48
+             */
49
+            root?: string | undefined;
50
+            /**
51
+             * The full directory path such as '/home/user/dir' or 'c:\path\dir'
52
+             */
53
+            dir?: string | undefined;
54
+            /**
55
+             * The file name including extension (if any) such as 'index.html'
56
+             */
57
+            base?: string | undefined;
58
+            /**
59
+             * The file extension (if any) such as '.html'
60
+             */
61
+            ext?: string | undefined;
62
+            /**
63
+             * The file name without extension (if any) such as 'index'
64
+             */
65
+            name?: string | undefined;
66
+        }
67
+        interface PlatformPath {
68
+            /**
69
+             * Normalize a string path, reducing '..' and '.' parts.
70
+             * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
71
+             *
72
+             * @param path string path to normalize.
73
+             * @throws {TypeError} if `path` is not a string.
74
+             */
75
+            normalize(path: string): string;
76
+            /**
77
+             * Join all arguments together and normalize the resulting path.
78
+             *
79
+             * @param paths paths to join.
80
+             * @throws {TypeError} if any of the path segments is not a string.
81
+             */
82
+            join(...paths: string[]): string;
83
+            /**
84
+             * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
85
+             *
86
+             * Starting from leftmost {from} parameter, resolves {to} to an absolute path.
87
+             *
88
+             * If {to} isn't already absolute, {from} arguments are prepended in right to left order,
89
+             * until an absolute path is found. If after using all {from} paths still no absolute path is found,
90
+             * the current working directory is used as well. The resulting path is normalized,
91
+             * and trailing slashes are removed unless the path gets resolved to the root directory.
92
+             *
93
+             * @param paths A sequence of paths or path segments.
94
+             * @throws {TypeError} if any of the arguments is not a string.
95
+             */
96
+            resolve(...paths: string[]): string;
97
+            /**
98
+             * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
99
+             *
100
+             * If the given {path} is a zero-length string, `false` will be returned.
101
+             *
102
+             * @param path path to test.
103
+             * @throws {TypeError} if `path` is not a string.
104
+             */
105
+            isAbsolute(path: string): boolean;
106
+            /**
107
+             * Solve the relative path from {from} to {to} based on the current working directory.
108
+             * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
109
+             *
110
+             * @throws {TypeError} if either `from` or `to` is not a string.
111
+             */
112
+            relative(from: string, to: string): string;
113
+            /**
114
+             * Return the directory name of a path. Similar to the Unix dirname command.
115
+             *
116
+             * @param path the path to evaluate.
117
+             * @throws {TypeError} if `path` is not a string.
118
+             */
119
+            dirname(path: string): string;
120
+            /**
121
+             * Return the last portion of a path. Similar to the Unix basename command.
122
+             * Often used to extract the file name from a fully qualified path.
123
+             *
124
+             * @param path the path to evaluate.
125
+             * @param suffix optionally, an extension to remove from the result.
126
+             * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
127
+             */
128
+            basename(path: string, suffix?: string): string;
129
+            /**
130
+             * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
131
+             * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
132
+             *
133
+             * @param path the path to evaluate.
134
+             * @throws {TypeError} if `path` is not a string.
135
+             */
136
+            extname(path: string): string;
137
+            /**
138
+             * The platform-specific file separator. '\\' or '/'.
139
+             */
140
+            readonly sep: '\\' | '/';
141
+            /**
142
+             * The platform-specific file delimiter. ';' or ':'.
143
+             */
144
+            readonly delimiter: ';' | ':';
145
+            /**
146
+             * Returns an object from a path string - the opposite of format().
147
+             *
148
+             * @param path path to evaluate.
149
+             * @throws {TypeError} if `path` is not a string.
150
+             */
151
+            parse(path: string): ParsedPath;
152
+            /**
153
+             * Returns a path string from an object - the opposite of parse().
154
+             *
155
+             * @param pathObject path to evaluate.
156
+             */
157
+            format(pathObject: FormatInputPathObject): string;
158
+            /**
159
+             * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
160
+             * If path is not a string, path will be returned without modifications.
161
+             * This method is meaningful only on Windows system.
162
+             * On POSIX systems, the method is non-operational and always returns path without modifications.
163
+             */
164
+            toNamespacedPath(path: string): string;
165
+            /**
166
+             * Posix specific pathing.
167
+             * Same as parent object on posix.
168
+             */
169
+            readonly posix: PlatformPath;
170
+            /**
171
+             * Windows specific pathing.
172
+             * Same as parent object on windows
173
+             */
174
+            readonly win32: PlatformPath;
175
+        }
176
+    }
177
+    const path: path.PlatformPath;
178
+    export = path;
179
+}
180
+declare module 'node:path' {
181
+    import path = require('path');
182
+    export = path;
183
+}
184
+declare module 'node:path/posix' {
185
+    import path = require('path/posix');
186
+    export = path;
187
+}
188
+declare module 'node:path/win32' {
189
+    import path = require('path/win32');
190
+    export = path;
191
+}

+ 625
- 0
node_modules/@types/node/perf_hooks.d.ts 查看文件

@@ -0,0 +1,625 @@
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
+ * const { PerformanceObserver, performance } = require('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 = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
34
+    interface NodeGCPerformanceDetail {
35
+        /**
36
+         * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
37
+         * the type of garbage collection operation that occurred.
38
+         * See perf_hooks.constants for valid values.
39
+         */
40
+        readonly kind?: number | undefined;
41
+        /**
42
+         * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
43
+         * property contains additional information about garbage collection operation.
44
+         * See perf_hooks.constants for valid values.
45
+         */
46
+        readonly flags?: number | undefined;
47
+    }
48
+    /**
49
+     * @since v8.5.0
50
+     */
51
+    class PerformanceEntry {
52
+        protected constructor();
53
+        /**
54
+         * The total number of milliseconds elapsed for this entry. This value will not
55
+         * be meaningful for all Performance Entry types.
56
+         * @since v8.5.0
57
+         */
58
+        readonly duration: number;
59
+        /**
60
+         * The name of the performance entry.
61
+         * @since v8.5.0
62
+         */
63
+        readonly name: string;
64
+        /**
65
+         * The high resolution millisecond timestamp marking the starting time of the
66
+         * Performance Entry.
67
+         * @since v8.5.0
68
+         */
69
+        readonly startTime: number;
70
+        /**
71
+         * The type of the performance entry. It may be one of:
72
+         *
73
+         * * `'node'` (Node.js only)
74
+         * * `'mark'` (available on the Web)
75
+         * * `'measure'` (available on the Web)
76
+         * * `'gc'` (Node.js only)
77
+         * * `'function'` (Node.js only)
78
+         * * `'http2'` (Node.js only)
79
+         * * `'http'` (Node.js only)
80
+         * @since v8.5.0
81
+         */
82
+        readonly entryType: EntryType;
83
+        /**
84
+         * Additional detail specific to the `entryType`.
85
+         * @since v16.0.0
86
+         */
87
+        readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
88
+        toJSON(): any;
89
+    }
90
+    class PerformanceMark extends PerformanceEntry {
91
+        readonly duration: 0;
92
+        readonly entryType: 'mark';
93
+    }
94
+    class PerformanceMeasure extends PerformanceEntry {
95
+        readonly entryType: 'measure';
96
+    }
97
+    /**
98
+     * _This property is an extension by Node.js. It is not available in Web browsers._
99
+     *
100
+     * Provides timing details for Node.js itself. The constructor of this class
101
+     * is not exposed to users.
102
+     * @since v8.5.0
103
+     */
104
+    class PerformanceNodeTiming extends PerformanceEntry {
105
+        /**
106
+         * The high resolution millisecond timestamp at which the Node.js process
107
+         * completed bootstrapping. If bootstrapping has not yet finished, the property
108
+         * has the value of -1.
109
+         * @since v8.5.0
110
+         */
111
+        readonly bootstrapComplete: number;
112
+        /**
113
+         * The high resolution millisecond timestamp at which the Node.js environment was
114
+         * initialized.
115
+         * @since v8.5.0
116
+         */
117
+        readonly environment: number;
118
+        /**
119
+         * The high resolution millisecond timestamp of the amount of time the event loop
120
+         * has been idle within the event loop's event provider (e.g. `epoll_wait`). This
121
+         * does not take CPU usage into consideration. If the event loop has not yet
122
+         * started (e.g., in the first tick of the main script), the property has the
123
+         * value of 0.
124
+         * @since v14.10.0, v12.19.0
125
+         */
126
+        readonly idleTime: number;
127
+        /**
128
+         * The high resolution millisecond timestamp at which the Node.js event loop
129
+         * exited. If the event loop has not yet exited, the property has the value of -1\.
130
+         * It can only have a value of not -1 in a handler of the `'exit'` event.
131
+         * @since v8.5.0
132
+         */
133
+        readonly loopExit: number;
134
+        /**
135
+         * The high resolution millisecond timestamp at which the Node.js event loop
136
+         * started. If the event loop has not yet started (e.g., in the first tick of the
137
+         * main script), the property has the value of -1.
138
+         * @since v8.5.0
139
+         */
140
+        readonly loopStart: number;
141
+        /**
142
+         * The high resolution millisecond timestamp at which the V8 platform was
143
+         * initialized.
144
+         * @since v8.5.0
145
+         */
146
+        readonly v8Start: number;
147
+    }
148
+    interface EventLoopUtilization {
149
+        idle: number;
150
+        active: number;
151
+        utilization: number;
152
+    }
153
+    /**
154
+     * @param util1 The result of a previous call to eventLoopUtilization()
155
+     * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
156
+     */
157
+    type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
158
+    interface MarkOptions {
159
+        /**
160
+         * Additional optional detail to include with the mark.
161
+         */
162
+        detail?: unknown | undefined;
163
+        /**
164
+         * An optional timestamp to be used as the mark time.
165
+         * @default `performance.now()`.
166
+         */
167
+        startTime?: number | undefined;
168
+    }
169
+    interface MeasureOptions {
170
+        /**
171
+         * Additional optional detail to include with the mark.
172
+         */
173
+        detail?: unknown | undefined;
174
+        /**
175
+         * Duration between start and end times.
176
+         */
177
+        duration?: number | undefined;
178
+        /**
179
+         * Timestamp to be used as the end time, or a string identifying a previously recorded mark.
180
+         */
181
+        end?: number | string | undefined;
182
+        /**
183
+         * Timestamp to be used as the start time, or a string identifying a previously recorded mark.
184
+         */
185
+        start?: number | string | undefined;
186
+    }
187
+    interface TimerifyOptions {
188
+        /**
189
+         * A histogram object created using
190
+         * `perf_hooks.createHistogram()` that will record runtime durations in
191
+         * nanoseconds.
192
+         */
193
+        histogram?: RecordableHistogram | undefined;
194
+    }
195
+    interface Performance {
196
+        /**
197
+         * If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
198
+         * If name is provided, removes only the named mark.
199
+         * @param name
200
+         */
201
+        clearMarks(name?: string): void;
202
+        /**
203
+         * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
204
+         * If name is provided, removes only the named measure.
205
+         * @param name
206
+         * @since v16.7.0
207
+         */
208
+        clearMeasures(name?: string): void;
209
+        /**
210
+         * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
211
+         * If you are only interested in performance entries of certain types or that have certain names, see
212
+         * `performance.getEntriesByType()` and `performance.getEntriesByName()`.
213
+         * @since v16.7.0
214
+         */
215
+        getEntries(): PerformanceEntry[];
216
+        /**
217
+         * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
218
+         * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
219
+         * @param name
220
+         * @param type
221
+         * @since v16.7.0
222
+         */
223
+        getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
224
+        /**
225
+         * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
226
+         * whose `performanceEntry.entryType` is equal to `type`.
227
+         * @param type
228
+         * @since v16.7.0
229
+         */
230
+        getEntriesByType(type: EntryType): PerformanceEntry[];
231
+        /**
232
+         * Creates a new PerformanceMark entry in the Performance Timeline.
233
+         * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark',
234
+         * and whose performanceEntry.duration is always 0.
235
+         * Performance marks are used to mark specific significant moments in the Performance Timeline.
236
+         * @param name
237
+         * @return The PerformanceMark entry that was created
238
+         */
239
+        mark(name?: string, options?: MarkOptions): PerformanceMark;
240
+        /**
241
+         * Creates a new PerformanceMeasure entry in the Performance Timeline.
242
+         * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
243
+         * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark.
244
+         *
245
+         * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify
246
+         * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist,
247
+         * then startMark is set to timeOrigin by default.
248
+         *
249
+         * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp
250
+         * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown.
251
+         * @param name
252
+         * @param startMark
253
+         * @param endMark
254
+         * @return The PerformanceMeasure entry that was created
255
+         */
256
+        measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
257
+        measure(name: string, options: MeasureOptions): PerformanceMeasure;
258
+        /**
259
+         * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
260
+         */
261
+        readonly nodeTiming: PerformanceNodeTiming;
262
+        /**
263
+         * @return the current high resolution millisecond timestamp
264
+         */
265
+        now(): number;
266
+        /**
267
+         * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured.
268
+         */
269
+        readonly timeOrigin: number;
270
+        /**
271
+         * Wraps a function within a new function that measures the running time of the wrapped function.
272
+         * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed.
273
+         * @param fn
274
+         */
275
+        timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
276
+        /**
277
+         * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
278
+         * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
279
+         * No other CPU idle time is taken into consideration.
280
+         */
281
+        eventLoopUtilization: EventLoopUtilityFunction;
282
+    }
283
+    interface PerformanceObserverEntryList {
284
+        /**
285
+         * Returns a list of `PerformanceEntry` objects in chronological order
286
+         * with respect to `performanceEntry.startTime`.
287
+         *
288
+         * ```js
289
+         * const {
290
+         *   performance,
291
+         *   PerformanceObserver
292
+         * } = require('perf_hooks');
293
+         *
294
+         * const obs = new PerformanceObserver((perfObserverList, observer) => {
295
+         *   console.log(perfObserverList.getEntries());
296
+         *
297
+         *    * [
298
+         *    *   PerformanceEntry {
299
+         *    *     name: 'test',
300
+         *    *     entryType: 'mark',
301
+         *    *     startTime: 81.465639,
302
+         *    *     duration: 0
303
+         *    *   },
304
+         *    *   PerformanceEntry {
305
+         *    *     name: 'meow',
306
+         *    *     entryType: 'mark',
307
+         *    *     startTime: 81.860064,
308
+         *    *     duration: 0
309
+         *    *   }
310
+         *    * ]
311
+         *
312
+         *
313
+         *   performance.clearMarks();
314
+         *   performance.clearMeasures();
315
+         *   observer.disconnect();
316
+         * });
317
+         * obs.observe({ type: 'mark' });
318
+         *
319
+         * performance.mark('test');
320
+         * performance.mark('meow');
321
+         * ```
322
+         * @since v8.5.0
323
+         */
324
+        getEntries(): PerformanceEntry[];
325
+        /**
326
+         * Returns a list of `PerformanceEntry` objects in chronological order
327
+         * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
328
+         * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
329
+         *
330
+         * ```js
331
+         * const {
332
+         *   performance,
333
+         *   PerformanceObserver
334
+         * } = require('perf_hooks');
335
+         *
336
+         * const obs = new PerformanceObserver((perfObserverList, observer) => {
337
+         *   console.log(perfObserverList.getEntriesByName('meow'));
338
+         *
339
+         *    * [
340
+         *    *   PerformanceEntry {
341
+         *    *     name: 'meow',
342
+         *    *     entryType: 'mark',
343
+         *    *     startTime: 98.545991,
344
+         *    *     duration: 0
345
+         *    *   }
346
+         *    * ]
347
+         *
348
+         *   console.log(perfObserverList.getEntriesByName('nope')); // []
349
+         *
350
+         *   console.log(perfObserverList.getEntriesByName('test', 'mark'));
351
+         *
352
+         *    * [
353
+         *    *   PerformanceEntry {
354
+         *    *     name: 'test',
355
+         *    *     entryType: 'mark',
356
+         *    *     startTime: 63.518931,
357
+         *    *     duration: 0
358
+         *    *   }
359
+         *    * ]
360
+         *
361
+         *   console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
362
+         *
363
+         *   performance.clearMarks();
364
+         *   performance.clearMeasures();
365
+         *   observer.disconnect();
366
+         * });
367
+         * obs.observe({ entryTypes: ['mark', 'measure'] });
368
+         *
369
+         * performance.mark('test');
370
+         * performance.mark('meow');
371
+         * ```
372
+         * @since v8.5.0
373
+         */
374
+        getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
375
+        /**
376
+         * Returns a list of `PerformanceEntry` objects in chronological order
377
+         * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`.
378
+         *
379
+         * ```js
380
+         * const {
381
+         *   performance,
382
+         *   PerformanceObserver
383
+         * } = require('perf_hooks');
384
+         *
385
+         * const obs = new PerformanceObserver((perfObserverList, observer) => {
386
+         *   console.log(perfObserverList.getEntriesByType('mark'));
387
+         *
388
+         *    * [
389
+         *    *   PerformanceEntry {
390
+         *    *     name: 'test',
391
+         *    *     entryType: 'mark',
392
+         *    *     startTime: 55.897834,
393
+         *    *     duration: 0
394
+         *    *   },
395
+         *    *   PerformanceEntry {
396
+         *    *     name: 'meow',
397
+         *    *     entryType: 'mark',
398
+         *    *     startTime: 56.350146,
399
+         *    *     duration: 0
400
+         *    *   }
401
+         *    * ]
402
+         *
403
+         *   performance.clearMarks();
404
+         *   performance.clearMeasures();
405
+         *   observer.disconnect();
406
+         * });
407
+         * obs.observe({ type: 'mark' });
408
+         *
409
+         * performance.mark('test');
410
+         * performance.mark('meow');
411
+         * ```
412
+         * @since v8.5.0
413
+         */
414
+        getEntriesByType(type: EntryType): PerformanceEntry[];
415
+    }
416
+    type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
417
+    class PerformanceObserver extends AsyncResource {
418
+        constructor(callback: PerformanceObserverCallback);
419
+        /**
420
+         * Disconnects the `PerformanceObserver` instance from all notifications.
421
+         * @since v8.5.0
422
+         */
423
+        disconnect(): void;
424
+        /**
425
+         * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`:
426
+         *
427
+         * ```js
428
+         * const {
429
+         *   performance,
430
+         *   PerformanceObserver
431
+         * } = require('perf_hooks');
432
+         *
433
+         * const obs = new PerformanceObserver((list, observer) => {
434
+         *   // Called once asynchronously. `list` contains three items.
435
+         * });
436
+         * obs.observe({ type: 'mark' });
437
+         *
438
+         * for (let n = 0; n < 3; n++)
439
+         *   performance.mark(`test${n}`);
440
+         * ```
441
+         * @since v8.5.0
442
+         */
443
+        observe(
444
+            options:
445
+                | {
446
+                      entryTypes: ReadonlyArray<EntryType>;
447
+                      buffered?: boolean | undefined;
448
+                  }
449
+                | {
450
+                      type: EntryType;
451
+                      buffered?: boolean | undefined;
452
+                  }
453
+        ): void;
454
+    }
455
+    namespace constants {
456
+        const NODE_PERFORMANCE_GC_MAJOR: number;
457
+        const NODE_PERFORMANCE_GC_MINOR: number;
458
+        const NODE_PERFORMANCE_GC_INCREMENTAL: number;
459
+        const NODE_PERFORMANCE_GC_WEAKCB: number;
460
+        const NODE_PERFORMANCE_GC_FLAGS_NO: number;
461
+        const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
462
+        const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
463
+        const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
464
+        const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
465
+        const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
466
+        const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
467
+    }
468
+    const performance: Performance;
469
+    interface EventLoopMonitorOptions {
470
+        /**
471
+         * The sampling rate in milliseconds.
472
+         * Must be greater than zero.
473
+         * @default 10
474
+         */
475
+        resolution?: number | undefined;
476
+    }
477
+    interface Histogram {
478
+        /**
479
+         * Returns a `Map` object detailing the accumulated percentile distribution.
480
+         * @since v11.10.0
481
+         */
482
+        readonly percentiles: Map<number, number>;
483
+        /**
484
+         * The number of times the event loop delay exceeded the maximum 1 hour event
485
+         * loop delay threshold.
486
+         * @since v11.10.0
487
+         */
488
+        readonly exceeds: number;
489
+        /**
490
+         * The minimum recorded event loop delay.
491
+         * @since v11.10.0
492
+         */
493
+        readonly min: number;
494
+        /**
495
+         * The maximum recorded event loop delay.
496
+         * @since v11.10.0
497
+         */
498
+        readonly max: number;
499
+        /**
500
+         * The mean of the recorded event loop delays.
501
+         * @since v11.10.0
502
+         */
503
+        readonly mean: number;
504
+        /**
505
+         * The standard deviation of the recorded event loop delays.
506
+         * @since v11.10.0
507
+         */
508
+        readonly stddev: number;
509
+        /**
510
+         * Resets the collected histogram data.
511
+         * @since v11.10.0
512
+         */
513
+        reset(): void;
514
+        /**
515
+         * Returns the value at the given percentile.
516
+         * @since v11.10.0
517
+         * @param percentile A percentile value in the range (0, 100].
518
+         */
519
+        percentile(percentile: number): number;
520
+    }
521
+    interface IntervalHistogram extends Histogram {
522
+        /**
523
+         * Enables the update interval timer. Returns `true` if the timer was
524
+         * started, `false` if it was already started.
525
+         * @since v11.10.0
526
+         */
527
+        enable(): boolean;
528
+        /**
529
+         * Disables the update interval timer. Returns `true` if the timer was
530
+         * stopped, `false` if it was already stopped.
531
+         * @since v11.10.0
532
+         */
533
+        disable(): boolean;
534
+    }
535
+    interface RecordableHistogram extends Histogram {
536
+        /**
537
+         * @since v15.9.0, v14.18.0
538
+         * @param val The amount to record in the histogram.
539
+         */
540
+        record(val: number | bigint): void;
541
+        /**
542
+         * Calculates the amount of time (in nanoseconds) that has passed since the
543
+         * previous call to `recordDelta()` and records that amount in the histogram.
544
+         *
545
+         * ## Examples
546
+         * @since v15.9.0, v14.18.0
547
+         */
548
+        recordDelta(): void;
549
+        /**
550
+         * Adds the values from other to this histogram.
551
+         * @since v17.4.0, v16.14.0
552
+         * @param other Recordable Histogram to combine with
553
+         */
554
+         add(other: RecordableHistogram): void;
555
+    }
556
+    /**
557
+     * _This property is an extension by Node.js. It is not available in Web browsers._
558
+     *
559
+     * Creates an `IntervalHistogram` object that samples and reports the event loop
560
+     * delay over time. The delays will be reported in nanoseconds.
561
+     *
562
+     * Using a timer to detect approximate event loop delay works because the
563
+     * execution of timers is tied specifically to the lifecycle of the libuv
564
+     * event loop. That is, a delay in the loop will cause a delay in the execution
565
+     * of the timer, and those delays are specifically what this API is intended to
566
+     * detect.
567
+     *
568
+     * ```js
569
+     * const { monitorEventLoopDelay } = require('perf_hooks');
570
+     * const h = monitorEventLoopDelay({ resolution: 20 });
571
+     * h.enable();
572
+     * // Do something.
573
+     * h.disable();
574
+     * console.log(h.min);
575
+     * console.log(h.max);
576
+     * console.log(h.mean);
577
+     * console.log(h.stddev);
578
+     * console.log(h.percentiles);
579
+     * console.log(h.percentile(50));
580
+     * console.log(h.percentile(99));
581
+     * ```
582
+     * @since v11.10.0
583
+     */
584
+    function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
585
+    interface CreateHistogramOptions {
586
+        /**
587
+         * The minimum recordable value. Must be an integer value greater than 0.
588
+         * @default 1
589
+         */
590
+        min?: number | bigint | undefined;
591
+        /**
592
+         * The maximum recordable value. Must be an integer value greater than min.
593
+         * @default Number.MAX_SAFE_INTEGER
594
+         */
595
+        max?: number | bigint | undefined;
596
+        /**
597
+         * The number of accuracy digits. Must be a number between 1 and 5.
598
+         * @default 3
599
+         */
600
+        figures?: number | undefined;
601
+    }
602
+    /**
603
+     * Returns a `RecordableHistogram`.
604
+     * @since v15.9.0, v14.18.0
605
+     */
606
+    function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
607
+
608
+    import { performance as _performance } from 'perf_hooks';
609
+    global {
610
+        /**
611
+         * `performance` is a global reference for `require('perf_hooks').performance`
612
+         * https://nodejs.org/api/globals.html#performance
613
+         * @since v16.0.0
614
+         */
615
+        var performance: typeof globalThis extends {
616
+            onmessage: any;
617
+            performance: infer T;
618
+        }
619
+            ? T
620
+            : typeof _performance;
621
+    }
622
+}
623
+declare module 'node:perf_hooks' {
624
+    export * from 'perf_hooks';
625
+}

+ 1482
- 0
node_modules/@types/node/process.d.ts
文件差異過大導致無法顯示
查看文件


+ 117
- 0
node_modules/@types/node/punycode.d.ts 查看文件

@@ -0,0 +1,117 @@
1
+/**
2
+ * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users
3
+ * currently depending on the `punycode` module should switch to using the
4
+ * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL
5
+ * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.
6
+ *
7
+ * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It
8
+ * can be accessed using:
9
+ *
10
+ * ```js
11
+ * const punycode = require('punycode');
12
+ * ```
13
+ *
14
+ * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is
15
+ * primarily intended for use in Internationalized Domain Names. Because host
16
+ * names in URLs are limited to ASCII characters only, Domain Names that contain
17
+ * non-ASCII characters must be converted into ASCII using the Punycode scheme.
18
+ * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent
19
+ * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`.
20
+ *
21
+ * The `punycode` module provides a simple implementation of the Punycode standard.
22
+ *
23
+ * The `punycode` module is a third-party dependency used by Node.js and
24
+ * made available to developers as a convenience. Fixes or other modifications to
25
+ * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.
26
+ * @deprecated Since v7.0.0 - Deprecated
27
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/punycode.js)
28
+ */
29
+declare module 'punycode' {
30
+    /**
31
+     * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only
32
+     * characters to the equivalent string of Unicode codepoints.
33
+     *
34
+     * ```js
35
+     * punycode.decode('maana-pta'); // 'mañana'
36
+     * punycode.decode('--dqo34k'); // '☃-⌘'
37
+     * ```
38
+     * @since v0.5.1
39
+     */
40
+    function decode(string: string): string;
41
+    /**
42
+     * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.
43
+     *
44
+     * ```js
45
+     * punycode.encode('mañana'); // 'maana-pta'
46
+     * punycode.encode('☃-⌘'); // '--dqo34k'
47
+     * ```
48
+     * @since v0.5.1
49
+     */
50
+    function encode(string: string): string;
51
+    /**
52
+     * The `punycode.toUnicode()` method converts a string representing a domain name
53
+     * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be
54
+     * converted.
55
+     *
56
+     * ```js
57
+     * // decode domain names
58
+     * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com'
59
+     * punycode.toUnicode('xn----dqo34k.com');  // '☃-⌘.com'
60
+     * punycode.toUnicode('example.com');       // 'example.com'
61
+     * ```
62
+     * @since v0.6.1
63
+     */
64
+    function toUnicode(domain: string): string;
65
+    /**
66
+     * The `punycode.toASCII()` method converts a Unicode string representing an
67
+     * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the
68
+     * domain name will be converted. Calling `punycode.toASCII()` on a string that
69
+     * already only contains ASCII characters will have no effect.
70
+     *
71
+     * ```js
72
+     * // encode domain names
73
+     * punycode.toASCII('mañana.com');  // 'xn--maana-pta.com'
74
+     * punycode.toASCII('☃-⌘.com');   // 'xn----dqo34k.com'
75
+     * punycode.toASCII('example.com'); // 'example.com'
76
+     * ```
77
+     * @since v0.6.1
78
+     */
79
+    function toASCII(domain: string): string;
80
+    /**
81
+     * @deprecated since v7.0.0
82
+     * The version of the punycode module bundled in Node.js is being deprecated.
83
+     * In a future major version of Node.js this module will be removed.
84
+     * Users currently depending on the punycode module should switch to using
85
+     * the userland-provided Punycode.js module instead.
86
+     */
87
+    const ucs2: ucs2;
88
+    interface ucs2 {
89
+        /**
90
+         * @deprecated since v7.0.0
91
+         * The version of the punycode module bundled in Node.js is being deprecated.
92
+         * In a future major version of Node.js this module will be removed.
93
+         * Users currently depending on the punycode module should switch to using
94
+         * the userland-provided Punycode.js module instead.
95
+         */
96
+        decode(string: string): number[];
97
+        /**
98
+         * @deprecated since v7.0.0
99
+         * The version of the punycode module bundled in Node.js is being deprecated.
100
+         * In a future major version of Node.js this module will be removed.
101
+         * Users currently depending on the punycode module should switch to using
102
+         * the userland-provided Punycode.js module instead.
103
+         */
104
+        encode(codePoints: ReadonlyArray<number>): string;
105
+    }
106
+    /**
107
+     * @deprecated since v7.0.0
108
+     * The version of the punycode module bundled in Node.js is being deprecated.
109
+     * In a future major version of Node.js this module will be removed.
110
+     * Users currently depending on the punycode module should switch to using
111
+     * the userland-provided Punycode.js module instead.
112
+     */
113
+    const version: string;
114
+}
115
+declare module 'node:punycode' {
116
+    export * from 'punycode';
117
+}

+ 131
- 0
node_modules/@types/node/querystring.d.ts 查看文件

@@ -0,0 +1,131 @@
1
+/**
2
+ * The `querystring` module provides utilities for parsing and formatting URL
3
+ * query strings. It can be accessed using:
4
+ *
5
+ * ```js
6
+ * const querystring = require('querystring');
7
+ * ```
8
+ *
9
+ * The `querystring` API is considered Legacy. While it is still maintained,
10
+ * new code should use the `URLSearchParams` API instead.
11
+ * @deprecated Legacy
12
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/querystring.js)
13
+ */
14
+declare module 'querystring' {
15
+    interface StringifyOptions {
16
+        encodeURIComponent?: ((str: string) => string) | undefined;
17
+    }
18
+    interface ParseOptions {
19
+        maxKeys?: number | undefined;
20
+        decodeURIComponent?: ((str: string) => string) | undefined;
21
+    }
22
+    interface ParsedUrlQuery extends NodeJS.Dict<string | string[]> {}
23
+    interface ParsedUrlQueryInput extends NodeJS.Dict<string | number | boolean | ReadonlyArray<string> | ReadonlyArray<number> | ReadonlyArray<boolean> | null> {}
24
+    /**
25
+     * The `querystring.stringify()` method produces a URL query string from a
26
+     * given `obj` by iterating through the object's "own properties".
27
+     *
28
+     * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
29
+     * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
30
+     * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
31
+     * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) |
32
+     * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) |
33
+     * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) |
34
+     * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) |
35
+     * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to
36
+     * empty strings.
37
+     *
38
+     * ```js
39
+     * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
40
+     * // Returns 'foo=bar&#x26;baz=qux&#x26;baz=quux&#x26;corge='
41
+     *
42
+     * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
43
+     * // Returns 'foo:bar;baz:qux'
44
+     * ```
45
+     *
46
+     * By default, characters requiring percent-encoding within the query string will
47
+     * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified:
48
+     *
49
+     * ```js
50
+     * // Assuming gbkEncodeURIComponent function already exists,
51
+     *
52
+     * querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
53
+     *                       { encodeURIComponent: gbkEncodeURIComponent });
54
+     * ```
55
+     * @since v0.1.25
56
+     * @param obj The object to serialize into a URL query string
57
+     * @param [sep='&'] The substring used to delimit key and value pairs in the query string.
58
+     * @param [eq='='] . The substring used to delimit keys and values in the query string.
59
+     */
60
+    function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string;
61
+    /**
62
+     * The `querystring.parse()` method parses a URL query string (`str`) into a
63
+     * collection of key and value pairs.
64
+     *
65
+     * For example, the query string `'foo=bar&#x26;abc=xyz&#x26;abc=123'` is parsed into:
66
+     *
67
+     * ```js
68
+     * {
69
+     *   foo: 'bar',
70
+     *   abc: ['xyz', '123']
71
+     * }
72
+     * ```
73
+     *
74
+     * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`,
75
+     * `obj.hasOwnProperty()`, and others
76
+     * are not defined and _will not work_.
77
+     *
78
+     * By default, percent-encoded characters within the query string will be assumed
79
+     * to use UTF-8 encoding. If an alternative character encoding is used, then an
80
+     * alternative `decodeURIComponent` option will need to be specified:
81
+     *
82
+     * ```js
83
+     * // Assuming gbkDecodeURIComponent function already exists...
84
+     *
85
+     * querystring.parse('w=%D6%D0%CE%C4&#x26;foo=bar', null, null,
86
+     *                   { decodeURIComponent: gbkDecodeURIComponent });
87
+     * ```
88
+     * @since v0.1.25
89
+     * @param str The URL query string to parse
90
+     * @param [sep='&'] The substring used to delimit key and value pairs in the query string.
91
+     * @param [eq='='] . The substring used to delimit keys and values in the query string.
92
+     */
93
+    function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery;
94
+    /**
95
+     * The querystring.encode() function is an alias for querystring.stringify().
96
+     */
97
+    const encode: typeof stringify;
98
+    /**
99
+     * The querystring.decode() function is an alias for querystring.parse().
100
+     */
101
+    const decode: typeof parse;
102
+    /**
103
+     * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL
104
+     * query strings.
105
+     *
106
+     * The `querystring.escape()` method is used by `querystring.stringify()` and is
107
+     * generally not expected to be used directly. It is exported primarily to allow
108
+     * application code to provide a replacement percent-encoding implementation if
109
+     * necessary by assigning `querystring.escape` to an alternative function.
110
+     * @since v0.1.25
111
+     */
112
+    function escape(str: string): string;
113
+    /**
114
+     * The `querystring.unescape()` method performs decoding of URL percent-encoded
115
+     * characters on the given `str`.
116
+     *
117
+     * The `querystring.unescape()` method is used by `querystring.parse()` and is
118
+     * generally not expected to be used directly. It is exported primarily to allow
119
+     * application code to provide a replacement decoding implementation if
120
+     * necessary by assigning `querystring.unescape` to an alternative function.
121
+     *
122
+     * By default, the `querystring.unescape()` method will attempt to use the
123
+     * JavaScript built-in `decodeURIComponent()` method to decode. If that fails,
124
+     * a safer equivalent that does not throw on malformed URLs will be used.
125
+     * @since v0.1.25
126
+     */
127
+    function unescape(str: string): string;
128
+}
129
+declare module 'node:querystring' {
130
+    export * from 'querystring';
131
+}

+ 653
- 0
node_modules/@types/node/readline.d.ts 查看文件

@@ -0,0 +1,653 @@
1
+/**
2
+ * The `readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time.
3
+ *
4
+ * To use the promise-based APIs:
5
+ *
6
+ * ```js
7
+ * import * as readline from 'node:readline/promises';
8
+ * ```
9
+ *
10
+ * To use the callback and sync APIs:
11
+ *
12
+ * ```js
13
+ * import * as readline from 'node:readline';
14
+ * ```
15
+ *
16
+ * The following simple example illustrates the basic use of the `readline` module.
17
+ *
18
+ * ```js
19
+ * import * as readline from 'node:readline/promises';
20
+ * import { stdin as input, stdout as output } from 'node:process';
21
+ *
22
+ * const rl = readline.createInterface({ input, output });
23
+ *
24
+ * const answer = await rl.question('What do you think of Node.js? ');
25
+ *
26
+ * console.log(`Thank you for your valuable feedback: ${answer}`);
27
+ *
28
+ * rl.close();
29
+ * ```
30
+ *
31
+ * Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be
32
+ * received on the `input` stream.
33
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline.js)
34
+ */
35
+declare module 'readline' {
36
+    import { Abortable, EventEmitter } from 'node:events';
37
+    import * as promises from 'node:readline/promises';
38
+
39
+    export { promises };
40
+    export interface Key {
41
+        sequence?: string | undefined;
42
+        name?: string | undefined;
43
+        ctrl?: boolean | undefined;
44
+        meta?: boolean | undefined;
45
+        shift?: boolean | undefined;
46
+    }
47
+    /**
48
+     * Instances of the `readline.Interface` class are constructed using the`readline.createInterface()` method. Every instance is associated with a
49
+     * single `input` `Readable` stream and a single `output` `Writable` stream.
50
+     * The `output` stream is used to print prompts for user input that arrives on,
51
+     * and is read from, the `input` stream.
52
+     * @since v0.1.104
53
+     */
54
+    export class Interface extends EventEmitter {
55
+        readonly terminal: boolean;
56
+        /**
57
+         * The current input data being processed by node.
58
+         *
59
+         * This can be used when collecting input from a TTY stream to retrieve the
60
+         * current value that has been processed thus far, prior to the `line` event
61
+         * being emitted. Once the `line` event has been emitted, this property will
62
+         * be an empty string.
63
+         *
64
+         * Be aware that modifying the value during the instance runtime may have
65
+         * unintended consequences if `rl.cursor` is not also controlled.
66
+         *
67
+         * **If not using a TTY stream for input, use the `'line'` event.**
68
+         *
69
+         * One possible use case would be as follows:
70
+         *
71
+         * ```js
72
+         * const values = ['lorem ipsum', 'dolor sit amet'];
73
+         * const rl = readline.createInterface(process.stdin);
74
+         * const showResults = debounce(() => {
75
+         *   console.log(
76
+         *     '\n',
77
+         *     values.filter((val) => val.startsWith(rl.line)).join(' ')
78
+         *   );
79
+         * }, 300);
80
+         * process.stdin.on('keypress', (c, k) => {
81
+         *   showResults();
82
+         * });
83
+         * ```
84
+         * @since v0.1.98
85
+         */
86
+        readonly line: string;
87
+        /**
88
+         * The cursor position relative to `rl.line`.
89
+         *
90
+         * This will track where the current cursor lands in the input string, when
91
+         * reading input from a TTY stream. The position of cursor determines the
92
+         * portion of the input string that will be modified as input is processed,
93
+         * as well as the column where the terminal caret will be rendered.
94
+         * @since v0.1.98
95
+         */
96
+        readonly cursor: number;
97
+        /**
98
+         * NOTE: According to the documentation:
99
+         *
100
+         * > Instances of the `readline.Interface` class are constructed using the
101
+         * > `readline.createInterface()` method.
102
+         *
103
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
104
+         */
105
+        protected constructor(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean);
106
+        /**
107
+         * NOTE: According to the documentation:
108
+         *
109
+         * > Instances of the `readline.Interface` class are constructed using the
110
+         * > `readline.createInterface()` method.
111
+         *
112
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/readline.html#readline_class_interface
113
+         */
114
+        protected constructor(options: ReadLineOptions);
115
+        /**
116
+         * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`.
117
+         * @since v15.3.0
118
+         * @return the current prompt string
119
+         */
120
+        getPrompt(): string;
121
+        /**
122
+         * The `rl.setPrompt()` method sets the prompt that will be written to `output`whenever `rl.prompt()` is called.
123
+         * @since v0.1.98
124
+         */
125
+        setPrompt(prompt: string): void;
126
+        /**
127
+         * The `rl.prompt()` method writes the `readline.Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new
128
+         * location at which to provide input.
129
+         *
130
+         * When called, `rl.prompt()` will resume the `input` stream if it has been
131
+         * paused.
132
+         *
133
+         * If the `readline.Interface` was created with `output` set to `null` or`undefined` the prompt is not written.
134
+         * @since v0.1.98
135
+         * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`.
136
+         */
137
+        prompt(preserveCursor?: boolean): void;
138
+        /**
139
+         * The `rl.question()` method displays the `query` by writing it to the `output`,
140
+         * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument.
141
+         *
142
+         * When called, `rl.question()` will resume the `input` stream if it has been
143
+         * paused.
144
+         *
145
+         * If the `readline.Interface` was created with `output` set to `null` or`undefined` the `query` is not written.
146
+         *
147
+         * The `callback` function passed to `rl.question()` does not follow the typical
148
+         * pattern of accepting an `Error` object or `null` as the first argument.
149
+         * The `callback` is called with the provided answer as the only argument.
150
+         *
151
+         * Example usage:
152
+         *
153
+         * ```js
154
+         * rl.question('What is your favorite food? ', (answer) => {
155
+         *   console.log(`Oh, so your favorite food is ${answer}`);
156
+         * });
157
+         * ```
158
+         *
159
+         * Using an `AbortController` to cancel a question.
160
+         *
161
+         * ```js
162
+         * const ac = new AbortController();
163
+         * const signal = ac.signal;
164
+         *
165
+         * rl.question('What is your favorite food? ', { signal }, (answer) => {
166
+         *   console.log(`Oh, so your favorite food is ${answer}`);
167
+         * });
168
+         *
169
+         * signal.addEventListener('abort', () => {
170
+         *   console.log('The food question timed out');
171
+         * }, { once: true });
172
+         *
173
+         * setTimeout(() => ac.abort(), 10000);
174
+         * ```
175
+         *
176
+         * If this method is invoked as it's util.promisify()ed version, it returns a
177
+         * Promise that fulfills with the answer. If the question is canceled using
178
+         * an `AbortController` it will reject with an `AbortError`.
179
+         *
180
+         * ```js
181
+         * const util = require('util');
182
+         * const question = util.promisify(rl.question).bind(rl);
183
+         *
184
+         * async function questionExample() {
185
+         *   try {
186
+         *     const answer = await question('What is you favorite food? ');
187
+         *     console.log(`Oh, so your favorite food is ${answer}`);
188
+         *   } catch (err) {
189
+         *     console.error('Question rejected', err);
190
+         *   }
191
+         * }
192
+         * questionExample();
193
+         * ```
194
+         * @since v0.3.3
195
+         * @param query A statement or query to write to `output`, prepended to the prompt.
196
+         * @param callback A callback function that is invoked with the user's input in response to the `query`.
197
+         */
198
+        question(query: string, callback: (answer: string) => void): void;
199
+        question(query: string, options: Abortable, callback: (answer: string) => void): void;
200
+        /**
201
+         * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed
202
+         * later if necessary.
203
+         *
204
+         * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `readline.Interface` instance.
205
+         * @since v0.3.4
206
+         */
207
+        pause(): this;
208
+        /**
209
+         * The `rl.resume()` method resumes the `input` stream if it has been paused.
210
+         * @since v0.3.4
211
+         */
212
+        resume(): this;
213
+        /**
214
+         * The `rl.close()` method closes the `readline.Interface` instance and
215
+         * relinquishes control over the `input` and `output` streams. When called,
216
+         * the `'close'` event will be emitted.
217
+         *
218
+         * Calling `rl.close()` does not immediately stop other events (including `'line'`)
219
+         * from being emitted by the `readline.Interface` instance.
220
+         * @since v0.1.98
221
+         */
222
+        close(): void;
223
+        /**
224
+         * The `rl.write()` method will write either `data` or a key sequence identified
225
+         * by `key` to the `output`. The `key` argument is supported only if `output` is
226
+         * a `TTY` text terminal. See `TTY keybindings` for a list of key
227
+         * combinations.
228
+         *
229
+         * If `key` is specified, `data` is ignored.
230
+         *
231
+         * When called, `rl.write()` will resume the `input` stream if it has been
232
+         * paused.
233
+         *
234
+         * If the `readline.Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written.
235
+         *
236
+         * ```js
237
+         * rl.write('Delete this!');
238
+         * // Simulate Ctrl+U to delete the line written previously
239
+         * rl.write(null, { ctrl: true, name: 'u' });
240
+         * ```
241
+         *
242
+         * The `rl.write()` method will write the data to the `readline` `Interface`'s`input`_as if it were provided by the user_.
243
+         * @since v0.1.98
244
+         */
245
+        write(data: string | Buffer, key?: Key): void;
246
+        write(data: undefined | null | string | Buffer, key: Key): void;
247
+        /**
248
+         * Returns the real position of the cursor in relation to the input
249
+         * prompt + string. Long input (wrapping) strings, as well as multiple
250
+         * line prompts are included in the calculations.
251
+         * @since v13.5.0, v12.16.0
252
+         */
253
+        getCursorPos(): CursorPos;
254
+        /**
255
+         * events.EventEmitter
256
+         * 1. close
257
+         * 2. line
258
+         * 3. pause
259
+         * 4. resume
260
+         * 5. SIGCONT
261
+         * 6. SIGINT
262
+         * 7. SIGTSTP
263
+         * 8. history
264
+         */
265
+        addListener(event: string, listener: (...args: any[]) => void): this;
266
+        addListener(event: 'close', listener: () => void): this;
267
+        addListener(event: 'line', listener: (input: string) => void): this;
268
+        addListener(event: 'pause', listener: () => void): this;
269
+        addListener(event: 'resume', listener: () => void): this;
270
+        addListener(event: 'SIGCONT', listener: () => void): this;
271
+        addListener(event: 'SIGINT', listener: () => void): this;
272
+        addListener(event: 'SIGTSTP', listener: () => void): this;
273
+        addListener(event: 'history', listener: (history: string[]) => void): this;
274
+        emit(event: string | symbol, ...args: any[]): boolean;
275
+        emit(event: 'close'): boolean;
276
+        emit(event: 'line', input: string): boolean;
277
+        emit(event: 'pause'): boolean;
278
+        emit(event: 'resume'): boolean;
279
+        emit(event: 'SIGCONT'): boolean;
280
+        emit(event: 'SIGINT'): boolean;
281
+        emit(event: 'SIGTSTP'): boolean;
282
+        emit(event: 'history', history: string[]): boolean;
283
+        on(event: string, listener: (...args: any[]) => void): this;
284
+        on(event: 'close', listener: () => void): this;
285
+        on(event: 'line', listener: (input: string) => void): this;
286
+        on(event: 'pause', listener: () => void): this;
287
+        on(event: 'resume', listener: () => void): this;
288
+        on(event: 'SIGCONT', listener: () => void): this;
289
+        on(event: 'SIGINT', listener: () => void): this;
290
+        on(event: 'SIGTSTP', listener: () => void): this;
291
+        on(event: 'history', listener: (history: string[]) => void): this;
292
+        once(event: string, listener: (...args: any[]) => void): this;
293
+        once(event: 'close', listener: () => void): this;
294
+        once(event: 'line', listener: (input: string) => void): this;
295
+        once(event: 'pause', listener: () => void): this;
296
+        once(event: 'resume', listener: () => void): this;
297
+        once(event: 'SIGCONT', listener: () => void): this;
298
+        once(event: 'SIGINT', listener: () => void): this;
299
+        once(event: 'SIGTSTP', listener: () => void): this;
300
+        once(event: 'history', listener: (history: string[]) => void): this;
301
+        prependListener(event: string, listener: (...args: any[]) => void): this;
302
+        prependListener(event: 'close', listener: () => void): this;
303
+        prependListener(event: 'line', listener: (input: string) => void): this;
304
+        prependListener(event: 'pause', listener: () => void): this;
305
+        prependListener(event: 'resume', listener: () => void): this;
306
+        prependListener(event: 'SIGCONT', listener: () => void): this;
307
+        prependListener(event: 'SIGINT', listener: () => void): this;
308
+        prependListener(event: 'SIGTSTP', listener: () => void): this;
309
+        prependListener(event: 'history', listener: (history: string[]) => void): this;
310
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
311
+        prependOnceListener(event: 'close', listener: () => void): this;
312
+        prependOnceListener(event: 'line', listener: (input: string) => void): this;
313
+        prependOnceListener(event: 'pause', listener: () => void): this;
314
+        prependOnceListener(event: 'resume', listener: () => void): this;
315
+        prependOnceListener(event: 'SIGCONT', listener: () => void): this;
316
+        prependOnceListener(event: 'SIGINT', listener: () => void): this;
317
+        prependOnceListener(event: 'SIGTSTP', listener: () => void): this;
318
+        prependOnceListener(event: 'history', listener: (history: string[]) => void): this;
319
+        [Symbol.asyncIterator](): AsyncIterableIterator<string>;
320
+    }
321
+    export type ReadLine = Interface; // type forwarded for backwards compatibility
322
+    export type Completer = (line: string) => CompleterResult;
323
+    export type AsyncCompleter = (line: string, callback: (err?: null | Error, result?: CompleterResult) => void) => void;
324
+    export type CompleterResult = [string[], string];
325
+    export interface ReadLineOptions {
326
+        input: NodeJS.ReadableStream;
327
+        output?: NodeJS.WritableStream | undefined;
328
+        completer?: Completer | AsyncCompleter | undefined;
329
+        terminal?: boolean | undefined;
330
+        /**
331
+         *  Initial list of history lines. This option makes sense
332
+         * only if `terminal` is set to `true` by the user or by an internal `output`
333
+         * check, otherwise the history caching mechanism is not initialized at all.
334
+         * @default []
335
+         */
336
+        history?: string[] | undefined;
337
+        historySize?: number | undefined;
338
+        prompt?: string | undefined;
339
+        crlfDelay?: number | undefined;
340
+        /**
341
+         * If `true`, when a new input line added
342
+         * to the history list duplicates an older one, this removes the older line
343
+         * from the list.
344
+         * @default false
345
+         */
346
+        removeHistoryDuplicates?: boolean | undefined;
347
+        escapeCodeTimeout?: number | undefined;
348
+        tabSize?: number | undefined;
349
+    }
350
+    /**
351
+     * The `readline.createInterface()` method creates a new `readline.Interface`instance.
352
+     *
353
+     * ```js
354
+     * const readline = require('readline');
355
+     * const rl = readline.createInterface({
356
+     *   input: process.stdin,
357
+     *   output: process.stdout
358
+     * });
359
+     * ```
360
+     *
361
+     * Once the `readline.Interface` instance is created, the most common case is to
362
+     * listen for the `'line'` event:
363
+     *
364
+     * ```js
365
+     * rl.on('line', (line) => {
366
+     *   console.log(`Received: ${line}`);
367
+     * });
368
+     * ```
369
+     *
370
+     * If `terminal` is `true` for this instance then the `output` stream will get
371
+     * the best compatibility if it defines an `output.columns` property and emits
372
+     * a `'resize'` event on the `output` if or when the columns ever change
373
+     * (`process.stdout` does this automatically when it is a TTY).
374
+     *
375
+     * When creating a `readline.Interface` using `stdin` as input, the program
376
+     * will not terminate until it receives `EOF` (Ctrl+D on
377
+     * Linux/macOS, Ctrl+Z followed by Return on
378
+     * Windows).
379
+     * If you want your application to exit without waiting for user input, you can `unref()` the standard input stream:
380
+     *
381
+     * ```js
382
+     * process.stdin.unref();
383
+     * ```
384
+     * @since v0.1.98
385
+     */
386
+    export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer | AsyncCompleter, terminal?: boolean): Interface;
387
+    export function createInterface(options: ReadLineOptions): Interface;
388
+    /**
389
+     * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input.
390
+     *
391
+     * Optionally, `interface` specifies a `readline.Interface` instance for which
392
+     * autocompletion is disabled when copy-pasted input is detected.
393
+     *
394
+     * If the `stream` is a `TTY`, then it must be in raw mode.
395
+     *
396
+     * This is automatically called by any readline instance on its `input` if the`input` is a terminal. Closing the `readline` instance does not stop
397
+     * the `input` from emitting `'keypress'` events.
398
+     *
399
+     * ```js
400
+     * readline.emitKeypressEvents(process.stdin);
401
+     * if (process.stdin.isTTY)
402
+     *   process.stdin.setRawMode(true);
403
+     * ```
404
+     *
405
+     * ## Example: Tiny CLI
406
+     *
407
+     * The following example illustrates the use of `readline.Interface` class to
408
+     * implement a small command-line interface:
409
+     *
410
+     * ```js
411
+     * const readline = require('readline');
412
+     * const rl = readline.createInterface({
413
+     *   input: process.stdin,
414
+     *   output: process.stdout,
415
+     *   prompt: 'OHAI> '
416
+     * });
417
+     *
418
+     * rl.prompt();
419
+     *
420
+     * rl.on('line', (line) => {
421
+     *   switch (line.trim()) {
422
+     *     case 'hello':
423
+     *       console.log('world!');
424
+     *       break;
425
+     *     default:
426
+     *       console.log(`Say what? I might have heard '${line.trim()}'`);
427
+     *       break;
428
+     *   }
429
+     *   rl.prompt();
430
+     * }).on('close', () => {
431
+     *   console.log('Have a great day!');
432
+     *   process.exit(0);
433
+     * });
434
+     * ```
435
+     *
436
+     * ## Example: Read file stream line-by-Line
437
+     *
438
+     * A common use case for `readline` is to consume an input file one line at a
439
+     * time. The easiest way to do so is leveraging the `fs.ReadStream` API as
440
+     * well as a `for await...of` loop:
441
+     *
442
+     * ```js
443
+     * const fs = require('fs');
444
+     * const readline = require('readline');
445
+     *
446
+     * async function processLineByLine() {
447
+     *   const fileStream = fs.createReadStream('input.txt');
448
+     *
449
+     *   const rl = readline.createInterface({
450
+     *     input: fileStream,
451
+     *     crlfDelay: Infinity
452
+     *   });
453
+     *   // Note: we use the crlfDelay option to recognize all instances of CR LF
454
+     *   // ('\r\n') in input.txt as a single line break.
455
+     *
456
+     *   for await (const line of rl) {
457
+     *     // Each line in input.txt will be successively available here as `line`.
458
+     *     console.log(`Line from file: ${line}`);
459
+     *   }
460
+     * }
461
+     *
462
+     * processLineByLine();
463
+     * ```
464
+     *
465
+     * Alternatively, one could use the `'line'` event:
466
+     *
467
+     * ```js
468
+     * const fs = require('fs');
469
+     * const readline = require('readline');
470
+     *
471
+     * const rl = readline.createInterface({
472
+     *   input: fs.createReadStream('sample.txt'),
473
+     *   crlfDelay: Infinity
474
+     * });
475
+     *
476
+     * rl.on('line', (line) => {
477
+     *   console.log(`Line from file: ${line}`);
478
+     * });
479
+     * ```
480
+     *
481
+     * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
482
+     *
483
+     * ```js
484
+     * const { once } = require('events');
485
+     * const { createReadStream } = require('fs');
486
+     * const { createInterface } = require('readline');
487
+     *
488
+     * (async function processLineByLine() {
489
+     *   try {
490
+     *     const rl = createInterface({
491
+     *       input: createReadStream('big-file.txt'),
492
+     *       crlfDelay: Infinity
493
+     *     });
494
+     *
495
+     *     rl.on('line', (line) => {
496
+     *       // Process the line.
497
+     *     });
498
+     *
499
+     *     await once(rl, 'close');
500
+     *
501
+     *     console.log('File processed.');
502
+     *   } catch (err) {
503
+     *     console.error(err);
504
+     *   }
505
+     * })();
506
+     * ```
507
+     * @since v0.7.7
508
+     */
509
+    export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void;
510
+    export type Direction = -1 | 0 | 1;
511
+    export interface CursorPos {
512
+        rows: number;
513
+        cols: number;
514
+    }
515
+    /**
516
+     * The `readline.clearLine()` method clears current line of given `TTY` stream
517
+     * in a specified direction identified by `dir`.
518
+     * @since v0.7.7
519
+     * @param callback Invoked once the operation completes.
520
+     * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
521
+     */
522
+    export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean;
523
+    /**
524
+     * The `readline.clearScreenDown()` method clears the given `TTY` stream from
525
+     * the current position of the cursor down.
526
+     * @since v0.7.7
527
+     * @param callback Invoked once the operation completes.
528
+     * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
529
+     */
530
+    export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean;
531
+    /**
532
+     * The `readline.cursorTo()` method moves cursor to the specified position in a
533
+     * given `TTY` `stream`.
534
+     * @since v0.7.7
535
+     * @param callback Invoked once the operation completes.
536
+     * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
537
+     */
538
+    export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean;
539
+    /**
540
+     * The `readline.moveCursor()` method moves the cursor _relative_ to its current
541
+     * position in a given `TTY` `stream`.
542
+     *
543
+     * ## Example: Tiny CLI
544
+     *
545
+     * The following example illustrates the use of `readline.Interface` class to
546
+     * implement a small command-line interface:
547
+     *
548
+     * ```js
549
+     * const readline = require('readline');
550
+     * const rl = readline.createInterface({
551
+     *   input: process.stdin,
552
+     *   output: process.stdout,
553
+     *   prompt: 'OHAI> '
554
+     * });
555
+     *
556
+     * rl.prompt();
557
+     *
558
+     * rl.on('line', (line) => {
559
+     *   switch (line.trim()) {
560
+     *     case 'hello':
561
+     *       console.log('world!');
562
+     *       break;
563
+     *     default:
564
+     *       console.log(`Say what? I might have heard '${line.trim()}'`);
565
+     *       break;
566
+     *   }
567
+     *   rl.prompt();
568
+     * }).on('close', () => {
569
+     *   console.log('Have a great day!');
570
+     *   process.exit(0);
571
+     * });
572
+     * ```
573
+     *
574
+     * ## Example: Read file stream line-by-Line
575
+     *
576
+     * A common use case for `readline` is to consume an input file one line at a
577
+     * time. The easiest way to do so is leveraging the `fs.ReadStream` API as
578
+     * well as a `for await...of` loop:
579
+     *
580
+     * ```js
581
+     * const fs = require('fs');
582
+     * const readline = require('readline');
583
+     *
584
+     * async function processLineByLine() {
585
+     *   const fileStream = fs.createReadStream('input.txt');
586
+     *
587
+     *   const rl = readline.createInterface({
588
+     *     input: fileStream,
589
+     *     crlfDelay: Infinity
590
+     *   });
591
+     *   // Note: we use the crlfDelay option to recognize all instances of CR LF
592
+     *   // ('\r\n') in input.txt as a single line break.
593
+     *
594
+     *   for await (const line of rl) {
595
+     *     // Each line in input.txt will be successively available here as `line`.
596
+     *     console.log(`Line from file: ${line}`);
597
+     *   }
598
+     * }
599
+     *
600
+     * processLineByLine();
601
+     * ```
602
+     *
603
+     * Alternatively, one could use the `'line'` event:
604
+     *
605
+     * ```js
606
+     * const fs = require('fs');
607
+     * const readline = require('readline');
608
+     *
609
+     * const rl = readline.createInterface({
610
+     *   input: fs.createReadStream('sample.txt'),
611
+     *   crlfDelay: Infinity
612
+     * });
613
+     *
614
+     * rl.on('line', (line) => {
615
+     *   console.log(`Line from file: ${line}`);
616
+     * });
617
+     * ```
618
+     *
619
+     * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied:
620
+     *
621
+     * ```js
622
+     * const { once } = require('events');
623
+     * const { createReadStream } = require('fs');
624
+     * const { createInterface } = require('readline');
625
+     *
626
+     * (async function processLineByLine() {
627
+     *   try {
628
+     *     const rl = createInterface({
629
+     *       input: createReadStream('big-file.txt'),
630
+     *       crlfDelay: Infinity
631
+     *     });
632
+     *
633
+     *     rl.on('line', (line) => {
634
+     *       // Process the line.
635
+     *     });
636
+     *
637
+     *     await once(rl, 'close');
638
+     *
639
+     *     console.log('File processed.');
640
+     *   } catch (err) {
641
+     *     console.error(err);
642
+     *   }
643
+     * })();
644
+     * ```
645
+     * @since v0.7.7
646
+     * @param callback Invoked once the operation completes.
647
+     * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`.
648
+     */
649
+    export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean;
650
+}
651
+declare module 'node:readline' {
652
+    export * from 'readline';
653
+}

+ 143
- 0
node_modules/@types/node/readline/promises.d.ts 查看文件

@@ -0,0 +1,143 @@
1
+/**
2
+ * The `readline/promise` module provides an API for reading lines of input from a Readable stream one line at a time.
3
+ *
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/readline/promises.js)
5
+ * @since v17.0.0
6
+ */
7
+declare module 'readline/promises' {
8
+    import { Interface as _Interface, ReadLineOptions, Completer, AsyncCompleter, Direction } from 'node:readline';
9
+    import { Abortable } from 'node:events';
10
+
11
+    class Interface extends _Interface {
12
+        /**
13
+         * The rl.question() method displays the query by writing it to the output, waits for user input to be provided on input,
14
+         * then invokes the callback function passing the provided input as the first argument.
15
+         *
16
+         * When called, rl.question() will resume the input stream if it has been paused.
17
+         *
18
+         * If the readlinePromises.Interface was created with output set to null or undefined the query is not written.
19
+         *
20
+         * If the question is called after rl.close(), it returns a rejected promise.
21
+         *
22
+         * Example usage:
23
+         *
24
+         * ```js
25
+         * const answer = await rl.question('What is your favorite food? ');
26
+         * console.log(`Oh, so your favorite food is ${answer}`);
27
+         * ```
28
+         *
29
+         * Using an AbortSignal to cancel a question.
30
+         *
31
+         * ```js
32
+         * const signal = AbortSignal.timeout(10_000);
33
+         *
34
+         * signal.addEventListener('abort', () => {
35
+         *   console.log('The food question timed out');
36
+         * }, { once: true });
37
+         *
38
+         * const answer = await rl.question('What is your favorite food? ', { signal });
39
+         * console.log(`Oh, so your favorite food is ${answer}`);
40
+         * ```
41
+         *
42
+         * @since v17.0.0
43
+         * @param query A statement or query to write to output, prepended to the prompt.
44
+         */
45
+        question(query: string): Promise<string>;
46
+        question(query: string, options: Abortable): Promise<string>;
47
+    }
48
+
49
+    class Readline {
50
+        /**
51
+         * @param stream A TTY stream.
52
+         */
53
+        constructor(stream: NodeJS.WritableStream, options?: { autoCommit?: boolean });
54
+        /**
55
+         * The `rl.clearLine()` method adds to the internal list of pending action an action that clears current line of the associated `stream` in a specified direction identified by `dir`.
56
+         * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
57
+         */
58
+        clearLine(dir: Direction): this;
59
+        /**
60
+         * The `rl.clearScreenDown()` method adds to the internal list of pending action an action that clears the associated `stream` from the current position of the cursor down.
61
+         * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
62
+         */
63
+        clearScreenDown(): this;
64
+        /**
65
+         * The `rl.commit()` method sends all the pending actions to the associated `stream` and clears the internal list of pending actions.
66
+         */
67
+        commit(): Promise<void>;
68
+        /**
69
+         * The `rl.cursorTo()` method adds to the internal list of pending action an action that moves cursor to the specified position in the associated `stream`.
70
+         * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true` was passed to the constructor.
71
+         */
72
+        cursorTo(x: number, y?: number): this;
73
+        /**
74
+         * The `rl.moveCursor()` method adds to the internal list of pending action an action that moves the cursor relative to its current position in the associated `stream`.
75
+         * Call `rl.commit()` to see the effect of this method, unless autoCommit: true was passed to the constructor.
76
+         */
77
+        moveCursor(dx: number, dy: number): this;
78
+        /**
79
+         * The `rl.rollback()` method clears the internal list of pending actions without sending it to the associated `stream`.
80
+         */
81
+        rollback(): this;
82
+    }
83
+
84
+    /**
85
+     * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface` instance.
86
+     *
87
+     * ```js
88
+     * const readlinePromises = require('node:readline/promises');
89
+     * const rl = readlinePromises.createInterface({
90
+     *   input: process.stdin,
91
+     *   output: process.stdout
92
+     * });
93
+     * ```
94
+     *
95
+     * Once the `readlinePromises.Interface` instance is created, the most common case is to listen for the `'line'` event:
96
+     *
97
+     * ```js
98
+     * rl.on('line', (line) => {
99
+     *   console.log(`Received: ${line}`);
100
+     * });
101
+     * ```
102
+     *
103
+     * If `terminal` is `true` for this instance then the `output` stream will get the best compatibility if it defines an `output.columns` property,
104
+     * and emits a `'resize'` event on the `output`, if or when the columns ever change (`process.stdout` does this automatically when it is a TTY).
105
+     *
106
+     * ## Use of the `completer` function
107
+     *
108
+     * The `completer` function takes the current line entered by the user as an argument, and returns an `Array` with 2 entries:
109
+     *
110
+     * - An Array with matching entries for the completion.
111
+     * - The substring that was used for the matching.
112
+     *
113
+     * For instance: `[[substr1, substr2, ...], originalsubstring]`.
114
+     *
115
+     * ```js
116
+     * function completer(line) {
117
+     *   const completions = '.help .error .exit .quit .q'.split(' ');
118
+     *   const hits = completions.filter((c) => c.startsWith(line));
119
+     *   // Show all completions if none found
120
+     *   return [hits.length ? hits : completions, line];
121
+     * }
122
+     * ```
123
+     *
124
+     * The `completer` function can also returns a `Promise`, or be asynchronous:
125
+     *
126
+     * ```js
127
+     * async function completer(linePartial) {
128
+     *   await someAsyncWork();
129
+     *   return [['123'], linePartial];
130
+     * }
131
+     * ```
132
+     */
133
+    function createInterface(
134
+        input: NodeJS.ReadableStream,
135
+        output?: NodeJS.WritableStream,
136
+        completer?: Completer | AsyncCompleter,
137
+        terminal?: boolean,
138
+    ): Interface;
139
+    function createInterface(options: ReadLineOptions): Interface;
140
+}
141
+declare module 'node:readline/promises' {
142
+    export * from 'readline/promises';
143
+}

+ 424
- 0
node_modules/@types/node/repl.d.ts 查看文件

@@ -0,0 +1,424 @@
1
+/**
2
+ * The `repl` module provides a Read-Eval-Print-Loop (REPL) implementation that
3
+ * is available both as a standalone program or includible in other applications.
4
+ * It can be accessed using:
5
+ *
6
+ * ```js
7
+ * const repl = require('repl');
8
+ * ```
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/repl.js)
10
+ */
11
+declare module 'repl' {
12
+    import { Interface, Completer, AsyncCompleter } from 'node:readline';
13
+    import { Context } from 'node:vm';
14
+    import { InspectOptions } from 'node:util';
15
+    interface ReplOptions {
16
+        /**
17
+         * The input prompt to display.
18
+         * @default "> "
19
+         */
20
+        prompt?: string | undefined;
21
+        /**
22
+         * The `Readable` stream from which REPL input will be read.
23
+         * @default process.stdin
24
+         */
25
+        input?: NodeJS.ReadableStream | undefined;
26
+        /**
27
+         * The `Writable` stream to which REPL output will be written.
28
+         * @default process.stdout
29
+         */
30
+        output?: NodeJS.WritableStream | undefined;
31
+        /**
32
+         * If `true`, specifies that the output should be treated as a TTY terminal, and have
33
+         * ANSI/VT100 escape codes written to it.
34
+         * Default: checking the value of the `isTTY` property on the output stream upon
35
+         * instantiation.
36
+         */
37
+        terminal?: boolean | undefined;
38
+        /**
39
+         * The function to be used when evaluating each given line of input.
40
+         * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
41
+         * error with `repl.Recoverable` to indicate the input was incomplete and prompt for
42
+         * additional lines.
43
+         *
44
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation
45
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
46
+         */
47
+        eval?: REPLEval | undefined;
48
+        /**
49
+         * Defines if the repl prints output previews or not.
50
+         * @default `true` Always `false` in case `terminal` is falsy.
51
+         */
52
+        preview?: boolean | undefined;
53
+        /**
54
+         * If `true`, specifies that the default `writer` function should include ANSI color
55
+         * styling to REPL output. If a custom `writer` function is provided then this has no
56
+         * effect.
57
+         * Default: the REPL instance's `terminal` value.
58
+         */
59
+        useColors?: boolean | undefined;
60
+        /**
61
+         * If `true`, specifies that the default evaluation function will use the JavaScript
62
+         * `global` as the context as opposed to creating a new separate context for the REPL
63
+         * instance. The node CLI REPL sets this value to `true`.
64
+         * Default: `false`.
65
+         */
66
+        useGlobal?: boolean | undefined;
67
+        /**
68
+         * If `true`, specifies that the default writer will not output the return value of a
69
+         * command if it evaluates to `undefined`.
70
+         * Default: `false`.
71
+         */
72
+        ignoreUndefined?: boolean | undefined;
73
+        /**
74
+         * The function to invoke to format the output of each command before writing to `output`.
75
+         * Default: a wrapper for `util.inspect`.
76
+         *
77
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
78
+         */
79
+        writer?: REPLWriter | undefined;
80
+        /**
81
+         * An optional function used for custom Tab auto completion.
82
+         *
83
+         * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
84
+         */
85
+        completer?: Completer | AsyncCompleter | undefined;
86
+        /**
87
+         * A flag that specifies whether the default evaluator executes all JavaScript commands in
88
+         * strict mode or default (sloppy) mode.
89
+         * Accepted values are:
90
+         * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
91
+         * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
92
+         *   prefacing every repl statement with `'use strict'`.
93
+         */
94
+        replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined;
95
+        /**
96
+         * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is
97
+         * pressed. This cannot be used together with a custom `eval` function.
98
+         * Default: `false`.
99
+         */
100
+        breakEvalOnSigint?: boolean | undefined;
101
+    }
102
+    type REPLEval = (this: REPLServer, evalCmd: string, context: Context, file: string, cb: (err: Error | null, result: any) => void) => void;
103
+    type REPLWriter = (this: REPLServer, obj: any) => string;
104
+    /**
105
+     * This is the default "writer" value, if none is passed in the REPL options,
106
+     * and it can be overridden by custom print functions.
107
+     */
108
+    const writer: REPLWriter & {
109
+        options: InspectOptions;
110
+    };
111
+    type REPLCommandAction = (this: REPLServer, text: string) => void;
112
+    interface REPLCommand {
113
+        /**
114
+         * Help text to be displayed when `.help` is entered.
115
+         */
116
+        help?: string | undefined;
117
+        /**
118
+         * The function to execute, optionally accepting a single string argument.
119
+         */
120
+        action: REPLCommandAction;
121
+    }
122
+    /**
123
+     * Instances of `repl.REPLServer` are created using the {@link start} method
124
+     * or directly using the JavaScript `new` keyword.
125
+     *
126
+     * ```js
127
+     * const repl = require('repl');
128
+     *
129
+     * const options = { useColors: true };
130
+     *
131
+     * const firstInstance = repl.start(options);
132
+     * const secondInstance = new repl.REPLServer(options);
133
+     * ```
134
+     * @since v0.1.91
135
+     */
136
+    class REPLServer extends Interface {
137
+        /**
138
+         * The `vm.Context` provided to the `eval` function to be used for JavaScript
139
+         * evaluation.
140
+         */
141
+        readonly context: Context;
142
+        /**
143
+         * @deprecated since v14.3.0 - Use `input` instead.
144
+         */
145
+        readonly inputStream: NodeJS.ReadableStream;
146
+        /**
147
+         * @deprecated since v14.3.0 - Use `output` instead.
148
+         */
149
+        readonly outputStream: NodeJS.WritableStream;
150
+        /**
151
+         * The `Readable` stream from which REPL input will be read.
152
+         */
153
+        readonly input: NodeJS.ReadableStream;
154
+        /**
155
+         * The `Writable` stream to which REPL output will be written.
156
+         */
157
+        readonly output: NodeJS.WritableStream;
158
+        /**
159
+         * The commands registered via `replServer.defineCommand()`.
160
+         */
161
+        readonly commands: NodeJS.ReadOnlyDict<REPLCommand>;
162
+        /**
163
+         * A value indicating whether the REPL is currently in "editor mode".
164
+         *
165
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys
166
+         */
167
+        readonly editorMode: boolean;
168
+        /**
169
+         * A value indicating whether the `_` variable has been assigned.
170
+         *
171
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
172
+         */
173
+        readonly underscoreAssigned: boolean;
174
+        /**
175
+         * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
176
+         *
177
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
178
+         */
179
+        readonly last: any;
180
+        /**
181
+         * A value indicating whether the `_error` variable has been assigned.
182
+         *
183
+         * @since v9.8.0
184
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
185
+         */
186
+        readonly underscoreErrAssigned: boolean;
187
+        /**
188
+         * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
189
+         *
190
+         * @since v9.8.0
191
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
192
+         */
193
+        readonly lastError: any;
194
+        /**
195
+         * Specified in the REPL options, this is the function to be used when evaluating each
196
+         * given line of input. If not specified in the REPL options, this is an async wrapper
197
+         * for the JavaScript `eval()` function.
198
+         */
199
+        readonly eval: REPLEval;
200
+        /**
201
+         * Specified in the REPL options, this is a value indicating whether the default
202
+         * `writer` function should include ANSI color styling to REPL output.
203
+         */
204
+        readonly useColors: boolean;
205
+        /**
206
+         * Specified in the REPL options, this is a value indicating whether the default `eval`
207
+         * function will use the JavaScript `global` as the context as opposed to creating a new
208
+         * separate context for the REPL instance.
209
+         */
210
+        readonly useGlobal: boolean;
211
+        /**
212
+         * Specified in the REPL options, this is a value indicating whether the default `writer`
213
+         * function should output the result of a command if it evaluates to `undefined`.
214
+         */
215
+        readonly ignoreUndefined: boolean;
216
+        /**
217
+         * Specified in the REPL options, this is the function to invoke to format the output of
218
+         * each command before writing to `outputStream`. If not specified in the REPL options,
219
+         * this will be a wrapper for `util.inspect`.
220
+         */
221
+        readonly writer: REPLWriter;
222
+        /**
223
+         * Specified in the REPL options, this is the function to use for custom Tab auto-completion.
224
+         */
225
+        readonly completer: Completer | AsyncCompleter;
226
+        /**
227
+         * Specified in the REPL options, this is a flag that specifies whether the default `eval`
228
+         * function should execute all JavaScript commands in strict mode or default (sloppy) mode.
229
+         * Possible values are:
230
+         * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
231
+         * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
232
+         *    prefacing every repl statement with `'use strict'`.
233
+         */
234
+        readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT;
235
+        /**
236
+         * NOTE: According to the documentation:
237
+         *
238
+         * > Instances of `repl.REPLServer` are created using the `repl.start()` method and
239
+         * > _should not_ be created directly using the JavaScript `new` keyword.
240
+         *
241
+         * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
242
+         *
243
+         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
244
+         */
245
+        private constructor();
246
+        /**
247
+         * The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands
248
+         * to the REPL instance. Such commands are invoked by typing a `.` followed by the`keyword`. The `cmd` is either a `Function` or an `Object` with the following
249
+         * properties:
250
+         *
251
+         * The following example shows two new commands added to the REPL instance:
252
+         *
253
+         * ```js
254
+         * const repl = require('repl');
255
+         *
256
+         * const replServer = repl.start({ prompt: '> ' });
257
+         * replServer.defineCommand('sayhello', {
258
+         *   help: 'Say hello',
259
+         *   action(name) {
260
+         *     this.clearBufferedCommand();
261
+         *     console.log(`Hello, ${name}!`);
262
+         *     this.displayPrompt();
263
+         *   }
264
+         * });
265
+         * replServer.defineCommand('saybye', function saybye() {
266
+         *   console.log('Goodbye!');
267
+         *   this.close();
268
+         * });
269
+         * ```
270
+         *
271
+         * The new commands can then be used from within the REPL instance:
272
+         *
273
+         * ```console
274
+         * > .sayhello Node.js User
275
+         * Hello, Node.js User!
276
+         * > .saybye
277
+         * Goodbye!
278
+         * ```
279
+         * @since v0.3.0
280
+         * @param keyword The command keyword (_without_ a leading `.` character).
281
+         * @param cmd The function to invoke when the command is processed.
282
+         */
283
+        defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void;
284
+        /**
285
+         * The `replServer.displayPrompt()` method readies the REPL instance for input
286
+         * from the user, printing the configured `prompt` to a new line in the `output`and resuming the `input` to accept new input.
287
+         *
288
+         * When multi-line input is being entered, an ellipsis is printed rather than the
289
+         * 'prompt'.
290
+         *
291
+         * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`.
292
+         *
293
+         * The `replServer.displayPrompt` method is primarily intended to be called from
294
+         * within the action function for commands registered using the`replServer.defineCommand()` method.
295
+         * @since v0.1.91
296
+         */
297
+        displayPrompt(preserveCursor?: boolean): void;
298
+        /**
299
+         * The `replServer.clearBufferedCommand()` method clears any command that has been
300
+         * buffered but not yet executed. This method is primarily intended to be
301
+         * called from within the action function for commands registered using the`replServer.defineCommand()` method.
302
+         * @since v9.0.0
303
+         */
304
+        clearBufferedCommand(): void;
305
+        /**
306
+         * Initializes a history log file for the REPL instance. When executing the
307
+         * Node.js binary and using the command-line REPL, a history file is initialized
308
+         * by default. However, this is not the case when creating a REPL
309
+         * programmatically. Use this method to initialize a history log file when working
310
+         * with REPL instances programmatically.
311
+         * @since v11.10.0
312
+         * @param historyPath the path to the history file
313
+         * @param callback called when history writes are ready or upon error
314
+         */
315
+        setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void;
316
+        /**
317
+         * events.EventEmitter
318
+         * 1. close - inherited from `readline.Interface`
319
+         * 2. line - inherited from `readline.Interface`
320
+         * 3. pause - inherited from `readline.Interface`
321
+         * 4. resume - inherited from `readline.Interface`
322
+         * 5. SIGCONT - inherited from `readline.Interface`
323
+         * 6. SIGINT - inherited from `readline.Interface`
324
+         * 7. SIGTSTP - inherited from `readline.Interface`
325
+         * 8. exit
326
+         * 9. reset
327
+         */
328
+        addListener(event: string, listener: (...args: any[]) => void): this;
329
+        addListener(event: 'close', listener: () => void): this;
330
+        addListener(event: 'line', listener: (input: string) => void): this;
331
+        addListener(event: 'pause', listener: () => void): this;
332
+        addListener(event: 'resume', listener: () => void): this;
333
+        addListener(event: 'SIGCONT', listener: () => void): this;
334
+        addListener(event: 'SIGINT', listener: () => void): this;
335
+        addListener(event: 'SIGTSTP', listener: () => void): this;
336
+        addListener(event: 'exit', listener: () => void): this;
337
+        addListener(event: 'reset', listener: (context: Context) => void): this;
338
+        emit(event: string | symbol, ...args: any[]): boolean;
339
+        emit(event: 'close'): boolean;
340
+        emit(event: 'line', input: string): boolean;
341
+        emit(event: 'pause'): boolean;
342
+        emit(event: 'resume'): boolean;
343
+        emit(event: 'SIGCONT'): boolean;
344
+        emit(event: 'SIGINT'): boolean;
345
+        emit(event: 'SIGTSTP'): boolean;
346
+        emit(event: 'exit'): boolean;
347
+        emit(event: 'reset', context: Context): boolean;
348
+        on(event: string, listener: (...args: any[]) => void): this;
349
+        on(event: 'close', listener: () => void): this;
350
+        on(event: 'line', listener: (input: string) => void): this;
351
+        on(event: 'pause', listener: () => void): this;
352
+        on(event: 'resume', listener: () => void): this;
353
+        on(event: 'SIGCONT', listener: () => void): this;
354
+        on(event: 'SIGINT', listener: () => void): this;
355
+        on(event: 'SIGTSTP', listener: () => void): this;
356
+        on(event: 'exit', listener: () => void): this;
357
+        on(event: 'reset', listener: (context: Context) => void): this;
358
+        once(event: string, listener: (...args: any[]) => void): this;
359
+        once(event: 'close', listener: () => void): this;
360
+        once(event: 'line', listener: (input: string) => void): this;
361
+        once(event: 'pause', listener: () => void): this;
362
+        once(event: 'resume', listener: () => void): this;
363
+        once(event: 'SIGCONT', listener: () => void): this;
364
+        once(event: 'SIGINT', listener: () => void): this;
365
+        once(event: 'SIGTSTP', listener: () => void): this;
366
+        once(event: 'exit', listener: () => void): this;
367
+        once(event: 'reset', listener: (context: Context) => void): this;
368
+        prependListener(event: string, listener: (...args: any[]) => void): this;
369
+        prependListener(event: 'close', listener: () => void): this;
370
+        prependListener(event: 'line', listener: (input: string) => void): this;
371
+        prependListener(event: 'pause', listener: () => void): this;
372
+        prependListener(event: 'resume', listener: () => void): this;
373
+        prependListener(event: 'SIGCONT', listener: () => void): this;
374
+        prependListener(event: 'SIGINT', listener: () => void): this;
375
+        prependListener(event: 'SIGTSTP', listener: () => void): this;
376
+        prependListener(event: 'exit', listener: () => void): this;
377
+        prependListener(event: 'reset', listener: (context: Context) => void): this;
378
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
379
+        prependOnceListener(event: 'close', listener: () => void): this;
380
+        prependOnceListener(event: 'line', listener: (input: string) => void): this;
381
+        prependOnceListener(event: 'pause', listener: () => void): this;
382
+        prependOnceListener(event: 'resume', listener: () => void): this;
383
+        prependOnceListener(event: 'SIGCONT', listener: () => void): this;
384
+        prependOnceListener(event: 'SIGINT', listener: () => void): this;
385
+        prependOnceListener(event: 'SIGTSTP', listener: () => void): this;
386
+        prependOnceListener(event: 'exit', listener: () => void): this;
387
+        prependOnceListener(event: 'reset', listener: (context: Context) => void): this;
388
+    }
389
+    /**
390
+     * A flag passed in the REPL options. Evaluates expressions in sloppy mode.
391
+     */
392
+    const REPL_MODE_SLOPPY: unique symbol;
393
+    /**
394
+     * A flag passed in the REPL options. Evaluates expressions in strict mode.
395
+     * This is equivalent to prefacing every repl statement with `'use strict'`.
396
+     */
397
+    const REPL_MODE_STRICT: unique symbol;
398
+    /**
399
+     * The `repl.start()` method creates and starts a {@link REPLServer} instance.
400
+     *
401
+     * If `options` is a string, then it specifies the input prompt:
402
+     *
403
+     * ```js
404
+     * const repl = require('repl');
405
+     *
406
+     * // a Unix style prompt
407
+     * repl.start('$ ');
408
+     * ```
409
+     * @since v0.1.91
410
+     */
411
+    function start(options?: string | ReplOptions): REPLServer;
412
+    /**
413
+     * Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
414
+     *
415
+     * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors
416
+     */
417
+    class Recoverable extends SyntaxError {
418
+        err: Error;
419
+        constructor(err: Error);
420
+    }
421
+}
422
+declare module 'node:repl' {
423
+    export * from 'repl';
424
+}

+ 1340
- 0
node_modules/@types/node/stream.d.ts
文件差異過大導致無法顯示
查看文件


+ 12
- 0
node_modules/@types/node/stream/consumers.d.ts 查看文件

@@ -0,0 +1,12 @@
1
+declare module 'stream/consumers' {
2
+    import { Blob as NodeBlob } from "node:buffer";
3
+    import { Readable } from 'node:stream';
4
+    function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<Buffer>;
5
+    function text(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<string>;
6
+    function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<ArrayBuffer>;
7
+    function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<NodeBlob>;
8
+    function json(stream: NodeJS.ReadableStream | Readable | AsyncIterator<any>): Promise<unknown>;
9
+}
10
+declare module 'node:stream/consumers' {
11
+    export * from 'stream/consumers';
12
+}

+ 42
- 0
node_modules/@types/node/stream/promises.d.ts 查看文件

@@ -0,0 +1,42 @@
1
+declare module 'stream/promises' {
2
+    import { FinishedOptions, PipelineSource, PipelineTransform, PipelineDestination, PipelinePromise, PipelineOptions } from 'node:stream';
3
+    function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, options?: FinishedOptions): Promise<void>;
4
+    function pipeline<A extends PipelineSource<any>, B extends PipelineDestination<A, any>>(source: A, destination: B, options?: PipelineOptions): PipelinePromise<B>;
5
+    function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, B extends PipelineDestination<T1, any>>(
6
+        source: A,
7
+        transform1: T1,
8
+        destination: B,
9
+        options?: PipelineOptions
10
+    ): PipelinePromise<B>;
11
+    function pipeline<A extends PipelineSource<any>, T1 extends PipelineTransform<A, any>, T2 extends PipelineTransform<T1, any>, B extends PipelineDestination<T2, any>>(
12
+        source: A,
13
+        transform1: T1,
14
+        transform2: T2,
15
+        destination: B,
16
+        options?: PipelineOptions
17
+    ): PipelinePromise<B>;
18
+    function pipeline<
19
+        A extends PipelineSource<any>,
20
+        T1 extends PipelineTransform<A, any>,
21
+        T2 extends PipelineTransform<T1, any>,
22
+        T3 extends PipelineTransform<T2, any>,
23
+        B extends PipelineDestination<T3, any>
24
+    >(source: A, transform1: T1, transform2: T2, transform3: T3, destination: B, options?: PipelineOptions): PipelinePromise<B>;
25
+    function pipeline<
26
+        A extends PipelineSource<any>,
27
+        T1 extends PipelineTransform<A, any>,
28
+        T2 extends PipelineTransform<T1, any>,
29
+        T3 extends PipelineTransform<T2, any>,
30
+        T4 extends PipelineTransform<T3, any>,
31
+        B extends PipelineDestination<T4, any>
32
+    >(source: A, transform1: T1, transform2: T2, transform3: T3, transform4: T4, destination: B, options?: PipelineOptions): PipelinePromise<B>;
33
+    function pipeline(streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream>, options?: PipelineOptions): Promise<void>;
34
+    function pipeline(
35
+        stream1: NodeJS.ReadableStream,
36
+        stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream,
37
+        ...streams: Array<NodeJS.ReadWriteStream | NodeJS.WritableStream | PipelineOptions>
38
+    ): Promise<void>;
39
+}
40
+declare module 'node:stream/promises' {
41
+    export * from 'stream/promises';
42
+}

+ 330
- 0
node_modules/@types/node/stream/web.d.ts 查看文件

@@ -0,0 +1,330 @@
1
+declare module 'stream/web' {
2
+    // stub module, pending copy&paste from .d.ts or manual impl
3
+    // copy from lib.dom.d.ts
4
+    interface ReadableWritablePair<R = any, W = any> {
5
+        readable: ReadableStream<R>;
6
+        /**
7
+         * Provides a convenient, chainable way of piping this readable stream
8
+         * through a transform stream (or any other { writable, readable }
9
+         * pair). It simply pipes the stream into the writable side of the
10
+         * supplied pair, and returns the readable side for further use.
11
+         *
12
+         * Piping a stream will lock it for the duration of the pipe, preventing
13
+         * any other consumer from acquiring a reader.
14
+         */
15
+        writable: WritableStream<W>;
16
+    }
17
+    interface StreamPipeOptions {
18
+        preventAbort?: boolean;
19
+        preventCancel?: boolean;
20
+        /**
21
+         * Pipes this readable stream to a given writable stream destination.
22
+         * The way in which the piping process behaves under various error
23
+         * conditions can be customized with a number of passed options. It
24
+         * returns a promise that fulfills when the piping process completes
25
+         * successfully, or rejects if any errors were encountered.
26
+         *
27
+         * Piping a stream will lock it for the duration of the pipe, preventing
28
+         * any other consumer from acquiring a reader.
29
+         *
30
+         * Errors and closures of the source and destination streams propagate
31
+         * as follows:
32
+         *
33
+         * An error in this source readable stream will abort destination,
34
+         * unless preventAbort is truthy. The returned promise will be rejected
35
+         * with the source's error, or with any error that occurs during
36
+         * aborting the destination.
37
+         *
38
+         * An error in destination will cancel this source readable stream,
39
+         * unless preventCancel is truthy. The returned promise will be rejected
40
+         * with the destination's error, or with any error that occurs during
41
+         * canceling the source.
42
+         *
43
+         * When this source readable stream closes, destination will be closed,
44
+         * unless preventClose is truthy. The returned promise will be fulfilled
45
+         * once this process completes, unless an error is encountered while
46
+         * closing the destination, in which case it will be rejected with that
47
+         * error.
48
+         *
49
+         * If destination starts out closed or closing, this source readable
50
+         * stream will be canceled, unless preventCancel is true. The returned
51
+         * promise will be rejected with an error indicating piping to a closed
52
+         * stream failed, or with any error that occurs during canceling the
53
+         * source.
54
+         *
55
+         * The signal option can be set to an AbortSignal to allow aborting an
56
+         * ongoing pipe operation via the corresponding AbortController. In this
57
+         * case, this source readable stream will be canceled, and destination
58
+         * aborted, unless the respective options preventCancel or preventAbort
59
+         * are set.
60
+         */
61
+        preventClose?: boolean;
62
+        signal?: AbortSignal;
63
+    }
64
+    interface ReadableStreamGenericReader {
65
+        readonly closed: Promise<undefined>;
66
+        cancel(reason?: any): Promise<void>;
67
+    }
68
+    interface ReadableStreamDefaultReadValueResult<T> {
69
+        done: false;
70
+        value: T;
71
+    }
72
+    interface ReadableStreamDefaultReadDoneResult {
73
+        done: true;
74
+        value?: undefined;
75
+    }
76
+    type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
77
+    type ReadableStreamDefaultReadResult<T> = ReadableStreamDefaultReadValueResult<T> | ReadableStreamDefaultReadDoneResult;
78
+    interface ReadableByteStreamControllerCallback {
79
+        (controller: ReadableByteStreamController): void | PromiseLike<void>;
80
+    }
81
+    interface UnderlyingSinkAbortCallback {
82
+        (reason?: any): void | PromiseLike<void>;
83
+    }
84
+    interface UnderlyingSinkCloseCallback {
85
+        (): void | PromiseLike<void>;
86
+    }
87
+    interface UnderlyingSinkStartCallback {
88
+        (controller: WritableStreamDefaultController): any;
89
+    }
90
+    interface UnderlyingSinkWriteCallback<W> {
91
+        (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
92
+    }
93
+    interface UnderlyingSourceCancelCallback {
94
+        (reason?: any): void | PromiseLike<void>;
95
+    }
96
+    interface UnderlyingSourcePullCallback<R> {
97
+        (controller: ReadableStreamController<R>): void | PromiseLike<void>;
98
+    }
99
+    interface UnderlyingSourceStartCallback<R> {
100
+        (controller: ReadableStreamController<R>): any;
101
+    }
102
+    interface TransformerFlushCallback<O> {
103
+        (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
104
+    }
105
+    interface TransformerStartCallback<O> {
106
+        (controller: TransformStreamDefaultController<O>): any;
107
+    }
108
+    interface TransformerTransformCallback<I, O> {
109
+        (chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
110
+    }
111
+    interface UnderlyingByteSource {
112
+        autoAllocateChunkSize?: number;
113
+        cancel?: ReadableStreamErrorCallback;
114
+        pull?: ReadableByteStreamControllerCallback;
115
+        start?: ReadableByteStreamControllerCallback;
116
+        type: 'bytes';
117
+    }
118
+    interface UnderlyingSource<R = any> {
119
+        cancel?: UnderlyingSourceCancelCallback;
120
+        pull?: UnderlyingSourcePullCallback<R>;
121
+        start?: UnderlyingSourceStartCallback<R>;
122
+        type?: undefined;
123
+    }
124
+    interface UnderlyingSink<W = any> {
125
+        abort?: UnderlyingSinkAbortCallback;
126
+        close?: UnderlyingSinkCloseCallback;
127
+        start?: UnderlyingSinkStartCallback;
128
+        type?: undefined;
129
+        write?: UnderlyingSinkWriteCallback<W>;
130
+    }
131
+    interface ReadableStreamErrorCallback {
132
+        (reason: any): void | PromiseLike<void>;
133
+    }
134
+    /** This Streams API interface represents a readable stream of byte data. */
135
+    interface ReadableStream<R = any> {
136
+        readonly locked: boolean;
137
+        cancel(reason?: any): Promise<void>;
138
+        getReader(): ReadableStreamDefaultReader<R>;
139
+        pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
140
+        pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
141
+        tee(): [ReadableStream<R>, ReadableStream<R>];
142
+        values(options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
143
+        [Symbol.asyncIterator](): AsyncIterableIterator<R>;
144
+    }
145
+    const ReadableStream: {
146
+        prototype: ReadableStream;
147
+        new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;
148
+        new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
149
+    };
150
+    interface ReadableStreamDefaultReader<R = any> extends ReadableStreamGenericReader {
151
+        read(): Promise<ReadableStreamDefaultReadResult<R>>;
152
+        releaseLock(): void;
153
+    }
154
+    const ReadableStreamDefaultReader: {
155
+        prototype: ReadableStreamDefaultReader;
156
+        new <R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
157
+    };
158
+    const ReadableStreamBYOBReader: any;
159
+    const ReadableStreamBYOBRequest: any;
160
+    interface ReadableByteStreamController {
161
+        readonly byobRequest: undefined;
162
+        readonly desiredSize: number | null;
163
+        close(): void;
164
+        enqueue(chunk: ArrayBufferView): void;
165
+        error(error?: any): void;
166
+    }
167
+    const ReadableByteStreamController: {
168
+        prototype: ReadableByteStreamController;
169
+        new (): ReadableByteStreamController;
170
+    };
171
+    interface ReadableStreamDefaultController<R = any> {
172
+        readonly desiredSize: number | null;
173
+        close(): void;
174
+        enqueue(chunk?: R): void;
175
+        error(e?: any): void;
176
+    }
177
+    const ReadableStreamDefaultController: {
178
+        prototype: ReadableStreamDefaultController;
179
+        new (): ReadableStreamDefaultController;
180
+    };
181
+    interface Transformer<I = any, O = any> {
182
+        flush?: TransformerFlushCallback<O>;
183
+        readableType?: undefined;
184
+        start?: TransformerStartCallback<O>;
185
+        transform?: TransformerTransformCallback<I, O>;
186
+        writableType?: undefined;
187
+    }
188
+    interface TransformStream<I = any, O = any> {
189
+        readonly readable: ReadableStream<O>;
190
+        readonly writable: WritableStream<I>;
191
+    }
192
+    const TransformStream: {
193
+        prototype: TransformStream;
194
+        new <I = any, O = any>(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>): TransformStream<I, O>;
195
+    };
196
+    interface TransformStreamDefaultController<O = any> {
197
+        readonly desiredSize: number | null;
198
+        enqueue(chunk?: O): void;
199
+        error(reason?: any): void;
200
+        terminate(): void;
201
+    }
202
+    const TransformStreamDefaultController: {
203
+        prototype: TransformStreamDefaultController;
204
+        new (): TransformStreamDefaultController;
205
+    };
206
+    /**
207
+     * This Streams API interface provides a standard abstraction for writing
208
+     * streaming data to a destination, known as a sink. This object comes with
209
+     * built-in back pressure and queuing.
210
+     */
211
+    interface WritableStream<W = any> {
212
+        readonly locked: boolean;
213
+        abort(reason?: any): Promise<void>;
214
+        close(): Promise<void>;
215
+        getWriter(): WritableStreamDefaultWriter<W>;
216
+    }
217
+    const WritableStream: {
218
+        prototype: WritableStream;
219
+        new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
220
+    };
221
+    /**
222
+     * This Streams API interface is the object returned by
223
+     * WritableStream.getWriter() and once created locks the < writer to the
224
+     * WritableStream ensuring that no other streams can write to the underlying
225
+     * sink.
226
+     */
227
+    interface WritableStreamDefaultWriter<W = any> {
228
+        readonly closed: Promise<undefined>;
229
+        readonly desiredSize: number | null;
230
+        readonly ready: Promise<undefined>;
231
+        abort(reason?: any): Promise<void>;
232
+        close(): Promise<void>;
233
+        releaseLock(): void;
234
+        write(chunk?: W): Promise<void>;
235
+    }
236
+    const WritableStreamDefaultWriter: {
237
+        prototype: WritableStreamDefaultWriter;
238
+        new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
239
+    };
240
+    /**
241
+     * This Streams API interface represents a controller allowing control of a
242
+     * WritableStream's state. When constructing a WritableStream, the
243
+     * underlying sink is given a corresponding WritableStreamDefaultController
244
+     * instance to manipulate.
245
+     */
246
+    interface WritableStreamDefaultController {
247
+        error(e?: any): void;
248
+    }
249
+    const WritableStreamDefaultController: {
250
+        prototype: WritableStreamDefaultController;
251
+        new (): WritableStreamDefaultController;
252
+    };
253
+    interface QueuingStrategy<T = any> {
254
+        highWaterMark?: number;
255
+        size?: QueuingStrategySize<T>;
256
+    }
257
+    interface QueuingStrategySize<T = any> {
258
+        (chunk?: T): number;
259
+    }
260
+    interface QueuingStrategyInit {
261
+        /**
262
+         * Creates a new ByteLengthQueuingStrategy with the provided high water
263
+         * mark.
264
+         *
265
+         * Note that the provided high water mark will not be validated ahead of
266
+         * time. Instead, if it is negative, NaN, or not a number, the resulting
267
+         * ByteLengthQueuingStrategy will cause the corresponding stream
268
+         * constructor to throw.
269
+         */
270
+        highWaterMark: number;
271
+    }
272
+    /**
273
+     * This Streams API interface provides a built-in byte length queuing
274
+     * strategy that can be used when constructing streams.
275
+     */
276
+    interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
277
+        readonly highWaterMark: number;
278
+        readonly size: QueuingStrategySize<ArrayBufferView>;
279
+    }
280
+    const ByteLengthQueuingStrategy: {
281
+        prototype: ByteLengthQueuingStrategy;
282
+        new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
283
+    };
284
+    /**
285
+     * This Streams API interface provides a built-in byte length queuing
286
+     * strategy that can be used when constructing streams.
287
+     */
288
+    interface CountQueuingStrategy extends QueuingStrategy {
289
+        readonly highWaterMark: number;
290
+        readonly size: QueuingStrategySize;
291
+    }
292
+    const CountQueuingStrategy: {
293
+        prototype: CountQueuingStrategy;
294
+        new (init: QueuingStrategyInit): CountQueuingStrategy;
295
+    };
296
+    interface TextEncoderStream {
297
+        /** Returns "utf-8". */
298
+        readonly encoding: 'utf-8';
299
+        readonly readable: ReadableStream<Uint8Array>;
300
+        readonly writable: WritableStream<string>;
301
+        readonly [Symbol.toStringTag]: string;
302
+    }
303
+    const TextEncoderStream: {
304
+        prototype: TextEncoderStream;
305
+        new (): TextEncoderStream;
306
+    };
307
+    interface TextDecoderOptions {
308
+        fatal?: boolean;
309
+        ignoreBOM?: boolean;
310
+    }
311
+    type BufferSource = ArrayBufferView | ArrayBuffer;
312
+    interface TextDecoderStream {
313
+        /** Returns encoding's name, lower cased. */
314
+        readonly encoding: string;
315
+        /** Returns `true` if error mode is "fatal", and `false` otherwise. */
316
+        readonly fatal: boolean;
317
+        /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */
318
+        readonly ignoreBOM: boolean;
319
+        readonly readable: ReadableStream<string>;
320
+        readonly writable: WritableStream<BufferSource>;
321
+        readonly [Symbol.toStringTag]: string;
322
+    }
323
+    const TextDecoderStream: {
324
+        prototype: TextDecoderStream;
325
+        new (label?: string, options?: TextDecoderOptions): TextDecoderStream;
326
+    };
327
+}
328
+declare module 'node:stream/web' {
329
+    export * from 'stream/web';
330
+}

+ 67
- 0
node_modules/@types/node/string_decoder.d.ts 查看文件

@@ -0,0 +1,67 @@
1
+/**
2
+ * The `string_decoder` module provides an API for decoding `Buffer` objects into
3
+ * strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
4
+ * characters. It can be accessed using:
5
+ *
6
+ * ```js
7
+ * const { StringDecoder } = require('string_decoder');
8
+ * ```
9
+ *
10
+ * The following example shows the basic use of the `StringDecoder` class.
11
+ *
12
+ * ```js
13
+ * const { StringDecoder } = require('string_decoder');
14
+ * const decoder = new StringDecoder('utf8');
15
+ *
16
+ * const cent = Buffer.from([0xC2, 0xA2]);
17
+ * console.log(decoder.write(cent));
18
+ *
19
+ * const euro = Buffer.from([0xE2, 0x82, 0xAC]);
20
+ * console.log(decoder.write(euro));
21
+ * ```
22
+ *
23
+ * When a `Buffer` instance is written to the `StringDecoder` instance, an
24
+ * internal buffer is used to ensure that the decoded string does not contain
25
+ * any incomplete multibyte characters. These are held in the buffer until the
26
+ * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called.
27
+ *
28
+ * In the following example, the three UTF-8 encoded bytes of the European Euro
29
+ * symbol (`€`) are written over three separate operations:
30
+ *
31
+ * ```js
32
+ * const { StringDecoder } = require('string_decoder');
33
+ * const decoder = new StringDecoder('utf8');
34
+ *
35
+ * decoder.write(Buffer.from([0xE2]));
36
+ * decoder.write(Buffer.from([0x82]));
37
+ * console.log(decoder.end(Buffer.from([0xAC])));
38
+ * ```
39
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/string_decoder.js)
40
+ */
41
+declare module 'string_decoder' {
42
+    class StringDecoder {
43
+        constructor(encoding?: BufferEncoding);
44
+        /**
45
+         * Returns a decoded string, ensuring that any incomplete multibyte characters at
46
+         * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the
47
+         * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`.
48
+         * @since v0.1.99
49
+         * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
50
+         */
51
+        write(buffer: Buffer): string;
52
+        /**
53
+         * Returns any remaining input stored in the internal buffer as a string. Bytes
54
+         * representing incomplete UTF-8 and UTF-16 characters will be replaced with
55
+         * substitution characters appropriate for the character encoding.
56
+         *
57
+         * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input.
58
+         * After `end()` is called, the `stringDecoder` object can be reused for new input.
59
+         * @since v0.9.3
60
+         * @param buffer A `Buffer`, or `TypedArray`, or `DataView` containing the bytes to decode.
61
+         */
62
+        end(buffer?: Buffer): string;
63
+    }
64
+}
65
+declare module 'node:string_decoder' {
66
+    export * from 'string_decoder';
67
+}

+ 314
- 0
node_modules/@types/node/test.d.ts 查看文件

@@ -0,0 +1,314 @@
1
+/**
2
+ * The `node:test` module provides a standalone testing module.
3
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/test.js)
4
+ */
5
+declare module 'node:test' {
6
+    /**
7
+     * Programmatically start the test runner.
8
+     * @since v18.9.0
9
+     * @param options Configuration options for running tests.
10
+     * @returns A {@link TapStream} that emits events about the test execution.
11
+     */
12
+    function run(options?: RunOptions): TapStream;
13
+
14
+    /**
15
+     * The `test()` function is the value imported from the test module. Each invocation of this
16
+     * function results in the creation of a test point in the TAP output.
17
+     *
18
+     * The {@link TestContext} object passed to the fn argument can be used to perform actions
19
+     * related to the current test. Examples include skipping the test, adding additional TAP
20
+     * diagnostic information, or creating subtests.
21
+     *
22
+     * `test()` returns a {@link Promise} that resolves once the test completes. The return value
23
+     * can usually be discarded for top level tests. However, the return value from subtests should
24
+     * be used to prevent the parent test from finishing first and cancelling the subtest as shown
25
+     * in the following example.
26
+     *
27
+     * ```js
28
+     * test('top level test', async (t) => {
29
+     *   // The setTimeout() in the following subtest would cause it to outlive its
30
+     *   // parent test if 'await' is removed on the next line. Once the parent test
31
+     *   // completes, it will cancel any outstanding subtests.
32
+     *   await t.test('longer running subtest', async (t) => {
33
+     *     return new Promise((resolve, reject) => {
34
+     *       setTimeout(resolve, 1000);
35
+     *     });
36
+     *   });
37
+     * });
38
+     * ```
39
+     * @since v18.0.0
40
+     * @param name The name of the test, which is displayed when reporting test results.
41
+     *    Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
42
+     * @param options Configuration options for the test
43
+     * @param fn The function under test. The first argument to this function is a
44
+     *    {@link TestContext} object. If the test uses callbacks, the callback function is
45
+     *    passed as the second argument. Default: A no-op function.
46
+     * @returns A {@link Promise} resolved with `undefined` once the test completes.
47
+     */
48
+    function test(name?: string, fn?: TestFn): Promise<void>;
49
+    function test(name?: string, options?: TestOptions, fn?: TestFn): Promise<void>;
50
+    function test(options?: TestOptions, fn?: TestFn): Promise<void>;
51
+    function test(fn?: TestFn): Promise<void>;
52
+
53
+    /**
54
+     * @since v18.6.0
55
+     * @param name The name of the suite, which is displayed when reporting suite results.
56
+     *    Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
57
+     * @param options Configuration options for the suite
58
+     * @param fn The function under suite. Default: A no-op function.
59
+     */
60
+    function describe(name?: string, options?: TestOptions, fn?: SuiteFn): void;
61
+    function describe(name?: string, fn?: SuiteFn): void;
62
+    function describe(options?: TestOptions, fn?: SuiteFn): void;
63
+    function describe(fn?: SuiteFn): void;
64
+
65
+    /**
66
+     * @since v18.6.0
67
+     * @param name The name of the test, which is displayed when reporting test results.
68
+     *    Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
69
+     * @param options Configuration options for the test
70
+     * @param fn The function under test. If the test uses callbacks, the callback function is
71
+     *    passed as the second argument. Default: A no-op function.
72
+     */
73
+    function it(name?: string, options?: TestOptions, fn?: ItFn): void;
74
+    function it(name?: string, fn?: ItFn): void;
75
+    function it(options?: TestOptions, fn?: ItFn): void;
76
+    function it(fn?: ItFn): void;
77
+
78
+    /**
79
+     * The type of a function under test. The first argument to this function is a
80
+     * {@link TestContext} object. If the test uses callbacks, the callback function is passed as
81
+     * the second argument.
82
+     */
83
+    type TestFn = (t: TestContext, done: (result?: any) => void) => any;
84
+
85
+    /**
86
+     * The type of a function under Suite.
87
+     * If the test uses callbacks, the callback function is passed as an argument
88
+     */
89
+    type SuiteFn = (done: (result?: any) => void) => void;
90
+
91
+    /**
92
+     * The type of a function under test.
93
+     * If the test uses callbacks, the callback function is passed as an argument
94
+     */
95
+    type ItFn = (done: (result?: any) => void) => any;
96
+
97
+    interface RunOptions {
98
+        /**
99
+         * @default false
100
+         */
101
+        concurrency?: number | boolean;
102
+
103
+        /**
104
+         * An array containing the list of files to run. If unspecified, the test runner execution model will be used.
105
+         */
106
+        files?: readonly string[];
107
+
108
+        /**
109
+         * Allows aborting an in-progress test.
110
+         * @default undefined
111
+         */
112
+        signal?: AbortSignal;
113
+
114
+        /**
115
+         * A number of milliseconds the test will fail after. If unspecified, subtests inherit this
116
+         * value from their parent.
117
+         * @default Infinity
118
+         */
119
+        timeout?: number;
120
+    }
121
+
122
+    /**
123
+     * A successful call of the run() method will return a new TapStream object, streaming a TAP output.
124
+     * TapStream will emit events in the order of the tests' definitions.
125
+     * @since v18.9.0
126
+     */
127
+    interface TapStream extends NodeJS.ReadableStream {
128
+        addListener(event: 'test:diagnostic', listener: (message: string) => void): this;
129
+        addListener(event: 'test:fail', listener: (data: TestFail) => void): this;
130
+        addListener(event: 'test:pass', listener: (data: TestPass) => void): this;
131
+        addListener(event: string, listener: (...args: any[]) => void): this;
132
+        emit(event: 'test:diagnostic', message: string): boolean;
133
+        emit(event: 'test:fail', data: TestFail): boolean;
134
+        emit(event: 'test:pass', data: TestPass): boolean;
135
+        emit(event: string | symbol, ...args: any[]): boolean;
136
+        on(event: 'test:diagnostic', listener: (message: string) => void): this;
137
+        on(event: 'test:fail', listener: (data: TestFail) => void): this;
138
+        on(event: 'test:pass', listener: (data: TestPass) => void): this;
139
+        on(event: string, listener: (...args: any[]) => void): this;
140
+        once(event: 'test:diagnostic', listener: (message: string) => void): this;
141
+        once(event: 'test:fail', listener: (data: TestFail) => void): this;
142
+        once(event: 'test:pass', listener: (data: TestPass) => void): this;
143
+        once(event: string, listener: (...args: any[]) => void): this;
144
+        prependListener(event: 'test:diagnostic', listener: (message: string) => void): this;
145
+        prependListener(event: 'test:fail', listener: (data: TestFail) => void): this;
146
+        prependListener(event: 'test:pass', listener: (data: TestPass) => void): this;
147
+        prependListener(event: string, listener: (...args: any[]) => void): this;
148
+        prependOnceListener(event: 'test:diagnostic', listener: (message: string) => void): this;
149
+        prependOnceListener(event: 'test:fail', listener: (data: TestFail) => void): this;
150
+        prependOnceListener(event: 'test:pass', listener: (data: TestPass) => void): this;
151
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
152
+    }
153
+
154
+    interface TestFail {
155
+        /**
156
+         * The test duration.
157
+         */
158
+        duration: number;
159
+
160
+        /**
161
+         * The failure casing test to fail.
162
+         */
163
+        error: Error;
164
+
165
+        /**
166
+         * The test name.
167
+         */
168
+        name: string;
169
+
170
+        /**
171
+         * The ordinal number of the test.
172
+         */
173
+        testNumber: number;
174
+
175
+        /**
176
+         * Present if `context.todo` is called.
177
+         */
178
+        todo?: string;
179
+
180
+        /**
181
+         * Present if `context.skip` is called.
182
+         */
183
+        skip?: string;
184
+    }
185
+
186
+    interface TestPass {
187
+        /**
188
+         * The test duration.
189
+         */
190
+        duration: number;
191
+
192
+        /**
193
+         * The test name.
194
+         */
195
+        name: string;
196
+
197
+        /**
198
+         * The ordinal number of the test.
199
+         */
200
+        testNumber: number;
201
+
202
+        /**
203
+         * Present if `context.todo` is called.
204
+         */
205
+        todo?: string;
206
+
207
+        /**
208
+         * Present if `context.skip` is called.
209
+         */
210
+        skip?: string;
211
+    }
212
+
213
+    /**
214
+     * An instance of `TestContext` is passed to each test function in order to interact with the
215
+     * test runner. However, the `TestContext` constructor is not exposed as part of the API.
216
+     * @since v18.0.0
217
+     */
218
+    interface TestContext {
219
+        /**
220
+         * This function is used to write TAP diagnostics to the output. Any diagnostic information is
221
+         * included at the end of the test's results. This function does not return a value.
222
+         * @param message Message to be displayed as a TAP diagnostic.
223
+         * @since v18.0.0
224
+         */
225
+        diagnostic(message: string): void;
226
+
227
+        /**
228
+         * If `shouldRunOnlyTests` is truthy, the test context will only run tests that have the `only`
229
+         * option set. Otherwise, all tests are run. If Node.js was not started with the `--test-only`
230
+         * command-line option, this function is a no-op.
231
+         * @param shouldRunOnlyTests Whether or not to run `only` tests.
232
+         * @since v18.0.0
233
+         */
234
+        runOnly(shouldRunOnlyTests: boolean): void;
235
+
236
+        /**
237
+         * This function causes the test's output to indicate the test as skipped. If `message` is
238
+         * provided, it is included in the TAP output. Calling `skip()` does not terminate execution of
239
+         * the test function. This function does not return a value.
240
+         * @param message Optional skip message to be displayed in TAP output.
241
+         * @since v18.0.0
242
+         */
243
+        skip(message?: string): void;
244
+
245
+        /**
246
+         * This function adds a `TODO` directive to the test's output. If `message` is provided, it is
247
+         * included in the TAP output. Calling `todo()` does not terminate execution of the test
248
+         * function. This function does not return a value.
249
+         * @param message Optional `TODO` message to be displayed in TAP output.
250
+         * @since v18.0.0
251
+         */
252
+        todo(message?: string): void;
253
+
254
+        /**
255
+         * This function is used to create subtests under the current test. This function behaves in
256
+         * the same fashion as the top level {@link test} function.
257
+         * @since v18.0.0
258
+         * @param name The name of the test, which is displayed when reporting test results.
259
+         *    Default: The `name` property of fn, or `'<anonymous>'` if `fn` does not have a name.
260
+         * @param options Configuration options for the test
261
+         * @param fn The function under test. This first argument to this function is a
262
+         *    {@link TestContext} object. If the test uses callbacks, the callback function is
263
+         *    passed as the second argument. Default: A no-op function.
264
+         * @returns A {@link Promise} resolved with `undefined` once the test completes.
265
+         */
266
+        test: typeof test;
267
+    }
268
+
269
+    interface TestOptions {
270
+        /**
271
+         * The number of tests that can be run at the same time. If unspecified, subtests inherit this
272
+         * value from their parent.
273
+         * @default 1
274
+         */
275
+        concurrency?: number;
276
+
277
+        /**
278
+         * If truthy, and the test context is configured to run `only` tests, then this test will be
279
+         * run. Otherwise, the test is skipped.
280
+         * @default false
281
+         */
282
+        only?: boolean;
283
+
284
+        /**
285
+         * Allows aborting an in-progress test.
286
+         * @since v18.8.0
287
+         */
288
+        signal?: AbortSignal;
289
+
290
+        /**
291
+         * If truthy, the test is skipped. If a string is provided, that string is displayed in the
292
+         * test results as the reason for skipping the test.
293
+         * @default false
294
+         */
295
+        skip?: boolean | string;
296
+
297
+        /**
298
+         * A number of milliseconds the test will fail after. If unspecified, subtests inherit this
299
+         * value from their parent.
300
+         * @default Infinity
301
+         * @since v18.7.0
302
+         */
303
+        timeout?: number;
304
+
305
+        /**
306
+         * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in
307
+         * the test results as the reason why the test is `TODO`.
308
+         * @default false
309
+         */
310
+        todo?: boolean | string;
311
+    }
312
+
313
+    export { test as default, run, test, describe, it };
314
+}

+ 94
- 0
node_modules/@types/node/timers.d.ts 查看文件

@@ -0,0 +1,94 @@
1
+/**
2
+ * The `timer` module exposes a global API for scheduling functions to
3
+ * be called at some future period of time. Because the timer functions are
4
+ * globals, there is no need to call `require('timers')` to use the API.
5
+ *
6
+ * The timer functions within Node.js implement a similar API as the timers API
7
+ * provided by Web Browsers but use a different internal implementation that is
8
+ * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/timers.js)
10
+ */
11
+declare module 'timers' {
12
+    import { Abortable } from 'node:events';
13
+    import { setTimeout as setTimeoutPromise, setImmediate as setImmediatePromise, setInterval as setIntervalPromise } from 'node:timers/promises';
14
+    interface TimerOptions extends Abortable {
15
+        /**
16
+         * Set to `false` to indicate that the scheduled `Timeout`
17
+         * should not require the Node.js event loop to remain active.
18
+         * @default true
19
+         */
20
+        ref?: boolean | undefined;
21
+    }
22
+    let setTimeout: typeof global.setTimeout;
23
+    let clearTimeout: typeof global.clearTimeout;
24
+    let setInterval: typeof global.setInterval;
25
+    let clearInterval: typeof global.clearInterval;
26
+    let setImmediate: typeof global.setImmediate;
27
+    let clearImmediate: typeof global.clearImmediate;
28
+    global {
29
+        namespace NodeJS {
30
+            // compatibility with older typings
31
+            interface Timer extends RefCounted {
32
+                hasRef(): boolean;
33
+                refresh(): this;
34
+                [Symbol.toPrimitive](): number;
35
+            }
36
+            interface Immediate extends RefCounted {
37
+                /**
38
+                 * If true, the `Immediate` object will keep the Node.js event loop active.
39
+                 * @since v11.0.0
40
+                 */
41
+                hasRef(): boolean;
42
+                _onImmediate: Function; // to distinguish it from the Timeout class
43
+            }
44
+            interface Timeout extends Timer {
45
+                /**
46
+                 * If true, the `Timeout` object will keep the Node.js event loop active.
47
+                 * @since v11.0.0
48
+                 */
49
+                hasRef(): boolean;
50
+                /**
51
+                 * Sets the timer's start time to the current time, and reschedules the timer to
52
+                 * call its callback at the previously specified duration adjusted to the current
53
+                 * time. This is useful for refreshing a timer without allocating a new
54
+                 * JavaScript object.
55
+                 *
56
+                 * Using this on a timer that has already called its callback will reactivate the
57
+                 * timer.
58
+                 * @since v10.2.0
59
+                 * @return a reference to `timeout`
60
+                 */
61
+                refresh(): this;
62
+                [Symbol.toPrimitive](): number;
63
+            }
64
+        }
65
+        function setTimeout<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timeout;
66
+        // util.promisify no rest args compability
67
+        // tslint:disable-next-line void-return
68
+        function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout;
69
+        namespace setTimeout {
70
+            const __promisify__: typeof setTimeoutPromise;
71
+        }
72
+        function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void;
73
+        function setInterval<TArgs extends any[]>(callback: (...args: TArgs) => void, ms?: number, ...args: TArgs): NodeJS.Timer;
74
+        // util.promisify no rest args compability
75
+        // tslint:disable-next-line void-return
76
+        function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timer;
77
+        namespace setInterval {
78
+            const __promisify__: typeof setIntervalPromise;
79
+        }
80
+        function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void;
81
+        function setImmediate<TArgs extends any[]>(callback: (...args: TArgs) => void, ...args: TArgs): NodeJS.Immediate;
82
+        // util.promisify no rest args compability
83
+        // tslint:disable-next-line void-return
84
+        function setImmediate(callback: (args: void) => void): NodeJS.Immediate;
85
+        namespace setImmediate {
86
+            const __promisify__: typeof setImmediatePromise;
87
+        }
88
+        function clearImmediate(immediateId: NodeJS.Immediate | undefined): void;
89
+        function queueMicrotask(callback: () => void): void;
90
+    }
91
+}
92
+declare module 'node:timers' {
93
+    export * from 'timers';
94
+}

+ 68
- 0
node_modules/@types/node/timers/promises.d.ts 查看文件

@@ -0,0 +1,68 @@
1
+/**
2
+ * The `timers/promises` API provides an alternative set of timer functions
3
+ * that return `Promise` objects. The API is accessible via`require('timers/promises')`.
4
+ *
5
+ * ```js
6
+ * import {
7
+ *   setTimeout,
8
+ *   setImmediate,
9
+ *   setInterval,
10
+ * } from 'timers/promises';
11
+ * ```
12
+ * @since v15.0.0
13
+ */
14
+declare module 'timers/promises' {
15
+    import { TimerOptions } from 'node:timers';
16
+    /**
17
+     * ```js
18
+     * import {
19
+     *   setTimeout,
20
+     * } from 'timers/promises';
21
+     *
22
+     * const res = await setTimeout(100, 'result');
23
+     *
24
+     * console.log(res);  // Prints 'result'
25
+     * ```
26
+     * @since v15.0.0
27
+     * @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
28
+     * @param value A value with which the promise is fulfilled.
29
+     */
30
+    function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
31
+    /**
32
+     * ```js
33
+     * import {
34
+     *   setImmediate,
35
+     * } from 'timers/promises';
36
+     *
37
+     * const res = await setImmediate('result');
38
+     *
39
+     * console.log(res);  // Prints 'result'
40
+     * ```
41
+     * @since v15.0.0
42
+     * @param value A value with which the promise is fulfilled.
43
+     */
44
+    function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
45
+    /**
46
+     * Returns an async iterator that generates values in an interval of `delay` ms.
47
+     *
48
+     * ```js
49
+     * import {
50
+     *   setInterval,
51
+     * } from 'timers/promises';
52
+     *
53
+     * const interval = 100;
54
+     * for await (const startTime of setInterval(interval, Date.now())) {
55
+     *   const now = Date.now();
56
+     *   console.log(now);
57
+     *   if ((now - startTime) > 1000)
58
+     *     break;
59
+     * }
60
+     * console.log(Date.now());
61
+     * ```
62
+     * @since v15.9.0
63
+     */
64
+    function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
65
+}
66
+declare module 'node:timers/promises' {
67
+    export * from 'timers/promises';
68
+}

+ 1028
- 0
node_modules/@types/node/tls.d.ts
文件差異過大導致無法顯示
查看文件


+ 171
- 0
node_modules/@types/node/trace_events.d.ts 查看文件

@@ -0,0 +1,171 @@
1
+/**
2
+ * The `trace_events` module provides a mechanism to centralize tracing information
3
+ * generated by V8, Node.js core, and userspace code.
4
+ *
5
+ * Tracing can be enabled with the `--trace-event-categories` command-line flag
6
+ * or by using the `trace_events` module. The `--trace-event-categories` flag
7
+ * accepts a list of comma-separated category names.
8
+ *
9
+ * The available categories are:
10
+ *
11
+ * * `node`: An empty placeholder.
12
+ * * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data.
13
+ * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
14
+ * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
15
+ * * `node.console`: Enables capture of `console.time()` and `console.count()`output.
16
+ * * `node.dns.native`: Enables capture of trace data for DNS queries.
17
+ * * `node.environment`: Enables capture of Node.js Environment milestones.
18
+ * * `node.fs.sync`: Enables capture of trace data for file system sync methods.
19
+ * * `node.perf`: Enables capture of `Performance API` measurements.
20
+ *    * `node.perf.usertiming`: Enables capture of only Performance API User Timing
21
+ *    measures and marks.
22
+ *    * `node.perf.timerify`: Enables capture of only Performance API timerify
23
+ *    measurements.
24
+ * * `node.promises.rejections`: Enables capture of trace data tracking the number
25
+ * of unhandled Promise rejections and handled-after-rejections.
26
+ * * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
27
+ * * `v8`: The `V8` events are GC, compiling, and execution related.
28
+ *
29
+ * By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
30
+ *
31
+ * ```bash
32
+ * node --trace-event-categories v8,node,node.async_hooks server.js
33
+ * ```
34
+ *
35
+ * Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be
36
+ * used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default.
37
+ *
38
+ * ```bash
39
+ * node --trace-events-enabled
40
+ *
41
+ * # is equivalent to
42
+ *
43
+ * node --trace-event-categories v8,node,node.async_hooks
44
+ * ```
45
+ *
46
+ * Alternatively, trace events may be enabled using the `trace_events` module:
47
+ *
48
+ * ```js
49
+ * const trace_events = require('trace_events');
50
+ * const tracing = trace_events.createTracing({ categories: ['node.perf'] });
51
+ * tracing.enable();  // Enable trace event capture for the 'node.perf' category
52
+ *
53
+ * // do work
54
+ *
55
+ * tracing.disable();  // Disable trace event capture for the 'node.perf' category
56
+ * ```
57
+ *
58
+ * Running Node.js with tracing enabled will produce log files that can be opened
59
+ * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
60
+ *
61
+ * The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can
62
+ * be specified with `--trace-event-file-pattern` that accepts a template
63
+ * string that supports `${rotation}` and `${pid}`:
64
+ *
65
+ * ```bash
66
+ * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
67
+ * ```
68
+ *
69
+ * To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
70
+ * in your code, such as:
71
+ *
72
+ * ```js
73
+ * process.on('SIGINT', function onSigint() {
74
+ *   console.info('Received SIGINT.');
75
+ *   process.exit(130);  // Or applicable exit code depending on OS and signal
76
+ * });
77
+ * ```
78
+ *
79
+ * The tracing system uses the same time source
80
+ * as the one used by `process.hrtime()`.
81
+ * However the trace-event timestamps are expressed in microseconds,
82
+ * unlike `process.hrtime()` which returns nanoseconds.
83
+ *
84
+ * The features from this module are not available in `Worker` threads.
85
+ * @experimental
86
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/trace_events.js)
87
+ */
88
+declare module 'trace_events' {
89
+    /**
90
+     * The `Tracing` object is used to enable or disable tracing for sets of
91
+     * categories. Instances are created using the
92
+     * `trace_events.createTracing()` method.
93
+     *
94
+     * When created, the `Tracing` object is disabled. Calling the
95
+     * `tracing.enable()` method adds the categories to the set of enabled trace
96
+     * event categories. Calling `tracing.disable()` will remove the categories
97
+     * from the set of enabled trace event categories.
98
+     */
99
+    interface Tracing {
100
+        /**
101
+         * A comma-separated list of the trace event categories covered by this
102
+         * `Tracing` object.
103
+         */
104
+        readonly categories: string;
105
+        /**
106
+         * Disables this `Tracing` object.
107
+         *
108
+         * Only trace event categories _not_ covered by other enabled `Tracing`
109
+         * objects and _not_ specified by the `--trace-event-categories` flag
110
+         * will be disabled.
111
+         */
112
+        disable(): void;
113
+        /**
114
+         * Enables this `Tracing` object for the set of categories covered by
115
+         * the `Tracing` object.
116
+         */
117
+        enable(): void;
118
+        /**
119
+         * `true` only if the `Tracing` object has been enabled.
120
+         */
121
+        readonly enabled: boolean;
122
+    }
123
+    interface CreateTracingOptions {
124
+        /**
125
+         * An array of trace category names. Values included in the array are
126
+         * coerced to a string when possible. An error will be thrown if the
127
+         * value cannot be coerced.
128
+         */
129
+        categories: string[];
130
+    }
131
+    /**
132
+     * Creates and returns a `Tracing` object for the given set of `categories`.
133
+     *
134
+     * ```js
135
+     * const trace_events = require('trace_events');
136
+     * const categories = ['node.perf', 'node.async_hooks'];
137
+     * const tracing = trace_events.createTracing({ categories });
138
+     * tracing.enable();
139
+     * // do stuff
140
+     * tracing.disable();
141
+     * ```
142
+     * @since v10.0.0
143
+     * @return .
144
+     */
145
+    function createTracing(options: CreateTracingOptions): Tracing;
146
+    /**
147
+     * Returns a comma-separated list of all currently-enabled trace event
148
+     * categories. The current set of enabled trace event categories is determined
149
+     * by the _union_ of all currently-enabled `Tracing` objects and any categories
150
+     * enabled using the `--trace-event-categories` flag.
151
+     *
152
+     * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
153
+     *
154
+     * ```js
155
+     * const trace_events = require('trace_events');
156
+     * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
157
+     * const t2 = trace_events.createTracing({ categories: ['node.perf'] });
158
+     * const t3 = trace_events.createTracing({ categories: ['v8'] });
159
+     *
160
+     * t1.enable();
161
+     * t2.enable();
162
+     *
163
+     * console.log(trace_events.getEnabledCategories());
164
+     * ```
165
+     * @since v10.0.0
166
+     */
167
+    function getEnabledCategories(): string | undefined;
168
+}
169
+declare module 'node:trace_events' {
170
+    export * from 'trace_events';
171
+}

+ 911
- 0
node_modules/@types/node/ts4.8/assert.d.ts 查看文件

@@ -0,0 +1,911 @@
1
+/**
2
+ * The `assert` module provides a set of assertion functions for verifying
3
+ * invariants.
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/assert.js)
5
+ */
6
+declare module 'assert' {
7
+    /**
8
+     * An alias of {@link ok}.
9
+     * @since v0.5.9
10
+     * @param value The input that is checked for being truthy.
11
+     */
12
+    function assert(value: unknown, message?: string | Error): asserts value;
13
+    namespace assert {
14
+        /**
15
+         * Indicates the failure of an assertion. All errors thrown by the `assert` module
16
+         * will be instances of the `AssertionError` class.
17
+         */
18
+        class AssertionError extends Error {
19
+            actual: unknown;
20
+            expected: unknown;
21
+            operator: string;
22
+            generatedMessage: boolean;
23
+            code: 'ERR_ASSERTION';
24
+            constructor(options?: {
25
+                /** If provided, the error message is set to this value. */
26
+                message?: string | undefined;
27
+                /** The `actual` property on the error instance. */
28
+                actual?: unknown | undefined;
29
+                /** The `expected` property on the error instance. */
30
+                expected?: unknown | undefined;
31
+                /** The `operator` property on the error instance. */
32
+                operator?: string | undefined;
33
+                /** If provided, the generated stack trace omits frames before this function. */
34
+                // tslint:disable-next-line:ban-types
35
+                stackStartFn?: Function | undefined;
36
+            });
37
+        }
38
+        /**
39
+         * This feature is currently experimental and behavior might still change.
40
+         * @since v14.2.0, v12.19.0
41
+         * @experimental
42
+         */
43
+        class CallTracker {
44
+            /**
45
+             * The wrapper function is expected to be called exactly `exact` times. If the
46
+             * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an
47
+             * error.
48
+             *
49
+             * ```js
50
+             * import assert from 'assert';
51
+             *
52
+             * // Creates call tracker.
53
+             * const tracker = new assert.CallTracker();
54
+             *
55
+             * function func() {}
56
+             *
57
+             * // Returns a function that wraps func() that must be called exact times
58
+             * // before tracker.verify().
59
+             * const callsfunc = tracker.calls(func);
60
+             * ```
61
+             * @since v14.2.0, v12.19.0
62
+             * @param [fn='A no-op function']
63
+             * @param [exact=1]
64
+             * @return that wraps `fn`.
65
+             */
66
+            calls(exact?: number): () => void;
67
+            calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
68
+            /**
69
+             * The arrays contains information about the expected and actual number of calls of
70
+             * the functions that have not been called the expected number of times.
71
+             *
72
+             * ```js
73
+             * import assert from 'assert';
74
+             *
75
+             * // Creates call tracker.
76
+             * const tracker = new assert.CallTracker();
77
+             *
78
+             * function func() {}
79
+             *
80
+             * function foo() {}
81
+             *
82
+             * // Returns a function that wraps func() that must be called exact times
83
+             * // before tracker.verify().
84
+             * const callsfunc = tracker.calls(func, 2);
85
+             *
86
+             * // Returns an array containing information on callsfunc()
87
+             * tracker.report();
88
+             * // [
89
+             * //  {
90
+             * //    message: 'Expected the func function to be executed 2 time(s) but was
91
+             * //    executed 0 time(s).',
92
+             * //    actual: 0,
93
+             * //    expected: 2,
94
+             * //    operator: 'func',
95
+             * //    stack: stack trace
96
+             * //  }
97
+             * // ]
98
+             * ```
99
+             * @since v14.2.0, v12.19.0
100
+             * @return of objects containing information about the wrapper functions returned by `calls`.
101
+             */
102
+            report(): CallTrackerReportInformation[];
103
+            /**
104
+             * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
105
+             * have not been called the expected number of times.
106
+             *
107
+             * ```js
108
+             * import assert from 'assert';
109
+             *
110
+             * // Creates call tracker.
111
+             * const tracker = new assert.CallTracker();
112
+             *
113
+             * function func() {}
114
+             *
115
+             * // Returns a function that wraps func() that must be called exact times
116
+             * // before tracker.verify().
117
+             * const callsfunc = tracker.calls(func, 2);
118
+             *
119
+             * callsfunc();
120
+             *
121
+             * // Will throw an error since callsfunc() was only called once.
122
+             * tracker.verify();
123
+             * ```
124
+             * @since v14.2.0, v12.19.0
125
+             */
126
+            verify(): void;
127
+        }
128
+        interface CallTrackerReportInformation {
129
+            message: string;
130
+            /** The actual number of times the function was called. */
131
+            actual: number;
132
+            /** The number of times the function was expected to be called. */
133
+            expected: number;
134
+            /** The name of the function that is wrapped. */
135
+            operator: string;
136
+            /** A stack trace of the function. */
137
+            stack: object;
138
+        }
139
+        type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
140
+        /**
141
+         * Throws an `AssertionError` with the provided error message or a default
142
+         * error message. If the `message` parameter is an instance of an `Error` then
143
+         * it will be thrown instead of the `AssertionError`.
144
+         *
145
+         * ```js
146
+         * import assert from 'assert/strict';
147
+         *
148
+         * assert.fail();
149
+         * // AssertionError [ERR_ASSERTION]: Failed
150
+         *
151
+         * assert.fail('boom');
152
+         * // AssertionError [ERR_ASSERTION]: boom
153
+         *
154
+         * assert.fail(new TypeError('need array'));
155
+         * // TypeError: need array
156
+         * ```
157
+         *
158
+         * Using `assert.fail()` with more than two arguments is possible but deprecated.
159
+         * See below for further details.
160
+         * @since v0.1.21
161
+         * @param [message='Failed']
162
+         */
163
+        function fail(message?: string | Error): never;
164
+        /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
165
+        function fail(
166
+            actual: unknown,
167
+            expected: unknown,
168
+            message?: string | Error,
169
+            operator?: string,
170
+            // tslint:disable-next-line:ban-types
171
+            stackStartFn?: Function
172
+        ): never;
173
+        /**
174
+         * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
175
+         *
176
+         * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
177
+         * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
178
+         * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
179
+         *
180
+         * Be aware that in the `repl` the error message will be different to the one
181
+         * thrown in a file! See below for further details.
182
+         *
183
+         * ```js
184
+         * import assert from 'assert/strict';
185
+         *
186
+         * assert.ok(true);
187
+         * // OK
188
+         * assert.ok(1);
189
+         * // OK
190
+         *
191
+         * assert.ok();
192
+         * // AssertionError: No value argument passed to `assert.ok()`
193
+         *
194
+         * assert.ok(false, 'it\'s false');
195
+         * // AssertionError: it's false
196
+         *
197
+         * // In the repl:
198
+         * assert.ok(typeof 123 === 'string');
199
+         * // AssertionError: false == true
200
+         *
201
+         * // In a file (e.g. test.js):
202
+         * assert.ok(typeof 123 === 'string');
203
+         * // AssertionError: The expression evaluated to a falsy value:
204
+         * //
205
+         * //   assert.ok(typeof 123 === 'string')
206
+         *
207
+         * assert.ok(false);
208
+         * // AssertionError: The expression evaluated to a falsy value:
209
+         * //
210
+         * //   assert.ok(false)
211
+         *
212
+         * assert.ok(0);
213
+         * // AssertionError: The expression evaluated to a falsy value:
214
+         * //
215
+         * //   assert.ok(0)
216
+         * ```
217
+         *
218
+         * ```js
219
+         * import assert from 'assert/strict';
220
+         *
221
+         * // Using `assert()` works the same:
222
+         * assert(0);
223
+         * // AssertionError: The expression evaluated to a falsy value:
224
+         * //
225
+         * //   assert(0)
226
+         * ```
227
+         * @since v0.1.21
228
+         */
229
+        function ok(value: unknown, message?: string | Error): asserts value;
230
+        /**
231
+         * **Strict assertion mode**
232
+         *
233
+         * An alias of {@link strictEqual}.
234
+         *
235
+         * **Legacy assertion mode**
236
+         *
237
+         * > Stability: 3 - Legacy: Use {@link strictEqual} instead.
238
+         *
239
+         * Tests shallow, coercive equality between the `actual` and `expected` parameters
240
+         * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
241
+         * and treated as being identical if both sides are `NaN`.
242
+         *
243
+         * ```js
244
+         * import assert from 'assert';
245
+         *
246
+         * assert.equal(1, 1);
247
+         * // OK, 1 == 1
248
+         * assert.equal(1, '1');
249
+         * // OK, 1 == '1'
250
+         * assert.equal(NaN, NaN);
251
+         * // OK
252
+         *
253
+         * assert.equal(1, 2);
254
+         * // AssertionError: 1 == 2
255
+         * assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
256
+         * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
257
+         * ```
258
+         *
259
+         * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
260
+         * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
261
+         * @since v0.1.21
262
+         */
263
+        function equal(actual: unknown, expected: unknown, message?: string | Error): void;
264
+        /**
265
+         * **Strict assertion mode**
266
+         *
267
+         * An alias of {@link notStrictEqual}.
268
+         *
269
+         * **Legacy assertion mode**
270
+         *
271
+         * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
272
+         *
273
+         * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
274
+         * specially handled and treated as being identical if both sides are `NaN`.
275
+         *
276
+         * ```js
277
+         * import assert from 'assert';
278
+         *
279
+         * assert.notEqual(1, 2);
280
+         * // OK
281
+         *
282
+         * assert.notEqual(1, 1);
283
+         * // AssertionError: 1 != 1
284
+         *
285
+         * assert.notEqual(1, '1');
286
+         * // AssertionError: 1 != '1'
287
+         * ```
288
+         *
289
+         * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
290
+         * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
291
+         * @since v0.1.21
292
+         */
293
+        function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
294
+        /**
295
+         * **Strict assertion mode**
296
+         *
297
+         * An alias of {@link deepStrictEqual}.
298
+         *
299
+         * **Legacy assertion mode**
300
+         *
301
+         * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead.
302
+         *
303
+         * Tests for deep equality between the `actual` and `expected` parameters. Consider
304
+         * using {@link deepStrictEqual} instead. {@link deepEqual} can have
305
+         * surprising results.
306
+         *
307
+         * _Deep equality_ means that the enumerable "own" properties of child objects
308
+         * are also recursively evaluated by the following rules.
309
+         * @since v0.1.21
310
+         */
311
+        function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
312
+        /**
313
+         * **Strict assertion mode**
314
+         *
315
+         * An alias of {@link notDeepStrictEqual}.
316
+         *
317
+         * **Legacy assertion mode**
318
+         *
319
+         * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead.
320
+         *
321
+         * Tests for any deep inequality. Opposite of {@link deepEqual}.
322
+         *
323
+         * ```js
324
+         * import assert from 'assert';
325
+         *
326
+         * const obj1 = {
327
+         *   a: {
328
+         *     b: 1
329
+         *   }
330
+         * };
331
+         * const obj2 = {
332
+         *   a: {
333
+         *     b: 2
334
+         *   }
335
+         * };
336
+         * const obj3 = {
337
+         *   a: {
338
+         *     b: 1
339
+         *   }
340
+         * };
341
+         * const obj4 = Object.create(obj1);
342
+         *
343
+         * assert.notDeepEqual(obj1, obj1);
344
+         * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
345
+         *
346
+         * assert.notDeepEqual(obj1, obj2);
347
+         * // OK
348
+         *
349
+         * assert.notDeepEqual(obj1, obj3);
350
+         * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
351
+         *
352
+         * assert.notDeepEqual(obj1, obj4);
353
+         * // OK
354
+         * ```
355
+         *
356
+         * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
357
+         * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
358
+         * instead of the `AssertionError`.
359
+         * @since v0.1.21
360
+         */
361
+        function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
362
+        /**
363
+         * Tests strict equality between the `actual` and `expected` parameters as
364
+         * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
365
+         *
366
+         * ```js
367
+         * import assert from 'assert/strict';
368
+         *
369
+         * assert.strictEqual(1, 2);
370
+         * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
371
+         * //
372
+         * // 1 !== 2
373
+         *
374
+         * assert.strictEqual(1, 1);
375
+         * // OK
376
+         *
377
+         * assert.strictEqual('Hello foobar', 'Hello World!');
378
+         * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
379
+         * // + actual - expected
380
+         * //
381
+         * // + 'Hello foobar'
382
+         * // - 'Hello World!'
383
+         * //          ^
384
+         *
385
+         * const apples = 1;
386
+         * const oranges = 2;
387
+         * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
388
+         * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
389
+         *
390
+         * assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
391
+         * // TypeError: Inputs are not identical
392
+         * ```
393
+         *
394
+         * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
395
+         * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
396
+         * instead of the `AssertionError`.
397
+         * @since v0.1.21
398
+         */
399
+        function strictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
400
+        /**
401
+         * Tests strict inequality between the `actual` and `expected` parameters as
402
+         * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
403
+         *
404
+         * ```js
405
+         * import assert from 'assert/strict';
406
+         *
407
+         * assert.notStrictEqual(1, 2);
408
+         * // OK
409
+         *
410
+         * assert.notStrictEqual(1, 1);
411
+         * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to:
412
+         * //
413
+         * // 1
414
+         *
415
+         * assert.notStrictEqual(1, '1');
416
+         * // OK
417
+         * ```
418
+         *
419
+         * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
420
+         * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
421
+         * instead of the `AssertionError`.
422
+         * @since v0.1.21
423
+         */
424
+        function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
425
+        /**
426
+         * Tests for deep equality between the `actual` and `expected` parameters.
427
+         * "Deep" equality means that the enumerable "own" properties of child objects
428
+         * are recursively evaluated also by the following rules.
429
+         * @since v1.2.0
430
+         */
431
+        function deepStrictEqual<T>(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
432
+        /**
433
+         * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
434
+         *
435
+         * ```js
436
+         * import assert from 'assert/strict';
437
+         *
438
+         * assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
439
+         * // OK
440
+         * ```
441
+         *
442
+         * If the values are deeply and strictly equal, an `AssertionError` is thrown
443
+         * with a `message` property set equal to the value of the `message` parameter. If
444
+         * the `message` parameter is undefined, a default error message is assigned. If
445
+         * the `message` parameter is an instance of an `Error` then it will be thrown
446
+         * instead of the `AssertionError`.
447
+         * @since v1.2.0
448
+         */
449
+        function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void;
450
+        /**
451
+         * Expects the function `fn` to throw an error.
452
+         *
453
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
454
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
455
+         * a validation object where each property will be tested for strict deep equality,
456
+         * or an instance of error where each property will be tested for strict deep
457
+         * equality including the non-enumerable `message` and `name` properties. When
458
+         * using an object, it is also possible to use a regular expression, when
459
+         * validating against a string property. See below for examples.
460
+         *
461
+         * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
462
+         * fails.
463
+         *
464
+         * Custom validation object/error instance:
465
+         *
466
+         * ```js
467
+         * import assert from 'assert/strict';
468
+         *
469
+         * const err = new TypeError('Wrong value');
470
+         * err.code = 404;
471
+         * err.foo = 'bar';
472
+         * err.info = {
473
+         *   nested: true,
474
+         *   baz: 'text'
475
+         * };
476
+         * err.reg = /abc/i;
477
+         *
478
+         * assert.throws(
479
+         *   () => {
480
+         *     throw err;
481
+         *   },
482
+         *   {
483
+         *     name: 'TypeError',
484
+         *     message: 'Wrong value',
485
+         *     info: {
486
+         *       nested: true,
487
+         *       baz: 'text'
488
+         *     }
489
+         *     // Only properties on the validation object will be tested for.
490
+         *     // Using nested objects requires all properties to be present. Otherwise
491
+         *     // the validation is going to fail.
492
+         *   }
493
+         * );
494
+         *
495
+         * // Using regular expressions to validate error properties:
496
+         * throws(
497
+         *   () => {
498
+         *     throw err;
499
+         *   },
500
+         *   {
501
+         *     // The `name` and `message` properties are strings and using regular
502
+         *     // expressions on those will match against the string. If they fail, an
503
+         *     // error is thrown.
504
+         *     name: /^TypeError$/,
505
+         *     message: /Wrong/,
506
+         *     foo: 'bar',
507
+         *     info: {
508
+         *       nested: true,
509
+         *       // It is not possible to use regular expressions for nested properties!
510
+         *       baz: 'text'
511
+         *     },
512
+         *     // The `reg` property contains a regular expression and only if the
513
+         *     // validation object contains an identical regular expression, it is going
514
+         *     // to pass.
515
+         *     reg: /abc/i
516
+         *   }
517
+         * );
518
+         *
519
+         * // Fails due to the different `message` and `name` properties:
520
+         * throws(
521
+         *   () => {
522
+         *     const otherErr = new Error('Not found');
523
+         *     // Copy all enumerable properties from `err` to `otherErr`.
524
+         *     for (const [key, value] of Object.entries(err)) {
525
+         *       otherErr[key] = value;
526
+         *     }
527
+         *     throw otherErr;
528
+         *   },
529
+         *   // The error's `message` and `name` properties will also be checked when using
530
+         *   // an error as validation object.
531
+         *   err
532
+         * );
533
+         * ```
534
+         *
535
+         * Validate instanceof using constructor:
536
+         *
537
+         * ```js
538
+         * import assert from 'assert/strict';
539
+         *
540
+         * assert.throws(
541
+         *   () => {
542
+         *     throw new Error('Wrong value');
543
+         *   },
544
+         *   Error
545
+         * );
546
+         * ```
547
+         *
548
+         * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions):
549
+         *
550
+         * Using a regular expression runs `.toString` on the error object, and will
551
+         * therefore also include the error name.
552
+         *
553
+         * ```js
554
+         * import assert from 'assert/strict';
555
+         *
556
+         * assert.throws(
557
+         *   () => {
558
+         *     throw new Error('Wrong value');
559
+         *   },
560
+         *   /^Error: Wrong value$/
561
+         * );
562
+         * ```
563
+         *
564
+         * Custom error validation:
565
+         *
566
+         * The function must return `true` to indicate all internal validations passed.
567
+         * It will otherwise fail with an `AssertionError`.
568
+         *
569
+         * ```js
570
+         * import assert from 'assert/strict';
571
+         *
572
+         * assert.throws(
573
+         *   () => {
574
+         *     throw new Error('Wrong value');
575
+         *   },
576
+         *   (err) => {
577
+         *     assert(err instanceof Error);
578
+         *     assert(/value/.test(err));
579
+         *     // Avoid returning anything from validation functions besides `true`.
580
+         *     // Otherwise, it's not clear what part of the validation failed. Instead,
581
+         *     // throw an error about the specific validation that failed (as done in this
582
+         *     // example) and add as much helpful debugging information to that error as
583
+         *     // possible.
584
+         *     return true;
585
+         *   },
586
+         *   'unexpected error'
587
+         * );
588
+         * ```
589
+         *
590
+         * `error` cannot be a string. If a string is provided as the second
591
+         * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
592
+         * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
593
+         * a string as the second argument gets considered:
594
+         *
595
+         * ```js
596
+         * import assert from 'assert/strict';
597
+         *
598
+         * function throwingFirst() {
599
+         *   throw new Error('First');
600
+         * }
601
+         *
602
+         * function throwingSecond() {
603
+         *   throw new Error('Second');
604
+         * }
605
+         *
606
+         * function notThrowing() {}
607
+         *
608
+         * // The second argument is a string and the input function threw an Error.
609
+         * // The first case will not throw as it does not match for the error message
610
+         * // thrown by the input function!
611
+         * assert.throws(throwingFirst, 'Second');
612
+         * // In the next example the message has no benefit over the message from the
613
+         * // error and since it is not clear if the user intended to actually match
614
+         * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error.
615
+         * assert.throws(throwingSecond, 'Second');
616
+         * // TypeError [ERR_AMBIGUOUS_ARGUMENT]
617
+         *
618
+         * // The string is only used (as message) in case the function does not throw:
619
+         * assert.throws(notThrowing, 'Second');
620
+         * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second
621
+         *
622
+         * // If it was intended to match for the error message do this instead:
623
+         * // It does not throw because the error messages match.
624
+         * assert.throws(throwingSecond, /Second$/);
625
+         *
626
+         * // If the error message does not match, an AssertionError is thrown.
627
+         * assert.throws(throwingFirst, /Second$/);
628
+         * // AssertionError [ERR_ASSERTION]
629
+         * ```
630
+         *
631
+         * Due to the confusing error-prone notation, avoid a string as the second
632
+         * argument.
633
+         * @since v0.1.21
634
+         */
635
+        function throws(block: () => unknown, message?: string | Error): void;
636
+        function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
637
+        /**
638
+         * Asserts that the function `fn` does not throw an error.
639
+         *
640
+         * Using `assert.doesNotThrow()` is actually not useful because there
641
+         * is no benefit in catching an error and then rethrowing it. Instead, consider
642
+         * adding a comment next to the specific code path that should not throw and keep
643
+         * error messages as expressive as possible.
644
+         *
645
+         * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
646
+         *
647
+         * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
648
+         * different type, or if the `error` parameter is undefined, the error is
649
+         * propagated back to the caller.
650
+         *
651
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
652
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
653
+         * function. See {@link throws} for more details.
654
+         *
655
+         * The following, for instance, will throw the `TypeError` because there is no
656
+         * matching error type in the assertion:
657
+         *
658
+         * ```js
659
+         * import assert from 'assert/strict';
660
+         *
661
+         * assert.doesNotThrow(
662
+         *   () => {
663
+         *     throw new TypeError('Wrong value');
664
+         *   },
665
+         *   SyntaxError
666
+         * );
667
+         * ```
668
+         *
669
+         * However, the following will result in an `AssertionError` with the message
670
+         * 'Got unwanted exception...':
671
+         *
672
+         * ```js
673
+         * import assert from 'assert/strict';
674
+         *
675
+         * assert.doesNotThrow(
676
+         *   () => {
677
+         *     throw new TypeError('Wrong value');
678
+         *   },
679
+         *   TypeError
680
+         * );
681
+         * ```
682
+         *
683
+         * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
684
+         *
685
+         * ```js
686
+         * import assert from 'assert/strict';
687
+         *
688
+         * assert.doesNotThrow(
689
+         *   () => {
690
+         *     throw new TypeError('Wrong value');
691
+         *   },
692
+         *   /Wrong value/,
693
+         *   'Whoops'
694
+         * );
695
+         * // Throws: AssertionError: Got unwanted exception: Whoops
696
+         * ```
697
+         * @since v0.1.21
698
+         */
699
+        function doesNotThrow(block: () => unknown, message?: string | Error): void;
700
+        function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void;
701
+        /**
702
+         * Throws `value` if `value` is not `undefined` or `null`. This is useful when
703
+         * testing the `error` argument in callbacks. The stack trace contains all frames
704
+         * from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
705
+         *
706
+         * ```js
707
+         * import assert from 'assert/strict';
708
+         *
709
+         * assert.ifError(null);
710
+         * // OK
711
+         * assert.ifError(0);
712
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0
713
+         * assert.ifError('error');
714
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error'
715
+         * assert.ifError(new Error());
716
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error
717
+         *
718
+         * // Create some random error frames.
719
+         * let err;
720
+         * (function errorFrame() {
721
+         *   err = new Error('test error');
722
+         * })();
723
+         *
724
+         * (function ifErrorFrame() {
725
+         *   assert.ifError(err);
726
+         * })();
727
+         * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
728
+         * //     at ifErrorFrame
729
+         * //     at errorFrame
730
+         * ```
731
+         * @since v0.1.97
732
+         */
733
+        function ifError(value: unknown): asserts value is null | undefined;
734
+        /**
735
+         * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
736
+         * calls the function and awaits the returned promise to complete. It will then
737
+         * check that the promise is rejected.
738
+         *
739
+         * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
740
+         * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
741
+         * handler is skipped.
742
+         *
743
+         * Besides the async nature to await the completion behaves identically to {@link throws}.
744
+         *
745
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
746
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
747
+         * an object where each property will be tested for, or an instance of error where
748
+         * each property will be tested for including the non-enumerable `message` and`name` properties.
749
+         *
750
+         * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
751
+         *
752
+         * ```js
753
+         * import assert from 'assert/strict';
754
+         *
755
+         * await assert.rejects(
756
+         *   async () => {
757
+         *     throw new TypeError('Wrong value');
758
+         *   },
759
+         *   {
760
+         *     name: 'TypeError',
761
+         *     message: 'Wrong value'
762
+         *   }
763
+         * );
764
+         * ```
765
+         *
766
+         * ```js
767
+         * import assert from 'assert/strict';
768
+         *
769
+         * await assert.rejects(
770
+         *   async () => {
771
+         *     throw new TypeError('Wrong value');
772
+         *   },
773
+         *   (err) => {
774
+         *     assert.strictEqual(err.name, 'TypeError');
775
+         *     assert.strictEqual(err.message, 'Wrong value');
776
+         *     return true;
777
+         *   }
778
+         * );
779
+         * ```
780
+         *
781
+         * ```js
782
+         * import assert from 'assert/strict';
783
+         *
784
+         * assert.rejects(
785
+         *   Promise.reject(new Error('Wrong value')),
786
+         *   Error
787
+         * ).then(() => {
788
+         *   // ...
789
+         * });
790
+         * ```
791
+         *
792
+         * `error` cannot be a string. If a string is provided as the second
793
+         * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
794
+         * example in {@link throws} carefully if using a string as the second
795
+         * argument gets considered.
796
+         * @since v10.0.0
797
+         */
798
+        function rejects(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
799
+        function rejects(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
800
+        /**
801
+         * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
802
+         * calls the function and awaits the returned promise to complete. It will then
803
+         * check that the promise is not rejected.
804
+         *
805
+         * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
806
+         * the function does not return a promise, `assert.doesNotReject()` will return a
807
+         * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
808
+         * the error handler is skipped.
809
+         *
810
+         * Using `assert.doesNotReject()` is actually not useful because there is little
811
+         * benefit in catching a rejection and then rejecting it again. Instead, consider
812
+         * adding a comment next to the specific code path that should not reject and keep
813
+         * error messages as expressive as possible.
814
+         *
815
+         * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
816
+         * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
817
+         * function. See {@link throws} for more details.
818
+         *
819
+         * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
820
+         *
821
+         * ```js
822
+         * import assert from 'assert/strict';
823
+         *
824
+         * await assert.doesNotReject(
825
+         *   async () => {
826
+         *     throw new TypeError('Wrong value');
827
+         *   },
828
+         *   SyntaxError
829
+         * );
830
+         * ```
831
+         *
832
+         * ```js
833
+         * import assert from 'assert/strict';
834
+         *
835
+         * assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
836
+         *   .then(() => {
837
+         *     // ...
838
+         *   });
839
+         * ```
840
+         * @since v10.0.0
841
+         */
842
+        function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, message?: string | Error): Promise<void>;
843
+        function doesNotReject(block: (() => Promise<unknown>) | Promise<unknown>, error: AssertPredicate, message?: string | Error): Promise<void>;
844
+        /**
845
+         * Expects the `string` input to match the regular expression.
846
+         *
847
+         * ```js
848
+         * import assert from 'assert/strict';
849
+         *
850
+         * assert.match('I will fail', /pass/);
851
+         * // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
852
+         *
853
+         * assert.match(123, /pass/);
854
+         * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
855
+         *
856
+         * assert.match('I will pass', /pass/);
857
+         * // OK
858
+         * ```
859
+         *
860
+         * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
861
+         * to the value of the `message` parameter. If the `message` parameter is
862
+         * undefined, a default error message is assigned. If the `message` parameter is an
863
+         * instance of an `Error` then it will be thrown instead of the `AssertionError`.
864
+         * @since v13.6.0, v12.16.0
865
+         */
866
+        function match(value: string, regExp: RegExp, message?: string | Error): void;
867
+        /**
868
+         * Expects the `string` input not to match the regular expression.
869
+         *
870
+         * ```js
871
+         * import assert from 'assert/strict';
872
+         *
873
+         * assert.doesNotMatch('I will fail', /fail/);
874
+         * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
875
+         *
876
+         * assert.doesNotMatch(123, /pass/);
877
+         * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string.
878
+         *
879
+         * assert.doesNotMatch('I will pass', /different/);
880
+         * // OK
881
+         * ```
882
+         *
883
+         * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
884
+         * to the value of the `message` parameter. If the `message` parameter is
885
+         * undefined, a default error message is assigned. If the `message` parameter is an
886
+         * instance of an `Error` then it will be thrown instead of the `AssertionError`.
887
+         * @since v13.6.0, v12.16.0
888
+         */
889
+        function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
890
+        const strict: Omit<typeof assert, 'equal' | 'notEqual' | 'deepEqual' | 'notDeepEqual' | 'ok' | 'strictEqual' | 'deepStrictEqual' | 'ifError' | 'strict'> & {
891
+            (value: unknown, message?: string | Error): asserts value;
892
+            equal: typeof strictEqual;
893
+            notEqual: typeof notStrictEqual;
894
+            deepEqual: typeof deepStrictEqual;
895
+            notDeepEqual: typeof notDeepStrictEqual;
896
+            // Mapped types and assertion functions are incompatible?
897
+            // TS2775: Assertions require every name in the call target
898
+            // to be declared with an explicit type annotation.
899
+            ok: typeof ok;
900
+            strictEqual: typeof strictEqual;
901
+            deepStrictEqual: typeof deepStrictEqual;
902
+            ifError: typeof ifError;
903
+            strict: typeof strict;
904
+        };
905
+    }
906
+    export = assert;
907
+}
908
+declare module 'node:assert' {
909
+    import assert = require('assert');
910
+    export = assert;
911
+}

+ 8
- 0
node_modules/@types/node/ts4.8/assert/strict.d.ts 查看文件

@@ -0,0 +1,8 @@
1
+declare module 'assert/strict' {
2
+    import { strict } from 'node:assert';
3
+    export = strict;
4
+}
5
+declare module 'node:assert/strict' {
6
+    import { strict } from 'node:assert';
7
+    export = strict;
8
+}

+ 501
- 0
node_modules/@types/node/ts4.8/async_hooks.d.ts 查看文件

@@ -0,0 +1,501 @@
1
+/**
2
+ * The `async_hooks` module provides an API to track asynchronous resources. It
3
+ * can be accessed using:
4
+ *
5
+ * ```js
6
+ * import async_hooks from 'async_hooks';
7
+ * ```
8
+ * @experimental
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/async_hooks.js)
10
+ */
11
+declare module 'async_hooks' {
12
+    /**
13
+     * ```js
14
+     * import { executionAsyncId } from 'async_hooks';
15
+     *
16
+     * console.log(executionAsyncId());  // 1 - bootstrap
17
+     * fs.open(path, 'r', (err, fd) => {
18
+     *   console.log(executionAsyncId());  // 6 - open()
19
+     * });
20
+     * ```
21
+     *
22
+     * The ID returned from `executionAsyncId()` is related to execution timing, not
23
+     * causality (which is covered by `triggerAsyncId()`):
24
+     *
25
+     * ```js
26
+     * const server = net.createServer((conn) => {
27
+     *   // Returns the ID of the server, not of the new connection, because the
28
+     *   // callback runs in the execution scope of the server's MakeCallback().
29
+     *   async_hooks.executionAsyncId();
30
+     *
31
+     * }).listen(port, () => {
32
+     *   // Returns the ID of a TickObject (process.nextTick()) because all
33
+     *   // callbacks passed to .listen() are wrapped in a nextTick().
34
+     *   async_hooks.executionAsyncId();
35
+     * });
36
+     * ```
37
+     *
38
+     * Promise contexts may not get precise `executionAsyncIds` by default.
39
+     * See the section on `promise execution tracking`.
40
+     * @since v8.1.0
41
+     * @return The `asyncId` of the current execution context. Useful to track when something calls.
42
+     */
43
+    function executionAsyncId(): number;
44
+    /**
45
+     * Resource objects returned by `executionAsyncResource()` are most often internal
46
+     * Node.js handle objects with undocumented APIs. Using any functions or properties
47
+     * on the object is likely to crash your application and should be avoided.
48
+     *
49
+     * Using `executionAsyncResource()` in the top-level execution context will
50
+     * return an empty object as there is no handle or request object to use,
51
+     * but having an object representing the top-level can be helpful.
52
+     *
53
+     * ```js
54
+     * import { open } from 'fs';
55
+     * import { executionAsyncId, executionAsyncResource } from 'async_hooks';
56
+     *
57
+     * console.log(executionAsyncId(), executionAsyncResource());  // 1 {}
58
+     * open(new URL(import.meta.url), 'r', (err, fd) => {
59
+     *   console.log(executionAsyncId(), executionAsyncResource());  // 7 FSReqWrap
60
+     * });
61
+     * ```
62
+     *
63
+     * This can be used to implement continuation local storage without the
64
+     * use of a tracking `Map` to store the metadata:
65
+     *
66
+     * ```js
67
+     * import { createServer } from 'http';
68
+     * import {
69
+     *   executionAsyncId,
70
+     *   executionAsyncResource,
71
+     *   createHook
72
+     * } from 'async_hooks';
73
+     * const sym = Symbol('state'); // Private symbol to avoid pollution
74
+     *
75
+     * createHook({
76
+     *   init(asyncId, type, triggerAsyncId, resource) {
77
+     *     const cr = executionAsyncResource();
78
+     *     if (cr) {
79
+     *       resource[sym] = cr[sym];
80
+     *     }
81
+     *   }
82
+     * }).enable();
83
+     *
84
+     * const server = createServer((req, res) => {
85
+     *   executionAsyncResource()[sym] = { state: req.url };
86
+     *   setTimeout(function() {
87
+     *     res.end(JSON.stringify(executionAsyncResource()[sym]));
88
+     *   }, 100);
89
+     * }).listen(3000);
90
+     * ```
91
+     * @since v13.9.0, v12.17.0
92
+     * @return The resource representing the current execution. Useful to store data within the resource.
93
+     */
94
+    function executionAsyncResource(): object;
95
+    /**
96
+     * ```js
97
+     * const server = net.createServer((conn) => {
98
+     *   // The resource that caused (or triggered) this callback to be called
99
+     *   // was that of the new connection. Thus the return value of triggerAsyncId()
100
+     *   // is the asyncId of "conn".
101
+     *   async_hooks.triggerAsyncId();
102
+     *
103
+     * }).listen(port, () => {
104
+     *   // Even though all callbacks passed to .listen() are wrapped in a nextTick()
105
+     *   // the callback itself exists because the call to the server's .listen()
106
+     *   // was made. So the return value would be the ID of the server.
107
+     *   async_hooks.triggerAsyncId();
108
+     * });
109
+     * ```
110
+     *
111
+     * Promise contexts may not get valid `triggerAsyncId`s by default. See
112
+     * the section on `promise execution tracking`.
113
+     * @return The ID of the resource responsible for calling the callback that is currently being executed.
114
+     */
115
+    function triggerAsyncId(): number;
116
+    interface HookCallbacks {
117
+        /**
118
+         * Called when a class is constructed that has the possibility to emit an asynchronous event.
119
+         * @param asyncId a unique ID for the async resource
120
+         * @param type the type of the async resource
121
+         * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
122
+         * @param resource reference to the resource representing the async operation, needs to be released during destroy
123
+         */
124
+        init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
125
+        /**
126
+         * When an asynchronous operation is initiated or completes a callback is called to notify the user.
127
+         * The before callback is called just before said callback is executed.
128
+         * @param asyncId the unique identifier assigned to the resource about to execute the callback.
129
+         */
130
+        before?(asyncId: number): void;
131
+        /**
132
+         * Called immediately after the callback specified in before is completed.
133
+         * @param asyncId the unique identifier assigned to the resource which has executed the callback.
134
+         */
135
+        after?(asyncId: number): void;
136
+        /**
137
+         * Called when a promise has resolve() called. This may not be in the same execution id
138
+         * as the promise itself.
139
+         * @param asyncId the unique id for the promise that was resolve()d.
140
+         */
141
+        promiseResolve?(asyncId: number): void;
142
+        /**
143
+         * Called after the resource corresponding to asyncId is destroyed
144
+         * @param asyncId a unique ID for the async resource
145
+         */
146
+        destroy?(asyncId: number): void;
147
+    }
148
+    interface AsyncHook {
149
+        /**
150
+         * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop.
151
+         */
152
+        enable(): this;
153
+        /**
154
+         * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled.
155
+         */
156
+        disable(): this;
157
+    }
158
+    /**
159
+     * Registers functions to be called for different lifetime events of each async
160
+     * operation.
161
+     *
162
+     * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the
163
+     * respective asynchronous event during a resource's lifetime.
164
+     *
165
+     * All callbacks are optional. For example, if only resource cleanup needs to
166
+     * be tracked, then only the `destroy` callback needs to be passed. The
167
+     * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
168
+     *
169
+     * ```js
170
+     * import { createHook } from 'async_hooks';
171
+     *
172
+     * const asyncHook = createHook({
173
+     *   init(asyncId, type, triggerAsyncId, resource) { },
174
+     *   destroy(asyncId) { }
175
+     * });
176
+     * ```
177
+     *
178
+     * The callbacks will be inherited via the prototype chain:
179
+     *
180
+     * ```js
181
+     * class MyAsyncCallbacks {
182
+     *   init(asyncId, type, triggerAsyncId, resource) { }
183
+     *   destroy(asyncId) {}
184
+     * }
185
+     *
186
+     * class MyAddedCallbacks extends MyAsyncCallbacks {
187
+     *   before(asyncId) { }
188
+     *   after(asyncId) { }
189
+     * }
190
+     *
191
+     * const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
192
+     * ```
193
+     *
194
+     * Because promises are asynchronous resources whose lifecycle is tracked
195
+     * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
196
+     * @since v8.1.0
197
+     * @param callbacks The `Hook Callbacks` to register
198
+     * @return Instance used for disabling and enabling hooks
199
+     */
200
+    function createHook(callbacks: HookCallbacks): AsyncHook;
201
+    interface AsyncResourceOptions {
202
+        /**
203
+         * The ID of the execution context that created this async event.
204
+         * @default executionAsyncId()
205
+         */
206
+        triggerAsyncId?: number | undefined;
207
+        /**
208
+         * Disables automatic `emitDestroy` when the object is garbage collected.
209
+         * This usually does not need to be set (even if `emitDestroy` is called
210
+         * manually), unless the resource's `asyncId` is retrieved and the
211
+         * sensitive API's `emitDestroy` is called with it.
212
+         * @default false
213
+         */
214
+        requireManualDestroy?: boolean | undefined;
215
+    }
216
+    /**
217
+     * The class `AsyncResource` is designed to be extended by the embedder's async
218
+     * resources. Using this, users can easily trigger the lifetime events of their
219
+     * own resources.
220
+     *
221
+     * The `init` hook will trigger when an `AsyncResource` is instantiated.
222
+     *
223
+     * The following is an overview of the `AsyncResource` API.
224
+     *
225
+     * ```js
226
+     * import { AsyncResource, executionAsyncId } from 'async_hooks';
227
+     *
228
+     * // AsyncResource() is meant to be extended. Instantiating a
229
+     * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
230
+     * // async_hook.executionAsyncId() is used.
231
+     * const asyncResource = new AsyncResource(
232
+     *   type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
233
+     * );
234
+     *
235
+     * // Run a function in the execution context of the resource. This will
236
+     * // * establish the context of the resource
237
+     * // * trigger the AsyncHooks before callbacks
238
+     * // * call the provided function `fn` with the supplied arguments
239
+     * // * trigger the AsyncHooks after callbacks
240
+     * // * restore the original execution context
241
+     * asyncResource.runInAsyncScope(fn, thisArg, ...args);
242
+     *
243
+     * // Call AsyncHooks destroy callbacks.
244
+     * asyncResource.emitDestroy();
245
+     *
246
+     * // Return the unique ID assigned to the AsyncResource instance.
247
+     * asyncResource.asyncId();
248
+     *
249
+     * // Return the trigger ID for the AsyncResource instance.
250
+     * asyncResource.triggerAsyncId();
251
+     * ```
252
+     */
253
+    class AsyncResource {
254
+        /**
255
+         * AsyncResource() is meant to be extended. Instantiating a
256
+         * new AsyncResource() also triggers init. If triggerAsyncId is omitted then
257
+         * async_hook.executionAsyncId() is used.
258
+         * @param type The type of async event.
259
+         * @param triggerAsyncId The ID of the execution context that created
260
+         *   this async event (default: `executionAsyncId()`), or an
261
+         *   AsyncResourceOptions object (since v9.3.0)
262
+         */
263
+        constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
264
+        /**
265
+         * Binds the given function to the current execution context.
266
+         *
267
+         * The returned function will have an `asyncResource` property referencing
268
+         * the `AsyncResource` to which the function is bound.
269
+         * @since v14.8.0, v12.19.0
270
+         * @param fn The function to bind to the current execution context.
271
+         * @param type An optional name to associate with the underlying `AsyncResource`.
272
+         */
273
+        static bind<Func extends (this: ThisArg, ...args: any[]) => any, ThisArg>(
274
+            fn: Func,
275
+            type?: string,
276
+            thisArg?: ThisArg
277
+        ): Func & {
278
+            asyncResource: AsyncResource;
279
+        };
280
+        /**
281
+         * Binds the given function to execute to this `AsyncResource`'s scope.
282
+         *
283
+         * The returned function will have an `asyncResource` property referencing
284
+         * the `AsyncResource` to which the function is bound.
285
+         * @since v14.8.0, v12.19.0
286
+         * @param fn The function to bind to the current `AsyncResource`.
287
+         */
288
+        bind<Func extends (...args: any[]) => any>(
289
+            fn: Func
290
+        ): Func & {
291
+            asyncResource: AsyncResource;
292
+        };
293
+        /**
294
+         * Call the provided function with the provided arguments in the execution context
295
+         * of the async resource. This will establish the context, trigger the AsyncHooks
296
+         * before callbacks, call the function, trigger the AsyncHooks after callbacks, and
297
+         * then restore the original execution context.
298
+         * @since v9.6.0
299
+         * @param fn The function to call in the execution context of this async resource.
300
+         * @param thisArg The receiver to be used for the function call.
301
+         * @param args Optional arguments to pass to the function.
302
+         */
303
+        runInAsyncScope<This, Result>(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
304
+        /**
305
+         * Call all `destroy` hooks. This should only ever be called once. An error will
306
+         * be thrown if it is called more than once. This **must** be manually called. If
307
+         * the resource is left to be collected by the GC then the `destroy` hooks will
308
+         * never be called.
309
+         * @return A reference to `asyncResource`.
310
+         */
311
+        emitDestroy(): this;
312
+        /**
313
+         * @return The unique `asyncId` assigned to the resource.
314
+         */
315
+        asyncId(): number;
316
+        /**
317
+         *
318
+         * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
319
+         */
320
+        triggerAsyncId(): number;
321
+    }
322
+    /**
323
+     * This class creates stores that stay coherent through asynchronous operations.
324
+     *
325
+     * While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
326
+     * implementation that involves significant optimizations that are non-obvious to
327
+     * implement.
328
+     *
329
+     * The following example uses `AsyncLocalStorage` to build a simple logger
330
+     * that assigns IDs to incoming HTTP requests and includes them in messages
331
+     * logged within each request.
332
+     *
333
+     * ```js
334
+     * import http from 'http';
335
+     * import { AsyncLocalStorage } from 'async_hooks';
336
+     *
337
+     * const asyncLocalStorage = new AsyncLocalStorage();
338
+     *
339
+     * function logWithId(msg) {
340
+     *   const id = asyncLocalStorage.getStore();
341
+     *   console.log(`${id !== undefined ? id : '-'}:`, msg);
342
+     * }
343
+     *
344
+     * let idSeq = 0;
345
+     * http.createServer((req, res) => {
346
+     *   asyncLocalStorage.run(idSeq++, () => {
347
+     *     logWithId('start');
348
+     *     // Imagine any chain of async operations here
349
+     *     setImmediate(() => {
350
+     *       logWithId('finish');
351
+     *       res.end();
352
+     *     });
353
+     *   });
354
+     * }).listen(8080);
355
+     *
356
+     * http.get('http://localhost:8080');
357
+     * http.get('http://localhost:8080');
358
+     * // Prints:
359
+     * //   0: start
360
+     * //   1: start
361
+     * //   0: finish
362
+     * //   1: finish
363
+     * ```
364
+     *
365
+     * Each instance of `AsyncLocalStorage` maintains an independent storage context.
366
+     * Multiple instances can safely exist simultaneously without risk of interfering
367
+     * with each other's data.
368
+     * @since v13.10.0, v12.17.0
369
+     */
370
+    class AsyncLocalStorage<T> {
371
+        /**
372
+         * Disables the instance of `AsyncLocalStorage`. All subsequent calls
373
+         * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
374
+         *
375
+         * When calling `asyncLocalStorage.disable()`, all current contexts linked to the
376
+         * instance will be exited.
377
+         *
378
+         * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
379
+         * provided by the `asyncLocalStorage`, as those objects are garbage collected
380
+         * along with the corresponding async resources.
381
+         *
382
+         * Use this method when the `asyncLocalStorage` is not in use anymore
383
+         * in the current process.
384
+         * @since v13.10.0, v12.17.0
385
+         * @experimental
386
+         */
387
+        disable(): void;
388
+        /**
389
+         * Returns the current store.
390
+         * If called outside of an asynchronous context initialized by
391
+         * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
392
+         * returns `undefined`.
393
+         * @since v13.10.0, v12.17.0
394
+         */
395
+        getStore(): T | undefined;
396
+        /**
397
+         * Runs a function synchronously within a context and returns its
398
+         * return value. The store is not accessible outside of the callback function.
399
+         * The store is accessible to any asynchronous operations created within the
400
+         * callback.
401
+         *
402
+         * The optional `args` are passed to the callback function.
403
+         *
404
+         * If the callback function throws an error, the error is thrown by `run()` too.
405
+         * The stacktrace is not impacted by this call and the context is exited.
406
+         *
407
+         * Example:
408
+         *
409
+         * ```js
410
+         * const store = { id: 2 };
411
+         * try {
412
+         *   asyncLocalStorage.run(store, () => {
413
+         *     asyncLocalStorage.getStore(); // Returns the store object
414
+         *     setTimeout(() => {
415
+         *       asyncLocalStorage.getStore(); // Returns the store object
416
+         *     }, 200);
417
+         *     throw new Error();
418
+         *   });
419
+         * } catch (e) {
420
+         *   asyncLocalStorage.getStore(); // Returns undefined
421
+         *   // The error will be caught here
422
+         * }
423
+         * ```
424
+         * @since v13.10.0, v12.17.0
425
+         */
426
+        run<R, TArgs extends any[]>(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
427
+        /**
428
+         * Runs a function synchronously outside of a context and returns its
429
+         * return value. The store is not accessible within the callback function or
430
+         * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
431
+         *
432
+         * The optional `args` are passed to the callback function.
433
+         *
434
+         * If the callback function throws an error, the error is thrown by `exit()` too.
435
+         * The stacktrace is not impacted by this call and the context is re-entered.
436
+         *
437
+         * Example:
438
+         *
439
+         * ```js
440
+         * // Within a call to run
441
+         * try {
442
+         *   asyncLocalStorage.getStore(); // Returns the store object or value
443
+         *   asyncLocalStorage.exit(() => {
444
+         *     asyncLocalStorage.getStore(); // Returns undefined
445
+         *     throw new Error();
446
+         *   });
447
+         * } catch (e) {
448
+         *   asyncLocalStorage.getStore(); // Returns the same object or value
449
+         *   // The error will be caught here
450
+         * }
451
+         * ```
452
+         * @since v13.10.0, v12.17.0
453
+         * @experimental
454
+         */
455
+        exit<R, TArgs extends any[]>(callback: (...args: TArgs) => R, ...args: TArgs): R;
456
+        /**
457
+         * Transitions into the context for the remainder of the current
458
+         * synchronous execution and then persists the store through any following
459
+         * asynchronous calls.
460
+         *
461
+         * Example:
462
+         *
463
+         * ```js
464
+         * const store = { id: 1 };
465
+         * // Replaces previous store with the given store object
466
+         * asyncLocalStorage.enterWith(store);
467
+         * asyncLocalStorage.getStore(); // Returns the store object
468
+         * someAsyncOperation(() => {
469
+         *   asyncLocalStorage.getStore(); // Returns the same object
470
+         * });
471
+         * ```
472
+         *
473
+         * This transition will continue for the _entire_ synchronous execution.
474
+         * This means that if, for example, the context is entered within an event
475
+         * handler subsequent event handlers will also run within that context unless
476
+         * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
477
+         * to use the latter method.
478
+         *
479
+         * ```js
480
+         * const store = { id: 1 };
481
+         *
482
+         * emitter.on('my-event', () => {
483
+         *   asyncLocalStorage.enterWith(store);
484
+         * });
485
+         * emitter.on('my-event', () => {
486
+         *   asyncLocalStorage.getStore(); // Returns the same object
487
+         * });
488
+         *
489
+         * asyncLocalStorage.getStore(); // Returns undefined
490
+         * emitter.emit('my-event');
491
+         * asyncLocalStorage.getStore(); // Returns the same object
492
+         * ```
493
+         * @since v13.11.0, v12.17.0
494
+         * @experimental
495
+         */
496
+        enterWith(store: T): void;
497
+    }
498
+}
499
+declare module 'node:async_hooks' {
500
+    export * from 'async_hooks';
501
+}

+ 2259
- 0
node_modules/@types/node/ts4.8/buffer.d.ts
文件差異過大導致無法顯示
查看文件


+ 1369
- 0
node_modules/@types/node/ts4.8/child_process.d.ts
文件差異過大導致無法顯示
查看文件


+ 410
- 0
node_modules/@types/node/ts4.8/cluster.d.ts 查看文件

@@ -0,0 +1,410 @@
1
+/**
2
+ * Clusters of Node.js processes can be used to run multiple instances of Node.js
3
+ * that can distribute workloads among their application threads. When process
4
+ * isolation is not needed, use the `worker_threads` module instead, which
5
+ * allows running multiple application threads within a single Node.js instance.
6
+ *
7
+ * The cluster module allows easy creation of child processes that all share
8
+ * server ports.
9
+ *
10
+ * ```js
11
+ * import cluster from 'cluster';
12
+ * import http from 'http';
13
+ * import { cpus } from 'os';
14
+ * import process from 'process';
15
+ *
16
+ * const numCPUs = cpus().length;
17
+ *
18
+ * if (cluster.isPrimary) {
19
+ *   console.log(`Primary ${process.pid} is running`);
20
+ *
21
+ *   // Fork workers.
22
+ *   for (let i = 0; i < numCPUs; i++) {
23
+ *     cluster.fork();
24
+ *   }
25
+ *
26
+ *   cluster.on('exit', (worker, code, signal) => {
27
+ *     console.log(`worker ${worker.process.pid} died`);
28
+ *   });
29
+ * } else {
30
+ *   // Workers can share any TCP connection
31
+ *   // In this case it is an HTTP server
32
+ *   http.createServer((req, res) => {
33
+ *     res.writeHead(200);
34
+ *     res.end('hello world\n');
35
+ *   }).listen(8000);
36
+ *
37
+ *   console.log(`Worker ${process.pid} started`);
38
+ * }
39
+ * ```
40
+ *
41
+ * Running Node.js will now share port 8000 between the workers:
42
+ *
43
+ * ```console
44
+ * $ node server.js
45
+ * Primary 3596 is running
46
+ * Worker 4324 started
47
+ * Worker 4520 started
48
+ * Worker 6056 started
49
+ * Worker 5644 started
50
+ * ```
51
+ *
52
+ * On Windows, it is not yet possible to set up a named pipe server in a worker.
53
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
54
+ */
55
+declare module 'cluster' {
56
+    import * as child from 'node:child_process';
57
+    import EventEmitter = require('node:events');
58
+    import * as net from 'node:net';
59
+    export interface ClusterSettings {
60
+        execArgv?: string[] | undefined; // default: process.execArgv
61
+        exec?: string | undefined;
62
+        args?: string[] | undefined;
63
+        silent?: boolean | undefined;
64
+        stdio?: any[] | undefined;
65
+        uid?: number | undefined;
66
+        gid?: number | undefined;
67
+        inspectPort?: number | (() => number) | undefined;
68
+    }
69
+    export interface Address {
70
+        address: string;
71
+        port: number;
72
+        addressType: number | 'udp4' | 'udp6'; // 4, 6, -1, "udp4", "udp6"
73
+    }
74
+    /**
75
+     * A `Worker` object contains all public information and method about a worker.
76
+     * In the primary it can be obtained using `cluster.workers`. In a worker
77
+     * it can be obtained using `cluster.worker`.
78
+     * @since v0.7.0
79
+     */
80
+    export class Worker extends EventEmitter {
81
+        /**
82
+         * Each new worker is given its own unique id, this id is stored in the`id`.
83
+         *
84
+         * While a worker is alive, this is the key that indexes it in`cluster.workers`.
85
+         * @since v0.8.0
86
+         */
87
+        id: number;
88
+        /**
89
+         * All workers are created using `child_process.fork()`, the returned object
90
+         * from this function is stored as `.process`. In a worker, the global `process`is stored.
91
+         *
92
+         * See: `Child Process module`.
93
+         *
94
+         * Workers will call `process.exit(0)` if the `'disconnect'` event occurs
95
+         * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
96
+         * accidental disconnection.
97
+         * @since v0.7.0
98
+         */
99
+        process: child.ChildProcess;
100
+        /**
101
+         * Send a message to a worker or primary, optionally with a handle.
102
+         *
103
+         * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
104
+         *
105
+         * In a worker, this sends a message to the primary. It is identical to`process.send()`.
106
+         *
107
+         * This example will echo back all messages from the primary:
108
+         *
109
+         * ```js
110
+         * if (cluster.isPrimary) {
111
+         *   const worker = cluster.fork();
112
+         *   worker.send('hi there');
113
+         *
114
+         * } else if (cluster.isWorker) {
115
+         *   process.on('message', (msg) => {
116
+         *     process.send(msg);
117
+         *   });
118
+         * }
119
+         * ```
120
+         * @since v0.7.0
121
+         * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
122
+         */
123
+        send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
124
+        send(message: child.Serializable, sendHandle: child.SendHandle, callback?: (error: Error | null) => void): boolean;
125
+        send(message: child.Serializable, sendHandle: child.SendHandle, options?: child.MessageOptions, callback?: (error: Error | null) => void): boolean;
126
+        /**
127
+         * This function will kill the worker. In the primary worker, it does this by
128
+         * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
129
+         *
130
+         * The `kill()` function kills the worker process without waiting for a graceful
131
+         * disconnect, it has the same behavior as `worker.process.kill()`.
132
+         *
133
+         * This method is aliased as `worker.destroy()` for backwards compatibility.
134
+         *
135
+         * In a worker, `process.kill()` exists, but it is not this function;
136
+         * it is `kill()`.
137
+         * @since v0.9.12
138
+         * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
139
+         */
140
+        kill(signal?: string): void;
141
+        destroy(signal?: string): void;
142
+        /**
143
+         * In a worker, this function will close all servers, wait for the `'close'` event
144
+         * on those servers, and then disconnect the IPC channel.
145
+         *
146
+         * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
147
+         *
148
+         * Causes `.exitedAfterDisconnect` to be set.
149
+         *
150
+         * After a server is closed, it will no longer accept new connections,
151
+         * but connections may be accepted by any other listening worker. Existing
152
+         * connections will be allowed to close as usual. When no more connections exist,
153
+         * see `server.close()`, the IPC channel to the worker will close allowing it
154
+         * to die gracefully.
155
+         *
156
+         * The above applies _only_ to server connections, client connections are not
157
+         * automatically closed by workers, and disconnect does not wait for them to close
158
+         * before exiting.
159
+         *
160
+         * In a worker, `process.disconnect` exists, but it is not this function;
161
+         * it is `disconnect()`.
162
+         *
163
+         * Because long living server connections may block workers from disconnecting, it
164
+         * may be useful to send a message, so application specific actions may be taken to
165
+         * close them. It also may be useful to implement a timeout, killing a worker if
166
+         * the `'disconnect'` event has not been emitted after some time.
167
+         *
168
+         * ```js
169
+         * if (cluster.isPrimary) {
170
+         *   const worker = cluster.fork();
171
+         *   let timeout;
172
+         *
173
+         *   worker.on('listening', (address) => {
174
+         *     worker.send('shutdown');
175
+         *     worker.disconnect();
176
+         *     timeout = setTimeout(() => {
177
+         *       worker.kill();
178
+         *     }, 2000);
179
+         *   });
180
+         *
181
+         *   worker.on('disconnect', () => {
182
+         *     clearTimeout(timeout);
183
+         *   });
184
+         *
185
+         * } else if (cluster.isWorker) {
186
+         *   const net = require('net');
187
+         *   const server = net.createServer((socket) => {
188
+         *     // Connections never end
189
+         *   });
190
+         *
191
+         *   server.listen(8000);
192
+         *
193
+         *   process.on('message', (msg) => {
194
+         *     if (msg === 'shutdown') {
195
+         *       // Initiate graceful close of any connections to server
196
+         *     }
197
+         *   });
198
+         * }
199
+         * ```
200
+         * @since v0.7.7
201
+         * @return A reference to `worker`.
202
+         */
203
+        disconnect(): void;
204
+        /**
205
+         * This function returns `true` if the worker is connected to its primary via its
206
+         * IPC channel, `false` otherwise. A worker is connected to its primary after it
207
+         * has been created. It is disconnected after the `'disconnect'` event is emitted.
208
+         * @since v0.11.14
209
+         */
210
+        isConnected(): boolean;
211
+        /**
212
+         * This function returns `true` if the worker's process has terminated (either
213
+         * because of exiting or being signaled). Otherwise, it returns `false`.
214
+         *
215
+         * ```js
216
+         * import cluster from 'cluster';
217
+         * import http from 'http';
218
+         * import { cpus } from 'os';
219
+         * import process from 'process';
220
+         *
221
+         * const numCPUs = cpus().length;
222
+         *
223
+         * if (cluster.isPrimary) {
224
+         *   console.log(`Primary ${process.pid} is running`);
225
+         *
226
+         *   // Fork workers.
227
+         *   for (let i = 0; i < numCPUs; i++) {
228
+         *     cluster.fork();
229
+         *   }
230
+         *
231
+         *   cluster.on('fork', (worker) => {
232
+         *     console.log('worker is dead:', worker.isDead());
233
+         *   });
234
+         *
235
+         *   cluster.on('exit', (worker, code, signal) => {
236
+         *     console.log('worker is dead:', worker.isDead());
237
+         *   });
238
+         * } else {
239
+         *   // Workers can share any TCP connection. In this case, it is an HTTP server.
240
+         *   http.createServer((req, res) => {
241
+         *     res.writeHead(200);
242
+         *     res.end(`Current process\n ${process.pid}`);
243
+         *     process.kill(process.pid);
244
+         *   }).listen(8000);
245
+         * }
246
+         * ```
247
+         * @since v0.11.14
248
+         */
249
+        isDead(): boolean;
250
+        /**
251
+         * This property is `true` if the worker exited due to `.disconnect()`.
252
+         * If the worker exited any other way, it is `false`. If the
253
+         * worker has not exited, it is `undefined`.
254
+         *
255
+         * The boolean `worker.exitedAfterDisconnect` allows distinguishing between
256
+         * voluntary and accidental exit, the primary may choose not to respawn a worker
257
+         * based on this value.
258
+         *
259
+         * ```js
260
+         * cluster.on('exit', (worker, code, signal) => {
261
+         *   if (worker.exitedAfterDisconnect === true) {
262
+         *     console.log('Oh, it was just voluntary – no need to worry');
263
+         *   }
264
+         * });
265
+         *
266
+         * // kill worker
267
+         * worker.kill();
268
+         * ```
269
+         * @since v6.0.0
270
+         */
271
+        exitedAfterDisconnect: boolean;
272
+        /**
273
+         * events.EventEmitter
274
+         *   1. disconnect
275
+         *   2. error
276
+         *   3. exit
277
+         *   4. listening
278
+         *   5. message
279
+         *   6. online
280
+         */
281
+        addListener(event: string, listener: (...args: any[]) => void): this;
282
+        addListener(event: 'disconnect', listener: () => void): this;
283
+        addListener(event: 'error', listener: (error: Error) => void): this;
284
+        addListener(event: 'exit', listener: (code: number, signal: string) => void): this;
285
+        addListener(event: 'listening', listener: (address: Address) => void): this;
286
+        addListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
287
+        addListener(event: 'online', listener: () => void): this;
288
+        emit(event: string | symbol, ...args: any[]): boolean;
289
+        emit(event: 'disconnect'): boolean;
290
+        emit(event: 'error', error: Error): boolean;
291
+        emit(event: 'exit', code: number, signal: string): boolean;
292
+        emit(event: 'listening', address: Address): boolean;
293
+        emit(event: 'message', message: any, handle: net.Socket | net.Server): boolean;
294
+        emit(event: 'online'): boolean;
295
+        on(event: string, listener: (...args: any[]) => void): this;
296
+        on(event: 'disconnect', listener: () => void): this;
297
+        on(event: 'error', listener: (error: Error) => void): this;
298
+        on(event: 'exit', listener: (code: number, signal: string) => void): this;
299
+        on(event: 'listening', listener: (address: Address) => void): this;
300
+        on(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
301
+        on(event: 'online', listener: () => void): this;
302
+        once(event: string, listener: (...args: any[]) => void): this;
303
+        once(event: 'disconnect', listener: () => void): this;
304
+        once(event: 'error', listener: (error: Error) => void): this;
305
+        once(event: 'exit', listener: (code: number, signal: string) => void): this;
306
+        once(event: 'listening', listener: (address: Address) => void): this;
307
+        once(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
308
+        once(event: 'online', listener: () => void): this;
309
+        prependListener(event: string, listener: (...args: any[]) => void): this;
310
+        prependListener(event: 'disconnect', listener: () => void): this;
311
+        prependListener(event: 'error', listener: (error: Error) => void): this;
312
+        prependListener(event: 'exit', listener: (code: number, signal: string) => void): this;
313
+        prependListener(event: 'listening', listener: (address: Address) => void): this;
314
+        prependListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
315
+        prependListener(event: 'online', listener: () => void): this;
316
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
317
+        prependOnceListener(event: 'disconnect', listener: () => void): this;
318
+        prependOnceListener(event: 'error', listener: (error: Error) => void): this;
319
+        prependOnceListener(event: 'exit', listener: (code: number, signal: string) => void): this;
320
+        prependOnceListener(event: 'listening', listener: (address: Address) => void): this;
321
+        prependOnceListener(event: 'message', listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
322
+        prependOnceListener(event: 'online', listener: () => void): this;
323
+    }
324
+    export interface Cluster extends EventEmitter {
325
+        disconnect(callback?: () => void): void;
326
+        fork(env?: any): Worker;
327
+        /** @deprecated since v16.0.0 - use isPrimary. */
328
+        readonly isMaster: boolean;
329
+        readonly isPrimary: boolean;
330
+        readonly isWorker: boolean;
331
+        schedulingPolicy: number;
332
+        readonly settings: ClusterSettings;
333
+        /** @deprecated since v16.0.0 - use setupPrimary. */
334
+        setupMaster(settings?: ClusterSettings): void;
335
+        /**
336
+         * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
337
+         */
338
+        setupPrimary(settings?: ClusterSettings): void;
339
+        readonly worker?: Worker | undefined;
340
+        readonly workers?: NodeJS.Dict<Worker> | undefined;
341
+        readonly SCHED_NONE: number;
342
+        readonly SCHED_RR: number;
343
+        /**
344
+         * events.EventEmitter
345
+         *   1. disconnect
346
+         *   2. exit
347
+         *   3. fork
348
+         *   4. listening
349
+         *   5. message
350
+         *   6. online
351
+         *   7. setup
352
+         */
353
+        addListener(event: string, listener: (...args: any[]) => void): this;
354
+        addListener(event: 'disconnect', listener: (worker: Worker) => void): this;
355
+        addListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
356
+        addListener(event: 'fork', listener: (worker: Worker) => void): this;
357
+        addListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
358
+        addListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
359
+        addListener(event: 'online', listener: (worker: Worker) => void): this;
360
+        addListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
361
+        emit(event: string | symbol, ...args: any[]): boolean;
362
+        emit(event: 'disconnect', worker: Worker): boolean;
363
+        emit(event: 'exit', worker: Worker, code: number, signal: string): boolean;
364
+        emit(event: 'fork', worker: Worker): boolean;
365
+        emit(event: 'listening', worker: Worker, address: Address): boolean;
366
+        emit(event: 'message', worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
367
+        emit(event: 'online', worker: Worker): boolean;
368
+        emit(event: 'setup', settings: ClusterSettings): boolean;
369
+        on(event: string, listener: (...args: any[]) => void): this;
370
+        on(event: 'disconnect', listener: (worker: Worker) => void): this;
371
+        on(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
372
+        on(event: 'fork', listener: (worker: Worker) => void): this;
373
+        on(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
374
+        on(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
375
+        on(event: 'online', listener: (worker: Worker) => void): this;
376
+        on(event: 'setup', listener: (settings: ClusterSettings) => void): this;
377
+        once(event: string, listener: (...args: any[]) => void): this;
378
+        once(event: 'disconnect', listener: (worker: Worker) => void): this;
379
+        once(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
380
+        once(event: 'fork', listener: (worker: Worker) => void): this;
381
+        once(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
382
+        once(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
383
+        once(event: 'online', listener: (worker: Worker) => void): this;
384
+        once(event: 'setup', listener: (settings: ClusterSettings) => void): this;
385
+        prependListener(event: string, listener: (...args: any[]) => void): this;
386
+        prependListener(event: 'disconnect', listener: (worker: Worker) => void): this;
387
+        prependListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
388
+        prependListener(event: 'fork', listener: (worker: Worker) => void): this;
389
+        prependListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
390
+        // the handle is a net.Socket or net.Server object, or undefined.
391
+        prependListener(event: 'message', listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void): this;
392
+        prependListener(event: 'online', listener: (worker: Worker) => void): this;
393
+        prependListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
394
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
395
+        prependOnceListener(event: 'disconnect', listener: (worker: Worker) => void): this;
396
+        prependOnceListener(event: 'exit', listener: (worker: Worker, code: number, signal: string) => void): this;
397
+        prependOnceListener(event: 'fork', listener: (worker: Worker) => void): this;
398
+        prependOnceListener(event: 'listening', listener: (worker: Worker, address: Address) => void): this;
399
+        // the handle is a net.Socket or net.Server object, or undefined.
400
+        prependOnceListener(event: 'message', listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this;
401
+        prependOnceListener(event: 'online', listener: (worker: Worker) => void): this;
402
+        prependOnceListener(event: 'setup', listener: (settings: ClusterSettings) => void): this;
403
+    }
404
+    const cluster: Cluster;
405
+    export default cluster;
406
+}
407
+declare module 'node:cluster' {
408
+    export * from 'cluster';
409
+    export { default as default } from 'cluster';
410
+}

+ 412
- 0
node_modules/@types/node/ts4.8/console.d.ts 查看文件

@@ -0,0 +1,412 @@
1
+/**
2
+ * The `console` module provides a simple debugging console that is similar to the
3
+ * JavaScript console mechanism provided by web browsers.
4
+ *
5
+ * The module exports two specific components:
6
+ *
7
+ * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
8
+ * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
9
+ *
10
+ * _**Warning**_: The global console object's methods are neither consistently
11
+ * synchronous like the browser APIs they resemble, nor are they consistently
12
+ * asynchronous like all other Node.js streams. See the `note on process I/O` for
13
+ * more information.
14
+ *
15
+ * Example using the global `console`:
16
+ *
17
+ * ```js
18
+ * console.log('hello world');
19
+ * // Prints: hello world, to stdout
20
+ * console.log('hello %s', 'world');
21
+ * // Prints: hello world, to stdout
22
+ * console.error(new Error('Whoops, something bad happened'));
23
+ * // Prints error message and stack trace to stderr:
24
+ * //   Error: Whoops, something bad happened
25
+ * //     at [eval]:5:15
26
+ * //     at Script.runInThisContext (node:vm:132:18)
27
+ * //     at Object.runInThisContext (node:vm:309:38)
28
+ * //     at node:internal/process/execution:77:19
29
+ * //     at [eval]-wrapper:6:22
30
+ * //     at evalScript (node:internal/process/execution:76:60)
31
+ * //     at node:internal/main/eval_string:23:3
32
+ *
33
+ * const name = 'Will Robinson';
34
+ * console.warn(`Danger ${name}! Danger!`);
35
+ * // Prints: Danger Will Robinson! Danger!, to stderr
36
+ * ```
37
+ *
38
+ * Example using the `Console` class:
39
+ *
40
+ * ```js
41
+ * const out = getStreamSomehow();
42
+ * const err = getStreamSomehow();
43
+ * const myConsole = new console.Console(out, err);
44
+ *
45
+ * myConsole.log('hello world');
46
+ * // Prints: hello world, to out
47
+ * myConsole.log('hello %s', 'world');
48
+ * // Prints: hello world, to out
49
+ * myConsole.error(new Error('Whoops, something bad happened'));
50
+ * // Prints: [Error: Whoops, something bad happened], to err
51
+ *
52
+ * const name = 'Will Robinson';
53
+ * myConsole.warn(`Danger ${name}! Danger!`);
54
+ * // Prints: Danger Will Robinson! Danger!, to err
55
+ * ```
56
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/console.js)
57
+ */
58
+declare module 'console' {
59
+    import console = require('node:console');
60
+    export = console;
61
+}
62
+declare module 'node:console' {
63
+    import { InspectOptions } from 'node:util';
64
+    global {
65
+        // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
66
+        interface Console {
67
+            Console: console.ConsoleConstructor;
68
+            /**
69
+             * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
70
+             * writes a message and does not otherwise affect execution. The output always
71
+             * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`.
72
+             *
73
+             * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
74
+             *
75
+             * ```js
76
+             * console.assert(true, 'does nothing');
77
+             *
78
+             * console.assert(false, 'Whoops %s work', 'didn\'t');
79
+             * // Assertion failed: Whoops didn't work
80
+             *
81
+             * console.assert();
82
+             * // Assertion failed
83
+             * ```
84
+             * @since v0.1.101
85
+             * @param value The value tested for being truthy.
86
+             * @param message All arguments besides `value` are used as error message.
87
+             */
88
+            assert(value: any, message?: string, ...optionalParams: any[]): void;
89
+            /**
90
+             * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the
91
+             * TTY. When `stdout` is not a TTY, this method does nothing.
92
+             *
93
+             * The specific operation of `console.clear()` can vary across operating systems
94
+             * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the
95
+             * current terminal viewport for the Node.js
96
+             * binary.
97
+             * @since v8.3.0
98
+             */
99
+            clear(): void;
100
+            /**
101
+             * Maintains an internal counter specific to `label` and outputs to `stdout` the
102
+             * number of times `console.count()` has been called with the given `label`.
103
+             *
104
+             * ```js
105
+             * > console.count()
106
+             * default: 1
107
+             * undefined
108
+             * > console.count('default')
109
+             * default: 2
110
+             * undefined
111
+             * > console.count('abc')
112
+             * abc: 1
113
+             * undefined
114
+             * > console.count('xyz')
115
+             * xyz: 1
116
+             * undefined
117
+             * > console.count('abc')
118
+             * abc: 2
119
+             * undefined
120
+             * > console.count()
121
+             * default: 3
122
+             * undefined
123
+             * >
124
+             * ```
125
+             * @since v8.3.0
126
+             * @param label The display label for the counter.
127
+             */
128
+            count(label?: string): void;
129
+            /**
130
+             * Resets the internal counter specific to `label`.
131
+             *
132
+             * ```js
133
+             * > console.count('abc');
134
+             * abc: 1
135
+             * undefined
136
+             * > console.countReset('abc');
137
+             * undefined
138
+             * > console.count('abc');
139
+             * abc: 1
140
+             * undefined
141
+             * >
142
+             * ```
143
+             * @since v8.3.0
144
+             * @param label The display label for the counter.
145
+             */
146
+            countReset(label?: string): void;
147
+            /**
148
+             * The `console.debug()` function is an alias for {@link log}.
149
+             * @since v8.0.0
150
+             */
151
+            debug(message?: any, ...optionalParams: any[]): void;
152
+            /**
153
+             * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`.
154
+             * This function bypasses any custom `inspect()` function defined on `obj`.
155
+             * @since v0.1.101
156
+             */
157
+            dir(obj: any, options?: InspectOptions): void;
158
+            /**
159
+             * This method calls `console.log()` passing it the arguments received.
160
+             * This method does not produce any XML formatting.
161
+             * @since v8.0.0
162
+             */
163
+            dirxml(...data: any[]): void;
164
+            /**
165
+             * Prints to `stderr` with newline. Multiple arguments can be passed, with the
166
+             * first used as the primary message and all additional used as substitution
167
+             * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
168
+             *
169
+             * ```js
170
+             * const code = 5;
171
+             * console.error('error #%d', code);
172
+             * // Prints: error #5, to stderr
173
+             * console.error('error', code);
174
+             * // Prints: error 5, to stderr
175
+             * ```
176
+             *
177
+             * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string
178
+             * values are concatenated. See `util.format()` for more information.
179
+             * @since v0.1.100
180
+             */
181
+            error(message?: any, ...optionalParams: any[]): void;
182
+            /**
183
+             * Increases indentation of subsequent lines by spaces for `groupIndentation`length.
184
+             *
185
+             * If one or more `label`s are provided, those are printed first without the
186
+             * additional indentation.
187
+             * @since v8.5.0
188
+             */
189
+            group(...label: any[]): void;
190
+            /**
191
+             * An alias for {@link group}.
192
+             * @since v8.5.0
193
+             */
194
+            groupCollapsed(...label: any[]): void;
195
+            /**
196
+             * Decreases indentation of subsequent lines by spaces for `groupIndentation`length.
197
+             * @since v8.5.0
198
+             */
199
+            groupEnd(): void;
200
+            /**
201
+             * The `console.info()` function is an alias for {@link log}.
202
+             * @since v0.1.100
203
+             */
204
+            info(message?: any, ...optionalParams: any[]): void;
205
+            /**
206
+             * Prints to `stdout` with newline. Multiple arguments can be passed, with the
207
+             * first used as the primary message and all additional used as substitution
208
+             * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
209
+             *
210
+             * ```js
211
+             * const count = 5;
212
+             * console.log('count: %d', count);
213
+             * // Prints: count: 5, to stdout
214
+             * console.log('count:', count);
215
+             * // Prints: count: 5, to stdout
216
+             * ```
217
+             *
218
+             * See `util.format()` for more information.
219
+             * @since v0.1.100
220
+             */
221
+            log(message?: any, ...optionalParams: any[]): void;
222
+            /**
223
+             * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
224
+             * logging the argument if it can’t be parsed as tabular.
225
+             *
226
+             * ```js
227
+             * // These can't be parsed as tabular data
228
+             * console.table(Symbol());
229
+             * // Symbol()
230
+             *
231
+             * console.table(undefined);
232
+             * // undefined
233
+             *
234
+             * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]);
235
+             * // ┌─────────┬─────┬─────┐
236
+             * // │ (index) │  a  │  b  │
237
+             * // ├─────────┼─────┼─────┤
238
+             * // │    0    │  1  │ 'Y' │
239
+             * // │    1    │ 'Z' │  2  │
240
+             * // └─────────┴─────┴─────┘
241
+             *
242
+             * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']);
243
+             * // ┌─────────┬─────┐
244
+             * // │ (index) │  a  │
245
+             * // ├─────────┼─────┤
246
+             * // │    0    │  1  │
247
+             * // │    1    │ 'Z' │
248
+             * // └─────────┴─────┘
249
+             * ```
250
+             * @since v10.0.0
251
+             * @param properties Alternate properties for constructing the table.
252
+             */
253
+            table(tabularData: any, properties?: ReadonlyArray<string>): void;
254
+            /**
255
+             * Starts a timer that can be used to compute the duration of an operation. Timers
256
+             * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
257
+             * suitable time units to `stdout`. For example, if the elapsed
258
+             * time is 3869ms, `console.timeEnd()` displays "3.869s".
259
+             * @since v0.1.104
260
+             */
261
+            time(label?: string): void;
262
+            /**
263
+             * Stops a timer that was previously started by calling {@link time} and
264
+             * prints the result to `stdout`:
265
+             *
266
+             * ```js
267
+             * console.time('100-elements');
268
+             * for (let i = 0; i < 100; i++) {}
269
+             * console.timeEnd('100-elements');
270
+             * // prints 100-elements: 225.438ms
271
+             * ```
272
+             * @since v0.1.104
273
+             */
274
+            timeEnd(label?: string): void;
275
+            /**
276
+             * For a timer that was previously started by calling {@link time}, prints
277
+             * the elapsed time and other `data` arguments to `stdout`:
278
+             *
279
+             * ```js
280
+             * console.time('process');
281
+             * const value = expensiveProcess1(); // Returns 42
282
+             * console.timeLog('process', value);
283
+             * // Prints "process: 365.227ms 42".
284
+             * doExpensiveProcess2(value);
285
+             * console.timeEnd('process');
286
+             * ```
287
+             * @since v10.7.0
288
+             */
289
+            timeLog(label?: string, ...data: any[]): void;
290
+            /**
291
+             * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code.
292
+             *
293
+             * ```js
294
+             * console.trace('Show me');
295
+             * // Prints: (stack trace will vary based on where trace is called)
296
+             * //  Trace: Show me
297
+             * //    at repl:2:9
298
+             * //    at REPLServer.defaultEval (repl.js:248:27)
299
+             * //    at bound (domain.js:287:14)
300
+             * //    at REPLServer.runBound [as eval] (domain.js:300:12)
301
+             * //    at REPLServer.<anonymous> (repl.js:412:12)
302
+             * //    at emitOne (events.js:82:20)
303
+             * //    at REPLServer.emit (events.js:169:7)
304
+             * //    at REPLServer.Interface._onLine (readline.js:210:10)
305
+             * //    at REPLServer.Interface._line (readline.js:549:8)
306
+             * //    at REPLServer.Interface._ttyWrite (readline.js:826:14)
307
+             * ```
308
+             * @since v0.1.104
309
+             */
310
+            trace(message?: any, ...optionalParams: any[]): void;
311
+            /**
312
+             * The `console.warn()` function is an alias for {@link error}.
313
+             * @since v0.1.100
314
+             */
315
+            warn(message?: any, ...optionalParams: any[]): void;
316
+            // --- Inspector mode only ---
317
+            /**
318
+             * This method does not display anything unless used in the inspector.
319
+             *  Starts a JavaScript CPU profile with an optional label.
320
+             */
321
+            profile(label?: string): void;
322
+            /**
323
+             * This method does not display anything unless used in the inspector.
324
+             *  Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
325
+             */
326
+            profileEnd(label?: string): void;
327
+            /**
328
+             * This method does not display anything unless used in the inspector.
329
+             *  Adds an event with the label `label` to the Timeline panel of the inspector.
330
+             */
331
+            timeStamp(label?: string): void;
332
+        }
333
+        /**
334
+         * The `console` module provides a simple debugging console that is similar to the
335
+         * JavaScript console mechanism provided by web browsers.
336
+         *
337
+         * The module exports two specific components:
338
+         *
339
+         * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
340
+         * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
341
+         *
342
+         * _**Warning**_: The global console object's methods are neither consistently
343
+         * synchronous like the browser APIs they resemble, nor are they consistently
344
+         * asynchronous like all other Node.js streams. See the `note on process I/O` for
345
+         * more information.
346
+         *
347
+         * Example using the global `console`:
348
+         *
349
+         * ```js
350
+         * console.log('hello world');
351
+         * // Prints: hello world, to stdout
352
+         * console.log('hello %s', 'world');
353
+         * // Prints: hello world, to stdout
354
+         * console.error(new Error('Whoops, something bad happened'));
355
+         * // Prints error message and stack trace to stderr:
356
+         * //   Error: Whoops, something bad happened
357
+         * //     at [eval]:5:15
358
+         * //     at Script.runInThisContext (node:vm:132:18)
359
+         * //     at Object.runInThisContext (node:vm:309:38)
360
+         * //     at node:internal/process/execution:77:19
361
+         * //     at [eval]-wrapper:6:22
362
+         * //     at evalScript (node:internal/process/execution:76:60)
363
+         * //     at node:internal/main/eval_string:23:3
364
+         *
365
+         * const name = 'Will Robinson';
366
+         * console.warn(`Danger ${name}! Danger!`);
367
+         * // Prints: Danger Will Robinson! Danger!, to stderr
368
+         * ```
369
+         *
370
+         * Example using the `Console` class:
371
+         *
372
+         * ```js
373
+         * const out = getStreamSomehow();
374
+         * const err = getStreamSomehow();
375
+         * const myConsole = new console.Console(out, err);
376
+         *
377
+         * myConsole.log('hello world');
378
+         * // Prints: hello world, to out
379
+         * myConsole.log('hello %s', 'world');
380
+         * // Prints: hello world, to out
381
+         * myConsole.error(new Error('Whoops, something bad happened'));
382
+         * // Prints: [Error: Whoops, something bad happened], to err
383
+         *
384
+         * const name = 'Will Robinson';
385
+         * myConsole.warn(`Danger ${name}! Danger!`);
386
+         * // Prints: Danger Will Robinson! Danger!, to err
387
+         * ```
388
+         * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js)
389
+         */
390
+        namespace console {
391
+            interface ConsoleConstructorOptions {
392
+                stdout: NodeJS.WritableStream;
393
+                stderr?: NodeJS.WritableStream | undefined;
394
+                ignoreErrors?: boolean | undefined;
395
+                colorMode?: boolean | 'auto' | undefined;
396
+                inspectOptions?: InspectOptions | undefined;
397
+                /**
398
+                 * Set group indentation
399
+                 * @default 2
400
+                 */
401
+                groupIndentation?: number | undefined;
402
+            }
403
+            interface ConsoleConstructor {
404
+                prototype: Console;
405
+                new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
406
+                new (options: ConsoleConstructorOptions): Console;
407
+            }
408
+        }
409
+        var console: Console;
410
+    }
411
+    export = globalThis.console;
412
+}

+ 18
- 0
node_modules/@types/node/ts4.8/constants.d.ts 查看文件

@@ -0,0 +1,18 @@
1
+/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2
+declare module 'constants' {
3
+    import { constants as osConstants, SignalConstants } from 'node:os';
4
+    import { constants as cryptoConstants } from 'node:crypto';
5
+    import { constants as fsConstants } from 'node:fs';
6
+
7
+    const exp: typeof osConstants.errno &
8
+        typeof osConstants.priority &
9
+        SignalConstants &
10
+        typeof cryptoConstants &
11
+        typeof fsConstants;
12
+    export = exp;
13
+}
14
+
15
+declare module 'node:constants' {
16
+    import constants = require('constants');
17
+    export = constants;
18
+}

+ 3964
- 0
node_modules/@types/node/ts4.8/crypto.d.ts
文件差異過大導致無法顯示
查看文件


+ 545
- 0
node_modules/@types/node/ts4.8/dgram.d.ts 查看文件

@@ -0,0 +1,545 @@
1
+/**
2
+ * The `dgram` module provides an implementation of UDP datagram sockets.
3
+ *
4
+ * ```js
5
+ * import dgram from 'dgram';
6
+ *
7
+ * const server = dgram.createSocket('udp4');
8
+ *
9
+ * server.on('error', (err) => {
10
+ *   console.log(`server error:\n${err.stack}`);
11
+ *   server.close();
12
+ * });
13
+ *
14
+ * server.on('message', (msg, rinfo) => {
15
+ *   console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
16
+ * });
17
+ *
18
+ * server.on('listening', () => {
19
+ *   const address = server.address();
20
+ *   console.log(`server listening ${address.address}:${address.port}`);
21
+ * });
22
+ *
23
+ * server.bind(41234);
24
+ * // Prints: server listening 0.0.0.0:41234
25
+ * ```
26
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dgram.js)
27
+ */
28
+declare module 'dgram' {
29
+    import { AddressInfo } from 'node:net';
30
+    import * as dns from 'node:dns';
31
+    import { EventEmitter, Abortable } from 'node:events';
32
+    interface RemoteInfo {
33
+        address: string;
34
+        family: 'IPv4' | 'IPv6';
35
+        port: number;
36
+        size: number;
37
+    }
38
+    interface BindOptions {
39
+        port?: number | undefined;
40
+        address?: string | undefined;
41
+        exclusive?: boolean | undefined;
42
+        fd?: number | undefined;
43
+    }
44
+    type SocketType = 'udp4' | 'udp6';
45
+    interface SocketOptions extends Abortable {
46
+        type: SocketType;
47
+        reuseAddr?: boolean | undefined;
48
+        /**
49
+         * @default false
50
+         */
51
+        ipv6Only?: boolean | undefined;
52
+        recvBufferSize?: number | undefined;
53
+        sendBufferSize?: number | undefined;
54
+        lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
55
+    }
56
+    /**
57
+     * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
58
+     * messages. When `address` and `port` are not passed to `socket.bind()` the
59
+     * method will bind the socket to the "all interfaces" address on a random port
60
+     * (it does the right thing for both `udp4` and `udp6` sockets). The bound address
61
+     * and port can be retrieved using `socket.address().address` and `socket.address().port`.
62
+     *
63
+     * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket:
64
+     *
65
+     * ```js
66
+     * const controller = new AbortController();
67
+     * const { signal } = controller;
68
+     * const server = dgram.createSocket({ type: 'udp4', signal });
69
+     * server.on('message', (msg, rinfo) => {
70
+     *   console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
71
+     * });
72
+     * // Later, when you want to close the server.
73
+     * controller.abort();
74
+     * ```
75
+     * @since v0.11.13
76
+     * @param options Available options are:
77
+     * @param callback Attached as a listener for `'message'` events. Optional.
78
+     */
79
+    function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
80
+    function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
81
+    /**
82
+     * Encapsulates the datagram functionality.
83
+     *
84
+     * New instances of `dgram.Socket` are created using {@link createSocket}.
85
+     * The `new` keyword is not to be used to create `dgram.Socket` instances.
86
+     * @since v0.1.99
87
+     */
88
+    class Socket extends EventEmitter {
89
+        /**
90
+         * Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not
91
+         * specified, the operating system will choose
92
+         * one interface and will add membership to it. To add membership to every
93
+         * available interface, call `addMembership` multiple times, once per interface.
94
+         *
95
+         * When called on an unbound socket, this method will implicitly bind to a random
96
+         * port, listening on all interfaces.
97
+         *
98
+         * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
99
+         *
100
+         * ```js
101
+         * import cluster from 'cluster';
102
+         * import dgram from 'dgram';
103
+         *
104
+         * if (cluster.isPrimary) {
105
+         *   cluster.fork(); // Works ok.
106
+         *   cluster.fork(); // Fails with EADDRINUSE.
107
+         * } else {
108
+         *   const s = dgram.createSocket('udp4');
109
+         *   s.bind(1234, () => {
110
+         *     s.addMembership('224.0.0.114');
111
+         *   });
112
+         * }
113
+         * ```
114
+         * @since v0.6.9
115
+         */
116
+        addMembership(multicastAddress: string, multicastInterface?: string): void;
117
+        /**
118
+         * Returns an object containing the address information for a socket.
119
+         * For UDP sockets, this object will contain `address`, `family` and `port`properties.
120
+         *
121
+         * This method throws `EBADF` if called on an unbound socket.
122
+         * @since v0.1.99
123
+         */
124
+        address(): AddressInfo;
125
+        /**
126
+         * For UDP sockets, causes the `dgram.Socket` to listen for datagram
127
+         * messages on a named `port` and optional `address`. If `port` is not
128
+         * specified or is `0`, the operating system will attempt to bind to a
129
+         * random port. If `address` is not specified, the operating system will
130
+         * attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is
131
+         * called.
132
+         *
133
+         * Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very
134
+         * useful.
135
+         *
136
+         * A bound datagram socket keeps the Node.js process running to receive
137
+         * datagram messages.
138
+         *
139
+         * If binding fails, an `'error'` event is generated. In rare case (e.g.
140
+         * attempting to bind with a closed socket), an `Error` may be thrown.
141
+         *
142
+         * Example of a UDP server listening on port 41234:
143
+         *
144
+         * ```js
145
+         * import dgram from 'dgram';
146
+         *
147
+         * const server = dgram.createSocket('udp4');
148
+         *
149
+         * server.on('error', (err) => {
150
+         *   console.log(`server error:\n${err.stack}`);
151
+         *   server.close();
152
+         * });
153
+         *
154
+         * server.on('message', (msg, rinfo) => {
155
+         *   console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
156
+         * });
157
+         *
158
+         * server.on('listening', () => {
159
+         *   const address = server.address();
160
+         *   console.log(`server listening ${address.address}:${address.port}`);
161
+         * });
162
+         *
163
+         * server.bind(41234);
164
+         * // Prints: server listening 0.0.0.0:41234
165
+         * ```
166
+         * @since v0.1.99
167
+         * @param callback with no parameters. Called when binding is complete.
168
+         */
169
+        bind(port?: number, address?: string, callback?: () => void): this;
170
+        bind(port?: number, callback?: () => void): this;
171
+        bind(callback?: () => void): this;
172
+        bind(options: BindOptions, callback?: () => void): this;
173
+        /**
174
+         * Close the underlying socket and stop listening for data on it. If a callback is
175
+         * provided, it is added as a listener for the `'close'` event.
176
+         * @since v0.1.99
177
+         * @param callback Called when the socket has been closed.
178
+         */
179
+        close(callback?: () => void): this;
180
+        /**
181
+         * Associates the `dgram.Socket` to a remote address and port. Every
182
+         * message sent by this handle is automatically sent to that destination. Also,
183
+         * the socket will only receive messages from that remote peer.
184
+         * Trying to call `connect()` on an already connected socket will result
185
+         * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
186
+         * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
187
+         * will be used by default. Once the connection is complete, a `'connect'` event
188
+         * is emitted and the optional `callback` function is called. In case of failure,
189
+         * the `callback` is called or, failing this, an `'error'` event is emitted.
190
+         * @since v12.0.0
191
+         * @param callback Called when the connection is completed or on error.
192
+         */
193
+        connect(port: number, address?: string, callback?: () => void): void;
194
+        connect(port: number, callback: () => void): void;
195
+        /**
196
+         * A synchronous function that disassociates a connected `dgram.Socket` from
197
+         * its remote address. Trying to call `disconnect()` on an unbound or already
198
+         * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
199
+         * @since v12.0.0
200
+         */
201
+        disconnect(): void;
202
+        /**
203
+         * Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
204
+         * kernel when the socket is closed or the process terminates, so most apps will
205
+         * never have reason to call this.
206
+         *
207
+         * If `multicastInterface` is not specified, the operating system will attempt to
208
+         * drop membership on all valid interfaces.
209
+         * @since v0.6.9
210
+         */
211
+        dropMembership(multicastAddress: string, multicastInterface?: string): void;
212
+        /**
213
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
214
+         * @since v8.7.0
215
+         * @return the `SO_RCVBUF` socket receive buffer size in bytes.
216
+         */
217
+        getRecvBufferSize(): number;
218
+        /**
219
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
220
+         * @since v8.7.0
221
+         * @return the `SO_SNDBUF` socket send buffer size in bytes.
222
+         */
223
+        getSendBufferSize(): number;
224
+        /**
225
+         * By default, binding a socket will cause it to block the Node.js process from
226
+         * exiting as long as the socket is open. The `socket.unref()` method can be used
227
+         * to exclude the socket from the reference counting that keeps the Node.js
228
+         * process active. The `socket.ref()` method adds the socket back to the reference
229
+         * counting and restores the default behavior.
230
+         *
231
+         * Calling `socket.ref()` multiples times will have no additional effect.
232
+         *
233
+         * The `socket.ref()` method returns a reference to the socket so calls can be
234
+         * chained.
235
+         * @since v0.9.1
236
+         */
237
+        ref(): this;
238
+        /**
239
+         * Returns an object containing the `address`, `family`, and `port` of the remote
240
+         * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
241
+         * if the socket is not connected.
242
+         * @since v12.0.0
243
+         */
244
+        remoteAddress(): AddressInfo;
245
+        /**
246
+         * Broadcasts a datagram on the socket.
247
+         * For connectionless sockets, the destination `port` and `address` must be
248
+         * specified. Connected sockets, on the other hand, will use their associated
249
+         * remote endpoint, so the `port` and `address` arguments must not be set.
250
+         *
251
+         * The `msg` argument contains the message to be sent.
252
+         * Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
253
+         * any `TypedArray` or a `DataView`,
254
+         * the `offset` and `length` specify the offset within the `Buffer` where the
255
+         * message begins and the number of bytes in the message, respectively.
256
+         * If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that
257
+         * contain multi-byte characters, `offset` and `length` will be calculated with
258
+         * respect to `byte length` and not the character position.
259
+         * If `msg` is an array, `offset` and `length` must not be specified.
260
+         *
261
+         * The `address` argument is a string. If the value of `address` is a host name,
262
+         * DNS will be used to resolve the address of the host. If `address` is not
263
+         * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default.
264
+         *
265
+         * If the socket has not been previously bound with a call to `bind`, the socket
266
+         * is assigned a random port number and is bound to the "all interfaces" address
267
+         * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
268
+         *
269
+         * An optional `callback` function may be specified to as a way of reporting
270
+         * DNS errors or for determining when it is safe to reuse the `buf` object.
271
+         * DNS lookups delay the time to send for at least one tick of the
272
+         * Node.js event loop.
273
+         *
274
+         * The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be
275
+         * passed as the first argument to the `callback`. If a `callback` is not given,
276
+         * the error is emitted as an `'error'` event on the `socket` object.
277
+         *
278
+         * Offset and length are optional but both _must_ be set if either are used.
279
+         * They are supported only when the first argument is a `Buffer`, a `TypedArray`,
280
+         * or a `DataView`.
281
+         *
282
+         * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
283
+         *
284
+         * Example of sending a UDP packet to a port on `localhost`;
285
+         *
286
+         * ```js
287
+         * import dgram from 'dgram';
288
+         * import { Buffer } from 'buffer';
289
+         *
290
+         * const message = Buffer.from('Some bytes');
291
+         * const client = dgram.createSocket('udp4');
292
+         * client.send(message, 41234, 'localhost', (err) => {
293
+         *   client.close();
294
+         * });
295
+         * ```
296
+         *
297
+         * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
298
+         *
299
+         * ```js
300
+         * import dgram from 'dgram';
301
+         * import { Buffer } from 'buffer';
302
+         *
303
+         * const buf1 = Buffer.from('Some ');
304
+         * const buf2 = Buffer.from('bytes');
305
+         * const client = dgram.createSocket('udp4');
306
+         * client.send([buf1, buf2], 41234, (err) => {
307
+         *   client.close();
308
+         * });
309
+         * ```
310
+         *
311
+         * Sending multiple buffers might be faster or slower depending on the
312
+         * application and operating system. Run benchmarks to
313
+         * determine the optimal strategy on a case-by-case basis. Generally speaking,
314
+         * however, sending multiple buffers is faster.
315
+         *
316
+         * Example of sending a UDP packet using a socket connected to a port on`localhost`:
317
+         *
318
+         * ```js
319
+         * import dgram from 'dgram';
320
+         * import { Buffer } from 'buffer';
321
+         *
322
+         * const message = Buffer.from('Some bytes');
323
+         * const client = dgram.createSocket('udp4');
324
+         * client.connect(41234, 'localhost', (err) => {
325
+         *   client.send(message, (err) => {
326
+         *     client.close();
327
+         *   });
328
+         * });
329
+         * ```
330
+         * @since v0.1.99
331
+         * @param msg Message to be sent.
332
+         * @param offset Offset in the buffer where the message starts.
333
+         * @param length Number of bytes in the message.
334
+         * @param port Destination port.
335
+         * @param address Destination host name or IP address.
336
+         * @param callback Called when the message has been sent.
337
+         */
338
+        send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
339
+        send(msg: string | Uint8Array | ReadonlyArray<any>, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
340
+        send(msg: string | Uint8Array | ReadonlyArray<any>, callback?: (error: Error | null, bytes: number) => void): void;
341
+        send(msg: string | Uint8Array, offset: number, length: number, port?: number, address?: string, callback?: (error: Error | null, bytes: number) => void): void;
342
+        send(msg: string | Uint8Array, offset: number, length: number, port?: number, callback?: (error: Error | null, bytes: number) => void): void;
343
+        send(msg: string | Uint8Array, offset: number, length: number, callback?: (error: Error | null, bytes: number) => void): void;
344
+        /**
345
+         * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
346
+         * packets may be sent to a local interface's broadcast address.
347
+         *
348
+         * This method throws `EBADF` if called on an unbound socket.
349
+         * @since v0.6.9
350
+         */
351
+        setBroadcast(flag: boolean): void;
352
+        /**
353
+         * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
354
+         * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
355
+         * _with a scope index is written as `'IP%scope'` where scope is an interface name_
356
+         * _or interface number._
357
+         *
358
+         * Sets the default outgoing multicast interface of the socket to a chosen
359
+         * interface or back to system interface selection. The `multicastInterface` must
360
+         * be a valid string representation of an IP from the socket's family.
361
+         *
362
+         * For IPv4 sockets, this should be the IP configured for the desired physical
363
+         * interface. All packets sent to multicast on the socket will be sent on the
364
+         * interface determined by the most recent successful use of this call.
365
+         *
366
+         * For IPv6 sockets, `multicastInterface` should include a scope to indicate the
367
+         * interface as in the examples that follow. In IPv6, individual `send` calls can
368
+         * also use explicit scope in addresses, so only packets sent to a multicast
369
+         * address without specifying an explicit scope are affected by the most recent
370
+         * successful use of this call.
371
+         *
372
+         * This method throws `EBADF` if called on an unbound socket.
373
+         *
374
+         * #### Example: IPv6 outgoing multicast interface
375
+         *
376
+         * On most systems, where scope format uses the interface name:
377
+         *
378
+         * ```js
379
+         * const socket = dgram.createSocket('udp6');
380
+         *
381
+         * socket.bind(1234, () => {
382
+         *   socket.setMulticastInterface('::%eth1');
383
+         * });
384
+         * ```
385
+         *
386
+         * On Windows, where scope format uses an interface number:
387
+         *
388
+         * ```js
389
+         * const socket = dgram.createSocket('udp6');
390
+         *
391
+         * socket.bind(1234, () => {
392
+         *   socket.setMulticastInterface('::%2');
393
+         * });
394
+         * ```
395
+         *
396
+         * #### Example: IPv4 outgoing multicast interface
397
+         *
398
+         * All systems use an IP of the host on the desired physical interface:
399
+         *
400
+         * ```js
401
+         * const socket = dgram.createSocket('udp4');
402
+         *
403
+         * socket.bind(1234, () => {
404
+         *   socket.setMulticastInterface('10.0.0.2');
405
+         * });
406
+         * ```
407
+         * @since v8.6.0
408
+         */
409
+        setMulticastInterface(multicastInterface: string): void;
410
+        /**
411
+         * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
412
+         * multicast packets will also be received on the local interface.
413
+         *
414
+         * This method throws `EBADF` if called on an unbound socket.
415
+         * @since v0.3.8
416
+         */
417
+        setMulticastLoopback(flag: boolean): boolean;
418
+        /**
419
+         * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
420
+         * "Time to Live", in this context it specifies the number of IP hops that a
421
+         * packet is allowed to travel through, specifically for multicast traffic. Each
422
+         * router or gateway that forwards a packet decrements the TTL. If the TTL is
423
+         * decremented to 0 by a router, it will not be forwarded.
424
+         *
425
+         * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
426
+         *
427
+         * This method throws `EBADF` if called on an unbound socket.
428
+         * @since v0.3.8
429
+         */
430
+        setMulticastTTL(ttl: number): number;
431
+        /**
432
+         * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
433
+         * in bytes.
434
+         *
435
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
436
+         * @since v8.7.0
437
+         */
438
+        setRecvBufferSize(size: number): void;
439
+        /**
440
+         * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
441
+         * in bytes.
442
+         *
443
+         * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
444
+         * @since v8.7.0
445
+         */
446
+        setSendBufferSize(size: number): void;
447
+        /**
448
+         * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
449
+         * in this context it specifies the number of IP hops that a packet is allowed to
450
+         * travel through. Each router or gateway that forwards a packet decrements the
451
+         * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
452
+         * Changing TTL values is typically done for network probes or when multicasting.
453
+         *
454
+         * The `ttl` argument may be between 1 and 255\. The default on most systems
455
+         * is 64.
456
+         *
457
+         * This method throws `EBADF` if called on an unbound socket.
458
+         * @since v0.1.101
459
+         */
460
+        setTTL(ttl: number): number;
461
+        /**
462
+         * By default, binding a socket will cause it to block the Node.js process from
463
+         * exiting as long as the socket is open. The `socket.unref()` method can be used
464
+         * to exclude the socket from the reference counting that keeps the Node.js
465
+         * process active, allowing the process to exit even if the socket is still
466
+         * listening.
467
+         *
468
+         * Calling `socket.unref()` multiple times will have no addition effect.
469
+         *
470
+         * The `socket.unref()` method returns a reference to the socket so calls can be
471
+         * chained.
472
+         * @since v0.9.1
473
+         */
474
+        unref(): this;
475
+        /**
476
+         * Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket
477
+         * option. If the `multicastInterface` argument
478
+         * is not specified, the operating system will choose one interface and will add
479
+         * membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface.
480
+         *
481
+         * When called on an unbound socket, this method will implicitly bind to a random
482
+         * port, listening on all interfaces.
483
+         * @since v13.1.0, v12.16.0
484
+         */
485
+        addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
486
+        /**
487
+         * Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is
488
+         * automatically called by the kernel when the
489
+         * socket is closed or the process terminates, so most apps will never have
490
+         * reason to call this.
491
+         *
492
+         * If `multicastInterface` is not specified, the operating system will attempt to
493
+         * drop membership on all valid interfaces.
494
+         * @since v13.1.0, v12.16.0
495
+         */
496
+        dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
497
+        /**
498
+         * events.EventEmitter
499
+         * 1. close
500
+         * 2. connect
501
+         * 3. error
502
+         * 4. listening
503
+         * 5. message
504
+         */
505
+        addListener(event: string, listener: (...args: any[]) => void): this;
506
+        addListener(event: 'close', listener: () => void): this;
507
+        addListener(event: 'connect', listener: () => void): this;
508
+        addListener(event: 'error', listener: (err: Error) => void): this;
509
+        addListener(event: 'listening', listener: () => void): this;
510
+        addListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
511
+        emit(event: string | symbol, ...args: any[]): boolean;
512
+        emit(event: 'close'): boolean;
513
+        emit(event: 'connect'): boolean;
514
+        emit(event: 'error', err: Error): boolean;
515
+        emit(event: 'listening'): boolean;
516
+        emit(event: 'message', msg: Buffer, rinfo: RemoteInfo): boolean;
517
+        on(event: string, listener: (...args: any[]) => void): this;
518
+        on(event: 'close', listener: () => void): this;
519
+        on(event: 'connect', listener: () => void): this;
520
+        on(event: 'error', listener: (err: Error) => void): this;
521
+        on(event: 'listening', listener: () => void): this;
522
+        on(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
523
+        once(event: string, listener: (...args: any[]) => void): this;
524
+        once(event: 'close', listener: () => void): this;
525
+        once(event: 'connect', listener: () => void): this;
526
+        once(event: 'error', listener: (err: Error) => void): this;
527
+        once(event: 'listening', listener: () => void): this;
528
+        once(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
529
+        prependListener(event: string, listener: (...args: any[]) => void): this;
530
+        prependListener(event: 'close', listener: () => void): this;
531
+        prependListener(event: 'connect', listener: () => void): this;
532
+        prependListener(event: 'error', listener: (err: Error) => void): this;
533
+        prependListener(event: 'listening', listener: () => void): this;
534
+        prependListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
535
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
536
+        prependOnceListener(event: 'close', listener: () => void): this;
537
+        prependOnceListener(event: 'connect', listener: () => void): this;
538
+        prependOnceListener(event: 'error', listener: (err: Error) => void): this;
539
+        prependOnceListener(event: 'listening', listener: () => void): this;
540
+        prependOnceListener(event: 'message', listener: (msg: Buffer, rinfo: RemoteInfo) => void): this;
541
+    }
542
+}
543
+declare module 'node:dgram' {
544
+    export * from 'dgram';
545
+}

+ 153
- 0
node_modules/@types/node/ts4.8/diagnostics_channel.d.ts 查看文件

@@ -0,0 +1,153 @@
1
+/**
2
+ * The `diagnostics_channel` module provides an API to create named channels
3
+ * to report arbitrary message data for diagnostics purposes.
4
+ *
5
+ * It can be accessed using:
6
+ *
7
+ * ```js
8
+ * import diagnostics_channel from 'diagnostics_channel';
9
+ * ```
10
+ *
11
+ * It is intended that a module writer wanting to report diagnostics messages
12
+ * will create one or many top-level channels to report messages through.
13
+ * Channels may also be acquired at runtime but it is not encouraged
14
+ * due to the additional overhead of doing so. Channels may be exported for
15
+ * convenience, but as long as the name is known it can be acquired anywhere.
16
+ *
17
+ * If you intend for your module to produce diagnostics data for others to
18
+ * consume it is recommended that you include documentation of what named
19
+ * channels are used along with the shape of the message data. Channel names
20
+ * should generally include the module name to avoid collisions with data from
21
+ * other modules.
22
+ * @experimental
23
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/diagnostics_channel.js)
24
+ */
25
+declare module 'diagnostics_channel' {
26
+    /**
27
+     * Check if there are active subscribers to the named channel. This is helpful if
28
+     * the message you want to send might be expensive to prepare.
29
+     *
30
+     * This API is optional but helpful when trying to publish messages from very
31
+     * performance-sensitive code.
32
+     *
33
+     * ```js
34
+     * import diagnostics_channel from 'diagnostics_channel';
35
+     *
36
+     * if (diagnostics_channel.hasSubscribers('my-channel')) {
37
+     *   // There are subscribers, prepare and publish message
38
+     * }
39
+     * ```
40
+     * @since v15.1.0, v14.17.0
41
+     * @param name The channel name
42
+     * @return If there are active subscribers
43
+     */
44
+    function hasSubscribers(name: string): boolean;
45
+    /**
46
+     * This is the primary entry-point for anyone wanting to interact with a named
47
+     * channel. It produces a channel object which is optimized to reduce overhead at
48
+     * publish time as much as possible.
49
+     *
50
+     * ```js
51
+     * import diagnostics_channel from 'diagnostics_channel';
52
+     *
53
+     * const channel = diagnostics_channel.channel('my-channel');
54
+     * ```
55
+     * @since v15.1.0, v14.17.0
56
+     * @param name The channel name
57
+     * @return The named channel object
58
+     */
59
+    function channel(name: string): Channel;
60
+    type ChannelListener = (message: unknown, name: string) => void;
61
+    /**
62
+     * The class `Channel` represents an individual named channel within the data
63
+     * pipeline. It is use to track subscribers and to publish messages when there
64
+     * are subscribers present. It exists as a separate object to avoid channel
65
+     * lookups at publish time, enabling very fast publish speeds and allowing
66
+     * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly
67
+     * with `new Channel(name)` is not supported.
68
+     * @since v15.1.0, v14.17.0
69
+     */
70
+    class Channel {
71
+        readonly name: string;
72
+        /**
73
+         * Check if there are active subscribers to this channel. This is helpful if
74
+         * the message you want to send might be expensive to prepare.
75
+         *
76
+         * This API is optional but helpful when trying to publish messages from very
77
+         * performance-sensitive code.
78
+         *
79
+         * ```js
80
+         * import diagnostics_channel from 'diagnostics_channel';
81
+         *
82
+         * const channel = diagnostics_channel.channel('my-channel');
83
+         *
84
+         * if (channel.hasSubscribers) {
85
+         *   // There are subscribers, prepare and publish message
86
+         * }
87
+         * ```
88
+         * @since v15.1.0, v14.17.0
89
+         */
90
+        readonly hasSubscribers: boolean;
91
+        private constructor(name: string);
92
+        /**
93
+         * Publish a message to any subscribers to the channel. This will
94
+         * trigger message handlers synchronously so they will execute within
95
+         * the same context.
96
+         *
97
+         * ```js
98
+         * import diagnostics_channel from 'diagnostics_channel';
99
+         *
100
+         * const channel = diagnostics_channel.channel('my-channel');
101
+         *
102
+         * channel.publish({
103
+         *   some: 'message'
104
+         * });
105
+         * ```
106
+         * @since v15.1.0, v14.17.0
107
+         * @param message The message to send to the channel subscribers
108
+         */
109
+        publish(message: unknown): void;
110
+        /**
111
+         * Register a message handler to subscribe to this channel. This message handler
112
+         * will be run synchronously whenever a message is published to the channel. Any
113
+         * errors thrown in the message handler will trigger an `'uncaughtException'`.
114
+         *
115
+         * ```js
116
+         * import diagnostics_channel from 'diagnostics_channel';
117
+         *
118
+         * const channel = diagnostics_channel.channel('my-channel');
119
+         *
120
+         * channel.subscribe((message, name) => {
121
+         *   // Received data
122
+         * });
123
+         * ```
124
+         * @since v15.1.0, v14.17.0
125
+         * @param onMessage The handler to receive channel messages
126
+         */
127
+        subscribe(onMessage: ChannelListener): void;
128
+        /**
129
+         * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`.
130
+         *
131
+         * ```js
132
+         * import diagnostics_channel from 'diagnostics_channel';
133
+         *
134
+         * const channel = diagnostics_channel.channel('my-channel');
135
+         *
136
+         * function onMessage(message, name) {
137
+         *   // Received data
138
+         * }
139
+         *
140
+         * channel.subscribe(onMessage);
141
+         *
142
+         * channel.unsubscribe(onMessage);
143
+         * ```
144
+         * @since v15.1.0, v14.17.0
145
+         * @param onMessage The previous subscribed handler to remove
146
+         * @return `true` if the handler was found, `false` otherwise.
147
+         */
148
+        unsubscribe(onMessage: ChannelListener): void;
149
+    }
150
+}
151
+declare module 'node:diagnostics_channel' {
152
+    export * from 'diagnostics_channel';
153
+}

+ 659
- 0
node_modules/@types/node/ts4.8/dns.d.ts 查看文件

@@ -0,0 +1,659 @@
1
+/**
2
+ * The `dns` module enables name resolution. For example, use it to look up IP
3
+ * addresses of host names.
4
+ *
5
+ * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
6
+ * DNS protocol for lookups. {@link lookup} uses the operating system
7
+ * facilities to perform name resolution. It may not need to perform any network
8
+ * communication. To perform name resolution the way other applications on the same
9
+ * system do, use {@link lookup}.
10
+ *
11
+ * ```js
12
+ * const dns = require('dns');
13
+ *
14
+ * dns.lookup('example.org', (err, address, family) => {
15
+ *   console.log('address: %j family: IPv%s', address, family);
16
+ * });
17
+ * // address: "93.184.216.34" family: IPv4
18
+ * ```
19
+ *
20
+ * All other functions in the `dns` module connect to an actual DNS server to
21
+ * perform name resolution. They will always use the network to perform DNS
22
+ * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
23
+ * DNS queries, bypassing other name-resolution facilities.
24
+ *
25
+ * ```js
26
+ * const dns = require('dns');
27
+ *
28
+ * dns.resolve4('archive.org', (err, addresses) => {
29
+ *   if (err) throw err;
30
+ *
31
+ *   console.log(`addresses: ${JSON.stringify(addresses)}`);
32
+ *
33
+ *   addresses.forEach((a) => {
34
+ *     dns.reverse(a, (err, hostnames) => {
35
+ *       if (err) {
36
+ *         throw err;
37
+ *       }
38
+ *       console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
39
+ *     });
40
+ *   });
41
+ * });
42
+ * ```
43
+ *
44
+ * See the `Implementation considerations section` for more information.
45
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
46
+ */
47
+declare module 'dns' {
48
+    import * as dnsPromises from 'node:dns/promises';
49
+    // Supported getaddrinfo flags.
50
+    export const ADDRCONFIG: number;
51
+    export const V4MAPPED: number;
52
+    /**
53
+     * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
54
+     * well as IPv4 mapped IPv6 addresses.
55
+     */
56
+    export const ALL: number;
57
+    export interface LookupOptions {
58
+        family?: number | undefined;
59
+        hints?: number | undefined;
60
+        all?: boolean | undefined;
61
+        /**
62
+         * @default true
63
+         */
64
+        verbatim?: boolean | undefined;
65
+    }
66
+    export interface LookupOneOptions extends LookupOptions {
67
+        all?: false | undefined;
68
+    }
69
+    export interface LookupAllOptions extends LookupOptions {
70
+        all: true;
71
+    }
72
+    export interface LookupAddress {
73
+        address: string;
74
+        family: number;
75
+    }
76
+    /**
77
+     * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
78
+     * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
79
+     * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
80
+     * and IPv6 addresses are both returned if found.
81
+     *
82
+     * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
83
+     * properties `address` and `family`.
84
+     *
85
+     * On error, `err` is an `Error` object, where `err.code` is the error code.
86
+     * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
87
+     * the host name does not exist but also when the lookup fails in other ways
88
+     * such as no available file descriptors.
89
+     *
90
+     * `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
91
+     * The implementation uses an operating system facility that can associate names
92
+     * with addresses, and vice versa. This implementation can have subtle but
93
+     * important consequences on the behavior of any Node.js program. Please take some
94
+     * time to consult the `Implementation considerations section` before using`dns.lookup()`.
95
+     *
96
+     * Example usage:
97
+     *
98
+     * ```js
99
+     * const dns = require('dns');
100
+     * const options = {
101
+     *   family: 6,
102
+     *   hints: dns.ADDRCONFIG | dns.V4MAPPED,
103
+     * };
104
+     * dns.lookup('example.com', options, (err, address, family) =>
105
+     *   console.log('address: %j family: IPv%s', address, family));
106
+     * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
107
+     *
108
+     * // When options.all is true, the result will be an Array.
109
+     * options.all = true;
110
+     * dns.lookup('example.com', options, (err, addresses) =>
111
+     *   console.log('addresses: %j', addresses));
112
+     * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
113
+     * ```
114
+     *
115
+     * If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
116
+     * @since v0.1.90
117
+     */
118
+    export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
119
+    export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
120
+    export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
121
+    export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
122
+    export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
123
+    export namespace lookup {
124
+        function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
125
+        function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
126
+        function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
127
+    }
128
+    /**
129
+     * Resolves the given `address` and `port` into a host name and service using
130
+     * the operating system's underlying `getnameinfo` implementation.
131
+     *
132
+     * If `address` is not a valid IP address, a `TypeError` will be thrown.
133
+     * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
134
+     *
135
+     * On an error, `err` is an `Error` object, where `err.code` is the error code.
136
+     *
137
+     * ```js
138
+     * const dns = require('dns');
139
+     * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
140
+     *   console.log(hostname, service);
141
+     *   // Prints: localhost ssh
142
+     * });
143
+     * ```
144
+     *
145
+     * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
146
+     * @since v0.11.14
147
+     */
148
+    export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
149
+    export namespace lookupService {
150
+        function __promisify__(
151
+            address: string,
152
+            port: number
153
+        ): Promise<{
154
+            hostname: string;
155
+            service: string;
156
+        }>;
157
+    }
158
+    export interface ResolveOptions {
159
+        ttl: boolean;
160
+    }
161
+    export interface ResolveWithTtlOptions extends ResolveOptions {
162
+        ttl: true;
163
+    }
164
+    export interface RecordWithTtl {
165
+        address: string;
166
+        ttl: number;
167
+    }
168
+    /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
169
+    export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
170
+    export interface AnyARecord extends RecordWithTtl {
171
+        type: 'A';
172
+    }
173
+    export interface AnyAaaaRecord extends RecordWithTtl {
174
+        type: 'AAAA';
175
+    }
176
+    export interface CaaRecord {
177
+        critial: number;
178
+        issue?: string | undefined;
179
+        issuewild?: string | undefined;
180
+        iodef?: string | undefined;
181
+        contactemail?: string | undefined;
182
+        contactphone?: string | undefined;
183
+    }
184
+    export interface MxRecord {
185
+        priority: number;
186
+        exchange: string;
187
+    }
188
+    export interface AnyMxRecord extends MxRecord {
189
+        type: 'MX';
190
+    }
191
+    export interface NaptrRecord {
192
+        flags: string;
193
+        service: string;
194
+        regexp: string;
195
+        replacement: string;
196
+        order: number;
197
+        preference: number;
198
+    }
199
+    export interface AnyNaptrRecord extends NaptrRecord {
200
+        type: 'NAPTR';
201
+    }
202
+    export interface SoaRecord {
203
+        nsname: string;
204
+        hostmaster: string;
205
+        serial: number;
206
+        refresh: number;
207
+        retry: number;
208
+        expire: number;
209
+        minttl: number;
210
+    }
211
+    export interface AnySoaRecord extends SoaRecord {
212
+        type: 'SOA';
213
+    }
214
+    export interface SrvRecord {
215
+        priority: number;
216
+        weight: number;
217
+        port: number;
218
+        name: string;
219
+    }
220
+    export interface AnySrvRecord extends SrvRecord {
221
+        type: 'SRV';
222
+    }
223
+    export interface AnyTxtRecord {
224
+        type: 'TXT';
225
+        entries: string[];
226
+    }
227
+    export interface AnyNsRecord {
228
+        type: 'NS';
229
+        value: string;
230
+    }
231
+    export interface AnyPtrRecord {
232
+        type: 'PTR';
233
+        value: string;
234
+    }
235
+    export interface AnyCnameRecord {
236
+        type: 'CNAME';
237
+        value: string;
238
+    }
239
+    export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord;
240
+    /**
241
+     * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
242
+     * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
243
+     * records. The type and structure of individual results varies based on `rrtype`:
244
+     *
245
+     * <omitted>
246
+     *
247
+     * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
248
+     * @since v0.1.27
249
+     * @param hostname Host name to resolve.
250
+     * @param [rrtype='A'] Resource record type.
251
+     */
252
+    export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
253
+    export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
254
+    export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
255
+    export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
256
+    export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
257
+    export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
258
+    export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
259
+    export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
260
+    export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
261
+    export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
262
+    export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
263
+    export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
264
+    export function resolve(
265
+        hostname: string,
266
+        rrtype: string,
267
+        callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
268
+    ): void;
269
+    export namespace resolve {
270
+        function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise<string[]>;
271
+        function __promisify__(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
272
+        function __promisify__(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
273
+        function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
274
+        function __promisify__(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
275
+        function __promisify__(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
276
+        function __promisify__(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
277
+        function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
278
+    }
279
+    /**
280
+     * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
281
+     * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
282
+     * @since v0.1.16
283
+     * @param hostname Host name to resolve.
284
+     */
285
+    export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
286
+    export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
287
+    export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
288
+    export namespace resolve4 {
289
+        function __promisify__(hostname: string): Promise<string[]>;
290
+        function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
291
+        function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
292
+    }
293
+    /**
294
+     * Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
295
+     * will contain an array of IPv6 addresses.
296
+     * @since v0.1.16
297
+     * @param hostname Host name to resolve.
298
+     */
299
+    export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
300
+    export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
301
+    export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
302
+    export namespace resolve6 {
303
+        function __promisify__(hostname: string): Promise<string[]>;
304
+        function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
305
+        function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
306
+    }
307
+    /**
308
+     * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function
309
+     * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
310
+     * @since v0.3.2
311
+     */
312
+    export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
313
+    export namespace resolveCname {
314
+        function __promisify__(hostname: string): Promise<string[]>;
315
+    }
316
+    /**
317
+     * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
318
+     * will contain an array of certification authority authorization records
319
+     * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
320
+     * @since v15.0.0, v14.17.0
321
+     */
322
+    export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
323
+    export namespace resolveCaa {
324
+        function __promisify__(hostname: string): Promise<CaaRecord[]>;
325
+    }
326
+    /**
327
+     * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
328
+     * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
329
+     * @since v0.1.27
330
+     */
331
+    export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
332
+    export namespace resolveMx {
333
+        function __promisify__(hostname: string): Promise<MxRecord[]>;
334
+    }
335
+    /**
336
+     * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
337
+     * objects with the following properties:
338
+     *
339
+     * * `flags`
340
+     * * `service`
341
+     * * `regexp`
342
+     * * `replacement`
343
+     * * `order`
344
+     * * `preference`
345
+     *
346
+     * ```js
347
+     * {
348
+     *   flags: 's',
349
+     *   service: 'SIP+D2U',
350
+     *   regexp: '',
351
+     *   replacement: '_sip._udp.example.com',
352
+     *   order: 30,
353
+     *   preference: 100
354
+     * }
355
+     * ```
356
+     * @since v0.9.12
357
+     */
358
+    export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
359
+    export namespace resolveNaptr {
360
+        function __promisify__(hostname: string): Promise<NaptrRecord[]>;
361
+    }
362
+    /**
363
+     * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
364
+     * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
365
+     * @since v0.1.90
366
+     */
367
+    export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
368
+    export namespace resolveNs {
369
+        function __promisify__(hostname: string): Promise<string[]>;
370
+    }
371
+    /**
372
+     * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
373
+     * be an array of strings containing the reply records.
374
+     * @since v6.0.0
375
+     */
376
+    export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
377
+    export namespace resolvePtr {
378
+        function __promisify__(hostname: string): Promise<string[]>;
379
+    }
380
+    /**
381
+     * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
382
+     * the `hostname`. The `address` argument passed to the `callback` function will
383
+     * be an object with the following properties:
384
+     *
385
+     * * `nsname`
386
+     * * `hostmaster`
387
+     * * `serial`
388
+     * * `refresh`
389
+     * * `retry`
390
+     * * `expire`
391
+     * * `minttl`
392
+     *
393
+     * ```js
394
+     * {
395
+     *   nsname: 'ns.example.com',
396
+     *   hostmaster: 'root.example.com',
397
+     *   serial: 2013101809,
398
+     *   refresh: 10000,
399
+     *   retry: 2400,
400
+     *   expire: 604800,
401
+     *   minttl: 3600
402
+     * }
403
+     * ```
404
+     * @since v0.11.10
405
+     */
406
+    export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
407
+    export namespace resolveSoa {
408
+        function __promisify__(hostname: string): Promise<SoaRecord>;
409
+    }
410
+    /**
411
+     * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
412
+     * be an array of objects with the following properties:
413
+     *
414
+     * * `priority`
415
+     * * `weight`
416
+     * * `port`
417
+     * * `name`
418
+     *
419
+     * ```js
420
+     * {
421
+     *   priority: 10,
422
+     *   weight: 5,
423
+     *   port: 21223,
424
+     *   name: 'service.example.com'
425
+     * }
426
+     * ```
427
+     * @since v0.1.27
428
+     */
429
+    export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
430
+    export namespace resolveSrv {
431
+        function __promisify__(hostname: string): Promise<SrvRecord[]>;
432
+    }
433
+    /**
434
+     * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a
435
+     * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
436
+     * one record. Depending on the use case, these could be either joined together or
437
+     * treated separately.
438
+     * @since v0.1.27
439
+     */
440
+    export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
441
+    export namespace resolveTxt {
442
+        function __promisify__(hostname: string): Promise<string[][]>;
443
+    }
444
+    /**
445
+     * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
446
+     * The `ret` argument passed to the `callback` function will be an array containing
447
+     * various types of records. Each object has a property `type` that indicates the
448
+     * type of the current record. And depending on the `type`, additional properties
449
+     * will be present on the object:
450
+     *
451
+     * <omitted>
452
+     *
453
+     * Here is an example of the `ret` object passed to the callback:
454
+     *
455
+     * ```js
456
+     * [ { type: 'A', address: '127.0.0.1', ttl: 299 },
457
+     *   { type: 'CNAME', value: 'example.com' },
458
+     *   { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
459
+     *   { type: 'NS', value: 'ns1.example.com' },
460
+     *   { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
461
+     *   { type: 'SOA',
462
+     *     nsname: 'ns1.example.com',
463
+     *     hostmaster: 'admin.example.com',
464
+     *     serial: 156696742,
465
+     *     refresh: 900,
466
+     *     retry: 900,
467
+     *     expire: 1800,
468
+     *     minttl: 60 } ]
469
+     * ```
470
+     *
471
+     * DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
472
+     * 8482](https://tools.ietf.org/html/rfc8482).
473
+     */
474
+    export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
475
+    export namespace resolveAny {
476
+        function __promisify__(hostname: string): Promise<AnyRecord[]>;
477
+    }
478
+    /**
479
+     * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
480
+     * array of host names.
481
+     *
482
+     * On error, `err` is an `Error` object, where `err.code` is
483
+     * one of the `DNS error codes`.
484
+     * @since v0.1.16
485
+     */
486
+    export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
487
+    /**
488
+     * Sets the IP address and port of servers to be used when performing DNS
489
+     * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
490
+     * addresses. If the port is the IANA default DNS port (53) it can be omitted.
491
+     *
492
+     * ```js
493
+     * dns.setServers([
494
+     *   '4.4.4.4',
495
+     *   '[2001:4860:4860::8888]',
496
+     *   '4.4.4.4:1053',
497
+     *   '[2001:4860:4860::8888]:1053',
498
+     * ]);
499
+     * ```
500
+     *
501
+     * An error will be thrown if an invalid address is provided.
502
+     *
503
+     * The `dns.setServers()` method must not be called while a DNS query is in
504
+     * progress.
505
+     *
506
+     * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
507
+     *
508
+     * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
509
+     * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
510
+     * subsequent servers provided. Fallback DNS servers will only be used if the
511
+     * earlier ones time out or result in some other error.
512
+     * @since v0.11.3
513
+     * @param servers array of `RFC 5952` formatted addresses
514
+     */
515
+    export function setServers(servers: ReadonlyArray<string>): void;
516
+    /**
517
+     * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
518
+     * that are currently configured for DNS resolution. A string will include a port
519
+     * section if a custom port is used.
520
+     *
521
+     * ```js
522
+     * [
523
+     *   '4.4.4.4',
524
+     *   '2001:4860:4860::8888',
525
+     *   '4.4.4.4:1053',
526
+     *   '[2001:4860:4860::8888]:1053',
527
+     * ]
528
+     * ```
529
+     * @since v0.11.3
530
+     */
531
+    export function getServers(): string[];
532
+    /**
533
+     * Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
534
+     *
535
+     * * `ipv4first`: sets default `verbatim` `false`.
536
+     * * `verbatim`: sets default `verbatim` `true`.
537
+     *
538
+     * The default is `ipv4first` and {@link setDefaultResultOrder} have higher
539
+     * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default
540
+     * dns orders in workers.
541
+     * @since v16.4.0, v14.18.0
542
+     * @param order must be `'ipv4first'` or `'verbatim'`.
543
+     */
544
+    export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
545
+    // Error codes
546
+    export const NODATA: string;
547
+    export const FORMERR: string;
548
+    export const SERVFAIL: string;
549
+    export const NOTFOUND: string;
550
+    export const NOTIMP: string;
551
+    export const REFUSED: string;
552
+    export const BADQUERY: string;
553
+    export const BADNAME: string;
554
+    export const BADFAMILY: string;
555
+    export const BADRESP: string;
556
+    export const CONNREFUSED: string;
557
+    export const TIMEOUT: string;
558
+    export const EOF: string;
559
+    export const FILE: string;
560
+    export const NOMEM: string;
561
+    export const DESTRUCTION: string;
562
+    export const BADSTR: string;
563
+    export const BADFLAGS: string;
564
+    export const NONAME: string;
565
+    export const BADHINTS: string;
566
+    export const NOTINITIALIZED: string;
567
+    export const LOADIPHLPAPI: string;
568
+    export const ADDRGETNETWORKPARAMS: string;
569
+    export const CANCELLED: string;
570
+    export interface ResolverOptions {
571
+        timeout?: number | undefined;
572
+        /**
573
+         * @default 4
574
+         */
575
+        tries?: number;
576
+    }
577
+    /**
578
+     * An independent resolver for DNS requests.
579
+     *
580
+     * Creating a new resolver uses the default server settings. Setting
581
+     * the servers used for a resolver using `resolver.setServers()` does not affect
582
+     * other resolvers:
583
+     *
584
+     * ```js
585
+     * const { Resolver } = require('dns');
586
+     * const resolver = new Resolver();
587
+     * resolver.setServers(['4.4.4.4']);
588
+     *
589
+     * // This request will use the server at 4.4.4.4, independent of global settings.
590
+     * resolver.resolve4('example.org', (err, addresses) => {
591
+     *   // ...
592
+     * });
593
+     * ```
594
+     *
595
+     * The following methods from the `dns` module are available:
596
+     *
597
+     * * `resolver.getServers()`
598
+     * * `resolver.resolve()`
599
+     * * `resolver.resolve4()`
600
+     * * `resolver.resolve6()`
601
+     * * `resolver.resolveAny()`
602
+     * * `resolver.resolveCaa()`
603
+     * * `resolver.resolveCname()`
604
+     * * `resolver.resolveMx()`
605
+     * * `resolver.resolveNaptr()`
606
+     * * `resolver.resolveNs()`
607
+     * * `resolver.resolvePtr()`
608
+     * * `resolver.resolveSoa()`
609
+     * * `resolver.resolveSrv()`
610
+     * * `resolver.resolveTxt()`
611
+     * * `resolver.reverse()`
612
+     * * `resolver.setServers()`
613
+     * @since v8.3.0
614
+     */
615
+    export class Resolver {
616
+        constructor(options?: ResolverOptions);
617
+        /**
618
+         * Cancel all outstanding DNS queries made by this resolver. The corresponding
619
+         * callbacks will be called with an error with code `ECANCELLED`.
620
+         * @since v8.3.0
621
+         */
622
+        cancel(): void;
623
+        getServers: typeof getServers;
624
+        resolve: typeof resolve;
625
+        resolve4: typeof resolve4;
626
+        resolve6: typeof resolve6;
627
+        resolveAny: typeof resolveAny;
628
+        resolveCname: typeof resolveCname;
629
+        resolveMx: typeof resolveMx;
630
+        resolveNaptr: typeof resolveNaptr;
631
+        resolveNs: typeof resolveNs;
632
+        resolvePtr: typeof resolvePtr;
633
+        resolveSoa: typeof resolveSoa;
634
+        resolveSrv: typeof resolveSrv;
635
+        resolveTxt: typeof resolveTxt;
636
+        reverse: typeof reverse;
637
+        /**
638
+         * The resolver instance will send its requests from the specified IP address.
639
+         * This allows programs to specify outbound interfaces when used on multi-homed
640
+         * systems.
641
+         *
642
+         * If a v4 or v6 address is not specified, it is set to the default, and the
643
+         * operating system will choose a local address automatically.
644
+         *
645
+         * The resolver will use the v4 local address when making requests to IPv4 DNS
646
+         * servers, and the v6 local address when making requests to IPv6 DNS servers.
647
+         * The `rrtype` of resolution requests has no impact on the local address used.
648
+         * @since v15.1.0, v14.17.0
649
+         * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
650
+         * @param [ipv6='::0'] A string representation of an IPv6 address.
651
+         */
652
+        setLocalAddress(ipv4?: string, ipv6?: string): void;
653
+        setServers: typeof setServers;
654
+    }
655
+    export { dnsPromises as promises };
656
+}
657
+declare module 'node:dns' {
658
+    export * from 'dns';
659
+}

+ 370
- 0
node_modules/@types/node/ts4.8/dns/promises.d.ts 查看文件

@@ -0,0 +1,370 @@
1
+/**
2
+ * The `dns.promises` API provides an alternative set of asynchronous DNS methods
3
+ * that return `Promise` objects rather than using callbacks. The API is accessible
4
+ * via `require('dns').promises` or `require('dns/promises')`.
5
+ * @since v10.6.0
6
+ */
7
+declare module 'dns/promises' {
8
+    import {
9
+        LookupAddress,
10
+        LookupOneOptions,
11
+        LookupAllOptions,
12
+        LookupOptions,
13
+        AnyRecord,
14
+        CaaRecord,
15
+        MxRecord,
16
+        NaptrRecord,
17
+        SoaRecord,
18
+        SrvRecord,
19
+        ResolveWithTtlOptions,
20
+        RecordWithTtl,
21
+        ResolveOptions,
22
+        ResolverOptions,
23
+    } from 'node:dns';
24
+    /**
25
+     * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
26
+     * that are currently configured for DNS resolution. A string will include a port
27
+     * section if a custom port is used.
28
+     *
29
+     * ```js
30
+     * [
31
+     *   '4.4.4.4',
32
+     *   '2001:4860:4860::8888',
33
+     *   '4.4.4.4:1053',
34
+     *   '[2001:4860:4860::8888]:1053',
35
+     * ]
36
+     * ```
37
+     * @since v10.6.0
38
+     */
39
+    function getServers(): string[];
40
+    /**
41
+     * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
42
+     * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
43
+     * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
44
+     * and IPv6 addresses are both returned if found.
45
+     *
46
+     * With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`.
47
+     *
48
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
49
+     * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
50
+     * the host name does not exist but also when the lookup fails in other ways
51
+     * such as no available file descriptors.
52
+     *
53
+     * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS
54
+     * protocol. The implementation uses an operating system facility that can
55
+     * associate names with addresses, and vice versa. This implementation can have
56
+     * subtle but important consequences on the behavior of any Node.js program. Please
57
+     * take some time to consult the `Implementation considerations section` before
58
+     * using `dnsPromises.lookup()`.
59
+     *
60
+     * Example usage:
61
+     *
62
+     * ```js
63
+     * const dns = require('dns');
64
+     * const dnsPromises = dns.promises;
65
+     * const options = {
66
+     *   family: 6,
67
+     *   hints: dns.ADDRCONFIG | dns.V4MAPPED,
68
+     * };
69
+     *
70
+     * dnsPromises.lookup('example.com', options).then((result) => {
71
+     *   console.log('address: %j family: IPv%s', result.address, result.family);
72
+     *   // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
73
+     * });
74
+     *
75
+     * // When options.all is true, the result will be an Array.
76
+     * options.all = true;
77
+     * dnsPromises.lookup('example.com', options).then((result) => {
78
+     *   console.log('addresses: %j', result);
79
+     *   // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
80
+     * });
81
+     * ```
82
+     * @since v10.6.0
83
+     */
84
+    function lookup(hostname: string, family: number): Promise<LookupAddress>;
85
+    function lookup(hostname: string, options: LookupOneOptions): Promise<LookupAddress>;
86
+    function lookup(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
87
+    function lookup(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
88
+    function lookup(hostname: string): Promise<LookupAddress>;
89
+    /**
90
+     * Resolves the given `address` and `port` into a host name and service using
91
+     * the operating system's underlying `getnameinfo` implementation.
92
+     *
93
+     * If `address` is not a valid IP address, a `TypeError` will be thrown.
94
+     * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
95
+     *
96
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code.
97
+     *
98
+     * ```js
99
+     * const dnsPromises = require('dns').promises;
100
+     * dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
101
+     *   console.log(result.hostname, result.service);
102
+     *   // Prints: localhost ssh
103
+     * });
104
+     * ```
105
+     * @since v10.6.0
106
+     */
107
+    function lookupService(
108
+        address: string,
109
+        port: number
110
+    ): Promise<{
111
+        hostname: string;
112
+        service: string;
113
+    }>;
114
+    /**
115
+     * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
116
+     * of the resource records. When successful, the `Promise` is resolved with an
117
+     * array of resource records. The type and structure of individual results vary
118
+     * based on `rrtype`:
119
+     *
120
+     * <omitted>
121
+     *
122
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
123
+     * @since v10.6.0
124
+     * @param hostname Host name to resolve.
125
+     * @param [rrtype='A'] Resource record type.
126
+     */
127
+    function resolve(hostname: string): Promise<string[]>;
128
+    function resolve(hostname: string, rrtype: 'A'): Promise<string[]>;
129
+    function resolve(hostname: string, rrtype: 'AAAA'): Promise<string[]>;
130
+    function resolve(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
131
+    function resolve(hostname: string, rrtype: 'CAA'): Promise<CaaRecord[]>;
132
+    function resolve(hostname: string, rrtype: 'CNAME'): Promise<string[]>;
133
+    function resolve(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
134
+    function resolve(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
135
+    function resolve(hostname: string, rrtype: 'NS'): Promise<string[]>;
136
+    function resolve(hostname: string, rrtype: 'PTR'): Promise<string[]>;
137
+    function resolve(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
138
+    function resolve(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
139
+    function resolve(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
140
+    function resolve(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
141
+    /**
142
+     * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4
143
+     * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
144
+     * @since v10.6.0
145
+     * @param hostname Host name to resolve.
146
+     */
147
+    function resolve4(hostname: string): Promise<string[]>;
148
+    function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
149
+    function resolve4(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
150
+    /**
151
+     * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6
152
+     * addresses.
153
+     * @since v10.6.0
154
+     * @param hostname Host name to resolve.
155
+     */
156
+    function resolve6(hostname: string): Promise<string[]>;
157
+    function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
158
+    function resolve6(hostname: string, options: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
159
+    /**
160
+     * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
161
+     * On success, the `Promise` is resolved with an array containing various types of
162
+     * records. Each object has a property `type` that indicates the type of the
163
+     * current record. And depending on the `type`, additional properties will be
164
+     * present on the object:
165
+     *
166
+     * <omitted>
167
+     *
168
+     * Here is an example of the result object:
169
+     *
170
+     * ```js
171
+     * [ { type: 'A', address: '127.0.0.1', ttl: 299 },
172
+     *   { type: 'CNAME', value: 'example.com' },
173
+     *   { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
174
+     *   { type: 'NS', value: 'ns1.example.com' },
175
+     *   { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
176
+     *   { type: 'SOA',
177
+     *     nsname: 'ns1.example.com',
178
+     *     hostmaster: 'admin.example.com',
179
+     *     serial: 156696742,
180
+     *     refresh: 900,
181
+     *     retry: 900,
182
+     *     expire: 1800,
183
+     *     minttl: 60 } ]
184
+     * ```
185
+     * @since v10.6.0
186
+     */
187
+    function resolveAny(hostname: string): Promise<AnyRecord[]>;
188
+    /**
189
+     * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success,
190
+     * the `Promise` is resolved with an array of objects containing available
191
+     * certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`).
192
+     * @since v15.0.0, v14.17.0
193
+     */
194
+    function resolveCaa(hostname: string): Promise<CaaRecord[]>;
195
+    /**
196
+     * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success,
197
+     * the `Promise` is resolved with an array of canonical name records available for
198
+     * the `hostname` (e.g. `['bar.example.com']`).
199
+     * @since v10.6.0
200
+     */
201
+    function resolveCname(hostname: string): Promise<string[]>;
202
+    /**
203
+     * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects
204
+     * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`).
205
+     * @since v10.6.0
206
+     */
207
+    function resolveMx(hostname: string): Promise<MxRecord[]>;
208
+    /**
209
+     * Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array
210
+     * of objects with the following properties:
211
+     *
212
+     * * `flags`
213
+     * * `service`
214
+     * * `regexp`
215
+     * * `replacement`
216
+     * * `order`
217
+     * * `preference`
218
+     *
219
+     * ```js
220
+     * {
221
+     *   flags: 's',
222
+     *   service: 'SIP+D2U',
223
+     *   regexp: '',
224
+     *   replacement: '_sip._udp.example.com',
225
+     *   order: 30,
226
+     *   preference: 100
227
+     * }
228
+     * ```
229
+     * @since v10.6.0
230
+     */
231
+    function resolveNaptr(hostname: string): Promise<NaptrRecord[]>;
232
+    /**
233
+     * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server
234
+     * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`).
235
+     * @since v10.6.0
236
+     */
237
+    function resolveNs(hostname: string): Promise<string[]>;
238
+    /**
239
+     * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings
240
+     * containing the reply records.
241
+     * @since v10.6.0
242
+     */
243
+    function resolvePtr(hostname: string): Promise<string[]>;
244
+    /**
245
+     * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
246
+     * the `hostname`. On success, the `Promise` is resolved with an object with the
247
+     * following properties:
248
+     *
249
+     * * `nsname`
250
+     * * `hostmaster`
251
+     * * `serial`
252
+     * * `refresh`
253
+     * * `retry`
254
+     * * `expire`
255
+     * * `minttl`
256
+     *
257
+     * ```js
258
+     * {
259
+     *   nsname: 'ns.example.com',
260
+     *   hostmaster: 'root.example.com',
261
+     *   serial: 2013101809,
262
+     *   refresh: 10000,
263
+     *   retry: 2400,
264
+     *   expire: 604800,
265
+     *   minttl: 3600
266
+     * }
267
+     * ```
268
+     * @since v10.6.0
269
+     */
270
+    function resolveSoa(hostname: string): Promise<SoaRecord>;
271
+    /**
272
+     * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with
273
+     * the following properties:
274
+     *
275
+     * * `priority`
276
+     * * `weight`
277
+     * * `port`
278
+     * * `name`
279
+     *
280
+     * ```js
281
+     * {
282
+     *   priority: 10,
283
+     *   weight: 5,
284
+     *   port: 21223,
285
+     *   name: 'service.example.com'
286
+     * }
287
+     * ```
288
+     * @since v10.6.0
289
+     */
290
+    function resolveSrv(hostname: string): Promise<SrvRecord[]>;
291
+    /**
292
+     * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array
293
+     * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
294
+     * one record. Depending on the use case, these could be either joined together or
295
+     * treated separately.
296
+     * @since v10.6.0
297
+     */
298
+    function resolveTxt(hostname: string): Promise<string[][]>;
299
+    /**
300
+     * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
301
+     * array of host names.
302
+     *
303
+     * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`.
304
+     * @since v10.6.0
305
+     */
306
+    function reverse(ip: string): Promise<string[]>;
307
+    /**
308
+     * Sets the IP address and port of servers to be used when performing DNS
309
+     * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
310
+     * addresses. If the port is the IANA default DNS port (53) it can be omitted.
311
+     *
312
+     * ```js
313
+     * dnsPromises.setServers([
314
+     *   '4.4.4.4',
315
+     *   '[2001:4860:4860::8888]',
316
+     *   '4.4.4.4:1053',
317
+     *   '[2001:4860:4860::8888]:1053',
318
+     * ]);
319
+     * ```
320
+     *
321
+     * An error will be thrown if an invalid address is provided.
322
+     *
323
+     * The `dnsPromises.setServers()` method must not be called while a DNS query is in
324
+     * progress.
325
+     *
326
+     * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
327
+     * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
328
+     * subsequent servers provided. Fallback DNS servers will only be used if the
329
+     * earlier ones time out or result in some other error.
330
+     * @since v10.6.0
331
+     * @param servers array of `RFC 5952` formatted addresses
332
+     */
333
+    function setServers(servers: ReadonlyArray<string>): void;
334
+    /**
335
+     * Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:
336
+     *
337
+     * * `ipv4first`: sets default `verbatim` `false`.
338
+     * * `verbatim`: sets default `verbatim` `true`.
339
+     *
340
+     * The default is `ipv4first` and `dnsPromises.setDefaultResultOrder()` have
341
+     * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the
342
+     * default dns orders in workers.
343
+     * @since v16.4.0, v14.18.0
344
+     * @param order must be `'ipv4first'` or `'verbatim'`.
345
+     */
346
+    function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
347
+    class Resolver {
348
+        constructor(options?: ResolverOptions);
349
+        cancel(): void;
350
+        getServers: typeof getServers;
351
+        resolve: typeof resolve;
352
+        resolve4: typeof resolve4;
353
+        resolve6: typeof resolve6;
354
+        resolveAny: typeof resolveAny;
355
+        resolveCname: typeof resolveCname;
356
+        resolveMx: typeof resolveMx;
357
+        resolveNaptr: typeof resolveNaptr;
358
+        resolveNs: typeof resolveNs;
359
+        resolvePtr: typeof resolvePtr;
360
+        resolveSoa: typeof resolveSoa;
361
+        resolveSrv: typeof resolveSrv;
362
+        resolveTxt: typeof resolveTxt;
363
+        reverse: typeof reverse;
364
+        setLocalAddress(ipv4?: string, ipv6?: string): void;
365
+        setServers: typeof setServers;
366
+    }
367
+}
368
+declare module 'node:dns/promises' {
369
+    export * from 'dns/promises';
370
+}

+ 126
- 0
node_modules/@types/node/ts4.8/dom-events.d.ts 查看文件

@@ -0,0 +1,126 @@
1
+export {}; // Don't export anything!
2
+
3
+//// DOM-like Events
4
+// NB: The Event / EventTarget / EventListener implementations below were copied
5
+// from lib.dom.d.ts, then edited to reflect Node's documentation at
6
+// https://nodejs.org/api/events.html#class-eventtarget.
7
+// Please read that link to understand important implementation differences.
8
+
9
+// This conditional type will be the existing global Event in a browser, or
10
+// the copy below in a Node environment.
11
+type __Event = typeof globalThis extends { onmessage: any, Event: infer T }
12
+? T
13
+: {
14
+    /** This is not used in Node.js and is provided purely for completeness. */
15
+    readonly bubbles: boolean;
16
+    /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
17
+    cancelBubble: () => void;
18
+    /** True if the event was created with the cancelable option */
19
+    readonly cancelable: boolean;
20
+    /** This is not used in Node.js and is provided purely for completeness. */
21
+    readonly composed: boolean;
22
+    /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
23
+    composedPath(): [EventTarget?]
24
+    /** Alias for event.target. */
25
+    readonly currentTarget: EventTarget | null;
26
+    /** Is true if cancelable is true and event.preventDefault() has been called. */
27
+    readonly defaultPrevented: boolean;
28
+    /** This is not used in Node.js and is provided purely for completeness. */
29
+    readonly eventPhase: 0 | 2;
30
+    /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
31
+    readonly isTrusted: boolean;
32
+    /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
33
+    preventDefault(): void;
34
+    /** This is not used in Node.js and is provided purely for completeness. */
35
+    returnValue: boolean;
36
+    /** Alias for event.target. */
37
+    readonly srcElement: EventTarget | null;
38
+    /** Stops the invocation of event listeners after the current one completes. */
39
+    stopImmediatePropagation(): void;
40
+    /** This is not used in Node.js and is provided purely for completeness. */
41
+    stopPropagation(): void;
42
+    /** The `EventTarget` dispatching the event */
43
+    readonly target: EventTarget | null;
44
+    /** The millisecond timestamp when the Event object was created. */
45
+    readonly timeStamp: number;
46
+    /** Returns the type of event, e.g. "click", "hashchange", or "submit". */
47
+    readonly type: string;
48
+};
49
+
50
+// See comment above explaining conditional type
51
+type __EventTarget = typeof globalThis extends { onmessage: any, EventTarget: infer T }
52
+? T
53
+: {
54
+    /**
55
+     * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
56
+     *
57
+     * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
58
+     *
59
+     * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
60
+     * Specifically, the `capture` option is used as part of the key when registering a `listener`.
61
+     * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
62
+     */
63
+    addEventListener(
64
+        type: string,
65
+        listener: EventListener | EventListenerObject,
66
+        options?: AddEventListenerOptions | boolean,
67
+    ): void;
68
+    /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
69
+    dispatchEvent(event: Event): boolean;
70
+    /** Removes the event listener in target's event listener list with the same type, callback, and options. */
71
+    removeEventListener(
72
+        type: string,
73
+        listener: EventListener | EventListenerObject,
74
+        options?: EventListenerOptions | boolean,
75
+    ): void;
76
+};
77
+
78
+interface EventInit {
79
+    bubbles?: boolean;
80
+    cancelable?: boolean;
81
+    composed?: boolean;
82
+}
83
+
84
+interface EventListenerOptions {
85
+    /** Not directly used by Node.js. Added for API completeness. Default: `false`. */
86
+    capture?: boolean;
87
+}
88
+
89
+interface AddEventListenerOptions extends EventListenerOptions {
90
+    /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */
91
+    once?: boolean;
92
+    /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */
93
+    passive?: boolean;
94
+}
95
+
96
+interface EventListener {
97
+    (evt: Event): void;
98
+}
99
+
100
+interface EventListenerObject {
101
+    handleEvent(object: Event): void;
102
+}
103
+
104
+import {} from 'events';    // Make this an ambient declaration
105
+declare global {
106
+    /** An event which takes place in the DOM. */
107
+    interface Event extends __Event {}
108
+    var Event: typeof globalThis extends { onmessage: any, Event: infer T }
109
+        ? T
110
+        : {
111
+            prototype: __Event;
112
+            new (type: string, eventInitDict?: EventInit): __Event;
113
+        };
114
+
115
+    /**
116
+     * EventTarget is a DOM interface implemented by objects that can
117
+     * receive events and may have listeners for them.
118
+     */
119
+    interface EventTarget extends __EventTarget {}
120
+    var EventTarget: typeof globalThis extends { onmessage: any, EventTarget: infer T }
121
+        ? T
122
+        : {
123
+            prototype: __EventTarget;
124
+            new (): __EventTarget;
125
+        };
126
+}

+ 170
- 0
node_modules/@types/node/ts4.8/domain.d.ts 查看文件

@@ -0,0 +1,170 @@
1
+/**
2
+ * **This module is pending deprecation.** Once a replacement API has been
3
+ * finalized, this module will be fully deprecated. Most developers should
4
+ * **not** have cause to use this module. Users who absolutely must have
5
+ * the functionality that domains provide may rely on it for the time being
6
+ * but should expect to have to migrate to a different solution
7
+ * in the future.
8
+ *
9
+ * Domains provide a way to handle multiple different IO operations as a
10
+ * single group. If any of the event emitters or callbacks registered to a
11
+ * domain emit an `'error'` event, or throw an error, then the domain object
12
+ * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
13
+ * exit immediately with an error code.
14
+ * @deprecated Since v1.4.2 - Deprecated
15
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/domain.js)
16
+ */
17
+declare module 'domain' {
18
+    import EventEmitter = require('node:events');
19
+    /**
20
+     * The `Domain` class encapsulates the functionality of routing errors and
21
+     * uncaught exceptions to the active `Domain` object.
22
+     *
23
+     * To handle the errors that it catches, listen to its `'error'` event.
24
+     */
25
+    class Domain extends EventEmitter {
26
+        /**
27
+         * An array of timers and event emitters that have been explicitly added
28
+         * to the domain.
29
+         */
30
+        members: Array<EventEmitter | NodeJS.Timer>;
31
+        /**
32
+         * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
33
+         * pushes the domain onto the domain
34
+         * stack managed by the domain module (see {@link exit} for details on the
35
+         * domain stack). The call to `enter()` delimits the beginning of a chain of
36
+         * asynchronous calls and I/O operations bound to a domain.
37
+         *
38
+         * Calling `enter()` changes only the active domain, and does not alter the domain
39
+         * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
40
+         * single domain.
41
+         */
42
+        enter(): void;
43
+        /**
44
+         * The `exit()` method exits the current domain, popping it off the domain stack.
45
+         * Any time execution is going to switch to the context of a different chain of
46
+         * asynchronous calls, it's important to ensure that the current domain is exited.
47
+         * The call to `exit()` delimits either the end of or an interruption to the chain
48
+         * of asynchronous calls and I/O operations bound to a domain.
49
+         *
50
+         * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain.
51
+         *
52
+         * Calling `exit()` changes only the active domain, and does not alter the domain
53
+         * itself. `enter()` and `exit()` can be called an arbitrary number of times on a
54
+         * single domain.
55
+         */
56
+        exit(): void;
57
+        /**
58
+         * Run the supplied function in the context of the domain, implicitly
59
+         * binding all event emitters, timers, and lowlevel requests that are
60
+         * created in that context. Optionally, arguments can be passed to
61
+         * the function.
62
+         *
63
+         * This is the most basic way to use a domain.
64
+         *
65
+         * ```js
66
+         * const domain = require('domain');
67
+         * const fs = require('fs');
68
+         * const d = domain.create();
69
+         * d.on('error', (er) => {
70
+         *   console.error('Caught error!', er);
71
+         * });
72
+         * d.run(() => {
73
+         *   process.nextTick(() => {
74
+         *     setTimeout(() => { // Simulating some various async stuff
75
+         *       fs.open('non-existent file', 'r', (er, fd) => {
76
+         *         if (er) throw er;
77
+         *         // proceed...
78
+         *       });
79
+         *     }, 100);
80
+         *   });
81
+         * });
82
+         * ```
83
+         *
84
+         * In this example, the `d.on('error')` handler will be triggered, rather
85
+         * than crashing the program.
86
+         */
87
+        run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
88
+        /**
89
+         * Explicitly adds an emitter to the domain. If any event handlers called by
90
+         * the emitter throw an error, or if the emitter emits an `'error'` event, it
91
+         * will be routed to the domain's `'error'` event, just like with implicit
92
+         * binding.
93
+         *
94
+         * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by
95
+         * the domain `'error'` handler.
96
+         *
97
+         * If the Timer or `EventEmitter` was already bound to a domain, it is removed
98
+         * from that one, and bound to this one instead.
99
+         * @param emitter emitter or timer to be added to the domain
100
+         */
101
+        add(emitter: EventEmitter | NodeJS.Timer): void;
102
+        /**
103
+         * The opposite of {@link add}. Removes domain handling from the
104
+         * specified emitter.
105
+         * @param emitter emitter or timer to be removed from the domain
106
+         */
107
+        remove(emitter: EventEmitter | NodeJS.Timer): void;
108
+        /**
109
+         * The returned function will be a wrapper around the supplied callback
110
+         * function. When the returned function is called, any errors that are
111
+         * thrown will be routed to the domain's `'error'` event.
112
+         *
113
+         * ```js
114
+         * const d = domain.create();
115
+         *
116
+         * function readSomeFile(filename, cb) {
117
+         *   fs.readFile(filename, 'utf8', d.bind((er, data) => {
118
+         *     // If this throws, it will also be passed to the domain.
119
+         *     return cb(er, data ? JSON.parse(data) : null);
120
+         *   }));
121
+         * }
122
+         *
123
+         * d.on('error', (er) => {
124
+         *   // An error occurred somewhere. If we throw it now, it will crash the program
125
+         *   // with the normal line number and stack message.
126
+         * });
127
+         * ```
128
+         * @param callback The callback function
129
+         * @return The bound function
130
+         */
131
+        bind<T extends Function>(callback: T): T;
132
+        /**
133
+         * This method is almost identical to {@link bind}. However, in
134
+         * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function.
135
+         *
136
+         * In this way, the common `if (err) return callback(err);` pattern can be replaced
137
+         * with a single error handler in a single place.
138
+         *
139
+         * ```js
140
+         * const d = domain.create();
141
+         *
142
+         * function readSomeFile(filename, cb) {
143
+         *   fs.readFile(filename, 'utf8', d.intercept((data) => {
144
+         *     // Note, the first argument is never passed to the
145
+         *     // callback since it is assumed to be the 'Error' argument
146
+         *     // and thus intercepted by the domain.
147
+         *
148
+         *     // If this throws, it will also be passed to the domain
149
+         *     // so the error-handling logic can be moved to the 'error'
150
+         *     // event on the domain instead of being repeated throughout
151
+         *     // the program.
152
+         *     return cb(null, JSON.parse(data));
153
+         *   }));
154
+         * }
155
+         *
156
+         * d.on('error', (er) => {
157
+         *   // An error occurred somewhere. If we throw it now, it will crash the program
158
+         *   // with the normal line number and stack message.
159
+         * });
160
+         * ```
161
+         * @param callback The callback function
162
+         * @return The intercepted function
163
+         */
164
+        intercept<T extends Function>(callback: T): T;
165
+    }
166
+    function create(): Domain;
167
+}
168
+declare module 'node:domain' {
169
+    export * from 'domain';
170
+}

+ 678
- 0
node_modules/@types/node/ts4.8/events.d.ts 查看文件

@@ -0,0 +1,678 @@
1
+/**
2
+ * Much of the Node.js core API is built around an idiomatic asynchronous
3
+ * event-driven architecture in which certain kinds of objects (called "emitters")
4
+ * emit named events that cause `Function` objects ("listeners") to be called.
5
+ *
6
+ * For instance: a `net.Server` object emits an event each time a peer
7
+ * connects to it; a `fs.ReadStream` emits an event when the file is opened;
8
+ * a `stream` emits an event whenever data is available to be read.
9
+ *
10
+ * All objects that emit events are instances of the `EventEmitter` class. These
11
+ * objects expose an `eventEmitter.on()` function that allows one or more
12
+ * functions to be attached to named events emitted by the object. Typically,
13
+ * event names are camel-cased strings but any valid JavaScript property key
14
+ * can be used.
15
+ *
16
+ * When the `EventEmitter` object emits an event, all of the functions attached
17
+ * to that specific event are called _synchronously_. Any values returned by the
18
+ * called listeners are _ignored_ and discarded.
19
+ *
20
+ * The following example shows a simple `EventEmitter` instance with a single
21
+ * listener. The `eventEmitter.on()` method is used to register listeners, while
22
+ * the `eventEmitter.emit()` method is used to trigger the event.
23
+ *
24
+ * ```js
25
+ * const EventEmitter = require('events');
26
+ *
27
+ * class MyEmitter extends EventEmitter {}
28
+ *
29
+ * const myEmitter = new MyEmitter();
30
+ * myEmitter.on('event', () => {
31
+ *   console.log('an event occurred!');
32
+ * });
33
+ * myEmitter.emit('event');
34
+ * ```
35
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/events.js)
36
+ */
37
+declare module 'events' {
38
+    // NOTE: This class is in the docs but is **not actually exported** by Node.
39
+    // If https://github.com/nodejs/node/issues/39903 gets resolved and Node
40
+    // actually starts exporting the class, uncomment below.
41
+
42
+    // import { EventListener, EventListenerObject } from '__dom-events';
43
+    // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */
44
+    // interface NodeEventTarget extends EventTarget {
45
+    //     /**
46
+    //      * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API.
47
+    //      * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget.
48
+    //      */
49
+    //     addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
50
+    //     /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */
51
+    //     eventNames(): string[];
52
+    //     /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */
53
+    //     listenerCount(type: string): number;
54
+    //     /** Node.js-specific alias for `eventTarget.removeListener()`. */
55
+    //     off(type: string, listener: EventListener | EventListenerObject): this;
56
+    //     /** Node.js-specific alias for `eventTarget.addListener()`. */
57
+    //     on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this;
58
+    //     /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */
59
+    //     once(type: string, listener: EventListener | EventListenerObject): this;
60
+    //     /**
61
+    //      * Node.js-specific extension to the `EventTarget` class.
62
+    //      * If `type` is specified, removes all registered listeners for `type`,
63
+    //      * otherwise removes all registered listeners.
64
+    //      */
65
+    //     removeAllListeners(type: string): this;
66
+    //     /**
67
+    //      * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`.
68
+    //      * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`.
69
+    //      */
70
+    //     removeListener(type: string, listener: EventListener | EventListenerObject): this;
71
+    // }
72
+
73
+    interface EventEmitterOptions {
74
+        /**
75
+         * Enables automatic capturing of promise rejection.
76
+         */
77
+        captureRejections?: boolean | undefined;
78
+    }
79
+    // Any EventTarget with a Node-style `once` function
80
+    interface _NodeEventTarget {
81
+        once(eventName: string | symbol, listener: (...args: any[]) => void): this;
82
+    }
83
+    // Any EventTarget with a DOM-style `addEventListener`
84
+    interface _DOMEventTarget {
85
+        addEventListener(
86
+            eventName: string,
87
+            listener: (...args: any[]) => void,
88
+            opts?: {
89
+                once: boolean;
90
+            }
91
+        ): any;
92
+    }
93
+    interface StaticEventEmitterOptions {
94
+        signal?: AbortSignal | undefined;
95
+    }
96
+    interface EventEmitter extends NodeJS.EventEmitter {}
97
+    /**
98
+     * The `EventEmitter` class is defined and exposed by the `events` module:
99
+     *
100
+     * ```js
101
+     * const EventEmitter = require('events');
102
+     * ```
103
+     *
104
+     * All `EventEmitter`s emit the event `'newListener'` when new listeners are
105
+     * added and `'removeListener'` when existing listeners are removed.
106
+     *
107
+     * It supports the following option:
108
+     * @since v0.1.26
109
+     */
110
+    class EventEmitter {
111
+        constructor(options?: EventEmitterOptions);
112
+        /**
113
+         * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
114
+         * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
115
+         * The `Promise` will resolve with an array of all the arguments emitted to the
116
+         * given event.
117
+         *
118
+         * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event
119
+         * semantics and does not listen to the `'error'` event.
120
+         *
121
+         * ```js
122
+         * const { once, EventEmitter } = require('events');
123
+         *
124
+         * async function run() {
125
+         *   const ee = new EventEmitter();
126
+         *
127
+         *   process.nextTick(() => {
128
+         *     ee.emit('myevent', 42);
129
+         *   });
130
+         *
131
+         *   const [value] = await once(ee, 'myevent');
132
+         *   console.log(value);
133
+         *
134
+         *   const err = new Error('kaboom');
135
+         *   process.nextTick(() => {
136
+         *     ee.emit('error', err);
137
+         *   });
138
+         *
139
+         *   try {
140
+         *     await once(ee, 'myevent');
141
+         *   } catch (err) {
142
+         *     console.log('error happened', err);
143
+         *   }
144
+         * }
145
+         *
146
+         * run();
147
+         * ```
148
+         *
149
+         * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
150
+         * '`error'` event itself, then it is treated as any other kind of event without
151
+         * special handling:
152
+         *
153
+         * ```js
154
+         * const { EventEmitter, once } = require('events');
155
+         *
156
+         * const ee = new EventEmitter();
157
+         *
158
+         * once(ee, 'error')
159
+         *   .then(([err]) => console.log('ok', err.message))
160
+         *   .catch((err) => console.log('error', err.message));
161
+         *
162
+         * ee.emit('error', new Error('boom'));
163
+         *
164
+         * // Prints: ok boom
165
+         * ```
166
+         *
167
+         * An `AbortSignal` can be used to cancel waiting for the event:
168
+         *
169
+         * ```js
170
+         * const { EventEmitter, once } = require('events');
171
+         *
172
+         * const ee = new EventEmitter();
173
+         * const ac = new AbortController();
174
+         *
175
+         * async function foo(emitter, event, signal) {
176
+         *   try {
177
+         *     await once(emitter, event, { signal });
178
+         *     console.log('event emitted!');
179
+         *   } catch (error) {
180
+         *     if (error.name === 'AbortError') {
181
+         *       console.error('Waiting for the event was canceled!');
182
+         *     } else {
183
+         *       console.error('There was an error', error.message);
184
+         *     }
185
+         *   }
186
+         * }
187
+         *
188
+         * foo(ee, 'foo', ac.signal);
189
+         * ac.abort(); // Abort waiting for the event
190
+         * ee.emit('foo'); // Prints: Waiting for the event was canceled!
191
+         * ```
192
+         * @since v11.13.0, v10.16.0
193
+         */
194
+        static once(emitter: _NodeEventTarget, eventName: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>;
195
+        static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise<any[]>;
196
+        /**
197
+         * ```js
198
+         * const { on, EventEmitter } = require('events');
199
+         *
200
+         * (async () => {
201
+         *   const ee = new EventEmitter();
202
+         *
203
+         *   // Emit later on
204
+         *   process.nextTick(() => {
205
+         *     ee.emit('foo', 'bar');
206
+         *     ee.emit('foo', 42);
207
+         *   });
208
+         *
209
+         *   for await (const event of on(ee, 'foo')) {
210
+         *     // The execution of this inner block is synchronous and it
211
+         *     // processes one event at a time (even with await). Do not use
212
+         *     // if concurrent execution is required.
213
+         *     console.log(event); // prints ['bar'] [42]
214
+         *   }
215
+         *   // Unreachable here
216
+         * })();
217
+         * ```
218
+         *
219
+         * Returns an `AsyncIterator` that iterates `eventName` events. It will throw
220
+         * if the `EventEmitter` emits `'error'`. It removes all listeners when
221
+         * exiting the loop. The `value` returned by each iteration is an array
222
+         * composed of the emitted event arguments.
223
+         *
224
+         * An `AbortSignal` can be used to cancel waiting on events:
225
+         *
226
+         * ```js
227
+         * const { on, EventEmitter } = require('events');
228
+         * const ac = new AbortController();
229
+         *
230
+         * (async () => {
231
+         *   const ee = new EventEmitter();
232
+         *
233
+         *   // Emit later on
234
+         *   process.nextTick(() => {
235
+         *     ee.emit('foo', 'bar');
236
+         *     ee.emit('foo', 42);
237
+         *   });
238
+         *
239
+         *   for await (const event of on(ee, 'foo', { signal: ac.signal })) {
240
+         *     // The execution of this inner block is synchronous and it
241
+         *     // processes one event at a time (even with await). Do not use
242
+         *     // if concurrent execution is required.
243
+         *     console.log(event); // prints ['bar'] [42]
244
+         *   }
245
+         *   // Unreachable here
246
+         * })();
247
+         *
248
+         * process.nextTick(() => ac.abort());
249
+         * ```
250
+         * @since v13.6.0, v12.16.0
251
+         * @param eventName The name of the event being listened for
252
+         * @return that iterates `eventName` events emitted by the `emitter`
253
+         */
254
+        static on(emitter: NodeJS.EventEmitter, eventName: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>;
255
+        /**
256
+         * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
257
+         *
258
+         * ```js
259
+         * const { EventEmitter, listenerCount } = require('events');
260
+         * const myEmitter = new EventEmitter();
261
+         * myEmitter.on('event', () => {});
262
+         * myEmitter.on('event', () => {});
263
+         * console.log(listenerCount(myEmitter, 'event'));
264
+         * // Prints: 2
265
+         * ```
266
+         * @since v0.9.12
267
+         * @deprecated Since v3.2.0 - Use `listenerCount` instead.
268
+         * @param emitter The emitter to query
269
+         * @param eventName The event name
270
+         */
271
+        static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number;
272
+        /**
273
+         * Returns a copy of the array of listeners for the event named `eventName`.
274
+         *
275
+         * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on
276
+         * the emitter.
277
+         *
278
+         * For `EventTarget`s this is the only way to get the event listeners for the
279
+         * event target. This is useful for debugging and diagnostic purposes.
280
+         *
281
+         * ```js
282
+         * const { getEventListeners, EventEmitter } = require('events');
283
+         *
284
+         * {
285
+         *   const ee = new EventEmitter();
286
+         *   const listener = () => console.log('Events are fun');
287
+         *   ee.on('foo', listener);
288
+         *   getEventListeners(ee, 'foo'); // [listener]
289
+         * }
290
+         * {
291
+         *   const et = new EventTarget();
292
+         *   const listener = () => console.log('Events are fun');
293
+         *   et.addEventListener('foo', listener);
294
+         *   getEventListeners(et, 'foo'); // [listener]
295
+         * }
296
+         * ```
297
+         * @since v15.2.0, v14.17.0
298
+         */
299
+        static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[];
300
+        /**
301
+         * ```js
302
+         * const {
303
+         *   setMaxListeners,
304
+         *   EventEmitter
305
+         * } = require('events');
306
+         *
307
+         * const target = new EventTarget();
308
+         * const emitter = new EventEmitter();
309
+         *
310
+         * setMaxListeners(5, target, emitter);
311
+         * ```
312
+         * @since v15.4.0
313
+         * @param n A non-negative number. The maximum number of listeners per `EventTarget` event.
314
+         * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter}
315
+         * objects.
316
+         */
317
+        static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void;
318
+        /**
319
+         * This symbol shall be used to install a listener for only monitoring `'error'`
320
+         * events. Listeners installed using this symbol are called before the regular
321
+         * `'error'` listeners are called.
322
+         *
323
+         * Installing a listener using this symbol does not change the behavior once an
324
+         * `'error'` event is emitted, therefore the process will still crash if no
325
+         * regular `'error'` listener is installed.
326
+         */
327
+        static readonly errorMonitor: unique symbol;
328
+        static readonly captureRejectionSymbol: unique symbol;
329
+        /**
330
+         * Sets or gets the default captureRejection value for all emitters.
331
+         */
332
+        // TODO: These should be described using static getter/setter pairs:
333
+        static captureRejections: boolean;
334
+        static defaultMaxListeners: number;
335
+    }
336
+    import internal = require('node:events');
337
+    namespace EventEmitter {
338
+        // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4
339
+        export { internal as EventEmitter };
340
+        export interface Abortable {
341
+            /**
342
+             * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
343
+             */
344
+            signal?: AbortSignal | undefined;
345
+        }
346
+    }
347
+    global {
348
+        namespace NodeJS {
349
+            interface EventEmitter {
350
+                /**
351
+                 * Alias for `emitter.on(eventName, listener)`.
352
+                 * @since v0.1.26
353
+                 */
354
+                addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
355
+                /**
356
+                 * Adds the `listener` function to the end of the listeners array for the
357
+                 * event named `eventName`. No checks are made to see if the `listener` has
358
+                 * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
359
+                 * times.
360
+                 *
361
+                 * ```js
362
+                 * server.on('connection', (stream) => {
363
+                 *   console.log('someone connected!');
364
+                 * });
365
+                 * ```
366
+                 *
367
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
368
+                 *
369
+                 * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
370
+                 * event listener to the beginning of the listeners array.
371
+                 *
372
+                 * ```js
373
+                 * const myEE = new EventEmitter();
374
+                 * myEE.on('foo', () => console.log('a'));
375
+                 * myEE.prependListener('foo', () => console.log('b'));
376
+                 * myEE.emit('foo');
377
+                 * // Prints:
378
+                 * //   b
379
+                 * //   a
380
+                 * ```
381
+                 * @since v0.1.101
382
+                 * @param eventName The name of the event.
383
+                 * @param listener The callback function
384
+                 */
385
+                on(eventName: string | symbol, listener: (...args: any[]) => void): this;
386
+                /**
387
+                 * Adds a **one-time**`listener` function for the event named `eventName`. The
388
+                 * next time `eventName` is triggered, this listener is removed and then invoked.
389
+                 *
390
+                 * ```js
391
+                 * server.once('connection', (stream) => {
392
+                 *   console.log('Ah, we have our first user!');
393
+                 * });
394
+                 * ```
395
+                 *
396
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
397
+                 *
398
+                 * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
399
+                 * event listener to the beginning of the listeners array.
400
+                 *
401
+                 * ```js
402
+                 * const myEE = new EventEmitter();
403
+                 * myEE.once('foo', () => console.log('a'));
404
+                 * myEE.prependOnceListener('foo', () => console.log('b'));
405
+                 * myEE.emit('foo');
406
+                 * // Prints:
407
+                 * //   b
408
+                 * //   a
409
+                 * ```
410
+                 * @since v0.3.0
411
+                 * @param eventName The name of the event.
412
+                 * @param listener The callback function
413
+                 */
414
+                once(eventName: string | symbol, listener: (...args: any[]) => void): this;
415
+                /**
416
+                 * Removes the specified `listener` from the listener array for the event named`eventName`.
417
+                 *
418
+                 * ```js
419
+                 * const callback = (stream) => {
420
+                 *   console.log('someone connected!');
421
+                 * };
422
+                 * server.on('connection', callback);
423
+                 * // ...
424
+                 * server.removeListener('connection', callback);
425
+                 * ```
426
+                 *
427
+                 * `removeListener()` will remove, at most, one instance of a listener from the
428
+                 * listener array. If any single listener has been added multiple times to the
429
+                 * listener array for the specified `eventName`, then `removeListener()` must be
430
+                 * called multiple times to remove each instance.
431
+                 *
432
+                 * Once an event is emitted, all listeners attached to it at the
433
+                 * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
434
+                 * will not remove them from`emit()` in progress. Subsequent events behave as expected.
435
+                 *
436
+                 * ```js
437
+                 * const myEmitter = new MyEmitter();
438
+                 *
439
+                 * const callbackA = () => {
440
+                 *   console.log('A');
441
+                 *   myEmitter.removeListener('event', callbackB);
442
+                 * };
443
+                 *
444
+                 * const callbackB = () => {
445
+                 *   console.log('B');
446
+                 * };
447
+                 *
448
+                 * myEmitter.on('event', callbackA);
449
+                 *
450
+                 * myEmitter.on('event', callbackB);
451
+                 *
452
+                 * // callbackA removes listener callbackB but it will still be called.
453
+                 * // Internal listener array at time of emit [callbackA, callbackB]
454
+                 * myEmitter.emit('event');
455
+                 * // Prints:
456
+                 * //   A
457
+                 * //   B
458
+                 *
459
+                 * // callbackB is now removed.
460
+                 * // Internal listener array [callbackA]
461
+                 * myEmitter.emit('event');
462
+                 * // Prints:
463
+                 * //   A
464
+                 * ```
465
+                 *
466
+                 * Because listeners are managed using an internal array, calling this will
467
+                 * change the position indices of any listener registered _after_ the listener
468
+                 * being removed. This will not impact the order in which listeners are called,
469
+                 * but it means that any copies of the listener array as returned by
470
+                 * the `emitter.listeners()` method will need to be recreated.
471
+                 *
472
+                 * When a single function has been added as a handler multiple times for a single
473
+                 * event (as in the example below), `removeListener()` will remove the most
474
+                 * recently added instance. In the example the `once('ping')`listener is removed:
475
+                 *
476
+                 * ```js
477
+                 * const ee = new EventEmitter();
478
+                 *
479
+                 * function pong() {
480
+                 *   console.log('pong');
481
+                 * }
482
+                 *
483
+                 * ee.on('ping', pong);
484
+                 * ee.once('ping', pong);
485
+                 * ee.removeListener('ping', pong);
486
+                 *
487
+                 * ee.emit('ping');
488
+                 * ee.emit('ping');
489
+                 * ```
490
+                 *
491
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
492
+                 * @since v0.1.26
493
+                 */
494
+                removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
495
+                /**
496
+                 * Alias for `emitter.removeListener()`.
497
+                 * @since v10.0.0
498
+                 */
499
+                off(eventName: string | symbol, listener: (...args: any[]) => void): this;
500
+                /**
501
+                 * Removes all listeners, or those of the specified `eventName`.
502
+                 *
503
+                 * It is bad practice to remove listeners added elsewhere in the code,
504
+                 * particularly when the `EventEmitter` instance was created by some other
505
+                 * component or module (e.g. sockets or file streams).
506
+                 *
507
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
508
+                 * @since v0.1.26
509
+                 */
510
+                removeAllListeners(event?: string | symbol): this;
511
+                /**
512
+                 * By default `EventEmitter`s will print a warning if more than `10` listeners are
513
+                 * added for a particular event. This is a useful default that helps finding
514
+                 * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
515
+                 * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
516
+                 *
517
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
518
+                 * @since v0.3.5
519
+                 */
520
+                setMaxListeners(n: number): this;
521
+                /**
522
+                 * Returns the current max listener value for the `EventEmitter` which is either
523
+                 * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}.
524
+                 * @since v1.0.0
525
+                 */
526
+                getMaxListeners(): number;
527
+                /**
528
+                 * Returns a copy of the array of listeners for the event named `eventName`.
529
+                 *
530
+                 * ```js
531
+                 * server.on('connection', (stream) => {
532
+                 *   console.log('someone connected!');
533
+                 * });
534
+                 * console.log(util.inspect(server.listeners('connection')));
535
+                 * // Prints: [ [Function] ]
536
+                 * ```
537
+                 * @since v0.1.26
538
+                 */
539
+                listeners(eventName: string | symbol): Function[];
540
+                /**
541
+                 * Returns a copy of the array of listeners for the event named `eventName`,
542
+                 * including any wrappers (such as those created by `.once()`).
543
+                 *
544
+                 * ```js
545
+                 * const emitter = new EventEmitter();
546
+                 * emitter.once('log', () => console.log('log once'));
547
+                 *
548
+                 * // Returns a new Array with a function `onceWrapper` which has a property
549
+                 * // `listener` which contains the original listener bound above
550
+                 * const listeners = emitter.rawListeners('log');
551
+                 * const logFnWrapper = listeners[0];
552
+                 *
553
+                 * // Logs "log once" to the console and does not unbind the `once` event
554
+                 * logFnWrapper.listener();
555
+                 *
556
+                 * // Logs "log once" to the console and removes the listener
557
+                 * logFnWrapper();
558
+                 *
559
+                 * emitter.on('log', () => console.log('log persistently'));
560
+                 * // Will return a new Array with a single function bound by `.on()` above
561
+                 * const newListeners = emitter.rawListeners('log');
562
+                 *
563
+                 * // Logs "log persistently" twice
564
+                 * newListeners[0]();
565
+                 * emitter.emit('log');
566
+                 * ```
567
+                 * @since v9.4.0
568
+                 */
569
+                rawListeners(eventName: string | symbol): Function[];
570
+                /**
571
+                 * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
572
+                 * to each.
573
+                 *
574
+                 * Returns `true` if the event had listeners, `false` otherwise.
575
+                 *
576
+                 * ```js
577
+                 * const EventEmitter = require('events');
578
+                 * const myEmitter = new EventEmitter();
579
+                 *
580
+                 * // First listener
581
+                 * myEmitter.on('event', function firstListener() {
582
+                 *   console.log('Helloooo! first listener');
583
+                 * });
584
+                 * // Second listener
585
+                 * myEmitter.on('event', function secondListener(arg1, arg2) {
586
+                 *   console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
587
+                 * });
588
+                 * // Third listener
589
+                 * myEmitter.on('event', function thirdListener(...args) {
590
+                 *   const parameters = args.join(', ');
591
+                 *   console.log(`event with parameters ${parameters} in third listener`);
592
+                 * });
593
+                 *
594
+                 * console.log(myEmitter.listeners('event'));
595
+                 *
596
+                 * myEmitter.emit('event', 1, 2, 3, 4, 5);
597
+                 *
598
+                 * // Prints:
599
+                 * // [
600
+                 * //   [Function: firstListener],
601
+                 * //   [Function: secondListener],
602
+                 * //   [Function: thirdListener]
603
+                 * // ]
604
+                 * // Helloooo! first listener
605
+                 * // event with parameters 1, 2 in second listener
606
+                 * // event with parameters 1, 2, 3, 4, 5 in third listener
607
+                 * ```
608
+                 * @since v0.1.26
609
+                 */
610
+                emit(eventName: string | symbol, ...args: any[]): boolean;
611
+                /**
612
+                 * Returns the number of listeners listening to the event named `eventName`.
613
+                 * @since v3.2.0
614
+                 * @param eventName The name of the event being listened for
615
+                 */
616
+                listenerCount(eventName: string | symbol): number;
617
+                /**
618
+                 * Adds the `listener` function to the _beginning_ of the listeners array for the
619
+                 * event named `eventName`. No checks are made to see if the `listener` has
620
+                 * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
621
+                 * times.
622
+                 *
623
+                 * ```js
624
+                 * server.prependListener('connection', (stream) => {
625
+                 *   console.log('someone connected!');
626
+                 * });
627
+                 * ```
628
+                 *
629
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
630
+                 * @since v6.0.0
631
+                 * @param eventName The name of the event.
632
+                 * @param listener The callback function
633
+                 */
634
+                prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
635
+                /**
636
+                 * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
637
+                 * listener is removed, and then invoked.
638
+                 *
639
+                 * ```js
640
+                 * server.prependOnceListener('connection', (stream) => {
641
+                 *   console.log('Ah, we have our first user!');
642
+                 * });
643
+                 * ```
644
+                 *
645
+                 * Returns a reference to the `EventEmitter`, so that calls can be chained.
646
+                 * @since v6.0.0
647
+                 * @param eventName The name of the event.
648
+                 * @param listener The callback function
649
+                 */
650
+                prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
651
+                /**
652
+                 * Returns an array listing the events for which the emitter has registered
653
+                 * listeners. The values in the array are strings or `Symbol`s.
654
+                 *
655
+                 * ```js
656
+                 * const EventEmitter = require('events');
657
+                 * const myEE = new EventEmitter();
658
+                 * myEE.on('foo', () => {});
659
+                 * myEE.on('bar', () => {});
660
+                 *
661
+                 * const sym = Symbol('symbol');
662
+                 * myEE.on(sym, () => {});
663
+                 *
664
+                 * console.log(myEE.eventNames());
665
+                 * // Prints: [ 'foo', 'bar', Symbol(symbol) ]
666
+                 * ```
667
+                 * @since v6.0.0
668
+                 */
669
+                eventNames(): Array<string | symbol>;
670
+            }
671
+        }
672
+    }
673
+    export = EventEmitter;
674
+}
675
+declare module 'node:events' {
676
+    import events = require('events');
677
+    export = events;
678
+}

+ 3872
- 0
node_modules/@types/node/ts4.8/fs.d.ts
文件差異過大導致無法顯示
查看文件


+ 1138
- 0
node_modules/@types/node/ts4.8/fs/promises.d.ts
文件差異過大導致無法顯示
查看文件


+ 294
- 0
node_modules/@types/node/ts4.8/globals.d.ts 查看文件

@@ -0,0 +1,294 @@
1
+// Declare "static" methods in Error
2
+interface ErrorConstructor {
3
+    /** Create .stack property on a target object */
4
+    captureStackTrace(targetObject: object, constructorOpt?: Function): void;
5
+
6
+    /**
7
+     * Optional override for formatting stack traces
8
+     *
9
+     * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
10
+     */
11
+    prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
12
+
13
+    stackTraceLimit: number;
14
+}
15
+
16
+/*-----------------------------------------------*
17
+ *                                               *
18
+ *                   GLOBAL                      *
19
+ *                                               *
20
+ ------------------------------------------------*/
21
+
22
+// For backwards compability
23
+interface NodeRequire extends NodeJS.Require { }
24
+interface RequireResolve extends NodeJS.RequireResolve { }
25
+interface NodeModule extends NodeJS.Module { }
26
+
27
+declare var process: NodeJS.Process;
28
+declare var console: Console;
29
+
30
+declare var __filename: string;
31
+declare var __dirname: string;
32
+
33
+declare var require: NodeRequire;
34
+declare var module: NodeModule;
35
+
36
+// Same as module.exports
37
+declare var exports: any;
38
+
39
+/**
40
+ * Only available if `--expose-gc` is passed to the process.
41
+ */
42
+declare var gc: undefined | (() => void);
43
+
44
+//#region borrowed
45
+// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
46
+/** A controller object that allows you to abort one or more DOM requests as and when desired. */
47
+interface AbortController {
48
+    /**
49
+     * Returns the AbortSignal object associated with this object.
50
+     */
51
+
52
+    readonly signal: AbortSignal;
53
+    /**
54
+     * 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.
55
+     */
56
+    abort(): void;
57
+}
58
+
59
+/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
60
+interface AbortSignal extends EventTarget {
61
+    /**
62
+     * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
63
+     */
64
+    readonly aborted: boolean;
65
+}
66
+
67
+declare var AbortController: {
68
+    prototype: AbortController;
69
+    new(): AbortController;
70
+};
71
+
72
+declare var AbortSignal: {
73
+    prototype: AbortSignal;
74
+    new(): AbortSignal;
75
+    // TODO: Add abort() static
76
+};
77
+//#endregion borrowed
78
+
79
+//#region ArrayLike.at()
80
+interface RelativeIndexable<T> {
81
+    /**
82
+     * Takes an integer value and returns the item at that index,
83
+     * allowing for positive and negative integers.
84
+     * Negative integers count back from the last item in the array.
85
+     */
86
+    at(index: number): T | undefined;
87
+}
88
+interface String extends RelativeIndexable<string> {}
89
+interface Array<T> extends RelativeIndexable<T> {}
90
+interface Int8Array extends RelativeIndexable<number> {}
91
+interface Uint8Array extends RelativeIndexable<number> {}
92
+interface Uint8ClampedArray extends RelativeIndexable<number> {}
93
+interface Int16Array extends RelativeIndexable<number> {}
94
+interface Uint16Array extends RelativeIndexable<number> {}
95
+interface Int32Array extends RelativeIndexable<number> {}
96
+interface Uint32Array extends RelativeIndexable<number> {}
97
+interface Float32Array extends RelativeIndexable<number> {}
98
+interface Float64Array extends RelativeIndexable<number> {}
99
+interface BigInt64Array extends RelativeIndexable<bigint> {}
100
+interface BigUint64Array extends RelativeIndexable<bigint> {}
101
+//#endregion ArrayLike.at() end
102
+
103
+/**
104
+ * @since v17.0.0
105
+ *
106
+ * Creates a deep clone of an object.
107
+ */
108
+declare function structuredClone<T>(
109
+    value: T,
110
+    transfer?: { transfer: ReadonlyArray<import('worker_threads').TransferListItem> },
111
+): T;
112
+
113
+/*----------------------------------------------*
114
+*                                               *
115
+*               GLOBAL INTERFACES               *
116
+*                                               *
117
+*-----------------------------------------------*/
118
+declare namespace NodeJS {
119
+    interface CallSite {
120
+        /**
121
+         * Value of "this"
122
+         */
123
+        getThis(): unknown;
124
+
125
+        /**
126
+         * Type of "this" as a string.
127
+         * This is the name of the function stored in the constructor field of
128
+         * "this", if available.  Otherwise the object's [[Class]] internal
129
+         * property.
130
+         */
131
+        getTypeName(): string | null;
132
+
133
+        /**
134
+         * Current function
135
+         */
136
+        getFunction(): Function | undefined;
137
+
138
+        /**
139
+         * Name of the current function, typically its name property.
140
+         * If a name property is not available an attempt will be made to try
141
+         * to infer a name from the function's context.
142
+         */
143
+        getFunctionName(): string | null;
144
+
145
+        /**
146
+         * Name of the property [of "this" or one of its prototypes] that holds
147
+         * the current function
148
+         */
149
+        getMethodName(): string | null;
150
+
151
+        /**
152
+         * Name of the script [if this function was defined in a script]
153
+         */
154
+        getFileName(): string | null;
155
+
156
+        /**
157
+         * Current line number [if this function was defined in a script]
158
+         */
159
+        getLineNumber(): number | null;
160
+
161
+        /**
162
+         * Current column number [if this function was defined in a script]
163
+         */
164
+        getColumnNumber(): number | null;
165
+
166
+        /**
167
+         * A call site object representing the location where eval was called
168
+         * [if this function was created using a call to eval]
169
+         */
170
+        getEvalOrigin(): string | undefined;
171
+
172
+        /**
173
+         * Is this a toplevel invocation, that is, is "this" the global object?
174
+         */
175
+        isToplevel(): boolean;
176
+
177
+        /**
178
+         * Does this call take place in code defined by a call to eval?
179
+         */
180
+        isEval(): boolean;
181
+
182
+        /**
183
+         * Is this call in native V8 code?
184
+         */
185
+        isNative(): boolean;
186
+
187
+        /**
188
+         * Is this a constructor call?
189
+         */
190
+        isConstructor(): boolean;
191
+    }
192
+
193
+    interface ErrnoException extends Error {
194
+        errno?: number | undefined;
195
+        code?: string | undefined;
196
+        path?: string | undefined;
197
+        syscall?: string | undefined;
198
+    }
199
+
200
+    interface ReadableStream extends EventEmitter {
201
+        readable: boolean;
202
+        read(size?: number): string | Buffer;
203
+        setEncoding(encoding: BufferEncoding): this;
204
+        pause(): this;
205
+        resume(): this;
206
+        isPaused(): boolean;
207
+        pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined; }): T;
208
+        unpipe(destination?: WritableStream): this;
209
+        unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
210
+        wrap(oldStream: ReadableStream): this;
211
+        [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
212
+    }
213
+
214
+    interface WritableStream extends EventEmitter {
215
+        writable: boolean;
216
+        write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
217
+        write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
218
+        end(cb?: () => void): this;
219
+        end(data: string | Uint8Array, cb?: () => void): this;
220
+        end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
221
+    }
222
+
223
+    interface ReadWriteStream extends ReadableStream, WritableStream { }
224
+
225
+    interface RefCounted {
226
+        ref(): this;
227
+        unref(): this;
228
+    }
229
+
230
+    type TypedArray =
231
+        | Uint8Array
232
+        | Uint8ClampedArray
233
+        | Uint16Array
234
+        | Uint32Array
235
+        | Int8Array
236
+        | Int16Array
237
+        | Int32Array
238
+        | BigUint64Array
239
+        | BigInt64Array
240
+        | Float32Array
241
+        | Float64Array;
242
+    type ArrayBufferView = TypedArray | DataView;
243
+
244
+    interface Require {
245
+        (id: string): any;
246
+        resolve: RequireResolve;
247
+        cache: Dict<NodeModule>;
248
+        /**
249
+         * @deprecated
250
+         */
251
+        extensions: RequireExtensions;
252
+        main: Module | undefined;
253
+    }
254
+
255
+    interface RequireResolve {
256
+        (id: string, options?: { paths?: string[] | undefined; }): string;
257
+        paths(request: string): string[] | null;
258
+    }
259
+
260
+    interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
261
+        '.js': (m: Module, filename: string) => any;
262
+        '.json': (m: Module, filename: string) => any;
263
+        '.node': (m: Module, filename: string) => any;
264
+    }
265
+    interface Module {
266
+        /**
267
+         * `true` if the module is running during the Node.js preload
268
+         */
269
+        isPreloading: boolean;
270
+        exports: any;
271
+        require: Require;
272
+        id: string;
273
+        filename: string;
274
+        loaded: boolean;
275
+        /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
276
+        parent: Module | null | undefined;
277
+        children: Module[];
278
+        /**
279
+         * @since v11.14.0
280
+         *
281
+         * The directory name of the module. This is usually the same as the path.dirname() of the module.id.
282
+         */
283
+        path: string;
284
+        paths: string[];
285
+    }
286
+
287
+    interface Dict<T> {
288
+        [key: string]: T | undefined;
289
+    }
290
+
291
+    interface ReadOnlyDict<T> {
292
+        readonly [key: string]: T | undefined;
293
+    }
294
+}

+ 1
- 0
node_modules/@types/node/ts4.8/globals.global.d.ts 查看文件

@@ -0,0 +1 @@
1
+declare var global: typeof globalThis;

+ 1607
- 0
node_modules/@types/node/ts4.8/http.d.ts
文件差異過大導致無法顯示
查看文件


+ 2134
- 0
node_modules/@types/node/ts4.8/http2.d.ts
文件差異過大導致無法顯示
查看文件


+ 541
- 0
node_modules/@types/node/ts4.8/https.d.ts 查看文件

@@ -0,0 +1,541 @@
1
+/**
2
+ * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
3
+ * separate module.
4
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/https.js)
5
+ */
6
+declare module 'https' {
7
+    import { Duplex } from 'node:stream';
8
+    import * as tls from 'node:tls';
9
+    import * as http from 'node:http';
10
+    import { URL } from 'node:url';
11
+    type ServerOptions<
12
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
13
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
14
+    > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions<Request, Response>;
15
+    type RequestOptions = http.RequestOptions &
16
+        tls.SecureContextOptions & {
17
+            rejectUnauthorized?: boolean | undefined; // Defaults to true
18
+            servername?: string | undefined; // SNI TLS Extension
19
+        };
20
+    interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
21
+        rejectUnauthorized?: boolean | undefined;
22
+        maxCachedSessions?: number | undefined;
23
+    }
24
+    /**
25
+     * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
26
+     * @since v0.4.5
27
+     */
28
+    class Agent extends http.Agent {
29
+        constructor(options?: AgentOptions);
30
+        options: AgentOptions;
31
+    }
32
+    interface Server<
33
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
34
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
35
+    > extends http.Server<Request, Response> {}
36
+    /**
37
+     * See `http.Server` for more information.
38
+     * @since v0.3.4
39
+     */
40
+    class Server<
41
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
42
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
43
+    > extends tls.Server {
44
+        constructor(requestListener?: http.RequestListener<Request, Response>);
45
+        constructor(
46
+            options: ServerOptions<Request, Response>,
47
+            requestListener?: http.RequestListener<Request, Response>,
48
+        );
49
+        /**
50
+         * Closes all connections connected to this server.
51
+         * @since v18.2.0
52
+         */
53
+        closeAllConnections(): void;
54
+        /**
55
+         * Closes all connections connected to this server which are not sending a request or waiting for a response.
56
+         * @since v18.2.0
57
+         */
58
+        closeIdleConnections(): void;
59
+        addListener(event: string, listener: (...args: any[]) => void): this;
60
+        addListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
61
+        addListener(
62
+            event: 'newSession',
63
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
64
+        ): this;
65
+        addListener(
66
+            event: 'OCSPRequest',
67
+            listener: (
68
+                certificate: Buffer,
69
+                issuer: Buffer,
70
+                callback: (err: Error | null, resp: Buffer) => void,
71
+            ) => void,
72
+        ): this;
73
+        addListener(
74
+            event: 'resumeSession',
75
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
76
+        ): this;
77
+        addListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
78
+        addListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
79
+        addListener(event: 'close', listener: () => void): this;
80
+        addListener(event: 'connection', listener: (socket: Duplex) => void): this;
81
+        addListener(event: 'error', listener: (err: Error) => void): this;
82
+        addListener(event: 'listening', listener: () => void): this;
83
+        addListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
84
+        addListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
85
+        addListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
86
+        addListener(
87
+            event: 'connect',
88
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
89
+        ): this;
90
+        addListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
91
+        addListener(
92
+            event: 'upgrade',
93
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
94
+        ): this;
95
+        emit(event: string, ...args: any[]): boolean;
96
+        emit(event: 'keylog', line: Buffer, tlsSocket: tls.TLSSocket): boolean;
97
+        emit(
98
+            event: 'newSession',
99
+            sessionId: Buffer,
100
+            sessionData: Buffer,
101
+            callback: (err: Error, resp: Buffer) => void,
102
+        ): boolean;
103
+        emit(
104
+            event: 'OCSPRequest',
105
+            certificate: Buffer,
106
+            issuer: Buffer,
107
+            callback: (err: Error | null, resp: Buffer) => void,
108
+        ): boolean;
109
+        emit(event: 'resumeSession', sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean;
110
+        emit(event: 'secureConnection', tlsSocket: tls.TLSSocket): boolean;
111
+        emit(event: 'tlsClientError', err: Error, tlsSocket: tls.TLSSocket): boolean;
112
+        emit(event: 'close'): boolean;
113
+        emit(event: 'connection', socket: Duplex): boolean;
114
+        emit(event: 'error', err: Error): boolean;
115
+        emit(event: 'listening'): boolean;
116
+        emit(
117
+            event: 'checkContinue',
118
+            req: InstanceType<Request>,
119
+            res: InstanceType<Response> & { req: InstanceType<Request> },
120
+        ): boolean;
121
+        emit(
122
+            event: 'checkExpectation',
123
+            req: InstanceType<Request>,
124
+            res: InstanceType<Response> & { req: InstanceType<Request> },
125
+        ): boolean;
126
+        emit(event: 'clientError', err: Error, socket: Duplex): boolean;
127
+        emit(event: 'connect', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
128
+        emit(
129
+            event: 'request',
130
+            req: InstanceType<Request>,
131
+            res: InstanceType<Response> & { req: InstanceType<Request> },
132
+        ): boolean;
133
+        emit(event: 'upgrade', req: InstanceType<Request>, socket: Duplex, head: Buffer): boolean;
134
+        on(event: string, listener: (...args: any[]) => void): this;
135
+        on(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
136
+        on(
137
+            event: 'newSession',
138
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
139
+        ): this;
140
+        on(
141
+            event: 'OCSPRequest',
142
+            listener: (
143
+                certificate: Buffer,
144
+                issuer: Buffer,
145
+                callback: (err: Error | null, resp: Buffer) => void,
146
+            ) => void,
147
+        ): this;
148
+        on(
149
+            event: 'resumeSession',
150
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
151
+        ): this;
152
+        on(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
153
+        on(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
154
+        on(event: 'close', listener: () => void): this;
155
+        on(event: 'connection', listener: (socket: Duplex) => void): this;
156
+        on(event: 'error', listener: (err: Error) => void): this;
157
+        on(event: 'listening', listener: () => void): this;
158
+        on(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
159
+        on(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
160
+        on(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
161
+        on(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
162
+        on(event: 'request', listener: http.RequestListener<Request, Response>): this;
163
+        on(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
164
+        once(event: string, listener: (...args: any[]) => void): this;
165
+        once(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
166
+        once(
167
+            event: 'newSession',
168
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
169
+        ): this;
170
+        once(
171
+            event: 'OCSPRequest',
172
+            listener: (
173
+                certificate: Buffer,
174
+                issuer: Buffer,
175
+                callback: (err: Error | null, resp: Buffer) => void,
176
+            ) => void,
177
+        ): this;
178
+        once(
179
+            event: 'resumeSession',
180
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
181
+        ): this;
182
+        once(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
183
+        once(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
184
+        once(event: 'close', listener: () => void): this;
185
+        once(event: 'connection', listener: (socket: Duplex) => void): this;
186
+        once(event: 'error', listener: (err: Error) => void): this;
187
+        once(event: 'listening', listener: () => void): this;
188
+        once(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
189
+        once(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
190
+        once(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
191
+        once(event: 'connect', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
192
+        once(event: 'request', listener: http.RequestListener<Request, Response>): this;
193
+        once(event: 'upgrade', listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void): this;
194
+        prependListener(event: string, listener: (...args: any[]) => void): this;
195
+        prependListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
196
+        prependListener(
197
+            event: 'newSession',
198
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
199
+        ): this;
200
+        prependListener(
201
+            event: 'OCSPRequest',
202
+            listener: (
203
+                certificate: Buffer,
204
+                issuer: Buffer,
205
+                callback: (err: Error | null, resp: Buffer) => void,
206
+            ) => void,
207
+        ): this;
208
+        prependListener(
209
+            event: 'resumeSession',
210
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
211
+        ): this;
212
+        prependListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
213
+        prependListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
214
+        prependListener(event: 'close', listener: () => void): this;
215
+        prependListener(event: 'connection', listener: (socket: Duplex) => void): this;
216
+        prependListener(event: 'error', listener: (err: Error) => void): this;
217
+        prependListener(event: 'listening', listener: () => void): this;
218
+        prependListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
219
+        prependListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
220
+        prependListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
221
+        prependListener(
222
+            event: 'connect',
223
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
224
+        ): this;
225
+        prependListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
226
+        prependListener(
227
+            event: 'upgrade',
228
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
229
+        ): this;
230
+        prependOnceListener(event: string, listener: (...args: any[]) => void): this;
231
+        prependOnceListener(event: 'keylog', listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this;
232
+        prependOnceListener(
233
+            event: 'newSession',
234
+            listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void,
235
+        ): this;
236
+        prependOnceListener(
237
+            event: 'OCSPRequest',
238
+            listener: (
239
+                certificate: Buffer,
240
+                issuer: Buffer,
241
+                callback: (err: Error | null, resp: Buffer) => void,
242
+            ) => void,
243
+        ): this;
244
+        prependOnceListener(
245
+            event: 'resumeSession',
246
+            listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void,
247
+        ): this;
248
+        prependOnceListener(event: 'secureConnection', listener: (tlsSocket: tls.TLSSocket) => void): this;
249
+        prependOnceListener(event: 'tlsClientError', listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
250
+        prependOnceListener(event: 'close', listener: () => void): this;
251
+        prependOnceListener(event: 'connection', listener: (socket: Duplex) => void): this;
252
+        prependOnceListener(event: 'error', listener: (err: Error) => void): this;
253
+        prependOnceListener(event: 'listening', listener: () => void): this;
254
+        prependOnceListener(event: 'checkContinue', listener: http.RequestListener<Request, Response>): this;
255
+        prependOnceListener(event: 'checkExpectation', listener: http.RequestListener<Request, Response>): this;
256
+        prependOnceListener(event: 'clientError', listener: (err: Error, socket: Duplex) => void): this;
257
+        prependOnceListener(
258
+            event: 'connect',
259
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
260
+        ): this;
261
+        prependOnceListener(event: 'request', listener: http.RequestListener<Request, Response>): this;
262
+        prependOnceListener(
263
+            event: 'upgrade',
264
+            listener: (req: InstanceType<Request>, socket: Duplex, head: Buffer) => void,
265
+        ): this;
266
+    }
267
+    /**
268
+     * ```js
269
+     * // curl -k https://localhost:8000/
270
+     * const https = require('https');
271
+     * const fs = require('fs');
272
+     *
273
+     * const options = {
274
+     *   key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
275
+     *   cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
276
+     * };
277
+     *
278
+     * https.createServer(options, (req, res) => {
279
+     *   res.writeHead(200);
280
+     *   res.end('hello world\n');
281
+     * }).listen(8000);
282
+     * ```
283
+     *
284
+     * Or
285
+     *
286
+     * ```js
287
+     * const https = require('https');
288
+     * const fs = require('fs');
289
+     *
290
+     * const options = {
291
+     *   pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
292
+     *   passphrase: 'sample'
293
+     * };
294
+     *
295
+     * https.createServer(options, (req, res) => {
296
+     *   res.writeHead(200);
297
+     *   res.end('hello world\n');
298
+     * }).listen(8000);
299
+     * ```
300
+     * @since v0.3.4
301
+     * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`.
302
+     * @param requestListener A listener to be added to the `'request'` event.
303
+     */
304
+    function createServer<
305
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
306
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
307
+    >(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
308
+    function createServer<
309
+        Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
310
+        Response extends typeof http.ServerResponse = typeof http.ServerResponse,
311
+    >(
312
+        options: ServerOptions<Request, Response>,
313
+        requestListener?: http.RequestListener<Request, Response>,
314
+    ): Server<Request, Response>;
315
+    /**
316
+     * Makes a request to a secure web server.
317
+     *
318
+     * The following additional `options` from `tls.connect()` are also accepted:`ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`,`honorCipherOrder`, `key`, `passphrase`,
319
+     * `pfx`, `rejectUnauthorized`,`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`,`highWaterMark`.
320
+     *
321
+     * `options` can be an object, a string, or a `URL` object. If `options` is a
322
+     * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
323
+     *
324
+     * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to
325
+     * upload a file with a POST request, then write to the `ClientRequest` object.
326
+     *
327
+     * ```js
328
+     * const https = require('https');
329
+     *
330
+     * const options = {
331
+     *   hostname: 'encrypted.google.com',
332
+     *   port: 443,
333
+     *   path: '/',
334
+     *   method: 'GET'
335
+     * };
336
+     *
337
+     * const req = https.request(options, (res) => {
338
+     *   console.log('statusCode:', res.statusCode);
339
+     *   console.log('headers:', res.headers);
340
+     *
341
+     *   res.on('data', (d) => {
342
+     *     process.stdout.write(d);
343
+     *   });
344
+     * });
345
+     *
346
+     * req.on('error', (e) => {
347
+     *   console.error(e);
348
+     * });
349
+     * req.end();
350
+     * ```
351
+     *
352
+     * Example using options from `tls.connect()`:
353
+     *
354
+     * ```js
355
+     * const options = {
356
+     *   hostname: 'encrypted.google.com',
357
+     *   port: 443,
358
+     *   path: '/',
359
+     *   method: 'GET',
360
+     *   key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
361
+     *   cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
362
+     * };
363
+     * options.agent = new https.Agent(options);
364
+     *
365
+     * const req = https.request(options, (res) => {
366
+     *   // ...
367
+     * });
368
+     * ```
369
+     *
370
+     * Alternatively, opt out of connection pooling by not using an `Agent`.
371
+     *
372
+     * ```js
373
+     * const options = {
374
+     *   hostname: 'encrypted.google.com',
375
+     *   port: 443,
376
+     *   path: '/',
377
+     *   method: 'GET',
378
+     *   key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
379
+     *   cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
380
+     *   agent: false
381
+     * };
382
+     *
383
+     * const req = https.request(options, (res) => {
384
+     *   // ...
385
+     * });
386
+     * ```
387
+     *
388
+     * Example using a `URL` as `options`:
389
+     *
390
+     * ```js
391
+     * const options = new URL('https://abc:xyz@example.com');
392
+     *
393
+     * const req = https.request(options, (res) => {
394
+     *   // ...
395
+     * });
396
+     * ```
397
+     *
398
+     * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
399
+     *
400
+     * ```js
401
+     * const tls = require('tls');
402
+     * const https = require('https');
403
+     * const crypto = require('crypto');
404
+     *
405
+     * function sha256(s) {
406
+     *   return crypto.createHash('sha256').update(s).digest('base64');
407
+     * }
408
+     * const options = {
409
+     *   hostname: 'github.com',
410
+     *   port: 443,
411
+     *   path: '/',
412
+     *   method: 'GET',
413
+     *   checkServerIdentity: function(host, cert) {
414
+     *     // Make sure the certificate is issued to the host we are connected to
415
+     *     const err = tls.checkServerIdentity(host, cert);
416
+     *     if (err) {
417
+     *       return err;
418
+     *     }
419
+     *
420
+     *     // Pin the public key, similar to HPKP pin-sha25 pinning
421
+     *     const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
422
+     *     if (sha256(cert.pubkey) !== pubkey256) {
423
+     *       const msg = 'Certificate verification error: ' +
424
+     *         `The public key of '${cert.subject.CN}' ` +
425
+     *         'does not match our pinned fingerprint';
426
+     *       return new Error(msg);
427
+     *     }
428
+     *
429
+     *     // Pin the exact certificate, rather than the pub key
430
+     *     const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' +
431
+     *       'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16';
432
+     *     if (cert.fingerprint256 !== cert256) {
433
+     *       const msg = 'Certificate verification error: ' +
434
+     *         `The certificate of '${cert.subject.CN}' ` +
435
+     *         'does not match our pinned fingerprint';
436
+     *       return new Error(msg);
437
+     *     }
438
+     *
439
+     *     // This loop is informational only.
440
+     *     // Print the certificate and public key fingerprints of all certs in the
441
+     *     // chain. Its common to pin the public key of the issuer on the public
442
+     *     // internet, while pinning the public key of the service in sensitive
443
+     *     // environments.
444
+     *     do {
445
+     *       console.log('Subject Common Name:', cert.subject.CN);
446
+     *       console.log('  Certificate SHA256 fingerprint:', cert.fingerprint256);
447
+     *
448
+     *       hash = crypto.createHash('sha256');
449
+     *       console.log('  Public key ping-sha256:', sha256(cert.pubkey));
450
+     *
451
+     *       lastprint256 = cert.fingerprint256;
452
+     *       cert = cert.issuerCertificate;
453
+     *     } while (cert.fingerprint256 !== lastprint256);
454
+     *
455
+     *   },
456
+     * };
457
+     *
458
+     * options.agent = new https.Agent(options);
459
+     * const req = https.request(options, (res) => {
460
+     *   console.log('All OK. Server matched our pinned cert or public key');
461
+     *   console.log('statusCode:', res.statusCode);
462
+     *   // Print the HPKP values
463
+     *   console.log('headers:', res.headers['public-key-pins']);
464
+     *
465
+     *   res.on('data', (d) => {});
466
+     * });
467
+     *
468
+     * req.on('error', (e) => {
469
+     *   console.error(e.message);
470
+     * });
471
+     * req.end();
472
+     * ```
473
+     *
474
+     * Outputs for example:
475
+     *
476
+     * ```text
477
+     * Subject Common Name: github.com
478
+     *   Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16
479
+     *   Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=
480
+     * Subject Common Name: DigiCert SHA2 Extended Validation Server CA
481
+     *   Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A
482
+     *   Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=
483
+     * Subject Common Name: DigiCert High Assurance EV Root CA
484
+     *   Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF
485
+     *   Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18=
486
+     * All OK. Server matched our pinned cert or public key
487
+     * statusCode: 200
488
+     * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=";
489
+     * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4=";
490
+     * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains
491
+     * ```
492
+     * @since v0.3.6
493
+     * @param options Accepts all `options` from `request`, with some differences in default values:
494
+     */
495
+    function request(
496
+        options: RequestOptions | string | URL,
497
+        callback?: (res: http.IncomingMessage) => void,
498
+    ): http.ClientRequest;
499
+    function request(
500
+        url: string | URL,
501
+        options: RequestOptions,
502
+        callback?: (res: http.IncomingMessage) => void,
503
+    ): http.ClientRequest;
504
+    /**
505
+     * Like `http.get()` but for HTTPS.
506
+     *
507
+     * `options` can be an object, a string, or a `URL` object. If `options` is a
508
+     * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
509
+     *
510
+     * ```js
511
+     * const https = require('https');
512
+     *
513
+     * https.get('https://encrypted.google.com/', (res) => {
514
+     *   console.log('statusCode:', res.statusCode);
515
+     *   console.log('headers:', res.headers);
516
+     *
517
+     *   res.on('data', (d) => {
518
+     *     process.stdout.write(d);
519
+     *   });
520
+     *
521
+     * }).on('error', (e) => {
522
+     *   console.error(e);
523
+     * });
524
+     * ```
525
+     * @since v0.3.6
526
+     * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`.
527
+     */
528
+    function get(
529
+        options: RequestOptions | string | URL,
530
+        callback?: (res: http.IncomingMessage) => void,
531
+    ): http.ClientRequest;
532
+    function get(
533
+        url: string | URL,
534
+        options: RequestOptions,
535
+        callback?: (res: http.IncomingMessage) => void,
536
+    ): http.ClientRequest;
537
+    let globalAgent: Agent;
538
+}
539
+declare module 'node:https' {
540
+    export * from 'https';
541
+}

+ 0
- 0
node_modules/@types/node/ts4.8/index.d.ts 查看文件


部分文件因文件數量過多而無法顯示

Loading…
取消
儲存