@scriptc/compiler 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +409 -42
  2. package/dist/backend/llvm/array-search.js +1 -1
  3. package/dist/backend/llvm/array-search.js.map +1 -1
  4. package/dist/backend/llvm/call-lifetimes.d.ts +6 -0
  5. package/dist/backend/llvm/call-lifetimes.js +19 -0
  6. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  7. package/dist/backend/llvm/constant-callbacks.d.ts +2 -21
  8. package/dist/backend/llvm/constant-callbacks.js +36 -219
  9. package/dist/backend/llvm/constant-callbacks.js.map +1 -1
  10. package/dist/backend/llvm/constant-callbacks.test.js +22 -0
  11. package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
  12. package/dist/backend/llvm/dense-array-access.d.ts +9 -0
  13. package/dist/backend/llvm/dense-array-access.js +27 -1
  14. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  15. package/dist/backend/llvm/dyn.d.ts +6 -0
  16. package/dist/backend/llvm/dyn.js +71 -7
  17. package/dist/backend/llvm/dyn.js.map +1 -1
  18. package/dist/backend/llvm/emitter.d.ts +120 -2
  19. package/dist/backend/llvm/emitter.js +820 -142
  20. package/dist/backend/llvm/emitter.js.map +1 -1
  21. package/dist/backend/llvm/expr-async.js +17 -7
  22. package/dist/backend/llvm/expr-async.js.map +1 -1
  23. package/dist/backend/llvm/expr-bytes.js +1 -1
  24. package/dist/backend/llvm/expr-callbacks.d.ts +11 -0
  25. package/dist/backend/llvm/expr-callbacks.js +53 -0
  26. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  27. package/dist/backend/llvm/expr-calls.js +88 -2
  28. package/dist/backend/llvm/expr-calls.js.map +1 -1
  29. package/dist/backend/llvm/expr-containers.js +50 -27
  30. package/dist/backend/llvm/expr-containers.js.map +1 -1
  31. package/dist/backend/llvm/expr-dispatch.js +1 -0
  32. package/dist/backend/llvm/expr-dispatch.js.map +1 -1
  33. package/dist/backend/llvm/expr-dynamic.js +25 -1
  34. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  35. package/dist/backend/llvm/expr-primitives.d.ts +1 -1
  36. package/dist/backend/llvm/expr-primitives.js +20 -1
  37. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  38. package/dist/backend/llvm/expr-stream-bridges.js +4 -0
  39. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  40. package/dist/backend/llvm/integer-clones.d.ts +103 -0
  41. package/dist/backend/llvm/integer-clones.js +1336 -0
  42. package/dist/backend/llvm/integer-clones.js.map +1 -0
  43. package/dist/backend/llvm/integer-clones.test.d.ts +1 -0
  44. package/dist/backend/llvm/integer-clones.test.js +219 -0
  45. package/dist/backend/llvm/integer-clones.test.js.map +1 -0
  46. package/dist/backend/llvm/lib-datagram.js +14 -0
  47. package/dist/backend/llvm/lib-datagram.js.map +1 -1
  48. package/dist/backend/llvm/lib-dispatch.js +32 -1
  49. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  50. package/dist/backend/llvm/lib-filesystem.js +61 -1
  51. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  52. package/dist/backend/llvm/lib-network.js +21 -3
  53. package/dist/backend/llvm/lib-network.js.map +1 -1
  54. package/dist/backend/llvm/lib-process.js +34 -0
  55. package/dist/backend/llvm/lib-process.js.map +1 -1
  56. package/dist/backend/llvm/lib-shared.js +77 -2
  57. package/dist/backend/llvm/lib-shared.js.map +1 -1
  58. package/dist/backend/llvm/lib-test.js +16 -3
  59. package/dist/backend/llvm/lib-test.js.map +1 -1
  60. package/dist/backend/llvm/lib-tls.js +6 -0
  61. package/dist/backend/llvm/lib-tls.js.map +1 -1
  62. package/dist/backend/llvm/local-array-reads.js +1 -1
  63. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  64. package/dist/backend/llvm/map-entry-fusion.d.ts +28 -0
  65. package/dist/backend/llvm/map-entry-fusion.js +233 -0
  66. package/dist/backend/llvm/map-entry-fusion.js.map +1 -0
  67. package/dist/backend/llvm/map-entry-fusion.test.d.ts +1 -0
  68. package/dist/backend/llvm/map-entry-fusion.test.js +183 -0
  69. package/dist/backend/llvm/map-entry-fusion.test.js.map +1 -0
  70. package/dist/backend/llvm/map-number-lookup.d.ts +2 -0
  71. package/dist/backend/llvm/map-number-lookup.js +1 -1
  72. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  73. package/dist/backend/llvm/map-number-lookup.test.js +10 -11
  74. package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
  75. package/dist/backend/llvm/map-read-lifetimes.d.ts +2 -0
  76. package/dist/backend/llvm/map-read-lifetimes.js +3 -0
  77. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  78. package/dist/backend/llvm/map-read-lifetimes.test.js +2 -2
  79. package/dist/backend/llvm/nullable-unions.d.ts +6 -3
  80. package/dist/backend/llvm/nullable-unions.js +2 -0
  81. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  82. package/dist/backend/llvm/publish.d.ts +16 -0
  83. package/dist/backend/llvm/publish.js +81 -10
  84. package/dist/backend/llvm/publish.js.map +1 -1
  85. package/dist/backend/llvm/publish.test.d.ts +1 -0
  86. package/dist/backend/llvm/publish.test.js +94 -0
  87. package/dist/backend/llvm/publish.test.js.map +1 -0
  88. package/dist/backend/llvm/record-results.d.ts +1 -1
  89. package/dist/backend/llvm/record-results.js +78 -4
  90. package/dist/backend/llvm/record-results.js.map +1 -1
  91. package/dist/backend/llvm/record-sources.d.ts +7 -0
  92. package/dist/backend/llvm/record-sources.js +14 -0
  93. package/dist/backend/llvm/record-sources.js.map +1 -0
  94. package/dist/backend/llvm/reference-writes.js +1 -0
  95. package/dist/backend/llvm/reference-writes.js.map +1 -1
  96. package/dist/backend/llvm/shapes.d.ts +12 -3
  97. package/dist/backend/llvm/shapes.js +23 -14
  98. package/dist/backend/llvm/shapes.js.map +1 -1
  99. package/dist/backend/llvm/shapes.test.js +5 -3
  100. package/dist/backend/llvm/shapes.test.js.map +1 -1
  101. package/dist/backend/llvm/speculative-integers.d.ts +74 -0
  102. package/dist/backend/llvm/speculative-integers.js +571 -0
  103. package/dist/backend/llvm/speculative-integers.js.map +1 -0
  104. package/dist/backend/llvm/speculative-integers.test.d.ts +1 -0
  105. package/dist/backend/llvm/speculative-integers.test.js +148 -0
  106. package/dist/backend/llvm/speculative-integers.test.js.map +1 -0
  107. package/dist/backend/llvm/string-lifetimes.test.js +75 -1
  108. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  109. package/dist/backend/llvm/walkers.d.ts +17 -0
  110. package/dist/backend/llvm/walkers.js +123 -0
  111. package/dist/backend/llvm/walkers.js.map +1 -1
  112. package/dist/backend/may-throw.js +2 -0
  113. package/dist/backend/may-throw.js.map +1 -1
  114. package/dist/backend/native/contracts.d.ts +2 -1
  115. package/dist/backend/native/executable.js +6 -1
  116. package/dist/backend/native/executable.js.map +1 -1
  117. package/dist/backend/native/runtime-inputs.d.ts +1 -1
  118. package/dist/backend/native/runtime-inputs.js +1 -0
  119. package/dist/backend/native/runtime-inputs.js.map +1 -1
  120. package/dist/backend/runtime-abi.d.ts +2 -2
  121. package/dist/backend/runtime-abi.js +2 -2
  122. package/dist/backend/runtime-pack-targets.test.js +1 -1
  123. package/dist/backend/runtime-pack.d.ts +7 -3
  124. package/dist/backend/runtime-pack.js +12 -6
  125. package/dist/backend/runtime-pack.js.map +1 -1
  126. package/dist/backend/runtime-pack.test.js +16 -7
  127. package/dist/backend/runtime-pack.test.js.map +1 -1
  128. package/dist/contracts/check.js +1 -0
  129. package/dist/contracts/check.js.map +1 -1
  130. package/dist/coverage/surface-manifest.js +3 -3
  131. package/dist/coverage/surface-manifest.js.map +1 -1
  132. package/dist/diagnostics/diagnostic.d.ts +1 -1
  133. package/dist/diagnostics/diagnostic.js +6 -2
  134. package/dist/diagnostics/diagnostic.js.map +1 -1
  135. package/dist/frontend/lowering/builtin-calls.js +13 -0
  136. package/dist/frontend/lowering/builtin-calls.js.map +1 -1
  137. package/dist/frontend/lowering/builtins/callable-aliases.js +82 -8
  138. package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
  139. package/dist/frontend/lowering/builtins/child-process-async.d.ts +8 -6
  140. package/dist/frontend/lowering/builtins/child-process-async.js +45 -29
  141. package/dist/frontend/lowering/builtins/child-process-async.js.map +1 -1
  142. package/dist/frontend/lowering/builtins/compression.d.ts +9 -0
  143. package/dist/frontend/lowering/builtins/compression.js +145 -30
  144. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  145. package/dist/frontend/lowering/builtins/crypto.js +12 -1
  146. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  147. package/dist/frontend/lowering/builtins/errors.js +5 -3
  148. package/dist/frontend/lowering/builtins/errors.js.map +1 -1
  149. package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +6 -0
  150. package/dist/frontend/lowering/builtins/filesystem-calls.js +16 -0
  151. package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
  152. package/dist/frontend/lowering/builtins/filesystem.d.ts +8 -0
  153. package/dist/frontend/lowering/builtins/filesystem.js +199 -2
  154. package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
  155. package/dist/frontend/lowering/builtins/fs-streams.d.ts +26 -0
  156. package/dist/frontend/lowering/builtins/fs-streams.js +131 -0
  157. package/dist/frontend/lowering/builtins/fs-streams.js.map +1 -0
  158. package/dist/frontend/lowering/builtins/hash-stream.d.ts +12 -0
  159. package/dist/frontend/lowering/builtins/hash-stream.js +80 -0
  160. package/dist/frontend/lowering/builtins/hash-stream.js.map +1 -0
  161. package/dist/frontend/lowering/builtins/module-calls.js +17 -3
  162. package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
  163. package/dist/frontend/lowering/builtins/process.js +9 -2
  164. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  165. package/dist/frontend/lowering/builtins/readline.d.ts +45 -13
  166. package/dist/frontend/lowering/builtins/readline.js +812 -47
  167. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  168. package/dist/frontend/lowering/builtins/workers.d.ts +4 -0
  169. package/dist/frontend/lowering/builtins/workers.js +58 -0
  170. package/dist/frontend/lowering/builtins/workers.js.map +1 -1
  171. package/dist/frontend/lowering/class-dynamic-dispatch.js +150 -8
  172. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  173. package/dist/frontend/lowering/class-protocols.d.ts +55 -0
  174. package/dist/frontend/lowering/class-protocols.js +735 -0
  175. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  176. package/dist/frontend/lowering/containers/array-from-async.d.ts +18 -0
  177. package/dist/frontend/lowering/containers/array-from-async.js +282 -0
  178. package/dist/frontend/lowering/containers/array-from-async.js.map +1 -0
  179. package/dist/frontend/lowering/containers/bytes.js +33 -12
  180. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  181. package/dist/frontend/lowering/containers/collection-grouping.js +2 -1
  182. package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
  183. package/dist/frontend/lowering/containers/collection-methods.js +27 -23
  184. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  185. package/dist/frontend/lowering/devirtualize.js +20 -7
  186. package/dist/frontend/lowering/devirtualize.js.map +1 -1
  187. package/dist/frontend/lowering/divergences.js +188 -15
  188. package/dist/frontend/lowering/divergences.js.map +1 -1
  189. package/dist/frontend/lowering/lower-calls.js +129 -25
  190. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  191. package/dist/frontend/lowering/lower-classes.js +46 -1
  192. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  193. package/dist/frontend/lowering/lower-dgram.js +55 -15
  194. package/dist/frontend/lowering/lower-dgram.js.map +1 -1
  195. package/dist/frontend/lowering/lower-event-emitter.d.ts +9 -1
  196. package/dist/frontend/lowering/lower-event-emitter.js +88 -1
  197. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  198. package/dist/frontend/lowering/lower-exprs.d.ts +4 -0
  199. package/dist/frontend/lowering/lower-exprs.js +239 -71
  200. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  201. package/dist/frontend/lowering/lower-inspect.js +49 -3
  202. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  203. package/dist/frontend/lowering/lower-mock.d.ts +11 -1
  204. package/dist/frontend/lowering/lower-mock.js +377 -61
  205. package/dist/frontend/lowering/lower-mock.js.map +1 -1
  206. package/dist/frontend/lowering/lower-modules.js +1 -0
  207. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  208. package/dist/frontend/lowering/lower-server.d.ts +2 -1
  209. package/dist/frontend/lowering/lower-server.js +234 -21
  210. package/dist/frontend/lowering/lower-server.js.map +1 -1
  211. package/dist/frontend/lowering/lower-stmts.js +60 -13
  212. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  213. package/dist/frontend/lowering/lower-stream.d.ts +1 -3
  214. package/dist/frontend/lowering/lower-stream.js +325 -20
  215. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  216. package/dist/frontend/lowering/lower-test.js +147 -48
  217. package/dist/frontend/lowering/lower-test.js.map +1 -1
  218. package/dist/frontend/lowering/lowerer.d.ts +13 -1
  219. package/dist/frontend/lowering/lowerer.js +10 -2
  220. package/dist/frontend/lowering/lowerer.js.map +1 -1
  221. package/dist/frontend/lowering/null-prototype.d.ts +13 -0
  222. package/dist/frontend/lowering/null-prototype.js +33 -0
  223. package/dist/frontend/lowering/null-prototype.js.map +1 -0
  224. package/dist/frontend/lowering/record-sources.d.ts +15 -0
  225. package/dist/frontend/lowering/record-sources.js +46 -0
  226. package/dist/frontend/lowering/record-sources.js.map +1 -0
  227. package/dist/frontend/lowering/surfaces.d.ts +3 -3
  228. package/dist/frontend/lowering/surfaces.js +59 -5
  229. package/dist/frontend/lowering/surfaces.js.map +1 -1
  230. package/dist/frontend/mock-shapes.d.ts +5 -0
  231. package/dist/frontend/mock-shapes.js +27 -2
  232. package/dist/frontend/mock-shapes.js.map +1 -1
  233. package/dist/frontend/program.js +5 -4
  234. package/dist/frontend/program.js.map +1 -1
  235. package/dist/frontend/type-mapper.d.ts +3 -0
  236. package/dist/frontend/type-mapper.js +148 -4
  237. package/dist/frontend/type-mapper.js.map +1 -1
  238. package/dist/index.js +18 -8
  239. package/dist/index.js.map +1 -1
  240. package/dist/ir/analysis.d.ts +10 -0
  241. package/dist/ir/analysis.js +35 -0
  242. package/dist/ir/analysis.js.map +1 -1
  243. package/dist/ir/analysis.test.js +69 -1
  244. package/dist/ir/analysis.test.js.map +1 -1
  245. package/dist/ir/builtin-effects.js +72 -0
  246. package/dist/ir/builtin-effects.js.map +1 -1
  247. package/dist/ir/builtin-signatures.d.ts +1 -1
  248. package/dist/ir/builtin-signatures.js +258 -13
  249. package/dist/ir/builtin-signatures.js.map +1 -1
  250. package/dist/ir/capture-values.d.ts +107 -0
  251. package/dist/ir/capture-values.js +850 -0
  252. package/dist/ir/capture-values.js.map +1 -0
  253. package/dist/ir/capture-values.test.d.ts +1 -0
  254. package/dist/ir/capture-values.test.js +268 -0
  255. package/dist/ir/capture-values.test.js.map +1 -0
  256. package/dist/ir/field-values.d.ts +16 -0
  257. package/dist/ir/field-values.js +128 -0
  258. package/dist/ir/field-values.js.map +1 -0
  259. package/dist/ir/field-values.test.d.ts +1 -0
  260. package/dist/ir/field-values.test.js +160 -0
  261. package/dist/ir/field-values.test.js.map +1 -0
  262. package/dist/ir/final-fields.d.ts +4 -1
  263. package/dist/ir/final-fields.js +11 -3
  264. package/dist/ir/final-fields.js.map +1 -1
  265. package/dist/ir/function-references.test.js +2 -1
  266. package/dist/ir/function-references.test.js.map +1 -1
  267. package/dist/ir/init-only-globals.d.ts +16 -0
  268. package/dist/ir/init-only-globals.js +121 -0
  269. package/dist/ir/init-only-globals.js.map +1 -0
  270. package/dist/ir/init-only-globals.test.d.ts +1 -0
  271. package/dist/ir/init-only-globals.test.js +115 -0
  272. package/dist/ir/init-only-globals.test.js.map +1 -0
  273. package/dist/ir/initializer-bindings.d.ts +18 -1
  274. package/dist/ir/initializer-bindings.js +91 -1
  275. package/dist/ir/initializer-bindings.js.map +1 -1
  276. package/dist/ir/initializer-bindings.test.js +57 -2
  277. package/dist/ir/initializer-bindings.test.js.map +1 -1
  278. package/dist/ir/int32-slots.d.ts +22 -0
  279. package/dist/ir/int32-slots.js +398 -13
  280. package/dist/ir/int32-slots.js.map +1 -1
  281. package/dist/ir/int32-slots.test.js +119 -8
  282. package/dist/ir/int32-slots.test.js.map +1 -1
  283. package/dist/ir/integer-loop-facts.d.ts +27 -1
  284. package/dist/ir/integer-loop-facts.js +239 -7
  285. package/dist/ir/integer-loop-facts.js.map +1 -1
  286. package/dist/ir/integer-ranges.d.ts +8 -5
  287. package/dist/ir/integer-ranges.js +147 -59
  288. package/dist/ir/integer-ranges.js.map +1 -1
  289. package/dist/ir/integer-ranges.test.js +285 -7
  290. package/dist/ir/integer-ranges.test.js.map +1 -1
  291. package/dist/ir/ir.d.ts +22 -1
  292. package/dist/ir/ir.js +4 -0
  293. package/dist/ir/ir.js.map +1 -1
  294. package/dist/ir/property-bags.d.ts +14 -0
  295. package/dist/ir/property-bags.js +121 -0
  296. package/dist/ir/property-bags.js.map +1 -0
  297. package/dist/ir/receiver-readers.d.ts +21 -0
  298. package/dist/ir/receiver-readers.js +217 -0
  299. package/dist/ir/receiver-readers.js.map +1 -0
  300. package/dist/ir/runtime-features.d.ts +3 -1
  301. package/dist/ir/runtime-features.js +102 -7
  302. package/dist/ir/runtime-features.js.map +1 -1
  303. package/dist/ir/runtime-features.test.js +62 -0
  304. package/dist/ir/runtime-features.test.js.map +1 -1
  305. package/dist/ir/traverse.js +4 -0
  306. package/dist/ir/traverse.js.map +1 -1
  307. package/dist/ir/validate.js +71 -3
  308. package/dist/ir/validate.js.map +1 -1
  309. package/dist/ir/validate.test.js +59 -0
  310. package/dist/ir/validate.test.js.map +1 -1
  311. package/dist/library/int-infer.js +3 -0
  312. package/dist/library/int-infer.js.map +1 -1
  313. package/dist/library/ir-policy.js +5 -0
  314. package/dist/library/ir-policy.js.map +1 -1
  315. package/package.json +20 -20
  316. package/surface-manifest.json +57 -19
@@ -299,7 +299,7 @@ declare var process: {
299
299
  stdout: import("tty").WriteStream;
300
300
  stderr: import("tty").WriteStream;
301
301
  /* The stdin stream, the piped-input slice: the TTY probe, the
302
- * data/end/error events (on and once — a 'data' listener keeps the
302
+ * data/end/error events and readline's 'keypress' (on and once — a 'data' listener keeps the
303
303
  * event loop alive until EOF, like Node's flowing stdin), destroy()
304
304
  * (full teardown: nothing fires after, the loop stops waiting), and
305
305
  * async iteration (`for await (const chunk of process.stdin)` — chunks
@@ -310,9 +310,18 @@ declare var process: {
310
310
  on(event: "data", listener: (chunk: Uint8Array) => void): void;
311
311
  on(event: "end", listener: () => void): void;
312
312
  on(event: "error", listener: (err: Error) => void): void;
313
+ /* readline.emitKeypressEvents(process.stdin)'s keys */
314
+ on(
315
+ event: "keypress",
316
+ listener: (str: string | undefined, key: import("readline").Key) => void,
317
+ ): void;
313
318
  once(event: "data", listener: (chunk: Uint8Array) => void): void;
314
319
  once(event: "end", listener: () => void): void;
315
320
  once(event: "error", listener: (err: Error) => void): void;
321
+ once(
322
+ event: "keypress",
323
+ listener: (str: string | undefined, key: import("readline").Key) => void,
324
+ ): void;
316
325
  destroy(): void;
317
326
  setEncoding(encoding: "utf8"): void;
318
327
  /* Termios raw mode on a TTY stdin (libuv's UV_TTY_MODE_RAW, the mode
@@ -635,9 +644,12 @@ interface BufferConstructor {
635
644
  from(data: Uint8Array | readonly number[]): Buffer;
636
645
  alloc(size: number, fill?: string | number | Uint8Array, encoding?: BufferEncoding): Buffer;
637
646
  compare(buf1: Uint8Array, buf2: Uint8Array): number;
638
- /* alloc without the zero-fill guarantee — the lowering zero-fills
639
- * anyway (never handing out uninitialized memory costs one memset). */
647
+ /* alloc without the zero-fill guarantee. Below Buffer.poolSize >>> 1
648
+ * bytes it returns a view into the shared pool slab. */
640
649
  allocUnsafe(size: number): Buffer;
650
+ allocUnsafeSlow(size: number): Buffer;
651
+ /* The pool slab size for allocUnsafe, from, and concat. */
652
+ poolSize: number;
641
653
  concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
642
654
  isBuffer(obj: unknown): obj is Buffer;
643
655
  byteLength(input: string | Uint8Array, encoding?: BufferEncoding): number;
@@ -1198,6 +1210,7 @@ interface ImportMeta {
1198
1210
  * directory, open 'x'"). `rmSync` removes FILES only (like Node without
1199
1211
  * `recursive`); empty directories go through `rmdirSync`. */
1200
1212
  declare module "node:fs" {
1213
+ import { Readable, Writable } from "stream";
1201
1214
  export function readFileSync(path: string | number, encoding: BufferEncoding): string;
1202
1215
  export function readFileSync(
1203
1216
  path: string | number,
@@ -1247,6 +1260,45 @@ declare module "node:fs" {
1247
1260
  path: string | Uint8Array | URL,
1248
1261
  type?: string | null,
1249
1262
  ): void;
1263
+ /* fs.cpSync / fs.cp: copies a file, symlink or (with recursive) a
1264
+ * directory tree. filter decides per path; the callback and promise
1265
+ * forms complete the copy before reporting. */
1266
+ export interface CopySyncOptions {
1267
+ dereference?: boolean;
1268
+ errorOnExist?: boolean;
1269
+ filter?: (source: string, destination: string) => boolean;
1270
+ force?: boolean;
1271
+ mode?: number;
1272
+ preserveTimestamps?: boolean;
1273
+ recursive?: boolean;
1274
+ verbatimSymlinks?: boolean;
1275
+ }
1276
+ export interface CopyOptions {
1277
+ dereference?: boolean;
1278
+ errorOnExist?: boolean;
1279
+ filter?: (source: string, destination: string) => boolean | Promise<boolean>;
1280
+ force?: boolean;
1281
+ mode?: number;
1282
+ preserveTimestamps?: boolean;
1283
+ recursive?: boolean;
1284
+ verbatimSymlinks?: boolean;
1285
+ }
1286
+ export function cpSync(
1287
+ source: string | URL,
1288
+ destination: string | URL,
1289
+ options?: CopySyncOptions,
1290
+ ): void;
1291
+ export function cp(
1292
+ source: string | URL,
1293
+ destination: string | URL,
1294
+ callback: (err: NodeJS.ErrnoException | null) => void,
1295
+ ): void;
1296
+ export function cp(
1297
+ source: string | URL,
1298
+ destination: string | URL,
1299
+ options: CopyOptions,
1300
+ callback: (err: NodeJS.ErrnoException | null) => void,
1301
+ ): void;
1250
1302
  export function symlink(
1251
1303
  target: string | Uint8Array | URL,
1252
1304
  path: string | Uint8Array | URL,
@@ -1380,6 +1432,47 @@ declare module "node:fs" {
1380
1432
  bufferSize?: number;
1381
1433
  }
1382
1434
  export function opendirSync(path: string, options?: OpenDirOptions): Dir;
1435
+ /* fs.ReadStream / fs.WriteStream: runtime Readable and Writable streams
1436
+ * over a file (scr_fs_stream.c). The options are checked at runtime
1437
+ * with Node's rules; flags and mode are checked when the file opens, so
1438
+ * their errors arrive as 'error' events. Instances also emit 'open'
1439
+ * (with the fd) and 'ready'. */
1440
+ export interface StreamOptions {
1441
+ flags?: string;
1442
+ encoding?: BufferEncoding;
1443
+ fd?: number;
1444
+ mode?: number | string;
1445
+ autoClose?: boolean;
1446
+ emitClose?: boolean;
1447
+ start?: number;
1448
+ highWaterMark?: number;
1449
+ }
1450
+ export interface ReadStreamOptions extends StreamOptions {
1451
+ end?: number;
1452
+ }
1453
+ export interface WriteStreamOptions extends StreamOptions {
1454
+ flush?: boolean;
1455
+ }
1456
+ export class ReadStream extends Readable {
1457
+ readonly bytesRead: number;
1458
+ readonly path: string | Buffer;
1459
+ readonly pending: boolean;
1460
+ close(callback?: () => void): void;
1461
+ }
1462
+ export class WriteStream extends Writable {
1463
+ readonly bytesWritten: number;
1464
+ readonly path: string | Buffer;
1465
+ readonly pending: boolean;
1466
+ close(callback?: () => void): void;
1467
+ }
1468
+ export function createReadStream(
1469
+ path: string | Buffer | URL,
1470
+ options?: BufferEncoding | ReadStreamOptions,
1471
+ ): ReadStream;
1472
+ export function createWriteStream(
1473
+ path: string | Buffer | URL,
1474
+ options?: BufferEncoding | WriteStreamOptions,
1475
+ ): WriteStream;
1383
1476
  export function accessSync(path: string, mode?: number): void;
1384
1477
  export function mkdtempSync(prefix: string): string;
1385
1478
  export const constants: {
@@ -1396,6 +1489,9 @@ declare module "node:fs" {
1396
1489
  readonly O_NONBLOCK: number;
1397
1490
  readonly O_TRUNC: number;
1398
1491
  readonly O_APPEND: number;
1492
+ readonly COPYFILE_EXCL: number;
1493
+ readonly COPYFILE_FICLONE: number;
1494
+ readonly COPYFILE_FICLONE_FORCE: number;
1399
1495
  };
1400
1496
  /* A stat(2) snapshot (statSync follows symlinks, lstatSync does not —
1401
1497
  * Node's split) — immutable; the supported surface is exactly these
@@ -1429,8 +1525,37 @@ declare module "node:fs" {
1429
1525
  readonly ctime: Date;
1430
1526
  readonly birthtime: Date;
1431
1527
  }
1432
- export function statSync(path: string): Stats;
1433
- export function lstatSync(path: string): Stats;
1528
+ /* throwIfNoEntry: false answers undefined for a missing entry (ENOENT or
1529
+ * ENOTDIR) instead of throwing. BigIntStats (bigint: true) has no
1530
+ * lowering. */
1531
+ export interface StatSyncOptions {
1532
+ bigint?: boolean;
1533
+ throwIfNoEntry?: boolean;
1534
+ }
1535
+ export function statSync(path: string, options?: undefined): Stats;
1536
+ export function statSync(
1537
+ path: string,
1538
+ options: StatSyncOptions & { bigint?: false; throwIfNoEntry: false },
1539
+ ): Stats | undefined;
1540
+ export function statSync(
1541
+ path: string,
1542
+ options: StatSyncOptions & { bigint?: false; throwIfNoEntry?: true },
1543
+ ): Stats;
1544
+ /* bigint: true type-checks so the lowering can name it as unsupported. */
1545
+ export function statSync(path: string, options: StatSyncOptions & { bigint: true }): Stats;
1546
+ export function statSync(path: string, options: StatSyncOptions): Stats | undefined;
1547
+ export function lstatSync(path: string, options?: undefined): Stats;
1548
+ export function lstatSync(
1549
+ path: string,
1550
+ options: StatSyncOptions & { bigint?: false; throwIfNoEntry: false },
1551
+ ): Stats | undefined;
1552
+ export function lstatSync(
1553
+ path: string,
1554
+ options: StatSyncOptions & { bigint?: false; throwIfNoEntry?: true },
1555
+ ): Stats;
1556
+ /* bigint: true type-checks so the lowering can name it as unsupported. */
1557
+ export function lstatSync(path: string, options: StatSyncOptions & { bigint: true }): Stats;
1558
+ export function lstatSync(path: string, options: StatSyncOptions): Stats | undefined;
1434
1559
  /* The fd pair behind spawn's fd-stdio form: openSync(path, flags) →
1435
1560
  * the raw fd. Numeric flags use an inline OR of the O_* constants. */
1436
1561
  export function openSync(path: string, flags: string): number;
@@ -1632,9 +1757,31 @@ declare module "fs/promises" {
1632
1757
  length?: number | null;
1633
1758
  position?: number | null;
1634
1759
  }
1760
+ /* The streams over a FileHandle (createReadStream, createWriteStream,
1761
+ * readLines): fs streams that hold the handle until they close; closing
1762
+ * the stream closes the handle unless autoClose is false. */
1763
+ export interface CreateReadStreamOptions {
1764
+ encoding?: BufferEncoding | null;
1765
+ autoClose?: boolean;
1766
+ emitClose?: boolean;
1767
+ start?: number;
1768
+ end?: number;
1769
+ highWaterMark?: number;
1770
+ }
1771
+ export interface CreateWriteStreamOptions {
1772
+ encoding?: BufferEncoding | null;
1773
+ autoClose?: boolean;
1774
+ emitClose?: boolean;
1775
+ start?: number;
1776
+ highWaterMark?: number;
1777
+ flush?: boolean;
1778
+ }
1635
1779
  export interface FileHandle extends AsyncDisposable {
1636
1780
  readonly fd: number;
1637
1781
  close(): Promise<void>;
1782
+ createReadStream(options?: CreateReadStreamOptions): import("node:fs").ReadStream;
1783
+ createWriteStream(options?: CreateWriteStreamOptions): import("node:fs").WriteStream;
1784
+ readLines(options?: CreateReadStreamOptions): import("node:readline").Interface;
1638
1785
  sync(): Promise<void>;
1639
1786
  datasync(): Promise<void>;
1640
1787
  truncate(len?: number): Promise<void>;
@@ -1693,6 +1840,11 @@ declare module "fs/promises" {
1693
1840
  path: string | Uint8Array | URL,
1694
1841
  type?: string | null,
1695
1842
  ): Promise<void>;
1843
+ export function cp(
1844
+ source: string | URL,
1845
+ destination: string | URL,
1846
+ options?: import("node:fs").CopyOptions,
1847
+ ): Promise<void>;
1696
1848
  export function readlink(
1697
1849
  path: string | Uint8Array | URL,
1698
1850
  options: "buffer" | { encoding: "buffer" },
@@ -2309,6 +2461,7 @@ declare module "node:url" {
2309
2461
 
2310
2462
  /* node:crypto: the static hashing/MAC/random/key-derivation utility slice. */
2311
2463
  declare module "crypto" {
2464
+ import { Transform } from "stream";
2312
2465
  export type KeyObjectType = "secret" | "public" | "private";
2313
2466
  export interface JsonWebKey {
2314
2467
  kty?: string;
@@ -2351,14 +2504,16 @@ declare module "crypto" {
2351
2504
  export interface HashOptions {
2352
2505
  outputLength?: number | undefined;
2353
2506
  }
2354
- export interface Hash {
2507
+ /* Hash and Hmac are Transforms: written chunks update the digest, which
2508
+ * the readable side delivers once the writable side ends. */
2509
+ export interface Hash extends Transform {
2355
2510
  copy(options?: HashOptions): Hash;
2356
2511
  update(data: string | ArrayBufferView): Hash;
2357
2512
  update(data: string, inputEncoding: Encoding): Hash;
2358
2513
  digest(): Buffer;
2359
2514
  digest(encoding: BinaryToTextEncoding): string;
2360
2515
  }
2361
- export interface Hmac {
2516
+ export interface Hmac extends Transform {
2362
2517
  update(data: string | ArrayBufferView): Hmac;
2363
2518
  update(data: string, inputEncoding: Encoding): Hmac;
2364
2519
  digest(): Buffer;
@@ -2877,7 +3032,8 @@ declare module "child_process" {
2877
3032
  ): unknown;
2878
3033
  /* The async shell form — declared surface without full lowering (the
2879
3034
  * type-level tolerance story): harness code on paths tests don't reach
2880
- * must typecheck; a reached call fences at its site. */
3035
+ * must typecheck; a reached call fences at its site. util.promisify
3036
+ * recognizes it statically, as it does execFile. */
2881
3037
  export function exec(
2882
3038
  command: string,
2883
3039
  options?: ExecSyncOptions | ((error: Error | null, stdout: string, stderr: string) => void),
@@ -2888,9 +3044,10 @@ declare module "node:child_process" {
2888
3044
  export * from "child_process";
2889
3045
  }
2890
3046
 
2891
- /* node:util — compile-time projections for child_process.execFile and
2892
- * fs.readFile. The former retains Node's custom { stdout, stderr } result;
2893
- * the latter resolves the callback's data argument. Other targets and bare
3047
+ /* node:util — compile-time projections for child_process.execFile,
3048
+ * child_process.exec and fs.readFile. The first two retain Node's custom
3049
+ * { stdout, stderr } result; the last resolves the callback's data
3050
+ * argument. Other targets and bare
2894
3051
  * promisify values fence per site. */
2895
3052
  declare module "util" {
2896
3053
  export * as types from "util/types";
@@ -2964,6 +3121,12 @@ declare module "util" {
2964
3121
  export type TextDecoder = globalThis.TextDecoder;
2965
3122
  export var TextEncoder: typeof globalThis.TextEncoder;
2966
3123
  export var TextDecoder: typeof globalThis.TextDecoder;
3124
+ /* stream.pipeline's (...streams: unknown[]) => unknown is assignable to
3125
+ * every other target's parameter type, so its overload comes first; no
3126
+ * other target is assignable to it. */
3127
+ export function promisify(
3128
+ fn: typeof import("node:stream").pipeline,
3129
+ ): typeof import("node:stream/promises").pipeline;
2967
3130
  export function promisify(
2968
3131
  fn: typeof import("node:fs").readFile,
2969
3132
  ): (path: string, encoding: "utf8" | "utf-8") => Promise<string>;
@@ -2982,6 +3145,32 @@ declare module "util" {
2982
3145
  windowsHide?: boolean;
2983
3146
  },
2984
3147
  ) => Promise<{ stdout: string; stderr: string }>;
3148
+ export function promisify(
3149
+ fn: typeof globalThis.setTimeout,
3150
+ ): typeof import("node:timers/promises").setTimeout;
3151
+ export function promisify(
3152
+ fn: typeof globalThis.setImmediate,
3153
+ ): typeof import("node:timers/promises").setImmediate;
3154
+ export function promisify(fn: typeof import("node:child_process").exec): (
3155
+ command: string,
3156
+ options?: {
3157
+ encoding?: "utf8" | "utf-8";
3158
+ cwd?: string;
3159
+ env?: { [k: string]: string | undefined };
3160
+ timeout?: number;
3161
+ maxBuffer?: number;
3162
+ killSignal?: string;
3163
+ windowsHide?: boolean;
3164
+ },
3165
+ ) => Promise<{ stdout: string; stderr: string }>;
3166
+ /* The zlib callback one-shots (deflate, inflate, deflateRaw, inflateRaw,
3167
+ * gzip, gunzip, unzip) share one type. */
3168
+ export function promisify(
3169
+ fn: typeof import("node:zlib").gzip,
3170
+ ): (data: string | Uint8Array, options?: import("node:zlib").ZlibOptions) => Promise<Buffer>;
3171
+ export function promisify(
3172
+ fn: typeof import("node:stream").finished,
3173
+ ): typeof import("node:stream/promises").finished;
2985
3174
  /* Declared surface without full lowering (the type-level tolerance
2986
3175
  * story: guarded/diagnostic-path code must TYPECHECK; a reached use
2987
3176
  * without a lowering fences at its site). inspect's options carry the
@@ -3168,8 +3357,9 @@ declare module "node:test" {
3168
3357
  function after(fn: HookFn): void;
3169
3358
  function beforeEach(fn: HookFn): void;
3170
3359
  function afterEach(fn: HookFn): void;
3171
- /* The mock function surface: mock.fn and t.mock.fn, with the calls log
3172
- * and the implementation controls on fn.mock. */
3360
+ /* The mock function surface: mock.fn, mock.method and their t.mock
3361
+ * twins, the tracker's restoreAll and reset, and the calls log and the
3362
+ * implementation controls on fn.mock. */
3173
3363
  interface MockFunctionCall<
3174
3364
  F extends Function,
3175
3365
  ReturnType = F extends (...args: any) => infer T ? T : unknown,
@@ -3189,17 +3379,35 @@ declare module "node:test" {
3189
3379
  restore(): void;
3190
3380
  }
3191
3381
  type Mock<F extends Function> = F & { mock: MockFunctionContext<F> };
3382
+ interface MockFunctionOptions {
3383
+ times?: number;
3384
+ }
3385
+ type FunctionPropertyNames<T> = {
3386
+ [K in keyof T]: T[K] extends Function ? K : never;
3387
+ }[keyof T];
3192
3388
  interface MockTracker {
3193
3389
  fn<F extends Function = (...args: any[]) => undefined>(original?: F): Mock<F>;
3194
3390
  fn<F extends Function = (...args: any[]) => undefined, Implementation extends Function = F>(
3195
3391
  original?: F,
3196
3392
  implementation?: Implementation,
3197
3393
  ): Mock<F | Implementation>;
3198
- method<MockedObject extends object>(
3394
+ method<MockedObject extends object, MethodName extends FunctionPropertyNames<MockedObject>>(
3395
+ object: MockedObject,
3396
+ methodName: MethodName,
3397
+ options?: MockFunctionOptions,
3398
+ ): MockedObject[MethodName] extends Function ? Mock<MockedObject[MethodName]> : never;
3399
+ method<
3400
+ MockedObject extends object,
3401
+ MethodName extends FunctionPropertyNames<MockedObject>,
3402
+ Implementation extends Function,
3403
+ >(
3199
3404
  object: MockedObject,
3200
- methodName: keyof MockedObject,
3201
- implementation?: Function,
3202
- ): Mock<Function>;
3405
+ methodName: MethodName,
3406
+ implementation: Implementation,
3407
+ options?: MockFunctionOptions,
3408
+ ): MockedObject[MethodName] extends Function
3409
+ ? Mock<MockedObject[MethodName] | Implementation>
3410
+ : never;
3203
3411
  reset(): void;
3204
3412
  restoreAll(): void;
3205
3413
  }
@@ -3442,10 +3650,31 @@ declare module "node:querystring" {
3442
3650
  * on("close", cb). An open interface keeps the process alive until
3443
3651
  * close()/EOF, Node's semantics; lines split on \n and \r\n. */
3444
3652
  declare module "readline" {
3445
- /* The non-terminal Interface over process.stdin or a stream input
3446
- * (scr_readline.c). Listener registrations are statements: chaining
3447
- * on()/once() results has no lowering. */
3653
+ /* The Interface over process.stdin or a stream input (scr_readline.c;
3654
+ * terminal mode in scr_readline_tty.c). Listener registrations are
3655
+ * statements: chaining on()/once() results has no lowering. */
3656
+ export interface Key {
3657
+ sequence?: string;
3658
+ name?: string;
3659
+ ctrl?: boolean;
3660
+ meta?: boolean;
3661
+ shift?: boolean;
3662
+ }
3448
3663
  export interface Interface extends Disposable {
3664
+ /* terminal says whether the interface edits lines as a terminal;
3665
+ * line and cursor are the terminal's (line is '' otherwise). history
3666
+ * is the history option itself (or the interface's own empty array);
3667
+ * a terminal records the lines it reads. */
3668
+ readonly terminal: boolean;
3669
+ readonly line: string;
3670
+ readonly cursor: number;
3671
+ getCursorPos(): CursorPos;
3672
+ history: string[];
3673
+ readonly historySize: number;
3674
+ readonly historyIndex: number;
3675
+ readonly crlfDelay: number;
3676
+ readonly tabSize: number;
3677
+ readonly escapeCodeTimeout: number;
3449
3678
  question(query: string, callback: (answer: string) => void): void;
3450
3679
  close(): void;
3451
3680
  pause(): this;
@@ -3453,16 +3682,28 @@ declare module "readline" {
3453
3682
  prompt(preserveCursor?: boolean): void;
3454
3683
  setPrompt(prompt: string): void;
3455
3684
  getPrompt(): string;
3456
- write(data: string): void;
3685
+ write(data: string | null | undefined, key?: Key): void;
3457
3686
  on(event: "line", listener: (input: string) => void): this;
3458
- on(event: "close" | "pause" | "resume", listener: () => void): this;
3687
+ on(
3688
+ event: "close" | "pause" | "resume" | "SIGINT" | "SIGTSTP" | "SIGCONT",
3689
+ listener: () => void,
3690
+ ): this;
3459
3691
  on(event: "error", listener: (err: Error) => void): this;
3692
+ on(event: "history", listener: (history: string[]) => void): this;
3460
3693
  once(event: "line", listener: (input: string) => void): this;
3461
- once(event: "close" | "pause" | "resume", listener: () => void): this;
3694
+ once(
3695
+ event: "close" | "pause" | "resume" | "SIGINT" | "SIGTSTP" | "SIGCONT",
3696
+ listener: () => void,
3697
+ ): this;
3462
3698
  once(event: "error", listener: (err: Error) => void): this;
3699
+ once(event: "history", listener: (history: string[]) => void): this;
3463
3700
  addListener(event: "line", listener: (input: string) => void): this;
3464
- addListener(event: "close" | "pause" | "resume", listener: () => void): this;
3701
+ addListener(
3702
+ event: "close" | "pause" | "resume" | "SIGINT" | "SIGTSTP" | "SIGCONT",
3703
+ listener: () => void,
3704
+ ): this;
3465
3705
  addListener(event: "error", listener: (err: Error) => void): this;
3706
+ addListener(event: "history", listener: (history: string[]) => void): this;
3466
3707
  [Symbol.asyncIterator](): AsyncIterableIterator<string>;
3467
3708
  [Symbol.dispose](): void;
3468
3709
  }
@@ -3472,26 +3713,83 @@ declare module "readline" {
3472
3713
  terminal?: boolean;
3473
3714
  /* Node's crlfDelay: a \n arriving within this many ms (at least 100)
3474
3715
  * after a line ended by \r is dropped. completer and the history
3475
- * knobs fence by name (no interactive terminal). The options-record
3716
+ * options are validated and kept; a terminal interface uses them.
3717
+ * The options-record
3476
3718
  * stance (see http.RequestOptions) admits every key; the walk
3477
3719
  * decides. */
3478
3720
  crlfDelay?: number;
3479
3721
  completer?: unknown;
3480
3722
  signal?: AbortSignal;
3723
+ history?: string[];
3724
+ historySize?: number;
3725
+ removeHistoryDuplicates?: boolean;
3726
+ tabSize?: number;
3727
+ escapeCodeTimeout?: number;
3481
3728
  [option: string]: unknown;
3482
3729
  }
3483
3730
  export function createInterface(options: ReadLineOptions): Interface;
3484
- export function createInterface(input: unknown, output?: unknown): Interface;
3731
+ export function createInterface(
3732
+ input: unknown,
3733
+ output?: unknown,
3734
+ completer?: unknown,
3735
+ terminal?: boolean,
3736
+ ): Interface;
3737
+ export interface CursorPos {
3738
+ rows: number;
3739
+ cols: number;
3740
+ }
3741
+ /* The escape-sequence helpers over process.stdout, process.stderr, a
3742
+ * writable stream, or null/undefined (nothing is written). */
3743
+ export function cursorTo(stream: unknown, x: number, y?: number, callback?: () => void): boolean;
3744
+ export function cursorTo(stream: unknown, x: number, callback: () => void): boolean;
3745
+ export function moveCursor(
3746
+ stream: unknown,
3747
+ dx: number,
3748
+ dy: number,
3749
+ callback?: () => void,
3750
+ ): boolean;
3751
+ export function clearLine(stream: unknown, dir: -1 | 0 | 1, callback?: () => void): boolean;
3752
+ export function clearScreenDown(stream: unknown, callback?: () => void): boolean;
3753
+ /* 'keypress' events (str, key) on process.stdin or a readable stream */
3754
+ export function emitKeypressEvents(stream: unknown, readlineInterface?: unknown): void;
3755
+ /* the same object as node:readline/promises */
3756
+ export const promises: typeof import("node:readline/promises");
3485
3757
  }
3486
3758
  declare module "node:readline" {
3487
3759
  export * from "readline";
3488
3760
  }
3489
3761
  declare module "readline/promises" {
3490
- import { ReadLineOptions } from "readline";
3762
+ import { CursorPos, Key, ReadLineOptions } from "readline";
3763
+ /* The escape-sequence builder over process.stdout, process.stderr or a
3764
+ * writable stream: actions queue until commit(), or are written on the
3765
+ * next tick with autoCommit. */
3766
+ export class Readline {
3767
+ constructor(stream: unknown, options?: { autoCommit?: boolean });
3768
+ clearLine(dir: -1 | 0 | 1): this;
3769
+ clearScreenDown(): this;
3770
+ commit(): Promise<void>;
3771
+ cursorTo(x: number, y?: number): this;
3772
+ moveCursor(dx: number, dy: number): this;
3773
+ rollback(): this;
3774
+ }
3491
3775
  /* The readline Interface with the promise question: it resolves with
3492
3776
  * the next line, rejects with an AbortError when options.signal aborts,
3493
3777
  * and with ERR_USE_AFTER_CLOSE after close(). */
3494
3778
  export interface Interface extends Disposable {
3779
+ /* terminal says whether the interface edits lines as a terminal;
3780
+ * line and cursor are the terminal's (line is '' otherwise). history
3781
+ * is the history option itself (or the interface's own empty array);
3782
+ * a terminal records the lines it reads. */
3783
+ readonly terminal: boolean;
3784
+ readonly line: string;
3785
+ readonly cursor: number;
3786
+ getCursorPos(): CursorPos;
3787
+ history: string[];
3788
+ readonly historySize: number;
3789
+ readonly historyIndex: number;
3790
+ readonly crlfDelay: number;
3791
+ readonly tabSize: number;
3792
+ readonly escapeCodeTimeout: number;
3495
3793
  question(query: string, options?: { signal?: AbortSignal }): Promise<string>;
3496
3794
  close(): void;
3497
3795
  pause(): this;
@@ -3499,21 +3797,38 @@ declare module "readline/promises" {
3499
3797
  prompt(preserveCursor?: boolean): void;
3500
3798
  setPrompt(prompt: string): void;
3501
3799
  getPrompt(): string;
3502
- write(data: string): void;
3800
+ write(data: string | null | undefined, key?: Key): void;
3503
3801
  on(event: "line", listener: (input: string) => void): this;
3504
- on(event: "close" | "pause" | "resume", listener: () => void): this;
3802
+ on(
3803
+ event: "close" | "pause" | "resume" | "SIGINT" | "SIGTSTP" | "SIGCONT",
3804
+ listener: () => void,
3805
+ ): this;
3505
3806
  on(event: "error", listener: (err: Error) => void): this;
3807
+ on(event: "history", listener: (history: string[]) => void): this;
3506
3808
  once(event: "line", listener: (input: string) => void): this;
3507
- once(event: "close" | "pause" | "resume", listener: () => void): this;
3809
+ once(
3810
+ event: "close" | "pause" | "resume" | "SIGINT" | "SIGTSTP" | "SIGCONT",
3811
+ listener: () => void,
3812
+ ): this;
3508
3813
  once(event: "error", listener: (err: Error) => void): this;
3814
+ once(event: "history", listener: (history: string[]) => void): this;
3509
3815
  addListener(event: "line", listener: (input: string) => void): this;
3510
- addListener(event: "close" | "pause" | "resume", listener: () => void): this;
3816
+ addListener(
3817
+ event: "close" | "pause" | "resume" | "SIGINT" | "SIGTSTP" | "SIGCONT",
3818
+ listener: () => void,
3819
+ ): this;
3511
3820
  addListener(event: "error", listener: (err: Error) => void): this;
3821
+ addListener(event: "history", listener: (history: string[]) => void): this;
3512
3822
  [Symbol.asyncIterator](): AsyncIterableIterator<string>;
3513
3823
  [Symbol.dispose](): void;
3514
3824
  }
3515
3825
  export function createInterface(options: ReadLineOptions): Interface;
3516
- export function createInterface(input: unknown, output?: unknown): Interface;
3826
+ export function createInterface(
3827
+ input: unknown,
3828
+ output?: unknown,
3829
+ completer?: unknown,
3830
+ terminal?: boolean,
3831
+ ): Interface;
3517
3832
  }
3518
3833
  declare module "node:readline/promises" {
3519
3834
  export * from "readline/promises";
@@ -3979,6 +4294,11 @@ declare module "net" {
3979
4294
  setKeepAlive(enable?: boolean, initialDelay?: number): Socket;
3980
4295
  /* end() now, destroy once the FIN actually flushed. */
3981
4296
  destroySoon(): void;
4297
+ /* An RST instead of a FIN; a connecting socket resets once it
4298
+ * connects. Throws ERR_INVALID_HANDLE_TYPE on a TLS socket. */
4299
+ resetAndDestroy(): Socket;
4300
+ /* The local address, or {} while connecting and once destroyed. */
4301
+ address(): AddressInfo | {};
3982
4302
  /* setEncoding('utf8'): 'data' delivers strings — the IncomingMessage
3983
4303
  * twin's contract. */
3984
4304
  setEncoding(encoding: string): void;
@@ -4038,6 +4358,8 @@ declare module "net" {
4038
4358
  /* Connections past this many are closed with a 'drop' event;
4039
4359
  * undefined (the default) or null lifts the cap. */
4040
4360
  maxConnections: number | undefined;
4361
+ /* Node reads it only in cluster mode: a stored value here. */
4362
+ dropMaxConnection: boolean | undefined;
4041
4363
  /* cb(null, count) on the next tick. */
4042
4364
  getConnections(callback: (error: Error | null, count: number) => void): Server;
4043
4365
  /* Node answers the server itself (`return this` chaining). */
@@ -4073,7 +4395,7 @@ declare module "net" {
4073
4395
  /* http.createServer(handler)'s event twin (a no-parser net server
4074
4396
  * never fires it, like Node). */
4075
4397
  on(
4076
- event: "request",
4398
+ event: "request" | "checkContinue" | "checkExpectation",
4077
4399
  listener: (req: import("http").IncomingMessage, res: import("http").ServerResponse) => void,
4078
4400
  ): void;
4079
4401
  /* addListener IS on (Node aliases them) — the suite spells both. */
@@ -4087,7 +4409,7 @@ declare module "net" {
4087
4409
  listener: (req: import("http").IncomingMessage, socket: Socket, head: Buffer) => void,
4088
4410
  ): void;
4089
4411
  addListener(
4090
- event: "request",
4412
+ event: "request" | "checkContinue" | "checkExpectation",
4091
4413
  listener: (req: import("http").IncomingMessage, res: import("http").ServerResponse) => void,
4092
4414
  ): void;
4093
4415
  once(event: "connection" | "secureConnection", listener: (socket: Socket) => void): void;
@@ -4100,7 +4422,7 @@ declare module "net" {
4100
4422
  listener: (req: import("http").IncomingMessage, socket: Socket, head: Buffer) => void,
4101
4423
  ): void;
4102
4424
  once(
4103
- event: "request",
4425
+ event: "request" | "checkContinue" | "checkExpectation",
4104
4426
  listener: (req: import("http").IncomingMessage, res: import("http").ServerResponse) => void,
4105
4427
  ): void;
4106
4428
  }
@@ -4221,6 +4543,7 @@ declare module "http" {
4221
4543
  requireHostHeader?: boolean;
4222
4544
  joinDuplicateHeaders?: boolean;
4223
4545
  keepAliveTimeoutBuffer?: number;
4546
+ maxHeaderSize?: number;
4224
4547
  [option: string]: unknown;
4225
4548
  }
4226
4549
  /* The outgoing-header shape, @types/node's matrix: numbers format via
@@ -4340,6 +4663,8 @@ declare module "http" {
4340
4663
  * Agent VALUE threads through (getName-keyed maxSockets accounting
4341
4664
  * over one-dial-per-request connections). */
4342
4665
  agent?: Agent | boolean | null;
4666
+ /* Aborting destroys the request with an AbortError. */
4667
+ signal?: AbortSignal;
4343
4668
  /* The options-record stance: Node ignores an options record's
4344
4669
  * unknown keys, so every key typechecks here — the option WALK in
4345
4670
  * the lowering decides per key (lower, fence by name, or drop
@@ -4421,7 +4746,7 @@ declare module "http" {
4421
4746
  setTimeout(timeout: number, callback?: () => void): this;
4422
4747
  write(data: string | Uint8Array): void;
4423
4748
  end(data?: string | Uint8Array): void;
4424
- destroy(): void;
4749
+ destroy(error?: Error): void;
4425
4750
  abort(): void;
4426
4751
  on(event: "response", listener: (res: IncomingMessage) => void): void;
4427
4752
  on(event: "socket", listener: (socket: Socket) => void): void;
@@ -4429,7 +4754,7 @@ declare module "http" {
4429
4754
  event: "upgrade",
4430
4755
  listener: (res: IncomingMessage, socket: Socket, head: Buffer) => void,
4431
4756
  ): void;
4432
- on(event: "timeout" | "close" | "finish" | "abort", listener: () => void): void;
4757
+ on(event: "timeout" | "close" | "finish" | "abort" | "continue", listener: () => void): void;
4433
4758
  on(event: "error", listener: (err: Error) => void): void;
4434
4759
  /* addListener IS on (Node aliases them) — the suite spells both. */
4435
4760
  addListener(event: "response", listener: (res: IncomingMessage) => void): void;
@@ -4446,7 +4771,7 @@ declare module "http" {
4446
4771
  event: "upgrade",
4447
4772
  listener: (res: IncomingMessage, socket: Socket, head: Buffer) => void,
4448
4773
  ): void;
4449
- once(event: "timeout" | "close" | "finish" | "abort", listener: () => void): void;
4774
+ once(event: "timeout" | "close" | "finish" | "abort" | "continue", listener: () => void): void;
4450
4775
  once(event: "error", listener: (err: Error) => void): void;
4451
4776
  }
4452
4777
  export function createServer(
@@ -4508,7 +4833,7 @@ declare module "tls" {
4508
4833
  }
4509
4834
  export function createServer(
4510
4835
  options: TlsOptions,
4511
- secureConnectionListener?: (socket: Socket) => void,
4836
+ secureConnectionListener?: (socket: TLSSocket) => void,
4512
4837
  ): Server;
4513
4838
  /** TLSSocket — post-handshake it IS a net socket to every lowered
4514
4839
  * member (the mapping collapses it onto the socket kind; the
@@ -4519,7 +4844,20 @@ declare module "tls" {
4519
4844
  export interface TLSSocket extends Socket {
4520
4845
  authorized: boolean;
4521
4846
  authorizationError: string | null;
4847
+ /* null before the handshake, then the negotiated protocol or false */
4848
+ readonly alpnProtocol: string | false | null;
4849
+ /* "TLSv1.2" or "TLSv1.3"; null before the handshake and after close */
4850
+ getProtocol(): string | null;
4851
+ /* OpenSSL's suite name, the IANA name and the suite's version */
4852
+ getCipher(): CipherNameAndProtocol;
4853
+ }
4854
+ export interface CipherNameAndProtocol {
4855
+ name: string;
4856
+ standardName: string;
4857
+ version: string;
4522
4858
  }
4859
+ export const DEFAULT_MIN_VERSION: string;
4860
+ export const DEFAULT_MAX_VERSION: string;
4523
4861
  /** tls.connect options — the RUNTIME options record (members read at
4524
4862
  * runtime; port/host/rejectUnauthorized/ca/servername are the
4525
4863
  * honestly-implemented set, every other documented member throws the
@@ -4596,6 +4934,8 @@ declare module "https" {
4596
4934
  rejectUnauthorized?: boolean;
4597
4935
  ca?: string | Uint8Array;
4598
4936
  agent?: Agent | boolean | null;
4937
+ /* Aborting destroys the request with an AbortError. */
4938
+ signal?: AbortSignal;
4599
4939
  /* The options-record stance (see http.RequestOptions). */
4600
4940
  [option: string]: unknown;
4601
4941
  }
@@ -5306,8 +5646,9 @@ declare module "node:http2" {
5306
5646
  * Buffer datagram with an explicit port + address (the connected-send
5307
5647
  * and callback forms have no lowering); address() returns the real
5308
5648
  * {address, family, port} record and THROWS "Not running" before bind,
5309
- * like Node. 'error' with no listener exits 1 (the unhandled
5310
- * EventEmitter 'error' behavior). Multicast has no lowering. */
5649
+ * like Node. The socket options throw Node's errors (EBADF before bind);
5650
+ * add/dropMembership before bind is refused at run time (SC2020). 'error'
5651
+ * with no listener exits 1 (the unhandled EventEmitter 'error' behavior). */
5311
5652
  declare module "dgram" {
5312
5653
  export interface AddressInfo {
5313
5654
  address: string;
@@ -5326,8 +5667,22 @@ declare module "dgram" {
5326
5667
  send(msg: string | Uint8Array, port: number, address: string): void;
5327
5668
  address(): AddressInfo;
5328
5669
  close(callback?: () => void): void;
5670
+ disconnect(): void;
5329
5671
  unref(): void;
5330
5672
  ref(): void;
5673
+ setBroadcast(flag: boolean): void;
5674
+ setTTL(ttl: number): number;
5675
+ setMulticastTTL(ttl: number): number;
5676
+ setMulticastLoopback(flag: boolean): boolean;
5677
+ setMulticastInterface(multicastInterface: string): void;
5678
+ addMembership(multicastAddress: string, multicastInterface?: string): void;
5679
+ dropMembership(multicastAddress: string, multicastInterface?: string): void;
5680
+ getRecvBufferSize(): number;
5681
+ getSendBufferSize(): number;
5682
+ setRecvBufferSize(size: number): void;
5683
+ setSendBufferSize(size: number): void;
5684
+ getSendQueueSize(): number;
5685
+ getSendQueueCount(): number;
5331
5686
  on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): void;
5332
5687
  on(event: "listening" | "close" | "connect", listener: () => void): void;
5333
5688
  on(event: "error", listener: (err: Error) => void): void;
@@ -5456,6 +5811,13 @@ declare module "worker_threads" {
5456
5811
  removeAllListeners(event?: string): this;
5457
5812
  listenerCount(event: string, listener?: (...args: any[]) => void): number;
5458
5813
  }
5814
+ /* Two entangled ports; a port moves to another thread through a
5815
+ * postMessage or workerData transferList. */
5816
+ export class MessageChannel {
5817
+ readonly port1: MessagePort;
5818
+ readonly port2: MessagePort;
5819
+ }
5820
+ export function receiveMessageOnPort(port: MessagePort): { message: any } | undefined;
5459
5821
  export const parentPort: MessagePort | null;
5460
5822
  export const workerData: any;
5461
5823
  }
@@ -5595,7 +5957,12 @@ declare module "events" {
5595
5957
  // The class under its own name, so `import { EventEmitter }` resolves
5596
5958
  // (the @types/node namespace-alias pattern).
5597
5959
  export { internal as EventEmitter };
5598
- export function once(emitter: EventEmitter, eventName: string): Promise<any[]>;
5960
+ // The event's arguments, as checked-dynamic values.
5961
+ export function once(
5962
+ emitter: EventEmitter,
5963
+ eventName: string,
5964
+ options?: { signal?: AbortSignal },
5965
+ ): Promise<unknown[]>;
5599
5966
  }
5600
5967
  export = EventEmitter;
5601
5968
  }