@scriptc/compiler 0.3.3 → 0.3.5

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 (352) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +844 -36
  2. package/dist/backend/cycle-mutability.d.ts +5 -0
  3. package/dist/backend/cycle-mutability.js +62 -3
  4. package/dist/backend/cycle-mutability.js.map +1 -1
  5. package/dist/backend/executable-features.js +1 -0
  6. package/dist/backend/executable-features.js.map +1 -1
  7. package/dist/backend/library-pack.js +1 -0
  8. package/dist/backend/library-pack.js.map +1 -1
  9. package/dist/backend/llvm/array-search.js +1 -1
  10. package/dist/backend/llvm/array-search.js.map +1 -1
  11. package/dist/backend/llvm/call-lifetimes.d.ts +11 -1
  12. package/dist/backend/llvm/call-lifetimes.js +30 -3
  13. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  14. package/dist/backend/llvm/call-lifetimes.test.js +31 -1
  15. package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
  16. package/dist/backend/llvm/common.d.ts +5 -0
  17. package/dist/backend/llvm/common.js +7 -0
  18. package/dist/backend/llvm/common.js.map +1 -1
  19. package/dist/backend/llvm/constant-callbacks.d.ts +2 -21
  20. package/dist/backend/llvm/constant-callbacks.js +36 -219
  21. package/dist/backend/llvm/constant-callbacks.js.map +1 -1
  22. package/dist/backend/llvm/constant-callbacks.test.js +22 -0
  23. package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
  24. package/dist/backend/llvm/dense-array-access.d.ts +9 -0
  25. package/dist/backend/llvm/dense-array-access.js +29 -3
  26. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  27. package/dist/backend/llvm/dyn.d.ts +46 -1
  28. package/dist/backend/llvm/dyn.js +218 -33
  29. package/dist/backend/llvm/dyn.js.map +1 -1
  30. package/dist/backend/llvm/emitter.d.ts +87 -1
  31. package/dist/backend/llvm/emitter.js +568 -61
  32. package/dist/backend/llvm/emitter.js.map +1 -1
  33. package/dist/backend/llvm/expr-async.js +17 -7
  34. package/dist/backend/llvm/expr-async.js.map +1 -1
  35. package/dist/backend/llvm/expr-bytes.d.ts +9 -0
  36. package/dist/backend/llvm/expr-bytes.js +159 -64
  37. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  38. package/dist/backend/llvm/expr-callbacks.d.ts +11 -0
  39. package/dist/backend/llvm/expr-callbacks.js +53 -0
  40. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  41. package/dist/backend/llvm/expr-calls.d.ts +3 -1
  42. package/dist/backend/llvm/expr-calls.js +137 -3
  43. package/dist/backend/llvm/expr-calls.js.map +1 -1
  44. package/dist/backend/llvm/expr-containers.js +63 -29
  45. package/dist/backend/llvm/expr-containers.js.map +1 -1
  46. package/dist/backend/llvm/expr-primitives.js +9 -1
  47. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  48. package/dist/backend/llvm/expr-stream-bridges.js +4 -0
  49. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  50. package/dist/backend/llvm/integer-clones.d.ts +103 -0
  51. package/dist/backend/llvm/integer-clones.js +1336 -0
  52. package/dist/backend/llvm/integer-clones.js.map +1 -0
  53. package/dist/backend/llvm/integer-clones.test.d.ts +1 -0
  54. package/dist/backend/llvm/integer-clones.test.js +219 -0
  55. package/dist/backend/llvm/integer-clones.test.js.map +1 -0
  56. package/dist/backend/llvm/intern-tables.test.d.ts +1 -0
  57. package/dist/backend/llvm/intern-tables.test.js +77 -0
  58. package/dist/backend/llvm/intern-tables.test.js.map +1 -0
  59. package/dist/backend/llvm/lib-datagram.js +24 -0
  60. package/dist/backend/llvm/lib-datagram.js.map +1 -1
  61. package/dist/backend/llvm/lib-dispatch.js +96 -1
  62. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  63. package/dist/backend/llvm/lib-filesystem.js +51 -0
  64. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  65. package/dist/backend/llvm/lib-network.js +16 -0
  66. package/dist/backend/llvm/lib-network.js.map +1 -1
  67. package/dist/backend/llvm/lib-process.js +24 -0
  68. package/dist/backend/llvm/lib-process.js.map +1 -1
  69. package/dist/backend/llvm/lib-shared.d.ts +5 -0
  70. package/dist/backend/llvm/lib-shared.js +114 -3
  71. package/dist/backend/llvm/lib-shared.js.map +1 -1
  72. package/dist/backend/llvm/lib-stream.js +87 -0
  73. package/dist/backend/llvm/lib-stream.js.map +1 -1
  74. package/dist/backend/llvm/lib-test.js +9 -0
  75. package/dist/backend/llvm/lib-test.js.map +1 -1
  76. package/dist/backend/llvm/lib-tls.js +6 -0
  77. package/dist/backend/llvm/lib-tls.js.map +1 -1
  78. package/dist/backend/llvm/local-array-reads.js +1 -1
  79. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  80. package/dist/backend/llvm/map-entry-fusion.d.ts +28 -0
  81. package/dist/backend/llvm/map-entry-fusion.js +233 -0
  82. package/dist/backend/llvm/map-entry-fusion.js.map +1 -0
  83. package/dist/backend/llvm/map-entry-fusion.test.d.ts +1 -0
  84. package/dist/backend/llvm/map-entry-fusion.test.js +183 -0
  85. package/dist/backend/llvm/map-entry-fusion.test.js.map +1 -0
  86. package/dist/backend/llvm/map-number-lookup.d.ts +6 -0
  87. package/dist/backend/llvm/map-number-lookup.js +23 -1
  88. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  89. package/dist/backend/llvm/map-number-lookup.test.js +60 -5
  90. package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
  91. package/dist/backend/llvm/map-read-lifetimes.d.ts +11 -0
  92. package/dist/backend/llvm/map-read-lifetimes.js +92 -1
  93. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  94. package/dist/backend/llvm/map-read-lifetimes.test.js +131 -3
  95. package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
  96. package/dist/backend/llvm/publish.d.ts +21 -0
  97. package/dist/backend/llvm/publish.js +101 -11
  98. package/dist/backend/llvm/publish.js.map +1 -1
  99. package/dist/backend/llvm/publish.test.d.ts +1 -0
  100. package/dist/backend/llvm/publish.test.js +94 -0
  101. package/dist/backend/llvm/publish.test.js.map +1 -0
  102. package/dist/backend/llvm/record-results.js +76 -2
  103. package/dist/backend/llvm/record-results.js.map +1 -1
  104. package/dist/backend/llvm/record-sources.d.ts +7 -0
  105. package/dist/backend/llvm/record-sources.js +14 -0
  106. package/dist/backend/llvm/record-sources.js.map +1 -0
  107. package/dist/backend/llvm/reference-writes.js +5 -2
  108. package/dist/backend/llvm/reference-writes.js.map +1 -1
  109. package/dist/backend/llvm/regions.d.ts +4 -1
  110. package/dist/backend/llvm/regions.js +12 -3
  111. package/dist/backend/llvm/regions.js.map +1 -1
  112. package/dist/backend/llvm/shapes.d.ts +9 -3
  113. package/dist/backend/llvm/shapes.js +18 -14
  114. package/dist/backend/llvm/shapes.js.map +1 -1
  115. package/dist/backend/llvm/shapes.test.js +5 -3
  116. package/dist/backend/llvm/shapes.test.js.map +1 -1
  117. package/dist/backend/llvm/string-lifetimes.test.js +75 -1
  118. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  119. package/dist/backend/llvm/string-reads.js +2 -2
  120. package/dist/backend/llvm/string-reads.js.map +1 -1
  121. package/dist/backend/llvm/string-slices.js +2 -2
  122. package/dist/backend/llvm/string-slices.js.map +1 -1
  123. package/dist/backend/llvm/walkers.d.ts +17 -0
  124. package/dist/backend/llvm/walkers.js +123 -0
  125. package/dist/backend/llvm/walkers.js.map +1 -1
  126. package/dist/backend/may-throw.js +4 -0
  127. package/dist/backend/may-throw.js.map +1 -1
  128. package/dist/backend/native/contracts.d.ts +5 -1
  129. package/dist/backend/native/executable.js +16 -6
  130. package/dist/backend/native/executable.js.map +1 -1
  131. package/dist/backend/native/runtime-inputs.d.ts +1 -1
  132. package/dist/backend/native/runtime-inputs.js +1 -0
  133. package/dist/backend/native/runtime-inputs.js.map +1 -1
  134. package/dist/backend/native-codegen-core.d.ts +4 -4
  135. package/dist/backend/native-codegen-core.js +4 -6
  136. package/dist/backend/native-codegen-core.js.map +1 -1
  137. package/dist/backend/native-codegen.test.js +7 -8
  138. package/dist/backend/native-codegen.test.js.map +1 -1
  139. package/dist/backend/native-link-info-core.d.ts +3 -0
  140. package/dist/backend/native-link-info-core.js.map +1 -1
  141. package/dist/backend/publication.js +3 -1
  142. package/dist/backend/publication.js.map +1 -1
  143. package/dist/backend/runtime-abi.d.ts +2 -2
  144. package/dist/backend/runtime-abi.js +2 -2
  145. package/dist/backend/runtime-pack-targets.test.js +2 -1
  146. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  147. package/dist/backend/runtime-pack.test.js +2 -1
  148. package/dist/backend/runtime-pack.test.js.map +1 -1
  149. package/dist/backend/target-diagnostics.js +7 -0
  150. package/dist/backend/target-diagnostics.js.map +1 -1
  151. package/dist/backend/warm-cache.js +1 -0
  152. package/dist/backend/warm-cache.js.map +1 -1
  153. package/dist/executable/executable-cache.d.ts +1 -0
  154. package/dist/executable/executable-cache.js +1 -0
  155. package/dist/executable/executable-cache.js.map +1 -1
  156. package/dist/executable/executable-cache.test.js +1 -0
  157. package/dist/executable/executable-cache.test.js.map +1 -1
  158. package/dist/frontend/experimental-import.d.ts +5 -1
  159. package/dist/frontend/experimental-import.js +28 -3
  160. package/dist/frontend/experimental-import.js.map +1 -1
  161. package/dist/frontend/lowering/assert-instances.d.ts +38 -0
  162. package/dist/frontend/lowering/assert-instances.js +269 -0
  163. package/dist/frontend/lowering/assert-instances.js.map +1 -0
  164. package/dist/frontend/lowering/builtin-calls.js +3 -0
  165. package/dist/frontend/lowering/builtin-calls.js.map +1 -1
  166. package/dist/frontend/lowering/builtins/callable-aliases.js +54 -8
  167. package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
  168. package/dist/frontend/lowering/builtins/child-process-async.d.ts +8 -6
  169. package/dist/frontend/lowering/builtins/child-process-async.js +45 -29
  170. package/dist/frontend/lowering/builtins/child-process-async.js.map +1 -1
  171. package/dist/frontend/lowering/builtins/compression.d.ts +18 -0
  172. package/dist/frontend/lowering/builtins/compression.js +175 -2
  173. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  174. package/dist/frontend/lowering/builtins/constants.js +7 -2
  175. package/dist/frontend/lowering/builtins/constants.js.map +1 -1
  176. package/dist/frontend/lowering/builtins/crypto.d.ts +6 -0
  177. package/dist/frontend/lowering/builtins/crypto.js +111 -1
  178. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  179. package/dist/frontend/lowering/builtins/errors.js +23 -0
  180. package/dist/frontend/lowering/builtins/errors.js.map +1 -1
  181. package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +2 -0
  182. package/dist/frontend/lowering/builtins/filesystem-calls.js +5 -0
  183. package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
  184. package/dist/frontend/lowering/builtins/filesystem.js +60 -0
  185. package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
  186. package/dist/frontend/lowering/builtins/fs-streams.d.ts +26 -0
  187. package/dist/frontend/lowering/builtins/fs-streams.js +131 -0
  188. package/dist/frontend/lowering/builtins/fs-streams.js.map +1 -0
  189. package/dist/frontend/lowering/builtins/module-calls.js +5 -1
  190. package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
  191. package/dist/frontend/lowering/builtins/timers.d.ts +3 -0
  192. package/dist/frontend/lowering/builtins/timers.js +109 -23
  193. package/dist/frontend/lowering/builtins/timers.js.map +1 -1
  194. package/dist/frontend/lowering/call-signatures.js +6 -0
  195. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  196. package/dist/frontend/lowering/class-dynamic-dispatch.js +216 -20
  197. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  198. package/dist/frontend/lowering/containers/bytes.js +33 -12
  199. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  200. package/dist/frontend/lowering/devirtualize.js +20 -7
  201. package/dist/frontend/lowering/devirtualize.js.map +1 -1
  202. package/dist/frontend/lowering/intern-tables.d.ts +13 -0
  203. package/dist/frontend/lowering/intern-tables.js +536 -0
  204. package/dist/frontend/lowering/intern-tables.js.map +1 -0
  205. package/dist/frontend/lowering/lower-assert.js +700 -61
  206. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  207. package/dist/frontend/lowering/lower-async-iteration.js +11 -2
  208. package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
  209. package/dist/frontend/lowering/lower-calls.js +75 -6
  210. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  211. package/dist/frontend/lowering/lower-classes.d.ts +3 -0
  212. package/dist/frontend/lowering/lower-classes.js +43 -0
  213. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  214. package/dist/frontend/lowering/lower-dgram.js +132 -67
  215. package/dist/frontend/lowering/lower-dgram.js.map +1 -1
  216. package/dist/frontend/lowering/lower-event-emitter.d.ts +9 -1
  217. package/dist/frontend/lowering/lower-event-emitter.js +78 -0
  218. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  219. package/dist/frontend/lowering/lower-exprs.d.ts +4 -0
  220. package/dist/frontend/lowering/lower-exprs.js +144 -58
  221. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  222. package/dist/frontend/lowering/lower-inspect.d.ts +6 -0
  223. package/dist/frontend/lowering/lower-inspect.js +138 -39
  224. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  225. package/dist/frontend/lowering/lower-mock.d.ts +11 -0
  226. package/dist/frontend/lowering/lower-mock.js +504 -0
  227. package/dist/frontend/lowering/lower-mock.js.map +1 -0
  228. package/dist/frontend/lowering/lower-modules.js +7 -0
  229. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  230. package/dist/frontend/lowering/lower-server.d.ts +4 -0
  231. package/dist/frontend/lowering/lower-server.js +448 -30
  232. package/dist/frontend/lowering/lower-server.js.map +1 -1
  233. package/dist/frontend/lowering/lower-stmts.js +35 -8
  234. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  235. package/dist/frontend/lowering/lower-stream.d.ts +10 -6
  236. package/dist/frontend/lowering/lower-stream.js +794 -27
  237. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  238. package/dist/frontend/lowering/lower-test.js +86 -8
  239. package/dist/frontend/lowering/lower-test.js.map +1 -1
  240. package/dist/frontend/lowering/lowerer.d.ts +25 -1
  241. package/dist/frontend/lowering/lowerer.js +74 -9
  242. package/dist/frontend/lowering/lowerer.js.map +1 -1
  243. package/dist/frontend/lowering/pairs-snapshot.d.ts +6 -0
  244. package/dist/frontend/lowering/pairs-snapshot.js +49 -0
  245. package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
  246. package/dist/frontend/lowering/record-sources.d.ts +15 -0
  247. package/dist/frontend/lowering/record-sources.js +46 -0
  248. package/dist/frontend/lowering/record-sources.js.map +1 -0
  249. package/dist/frontend/lowering/surfaces.d.ts +4 -0
  250. package/dist/frontend/lowering/surfaces.js +94 -16
  251. package/dist/frontend/lowering/surfaces.js.map +1 -1
  252. package/dist/frontend/lowering/zlib-constants.d.ts +1 -0
  253. package/dist/frontend/lowering/zlib-constants.js +181 -0
  254. package/dist/frontend/lowering/zlib-constants.js.map +1 -0
  255. package/dist/frontend/mock-shapes.d.ts +10 -0
  256. package/dist/frontend/mock-shapes.js +76 -0
  257. package/dist/frontend/mock-shapes.js.map +1 -0
  258. package/dist/frontend/pipeline.js +5 -3
  259. package/dist/frontend/pipeline.js.map +1 -1
  260. package/dist/frontend/program.js +6 -1
  261. package/dist/frontend/program.js.map +1 -1
  262. package/dist/frontend/resolve.d.ts +4 -0
  263. package/dist/frontend/resolve.js +14 -0
  264. package/dist/frontend/resolve.js.map +1 -1
  265. package/dist/frontend/tsc-codes.js +1 -0
  266. package/dist/frontend/tsc-codes.js.map +1 -1
  267. package/dist/frontend/type-mapper.d.ts +8 -0
  268. package/dist/frontend/type-mapper.js +155 -9
  269. package/dist/frontend/type-mapper.js.map +1 -1
  270. package/dist/index.js +2 -1
  271. package/dist/index.js.map +1 -1
  272. package/dist/ir/analysis.d.ts +10 -0
  273. package/dist/ir/analysis.js +35 -0
  274. package/dist/ir/analysis.js.map +1 -1
  275. package/dist/ir/analysis.test.js +69 -1
  276. package/dist/ir/analysis.test.js.map +1 -1
  277. package/dist/ir/builtin-effects.js +72 -0
  278. package/dist/ir/builtin-effects.js.map +1 -1
  279. package/dist/ir/builtin-signatures.d.ts +1 -1
  280. package/dist/ir/builtin-signatures.js +238 -15
  281. package/dist/ir/builtin-signatures.js.map +1 -1
  282. package/dist/ir/capture-values.d.ts +107 -0
  283. package/dist/ir/capture-values.js +850 -0
  284. package/dist/ir/capture-values.js.map +1 -0
  285. package/dist/ir/capture-values.test.d.ts +1 -0
  286. package/dist/ir/capture-values.test.js +268 -0
  287. package/dist/ir/capture-values.test.js.map +1 -0
  288. package/dist/ir/field-values.d.ts +16 -0
  289. package/dist/ir/field-values.js +128 -0
  290. package/dist/ir/field-values.js.map +1 -0
  291. package/dist/ir/field-values.test.d.ts +1 -0
  292. package/dist/ir/field-values.test.js +160 -0
  293. package/dist/ir/field-values.test.js.map +1 -0
  294. package/dist/ir/final-fields.d.ts +4 -1
  295. package/dist/ir/final-fields.js +11 -3
  296. package/dist/ir/final-fields.js.map +1 -1
  297. package/dist/ir/function-references.test.js +1 -1
  298. package/dist/ir/function-references.test.js.map +1 -1
  299. package/dist/ir/init-only-globals.d.ts +16 -0
  300. package/dist/ir/init-only-globals.js +121 -0
  301. package/dist/ir/init-only-globals.js.map +1 -0
  302. package/dist/ir/init-only-globals.test.d.ts +1 -0
  303. package/dist/ir/init-only-globals.test.js +115 -0
  304. package/dist/ir/init-only-globals.test.js.map +1 -0
  305. package/dist/ir/initializer-bindings.d.ts +18 -1
  306. package/dist/ir/initializer-bindings.js +91 -1
  307. package/dist/ir/initializer-bindings.js.map +1 -1
  308. package/dist/ir/initializer-bindings.test.js +57 -2
  309. package/dist/ir/initializer-bindings.test.js.map +1 -1
  310. package/dist/ir/int32-slots.d.ts +22 -0
  311. package/dist/ir/int32-slots.js +376 -13
  312. package/dist/ir/int32-slots.js.map +1 -1
  313. package/dist/ir/int32-slots.test.js +91 -8
  314. package/dist/ir/int32-slots.test.js.map +1 -1
  315. package/dist/ir/integer-loop-facts.d.ts +19 -1
  316. package/dist/ir/integer-loop-facts.js +155 -7
  317. package/dist/ir/integer-loop-facts.js.map +1 -1
  318. package/dist/ir/integer-ranges.d.ts +8 -5
  319. package/dist/ir/integer-ranges.js +147 -55
  320. package/dist/ir/integer-ranges.js.map +1 -1
  321. package/dist/ir/integer-ranges.test.js +225 -7
  322. package/dist/ir/integer-ranges.test.js.map +1 -1
  323. package/dist/ir/ir.d.ts +29 -2
  324. package/dist/ir/ir.js +17 -0
  325. package/dist/ir/ir.js.map +1 -1
  326. package/dist/ir/property-bags.d.ts +14 -0
  327. package/dist/ir/property-bags.js +121 -0
  328. package/dist/ir/property-bags.js.map +1 -0
  329. package/dist/ir/receiver-readers.d.ts +21 -0
  330. package/dist/ir/receiver-readers.js +217 -0
  331. package/dist/ir/receiver-readers.js.map +1 -0
  332. package/dist/ir/runtime-features.d.ts +1 -0
  333. package/dist/ir/runtime-features.js +34 -2
  334. package/dist/ir/runtime-features.js.map +1 -1
  335. package/dist/ir/validate.js +221 -5
  336. package/dist/ir/validate.js.map +1 -1
  337. package/dist/ir/validate.test.js +21 -0
  338. package/dist/ir/validate.test.js.map +1 -1
  339. package/dist/library/int-infer.js +3 -0
  340. package/dist/library/int-infer.js.map +1 -1
  341. package/dist/library/ir-policy.js +1 -0
  342. package/dist/library/ir-policy.js.map +1 -1
  343. package/dist/native/cli.js +1 -0
  344. package/dist/native/cli.js.map +1 -1
  345. package/dist/native/compiler.js +1 -3
  346. package/dist/native/compiler.js.map +1 -1
  347. package/dist/native/prepare.js +1 -0
  348. package/dist/native/prepare.js.map +1 -1
  349. package/dist/native/sanitizer.test.js +1 -0
  350. package/dist/native/sanitizer.test.js.map +1 -1
  351. package/package.json +20 -20
  352. package/surface-manifest.json +896 -49
@@ -635,9 +635,12 @@ interface BufferConstructor {
635
635
  from(data: Uint8Array | readonly number[]): Buffer;
636
636
  alloc(size: number, fill?: string | number | Uint8Array, encoding?: BufferEncoding): Buffer;
637
637
  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). */
638
+ /* alloc without the zero-fill guarantee. Below Buffer.poolSize >>> 1
639
+ * bytes it returns a view into the shared pool slab. */
640
640
  allocUnsafe(size: number): Buffer;
641
+ allocUnsafeSlow(size: number): Buffer;
642
+ /* The pool slab size for allocUnsafe, from, and concat. */
643
+ poolSize: number;
641
644
  concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
642
645
  isBuffer(obj: unknown): obj is Buffer;
643
646
  byteLength(input: string | Uint8Array, encoding?: BufferEncoding): number;
@@ -992,14 +995,22 @@ declare module "timers" {
992
995
  }
993
996
 
994
997
  /* node:timers/promises — the promisified pair the Node test harness leans
995
- * on (`await setTimeout(ms)` as a sleep). setTimeout's delay-only form and
996
- * setImmediate's bare form lower (a void promise the shared timer heap
997
- * settles); setInterval(delay, value) lowers to a typed async iterator.
998
- * Resolve values on the one-shot pair and AbortSignal options remain
999
- * declared surface that fences per site. */
998
+ * on (`await setTimeout(ms)` as a sleep). setTimeout and setImmediate
999
+ * settle with their resolve value (undefined without one) from the shared
1000
+ * timer heap and the immediate queue; setInterval(delay, value) lowers to a
1001
+ * typed async iterator. The options object takes `ref`; AbortSignal
1002
+ * options remain declared surface that fences per site. */
1000
1003
  declare module "node:timers/promises" {
1001
- export function setTimeout(delay?: number): Promise<void>;
1002
- export function setImmediate(): Promise<void>;
1004
+ export interface TimerOptions {
1005
+ ref?: boolean;
1006
+ signal?: AbortSignal;
1007
+ }
1008
+ export function setTimeout<T = void>(
1009
+ delay?: number,
1010
+ value?: T,
1011
+ options?: TimerOptions,
1012
+ ): Promise<T>;
1013
+ export function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
1003
1014
  export function setInterval<T = unknown>(
1004
1015
  delay?: number,
1005
1016
  value?: T,
@@ -1190,6 +1201,7 @@ interface ImportMeta {
1190
1201
  * directory, open 'x'"). `rmSync` removes FILES only (like Node without
1191
1202
  * `recursive`); empty directories go through `rmdirSync`. */
1192
1203
  declare module "node:fs" {
1204
+ import { Readable, Writable } from "stream";
1193
1205
  export function readFileSync(path: string | number, encoding: BufferEncoding): string;
1194
1206
  export function readFileSync(
1195
1207
  path: string | number,
@@ -1372,6 +1384,47 @@ declare module "node:fs" {
1372
1384
  bufferSize?: number;
1373
1385
  }
1374
1386
  export function opendirSync(path: string, options?: OpenDirOptions): Dir;
1387
+ /* fs.ReadStream / fs.WriteStream: runtime Readable and Writable streams
1388
+ * over a file (scr_fs_stream.c). The options are checked at runtime
1389
+ * with Node's rules; flags and mode are checked when the file opens, so
1390
+ * their errors arrive as 'error' events. Instances also emit 'open'
1391
+ * (with the fd) and 'ready'. */
1392
+ export interface StreamOptions {
1393
+ flags?: string;
1394
+ encoding?: BufferEncoding;
1395
+ fd?: number;
1396
+ mode?: number | string;
1397
+ autoClose?: boolean;
1398
+ emitClose?: boolean;
1399
+ start?: number;
1400
+ highWaterMark?: number;
1401
+ }
1402
+ export interface ReadStreamOptions extends StreamOptions {
1403
+ end?: number;
1404
+ }
1405
+ export interface WriteStreamOptions extends StreamOptions {
1406
+ flush?: boolean;
1407
+ }
1408
+ export class ReadStream extends Readable {
1409
+ readonly bytesRead: number;
1410
+ readonly path: string | Buffer;
1411
+ readonly pending: boolean;
1412
+ close(callback?: () => void): void;
1413
+ }
1414
+ export class WriteStream extends Writable {
1415
+ readonly bytesWritten: number;
1416
+ readonly path: string | Buffer;
1417
+ readonly pending: boolean;
1418
+ close(callback?: () => void): void;
1419
+ }
1420
+ export function createReadStream(
1421
+ path: string | Buffer | URL,
1422
+ options?: BufferEncoding | ReadStreamOptions,
1423
+ ): ReadStream;
1424
+ export function createWriteStream(
1425
+ path: string | Buffer | URL,
1426
+ options?: BufferEncoding | WriteStreamOptions,
1427
+ ): WriteStream;
1375
1428
  export function accessSync(path: string, mode?: number): void;
1376
1429
  export function mkdtempSync(prefix: string): string;
1377
1430
  export const constants: {
@@ -1624,9 +1677,31 @@ declare module "fs/promises" {
1624
1677
  length?: number | null;
1625
1678
  position?: number | null;
1626
1679
  }
1680
+ /* The streams over a FileHandle (createReadStream, createWriteStream,
1681
+ * readLines): fs streams that hold the handle until they close; closing
1682
+ * the stream closes the handle unless autoClose is false. */
1683
+ export interface CreateReadStreamOptions {
1684
+ encoding?: BufferEncoding | null;
1685
+ autoClose?: boolean;
1686
+ emitClose?: boolean;
1687
+ start?: number;
1688
+ end?: number;
1689
+ highWaterMark?: number;
1690
+ }
1691
+ export interface CreateWriteStreamOptions {
1692
+ encoding?: BufferEncoding | null;
1693
+ autoClose?: boolean;
1694
+ emitClose?: boolean;
1695
+ start?: number;
1696
+ highWaterMark?: number;
1697
+ flush?: boolean;
1698
+ }
1627
1699
  export interface FileHandle extends AsyncDisposable {
1628
1700
  readonly fd: number;
1629
1701
  close(): Promise<void>;
1702
+ createReadStream(options?: CreateReadStreamOptions): import("node:fs").ReadStream;
1703
+ createWriteStream(options?: CreateWriteStreamOptions): import("node:fs").WriteStream;
1704
+ readLines(options?: CreateReadStreamOptions): import("node:readline").Interface;
1630
1705
  sync(): Promise<void>;
1631
1706
  datasync(): Promise<void>;
1632
1707
  truncate(len?: number): Promise<void>;
@@ -2442,6 +2517,95 @@ declare module "crypto" {
2442
2517
  callback: (error: Error | null, buffer: Buffer) => void,
2443
2518
  ): void;
2444
2519
  export type BinaryLike = string | ArrayBuffer | ArrayBufferView;
2520
+ /* Cipheriv/Decipheriv: aes-128/192/256 in cbc, ctr, and gcm modes and
2521
+ * chacha20-poly1305. The stream.Transform members are not declared. */
2522
+ export type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
2523
+ export type CipherChaCha20Poly1305Types = "chacha20-poly1305";
2524
+ export type CipherKey = BinaryLike | KeyObject;
2525
+ export interface CipherGCMOptions {
2526
+ authTagLength?: number;
2527
+ }
2528
+ export interface CipherChaCha20Poly1305Options {
2529
+ authTagLength?: number;
2530
+ }
2531
+ export interface Cipheriv {
2532
+ update(data: string | ArrayBufferView): Buffer;
2533
+ update(data: string, inputEncoding: BufferEncoding): Buffer;
2534
+ update(data: ArrayBufferView, inputEncoding: undefined, outputEncoding: BufferEncoding): string;
2535
+ update(
2536
+ data: string,
2537
+ inputEncoding: BufferEncoding | undefined,
2538
+ outputEncoding: BufferEncoding,
2539
+ ): string;
2540
+ final(): Buffer;
2541
+ final(outputEncoding: BufferEncoding): string;
2542
+ setAutoPadding(autoPadding?: boolean): this;
2543
+ }
2544
+ export interface CipherGCM extends Cipheriv {
2545
+ setAAD(buffer: ArrayBufferView, options?: { plaintextLength: number }): this;
2546
+ getAuthTag(): Buffer;
2547
+ }
2548
+ export interface CipherChaCha20Poly1305 extends Cipheriv {
2549
+ setAAD(buffer: ArrayBufferView, options?: { plaintextLength: number }): this;
2550
+ getAuthTag(): Buffer;
2551
+ }
2552
+ export interface Decipheriv {
2553
+ update(data: ArrayBufferView): Buffer;
2554
+ update(data: string, inputEncoding: BufferEncoding): Buffer;
2555
+ update(data: ArrayBufferView, inputEncoding: undefined, outputEncoding: BufferEncoding): string;
2556
+ update(
2557
+ data: string,
2558
+ inputEncoding: BufferEncoding | undefined,
2559
+ outputEncoding: BufferEncoding,
2560
+ ): string;
2561
+ final(): Buffer;
2562
+ final(outputEncoding: BufferEncoding): string;
2563
+ setAutoPadding(autoPadding?: boolean): this;
2564
+ }
2565
+ export interface DecipherGCM extends Decipheriv {
2566
+ setAuthTag(buffer: ArrayBufferView): this;
2567
+ setAAD(buffer: ArrayBufferView, options?: { plaintextLength: number }): this;
2568
+ }
2569
+ export interface DecipherChaCha20Poly1305 extends Decipheriv {
2570
+ setAuthTag(buffer: ArrayBufferView): this;
2571
+ setAAD(buffer: ArrayBufferView, options?: { plaintextLength: number }): this;
2572
+ }
2573
+ export function createCipheriv(
2574
+ algorithm: CipherGCMTypes,
2575
+ key: CipherKey,
2576
+ iv: BinaryLike,
2577
+ options?: CipherGCMOptions,
2578
+ ): CipherGCM;
2579
+ export function createCipheriv(
2580
+ algorithm: CipherChaCha20Poly1305Types,
2581
+ key: CipherKey,
2582
+ iv: BinaryLike,
2583
+ options?: CipherChaCha20Poly1305Options,
2584
+ ): CipherChaCha20Poly1305;
2585
+ export function createCipheriv(
2586
+ algorithm: string,
2587
+ key: CipherKey,
2588
+ iv: BinaryLike | null,
2589
+ options?: { authTagLength?: number },
2590
+ ): Cipheriv;
2591
+ export function createDecipheriv(
2592
+ algorithm: CipherGCMTypes,
2593
+ key: CipherKey,
2594
+ iv: BinaryLike,
2595
+ options?: CipherGCMOptions,
2596
+ ): DecipherGCM;
2597
+ export function createDecipheriv(
2598
+ algorithm: CipherChaCha20Poly1305Types,
2599
+ key: CipherKey,
2600
+ iv: BinaryLike,
2601
+ options?: CipherChaCha20Poly1305Options,
2602
+ ): DecipherChaCha20Poly1305;
2603
+ export function createDecipheriv(
2604
+ algorithm: string,
2605
+ key: CipherKey,
2606
+ iv: BinaryLike | null,
2607
+ options?: { authTagLength?: number },
2608
+ ): Decipheriv;
2445
2609
  export interface ScryptOptions {
2446
2610
  N?: number;
2447
2611
  r?: number;
@@ -2780,7 +2944,8 @@ declare module "child_process" {
2780
2944
  ): unknown;
2781
2945
  /* The async shell form — declared surface without full lowering (the
2782
2946
  * type-level tolerance story): harness code on paths tests don't reach
2783
- * must typecheck; a reached call fences at its site. */
2947
+ * must typecheck; a reached call fences at its site. util.promisify
2948
+ * recognizes it statically, as it does execFile. */
2784
2949
  export function exec(
2785
2950
  command: string,
2786
2951
  options?: ExecSyncOptions | ((error: Error | null, stdout: string, stderr: string) => void),
@@ -2791,9 +2956,10 @@ declare module "node:child_process" {
2791
2956
  export * from "child_process";
2792
2957
  }
2793
2958
 
2794
- /* node:util — compile-time projections for child_process.execFile and
2795
- * fs.readFile. The former retains Node's custom { stdout, stderr } result;
2796
- * the latter resolves the callback's data argument. Other targets and bare
2959
+ /* node:util — compile-time projections for child_process.execFile,
2960
+ * child_process.exec and fs.readFile. The first two retain Node's custom
2961
+ * { stdout, stderr } result; the last resolves the callback's data
2962
+ * argument. Other targets and bare
2797
2963
  * promisify values fence per site. */
2798
2964
  declare module "util" {
2799
2965
  export * as types from "util/types";
@@ -2885,6 +3051,18 @@ declare module "util" {
2885
3051
  windowsHide?: boolean;
2886
3052
  },
2887
3053
  ) => Promise<{ stdout: string; stderr: string }>;
3054
+ export function promisify(fn: typeof import("node:child_process").exec): (
3055
+ command: string,
3056
+ options?: {
3057
+ encoding?: "utf8" | "utf-8";
3058
+ cwd?: string;
3059
+ env?: { [k: string]: string | undefined };
3060
+ timeout?: number;
3061
+ maxBuffer?: number;
3062
+ killSignal?: string;
3063
+ windowsHide?: boolean;
3064
+ },
3065
+ ) => Promise<{ stdout: string; stderr: string }>;
2888
3066
  /* Declared surface without full lowering (the type-level tolerance
2889
3067
  * story: guarded/diagnostic-path code must TYPECHECK; a reached use
2890
3068
  * without a lowering fences at its site). inspect's options carry the
@@ -3019,7 +3197,9 @@ declare module "node:test" {
3019
3197
  }
3020
3198
  interface TestContext {
3021
3199
  readonly name: string;
3200
+ readonly fullName: string;
3022
3201
  readonly assert: TestContextAssert;
3202
+ readonly mock: MockTracker;
3023
3203
  test(name: string, fn?: TestFn): Promise<void>;
3024
3204
  test(name: string, options: TestOptions, fn?: TestFn): Promise<void>;
3025
3205
  skip(message?: string): void;
@@ -3069,10 +3249,45 @@ declare module "node:test" {
3069
3249
  function after(fn: HookFn): void;
3070
3250
  function beforeEach(fn: HookFn): void;
3071
3251
  function afterEach(fn: HookFn): void;
3252
+ /* The mock function surface: mock.fn and t.mock.fn, with the calls log
3253
+ * and the implementation controls on fn.mock. */
3254
+ interface MockFunctionCall<
3255
+ F extends Function,
3256
+ ReturnType = F extends (...args: any) => infer T ? T : unknown,
3257
+ Args = F extends (...args: infer Y) => any ? Y : unknown[],
3258
+ > {
3259
+ arguments: Args;
3260
+ error: unknown | undefined;
3261
+ result: ReturnType | undefined;
3262
+ this: unknown;
3263
+ }
3264
+ interface MockFunctionContext<F extends Function> {
3265
+ readonly calls: MockFunctionCall<F>[];
3266
+ callCount(): number;
3267
+ mockImplementation(implementation: F): void;
3268
+ mockImplementationOnce(implementation: F, onCall?: number): void;
3269
+ resetCalls(): void;
3270
+ restore(): void;
3271
+ }
3272
+ type Mock<F extends Function> = F & { mock: MockFunctionContext<F> };
3273
+ interface MockTracker {
3274
+ fn<F extends Function = (...args: any[]) => undefined>(original?: F): Mock<F>;
3275
+ fn<F extends Function = (...args: any[]) => undefined, Implementation extends Function = F>(
3276
+ original?: F,
3277
+ implementation?: Implementation,
3278
+ ): Mock<F | Implementation>;
3279
+ method<MockedObject extends object>(
3280
+ object: MockedObject,
3281
+ methodName: keyof MockedObject,
3282
+ implementation?: Function,
3283
+ ): Mock<Function>;
3284
+ reset(): void;
3285
+ restoreAll(): void;
3286
+ }
3287
+ const mock: MockTracker;
3072
3288
  /* Declared for typechecking only — every use fences (no lowering).
3073
3289
  * `assert` is the module-level custom-assertion registry (v24's
3074
3290
  * `const { assert } = require('node:test')`), not TestContext.assert. */
3075
- const mock: unknown;
3076
3291
  const assert: { register(name: string, fn: (...args: unknown[]) => unknown): void };
3077
3292
  function run(options?: unknown): unknown;
3078
3293
  function snapshot(...args: unknown[]): unknown;
@@ -3091,6 +3306,10 @@ declare module "node:test" {
3091
3306
  snapshot,
3092
3307
  TestContext,
3093
3308
  TestOptions,
3309
+ Mock,
3310
+ MockFunctionContext,
3311
+ MockFunctionCall,
3312
+ MockTracker,
3094
3313
  };
3095
3314
  export default test;
3096
3315
  }
@@ -3098,11 +3317,28 @@ declare module "node:test" {
3098
3317
  declare module "assert" {
3099
3318
  function assert(value: unknown, message?: string): void;
3100
3319
  namespace assert {
3320
+ interface AssertionErrorOptions {
3321
+ message?: string | undefined;
3322
+ actual?: unknown;
3323
+ expected?: unknown;
3324
+ operator?: string | undefined;
3325
+ stackStartFn?: Function | undefined;
3326
+ diff?: "simple" | "full" | undefined;
3327
+ }
3328
+ class AssertionError extends Error {
3329
+ constructor(options: AssertionErrorOptions);
3330
+ actual: unknown;
3331
+ expected: unknown;
3332
+ generatedMessage: boolean;
3333
+ code: "ERR_ASSERTION";
3334
+ operator: string;
3335
+ }
3101
3336
  function ok(value: unknown, message?: string): void;
3102
3337
  function strictEqual(actual: unknown, expected: unknown, message?: string): void;
3103
3338
  function notStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3104
3339
  function deepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3105
3340
  function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3341
+ function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3106
3342
  function equal(actual: unknown, expected: unknown, message?: string): void;
3107
3343
  function notEqual(actual: unknown, expected: unknown, message?: string): void;
3108
3344
  function deepEqual(actual: unknown, expected: unknown, message?: string): void;
@@ -3124,6 +3360,36 @@ declare module "assert" {
3124
3360
  function doesNotMatch(value: string, regExp: RegExp, message?: string): void;
3125
3361
  function ifError(value: unknown): void;
3126
3362
  const strict: typeof import("assert/strict");
3363
+ interface AssertOptions {
3364
+ diff?: "simple" | "full" | undefined;
3365
+ strict?: boolean | undefined;
3366
+ skipPrototype?: boolean | undefined;
3367
+ }
3368
+ type AssertMethodNames =
3369
+ | "deepEqual"
3370
+ | "deepStrictEqual"
3371
+ | "doesNotMatch"
3372
+ | "doesNotReject"
3373
+ | "doesNotThrow"
3374
+ | "equal"
3375
+ | "fail"
3376
+ | "ifError"
3377
+ | "match"
3378
+ | "notDeepEqual"
3379
+ | "notDeepStrictEqual"
3380
+ | "notEqual"
3381
+ | "notStrictEqual"
3382
+ | "ok"
3383
+ | "partialDeepStrictEqual"
3384
+ | "rejects"
3385
+ | "strictEqual"
3386
+ | "throws";
3387
+ interface Assert extends Pick<typeof assert, AssertMethodNames> {}
3388
+ interface AssertStrict extends Pick<typeof strict, AssertMethodNames> {}
3389
+ const Assert: {
3390
+ new (options?: AssertOptions & { strict?: true | undefined }): AssertStrict;
3391
+ new (options: AssertOptions): Assert;
3392
+ };
3127
3393
  }
3128
3394
  export = assert;
3129
3395
  }
@@ -3146,6 +3412,7 @@ declare module "assert/strict" {
3146
3412
  function notStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3147
3413
  function deepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3148
3414
  function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3415
+ function partialDeepStrictEqual(actual: unknown, expected: unknown, message?: string): void;
3149
3416
  function fail(message?: string): never;
3150
3417
  function throws(fn: () => unknown, expected?: unknown, message?: string): void;
3151
3418
  function doesNotThrow(fn: () => unknown, expected?: unknown, message?: string): void;
@@ -3163,6 +3430,10 @@ declare module "assert/strict" {
3163
3430
  function doesNotMatch(value: string, regExp: RegExp, message?: string): void;
3164
3431
  function ifError(value: unknown): void;
3165
3432
  const strict: typeof import("assert/strict");
3433
+ type AssertOptions = import("assert").AssertOptions;
3434
+ type Assert = import("assert").Assert;
3435
+ type AssertStrict = import("assert").AssertStrict;
3436
+ const Assert: typeof import("assert").Assert;
3166
3437
  }
3167
3438
  export = strict;
3168
3439
  }
@@ -3332,9 +3603,12 @@ declare module "node:readline/promises" {
3332
3603
  /* node:zlib — the one-shot zlib/raw/gzip codecs lower for string/Buffer
3333
3604
  * inputs with Node's default options; libz links only into zlib-using
3334
3605
  * binaries. Callback forms use the executable worker pool. Options stay
3335
- * declared so reached uses receive a named SC2020 refusal; Brotli,
3336
- * streaming, and Zstd remain outside the lowered surface. */
3606
+ * declared so reached uses receive a named SC2020 refusal. The Deflate,
3607
+ * Inflate, Gzip, Gunzip, DeflateRaw, InflateRaw and Unzip streams are
3608
+ * runtime Transform streams; Brotli and Zstd remain outside the lowered
3609
+ * surface. */
3337
3610
  declare module "zlib" {
3611
+ import { Transform } from "stream";
3338
3612
  export interface ZlibOptions {
3339
3613
  [option: string]: unknown;
3340
3614
  }
@@ -3391,6 +3665,340 @@ declare module "zlib" {
3391
3665
  export function crc32(data: string | Uint8Array, value?: number): number;
3392
3666
  export function brotliCompressSync(data: string | Uint8Array): Buffer;
3393
3667
  export function brotliDecompressSync(data: Uint8Array): Buffer;
3668
+ /* Brotli needs a codec the static runtime does not vendor: these are
3669
+ * declared so their uses receive the named refusal. */
3670
+ export function brotliCompress(data: string | Uint8Array, callback: ZlibCallback): void;
3671
+ export function brotliDecompress(data: Uint8Array, callback: ZlibCallback): void;
3672
+ export function createBrotliCompress(options?: ZlibOptions): Transform;
3673
+ export function createBrotliDecompress(options?: ZlibOptions): Transform;
3674
+ export class BrotliCompress extends Transform {
3675
+ constructor(options?: ZlibOptions);
3676
+ }
3677
+ export class BrotliDecompress extends Transform {
3678
+ constructor(options?: ZlibOptions);
3679
+ }
3680
+ /* The stream classes: runtime Transform streams over the zlib engine
3681
+ * (scr_zlib_stream.c). createGzip(options) and new Gzip(options) build
3682
+ * the same stream; options are validated at runtime with Node's rules. */
3683
+ class ZlibBase extends Transform {
3684
+ readonly bytesWritten: number;
3685
+ flush(kind?: number, callback?: () => void): void;
3686
+ flush(callback: () => void): void;
3687
+ params(level: number, strategy: number, callback?: () => void): void;
3688
+ close(callback?: () => void): void;
3689
+ reset(): void;
3690
+ }
3691
+ export class Deflate extends ZlibBase {
3692
+ constructor(options?: ZlibOptions);
3693
+ }
3694
+ export class Inflate extends ZlibBase {
3695
+ constructor(options?: ZlibOptions);
3696
+ }
3697
+ export class Gzip extends ZlibBase {
3698
+ constructor(options?: ZlibOptions);
3699
+ }
3700
+ export class Gunzip extends ZlibBase {
3701
+ constructor(options?: ZlibOptions);
3702
+ }
3703
+ export class DeflateRaw extends ZlibBase {
3704
+ constructor(options?: ZlibOptions);
3705
+ }
3706
+ export class InflateRaw extends ZlibBase {
3707
+ constructor(options?: ZlibOptions);
3708
+ }
3709
+ export class Unzip extends ZlibBase {
3710
+ constructor(options?: ZlibOptions);
3711
+ }
3712
+ export function createDeflate(options?: ZlibOptions): Deflate;
3713
+ export function createInflate(options?: ZlibOptions): Inflate;
3714
+ export function createGzip(options?: ZlibOptions): Gzip;
3715
+ export function createGunzip(options?: ZlibOptions): Gunzip;
3716
+ export function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
3717
+ export function createInflateRaw(options?: ZlibOptions): InflateRaw;
3718
+ export function createUnzip(options?: ZlibOptions): Unzip;
3719
+ /* Node v24 zlib.constants, literal-typed (the CryptoConstants stance):
3720
+ * every access bakes as its literal; the object never materializes. The
3721
+ * members outside BROTLI_* are also module properties (zlib.Z_SYNC_FLUSH). */
3722
+ export interface ZlibConstants {
3723
+ readonly Z_NO_FLUSH: 0;
3724
+ readonly Z_PARTIAL_FLUSH: 1;
3725
+ readonly Z_SYNC_FLUSH: 2;
3726
+ readonly Z_FULL_FLUSH: 3;
3727
+ readonly Z_FINISH: 4;
3728
+ readonly Z_BLOCK: 5;
3729
+ readonly Z_OK: 0;
3730
+ readonly Z_STREAM_END: 1;
3731
+ readonly Z_NEED_DICT: 2;
3732
+ readonly Z_ERRNO: -1;
3733
+ readonly Z_STREAM_ERROR: -2;
3734
+ readonly Z_DATA_ERROR: -3;
3735
+ readonly Z_MEM_ERROR: -4;
3736
+ readonly Z_BUF_ERROR: -5;
3737
+ readonly Z_VERSION_ERROR: -6;
3738
+ readonly Z_NO_COMPRESSION: 0;
3739
+ readonly Z_BEST_SPEED: 1;
3740
+ readonly Z_BEST_COMPRESSION: 9;
3741
+ readonly Z_DEFAULT_COMPRESSION: -1;
3742
+ readonly Z_FILTERED: 1;
3743
+ readonly Z_HUFFMAN_ONLY: 2;
3744
+ readonly Z_RLE: 3;
3745
+ readonly Z_FIXED: 4;
3746
+ readonly Z_DEFAULT_STRATEGY: 0;
3747
+ readonly ZLIB_VERNUM: 4897;
3748
+ readonly DEFLATE: 1;
3749
+ readonly INFLATE: 2;
3750
+ readonly GZIP: 3;
3751
+ readonly GUNZIP: 4;
3752
+ readonly DEFLATERAW: 5;
3753
+ readonly INFLATERAW: 6;
3754
+ readonly UNZIP: 7;
3755
+ readonly BROTLI_DECODE: 8;
3756
+ readonly BROTLI_ENCODE: 9;
3757
+ readonly ZSTD_DECOMPRESS: 11;
3758
+ readonly ZSTD_COMPRESS: 10;
3759
+ readonly Z_MIN_WINDOWBITS: 8;
3760
+ readonly Z_MAX_WINDOWBITS: 15;
3761
+ readonly Z_DEFAULT_WINDOWBITS: 15;
3762
+ readonly Z_MIN_CHUNK: 64;
3763
+ readonly Z_MAX_CHUNK: number;
3764
+ readonly Z_DEFAULT_CHUNK: 16384;
3765
+ readonly Z_MIN_MEMLEVEL: 1;
3766
+ readonly Z_MAX_MEMLEVEL: 9;
3767
+ readonly Z_DEFAULT_MEMLEVEL: 8;
3768
+ readonly Z_MIN_LEVEL: -1;
3769
+ readonly Z_MAX_LEVEL: 9;
3770
+ readonly Z_DEFAULT_LEVEL: -1;
3771
+ readonly BROTLI_OPERATION_PROCESS: 0;
3772
+ readonly BROTLI_OPERATION_FLUSH: 1;
3773
+ readonly BROTLI_OPERATION_FINISH: 2;
3774
+ readonly BROTLI_OPERATION_EMIT_METADATA: 3;
3775
+ readonly BROTLI_PARAM_MODE: 0;
3776
+ readonly BROTLI_MODE_GENERIC: 0;
3777
+ readonly BROTLI_MODE_TEXT: 1;
3778
+ readonly BROTLI_MODE_FONT: 2;
3779
+ readonly BROTLI_DEFAULT_MODE: 0;
3780
+ readonly BROTLI_PARAM_QUALITY: 1;
3781
+ readonly BROTLI_MIN_QUALITY: 0;
3782
+ readonly BROTLI_MAX_QUALITY: 11;
3783
+ readonly BROTLI_DEFAULT_QUALITY: 11;
3784
+ readonly BROTLI_PARAM_LGWIN: 2;
3785
+ readonly BROTLI_MIN_WINDOW_BITS: 10;
3786
+ readonly BROTLI_MAX_WINDOW_BITS: 24;
3787
+ readonly BROTLI_LARGE_MAX_WINDOW_BITS: 30;
3788
+ readonly BROTLI_DEFAULT_WINDOW: 22;
3789
+ readonly BROTLI_PARAM_LGBLOCK: 3;
3790
+ readonly BROTLI_MIN_INPUT_BLOCK_BITS: 16;
3791
+ readonly BROTLI_MAX_INPUT_BLOCK_BITS: 24;
3792
+ readonly BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4;
3793
+ readonly BROTLI_PARAM_SIZE_HINT: 5;
3794
+ readonly BROTLI_PARAM_LARGE_WINDOW: 6;
3795
+ readonly BROTLI_PARAM_NPOSTFIX: 7;
3796
+ readonly BROTLI_PARAM_NDIRECT: 8;
3797
+ readonly BROTLI_DECODER_RESULT_ERROR: 0;
3798
+ readonly BROTLI_DECODER_RESULT_SUCCESS: 1;
3799
+ readonly BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2;
3800
+ readonly BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3;
3801
+ readonly BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0;
3802
+ readonly BROTLI_DECODER_PARAM_LARGE_WINDOW: 1;
3803
+ readonly BROTLI_DECODER_NO_ERROR: 0;
3804
+ readonly BROTLI_DECODER_SUCCESS: 1;
3805
+ readonly BROTLI_DECODER_NEEDS_MORE_INPUT: 2;
3806
+ readonly BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3;
3807
+ readonly BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1;
3808
+ readonly BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2;
3809
+ readonly BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3;
3810
+ readonly BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4;
3811
+ readonly BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5;
3812
+ readonly BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6;
3813
+ readonly BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7;
3814
+ readonly BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8;
3815
+ readonly BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9;
3816
+ readonly BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10;
3817
+ readonly BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11;
3818
+ readonly BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12;
3819
+ readonly BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13;
3820
+ readonly BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14;
3821
+ readonly BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15;
3822
+ readonly BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16;
3823
+ readonly BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19;
3824
+ readonly BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20;
3825
+ readonly BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21;
3826
+ readonly BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22;
3827
+ readonly BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25;
3828
+ readonly BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26;
3829
+ readonly BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27;
3830
+ readonly BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30;
3831
+ readonly BROTLI_DECODER_ERROR_UNREACHABLE: -31;
3832
+ readonly ZSTD_e_continue: 0;
3833
+ readonly ZSTD_e_flush: 1;
3834
+ readonly ZSTD_e_end: 2;
3835
+ readonly ZSTD_fast: 1;
3836
+ readonly ZSTD_dfast: 2;
3837
+ readonly ZSTD_greedy: 3;
3838
+ readonly ZSTD_lazy: 4;
3839
+ readonly ZSTD_lazy2: 5;
3840
+ readonly ZSTD_btlazy2: 6;
3841
+ readonly ZSTD_btopt: 7;
3842
+ readonly ZSTD_btultra: 8;
3843
+ readonly ZSTD_btultra2: 9;
3844
+ readonly ZSTD_c_compressionLevel: 100;
3845
+ readonly ZSTD_c_windowLog: 101;
3846
+ readonly ZSTD_c_hashLog: 102;
3847
+ readonly ZSTD_c_chainLog: 103;
3848
+ readonly ZSTD_c_searchLog: 104;
3849
+ readonly ZSTD_c_minMatch: 105;
3850
+ readonly ZSTD_c_targetLength: 106;
3851
+ readonly ZSTD_c_strategy: 107;
3852
+ readonly ZSTD_c_enableLongDistanceMatching: 160;
3853
+ readonly ZSTD_c_ldmHashLog: 161;
3854
+ readonly ZSTD_c_ldmMinMatch: 162;
3855
+ readonly ZSTD_c_ldmBucketSizeLog: 163;
3856
+ readonly ZSTD_c_ldmHashRateLog: 164;
3857
+ readonly ZSTD_c_contentSizeFlag: 200;
3858
+ readonly ZSTD_c_checksumFlag: 201;
3859
+ readonly ZSTD_c_dictIDFlag: 202;
3860
+ readonly ZSTD_c_nbWorkers: 400;
3861
+ readonly ZSTD_c_jobSize: 401;
3862
+ readonly ZSTD_c_overlapLog: 402;
3863
+ readonly ZSTD_d_windowLogMax: 100;
3864
+ readonly ZSTD_CLEVEL_DEFAULT: 3;
3865
+ readonly ZSTD_error_no_error: 0;
3866
+ readonly ZSTD_error_GENERIC: 1;
3867
+ readonly ZSTD_error_prefix_unknown: 10;
3868
+ readonly ZSTD_error_version_unsupported: 12;
3869
+ readonly ZSTD_error_frameParameter_unsupported: 14;
3870
+ readonly ZSTD_error_frameParameter_windowTooLarge: 16;
3871
+ readonly ZSTD_error_corruption_detected: 20;
3872
+ readonly ZSTD_error_checksum_wrong: 22;
3873
+ readonly ZSTD_error_literals_headerWrong: 24;
3874
+ readonly ZSTD_error_dictionary_corrupted: 30;
3875
+ readonly ZSTD_error_dictionary_wrong: 32;
3876
+ readonly ZSTD_error_dictionaryCreation_failed: 34;
3877
+ readonly ZSTD_error_parameter_unsupported: 40;
3878
+ readonly ZSTD_error_parameter_combination_unsupported: 41;
3879
+ readonly ZSTD_error_parameter_outOfBound: 42;
3880
+ readonly ZSTD_error_tableLog_tooLarge: 44;
3881
+ readonly ZSTD_error_maxSymbolValue_tooLarge: 46;
3882
+ readonly ZSTD_error_maxSymbolValue_tooSmall: 48;
3883
+ readonly ZSTD_error_stabilityCondition_notRespected: 50;
3884
+ readonly ZSTD_error_stage_wrong: 60;
3885
+ readonly ZSTD_error_init_missing: 62;
3886
+ readonly ZSTD_error_memory_allocation: 64;
3887
+ readonly ZSTD_error_workSpace_tooSmall: 66;
3888
+ readonly ZSTD_error_dstSize_tooSmall: 70;
3889
+ readonly ZSTD_error_srcSize_wrong: 72;
3890
+ readonly ZSTD_error_dstBuffer_null: 74;
3891
+ readonly ZSTD_error_noForwardProgress_destFull: 80;
3892
+ readonly ZSTD_error_noForwardProgress_inputEmpty: 82;
3893
+ }
3894
+ export const constants: ZlibConstants;
3895
+ export const Z_NO_FLUSH: 0;
3896
+ export const Z_PARTIAL_FLUSH: 1;
3897
+ export const Z_SYNC_FLUSH: 2;
3898
+ export const Z_FULL_FLUSH: 3;
3899
+ export const Z_FINISH: 4;
3900
+ export const Z_BLOCK: 5;
3901
+ export const Z_OK: 0;
3902
+ export const Z_STREAM_END: 1;
3903
+ export const Z_NEED_DICT: 2;
3904
+ export const Z_ERRNO: -1;
3905
+ export const Z_STREAM_ERROR: -2;
3906
+ export const Z_DATA_ERROR: -3;
3907
+ export const Z_MEM_ERROR: -4;
3908
+ export const Z_BUF_ERROR: -5;
3909
+ export const Z_VERSION_ERROR: -6;
3910
+ export const Z_NO_COMPRESSION: 0;
3911
+ export const Z_BEST_SPEED: 1;
3912
+ export const Z_BEST_COMPRESSION: 9;
3913
+ export const Z_DEFAULT_COMPRESSION: -1;
3914
+ export const Z_FILTERED: 1;
3915
+ export const Z_HUFFMAN_ONLY: 2;
3916
+ export const Z_RLE: 3;
3917
+ export const Z_FIXED: 4;
3918
+ export const Z_DEFAULT_STRATEGY: 0;
3919
+ export const ZLIB_VERNUM: 4897;
3920
+ export const DEFLATE: 1;
3921
+ export const INFLATE: 2;
3922
+ export const GZIP: 3;
3923
+ export const GUNZIP: 4;
3924
+ export const DEFLATERAW: 5;
3925
+ export const INFLATERAW: 6;
3926
+ export const UNZIP: 7;
3927
+ export const ZSTD_DECOMPRESS: 11;
3928
+ export const ZSTD_COMPRESS: 10;
3929
+ export const Z_MIN_WINDOWBITS: 8;
3930
+ export const Z_MAX_WINDOWBITS: 15;
3931
+ export const Z_DEFAULT_WINDOWBITS: 15;
3932
+ export const Z_MIN_CHUNK: 64;
3933
+ export const Z_MAX_CHUNK: number;
3934
+ export const Z_DEFAULT_CHUNK: 16384;
3935
+ export const Z_MIN_MEMLEVEL: 1;
3936
+ export const Z_MAX_MEMLEVEL: 9;
3937
+ export const Z_DEFAULT_MEMLEVEL: 8;
3938
+ export const Z_MIN_LEVEL: -1;
3939
+ export const Z_MAX_LEVEL: 9;
3940
+ export const Z_DEFAULT_LEVEL: -1;
3941
+ export const ZSTD_e_continue: 0;
3942
+ export const ZSTD_e_flush: 1;
3943
+ export const ZSTD_e_end: 2;
3944
+ export const ZSTD_fast: 1;
3945
+ export const ZSTD_dfast: 2;
3946
+ export const ZSTD_greedy: 3;
3947
+ export const ZSTD_lazy: 4;
3948
+ export const ZSTD_lazy2: 5;
3949
+ export const ZSTD_btlazy2: 6;
3950
+ export const ZSTD_btopt: 7;
3951
+ export const ZSTD_btultra: 8;
3952
+ export const ZSTD_btultra2: 9;
3953
+ export const ZSTD_c_compressionLevel: 100;
3954
+ export const ZSTD_c_windowLog: 101;
3955
+ export const ZSTD_c_hashLog: 102;
3956
+ export const ZSTD_c_chainLog: 103;
3957
+ export const ZSTD_c_searchLog: 104;
3958
+ export const ZSTD_c_minMatch: 105;
3959
+ export const ZSTD_c_targetLength: 106;
3960
+ export const ZSTD_c_strategy: 107;
3961
+ export const ZSTD_c_enableLongDistanceMatching: 160;
3962
+ export const ZSTD_c_ldmHashLog: 161;
3963
+ export const ZSTD_c_ldmMinMatch: 162;
3964
+ export const ZSTD_c_ldmBucketSizeLog: 163;
3965
+ export const ZSTD_c_ldmHashRateLog: 164;
3966
+ export const ZSTD_c_contentSizeFlag: 200;
3967
+ export const ZSTD_c_checksumFlag: 201;
3968
+ export const ZSTD_c_dictIDFlag: 202;
3969
+ export const ZSTD_c_nbWorkers: 400;
3970
+ export const ZSTD_c_jobSize: 401;
3971
+ export const ZSTD_c_overlapLog: 402;
3972
+ export const ZSTD_d_windowLogMax: 100;
3973
+ export const ZSTD_CLEVEL_DEFAULT: 3;
3974
+ export const ZSTD_error_no_error: 0;
3975
+ export const ZSTD_error_GENERIC: 1;
3976
+ export const ZSTD_error_prefix_unknown: 10;
3977
+ export const ZSTD_error_version_unsupported: 12;
3978
+ export const ZSTD_error_frameParameter_unsupported: 14;
3979
+ export const ZSTD_error_frameParameter_windowTooLarge: 16;
3980
+ export const ZSTD_error_corruption_detected: 20;
3981
+ export const ZSTD_error_checksum_wrong: 22;
3982
+ export const ZSTD_error_literals_headerWrong: 24;
3983
+ export const ZSTD_error_dictionary_corrupted: 30;
3984
+ export const ZSTD_error_dictionary_wrong: 32;
3985
+ export const ZSTD_error_dictionaryCreation_failed: 34;
3986
+ export const ZSTD_error_parameter_unsupported: 40;
3987
+ export const ZSTD_error_parameter_combination_unsupported: 41;
3988
+ export const ZSTD_error_parameter_outOfBound: 42;
3989
+ export const ZSTD_error_tableLog_tooLarge: 44;
3990
+ export const ZSTD_error_maxSymbolValue_tooLarge: 46;
3991
+ export const ZSTD_error_maxSymbolValue_tooSmall: 48;
3992
+ export const ZSTD_error_stabilityCondition_notRespected: 50;
3993
+ export const ZSTD_error_stage_wrong: 60;
3994
+ export const ZSTD_error_init_missing: 62;
3995
+ export const ZSTD_error_memory_allocation: 64;
3996
+ export const ZSTD_error_workSpace_tooSmall: 66;
3997
+ export const ZSTD_error_dstSize_tooSmall: 70;
3998
+ export const ZSTD_error_srcSize_wrong: 72;
3999
+ export const ZSTD_error_dstBuffer_null: 74;
4000
+ export const ZSTD_error_noForwardProgress_destFull: 80;
4001
+ export const ZSTD_error_noForwardProgress_inputEmpty: 82;
3394
4002
  }
3395
4003
  declare module "node:zlib" {
3396
4004
  export * from "zlib";
@@ -3415,6 +4023,17 @@ declare module "net" {
3415
4023
  ref(): void;
3416
4024
  unref(): void;
3417
4025
  readonly remoteAddress: string | undefined;
4026
+ /* The peer's fields are cached at first read, like remoteAddress; the
4027
+ * local ones are undefined while connecting and after close. */
4028
+ readonly remotePort: number | undefined;
4029
+ readonly remoteFamily: string | undefined;
4030
+ readonly localAddress: string | undefined;
4031
+ readonly localPort: number | undefined;
4032
+ readonly localFamily: string | undefined;
4033
+ readonly bytesRead: number;
4034
+ readonly connecting: boolean;
4035
+ readonly pending: boolean;
4036
+ readonly readyState: "opening" | "open" | "readOnly" | "writeOnly" | "closed";
3418
4037
  /* true once the fd is gone (destroy() or full close) — Node's flag. */
3419
4038
  readonly destroyed: boolean;
3420
4039
  /* the write half is open: no end() yet, no FIN sent, fd alive. */
@@ -3424,8 +4043,11 @@ declare module "net" {
3424
4043
  /* every byte the write paths accepted (buffered included — Node
3425
4044
  * counts those too; plaintext on TLS sockets). */
3426
4045
  readonly bytesWritten: number;
3427
- write(data: string | Uint8Array): void;
3428
- end(data?: string | Uint8Array): void;
4046
+ /* write's callback runs once the data is flushed, with null; end's
4047
+ * once the socket finishes. */
4048
+ write(data: string | Uint8Array, callback?: (err?: Error | null) => void): void;
4049
+ end(callback?: () => void): void;
4050
+ end(data: string | Uint8Array, callback?: () => void): void;
3429
4051
  destroy(): void;
3430
4052
  /* Flow control: pause holds reads off (kernel/TCP backpressure is
3431
4053
  * the buffer); resume flows — and discards without listeners, so
@@ -3434,8 +4056,15 @@ declare module "net" {
3434
4056
  resume(): Socket;
3435
4057
  /* TCP_NODELAY on the live fd; missing means true. Chains. */
3436
4058
  setNoDelay(noDelay?: boolean): Socket;
4059
+ /* SO_KEEPALIVE with the initial delay in ms. Chains. */
4060
+ setKeepAlive(enable?: boolean, initialDelay?: number): Socket;
3437
4061
  /* end() now, destroy once the FIN actually flushed. */
3438
4062
  destroySoon(): void;
4063
+ /* An RST instead of a FIN; a connecting socket resets once it
4064
+ * connects. Throws ERR_INVALID_HANDLE_TYPE on a TLS socket. */
4065
+ resetAndDestroy(): Socket;
4066
+ /* The local address, or {} while connecting and once destroyed. */
4067
+ address(): AddressInfo | {};
3439
4068
  /* setEncoding('utf8'): 'data' delivers strings — the IncomingMessage
3440
4069
  * twin's contract. */
3441
4070
  setEncoding(encoding: string): void;
@@ -3444,7 +4073,8 @@ declare module "net" {
3444
4073
  pipe(
3445
4074
  destination: Socket | import("http").ServerResponse | import("http2").Http2ServerResponse,
3446
4075
  ): void;
3447
- setTimeout(ms: number): void;
4076
+ /* The callback is a once('timeout') listener (removed again by 0). */
4077
+ setTimeout(ms: number, callback?: () => void): void;
3448
4078
  /* The paused-mode demux surface: once('readable') + read(1) +
3449
4079
  * unshift — read answers exactly n buffered bytes or null. */
3450
4080
  read(size?: number): Buffer | null;
@@ -3455,25 +4085,34 @@ declare module "net" {
3455
4085
  * registration never fires — Node's exact split. 'session' fires
3456
4086
  * once with the serialized session (the received-ticket event). */
3457
4087
  on(event: "data", listener: (chunk: Buffer) => void): void;
4088
+ /* After setEncoding the chunk is a string. */
4089
+ on(event: "data", listener: (chunk: string) => void): void;
3458
4090
  on(
3459
- event: "end" | "close" | "connect" | "timeout" | "readable" | "finish" | "secureConnect",
4091
+ event: "end" | "connect" | "ready" | "timeout" | "readable" | "finish" | "secureConnect",
3460
4092
  listener: () => void,
3461
4093
  ): void;
4094
+ on(event: "close", listener: (hadError: boolean) => void): void;
3462
4095
  on(event: "error", listener: (err: Error) => void): void;
3463
4096
  on(event: "session", listener: (session: Buffer) => void): void;
3464
4097
  /* addListener IS on (Node aliases them) — the suite spells both. */
3465
4098
  addListener(event: "data", listener: (chunk: Buffer) => void): void;
4099
+ /* After setEncoding the chunk is a string. */
4100
+ addListener(event: "data", listener: (chunk: string) => void): void;
3466
4101
  addListener(
3467
- event: "end" | "close" | "connect" | "timeout" | "readable" | "finish" | "secureConnect",
4102
+ event: "end" | "connect" | "ready" | "timeout" | "readable" | "finish" | "secureConnect",
3468
4103
  listener: () => void,
3469
4104
  ): void;
4105
+ addListener(event: "close", listener: (hadError: boolean) => void): void;
3470
4106
  addListener(event: "error", listener: (err: Error) => void): void;
3471
4107
  addListener(event: "session", listener: (session: Buffer) => void): void;
3472
4108
  once(event: "data", listener: (chunk: Buffer) => void): void;
4109
+ /* After setEncoding the chunk is a string. */
4110
+ once(event: "data", listener: (chunk: string) => void): void;
3473
4111
  once(
3474
- event: "end" | "close" | "connect" | "timeout" | "readable" | "finish" | "secureConnect",
4112
+ event: "end" | "connect" | "ready" | "timeout" | "readable" | "finish" | "secureConnect",
3475
4113
  listener: () => void,
3476
4114
  ): void;
4115
+ once(event: "close", listener: (hadError: boolean) => void): void;
3477
4116
  once(event: "error", listener: (err: Error) => void): void;
3478
4117
  once(event: "session", listener: (session: Buffer) => void): void;
3479
4118
  }
@@ -3482,6 +4121,13 @@ declare module "net" {
3482
4121
  ref(): void;
3483
4122
  unref(): void;
3484
4123
  readonly listening: boolean;
4124
+ /* Connections past this many are closed with a 'drop' event;
4125
+ * undefined (the default) or null lifts the cap. */
4126
+ maxConnections: number | undefined;
4127
+ /* Node reads it only in cluster mode: a stored value here. */
4128
+ dropMaxConnection: boolean | undefined;
4129
+ /* cb(null, count) on the next tick. */
4130
+ getConnections(callback: (error: Error | null, count: number) => void): Server;
3485
4131
  /* Node answers the server itself (`return this` chaining). */
3486
4132
  listen(port: number, callback?: () => void): Server;
3487
4133
  /* The positional bind address (the options form's host in argument
@@ -3503,6 +4149,7 @@ declare module "net" {
3503
4149
  emit(event: "connection", socket: Socket): boolean;
3504
4150
  on(event: "connection" | "secureConnection", listener: (socket: Socket) => void): void;
3505
4151
  on(event: "close" | "listening", listener: () => void): void;
4152
+ on(event: "drop", listener: (data?: DropArgument) => void): void;
3506
4153
  on(event: "timeout", listener: (socket: Socket) => void): void;
3507
4154
  on(event: "error", listener: (err: Error) => void): void;
3508
4155
  /* The WebSocket handover: fires INSTEAD of 'request' for
@@ -3520,6 +4167,7 @@ declare module "net" {
3520
4167
  /* addListener IS on (Node aliases them) — the suite spells both. */
3521
4168
  addListener(event: "connection" | "secureConnection", listener: (socket: Socket) => void): void;
3522
4169
  addListener(event: "close" | "listening", listener: () => void): void;
4170
+ addListener(event: "drop", listener: (data?: DropArgument) => void): void;
3523
4171
  addListener(event: "timeout", listener: (socket: Socket) => void): void;
3524
4172
  addListener(event: "error", listener: (err: Error) => void): void;
3525
4173
  addListener(
@@ -3532,6 +4180,7 @@ declare module "net" {
3532
4180
  ): void;
3533
4181
  once(event: "connection" | "secureConnection", listener: (socket: Socket) => void): void;
3534
4182
  once(event: "close" | "listening", listener: () => void): void;
4183
+ once(event: "drop", listener: (data?: DropArgument) => void): void;
3535
4184
  once(event: "timeout", listener: (socket: Socket) => void): void;
3536
4185
  once(event: "error", listener: (err: Error) => void): void;
3537
4186
  once(
@@ -3543,6 +4192,20 @@ declare module "net" {
3543
4192
  listener: (req: import("http").IncomingMessage, res: import("http").ServerResponse) => void,
3544
4193
  ): void;
3545
4194
  }
4195
+ /* The 'drop' payload: the turned-away connection's addresses. */
4196
+ export interface DropArgument {
4197
+ localAddress?: string;
4198
+ localPort?: number;
4199
+ localFamily?: string;
4200
+ remoteAddress?: string;
4201
+ remotePort?: number;
4202
+ remoteFamily?: string;
4203
+ }
4204
+ export type AddressInfo = import("node:dgram").AddressInfo;
4205
+ /* Node's IPv4Reg and IPv6Reg tests: 4, 6, or 0 for isIP. */
4206
+ export function isIP(input: string): number;
4207
+ export function isIPv4(input: string): boolean;
4208
+ export function isIPv6(input: string): boolean;
3546
4209
  /* The Socket VALUE — the `x instanceof net.Socket` narrowing target
3547
4210
  * (the h2 compat 'connect' listener's test). Constructing bare sockets
3548
4211
  * has no lowering; the construct signature exists for instanceof. */
@@ -3708,8 +4371,11 @@ declare module "http" {
3708
4371
  /* Node's writable head properties: the implicit head reads them. */
3709
4372
  statusCode: number;
3710
4373
  statusMessage: string | undefined;
3711
- setHeader(name: string, value: string | number): void;
3712
- getHeader(name: string): string | undefined;
4374
+ /* The value keeps its type: getHeader answers the number, string or
4375
+ * array that was set. */
4376
+ setHeader(name: string, value: number | string | readonly string[]): void;
4377
+ appendHeader(name: string, value: string | readonly string[]): void;
4378
+ getHeader(name: string): number | string | string[] | undefined;
3713
4379
  getHeaderNames(): string[];
3714
4380
  getRawHeaderNames(): string[];
3715
4381
  getHeaders(): OutgoingHttpHeaders;
@@ -3930,7 +4596,7 @@ declare module "tls" {
3930
4596
  }
3931
4597
  export function createServer(
3932
4598
  options: TlsOptions,
3933
- secureConnectionListener?: (socket: Socket) => void,
4599
+ secureConnectionListener?: (socket: TLSSocket) => void,
3934
4600
  ): Server;
3935
4601
  /** TLSSocket — post-handshake it IS a net socket to every lowered
3936
4602
  * member (the mapping collapses it onto the socket kind; the
@@ -3941,7 +4607,20 @@ declare module "tls" {
3941
4607
  export interface TLSSocket extends Socket {
3942
4608
  authorized: boolean;
3943
4609
  authorizationError: string | null;
4610
+ /* null before the handshake, then the negotiated protocol or false */
4611
+ readonly alpnProtocol: string | false | null;
4612
+ /* "TLSv1.2" or "TLSv1.3"; null before the handshake and after close */
4613
+ getProtocol(): string | null;
4614
+ /* OpenSSL's suite name, the IANA name and the suite's version */
4615
+ getCipher(): CipherNameAndProtocol;
4616
+ }
4617
+ export interface CipherNameAndProtocol {
4618
+ name: string;
4619
+ standardName: string;
4620
+ version: string;
3944
4621
  }
4622
+ export const DEFAULT_MIN_VERSION: string;
4623
+ export const DEFAULT_MAX_VERSION: string;
3945
4624
  /** tls.connect options — the RUNTIME options record (members read at
3946
4625
  * runtime; port/host/rejectUnauthorized/ca/servername are the
3947
4626
  * honestly-implemented set, every other documented member throws the
@@ -4728,8 +5407,9 @@ declare module "node:http2" {
4728
5407
  * Buffer datagram with an explicit port + address (the connected-send
4729
5408
  * and callback forms have no lowering); address() returns the real
4730
5409
  * {address, family, port} record and THROWS "Not running" before bind,
4731
- * like Node. 'error' with no listener exits 1 (the unhandled
4732
- * EventEmitter 'error' behavior). Multicast has no lowering. */
5410
+ * like Node. The socket options throw Node's errors (EBADF before bind);
5411
+ * add/dropMembership before bind is refused at run time (SC2020). 'error'
5412
+ * with no listener exits 1 (the unhandled EventEmitter 'error' behavior). */
4733
5413
  declare module "dgram" {
4734
5414
  export interface AddressInfo {
4735
5415
  address: string;
@@ -4748,8 +5428,22 @@ declare module "dgram" {
4748
5428
  send(msg: string | Uint8Array, port: number, address: string): void;
4749
5429
  address(): AddressInfo;
4750
5430
  close(callback?: () => void): void;
5431
+ disconnect(): void;
4751
5432
  unref(): void;
4752
5433
  ref(): void;
5434
+ setBroadcast(flag: boolean): void;
5435
+ setTTL(ttl: number): number;
5436
+ setMulticastTTL(ttl: number): number;
5437
+ setMulticastLoopback(flag: boolean): boolean;
5438
+ setMulticastInterface(multicastInterface: string): void;
5439
+ addMembership(multicastAddress: string, multicastInterface?: string): void;
5440
+ dropMembership(multicastAddress: string, multicastInterface?: string): void;
5441
+ getRecvBufferSize(): number;
5442
+ getSendBufferSize(): number;
5443
+ setRecvBufferSize(size: number): void;
5444
+ setSendBufferSize(size: number): void;
5445
+ getSendQueueSize(): number;
5446
+ getSendQueueCount(): number;
4753
5447
  on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): void;
4754
5448
  on(event: "listening" | "close" | "connect", listener: () => void): void;
4755
5449
  on(event: "error", listener: (err: Error) => void): void;
@@ -4771,14 +5465,55 @@ declare module "node:dgram" {
4771
5465
  * ENOTFOUND <hostname>") as the callback's Error argument, with "" for
4772
5466
  * the address where Node passes undefined. */
4773
5467
  declare module "dns" {
5468
+ export interface LookupAddress {
5469
+ address: string;
5470
+ family: number;
5471
+ }
5472
+ export interface LookupOptions {
5473
+ family?: number | "IPv4" | "IPv6";
5474
+ hints?: number;
5475
+ all?: boolean;
5476
+ order?: "ipv4first" | "ipv6first" | "verbatim";
5477
+ verbatim?: boolean;
5478
+ }
5479
+ export interface LookupOneOptions extends LookupOptions {
5480
+ all?: false;
5481
+ }
5482
+ export interface LookupAllOptions extends LookupOptions {
5483
+ all: true;
5484
+ }
5485
+ /* The callback comes with the other lookup deliveries (literal
5486
+ * addresses on the next tick); the options follow lib/dns.js. */
5487
+ export function lookup(
5488
+ hostname: string,
5489
+ callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
5490
+ ): void;
5491
+ export function lookup(
5492
+ hostname: string,
5493
+ family: number,
5494
+ callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
5495
+ ): void;
5496
+ export function lookup(
5497
+ hostname: string,
5498
+ options: LookupOneOptions,
5499
+ callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
5500
+ ): void;
4774
5501
  export function lookup(
4775
5502
  hostname: string,
4776
- /* The options-record stance (see http.RequestOptions): family is the
4777
- * lowered option ({ family: 4 }); hints/all/order/verbatim fence by
4778
- * name; undocumented keys drop like Node. */
4779
- options: { family: number; [option: string]: unknown },
4780
- callback: (err: Error | null, address: string, family: number) => void,
5503
+ options: LookupAllOptions,
5504
+ callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
4781
5505
  ): void;
5506
+ /* getnameinfo with NI_NAMEREQD: the host's name and the port's service
5507
+ * name (the number when it has none). */
5508
+ export function lookupService(
5509
+ address: string,
5510
+ port: number,
5511
+ callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
5512
+ ): void;
5513
+ /* The nameservers /etc/resolv.conf lists. */
5514
+ export function getServers(): string[];
5515
+ export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
5516
+ export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
4782
5517
  }
4783
5518
  declare module "node:dns" {
4784
5519
  export * from "dns";
@@ -4976,7 +5711,12 @@ declare module "events" {
4976
5711
  // The class under its own name, so `import { EventEmitter }` resolves
4977
5712
  // (the @types/node namespace-alias pattern).
4978
5713
  export { internal as EventEmitter };
4979
- export function once(emitter: EventEmitter, eventName: string): Promise<any[]>;
5714
+ // The event's arguments, as checked-dynamic values.
5715
+ export function once(
5716
+ emitter: EventEmitter,
5717
+ eventName: string,
5718
+ options?: { signal?: AbortSignal },
5719
+ ): Promise<unknown[]>;
4980
5720
  }
4981
5721
  export = EventEmitter;
4982
5722
  }
@@ -5101,6 +5841,14 @@ declare module "stream" {
5101
5841
  signal?: AbortSignal;
5102
5842
  }
5103
5843
 
5844
+ /* The operators' options: concurrency and highWaterMark bound map's
5845
+ * in-flight callbacks and queued results. */
5846
+ interface ArrayOptions {
5847
+ concurrency?: number;
5848
+ highWaterMark?: number;
5849
+ signal?: AbortSignal;
5850
+ }
5851
+
5104
5852
  class Readable extends EventEmitter {
5105
5853
  constructor(opts?: ReadableOptions);
5106
5854
  /* The underscore-method surface (@types/node declares these on the
@@ -5131,6 +5879,51 @@ declare module "stream" {
5131
5879
  readonly destroyed: boolean;
5132
5880
  readonly errored: Error | null;
5133
5881
  static from(iterable: unknown, options?: ReadableOptions): Readable;
5882
+ /* The Readable operators: chunks are strings or Buffers, map and
5883
+ * flatMap callbacks return strings or Buffers (flatMap: arrays of
5884
+ * them, or strings), and callbacks that declare the options argument
5885
+ * are refused. */
5886
+ map(
5887
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any,
5888
+ options?: ArrayOptions,
5889
+ ): Readable;
5890
+ filter(
5891
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
5892
+ options?: ArrayOptions,
5893
+ ): Readable;
5894
+ forEach(
5895
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>,
5896
+ options?: ArrayOptions,
5897
+ ): Promise<void>;
5898
+ toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;
5899
+ some(
5900
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
5901
+ options?: ArrayOptions,
5902
+ ): Promise<boolean>;
5903
+ find(
5904
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
5905
+ options?: ArrayOptions,
5906
+ ): Promise<any>;
5907
+ every(
5908
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
5909
+ options?: ArrayOptions,
5910
+ ): Promise<boolean>;
5911
+ flatMap(
5912
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any,
5913
+ options?: ArrayOptions,
5914
+ ): Readable;
5915
+ drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
5916
+ take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
5917
+ reduce<T = any>(
5918
+ fn: (previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T,
5919
+ initial?: undefined,
5920
+ options?: Pick<ArrayOptions, "signal">,
5921
+ ): Promise<T>;
5922
+ reduce<T = any>(
5923
+ fn: (previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T,
5924
+ initial: T,
5925
+ options?: Pick<ArrayOptions, "signal">,
5926
+ ): Promise<T>;
5134
5927
  on(event: "data", listener: (chunk: any) => void): this;
5135
5928
  on(event: "end" | "close" | "readable" | "pause" | "resume", listener: () => void): this;
5136
5929
  on(event: "error", listener: (err: Error) => void): this;
@@ -5347,6 +6140,9 @@ declare module "stream" {
5347
6140
  function addAbortSignal<T extends Readable | Writable>(signal: AbortSignal, stream: T): T;
5348
6141
  /* Declared so requires typecheck; each fences at its use site. */
5349
6142
  function pipeline(...streams: unknown[]): unknown;
6143
+ /* compose(...streams): a Duplex that writes to the first stream and
6144
+ * reads from the last, with the streams running as a pipeline. */
6145
+ function compose(...streams: Array<Readable | Writable>): Duplex;
5350
6146
  /* finished's options: readable/writable choose which ends count,
5351
6147
  * error: false ignores 'error' events, signal aborts the wait. */
5352
6148
  interface FinishedOptions {
@@ -5364,8 +6160,16 @@ declare module "stream" {
5364
6160
  /* Folds to the TARGET platform's default at compile time (win32 16384,
5365
6161
  * else 65536 — Node's own state.js split); literal argument only. */
5366
6162
  function getDefaultHighWaterMark(objectMode: boolean): number;
6163
+ /* The promise pipeline's result: a last stage that is an async
6164
+ * function resolves the promise with its value. */
6165
+ type PipelinePromise<T extends unknown[]> = T extends [
6166
+ ...unknown[],
6167
+ (...args: any[]) => Promise<infer P>,
6168
+ ]
6169
+ ? Promise<P>
6170
+ : Promise<void>;
5367
6171
  namespace promises {
5368
- function pipeline(...streams: unknown[]): Promise<void>;
6172
+ function pipeline<T extends unknown[]>(...streams: T): PipelinePromise<T>;
5369
6173
  function finished(
5370
6174
  stream: unknown,
5371
6175
  options?: FinishedOptions & { cleanup?: boolean },
@@ -5382,6 +6186,7 @@ declare module "stream" {
5382
6186
  Stream,
5383
6187
  addAbortSignal,
5384
6188
  pipeline,
6189
+ compose,
5385
6190
  finished,
5386
6191
  getDefaultHighWaterMark,
5387
6192
  promises,
@@ -5404,8 +6209,11 @@ declare module "stream/promises" {
5404
6209
  * ERR_STREAM_PREMATURE_CLOSE on an early close). Stream arguments are
5405
6210
  * the lowered surface — iterables/generators/functions fence per site.
5406
6211
  * pipeline's trailing { signal, end } object and finished's options
5407
- * (readable, writable, error, cleanup, signal) are supported. */
5408
- function pipeline(...streams: unknown[]): Promise<void>;
6212
+ * (readable, writable, error, cleanup, signal) are supported. A last
6213
+ * stage that is an async function resolves the promise with its value. */
6214
+ function pipeline<T extends unknown[]>(
6215
+ ...streams: T
6216
+ ): T extends [...unknown[], (...args: any[]) => Promise<infer P>] ? Promise<P> : Promise<void>;
5409
6217
  function finished(
5410
6218
  stream: unknown,
5411
6219
  options?: {