@scriptc/compiler 0.4.6 → 0.4.8

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 (1082) hide show
  1. package/ambient/node-fallback/child_process.d.ts +71 -22
  2. package/ambient/node-fallback/crypto.d.ts +15 -7
  3. package/ambient/node-fallback/events.d.ts +29 -6
  4. package/ambient/node-fallback/fs-promises.d.ts +1 -1
  5. package/ambient/node-fallback/fs.d.ts +57 -12
  6. package/ambient/node-fallback/http.d.ts +26 -18
  7. package/ambient/node-fallback/https.d.ts +5 -2
  8. package/ambient/node-fallback/net.d.ts +25 -0
  9. package/ambient/node-fallback/os.d.ts +11 -1
  10. package/ambient/node-fallback/path-posix.d.ts +6 -0
  11. package/ambient/node-fallback/path-win32.d.ts +5 -0
  12. package/ambient/node-fallback/path.d.ts +2 -0
  13. package/ambient/node-fallback/querystring.d.ts +3 -3
  14. package/ambient/node-fallback/zlib.d.ts +31 -2
  15. package/ambient/scriptc-node-fallback.d.ts +95 -20
  16. package/ambient/scriptc.d.ts +7 -2
  17. package/dist/backend/executable-features.js +22 -1
  18. package/dist/backend/executable-features.js.map +1 -1
  19. package/dist/backend/immutability.d.ts +12 -1
  20. package/dist/backend/immutability.js +50 -4
  21. package/dist/backend/immutability.js.map +1 -1
  22. package/dist/backend/immutability.test.js +95 -1
  23. package/dist/backend/immutability.test.js.map +1 -1
  24. package/dist/backend/library-pack.d.ts +6 -0
  25. package/dist/backend/library-pack.js +18 -5
  26. package/dist/backend/library-pack.js.map +1 -1
  27. package/dist/backend/library-pack.test.d.ts +1 -0
  28. package/dist/backend/library-pack.test.js +28 -0
  29. package/dist/backend/library-pack.test.js.map +1 -0
  30. package/dist/backend/linker.d.ts +20 -2
  31. package/dist/backend/linker.js +221 -35
  32. package/dist/backend/linker.js.map +1 -1
  33. package/dist/backend/lld.d.ts +15 -6
  34. package/dist/backend/lld.js +24 -16
  35. package/dist/backend/lld.js.map +1 -1
  36. package/dist/backend/lld.test.js +13 -5
  37. package/dist/backend/lld.test.js.map +1 -1
  38. package/dist/backend/llvm/alloc.d.ts +15 -2
  39. package/dist/backend/llvm/alloc.js +172 -36
  40. package/dist/backend/llvm/alloc.js.map +1 -1
  41. package/dist/backend/llvm/alloc.test.js +69 -1
  42. package/dist/backend/llvm/alloc.test.js.map +1 -1
  43. package/dist/backend/llvm/arenas.d.ts +17 -4
  44. package/dist/backend/llvm/arenas.js +105 -10
  45. package/dist/backend/llvm/arenas.js.map +1 -1
  46. package/dist/backend/llvm/arenas.test.js +229 -0
  47. package/dist/backend/llvm/arenas.test.js.map +1 -1
  48. package/dist/backend/llvm/bytes-alias.js +10 -1
  49. package/dist/backend/llvm/bytes-alias.js.map +1 -1
  50. package/dist/backend/llvm/bytes-headers.js +6 -0
  51. package/dist/backend/llvm/bytes-headers.js.map +1 -1
  52. package/dist/backend/llvm/bytes-loop-versions.test.js +25 -0
  53. package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
  54. package/dist/backend/llvm/call-lifetimes.js +10 -0
  55. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  56. package/dist/backend/llvm/classes.d.ts +16 -9
  57. package/dist/backend/llvm/classes.js +142 -37
  58. package/dist/backend/llvm/classes.js.map +1 -1
  59. package/dist/backend/llvm/classes.test.js +42 -0
  60. package/dist/backend/llvm/classes.test.js.map +1 -1
  61. package/dist/backend/llvm/constant-callbacks.test.js +50 -1
  62. package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
  63. package/dist/backend/llvm/cpu-dispatch.d.ts +15 -5
  64. package/dist/backend/llvm/cpu-dispatch.js +34 -9
  65. package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
  66. package/dist/backend/llvm/dyn.d.ts +64 -3
  67. package/dist/backend/llvm/dyn.js +251 -15
  68. package/dist/backend/llvm/dyn.js.map +1 -1
  69. package/dist/backend/llvm/emit-function.js +68 -5
  70. package/dist/backend/llvm/emit-function.js.map +1 -1
  71. package/dist/backend/llvm/emit-module.js +226 -77
  72. package/dist/backend/llvm/emit-module.js.map +1 -1
  73. package/dist/backend/llvm/emit-module.test.d.ts +1 -0
  74. package/dist/backend/llvm/emit-module.test.js +52 -0
  75. package/dist/backend/llvm/emit-module.test.js.map +1 -0
  76. package/dist/backend/llvm/emit-statements.js +138 -34
  77. package/dist/backend/llvm/emit-statements.js.map +1 -1
  78. package/dist/backend/llvm/emitter.d.ts +142 -10
  79. package/dist/backend/llvm/emitter.js +523 -73
  80. package/dist/backend/llvm/emitter.js.map +1 -1
  81. package/dist/backend/llvm/emitter.test.js +31 -3
  82. package/dist/backend/llvm/emitter.test.js.map +1 -1
  83. package/dist/backend/llvm/expr-async.js +19 -1
  84. package/dist/backend/llvm/expr-async.js.map +1 -1
  85. package/dist/backend/llvm/expr-bytes.js +16 -1
  86. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  87. package/dist/backend/llvm/expr-calls.d.ts +4 -1
  88. package/dist/backend/llvm/expr-calls.js +38 -6
  89. package/dist/backend/llvm/expr-calls.js.map +1 -1
  90. package/dist/backend/llvm/expr-dynamic.js +237 -23
  91. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  92. package/dist/backend/llvm/expr-primitives.js +123 -12
  93. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  94. package/dist/backend/llvm/expr-records.d.ts +1 -1
  95. package/dist/backend/llvm/expr-records.js +124 -56
  96. package/dist/backend/llvm/expr-records.js.map +1 -1
  97. package/dist/backend/llvm/expr-stream-bridges.d.ts +8 -0
  98. package/dist/backend/llvm/expr-stream-bridges.js +59 -2
  99. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  100. package/dist/backend/llvm/expr-stream-callbacks.d.ts +16 -0
  101. package/dist/backend/llvm/expr-stream-callbacks.js +206 -20
  102. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  103. package/dist/backend/llvm/integer-values.d.ts +2 -0
  104. package/dist/backend/llvm/integer-values.js +6 -0
  105. package/dist/backend/llvm/integer-values.js.map +1 -1
  106. package/dist/backend/llvm/js-groups.d.ts +21 -0
  107. package/dist/backend/llvm/js-groups.js +277 -0
  108. package/dist/backend/llvm/js-groups.js.map +1 -0
  109. package/dist/backend/llvm/js-ic.d.ts +57 -1
  110. package/dist/backend/llvm/js-ic.js +389 -22
  111. package/dist/backend/llvm/js-ic.js.map +1 -1
  112. package/dist/backend/llvm/lib-dispatch.js +152 -1
  113. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  114. package/dist/backend/llvm/lib-filesystem.js +116 -11
  115. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  116. package/dist/backend/llvm/lib-network.js +33 -6
  117. package/dist/backend/llvm/lib-network.js.map +1 -1
  118. package/dist/backend/llvm/lib-process.js +180 -27
  119. package/dist/backend/llvm/lib-process.js.map +1 -1
  120. package/dist/backend/llvm/lib-shared.js +139 -2
  121. package/dist/backend/llvm/lib-shared.js.map +1 -1
  122. package/dist/backend/llvm/lib-stream.js +67 -0
  123. package/dist/backend/llvm/lib-stream.js.map +1 -1
  124. package/dist/backend/llvm/local-union-storage.test.js +32 -0
  125. package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
  126. package/dist/backend/llvm/loop-entry-versions.d.ts +2 -2
  127. package/dist/backend/llvm/loop-entry-versions.js +43 -21
  128. package/dist/backend/llvm/loop-entry-versions.js.map +1 -1
  129. package/dist/backend/llvm/loop-state.d.ts +7 -1
  130. package/dist/backend/llvm/loop-state.js +26 -3
  131. package/dist/backend/llvm/loop-state.js.map +1 -1
  132. package/dist/backend/llvm/map-entry-fusion.d.ts +8 -0
  133. package/dist/backend/llvm/map-entry-fusion.js +3 -3
  134. package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
  135. package/dist/backend/llvm/map-number-lookup.d.ts +3 -1
  136. package/dist/backend/llvm/map-number-lookup.js +7 -3
  137. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  138. package/dist/backend/llvm/map-number-lookup.test.js +58 -17
  139. package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
  140. package/dist/backend/llvm/nullable-unions.js +7 -6
  141. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  142. package/dist/backend/llvm/nullable-unions.test.js +4 -1
  143. package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
  144. package/dist/backend/llvm/receiver-brackets.test.d.ts +1 -0
  145. package/dist/backend/llvm/receiver-brackets.test.js +68 -0
  146. package/dist/backend/llvm/receiver-brackets.test.js.map +1 -0
  147. package/dist/backend/llvm/receivers.js +3 -0
  148. package/dist/backend/llvm/receivers.js.map +1 -1
  149. package/dist/backend/llvm/record-entry-fusion.d.ts +32 -0
  150. package/dist/backend/llvm/record-entry-fusion.js +217 -0
  151. package/dist/backend/llvm/record-entry-fusion.js.map +1 -0
  152. package/dist/backend/llvm/record-results.d.ts +5 -2
  153. package/dist/backend/llvm/record-results.js +13 -12
  154. package/dist/backend/llvm/record-results.js.map +1 -1
  155. package/dist/backend/llvm/record-views.d.ts +22 -2
  156. package/dist/backend/llvm/record-views.js +147 -12
  157. package/dist/backend/llvm/record-views.js.map +1 -1
  158. package/dist/backend/llvm/record-views.test.js +76 -0
  159. package/dist/backend/llvm/record-views.test.js.map +1 -1
  160. package/dist/backend/llvm/reference-effects.js +1 -0
  161. package/dist/backend/llvm/reference-effects.js.map +1 -1
  162. package/dist/backend/llvm/reference-writes.js +4 -0
  163. package/dist/backend/llvm/reference-writes.js.map +1 -1
  164. package/dist/backend/llvm/region-ir.js +1 -0
  165. package/dist/backend/llvm/region-ir.js.map +1 -1
  166. package/dist/backend/llvm/region-sites.d.ts +18 -0
  167. package/dist/backend/llvm/region-sites.js +79 -1
  168. package/dist/backend/llvm/region-sites.js.map +1 -1
  169. package/dist/backend/llvm/runtime-registries.test.js +53 -6
  170. package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
  171. package/dist/backend/llvm/serialized-ir-emission.test.js +3 -1
  172. package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
  173. package/dist/backend/llvm/shapes.d.ts +36 -3
  174. package/dist/backend/llvm/shapes.js +201 -16
  175. package/dist/backend/llvm/shapes.js.map +1 -1
  176. package/dist/backend/llvm/shapes.test.js +4 -0
  177. package/dist/backend/llvm/shapes.test.js.map +1 -1
  178. package/dist/backend/llvm/speculative-integers.d.ts +10 -1
  179. package/dist/backend/llvm/speculative-integers.js +59 -8
  180. package/dist/backend/llvm/speculative-integers.js.map +1 -1
  181. package/dist/backend/llvm/stack-objects.d.ts +1 -2
  182. package/dist/backend/llvm/stack-objects.js +8 -5
  183. package/dist/backend/llvm/stack-objects.js.map +1 -1
  184. package/dist/backend/llvm/unwind-abi.d.ts +3 -3
  185. package/dist/backend/llvm/unwind-abi.js +8 -3
  186. package/dist/backend/llvm/unwind-abi.js.map +1 -1
  187. package/dist/backend/llvm/walkers.d.ts +12 -0
  188. package/dist/backend/llvm/walkers.js +47 -3
  189. package/dist/backend/llvm/walkers.js.map +1 -1
  190. package/dist/backend/may-throw.js +12 -2
  191. package/dist/backend/may-throw.js.map +1 -1
  192. package/dist/backend/may-throw.test.js +13 -0
  193. package/dist/backend/may-throw.test.js.map +1 -1
  194. package/dist/backend/native/contracts.d.ts +94 -0
  195. package/dist/backend/native/executable.js +134 -10
  196. package/dist/backend/native/executable.js.map +1 -1
  197. package/dist/backend/native/helper-identity-record.d.ts +11 -0
  198. package/dist/backend/native/helper-identity-record.js +76 -0
  199. package/dist/backend/native/helper-identity-record.js.map +1 -0
  200. package/dist/backend/native/helper-identity-record.test.d.ts +1 -0
  201. package/dist/backend/native/helper-identity-record.test.js +101 -0
  202. package/dist/backend/native/helper-identity-record.test.js.map +1 -0
  203. package/dist/backend/native/library.js +10 -2
  204. package/dist/backend/native/library.js.map +1 -1
  205. package/dist/backend/native/runtime-inputs.js +8 -1
  206. package/dist/backend/native/runtime-inputs.js.map +1 -1
  207. package/dist/backend/native/vendor.d.ts +1 -1
  208. package/dist/backend/native/vendor.js +1 -1
  209. package/dist/backend/native/vendor.js.map +1 -1
  210. package/dist/backend/native-codegen-core.d.ts +13 -10
  211. package/dist/backend/native-codegen-core.js +26 -13
  212. package/dist/backend/native-codegen-core.js.map +1 -1
  213. package/dist/backend/native-codegen.js +30 -8
  214. package/dist/backend/native-codegen.js.map +1 -1
  215. package/dist/backend/native-codegen.test.js +110 -14
  216. package/dist/backend/native-codegen.test.js.map +1 -1
  217. package/dist/backend/native-link-info-core.d.ts +72 -0
  218. package/dist/backend/native-link-info-core.js.map +1 -1
  219. package/dist/backend/native-link-info.js +1 -0
  220. package/dist/backend/native-link-info.js.map +1 -1
  221. package/dist/backend/native-profile.d.ts +4 -1
  222. package/dist/backend/native-profile.js +12 -1
  223. package/dist/backend/native-profile.js.map +1 -1
  224. package/dist/backend/native-profile.test.js +10 -0
  225. package/dist/backend/native-profile.test.js.map +1 -1
  226. package/dist/backend/publication.d.ts +4 -1
  227. package/dist/backend/publication.js +4 -2
  228. package/dist/backend/publication.js.map +1 -1
  229. package/dist/backend/runtime-abi.d.ts +2 -2
  230. package/dist/backend/runtime-abi.js +2 -2
  231. package/dist/backend/runtime-pack-core.d.ts +46 -7
  232. package/dist/backend/runtime-pack-core.js +37 -2
  233. package/dist/backend/runtime-pack-core.js.map +1 -1
  234. package/dist/backend/runtime-pack-native.d.ts +18 -1
  235. package/dist/backend/runtime-pack-native.js +138 -29
  236. package/dist/backend/runtime-pack-native.js.map +1 -1
  237. package/dist/backend/runtime-pack-native.test.js +166 -4
  238. package/dist/backend/runtime-pack-native.test.js.map +1 -1
  239. package/dist/backend/runtime-pack-targets.test.js +3 -1
  240. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  241. package/dist/backend/runtime-pack.d.ts +7 -0
  242. package/dist/backend/runtime-pack.js +25 -3
  243. package/dist/backend/runtime-pack.js.map +1 -1
  244. package/dist/backend/runtime-pack.test.js +213 -12
  245. package/dist/backend/runtime-pack.test.js.map +1 -1
  246. package/dist/backend/tree-classes.d.ts +42 -0
  247. package/dist/backend/tree-classes.js +723 -0
  248. package/dist/backend/tree-classes.js.map +1 -0
  249. package/dist/backend/tree-classes.test.d.ts +1 -0
  250. package/dist/backend/tree-classes.test.js +338 -0
  251. package/dist/backend/tree-classes.test.js.map +1 -0
  252. package/dist/backend/vendor-archives.d.ts +8 -1
  253. package/dist/backend/vendor-archives.js +313 -8
  254. package/dist/backend/vendor-archives.js.map +1 -1
  255. package/dist/backend/vendor-inputs.d.ts +60 -3
  256. package/dist/backend/vendor-inputs.js +109 -3
  257. package/dist/backend/vendor-inputs.js.map +1 -1
  258. package/dist/backend/vendor-inputs.test.js +62 -1
  259. package/dist/backend/vendor-inputs.test.js.map +1 -1
  260. package/dist/backend/warm-cache.js +2 -0
  261. package/dist/backend/warm-cache.js.map +1 -1
  262. package/dist/compat/fetch-profile.d.ts +7 -1
  263. package/dist/compat/fetch-profile.js +25 -12
  264. package/dist/compat/fetch-profile.js.map +1 -1
  265. package/dist/compile-types.d.ts +7 -0
  266. package/dist/contracts/check.d.ts +3 -0
  267. package/dist/contracts/check.js +18 -5
  268. package/dist/contracts/check.js.map +1 -1
  269. package/dist/coverage/report.js +47 -0
  270. package/dist/coverage/report.js.map +1 -1
  271. package/dist/coverage/surface-manifest.js +1 -1
  272. package/dist/coverage/surface-manifest.js.map +1 -1
  273. package/dist/diagnostics/codes.d.ts +14 -0
  274. package/dist/diagnostics/codes.js +14 -0
  275. package/dist/diagnostics/codes.js.map +1 -1
  276. package/dist/diagnostics/diagnostic.d.ts +68 -0
  277. package/dist/diagnostics/diagnostic.js +186 -6
  278. package/dist/diagnostics/diagnostic.js.map +1 -1
  279. package/dist/diagnostics/dynamic-tier.js +3 -1
  280. package/dist/diagnostics/dynamic-tier.js.map +1 -1
  281. package/dist/diagnostics/envelope.d.ts +18 -0
  282. package/dist/diagnostics/envelope.js.map +1 -1
  283. package/dist/executable/executable-cache.d.ts +48 -0
  284. package/dist/executable/executable-cache.js +38 -0
  285. package/dist/executable/executable-cache.js.map +1 -1
  286. package/dist/executable/executable-cache.test.js +127 -1
  287. package/dist/executable/executable-cache.test.js.map +1 -1
  288. package/dist/executable/prepare.d.ts +13 -3
  289. package/dist/executable/prepare.js +438 -234
  290. package/dist/executable/prepare.js.map +1 -1
  291. package/dist/frontend/analysis.js +200 -18
  292. package/dist/frontend/analysis.js.map +1 -1
  293. package/dist/frontend/builtin-modules.d.ts +4 -0
  294. package/dist/frontend/builtin-modules.js +10 -0
  295. package/dist/frontend/builtin-modules.js.map +1 -1
  296. package/dist/frontend/early-errors.d.ts +24 -0
  297. package/dist/frontend/early-errors.js +836 -0
  298. package/dist/frontend/early-errors.js.map +1 -0
  299. package/dist/frontend/early-errors.test.d.ts +1 -0
  300. package/dist/frontend/early-errors.test.js +207 -0
  301. package/dist/frontend/early-errors.test.js.map +1 -0
  302. package/dist/frontend/inferred-js-diagnostics.test.js +88 -0
  303. package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
  304. package/dist/frontend/input-tracker.d.ts +47 -0
  305. package/dist/frontend/input-tracker.js +173 -36
  306. package/dist/frontend/input-tracker.js.map +1 -1
  307. package/dist/frontend/input-tracker.test.js +86 -2
  308. package/dist/frontend/input-tracker.test.js.map +1 -1
  309. package/dist/frontend/js-inference.d.ts +2 -0
  310. package/dist/frontend/js-inference.js +18 -0
  311. package/dist/frontend/js-inference.js.map +1 -0
  312. package/dist/frontend/jsx-opinion-sites.test.d.ts +1 -0
  313. package/dist/frontend/jsx-opinion-sites.test.js +86 -0
  314. package/dist/frontend/jsx-opinion-sites.test.js.map +1 -0
  315. package/dist/frontend/lib-exports.d.ts +23 -4
  316. package/dist/frontend/lib-exports.js +98 -26
  317. package/dist/frontend/lib-exports.js.map +1 -1
  318. package/dist/frontend/lowering/binding-analysis.d.ts +2 -1
  319. package/dist/frontend/lowering/binding-analysis.js +86 -4
  320. package/dist/frontend/lowering/binding-analysis.js.map +1 -1
  321. package/dist/frontend/lowering/buffers.d.ts +8 -0
  322. package/dist/frontend/lowering/buffers.js +43 -0
  323. package/dist/frontend/lowering/buffers.js.map +1 -0
  324. package/dist/frontend/lowering/builtin-calls.js +13 -0
  325. package/dist/frontend/lowering/builtin-calls.js.map +1 -1
  326. package/dist/frontend/lowering/builtin-namespaces.d.ts +3 -2
  327. package/dist/frontend/lowering/builtin-namespaces.js +41 -3
  328. package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
  329. package/dist/frontend/lowering/builtin-statics.d.ts +24 -0
  330. package/dist/frontend/lowering/builtin-statics.js +407 -0
  331. package/dist/frontend/lowering/builtin-statics.js.map +1 -0
  332. package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
  333. package/dist/frontend/lowering/builtins/arguments.js +12 -0
  334. package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
  335. package/dist/frontend/lowering/builtins/atomics.d.ts +6 -1
  336. package/dist/frontend/lowering/builtins/atomics.js +87 -1
  337. package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
  338. package/dist/frontend/lowering/builtins/child-process-methods.d.ts +7 -0
  339. package/dist/frontend/lowering/builtins/child-process-methods.js +52 -12
  340. package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
  341. package/dist/frontend/lowering/builtins/child-process-sync.d.ts +13 -0
  342. package/dist/frontend/lowering/builtins/child-process-sync.js +1 -13
  343. package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
  344. package/dist/frontend/lowering/builtins/child-process.d.ts +10 -4
  345. package/dist/frontend/lowering/builtins/child-process.js +565 -28
  346. package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
  347. package/dist/frontend/lowering/builtins/compression.d.ts +2 -2
  348. package/dist/frontend/lowering/builtins/compression.js +41 -21
  349. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  350. package/dist/frontend/lowering/builtins/constants.js +7 -2
  351. package/dist/frontend/lowering/builtins/constants.js.map +1 -1
  352. package/dist/frontend/lowering/builtins/dates.d.ts +1 -1
  353. package/dist/frontend/lowering/builtins/dates.js +23 -1
  354. package/dist/frontend/lowering/builtins/dates.js.map +1 -1
  355. package/dist/frontend/lowering/builtins/environment.d.ts +55 -0
  356. package/dist/frontend/lowering/builtins/environment.js +213 -2
  357. package/dist/frontend/lowering/builtins/environment.js.map +1 -1
  358. package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -0
  359. package/dist/frontend/lowering/builtins/filesystem-calls.js +75 -18
  360. package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
  361. package/dist/frontend/lowering/builtins/filesystem.d.ts +25 -7
  362. package/dist/frontend/lowering/builtins/filesystem.js +185 -16
  363. package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
  364. package/dist/frontend/lowering/builtins/json.js +4 -0
  365. package/dist/frontend/lowering/builtins/json.js.map +1 -1
  366. package/dist/frontend/lowering/builtins/module-calls.js +42 -3
  367. package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
  368. package/dist/frontend/lowering/builtins/module-resolution.d.ts +8 -0
  369. package/dist/frontend/lowering/builtins/module-resolution.js +31 -5
  370. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  371. package/dist/frontend/lowering/builtins/numbers.d.ts +4 -1
  372. package/dist/frontend/lowering/builtins/numbers.js +10 -2
  373. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  374. package/dist/frontend/lowering/builtins/operating-system.d.ts +9 -5
  375. package/dist/frontend/lowering/builtins/operating-system.js +101 -20
  376. package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
  377. package/dist/frontend/lowering/builtins/process.d.ts +18 -2
  378. package/dist/frontend/lowering/builtins/process.js +386 -25
  379. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  380. package/dist/frontend/lowering/builtins/promises.js +169 -8
  381. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  382. package/dist/frontend/lowering/builtins/properties.js +6 -2
  383. package/dist/frontend/lowering/builtins/properties.js.map +1 -1
  384. package/dist/frontend/lowering/builtins/querystring.d.ts +8 -0
  385. package/dist/frontend/lowering/builtins/querystring.js +202 -18
  386. package/dist/frontend/lowering/builtins/querystring.js.map +1 -1
  387. package/dist/frontend/lowering/builtins/readline.d.ts +6 -4
  388. package/dist/frontend/lowering/builtins/readline.js +200 -38
  389. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  390. package/dist/frontend/lowering/builtins/reflection.js +60 -1
  391. package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
  392. package/dist/frontend/lowering/builtins/text-codecs.js +208 -59
  393. package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
  394. package/dist/frontend/lowering/builtins/url.js +55 -13
  395. package/dist/frontend/lowering/builtins/url.js.map +1 -1
  396. package/dist/frontend/lowering/builtins/v8.d.ts +5 -5
  397. package/dist/frontend/lowering/builtins/v8.js +7 -5
  398. package/dist/frontend/lowering/builtins/v8.js.map +1 -1
  399. package/dist/frontend/lowering/builtins/web-streams-dyn.d.ts +17 -2
  400. package/dist/frontend/lowering/builtins/web-streams-dyn.js +97 -9
  401. package/dist/frontend/lowering/builtins/web-streams-dyn.js.map +1 -1
  402. package/dist/frontend/lowering/builtins/webassembly.js +2 -0
  403. package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
  404. package/dist/frontend/lowering/call-arguments.d.ts +10 -0
  405. package/dist/frontend/lowering/call-arguments.js +37 -2
  406. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  407. package/dist/frontend/lowering/call-signatures.d.ts +10 -0
  408. package/dist/frontend/lowering/call-signatures.js +180 -0
  409. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  410. package/dist/frontend/lowering/cjs-exports-object.d.ts +3 -0
  411. package/dist/frontend/lowering/cjs-exports-object.js +1 -1
  412. package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
  413. package/dist/frontend/lowering/cjs-inline-require.js +5 -0
  414. package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
  415. package/dist/frontend/lowering/class-construction.d.ts +14 -2
  416. package/dist/frontend/lowering/class-construction.js +99 -5
  417. package/dist/frontend/lowering/class-construction.js.map +1 -1
  418. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +14 -0
  419. package/dist/frontend/lowering/class-dynamic-dispatch.js +1376 -1009
  420. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  421. package/dist/frontend/lowering/class-dynamic-dispatch.test.js +158 -0
  422. package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
  423. package/dist/frontend/lowering/class-protocols.js +59 -10
  424. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  425. package/dist/frontend/lowering/class-prototypes.js +20 -15
  426. package/dist/frontend/lowering/class-prototypes.js.map +1 -1
  427. package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
  428. package/dist/frontend/lowering/class-runtime-statics.js +35 -1
  429. package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
  430. package/dist/frontend/lowering/class-unions.js +21 -4
  431. package/dist/frontend/lowering/class-unions.js.map +1 -1
  432. package/dist/frontend/lowering/class-views.d.ts +13 -0
  433. package/dist/frontend/lowering/class-views.js +51 -0
  434. package/dist/frontend/lowering/class-views.js.map +1 -0
  435. package/dist/frontend/lowering/coercions/function-adapters.d.ts +15 -1
  436. package/dist/frontend/lowering/coercions/function-adapters.js +63 -10
  437. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  438. package/dist/frontend/lowering/coercions/state.d.ts +15 -0
  439. package/dist/frontend/lowering/coercions/state.js +24 -0
  440. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  441. package/dist/frontend/lowering/coercions/structural-plans.js +75 -3
  442. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  443. package/dist/frontend/lowering/coercions/structural.js +39 -2
  444. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  445. package/dist/frontend/lowering/coercions/unions.d.ts +2 -1
  446. package/dist/frontend/lowering/coercions/unions.js +54 -10
  447. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  448. package/dist/frontend/lowering/constructor-returns.d.ts +23 -2
  449. package/dist/frontend/lowering/constructor-returns.js +284 -58
  450. package/dist/frontend/lowering/constructor-returns.js.map +1 -1
  451. package/dist/frontend/lowering/containers/array-callbacks.d.ts +8 -1
  452. package/dist/frontend/lowering/containers/array-callbacks.js +288 -90
  453. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  454. package/dist/frontend/lowering/containers/array-construction.js +37 -8
  455. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  456. package/dist/frontend/lowering/containers/array-from-async.js +139 -3
  457. package/dist/frontend/lowering/containers/array-from-async.js.map +1 -1
  458. package/dist/frontend/lowering/containers/array-iteration.d.ts +14 -4
  459. package/dist/frontend/lowering/containers/array-iteration.js +24 -7
  460. package/dist/frontend/lowering/containers/array-iteration.js.map +1 -1
  461. package/dist/frontend/lowering/containers/array-methods.js +30 -11
  462. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  463. package/dist/frontend/lowering/containers/bytes.d.ts +6 -0
  464. package/dist/frontend/lowering/containers/bytes.js +450 -86
  465. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  466. package/dist/frontend/lowering/containers/callback-arguments.d.ts +16 -0
  467. package/dist/frontend/lowering/containers/callback-arguments.js +74 -12
  468. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  469. package/dist/frontend/lowering/containers/collection-grouping.js +421 -2
  470. package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
  471. package/dist/frontend/lowering/containers/collection-methods.js +52 -17
  472. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  473. package/dist/frontend/lowering/containers/filter-predicates.d.ts +10 -0
  474. package/dist/frontend/lowering/containers/filter-predicates.js +69 -3
  475. package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
  476. package/dist/frontend/lowering/containers/indexed-objects.js +46 -2
  477. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  478. package/dist/frontend/lowering/containers/iterator-helpers.d.ts +23 -0
  479. package/dist/frontend/lowering/containers/iterator-helpers.js +176 -10
  480. package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
  481. package/dist/frontend/lowering/containers/string-and-regexp.d.ts +5 -2
  482. package/dist/frontend/lowering/containers/string-and-regexp.js +45 -11
  483. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  484. package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
  485. package/dist/frontend/lowering/crypto-tables.js +5 -5
  486. package/dist/frontend/lowering/dispatch-sites.js +3 -0
  487. package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
  488. package/dist/frontend/lowering/divergences.d.ts +40 -0
  489. package/dist/frontend/lowering/divergences.js +239 -20
  490. package/dist/frontend/lowering/divergences.js.map +1 -1
  491. package/dist/frontend/lowering/effect-free.d.ts +12 -0
  492. package/dist/frontend/lowering/effect-free.js +44 -0
  493. package/dist/frontend/lowering/effect-free.js.map +1 -0
  494. package/dist/frontend/lowering/expressions/array-literals.d.ts +24 -0
  495. package/dist/frontend/lowering/expressions/array-literals.js +88 -10
  496. package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
  497. package/dist/frontend/lowering/expressions/binary.js +216 -14
  498. package/dist/frontend/lowering/expressions/binary.js.map +1 -1
  499. package/dist/frontend/lowering/expressions/element-access.js +272 -11
  500. package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
  501. package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +15 -0
  502. package/dist/frontend/lowering/expressions/hosted-narrowing.js +54 -1
  503. package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
  504. package/dist/frontend/lowering/expressions/identifiers.js +173 -4
  505. package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
  506. package/dist/frontend/lowering/expressions/keyed-field-targets.d.ts +11 -1
  507. package/dist/frontend/lowering/expressions/keyed-field-targets.js +22 -1
  508. package/dist/frontend/lowering/expressions/keyed-field-targets.js.map +1 -1
  509. package/dist/frontend/lowering/expressions/narrowing.d.ts +3 -0
  510. package/dist/frontend/lowering/expressions/narrowing.js +195 -18
  511. package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
  512. package/dist/frontend/lowering/expressions/object-literals.d.ts +5 -1
  513. package/dist/frontend/lowering/expressions/object-literals.js +951 -240
  514. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  515. package/dist/frontend/lowering/expressions/optional-chains.js +71 -21
  516. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  517. package/dist/frontend/lowering/expressions/property-access.d.ts +39 -0
  518. package/dist/frontend/lowering/expressions/property-access.js +1141 -87
  519. package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
  520. package/dist/frontend/lowering/expressions/relational.js +262 -4
  521. package/dist/frontend/lowering/expressions/relational.js.map +1 -1
  522. package/dist/frontend/lowering/expressions/typeof.js +25 -0
  523. package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
  524. package/dist/frontend/lowering/expressions/union-fields.d.ts +20 -1
  525. package/dist/frontend/lowering/expressions/union-fields.js +103 -13
  526. package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
  527. package/dist/frontend/lowering/expressions/updates.js +156 -22
  528. package/dist/frontend/lowering/expressions/updates.js.map +1 -1
  529. package/dist/frontend/lowering/frozen-records.d.ts +6 -0
  530. package/dist/frontend/lowering/frozen-records.js +10 -4
  531. package/dist/frontend/lowering/frozen-records.js.map +1 -1
  532. package/dist/frontend/lowering/frozen-records.test.d.ts +1 -0
  533. package/dist/frontend/lowering/frozen-records.test.js +44 -0
  534. package/dist/frontend/lowering/frozen-records.test.js.map +1 -0
  535. package/dist/frontend/lowering/function-names.d.ts +9 -0
  536. package/dist/frontend/lowering/function-names.js +95 -0
  537. package/dist/frontend/lowering/function-names.js.map +1 -0
  538. package/dist/frontend/lowering/function-returns.js +42 -13
  539. package/dist/frontend/lowering/function-returns.js.map +1 -1
  540. package/dist/frontend/lowering/general-streams.js +5 -0
  541. package/dist/frontend/lowering/general-streams.js.map +1 -1
  542. package/dist/frontend/lowering/generator-delegation.d.ts +15 -7
  543. package/dist/frontend/lowering/generator-delegation.js +301 -118
  544. package/dist/frontend/lowering/generator-delegation.js.map +1 -1
  545. package/dist/frontend/lowering/generic-functions.d.ts +75 -0
  546. package/dist/frontend/lowering/generic-functions.js +790 -18
  547. package/dist/frontend/lowering/generic-functions.js.map +1 -1
  548. package/dist/frontend/lowering/global-function-values.d.ts +25 -0
  549. package/dist/frontend/lowering/global-function-values.js +193 -0
  550. package/dist/frontend/lowering/global-function-values.js.map +1 -0
  551. package/dist/frontend/lowering/global-values.d.ts +15 -4
  552. package/dist/frontend/lowering/global-values.js +67 -9
  553. package/dist/frontend/lowering/global-values.js.map +1 -1
  554. package/dist/frontend/lowering/handle-properties.js +34 -1
  555. package/dist/frontend/lowering/handle-properties.js.map +1 -1
  556. package/dist/frontend/lowering/host-global-values.d.ts +31 -0
  557. package/dist/frontend/lowering/host-global-values.js +121 -0
  558. package/dist/frontend/lowering/host-global-values.js.map +1 -0
  559. package/dist/frontend/lowering/host-globals.d.ts +74 -0
  560. package/dist/frontend/lowering/host-globals.js +344 -0
  561. package/dist/frontend/lowering/host-globals.js.map +1 -0
  562. package/dist/frontend/lowering/http2-constants.js +1 -1
  563. package/dist/frontend/lowering/iterator-adapters.js +46 -17
  564. package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
  565. package/dist/frontend/lowering/iterator-prototype.d.ts +30 -0
  566. package/dist/frontend/lowering/iterator-prototype.js +160 -0
  567. package/dist/frontend/lowering/iterator-prototype.js.map +1 -0
  568. package/dist/frontend/lowering/key-order-witness.d.ts +54 -0
  569. package/dist/frontend/lowering/key-order-witness.js +571 -9
  570. package/dist/frontend/lowering/key-order-witness.js.map +1 -1
  571. package/dist/frontend/lowering/key-order-witness.test.js +1 -0
  572. package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
  573. package/dist/frontend/lowering/lib-boundary.js +25 -3
  574. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  575. package/dist/frontend/lowering/lower-assert.js +140 -16
  576. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  577. package/dist/frontend/lowering/lower-async-iteration.d.ts +11 -0
  578. package/dist/frontend/lowering/lower-async-iteration.js +15 -0
  579. package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
  580. package/dist/frontend/lowering/lower-builtin-values.d.ts +36 -6
  581. package/dist/frontend/lowering/lower-builtin-values.js +342 -58
  582. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
  583. package/dist/frontend/lowering/lower-calls.d.ts +47 -1
  584. package/dist/frontend/lowering/lower-calls.js +1354 -273
  585. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  586. package/dist/frontend/lowering/lower-calls.test.d.ts +1 -0
  587. package/dist/frontend/lowering/lower-calls.test.js +121 -0
  588. package/dist/frontend/lowering/lower-calls.test.js.map +1 -0
  589. package/dist/frontend/lowering/lower-classes.d.ts +36 -5
  590. package/dist/frontend/lowering/lower-classes.js +630 -89
  591. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  592. package/dist/frontend/lowering/lower-event-emitter.d.ts +15 -2
  593. package/dist/frontend/lowering/lower-event-emitter.js +610 -98
  594. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  595. package/dist/frontend/lowering/lower-exprs.d.ts +15 -1
  596. package/dist/frontend/lowering/lower-exprs.js +96 -20
  597. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  598. package/dist/frontend/lowering/lower-functions.js +27 -6
  599. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  600. package/dist/frontend/lowering/lower-generators.js +57 -10
  601. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  602. package/dist/frontend/lowering/lower-global-value.d.ts +6 -0
  603. package/dist/frontend/lowering/lower-global-value.js +14 -5
  604. package/dist/frontend/lowering/lower-global-value.js.map +1 -1
  605. package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
  606. package/dist/frontend/lowering/lower-inspect.js +713 -92
  607. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  608. package/dist/frontend/lowering/lower-modules.js +135 -27
  609. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  610. package/dist/frontend/lowering/lower-namespaces.js +18 -0
  611. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  612. package/dist/frontend/lowering/lower-node-island.d.ts +35 -4
  613. package/dist/frontend/lowering/lower-node-island.js +472 -67
  614. package/dist/frontend/lowering/lower-node-island.js.map +1 -1
  615. package/dist/frontend/lowering/lower-server.js +463 -96
  616. package/dist/frontend/lowering/lower-server.js.map +1 -1
  617. package/dist/frontend/lowering/lower-shared-modules.js +13 -1
  618. package/dist/frontend/lowering/lower-shared-modules.js.map +1 -1
  619. package/dist/frontend/lowering/lower-stdlib.d.ts +3 -2
  620. package/dist/frontend/lowering/lower-stdlib.js +77 -18
  621. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  622. package/dist/frontend/lowering/lower-stmts.d.ts +24 -4
  623. package/dist/frontend/lowering/lower-stmts.js +831 -136
  624. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  625. package/dist/frontend/lowering/lower-stream.js +126 -8
  626. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  627. package/dist/frontend/lowering/lower-timers.js +243 -48
  628. package/dist/frontend/lowering/lower-timers.js.map +1 -1
  629. package/dist/frontend/lowering/lower-url.js +6 -3
  630. package/dist/frontend/lowering/lower-url.js.map +1 -1
  631. package/dist/frontend/lowering/lowerer.d.ts +363 -21
  632. package/dist/frontend/lowering/lowerer.js +1224 -129
  633. package/dist/frontend/lowering/lowerer.js.map +1 -1
  634. package/dist/frontend/lowering/lowerer.test.js +19 -1
  635. package/dist/frontend/lowering/lowerer.test.js.map +1 -1
  636. package/dist/frontend/lowering/lowering-facts.d.ts +110 -0
  637. package/dist/frontend/lowering/lowering-facts.js +323 -0
  638. package/dist/frontend/lowering/lowering-facts.js.map +1 -0
  639. package/dist/frontend/lowering/lowering-facts.test.d.ts +1 -0
  640. package/dist/frontend/lowering/lowering-facts.test.js +100 -0
  641. package/dist/frontend/lowering/lowering-facts.test.js.map +1 -0
  642. package/dist/frontend/lowering/module-namespace-elements.js +15 -0
  643. package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
  644. package/dist/frontend/lowering/nan-coded-reads.d.ts +27 -4
  645. package/dist/frontend/lowering/nan-coded-reads.js +112 -9
  646. package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
  647. package/dist/frontend/lowering/new-target.js +2 -2
  648. package/dist/frontend/lowering/nullish-empty-pattern.d.ts +17 -0
  649. package/dist/frontend/lowering/nullish-empty-pattern.js +118 -0
  650. package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -0
  651. package/dist/frontend/lowering/optional-arguments.d.ts +4 -0
  652. package/dist/frontend/lowering/optional-arguments.js +26 -2
  653. package/dist/frontend/lowering/optional-arguments.js.map +1 -1
  654. package/dist/frontend/lowering/partial-assertions.d.ts +36 -0
  655. package/dist/frontend/lowering/partial-assertions.js +189 -0
  656. package/dist/frontend/lowering/partial-assertions.js.map +1 -0
  657. package/dist/frontend/lowering/primitive-throws.d.ts +100 -0
  658. package/dist/frontend/lowering/primitive-throws.js +241 -0
  659. package/dist/frontend/lowering/primitive-throws.js.map +1 -0
  660. package/dist/frontend/lowering/primitive-wrappers.d.ts +34 -0
  661. package/dist/frontend/lowering/primitive-wrappers.js +221 -0
  662. package/dist/frontend/lowering/primitive-wrappers.js.map +1 -0
  663. package/dist/frontend/lowering/private-statics.d.ts +46 -0
  664. package/dist/frontend/lowering/private-statics.js +322 -0
  665. package/dist/frontend/lowering/private-statics.js.map +1 -0
  666. package/dist/frontend/lowering/record-inherited.d.ts +17 -1
  667. package/dist/frontend/lowering/record-inherited.js +16 -2
  668. package/dist/frontend/lowering/record-inherited.js.map +1 -1
  669. package/dist/frontend/lowering/record-links.d.ts +73 -0
  670. package/dist/frontend/lowering/record-links.js +797 -0
  671. package/dist/frontend/lowering/record-links.js.map +1 -0
  672. package/dist/frontend/lowering/record-sources.d.ts +12 -1
  673. package/dist/frontend/lowering/record-sources.js +60 -0
  674. package/dist/frontend/lowering/record-sources.js.map +1 -1
  675. package/dist/frontend/lowering/runtime-optional-provenance.d.ts +27 -7
  676. package/dist/frontend/lowering/runtime-optional-provenance.js +25 -11
  677. package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
  678. package/dist/frontend/lowering/runtime-optional-report.d.ts +40 -0
  679. package/dist/frontend/lowering/runtime-optional-report.js +300 -0
  680. package/dist/frontend/lowering/runtime-optional-report.js.map +1 -0
  681. package/dist/frontend/lowering/scoped-type-memo.test.d.ts +1 -0
  682. package/dist/frontend/lowering/scoped-type-memo.test.js +86 -0
  683. package/dist/frontend/lowering/scoped-type-memo.test.js.map +1 -0
  684. package/dist/frontend/lowering/static-typeof.d.ts +3 -1
  685. package/dist/frontend/lowering/static-typeof.js +6 -1
  686. package/dist/frontend/lowering/static-typeof.js.map +1 -1
  687. package/dist/frontend/lowering/strict-equality.d.ts +4 -0
  688. package/dist/frontend/lowering/strict-equality.js +14 -0
  689. package/dist/frontend/lowering/strict-equality.js.map +1 -1
  690. package/dist/frontend/lowering/strict-mode.d.ts +1 -5
  691. package/dist/frontend/lowering/strict-mode.js +4 -30
  692. package/dist/frontend/lowering/strict-mode.js.map +1 -1
  693. package/dist/frontend/lowering/structural-instances.d.ts +7 -0
  694. package/dist/frontend/lowering/structural-instances.js +23 -0
  695. package/dist/frontend/lowering/structural-instances.js.map +1 -1
  696. package/dist/frontend/lowering/surfaces.d.ts +42 -1
  697. package/dist/frontend/lowering/surfaces.js +212 -71
  698. package/dist/frontend/lowering/surfaces.js.map +1 -1
  699. package/dist/frontend/lowering/union-retag.d.ts +13 -1
  700. package/dist/frontend/lowering/union-retag.js +55 -1
  701. package/dist/frontend/lowering/union-retag.js.map +1 -1
  702. package/dist/frontend/lowering/union-retag.test.js +51 -0
  703. package/dist/frontend/lowering/union-retag.test.js.map +1 -1
  704. package/dist/frontend/lowering/unit-journal.d.ts +136 -17
  705. package/dist/frontend/lowering/unit-journal.js +324 -53
  706. package/dist/frontend/lowering/unit-journal.js.map +1 -1
  707. package/dist/frontend/lowering/unit-journal.test.js +126 -3
  708. package/dist/frontend/lowering/unit-journal.test.js.map +1 -1
  709. package/dist/frontend/lowering/unit-reuse.d.ts +92 -0
  710. package/dist/frontend/lowering/unit-reuse.js +1008 -0
  711. package/dist/frontend/lowering/unit-reuse.js.map +1 -0
  712. package/dist/frontend/lowering/width-lift.d.ts +12 -0
  713. package/dist/frontend/lowering/zlib-constants.js +3 -2
  714. package/dist/frontend/lowering/zlib-constants.js.map +1 -1
  715. package/dist/frontend/npm-file-import.test.d.ts +1 -0
  716. package/dist/frontend/npm-file-import.test.js +76 -0
  717. package/dist/frontend/npm-file-import.test.js.map +1 -0
  718. package/dist/frontend/npm-static.js +95 -11
  719. package/dist/frontend/npm-static.js.map +1 -1
  720. package/dist/frontend/npm-static.test.js +95 -2
  721. package/dist/frontend/npm-static.test.js.map +1 -1
  722. package/dist/frontend/npm.d.ts +9 -0
  723. package/dist/frontend/npm.js +82 -0
  724. package/dist/frontend/npm.js.map +1 -1
  725. package/dist/frontend/pipeline-native.js +2 -1
  726. package/dist/frontend/pipeline-native.js.map +1 -1
  727. package/dist/frontend/pipeline.d.ts +9 -4
  728. package/dist/frontend/pipeline.js +162 -38
  729. package/dist/frontend/pipeline.js.map +1 -1
  730. package/dist/frontend/pipeline.test.js +68 -11
  731. package/dist/frontend/pipeline.test.js.map +1 -1
  732. package/dist/frontend/program-node.d.ts +3 -0
  733. package/dist/frontend/program-node.js +13 -6
  734. package/dist/frontend/program-node.js.map +1 -1
  735. package/dist/frontend/program.d.ts +71 -2
  736. package/dist/frontend/program.js +836 -411
  737. package/dist/frontend/program.js.map +1 -1
  738. package/dist/frontend/program.test.js +37 -1
  739. package/dist/frontend/program.test.js.map +1 -1
  740. package/dist/frontend/provenance-core.js +4 -0
  741. package/dist/frontend/provenance-core.js.map +1 -1
  742. package/dist/frontend/services-node.d.ts +7 -0
  743. package/dist/frontend/services-node.js +32 -1
  744. package/dist/frontend/services-node.js.map +1 -1
  745. package/dist/frontend/services-node.test.js +51 -0
  746. package/dist/frontend/services-node.test.js.map +1 -1
  747. package/dist/frontend/services.d.ts +14 -0
  748. package/dist/frontend/services.js +52 -2
  749. package/dist/frontend/services.js.map +1 -1
  750. package/dist/frontend/services.test.js +61 -1
  751. package/dist/frontend/services.test.js.map +1 -1
  752. package/dist/frontend/shape-inference/analyze.d.ts +5 -0
  753. package/dist/frontend/shape-inference/analyze.js +104 -4
  754. package/dist/frontend/shape-inference/analyze.js.map +1 -1
  755. package/dist/frontend/shape-inference/domain.js +0 -1
  756. package/dist/frontend/shape-inference/domain.js.map +1 -1
  757. package/dist/frontend/shape-inference/index.js +5 -1
  758. package/dist/frontend/shape-inference/index.js.map +1 -1
  759. package/dist/frontend/shape-inference/memo.d.ts +2 -1
  760. package/dist/frontend/shape-inference/memo.js +6 -2
  761. package/dist/frontend/shape-inference/memo.js.map +1 -1
  762. package/dist/frontend/shape-inference/overlay.d.ts +1 -1
  763. package/dist/frontend/shape-inference/overlay.js +184 -4
  764. package/dist/frontend/shape-inference/overlay.js.map +1 -1
  765. package/dist/frontend/shape-inference/static-objects.js +11 -6
  766. package/dist/frontend/shape-inference/static-objects.js.map +1 -1
  767. package/dist/frontend/source-phase-imports.test.d.ts +1 -0
  768. package/dist/frontend/source-phase-imports.test.js +37 -0
  769. package/dist/frontend/source-phase-imports.test.js.map +1 -0
  770. package/dist/frontend/tier-analysis.d.ts +9 -0
  771. package/dist/frontend/tier-analysis.js +1 -0
  772. package/dist/frontend/tier-analysis.js.map +1 -1
  773. package/dist/frontend/ts7/ast-node.d.ts +6 -1
  774. package/dist/frontend/ts7/ast-node.js +12 -0
  775. package/dist/frontend/ts7/ast-node.js.map +1 -1
  776. package/dist/frontend/ts7/ast-wire-protocols.test.js +11 -3
  777. package/dist/frontend/ts7/ast-wire-protocols.test.js.map +1 -1
  778. package/dist/frontend/ts7/ast-wire.js +3 -5
  779. package/dist/frontend/ts7/ast-wire.js.map +1 -1
  780. package/dist/frontend/ts7/checker-backend.d.ts +13 -0
  781. package/dist/frontend/ts7/checker-backend.js +84 -2
  782. package/dist/frontend/ts7/checker-backend.js.map +1 -1
  783. package/dist/frontend/ts7/checker-backend.test.js +126 -2
  784. package/dist/frontend/ts7/checker-backend.test.js.map +1 -1
  785. package/dist/frontend/ts7/program-host.d.ts +22 -1
  786. package/dist/frontend/ts7/program-host.js +49 -4
  787. package/dist/frontend/ts7/program-host.js.map +1 -1
  788. package/dist/frontend/ts7/program-host.test.js +83 -0
  789. package/dist/frontend/ts7/program-host.test.js.map +1 -1
  790. package/dist/frontend/ts7/rpc-process.d.ts +16 -1
  791. package/dist/frontend/ts7/rpc-process.js +170 -92
  792. package/dist/frontend/ts7/rpc-process.js.map +1 -1
  793. package/dist/frontend/ts7/rpc-process.test.js +49 -21
  794. package/dist/frontend/ts7/rpc-process.test.js.map +1 -1
  795. package/dist/frontend/tsc-codes.d.ts +57 -3
  796. package/dist/frontend/tsc-codes.js +956 -101
  797. package/dist/frontend/tsc-codes.js.map +1 -1
  798. package/dist/frontend/tsc-codes.test.js +221 -12
  799. package/dist/frontend/tsc-codes.test.js.map +1 -1
  800. package/dist/frontend/type-mapper.d.ts +98 -11
  801. package/dist/frontend/type-mapper.js +770 -182
  802. package/dist/frontend/type-mapper.js.map +1 -1
  803. package/dist/index.d.ts +1 -1
  804. package/dist/index.js +224 -15
  805. package/dist/index.js.map +1 -1
  806. package/dist/index.test.d.ts +1 -0
  807. package/dist/index.test.js +60 -0
  808. package/dist/index.test.js.map +1 -0
  809. package/dist/ir/api.d.ts +1 -1
  810. package/dist/ir/api.js +1 -1
  811. package/dist/ir/api.js.map +1 -1
  812. package/dist/ir/build.d.ts +3 -2
  813. package/dist/ir/build.js +4 -2
  814. package/dist/ir/build.js.map +1 -1
  815. package/dist/ir/builtin-effects.js +96 -0
  816. package/dist/ir/builtin-effects.js.map +1 -1
  817. package/dist/ir/builtin-signatures.d.ts +1 -1
  818. package/dist/ir/builtin-signatures.js +453 -26
  819. package/dist/ir/builtin-signatures.js.map +1 -1
  820. package/dist/ir/callback-specialization.d.ts +3 -2
  821. package/dist/ir/callback-specialization.js +35 -25
  822. package/dist/ir/callback-specialization.js.map +1 -1
  823. package/dist/ir/capture-values.d.ts +8 -4
  824. package/dist/ir/capture-values.js +9 -6
  825. package/dist/ir/capture-values.js.map +1 -1
  826. package/dist/ir/char-unit-locals.d.ts +6 -2
  827. package/dist/ir/char-unit-locals.js +11 -2
  828. package/dist/ir/char-unit-locals.js.map +1 -1
  829. package/dist/ir/class-key-index.d.ts +18 -0
  830. package/dist/ir/class-key-index.js +29 -0
  831. package/dist/ir/class-key-index.js.map +1 -0
  832. package/dist/ir/class-key-index.test.d.ts +1 -0
  833. package/dist/ir/class-key-index.test.js +25 -0
  834. package/dist/ir/class-key-index.test.js.map +1 -0
  835. package/dist/ir/codec.d.ts +82 -0
  836. package/dist/ir/codec.generated.d.ts +13 -0
  837. package/dist/ir/codec.generated.js +5350 -0
  838. package/dist/ir/codec.generated.js.map +1 -0
  839. package/dist/ir/codec.js +325 -0
  840. package/dist/ir/codec.js.map +1 -0
  841. package/dist/ir/codec.test.d.ts +1 -0
  842. package/dist/ir/codec.test.js +225 -0
  843. package/dist/ir/codec.test.js.map +1 -0
  844. package/dist/ir/constant-globals.d.ts +5 -2
  845. package/dist/ir/constant-globals.js +25 -27
  846. package/dist/ir/constant-globals.js.map +1 -1
  847. package/dist/ir/expression-inlining.d.ts +4 -2
  848. package/dist/ir/expression-inlining.js +8 -2
  849. package/dist/ir/expression-inlining.js.map +1 -1
  850. package/dist/ir/field-values.d.ts +5 -2
  851. package/dist/ir/field-values.js +32 -21
  852. package/dist/ir/field-values.js.map +1 -1
  853. package/dist/ir/fields.generated.d.ts +29 -10
  854. package/dist/ir/fields.generated.js +1039 -11
  855. package/dist/ir/fields.generated.js.map +1 -1
  856. package/dist/ir/fields.test.js +46 -2
  857. package/dist/ir/fields.test.js.map +1 -1
  858. package/dist/ir/final-fields.js +1 -1
  859. package/dist/ir/final-fields.js.map +1 -1
  860. package/dist/ir/function-references.d.ts +6 -4
  861. package/dist/ir/function-references.js +11 -4
  862. package/dist/ir/function-references.js.map +1 -1
  863. package/dist/ir/function-references.test.js +14 -0
  864. package/dist/ir/function-references.test.js.map +1 -1
  865. package/dist/ir/init-only-globals.d.ts +4 -2
  866. package/dist/ir/init-only-globals.js +17 -18
  867. package/dist/ir/init-only-globals.js.map +1 -1
  868. package/dist/ir/inline-array-sources.js +4 -1
  869. package/dist/ir/inline-array-sources.js.map +1 -1
  870. package/dist/ir/inline-array-views.d.ts +13 -0
  871. package/dist/ir/inline-array-views.js +945 -0
  872. package/dist/ir/inline-array-views.js.map +1 -0
  873. package/dist/ir/inline-arrays.d.ts +7 -0
  874. package/dist/ir/inline-arrays.js +190 -55
  875. package/dist/ir/inline-arrays.js.map +1 -1
  876. package/dist/ir/inline-arrays.test.js +140 -2
  877. package/dist/ir/inline-arrays.test.js.map +1 -1
  878. package/dist/ir/int32-slots.js +7 -0
  879. package/dist/ir/int32-slots.js.map +1 -1
  880. package/dist/ir/integer-ranges.js +16 -6
  881. package/dist/ir/integer-ranges.js.map +1 -1
  882. package/dist/ir/ir.d.ts +130 -44
  883. package/dist/ir/ir.js +7 -0
  884. package/dist/ir/ir.js.map +1 -1
  885. package/dist/ir/js-groups.d.ts +51 -0
  886. package/dist/ir/js-groups.js +394 -0
  887. package/dist/ir/js-groups.js.map +1 -0
  888. package/dist/ir/js-groups.test.d.ts +1 -0
  889. package/dist/ir/js-groups.test.js +555 -0
  890. package/dist/ir/js-groups.test.js.map +1 -0
  891. package/dist/ir/js-ic.d.ts +10 -9
  892. package/dist/ir/js-ic.js +58 -25
  893. package/dist/ir/js-ic.js.map +1 -1
  894. package/dist/ir/js-ic.test.js +37 -3
  895. package/dist/ir/js-ic.test.js.map +1 -1
  896. package/dist/ir/jsval.js +374 -63
  897. package/dist/ir/jsval.js.map +1 -1
  898. package/dist/ir/jsval.test.js +96 -2
  899. package/dist/ir/jsval.test.js.map +1 -1
  900. package/dist/ir/loop-entry-ranges.js +112 -9
  901. package/dist/ir/loop-entry-ranges.js.map +1 -1
  902. package/dist/ir/loop-entry-ranges.test.js +40 -0
  903. package/dist/ir/loop-entry-ranges.test.js.map +1 -1
  904. package/dist/ir/node-index.d.ts +23 -6
  905. package/dist/ir/node-index.js +126 -49
  906. package/dist/ir/node-index.js.map +1 -1
  907. package/dist/ir/numeric-call-specialization.d.ts +4 -2
  908. package/dist/ir/numeric-call-specialization.js +40 -26
  909. package/dist/ir/numeric-call-specialization.js.map +1 -1
  910. package/dist/ir/paired-while-loops.d.ts +4 -2
  911. package/dist/ir/paired-while-loops.js +8 -2
  912. package/dist/ir/paired-while-loops.js.map +1 -1
  913. package/dist/ir/parameter-versions.d.ts +13 -3
  914. package/dist/ir/parameter-versions.js +63 -40
  915. package/dist/ir/parameter-versions.js.map +1 -1
  916. package/dist/ir/property-bags.d.ts +4 -2
  917. package/dist/ir/property-bags.js +22 -17
  918. package/dist/ir/property-bags.js.map +1 -1
  919. package/dist/ir/receiver-readers.js +58 -2
  920. package/dist/ir/receiver-readers.js.map +1 -1
  921. package/dist/ir/row-pairs.d.ts +4 -2
  922. package/dist/ir/row-pairs.js +12 -11
  923. package/dist/ir/row-pairs.js.map +1 -1
  924. package/dist/ir/runtime-features.d.ts +139 -5
  925. package/dist/ir/runtime-features.js +397 -19
  926. package/dist/ir/runtime-features.js.map +1 -1
  927. package/dist/ir/runtime-features.test.js +135 -1
  928. package/dist/ir/runtime-features.test.js.map +1 -1
  929. package/dist/ir/runtime-jam-loops.d.ts +35 -0
  930. package/dist/ir/runtime-jam-loops.js +604 -0
  931. package/dist/ir/runtime-jam-loops.js.map +1 -0
  932. package/dist/ir/runtime-jam-loops.test.d.ts +1 -0
  933. package/dist/ir/runtime-jam-loops.test.js +565 -0
  934. package/dist/ir/runtime-jam-loops.test.js.map +1 -0
  935. package/dist/ir/saturating-loop-jams.d.ts +11 -2
  936. package/dist/ir/saturating-loop-jams.js +56 -16
  937. package/dist/ir/saturating-loop-jams.js.map +1 -1
  938. package/dist/ir/saturating-loop-jams.test.js +39 -1
  939. package/dist/ir/saturating-loop-jams.test.js.map +1 -1
  940. package/dist/ir/scalar-records.d.ts +5 -2
  941. package/dist/ir/scalar-records.js +12 -2
  942. package/dist/ir/scalar-records.js.map +1 -1
  943. package/dist/ir/self-captures.d.ts +4 -2
  944. package/dist/ir/self-captures.js +40 -28
  945. package/dist/ir/self-captures.js.map +1 -1
  946. package/dist/ir/self-captures.test.js +15 -0
  947. package/dist/ir/self-captures.test.js.map +1 -1
  948. package/dist/ir/serialize.d.ts +8 -2
  949. package/dist/ir/serialize.js +92 -24
  950. package/dist/ir/serialize.js.map +1 -1
  951. package/dist/ir/serialize.test.js +26 -0
  952. package/dist/ir/serialize.test.js.map +1 -1
  953. package/dist/ir/tiers.js +1 -0
  954. package/dist/ir/tiers.js.map +1 -1
  955. package/dist/ir/traverse.js +4 -0
  956. package/dist/ir/traverse.js.map +1 -1
  957. package/dist/ir/typed-argument-clones.d.ts +30 -0
  958. package/dist/ir/typed-argument-clones.js +789 -0
  959. package/dist/ir/typed-argument-clones.js.map +1 -0
  960. package/dist/ir/union-arm-loops.d.ts +3 -0
  961. package/dist/ir/union-arm-loops.js +373 -0
  962. package/dist/ir/union-arm-loops.js.map +1 -0
  963. package/dist/ir/union-arm-loops.test.d.ts +1 -0
  964. package/dist/ir/union-arm-loops.test.js +230 -0
  965. package/dist/ir/union-arm-loops.test.js.map +1 -0
  966. package/dist/ir/validate.js +170 -22
  967. package/dist/ir/validate.js.map +1 -1
  968. package/dist/ir/validate.test.js +46 -0
  969. package/dist/ir/validate.test.js.map +1 -1
  970. package/dist/library/compiler-self-identity.d.ts +8 -2
  971. package/dist/library/compiler-self-identity.js +92 -18
  972. package/dist/library/compiler-self-identity.js.map +1 -1
  973. package/dist/library/compiler-self-identity.test.js +150 -3
  974. package/dist/library/compiler-self-identity.test.js.map +1 -1
  975. package/dist/library/int-infer.d.ts +5 -0
  976. package/dist/library/int-infer.js +15 -3
  977. package/dist/library/int-infer.js.map +1 -1
  978. package/dist/library/ir-policy.js +4 -0
  979. package/dist/library/ir-policy.js.map +1 -1
  980. package/dist/library/library-cache.d.ts +4 -0
  981. package/dist/library/library-cache.js +2 -0
  982. package/dist/library/library-cache.js.map +1 -1
  983. package/dist/library/library-cache.test.js +26 -0
  984. package/dist/library/library-cache.test.js.map +1 -1
  985. package/dist/library/prepare.js +99 -31
  986. package/dist/library/prepare.js.map +1 -1
  987. package/dist/native/cache.d.ts +7 -0
  988. package/dist/native/cache.js +49 -0
  989. package/dist/native/cache.js.map +1 -1
  990. package/dist/native/cache.test.js +13 -1
  991. package/dist/native/cache.test.js.map +1 -1
  992. package/dist/native/cli.js +2 -0
  993. package/dist/native/cli.js.map +1 -1
  994. package/dist/native/compiler.js +26 -5
  995. package/dist/native/compiler.js.map +1 -1
  996. package/dist/native/executable-cache-open.test.js +31 -5
  997. package/dist/native/executable-cache-open.test.js.map +1 -1
  998. package/dist/native/executable-cache.d.ts +6 -1
  999. package/dist/native/executable-cache.js +7 -1
  1000. package/dist/native/executable-cache.js.map +1 -1
  1001. package/dist/native/prepare.d.ts +3 -0
  1002. package/dist/native/prepare.js +74 -28
  1003. package/dist/native/prepare.js.map +1 -1
  1004. package/dist/native/prepare.test.js +25 -3
  1005. package/dist/native/prepare.test.js.map +1 -1
  1006. package/dist/native/sanitizer.js +63 -4
  1007. package/dist/native/sanitizer.js.map +1 -1
  1008. package/dist/native/sanitizer.test.js +93 -2
  1009. package/dist/native/sanitizer.test.js.map +1 -1
  1010. package/dist/native/toolchain.js +9 -2
  1011. package/dist/native/toolchain.js.map +1 -1
  1012. package/dist/node-islands/boundary.d.ts +37 -1
  1013. package/dist/node-islands/boundary.js +65 -7
  1014. package/dist/node-islands/boundary.js.map +1 -1
  1015. package/dist/node-islands/boundary.test.d.ts +1 -0
  1016. package/dist/node-islands/boundary.test.js +76 -0
  1017. package/dist/node-islands/boundary.test.js.map +1 -0
  1018. package/dist/node-islands/detect.d.ts +27 -1
  1019. package/dist/node-islands/detect.js +475 -40
  1020. package/dist/node-islands/detect.js.map +1 -1
  1021. package/dist/node-islands/detect.test.js +175 -4
  1022. package/dist/node-islands/detect.test.js.map +1 -1
  1023. package/dist/node-islands/effect-gate.js +30 -20
  1024. package/dist/node-islands/effect-gate.js.map +1 -1
  1025. package/dist/node-islands/effect-gate.test.js +4 -1
  1026. package/dist/node-islands/effect-gate.test.js.map +1 -1
  1027. package/dist/node-islands/graph-islands.d.ts +40 -0
  1028. package/dist/node-islands/graph-islands.js +128 -0
  1029. package/dist/node-islands/graph-islands.js.map +1 -0
  1030. package/dist/node-islands/growth.d.ts +57 -0
  1031. package/dist/node-islands/growth.js +205 -0
  1032. package/dist/node-islands/growth.js.map +1 -0
  1033. package/dist/node-islands/libnode.d.ts +1 -1
  1034. package/dist/node-islands/libnode.js +1 -1
  1035. package/dist/node-islands/libnode.js.map +1 -1
  1036. package/dist/node-islands/modules.d.ts +28 -0
  1037. package/dist/node-islands/modules.js +156 -0
  1038. package/dist/node-islands/modules.js.map +1 -1
  1039. package/dist/node-islands/modules.test.js +105 -1
  1040. package/dist/node-islands/modules.test.js.map +1 -1
  1041. package/dist/node-islands/policy.js +2 -3
  1042. package/dist/node-islands/policy.js.map +1 -1
  1043. package/dist/node-islands/probe-recorder.d.ts +1 -0
  1044. package/dist/node-islands/probe-recorder.js +596 -0
  1045. package/dist/node-islands/probe-recorder.js.map +1 -0
  1046. package/dist/node-islands/probe-recorder.test.d.ts +1 -0
  1047. package/dist/node-islands/probe-recorder.test.js +80 -0
  1048. package/dist/node-islands/probe-recorder.test.js.map +1 -0
  1049. package/dist/node-islands/report.d.ts +12 -0
  1050. package/dist/node-islands/report.js +28 -0
  1051. package/dist/node-islands/report.js.map +1 -1
  1052. package/dist/node-islands/report.test.js +4 -0
  1053. package/dist/node-islands/report.test.js.map +1 -1
  1054. package/dist/node-islands/rules.js +9 -0
  1055. package/dist/node-islands/rules.js.map +1 -1
  1056. package/dist/node-islands/scan.d.ts +16 -1
  1057. package/dist/node-islands/scan.js +110 -9
  1058. package/dist/node-islands/scan.js.map +1 -1
  1059. package/dist/node-islands/snapshot.d.ts +38 -1
  1060. package/dist/node-islands/snapshot.js +165 -161
  1061. package/dist/node-islands/snapshot.js.map +1 -1
  1062. package/dist/node-islands/snapshot.test.js +63 -2
  1063. package/dist/node-islands/snapshot.test.js.map +1 -1
  1064. package/dist/node-islands/summary.js +8 -0
  1065. package/dist/node-islands/summary.js.map +1 -1
  1066. package/dist/node-islands/type-strip.d.ts +11 -0
  1067. package/dist/node-islands/type-strip.js +157 -0
  1068. package/dist/node-islands/type-strip.js.map +1 -0
  1069. package/dist/node-islands/type-strip.test.d.ts +1 -0
  1070. package/dist/node-islands/type-strip.test.js +31 -0
  1071. package/dist/node-islands/type-strip.test.js.map +1 -0
  1072. package/dist/project-config.d.ts +4 -0
  1073. package/dist/project-config.js +19 -0
  1074. package/dist/project-config.js.map +1 -1
  1075. package/dist/project-config.test.js +10 -0
  1076. package/dist/project-config.test.js.map +1 -1
  1077. package/dist/wasm/translate.js +11 -5
  1078. package/dist/wasm/translate.js.map +1 -1
  1079. package/dist/wasm/translate.test.js +35 -0
  1080. package/dist/wasm/translate.test.js.map +1 -1
  1081. package/package.json +20 -20
  1082. package/surface-manifest.json +221 -122
@@ -1,5 +1,6 @@
1
1
  import { InternalCompilerError } from "../errors.js";
2
2
  import { keyedHelperName } from "./lowering/stable-names.js";
3
+ import { contentDigest } from "./lowering/unit-journal.js";
3
4
  import { mockCallRecordType, mockContextType } from "./mock-shapes.js";
4
5
  import * as ts from "./ts7/adapter.js";
5
6
  import { bodyReadsArguments } from "./arguments-usage.js";
@@ -154,8 +155,10 @@ export const FETCH_AMBIENT_TYPES = [
154
155
  "ReadableStreamReadValueResult",
155
156
  "ReadableStreamReadDoneResult",
156
157
  "TransformStream",
158
+ "TransformStreamDefaultController",
157
159
  "WritableStream",
158
160
  "WritableStreamDefaultWriter",
161
+ "WritableStreamDefaultController",
159
162
  "Blob",
160
163
  "File",
161
164
  "BlobPropertyBag",
@@ -587,9 +590,41 @@ export class UnionRegistry {
587
590
  * the key its arms give. A unit that adds a recursive union changes
588
591
  * journalSizes, so the unions past a unit's start are interned ones. */
589
592
  journalTable() {
593
+ // The position of each union by id, for the unions indexed so far.
594
+ let indexes = new Map();
595
+ let indexed = 0;
596
+ const indexOf = (id) => {
597
+ if (indexed > this.unions.length) {
598
+ indexes = new Map();
599
+ indexed = 0;
600
+ }
601
+ for (; indexed < this.unions.length; indexed++)
602
+ indexes.set(this.unions[indexed].id, indexed);
603
+ const index = indexes.get(id);
604
+ return index !== undefined && this.unions[index]?.id === id ? index : undefined;
605
+ };
590
606
  return {
591
607
  name: "unions",
592
608
  size: () => this.unions.length,
609
+ digest: (key, before) => {
610
+ if (!this.byId.has(key))
611
+ return null;
612
+ let index = indexOf(key);
613
+ if (index === undefined) {
614
+ // A list that was cut and grown again holds other unions at the
615
+ // positions indexed before.
616
+ indexes = new Map();
617
+ indexed = 0;
618
+ index = indexOf(key);
619
+ }
620
+ if (index === undefined || index >= before)
621
+ return null;
622
+ return contentDigest(JSON.stringify(this.unions[index]));
623
+ },
624
+ holds: (entry) => {
625
+ const def = JSON.parse(entry);
626
+ return this.byKey.has(unionKey(def.arms, def.discriminant));
627
+ },
593
628
  entries: (from) => {
594
629
  const out = [];
595
630
  for (const def of this.unions.slice(from)) {
@@ -601,6 +636,11 @@ export class UnionRegistry {
601
636
  }
602
637
  return out;
603
638
  },
639
+ agrees: (entries) => entries.every((entry) => {
640
+ const def = JSON.parse(entry);
641
+ const held = this.byKey.get(unionKey(def.arms, def.discriminant));
642
+ return held === undefined ? !this.byId.has(def.id) : held === def.id;
643
+ }),
604
644
  apply: (entries) => {
605
645
  for (const entry of entries) {
606
646
  const def = JSON.parse(entry);
@@ -1106,11 +1146,57 @@ export function isDeclaredInAmbientNamespace(d, name) {
1106
1146
  }
1107
1147
  return false;
1108
1148
  }
1149
+ /** The answers provenanceOf has given, keyed by symbol. The lowering owns
1150
+ * one map through TypeMapperCtx.symbolProvenance; a symbol belongs to one
1151
+ * loaded program, so one island round shares the map across its passes
1152
+ * (lowering-facts.ts). */
1153
+ export function newSymbolProvenanceMemo() {
1154
+ return new Map();
1155
+ }
1156
+ /** A symbol's provenance, computed from its declarations alone: the answer
1157
+ * depends on which files declare it and nothing else, so it is the same for
1158
+ * every lowering pass of one loaded program (lowering-facts.ts shares the
1159
+ * memo). */
1160
+ export function computeSymbolProvenance(psym, isStdlibFile) {
1161
+ let stdlibInterface = false;
1162
+ let stdlibClass = false;
1163
+ let libInterface = false;
1164
+ for (const decl of psym.declarations) {
1165
+ const file = ts.getSourceFileOfNode(decl);
1166
+ if (!isStdlibFile(file))
1167
+ continue;
1168
+ if (ts.isInterfaceDeclaration(decl)) {
1169
+ stdlibInterface = true;
1170
+ stdlibClass = true;
1171
+ if (!isNodeTypesPath(file.fileName))
1172
+ libInterface = true;
1173
+ }
1174
+ else if (ts.isClassDeclaration(decl)) {
1175
+ stdlibClass = true;
1176
+ }
1177
+ }
1178
+ return { stdlibInterface, stdlibClass, libInterface };
1179
+ }
1180
+ function provenanceOf(psym, ctx) {
1181
+ let bySymbol = ctx.symbolProvenance;
1182
+ if (bySymbol === undefined) {
1183
+ bySymbol = new Map();
1184
+ ctx.symbolProvenance = bySymbol;
1185
+ }
1186
+ let provenance = bySymbol.get(psym);
1187
+ if (provenance === undefined) {
1188
+ provenance = computeSymbolProvenance(psym, ctx.isStdlibFile);
1189
+ bySymbol.set(psym, provenance);
1190
+ }
1191
+ else
1192
+ ctx.verifySymbolProvenance?.(psym, provenance);
1193
+ return provenance;
1194
+ }
1109
1195
  /** Whether `type` is one of the stream spellings the general stream
1110
1196
  * representation (TypeMapperCtx.generalNodeStreams) maps differently:
1111
1197
  * NodeJS.ReadableStream / NodeJS.WritableStream, @types/node's
1112
1198
  * stream.Readable / stream.Writable, or the fallback declarations'
1113
- * ChildStdin. */
1199
+ * ChildStdin / ChildStdout. */
1114
1200
  export function isGeneralNodeStreamInterface(type, ctx) {
1115
1201
  const psym = type.getSymbol() ?? type.getAliasSymbol();
1116
1202
  if (psym === undefined)
@@ -1122,13 +1208,21 @@ export function isGeneralNodeStreamInterface(type, ctx) {
1122
1208
  return false;
1123
1209
  if (ts.symbolName(psym) === "ReadableStream" || ts.symbolName(psym) === "WritableStream")
1124
1210
  return ts.isInterfaceDeclaration(d) && isDeclaredInAmbientNamespace(d, "NodeJS");
1125
- if (ts.symbolName(psym) === "ChildStdin")
1211
+ if (ts.symbolName(psym) === "ChildStdin" || ts.symbolName(psym) === "ChildStdout")
1126
1212
  return isDeclaredInAmbientModule(d, "child_process");
1127
1213
  return ((ts.symbolName(psym) === "Readable" || ts.symbolName(psym) === "Writable") &&
1128
1214
  isNodeTypesPath(ts.getSourceFileOfNode(d).fileName) &&
1129
1215
  isDeclaredInAmbientModule(d, "stream"));
1130
1216
  });
1131
1217
  }
1218
+ /** Whether any declaration of the symbol sits in the shipped WebAssembly
1219
+ * namespace (scriptc.d.ts). Like the declaration-kind walk, the answer is a
1220
+ * function of the declarations alone, so provenanceOf's shared memo can keep
1221
+ * it (SymbolProvenance.webAssembly). */
1222
+ export function declaresWebAssemblyNamespace(declarations, isStdlibFile) {
1223
+ return declarations.some((d) => isStdlibFile(ts.getSourceFileOfNode(d)) &&
1224
+ isDeclaredInAmbientNamespace(d, "WebAssembly"));
1225
+ }
1132
1226
  /** A type declared in the shipped WebAssembly namespace (scriptc.d.ts):
1133
1227
  * its modules, instances, memories, tables, globals, error classes and the
1134
1228
  * Exports/Imports records. */
@@ -1136,8 +1230,9 @@ export function isWebAssemblyType(type, ctx) {
1136
1230
  const symbol = type.getAliasSymbol() ?? type.getSymbol();
1137
1231
  if (!symbol)
1138
1232
  return false;
1139
- return symbol.declarations.some((d) => ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
1140
- isDeclaredInAmbientNamespace(d, "WebAssembly"));
1233
+ const provenance = provenanceOf(symbol, ctx);
1234
+ provenance.webAssembly ??= declaresWebAssemblyNamespace(symbol.declarations, ctx.isStdlibFile);
1235
+ return provenance.webAssembly;
1141
1236
  }
1142
1237
  /** True when a type contains a record anywhere (the trigger for the
1143
1238
  * shape-mismatch diagnostic SC2002 — non-record mismatches are tsc's or
@@ -1251,6 +1346,37 @@ let mapTypeDepth = 0;
1251
1346
  * a bump between entry and exit stays fenced (recursive generic-open types
1252
1347
  * stay fenced instead of interning a per-context-wrong shape). */
1253
1348
  let contextResolutions = 0;
1349
+ /** Bumped whenever a mapping reads state that only a generic-INSTANTIATION
1350
+ * scope installs: a type-parameter binding (the Lowerer's resolver hooks,
1351
+ * consulted whether or not bindings are installed right now — the same
1352
+ * checker type parameter answers differently with and without them), the
1353
+ * instance's result class, or the local-class instantiation stack. The
1354
+ * answer of such a mapping can differ from one instance to the next, so it
1355
+ * stays in that scope's memo (Lowerer.currentTypeMemo). A mapping that reads
1356
+ * none of it is the answer every scope gives, and may serve all of them
1357
+ * (TypeMapperCtx.typeMemoShared). */
1358
+ let scopeSensitivity = 0;
1359
+ /** Notes that the mapping in progress read generic-instantiation scope state. */
1360
+ export function noteScopeSensitiveMapping() {
1361
+ scopeSensitivity++;
1362
+ }
1363
+ /** SCRIPTC_TYPE_MEMO_VERIFY=1: every hit on a shared (scope-independent)
1364
+ * memo entry is recomputed from scratch in the scope that took it and
1365
+ * compared. A mismatch is a miscompile the sharing would have introduced,
1366
+ * so the mode throws instead of quietly recomputing: it exists to prove the
1367
+ * sharing on a corpus, never to rescue it at run time. `=stats` also prints
1368
+ * how many hits it checked when the process exits. */
1369
+ const verifyMemoMode = process.env["SCRIPTC_TYPE_MEMO_VERIFY"] ?? "";
1370
+ const verifySharedTypeMemo = verifyMemoMode === "1" || verifyMemoMode === "stats";
1371
+ let verifiedSharedHits = 0;
1372
+ if (verifyMemoMode === "stats") {
1373
+ process.on("exit", () => {
1374
+ process.stderr.write(`[type-memo] verified ${verifiedSharedHits} shared memo hits\n`);
1375
+ });
1376
+ }
1377
+ /** Set while verifying, so the recomputation bypasses every memo and does
1378
+ * not verify itself. */
1379
+ let bypassTypeMemo = false;
1254
1380
  /** node:url's legacy record interfaces: url.parse()'s Url instance (and
1255
1381
  * its two query-typed refinements), url.format()'s UrlObject input, the
1256
1382
  * URL form's URLFormatOptions, and urlToHttpOptions's result. The values
@@ -1274,7 +1400,15 @@ export function isLegacyUrlType(type, ctx) {
1274
1400
  export function isLegacyUrlSymbol(symbol, ctx) {
1275
1401
  if (!symbol)
1276
1402
  return false;
1277
- for (const d of symbol.declarations) {
1403
+ const provenance = provenanceOf(symbol, ctx);
1404
+ provenance.legacyUrl ??= declaresLegacyUrl(symbol.declarations, ctx);
1405
+ return provenance.legacyUrl;
1406
+ }
1407
+ /** Whether any declaration of the symbol is one of node:url's legacy record
1408
+ * interfaces (or a member of one). A function of the declarations alone,
1409
+ * stored as SymbolProvenance.legacyUrl in provenanceOf's shared memo. */
1410
+ export function declaresLegacyUrl(declarations, ctx) {
1411
+ for (const d of declarations) {
1278
1412
  if (!ctx.isStdlibFile(ts.getSourceFileOfNode(d)))
1279
1413
  continue;
1280
1414
  let family = false;
@@ -1646,12 +1780,34 @@ function mapTypeEntry(type, ctx) {
1646
1780
  // arm (emptyLiteralArm) and to the checked-dynamic value elsewhere: the two
1647
1781
  // answers keep separate memo entries. Type ids are non-negative integers.
1648
1782
  const memoKey = memoizable ? typeId * 2 + (ctx.emptyLiteralArm ? 1 : 0) : null;
1649
- if (memoKey !== null) {
1650
- const memo = ctx.typeMemo?.get(memoKey);
1651
- if (memo !== undefined)
1652
- return memo;
1783
+ /** The memo of the binding context this frame started in: the scope's own
1784
+ * inside generic bindings, the lowerer's top-level memo outside them. */
1785
+ let contextMemo;
1786
+ if (memoKey !== null && !bypassTypeMemo) {
1787
+ contextMemo = ctx.typeMemoFor?.() ?? ctx.typeMemo;
1788
+ const own = contextMemo?.get(memoKey);
1789
+ if (own !== undefined) {
1790
+ // The scope's own memo also holds answers this scope's bindings shaped
1791
+ // (they were written here, not shared). Taking one re-reads that
1792
+ // scope state just as mapping the type would, so the frame that took it
1793
+ // is scope-specific too: without this the parent could enter the shared
1794
+ // memo and serve this instance's representation to every later one.
1795
+ if (ctx.typeMemoShared?.get(memoKey) !== own)
1796
+ noteScopeSensitiveMapping();
1797
+ return own;
1798
+ }
1799
+ const shared = ctx.typeMemoShared;
1800
+ if (shared !== undefined && shared !== contextMemo) {
1801
+ const hit = shared.get(memoKey);
1802
+ if (hit !== undefined) {
1803
+ if (verifySharedTypeMemo && topLevel)
1804
+ verifySharedMapping(type, ctx, hit);
1805
+ return hit;
1806
+ }
1807
+ }
1653
1808
  }
1654
1809
  const sensitivityAtEntry = contextResolutions;
1810
+ const scopeReadsAtEntry = scopeSensitivity;
1655
1811
  mapTypeDepth++;
1656
1812
  try {
1657
1813
  let mapped;
@@ -1677,6 +1833,17 @@ function mapTypeEntry(type, ctx) {
1677
1833
  contextResolutions++;
1678
1834
  }
1679
1835
  }
1836
+ // A PACKAGE DATA SHAPE the structural rules cannot map: `import type`
1837
+ // from a package whose implementation is not part of the compiled
1838
+ // module graph declares data the program itself builds, and a
1839
+ // declaration the compiled graph never loads cannot produce a value of
1840
+ // its own. A shape with no native mapping is then exactly the
1841
+ // checked-dynamic value — the same answer `unknown` gets — never the
1842
+ // package's story (there is no package value here to disagree with).
1843
+ if (mapped === null && packageTypeIsData(type, ctx)) {
1844
+ mapped = DYN;
1845
+ contextResolutions++;
1846
+ }
1680
1847
  // Localized failure: a type that failed at a committed slot maps to its
1681
1848
  // lenient form. It counts as a context resolution so neither it nor a
1682
1849
  // type containing it is memoized: the strict form may map elsewhere.
@@ -1697,10 +1864,25 @@ function mapTypeEntry(type, ctx) {
1697
1864
  if (mapped !== null &&
1698
1865
  memoKey !== null &&
1699
1866
  topLevel &&
1867
+ !bypassTypeMemo &&
1700
1868
  contextResolutions === sensitivityAtEntry &&
1701
1869
  ctx.erasingSignature === undefined &&
1702
1870
  (ctx.canMemoizeType?.() ?? true)) {
1703
- ctx.typeMemo?.set(memoKey, mapped);
1871
+ // Read the hook again rather than reusing the entry's memo: the write
1872
+ // condition rechecks the binding context, and a hook is what keeps a
1873
+ // context copy made inside a binding scope pointed at that scope.
1874
+ const liveMemo = ctx.typeMemoFor?.() ?? ctx.typeMemo;
1875
+ // A scope that changed mid-frame cannot own this answer. (It cannot
1876
+ // happen today; the identity check keeps it a proof rather than an
1877
+ // assumption.)
1878
+ if (liveMemo === contextMemo) {
1879
+ liveMemo?.set(memoKey, mapped);
1880
+ // An answer that read no scope state is every scope's answer, so it
1881
+ // also serves the shared memo — including the scopes entered later.
1882
+ const shared = ctx.typeMemoShared;
1883
+ if (shared !== undefined && shared !== liveMemo && scopeSensitivity === scopeReadsAtEntry)
1884
+ shared.set(memoKey, mapped);
1885
+ }
1704
1886
  }
1705
1887
  return mapped;
1706
1888
  }
@@ -1708,6 +1890,32 @@ function mapTypeEntry(type, ctx) {
1708
1890
  mapTypeDepth--;
1709
1891
  }
1710
1892
  }
1893
+ /** SCRIPTC_TYPE_MEMO_VERIFY: recomputes a shared memo entry in the scope
1894
+ * that just took it and fails loudly when the two answers disagree. The
1895
+ * recalculation runs with every memo bypassed and restores the mapping
1896
+ * counters it moves, so the observation leaves the mapping it observes
1897
+ * unchanged. */
1898
+ function verifySharedMapping(type, ctx, shared) {
1899
+ const resolutions = contextResolutions;
1900
+ const scopeReads = scopeSensitivity;
1901
+ bypassTypeMemo = true;
1902
+ let recomputed;
1903
+ try {
1904
+ recomputed = mapTypeEntry(type, ctx);
1905
+ }
1906
+ finally {
1907
+ bypassTypeMemo = false;
1908
+ contextResolutions = resolutions;
1909
+ scopeSensitivity = scopeReads;
1910
+ }
1911
+ const wanted = recomputed === null ? "<unmapped>" : typeKey(recomputed);
1912
+ verifiedSharedHits++;
1913
+ if (typeKey(shared) === wanted)
1914
+ return;
1915
+ throw new InternalCompilerError(`shared type memo entry does not match a fresh mapping: type ` +
1916
+ `${checkerTypeDescription(type, ctx)} answered ${typeKey(shared)} from the shared ` +
1917
+ `memo and ${wanted} when remapped in its scope`);
1918
+ }
1711
1919
  /** Local class types need the enclosing specialization's registered layout.
1712
1920
  * Static-block classes are sent through the same hook for an explicit fence. */
1713
1921
  function classExprNeedsContext(decl) {
@@ -1736,6 +1944,19 @@ function spreadsCheckedDynamic(symbol, ctx) {
1736
1944
  return decl.properties.nodes.some((prop) => ts.isSpreadAssignment(prop) &&
1737
1945
  mapType(ctx.checker.getTypeAtLocation(prop.expression), ctx)?.kind === "dyn");
1738
1946
  }
1947
+ /** The members a hand-written writable-pipe interface may name: the child
1948
+ * stdin surface a `Pipe { write(chunk: string): boolean; end(): void }`
1949
+ * declares (see the childWriter mapping in mapTypeInner). */
1950
+ const CHILD_WRITER_MEMBERS = new Set([
1951
+ "write",
1952
+ "end",
1953
+ "destroy",
1954
+ "writable",
1955
+ "on",
1956
+ "once",
1957
+ "off",
1958
+ "removeListener",
1959
+ ]);
1739
1960
  function mapTypeInner(type, ctx) {
1740
1961
  const { checker, unions, classNamer, resolveTypeParam } = ctx;
1741
1962
  // TypeScript's intrinsic globalThis symbol has no declaration. A stored
@@ -1997,6 +2218,10 @@ function mapTypeInner(type, ctx) {
1997
2218
  ts.symbolName(boxSym) === "String" ||
1998
2219
  ts.symbolName(boxSym) === "Boolean") &&
1999
2220
  boxSym.declarations.some((d) => ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2221
+ // Once the program creates wrapper objects, a slot of the boxed type
2222
+ // may hold one: the checked-dynamic value holds both.
2223
+ if (ctx.primitiveWrappers?.())
2224
+ return DYN;
2000
2225
  return ts.symbolName(boxSym) === "Number"
2001
2226
  ? F64
2002
2227
  : ts.symbolName(boxSym) === "String"
@@ -2157,30 +2382,13 @@ function mapTypeInner(type, ctx) {
2157
2382
  // such a type is one the program built itself (`import type` from a
2158
2383
  // types-only package), so it maps structurally like a local declaration.
2159
2384
  // Values the package itself would produce stay refused at their import.
2160
- const packageOnly = (sym) => {
2161
- const decls = sym ? sym.declarations : undefined;
2162
- return decls &&
2163
- decls.length > 0 &&
2164
- decls.every((d) => {
2165
- const sf = ts.getSourceFileOfNode(d);
2166
- return sf.isDeclarationFile && !ctx.isStdlibFile(sf) && !ctx.isExternalTypeFile(sf);
2167
- })
2168
- ? decls
2169
- : null;
2170
- };
2171
- const pureTypeShape = (decls) => decls === null ||
2172
- decls.every((d) => packageTypeFile(ts.getSourceFileOfNode(d), ctx) &&
2173
- (ts.isInterfaceDeclaration(d) ||
2174
- ts.isTypeAliasDeclaration(d) ||
2175
- ts.isTypeLiteralNode(d) ||
2176
- ts.isMappedTypeNode(d) ||
2177
- isDeclaredDataClass(d) ||
2178
- (decls.some(isDeclaredDataClass) && isTypeOnlyNamespace(d))));
2179
- const aliasDecls = packageOnly(widened.getAliasSymbol());
2180
- const ownDecls = packageOnly(widened.getSymbol());
2181
- if ((aliasDecls !== null || (widened.getAliasSymbol() === undefined && ownDecls !== null)) &&
2182
- !(pureTypeShape(aliasDecls) && pureTypeShape(ownDecls))) {
2183
- return null;
2385
+ {
2386
+ const aliasDecls = packageDeclarations(widened.getAliasSymbol(), ctx);
2387
+ const ownDecls = packageDeclarations(widened.getSymbol(), ctx);
2388
+ if ((aliasDecls !== null || (widened.getAliasSymbol() === undefined && ownDecls !== null)) &&
2389
+ !(purePackageDeclarations(aliasDecls, ctx) && purePackageDeclarations(ownDecls, ctx))) {
2390
+ return null;
2391
+ }
2184
2392
  }
2185
2393
  // Module namespaces were claimed above when they name compiled source
2186
2394
  // modules or supported builtins. Declaration-only namespaces remain refused.
@@ -2398,8 +2606,22 @@ function mapTypeInner(type, ctx) {
2398
2606
  }
2399
2607
  }
2400
2608
  const classView = mapClassView(widened, ctx);
2401
- if (classView !== undefined)
2609
+ if (classView !== undefined) {
2610
+ // An intersection of ONE compiled class instance with data-only object
2611
+ // types is a class instance carrying expando properties
2612
+ // (`Box & { preview?: Preview }`): the class owns the instance's
2613
+ // storage and the other members are properties the instance carries at
2614
+ // run time, so the class view has no single layout to answer (null).
2615
+ // The checked-dynamic representation IS that object model — one object,
2616
+ // the instance's identity and prototype, class fields reading and
2617
+ // writing through the live view, extra members in its property table.
2618
+ if (classView === null && widened.isIntersectionType()) {
2619
+ const expando = mapClassExpandoIntersection(widened, ctx);
2620
+ if (expando)
2621
+ return expando;
2622
+ }
2402
2623
  return classView;
2624
+ }
2403
2625
  // Class instances name a program class. The same symbol with construct
2404
2626
  // signatures names its static side, mapped to classval below.
2405
2627
  const widenedSym = widened.getSymbol();
@@ -2556,15 +2778,24 @@ function mapTypeInner(type, ctx) {
2556
2778
  // outside stays unmapped — callers report the component fence (SC2009)
2557
2779
  // naming the offending half, as does the `new Map` lowering per site.
2558
2780
  const psym = widened.getSymbol();
2559
- const isStdlibInterface = (name) => psym !== undefined &&
2560
- ts.symbolName(psym) === name &&
2561
- psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)));
2781
+ // The symbol's name and its standard-library declarations, asked once per
2782
+ // type (provenanceOf memoizes the answer per symbol). No symbol is named
2783
+ // "", so the absent symbol's placeholder names nothing.
2784
+ const psymName = psym === undefined ? "" : ts.symbolName(psym);
2785
+ const provenance = psym === undefined ? null : provenanceOf(psym, ctx);
2786
+ const isStdlibInterface = (name) => provenance !== null && name === psymName && provenance.stdlibInterface;
2787
+ // The async iteration protocols a `for await` source is annotated with
2788
+ // (and the older spelling of an async generator's iterator object). Node's
2789
+ // typings declare an interface named AsyncIterator too — the native handle
2790
+ // timers/promises.setInterval answers, which that builtin's lowering
2791
+ // builds — so only the ES lib's declarations take the protocol mapping.
2792
+ const isLibAsyncInterface = (name) => provenance !== null && name === psymName && provenance.libInterface;
2793
+ const isAsyncIterationProtocol = () => isLibAsyncInterface("AsyncIterable") ||
2794
+ isLibAsyncInterface("AsyncIterator") ||
2795
+ isLibAsyncInterface("AsyncIterableIterator");
2562
2796
  // The timer handles: an interface in the fallback and in @types/node 22+,
2563
2797
  // a class (`class Timeout implements Timer`) in @types/node 20 and older.
2564
- const isStdlibTimerHandle = (name) => psym !== undefined &&
2565
- ts.symbolName(psym) === name &&
2566
- psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2567
- ctx.isStdlibFile(ts.getSourceFileOfNode(d)));
2798
+ const isStdlibTimerHandle = (name) => provenance !== null && name === psymName && provenance.stdlibClass;
2568
2799
  // The builtin Error classes: references to the lib's Error interfaces map to the runtime-provided class
2569
2800
  // hierarchy (provenance, not the name — a user's own `class Error`
2570
2801
  // resolved through the class-instance branch above, and a user
@@ -2578,7 +2809,7 @@ function mapTypeInner(type, ctx) {
2578
2809
  // node:assert's AssertionError is declared as a class (in the shipped
2579
2810
  // fallback and in @types/node), not as a lib interface.
2580
2811
  if (psym !== undefined &&
2581
- ts.symbolName(psym) === "AssertionError" &&
2812
+ psymName === "AssertionError" &&
2582
2813
  psym.declarations.some((d) => ts.isClassDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d))))
2583
2814
  return { kind: "object", className: "%AssertionError" };
2584
2815
  // The lib's `Object` interface is a TOP type: tsc admits every
@@ -2595,11 +2826,11 @@ function mapTypeInner(type, ctx) {
2595
2826
  // module lowering before generic number operations can observe the
2596
2827
  // representation. The node:module class's merged instance interface is
2597
2828
  // included, while unrelated user interfaces named Module stay structural.
2598
- if (((psym !== undefined && ts.symbolName(psym) === "ScriptcModule") ||
2599
- (psym !== undefined && ts.symbolName(psym) === "Module")) &&
2829
+ if (((psym !== undefined && psymName === "ScriptcModule") ||
2830
+ (psym !== undefined && psymName === "Module")) &&
2600
2831
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2601
2832
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2602
- (ts.symbolName(psym) === "ScriptcModule" ||
2833
+ (psymName === "ScriptcModule" ||
2603
2834
  isDeclaredInAmbientNamespace(d, "NodeJS") ||
2604
2835
  isDeclaredInAmbientModule(d, "module")))) {
2605
2836
  return F64;
@@ -2612,7 +2843,7 @@ function mapTypeInner(type, ctx) {
2612
2843
  // NodeJS.EventEmitter interface (the structural surface net.Socket
2613
2844
  // et al. extend) is the same runtime value. Provenance-checked.
2614
2845
  if (psym !== undefined &&
2615
- ts.symbolName(psym) === "EventEmitter" &&
2846
+ psymName === "EventEmitter" &&
2616
2847
  psym.declarations.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
2617
2848
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2618
2849
  (isDeclaredInAmbientModule(d, "events") || isDeclaredInAmbientNamespace(d, "NodeJS")))) {
@@ -2623,7 +2854,7 @@ function mapTypeInner(type, ctx) {
2623
2854
  // precedent). The NAME is generic, so the provenance check adds the
2624
2855
  // enclosing ambient module, like net.Server.
2625
2856
  if (psym !== undefined &&
2626
- ts.symbolName(psym) === "Interface" &&
2857
+ psymName === "Interface" &&
2627
2858
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2628
2859
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2629
2860
  (isDeclaredInAmbientModule(d, "readline") ||
@@ -2634,7 +2865,7 @@ function mapTypeInner(type, ctx) {
2634
2865
  // it keeps Node's own shape (an undefined name, the escape sequences'
2635
2866
  // code member).
2636
2867
  if (psym !== undefined &&
2637
- ts.symbolName(psym) === "Key" &&
2868
+ psymName === "Key" &&
2638
2869
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
2639
2870
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2640
2871
  (isDeclaredInAmbientModule(d, "readline") ||
@@ -2643,7 +2874,7 @@ function mapTypeInner(type, ctx) {
2643
2874
  }
2644
2875
  // readline/promises.Readline: an f64 handle the same way.
2645
2876
  if (psym !== undefined &&
2646
- ts.symbolName(psym) === "Readline" &&
2877
+ psymName === "Readline" &&
2647
2878
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2648
2879
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2649
2880
  isDeclaredInAmbientModule(d, "readline/promises"))) {
@@ -2656,7 +2887,7 @@ function mapTypeInner(type, ctx) {
2656
2887
  // plus the ambient module suffices for both the fallback declarations
2657
2888
  // and @types/node's class Channel<StoreType, ContextType>.
2658
2889
  if (psym !== undefined &&
2659
- ts.symbolName(psym) === "Channel" &&
2890
+ psymName === "Channel" &&
2660
2891
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2661
2892
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2662
2893
  isDeclaredInAmbientModule(d, "diagnostics_channel"))) {
@@ -2666,7 +2897,7 @@ function mapTypeInner(type, ctx) {
2666
2897
  // the runtime's store id space (the Channel story — stores are
2667
2898
  // process-lived; contexts ride the fiber machinery).
2668
2899
  if (psym !== undefined &&
2669
- ts.symbolName(psym) === "AsyncLocalStorage" &&
2900
+ psymName === "AsyncLocalStorage" &&
2670
2901
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2671
2902
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2672
2903
  isDeclaredInAmbientModule(d, "async_hooks"))) {
@@ -2675,7 +2906,7 @@ function mapTypeInner(type, ctx) {
2675
2906
  // diagnostics_channel.TracingChannel: the same f64-handle story over the
2676
2907
  // runtime's tracing registry (five event channels per entry).
2677
2908
  if (psym !== undefined &&
2678
- ts.symbolName(psym) === "TracingChannel" &&
2909
+ psymName === "TracingChannel" &&
2679
2910
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2680
2911
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2681
2912
  isDeclaredInAmbientModule(d, "diagnostics_channel"))) {
@@ -2708,15 +2939,15 @@ function mapTypeInner(type, ctx) {
2708
2939
  };
2709
2940
  // WHATWG codec instances have ordinary reference identity and ownership.
2710
2941
  // Their private encoding slot is omitted from enumeration and JSON.
2711
- if (((psym !== undefined && ts.symbolName(psym) === "TextEncoder") ||
2712
- (psym !== undefined && ts.symbolName(psym) === "TextDecoder")) &&
2942
+ if (((psym !== undefined && psymName === "TextEncoder") ||
2943
+ (psym !== undefined && psymName === "TextDecoder")) &&
2713
2944
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2714
2945
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2715
2946
  return {
2716
2947
  kind: "record",
2717
2948
  shapeId: ctx.shapes.intern([
2718
- { name: `%${ts.symbolName(psym)}`, type: F64 },
2719
- ...(ts.symbolName(psym) === "TextDecoder"
2949
+ { name: `%${psymName}`, type: F64 },
2950
+ ...(psymName === "TextDecoder"
2720
2951
  ? [
2721
2952
  { name: "%fatal", type: BOOL },
2722
2953
  { name: "%ignoreBOM", type: BOOL },
@@ -2734,7 +2965,7 @@ function mapTypeInner(type, ctx) {
2734
2965
  // special-cased in lowerNew / lowerStringDecoderMethodCall, so the
2735
2966
  // record shape never surfaces.
2736
2967
  if (psym !== undefined &&
2737
- ts.symbolName(psym) === "StringDecoder" &&
2968
+ psymName === "StringDecoder" &&
2738
2969
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2739
2970
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2740
2971
  return {
@@ -2803,7 +3034,7 @@ function mapTypeInner(type, ctx) {
2803
3034
  // `typeof inspect`): the runtime's inspect function, called through the
2804
3035
  // checked-dynamic boundary.
2805
3036
  if (psym !== undefined &&
2806
- ts.symbolName(psym) === "inspect" &&
3037
+ psymName === "inspect" &&
2807
3038
  psym.declarations.some((d) => ts.isFunctionDeclaration(d) &&
2808
3039
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2809
3040
  isDeclaredInAmbientModule(d, "util")))
@@ -2824,7 +3055,7 @@ function mapTypeInner(type, ctx) {
2824
3055
  // option record whose members include functions, agents and signals.
2825
3056
  // Values ride checked-dynamic storage, like SpawnOptions.
2826
3057
  if (psym !== undefined &&
2827
- ts.symbolName(psym) === "RequestOptions" &&
3058
+ psymName === "RequestOptions" &&
2828
3059
  psym.declarations.some((d) => {
2829
3060
  if (!ts.isInterfaceDeclaration(d) || !ctx.isStdlibFile(ts.getSourceFileOfNode(d)))
2830
3061
  return false;
@@ -2858,8 +3089,7 @@ function mapTypeInner(type, ctx) {
2858
3089
  }
2859
3090
  }
2860
3091
  if (psym &&
2861
- (ts.symbolName(psym) === "ReadableStreamReadValueResult" ||
2862
- ts.symbolName(psym) === "ReadableStreamReadDoneResult") &&
3092
+ (psymName === "ReadableStreamReadValueResult" || psymName === "ReadableStreamReadDoneResult") &&
2863
3093
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2864
3094
  const elemTs = checker.getTypeArguments(widened)[0];
2865
3095
  const elem = elemTs && elemTs.flags & ts.TypeFlags.Any ? DYN : elemTs ? mapType(elemTs, ctx) : null;
@@ -2870,10 +3100,10 @@ function mapTypeInner(type, ctx) {
2870
3100
  // node:net's SocketAddress and BlockList (scr_net.c) and node:util's
2871
3101
  // MIMEType and MIMEParams (scr_mime.c): native handles whose getters and
2872
3102
  // methods dispatch through the handle.
2873
- if (((psym !== undefined && ts.symbolName(psym) === "SocketAddress") ||
2874
- (psym !== undefined && ts.symbolName(psym) === "BlockList") ||
2875
- (psym !== undefined && ts.symbolName(psym) === "MIMEType") ||
2876
- (psym !== undefined && ts.symbolName(psym) === "MIMEParams")) &&
3103
+ if (((psym !== undefined && psymName === "SocketAddress") ||
3104
+ (psym !== undefined && psymName === "BlockList") ||
3105
+ (psym !== undefined && psymName === "MIMEType") ||
3106
+ (psym !== undefined && psymName === "MIMEParams")) &&
2877
3107
  psym.declarations.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
2878
3108
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2879
3109
  return DYN;
@@ -2882,7 +3112,7 @@ function mapTypeInner(type, ctx) {
2882
3112
  // (scr_util_timing.c): native functions with their own members and
2883
3113
  // getters.
2884
3114
  if (psym !== undefined &&
2885
- (ts.symbolName(psym) === "DebouncedFunction" || ts.symbolName(psym) === "ThrottledFunction") &&
3115
+ (psymName === "DebouncedFunction" || psymName === "ThrottledFunction") &&
2886
3116
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2887
3117
  return DYN;
2888
3118
  }
@@ -2891,7 +3121,7 @@ function mapTypeInner(type, ctx) {
2891
3121
  // the algorithm dictionaries the methods take and keys report are plain
2892
3122
  // checked-dynamic objects.
2893
3123
  if (psym &&
2894
- WEBCRYPTO_DYN_TYPES.has(ts.symbolName(psym)) &&
3124
+ WEBCRYPTO_DYN_TYPES.has(psymName) &&
2895
3125
  psym.declarations.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
2896
3126
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2897
3127
  return DYN;
@@ -2900,8 +3130,8 @@ function mapTypeInner(type, ctx) {
2900
3130
  // public keys (scr_pki.c) are native handles whose getters and methods
2901
3131
  // dispatch through the handle. The JsonWebKey that export() returns is a
2902
3132
  // plain checked-dynamic object.
2903
- if (((psym !== undefined && ts.symbolName(psym) === "KeyObject") ||
2904
- (psym !== undefined && ts.symbolName(psym) === "JsonWebKey")) &&
3133
+ if (((psym !== undefined && psymName === "KeyObject") ||
3134
+ (psym !== undefined && psymName === "JsonWebKey")) &&
2905
3135
  psym.declarations.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
2906
3136
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2907
3137
  return DYN;
@@ -2910,7 +3140,7 @@ function mapTypeInner(type, ctx) {
2910
3140
  // objects, so a value asserted to one (`opts as
2911
3141
  // crypto.AsymmetricKeyExportOptions<"pem">`) reaches the call unchanged.
2912
3142
  if (psym !== undefined &&
2913
- CRYPTO_KEY_OPTION_DYN_TYPES.has(ts.symbolName(psym)) &&
3143
+ CRYPTO_KEY_OPTION_DYN_TYPES.has(psymName) &&
2914
3144
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
2915
3145
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2916
3146
  isDeclaredInAmbientModule(d, "crypto"))) {
@@ -2919,15 +3149,15 @@ function mapTypeInner(type, ctx) {
2919
3149
  // node:crypto's Sign and Verify (createSign/createVerify): native
2920
3150
  // handles over the digest state (scr_pki.c).
2921
3151
  if (psym !== undefined &&
2922
- (ts.symbolName(psym) === "Sign" || ts.symbolName(psym) === "Verify") &&
3152
+ (psymName === "Sign" || psymName === "Verify") &&
2923
3153
  psym.declarations.some((d) => ts.isClassDeclaration(d) &&
2924
3154
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
2925
3155
  isDeclaredInAmbientModule(d, "crypto"))) {
2926
3156
  return DYN;
2927
3157
  }
2928
3158
  if (psym &&
2929
- FETCH_AMBIENT_TYPES.includes(ts.symbolName(psym)) &&
2930
- !((ts.symbolName(psym) === "ReadableStream" || ts.symbolName(psym) === "WritableStream") &&
3159
+ FETCH_AMBIENT_TYPES.includes(psymName) &&
3160
+ !((psymName === "ReadableStream" || psymName === "WritableStream") &&
2931
3161
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && isDeclaredInAmbientNamespace(d, "NodeJS"))) &&
2932
3162
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
2933
3163
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
@@ -2940,10 +3170,10 @@ function mapTypeInner(type, ctx) {
2940
3170
  // AsyncDisposable are checked objects carrying their Symbol.dispose or
2941
3171
  // Symbol.asyncDispose method. A DisposableStack is a native handle whose
2942
3172
  // methods are function values of its checked-dynamic view.
2943
- if (((psym !== undefined && ts.symbolName(psym) === "Console") ||
2944
- (psym !== undefined && ts.symbolName(psym) === "Disposable") ||
2945
- (psym !== undefined && ts.symbolName(psym) === "AsyncDisposable") ||
2946
- (psym !== undefined && ts.symbolName(psym) === "DisposableStack")) &&
3173
+ if (((psym !== undefined && psymName === "Console") ||
3174
+ (psym !== undefined && psymName === "Disposable") ||
3175
+ (psym !== undefined && psymName === "AsyncDisposable") ||
3176
+ (psym !== undefined && psymName === "DisposableStack")) &&
2947
3177
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2948
3178
  return DYN;
2949
3179
  }
@@ -2951,14 +3181,14 @@ function mapTypeInner(type, ctx) {
2951
3181
  // interfaces over them) are native handles carried by the checked-dynamic
2952
3182
  // representation; lowerCipherMethodCall dispatches their methods.
2953
3183
  if (psym !== undefined &&
2954
- CIPHER_TYPE_NAMES.has(ts.symbolName(psym)) &&
3184
+ CIPHER_TYPE_NAMES.has(psymName) &&
2955
3185
  psym.declarations.some((d) => ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2956
3186
  return DYN;
2957
3187
  }
2958
3188
  // node:crypto ECDH values are native handles carried by the
2959
3189
  // checked-dynamic representation; lowerEcdhCall dispatches their methods.
2960
3190
  if (psym !== undefined &&
2961
- ts.symbolName(psym) === "ECDH" &&
3191
+ psymName === "ECDH" &&
2962
3192
  psym.declarations.some((d) => ts.isClassDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
2963
3193
  return DYN;
2964
3194
  }
@@ -3111,7 +3341,7 @@ function mapTypeInner(type, ctx) {
3111
3341
  // fallback and by @types/node (whose NonSharedBuffer alias resolves to
3112
3342
  // the same symbol); provenance-checked like URL.
3113
3343
  if (psym !== undefined &&
3114
- ts.symbolName(psym) === "Buffer" &&
3344
+ psymName === "Buffer" &&
3115
3345
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3116
3346
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3117
3347
  return bytesOf("u8");
@@ -3122,7 +3352,7 @@ function mapTypeInner(type, ctx) {
3122
3352
  // instance type). Provenance, not the name: a user's own URL maps as a
3123
3353
  // record/class like any other.
3124
3354
  if (psym !== undefined &&
3125
- ts.symbolName(psym) === "URL" &&
3355
+ psymName === "URL" &&
3126
3356
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3127
3357
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3128
3358
  return { kind: "url" };
@@ -3131,7 +3361,7 @@ function mapTypeInner(type, ctx) {
3131
3361
  // interface by the shipped fallback and by @types/node (plus `class
3132
3362
  // URLSearchParams` in the "url" module). Provenance-checked like URL.
3133
3363
  if (psym !== undefined &&
3134
- ts.symbolName(psym) === "URLSearchParams" &&
3364
+ psymName === "URLSearchParams" &&
3135
3365
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3136
3366
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3137
3367
  return { kind: "searchParams" };
@@ -3139,7 +3369,7 @@ function mapTypeInner(type, ctx) {
3139
3369
  // fs.Stats: @types/node's `class Stats` (module "fs") or the fallback
3140
3370
  // declarations' interface. Provenance-checked like URL.
3141
3371
  if (psym !== undefined &&
3142
- ts.symbolName(psym) === "Stats" &&
3372
+ psymName === "Stats" &&
3143
3373
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3144
3374
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3145
3375
  return { kind: "stats" };
@@ -3149,16 +3379,16 @@ function mapTypeInner(type, ctx) {
3149
3379
  // `class BigIntStats` in "fs"; the fallback declarations keep the class
3150
3380
  // shape too. Provenance-checked like Stats.
3151
3381
  if (psym !== undefined &&
3152
- ts.symbolName(psym) === "BigIntStats" &&
3382
+ psymName === "BigIntStats" &&
3153
3383
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3154
3384
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3155
3385
  return { kind: "bigintStats" };
3156
3386
  }
3157
3387
  // Capacity snapshots and options keep their live object representation
3158
3388
  // across numeric/BigInt overloads, runtime options, and callbacks.
3159
- if (((psym !== undefined && ts.symbolName(psym) === "StatsFs") ||
3160
- (psym !== undefined && ts.symbolName(psym) === "BigIntStatsFs") ||
3161
- (psym !== undefined && ts.symbolName(psym) === "StatFsOptions")) &&
3389
+ if (((psym !== undefined && psymName === "StatsFs") ||
3390
+ (psym !== undefined && psymName === "BigIntStatsFs") ||
3391
+ (psym !== undefined && psymName === "StatFsOptions")) &&
3162
3392
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3163
3393
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3164
3394
  isDeclaredInAmbientModule(d, "fs")))
@@ -3169,7 +3399,7 @@ function mapTypeInner(type, ctx) {
3169
3399
  // distinguishes it from user interfaces with the same name; both the
3170
3400
  // fallback and @types/node declare it in "fs/promises".
3171
3401
  if (psym !== undefined &&
3172
- ts.symbolName(psym) === "FileHandle" &&
3402
+ psymName === "FileHandle" &&
3173
3403
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3174
3404
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3175
3405
  isDeclaredInAmbientModule(d, "fs/promises"))) {
@@ -3178,7 +3408,7 @@ function mapTypeInner(type, ctx) {
3178
3408
  // fs.Dir: an open directory stream, declared in "fs" by both the
3179
3409
  // fallback and @types/node.
3180
3410
  if (psym !== undefined &&
3181
- ts.symbolName(psym) === "Dir" &&
3411
+ psymName === "Dir" &&
3182
3412
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3183
3413
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3184
3414
  isDeclaredInAmbientModule(d, "fs"))) {
@@ -3189,7 +3419,7 @@ function mapTypeInner(type, ctx) {
3189
3419
  // reads work either way) or the fallback declarations' plain interface.
3190
3420
  // Provenance-checked like Stats.
3191
3421
  if (psym !== undefined &&
3192
- ts.symbolName(psym) === "SpawnSyncReturns" &&
3422
+ psymName === "SpawnSyncReturns" &&
3193
3423
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3194
3424
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3195
3425
  return { kind: "spawnRes" };
@@ -3198,9 +3428,9 @@ function mapTypeInner(type, ctx) {
3198
3428
  // interfaces: all carry the same runtime child handle; the generic
3199
3429
  // refinements only tell the checker which stdio properties are null.
3200
3430
  if (psym !== undefined &&
3201
- (ts.symbolName(psym) === "ChildProcess" ||
3202
- ts.symbolName(psym) === "ChildProcessWithoutNullStreams" ||
3203
- ts.symbolName(psym) === "ChildProcessByStdio") &&
3431
+ (psymName === "ChildProcess" ||
3432
+ psymName === "ChildProcessWithoutNullStreams" ||
3433
+ psymName === "ChildProcessByStdio") &&
3204
3434
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3205
3435
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3206
3436
  isDeclaredInAmbientModule(d, "child_process"))) {
@@ -3213,9 +3443,9 @@ function mapTypeInner(type, ctx) {
3213
3443
  // declare these inside `declare module "net"` — a declaration outside
3214
3444
  // that module (http's Server) stays unmapped and fences at its use
3215
3445
  // site.
3216
- if (((psym !== undefined && ts.symbolName(psym) === "Server") ||
3217
- (psym !== undefined && ts.symbolName(psym) === "Socket") ||
3218
- (psym !== undefined && ts.symbolName(psym) === "TLSSocket")) &&
3446
+ if (((psym !== undefined && psymName === "Server") ||
3447
+ (psym !== undefined && psymName === "Socket") ||
3448
+ (psym !== undefined && psymName === "TLSSocket")) &&
3219
3449
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3220
3450
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3221
3451
  (isDeclaredInAmbientModule(d, "net") ||
@@ -3224,12 +3454,12 @@ function mapTypeInner(type, ctx) {
3224
3454
  // (listen/close/address/'error'), same handle kind. tls.TLSSocket
3225
3455
  // extends net.Socket the same way: post-handshake it IS a net
3226
3456
  // socket to every lowered member.
3227
- (ts.symbolName(psym) === "Server" &&
3457
+ (psymName === "Server" &&
3228
3458
  (isDeclaredInAmbientModule(d, "http") ||
3229
3459
  isDeclaredInAmbientModule(d, "tls") ||
3230
3460
  isDeclaredInAmbientModule(d, "https"))) ||
3231
- (ts.symbolName(psym) === "TLSSocket" && isDeclaredInAmbientModule(d, "tls"))))) {
3232
- return ts.symbolName(psym) === "Server" ? { kind: "netServer" } : { kind: "netSocket" };
3461
+ (psymName === "TLSSocket" && isDeclaredInAmbientModule(d, "tls"))))) {
3462
+ return psymName === "Server" ? { kind: "netServer" } : { kind: "netSocket" };
3233
3463
  }
3234
3464
  // tls.SecureContext: the opaque parsed-cert/key handle SNI callbacks
3235
3465
  // answer with (tls.createSecureContext({ cert, key }) mints it; the TLS
@@ -3237,7 +3467,7 @@ function mapTypeInner(type, ctx) {
3237
3467
  // @types/node declares `interface SecureContext` inside `declare module
3238
3468
  // "tls"`, and the shipped fallback mirrors it.
3239
3469
  if (psym !== undefined &&
3240
- ts.symbolName(psym) === "SecureContext" &&
3470
+ psymName === "SecureContext" &&
3241
3471
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3242
3472
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3243
3473
  isDeclaredInAmbientModule(d, "tls"))) {
@@ -3246,7 +3476,7 @@ function mapTypeInner(type, ctx) {
3246
3476
  // Scrypt's runtime options retain property accessors and aliases. Use
3247
3477
  // checked values so presence probes and repeated getter reads match Node.
3248
3478
  if (psym !== undefined &&
3249
- ts.symbolName(psym) === "ScryptOptions" &&
3479
+ psymName === "ScryptOptions" &&
3250
3480
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3251
3481
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3252
3482
  isDeclaredInAmbientModule(d, "crypto")))
@@ -3254,19 +3484,18 @@ function mapTypeInner(type, ctx) {
3254
3484
  // crypto.Hash / crypto.Hmac: native incremental digest handles. Keep
3255
3485
  // provenance module-qualified so user classes with these common names
3256
3486
  // retain their ordinary structural/class representation.
3257
- if (((psym !== undefined && ts.symbolName(psym) === "Hash") ||
3258
- (psym !== undefined && ts.symbolName(psym) === "Hmac")) &&
3487
+ if (((psym !== undefined && psymName === "Hash") || (psym !== undefined && psymName === "Hmac")) &&
3259
3488
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3260
3489
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3261
3490
  isDeclaredInAmbientModule(d, "crypto"))) {
3262
- return ts.symbolName(psym) === "Hash" ? CRYPTOHASH_T : CRYPTOHMAC_T;
3491
+ return psymName === "Hash" ? CRYPTOHASH_T : CRYPTOHMAC_T;
3263
3492
  }
3264
3493
  // fs.FSWatcher: the fs.watch handle (scr_watch.c). Module-checked like
3265
3494
  // net.Server — @types/node declares `interface FSWatcher extends
3266
3495
  // EventEmitter` inside `declare module "fs"`, and the shipped fallback
3267
3496
  // mirrors it.
3268
3497
  if (psym !== undefined &&
3269
- ts.symbolName(psym) === "FSWatcher" &&
3498
+ psymName === "FSWatcher" &&
3270
3499
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3271
3500
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3272
3501
  isDeclaredInAmbientModule(d, "fs"))) {
@@ -3308,7 +3537,7 @@ function mapTypeInner(type, ctx) {
3308
3537
  return DYN;
3309
3538
  }
3310
3539
  const nodeWritableInterface = psym !== undefined &&
3311
- ts.symbolName(psym) === "WritableStream" &&
3540
+ psymName === "WritableStream" &&
3312
3541
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3313
3542
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3314
3543
  isDeclaredInAmbientNamespace(d, "NodeJS"));
@@ -3316,7 +3545,7 @@ function mapTypeInner(type, ctx) {
3316
3545
  return ctx.dynNodeStreams === true ? DYN : { kind: "object", className: "%Writable" };
3317
3546
  }
3318
3547
  if ((psym !== undefined &&
3319
- ts.symbolName(psym) === "WriteStream" &&
3548
+ psymName === "WriteStream" &&
3320
3549
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3321
3550
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3322
3551
  (isDeclaredInAmbientModule(d, "tty") ||
@@ -3329,13 +3558,13 @@ function mapTypeInner(type, ctx) {
3329
3558
  // stream.Writable. As with stream.Readable below, unsupported producers
3330
3559
  // of the broad @types class fence where they are constructed.
3331
3560
  if ((psym !== undefined &&
3332
- ts.symbolName(psym) === "ChildStdin" &&
3561
+ psymName === "ChildStdin" &&
3333
3562
  ctx.generalNodeStreams !== true &&
3334
3563
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3335
3564
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3336
3565
  isDeclaredInAmbientModule(d, "child_process"))) ||
3337
3566
  (psym !== undefined &&
3338
- ts.symbolName(psym) === "Writable" &&
3567
+ psymName === "Writable" &&
3339
3568
  ctx.generalNodeStreams !== true &&
3340
3569
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3341
3570
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
@@ -3347,7 +3576,7 @@ function mapTypeInner(type, ctx) {
3347
3576
  // ChildStdin is the runtime Writable too (child.stdioStream bridges it).
3348
3577
  if (ctx.generalNodeStreams === true &&
3349
3578
  psym !== undefined &&
3350
- ts.symbolName(psym) === "ChildStdin" &&
3579
+ psymName === "ChildStdin" &&
3351
3580
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3352
3581
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3353
3582
  isDeclaredInAmbientModule(d, "child_process"))) {
@@ -3365,7 +3594,7 @@ function mapTypeInner(type, ctx) {
3365
3594
  // Writable join them under the general representation.
3366
3595
  for (const [irName, rec] of RUNTIME_STREAM_CLASSES) {
3367
3596
  if (psym !== undefined &&
3368
- ts.symbolName(psym) === rec.lib &&
3597
+ psymName === rec.lib &&
3369
3598
  psym.declarations.some((d) => ts.isClassDeclaration(d) &&
3370
3599
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3371
3600
  (!isNodeTypesPath(ts.getSourceFileOfNode(d).fileName) ||
@@ -3378,7 +3607,7 @@ function mapTypeInner(type, ctx) {
3378
3607
  // node:zlib's stream classes (the shipped fallback declarations and
3379
3608
  // @types/node's): their instances are runtime Transform streams.
3380
3609
  if (psym !== undefined &&
3381
- ZLIB_STREAM_MODES.has(ts.symbolName(psym)) &&
3610
+ ZLIB_STREAM_MODES.has(psymName) &&
3382
3611
  psym.declarations.some((d) => (ts.isClassDeclaration(d) ||
3383
3612
  (ts.isInterfaceDeclaration(d) && isNodeTypesPath(ts.getSourceFileOfNode(d).fileName))) &&
3384
3613
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
@@ -3388,32 +3617,38 @@ function mapTypeInner(type, ctx) {
3388
3617
  // fs.ReadStream / fs.WriteStream (the shipped fallback declarations and
3389
3618
  // @types/node's): their instances are runtime Readable / Writable
3390
3619
  // streams (scr_fs_stream.c).
3391
- if (((psym !== undefined && ts.symbolName(psym) === "ReadStream") ||
3392
- (psym !== undefined && ts.symbolName(psym) === "WriteStream")) &&
3620
+ if (((psym !== undefined && psymName === "ReadStream") ||
3621
+ (psym !== undefined && psymName === "WriteStream")) &&
3393
3622
  psym.declarations.some((d) => ts.isClassDeclaration(d) &&
3394
3623
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3395
3624
  isDeclaredInAmbientModule(d, "fs"))) {
3396
3625
  return {
3397
3626
  kind: "object",
3398
- className: ts.symbolName(psym) === "ReadStream" ? "%Readable" : "%Writable",
3627
+ className: psymName === "ReadStream" ? "%Readable" : "%Writable",
3399
3628
  };
3400
3629
  }
3401
3630
  if ((psym !== undefined &&
3402
- ts.symbolName(psym) === "Readable" &&
3631
+ psymName === "Readable" &&
3403
3632
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3404
3633
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3405
3634
  isDeclaredInAmbientModule(d, "stream"))) ||
3406
3635
  (psym !== undefined &&
3407
- ts.symbolName(psym) === "ReadableStream" &&
3636
+ psymName === "ReadableStream" &&
3408
3637
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3409
3638
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3410
- isDeclaredInAmbientNamespace(d, "NodeJS")))) {
3639
+ isDeclaredInAmbientNamespace(d, "NodeJS"))) ||
3640
+ (psym !== undefined &&
3641
+ psymName === "ChildStdout" &&
3642
+ psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3643
+ ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3644
+ isDeclaredInAmbientModule(d, "child_process")))) {
3411
3645
  // The general representation: the runtime Readable, which child
3412
3646
  // stdio reads produce through the child stream bridge. With
3413
3647
  // checked-dynamic stream slots, NodeJS.ReadableStream holds any
3414
3648
  // stream value (dyn-streams.ts); stream.Readable keeps the class.
3415
3649
  if (ctx.generalNodeStreams === true) {
3416
- if (ctx.dynNodeStreams === true && ts.symbolName(psym) === "ReadableStream")
3650
+ if (ctx.dynNodeStreams === true &&
3651
+ (psymName === "ReadableStream" || psymName === "ChildStdout"))
3417
3652
  return DYN;
3418
3653
  return { kind: "object", className: "%Readable" };
3419
3654
  }
@@ -3424,7 +3659,7 @@ function mapTypeInner(type, ctx) {
3424
3659
  // EventEmitter` and the fallback declarations' interface both live
3425
3660
  // inside `declare module "dgram"`.
3426
3661
  if (psym !== undefined &&
3427
- ts.symbolName(psym) === "Socket" &&
3662
+ psymName === "Socket" &&
3428
3663
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3429
3664
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3430
3665
  isDeclaredInAmbientModule(d, "dgram"))) {
@@ -3436,8 +3671,8 @@ function mapTypeInner(type, ctx) {
3436
3671
  // classes and the fallback declarations' interfaces all live inside
3437
3672
  // `declare module "node:test"` (isDeclaredInAmbientModule answers for
3438
3673
  // both spellings).
3439
- if (((psym !== undefined && ts.symbolName(psym) === "TestContext") ||
3440
- (psym !== undefined && ts.symbolName(psym) === "SuiteContext")) &&
3674
+ if (((psym !== undefined && psymName === "TestContext") ||
3675
+ (psym !== undefined && psymName === "SuiteContext")) &&
3441
3676
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3442
3677
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3443
3678
  isDeclaredInAmbientModule(d, "test"))) {
@@ -3446,8 +3681,8 @@ function mapTypeInner(type, ctx) {
3446
3681
  // node:test's MockFunctionContext<F> and MockFunctionCall<F>: compiler
3447
3682
  // records built from F (mock-shapes.ts). Mock<F> then maps as the hybrid
3448
3683
  // { %call: F, mock } record through mapHybridCallableIntersection.
3449
- if (((psym !== undefined && ts.symbolName(psym) === "MockFunctionContext") ||
3450
- (psym !== undefined && ts.symbolName(psym) === "MockFunctionCall")) &&
3684
+ if (((psym !== undefined && psymName === "MockFunctionContext") ||
3685
+ (psym !== undefined && psymName === "MockFunctionCall")) &&
3451
3686
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3452
3687
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3453
3688
  isDeclaredInAmbientModule(d, "test"))) {
@@ -3455,7 +3690,7 @@ function mapTypeInner(type, ctx) {
3455
3690
  const fn = fnTs ? mapType(fnTs, ctx) : null;
3456
3691
  if (!fn || fn.kind !== "func")
3457
3692
  return null;
3458
- return ts.symbolName(psym) === "MockFunctionContext"
3693
+ return psymName === "MockFunctionContext"
3459
3694
  ? mockContextType(fn, ctx)
3460
3695
  : mockCallRecordType(fn, ctx);
3461
3696
  }
@@ -3465,7 +3700,7 @@ function mapTypeInner(type, ctx) {
3465
3700
  // above; optional metadata uses the same checked property view.
3466
3701
  // Provenance-checked like the rest.
3467
3702
  if (psym !== undefined &&
3468
- ts.symbolName(psym) === "ErrnoException" &&
3703
+ psymName === "ErrnoException" &&
3469
3704
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3470
3705
  return { kind: "object", className: "%Error" };
3471
3706
  }
@@ -3476,7 +3711,7 @@ function mapTypeInner(type, ctx) {
3476
3711
  // of fencing at the declaration. Module-checked like the rest (https'
3477
3712
  // Agent extends http's; both live in their ambient modules).
3478
3713
  if (psym !== undefined &&
3479
- ts.symbolName(psym) === "Agent" &&
3714
+ psymName === "Agent" &&
3480
3715
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3481
3716
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3482
3717
  (isDeclaredInAmbientModule(d, "http") || isDeclaredInAmbientModule(d, "https")))) {
@@ -3485,12 +3720,12 @@ function mapTypeInner(type, ctx) {
3485
3720
  // http.IncomingMessage / http.ServerResponse — module-checked like
3486
3721
  // net.Server (the names repeat nowhere today, but provenance stays the
3487
3722
  // rule).
3488
- if (((psym !== undefined && ts.symbolName(psym) === "IncomingMessage") ||
3489
- (psym !== undefined && ts.symbolName(psym) === "ServerResponse")) &&
3723
+ if (((psym !== undefined && psymName === "IncomingMessage") ||
3724
+ (psym !== undefined && psymName === "ServerResponse")) &&
3490
3725
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3491
3726
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3492
3727
  isDeclaredInAmbientModule(d, "http"))) {
3493
- return ts.symbolName(psym) === "IncomingMessage" ? { kind: "httpReq" } : { kind: "httpRes" };
3728
+ return psymName === "IncomingMessage" ? { kind: "httpReq" } : { kind: "httpRes" };
3494
3729
  }
3495
3730
  // http2's compatibility surface (the allowHTTP1 lowering): the secure
3496
3731
  // server IS a net server (listen/close/address/emit ride the same
@@ -3500,15 +3735,15 @@ function mapTypeInner(type, ctx) {
3500
3735
  // ServerResponse surface. h2-only members (stream, session) fence per
3501
3736
  // member at their use sites (lower-server.ts). Module-checked like the
3502
3737
  // rest.
3503
- if (((psym !== undefined && ts.symbolName(psym) === "Http2SecureServer") ||
3504
- (psym !== undefined && ts.symbolName(psym) === "Http2ServerRequest") ||
3505
- (psym !== undefined && ts.symbolName(psym) === "Http2ServerResponse")) &&
3738
+ if (((psym !== undefined && psymName === "Http2SecureServer") ||
3739
+ (psym !== undefined && psymName === "Http2ServerRequest") ||
3740
+ (psym !== undefined && psymName === "Http2ServerResponse")) &&
3506
3741
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3507
3742
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3508
3743
  isDeclaredInAmbientModule(d, "http2"))) {
3509
- return ts.symbolName(psym) === "Http2SecureServer"
3744
+ return psymName === "Http2SecureServer"
3510
3745
  ? { kind: "netServer" }
3511
- : ts.symbolName(psym) === "Http2ServerRequest"
3746
+ : psymName === "Http2ServerRequest"
3512
3747
  ? { kind: "httpReq" }
3513
3748
  : { kind: "httpRes" };
3514
3749
  }
@@ -3516,25 +3751,25 @@ function mapTypeInner(type, ctx) {
3516
3751
  // like the secure one; sessions and streams are first-class handle
3517
3752
  // kinds (client and server flavors share a kind — the runtime handle
3518
3753
  // carries the role). Module-checked like the rest.
3519
- if (((psym !== undefined && ts.symbolName(psym) === "Http2Server") ||
3520
- (psym !== undefined && ts.symbolName(psym) === "Http2Session") ||
3521
- (psym !== undefined && ts.symbolName(psym) === "ClientHttp2Session") ||
3522
- (psym !== undefined && ts.symbolName(psym) === "ServerHttp2Session") ||
3523
- (psym !== undefined && ts.symbolName(psym) === "ClientHttp2Stream") ||
3524
- (psym !== undefined && ts.symbolName(psym) === "ServerHttp2Stream")) &&
3754
+ if (((psym !== undefined && psymName === "Http2Server") ||
3755
+ (psym !== undefined && psymName === "Http2Session") ||
3756
+ (psym !== undefined && psymName === "ClientHttp2Session") ||
3757
+ (psym !== undefined && psymName === "ServerHttp2Session") ||
3758
+ (psym !== undefined && psymName === "ClientHttp2Stream") ||
3759
+ (psym !== undefined && psymName === "ServerHttp2Stream")) &&
3525
3760
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3526
3761
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3527
3762
  isDeclaredInAmbientModule(d, "http2"))) {
3528
- return ts.symbolName(psym) === "Http2Server"
3763
+ return psymName === "Http2Server"
3529
3764
  ? { kind: "netServer" }
3530
- : ts.symbolName(psym) === "ClientHttp2Stream" || ts.symbolName(psym) === "ServerHttp2Stream"
3765
+ : psymName === "ClientHttp2Stream" || psymName === "ServerHttp2Stream"
3531
3766
  ? { kind: "http2Stream" }
3532
3767
  : { kind: "http2Session" };
3533
3768
  }
3534
3769
  // http.ClientRequest (http.request/http.get results) — module-checked
3535
3770
  // like IncomingMessage.
3536
3771
  if (psym !== undefined &&
3537
- ts.symbolName(psym) === "ClientRequest" &&
3772
+ psymName === "ClientRequest" &&
3538
3773
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3539
3774
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3540
3775
  isDeclaredInAmbientModule(d, "http"))) {
@@ -3549,7 +3784,7 @@ function mapTypeInner(type, ctx) {
3549
3784
  // declarations' anonymous env type takes the pureIndexShape path below
3550
3785
  // and interns the SAME shape.
3551
3786
  if (psym !== undefined &&
3552
- ts.symbolName(psym) === "ProcessEnv" &&
3787
+ psymName === "ProcessEnv" &&
3553
3788
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3554
3789
  const value = withUndefinedArm(STRING, ctx.unions);
3555
3790
  if (!value)
@@ -3596,8 +3831,10 @@ function mapTypeInner(type, ctx) {
3596
3831
  return { kind: "generator", yieldT, retT: VOID, nextT: UNDEFINED_T };
3597
3832
  }
3598
3833
  // Generator<T, TReturn, TNext>, AsyncGenerator<T, TReturn, TNext> (and
3599
- // the lib's IterableIterator<T, ...>, the older sync annotation spelling):
3600
- // the generator kind. Channel normalization keeps the runtime honest:
3834
+ // the lib's IterableIterator<T, ...>, the older sync annotation spelling;
3835
+ // AsyncIterator<T>, AsyncIterableIterator<T> and AsyncIterable<T>, what
3836
+ // `for await` consumes): the generator kind. Channel normalization keeps
3837
+ // the runtime honest:
3601
3838
  // yield channel — T must be a real value type (a generator that could
3602
3839
  // only yield undefined has no C value form); `never`
3603
3840
  // (a generator that never yields) rides the VOID
@@ -3626,19 +3863,32 @@ function mapTypeInner(type, ctx) {
3626
3863
  isStdlibInterface("Iterator") ||
3627
3864
  // IteratorObject<T> is what the iterator helpers return: a helper
3628
3865
  // generator over its source (containers/iterator-helpers.ts).
3629
- isStdlibInterface("IteratorObject")) {
3866
+ isStdlibInterface("IteratorObject") ||
3867
+ isAsyncIterationProtocol()) {
3630
3868
  const args = checker.getTypeArguments(widened);
3631
3869
  const channels = genChannels(args[0], args[1], args[2], ctx);
3632
3870
  if (!channels)
3633
3871
  return null;
3872
+ // The async iteration protocols are what `for await` CONSUMES: the
3873
+ // yield channel is the only promise they make. A for-await consumer
3874
+ // sends nothing back, and a producer's own return and resume
3875
+ // channels are its business, so the protocol spelling takes the
3876
+ // return channel as valueless and the resume channel as the
3877
+ // checked-dynamic one — the channels of the common
3878
+ // `AsyncGenerator<T, void, unknown>` producer annotation.
3879
+ const consumer = isAsyncIterationProtocol()
3880
+ ? { ...channels, retT: VOID, nextT: DYN }
3881
+ : channels;
3634
3882
  // The result record must exist too (its union must be legal), or
3635
3883
  // `.next()` could never answer — mapped generators always resume.
3636
- if (!genResultRecord(channels.yieldT, channels.retT, ctx.shapes, unions))
3884
+ if (!genResultRecord(consumer.yieldT, consumer.retT, ctx.shapes, unions))
3637
3885
  return null;
3638
3886
  return {
3639
3887
  kind: "generator",
3640
- ...(isStdlibInterface("AsyncGenerator") ? { async: true } : {}),
3641
- ...channels,
3888
+ ...(isStdlibInterface("AsyncGenerator") || isAsyncIterationProtocol()
3889
+ ? { async: true }
3890
+ : {}),
3891
+ ...consumer,
3642
3892
  };
3643
3893
  }
3644
3894
  // Iterable<T>: the iterable union (iterableUnionType) — the source value
@@ -3732,6 +3982,37 @@ function mapTypeInner(type, ctx) {
3732
3982
  ], false, undefined, ["encoding", "cwd", "input", "timeout", "stdio", "maxBuffer", "windowsHide"]),
3733
3983
  };
3734
3984
  }
3985
+ // child_process.SpawnSyncOptionsWithStringEncoding: the spawnSync twin of
3986
+ // the exec-options record above, interned explicitly for the same
3987
+ // reason — a typed const or a runner function's options parameter is a
3988
+ // runtime record the spawnSync lowering reads member by member. The
3989
+ // members are the ones it honestly implements: encoding (required — the
3990
+ // "WithStringEncoding" refinement), cwd/input/timeout/shell/stdio (a
3991
+ // runtime array is string[]; unsupported runtime modes throw at the
3992
+ // call), and the accepted-but-inert windowsHide. env and killSignal
3993
+ // stay literal-only, so their presence keeps the shape unmatched and
3994
+ // their literals fence at the shape check instead of being dropped.
3995
+ if (isStdlibInterface("SpawnSyncOptionsWithStringEncoding")) {
3996
+ const optStr = withUndefinedArm(STRING, ctx.unions);
3997
+ const optNum = withUndefinedArm(F64, ctx.unions);
3998
+ const optBool = withUndefinedArm(BOOL, ctx.unions);
3999
+ const stdioArms = [arrayOf(STRING), STRING, UNDEFINED_T].sort((a, b) => typeKey(a) < typeKey(b) ? -1 : 1);
4000
+ const stdio = { kind: "union", unionId: ctx.unions.intern(stdioArms) };
4001
+ if (!optStr || !optNum || !optBool)
4002
+ return null;
4003
+ return {
4004
+ kind: "record",
4005
+ shapeId: ctx.shapes.intern([
4006
+ { name: "cwd", type: optStr },
4007
+ { name: "encoding", type: STRING },
4008
+ { name: "input", type: optStr },
4009
+ { name: "shell", type: optBool },
4010
+ { name: "stdio", type: stdio },
4011
+ { name: "timeout", type: optNum },
4012
+ { name: "windowsHide", type: optBool },
4013
+ ], false, undefined, ["encoding", "cwd", "input", "timeout", "shell", "stdio", "windowsHide"]),
4014
+ };
4015
+ }
3735
4016
  if (isStdlibInterface("AddressInfo")) {
3736
4017
  return {
3737
4018
  kind: "record",
@@ -3775,10 +4056,10 @@ function mapTypeInner(type, ctx) {
3775
4056
  return DYN;
3776
4057
  // Filesystem options are data records. Keep their declared optional fields
3777
4058
  // instead of allowing arbitrary standard-library interfaces into records.
3778
- if (((psym !== undefined && ts.symbolName(psym) === "FileReadOptions") ||
3779
- (psym !== undefined && ts.symbolName(psym) === "ReadOptions") ||
3780
- (psym !== undefined && ts.symbolName(psym) === "ReadOptionsWithBuffer") ||
3781
- (psym !== undefined && ts.symbolName(psym) === "WriteOptions")) &&
4059
+ if (((psym !== undefined && psymName === "FileReadOptions") ||
4060
+ (psym !== undefined && psymName === "ReadOptions") ||
4061
+ (psym !== undefined && psymName === "ReadOptionsWithBuffer") ||
4062
+ (psym !== undefined && psymName === "WriteOptions")) &&
3782
4063
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3783
4064
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3784
4065
  (isDeclaredInAmbientModule(d, "fs/promises") || isDeclaredInAmbientModule(d, "fs")))) {
@@ -3799,24 +4080,24 @@ function mapTypeInner(type, ctx) {
3799
4080
  // null-prototype objects returned by FileHandle.read/write. The native
3800
4081
  // record does not model the prototype (unobservable through the lowered
3801
4082
  // surface); it preserves the caller buffer/string by reference.
3802
- if (((psym !== undefined && ts.symbolName(psym) === "FileReadResult") ||
3803
- (psym !== undefined && ts.symbolName(psym) === "FileWriteResult") ||
3804
- (psym !== undefined && ts.symbolName(psym) === "FileReadvResult") ||
3805
- (psym !== undefined && ts.symbolName(psym) === "FileWritevResult") ||
3806
- (psym !== undefined && ts.symbolName(psym) === "ReadVResult") ||
3807
- (psym !== undefined && ts.symbolName(psym) === "WriteVResult")) &&
4083
+ if (((psym !== undefined && psymName === "FileReadResult") ||
4084
+ (psym !== undefined && psymName === "FileWriteResult") ||
4085
+ (psym !== undefined && psymName === "FileReadvResult") ||
4086
+ (psym !== undefined && psymName === "FileWritevResult") ||
4087
+ (psym !== undefined && psymName === "ReadVResult") ||
4088
+ (psym !== undefined && psymName === "WriteVResult")) &&
3808
4089
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3809
4090
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3810
4091
  (isDeclaredInAmbientModule(d, "fs/promises") ||
3811
- ((ts.symbolName(psym) === "ReadVResult" || ts.symbolName(psym) === "WriteVResult") &&
4092
+ ((psymName === "ReadVResult" || psymName === "WriteVResult") &&
3812
4093
  isDeclaredInAmbientModule(d, "fs"))))) {
3813
4094
  const args = checker.getTypeArguments(widened);
3814
4095
  if (args.length !== 1)
3815
4096
  return null;
3816
- const vector = ts.symbolName(psym) === "FileReadvResult" ||
3817
- ts.symbolName(psym) === "FileWritevResult" ||
3818
- ts.symbolName(psym) === "ReadVResult" ||
3819
- ts.symbolName(psym) === "WriteVResult";
4097
+ const vector = psymName === "FileReadvResult" ||
4098
+ psymName === "FileWritevResult" ||
4099
+ psymName === "ReadVResult" ||
4100
+ psymName === "WriteVResult";
3820
4101
  const emptyVector = vector &&
3821
4102
  checker.isArrayType(args[0]) &&
3822
4103
  (checker.getTypeArguments(args[0])[0].flags & ts.TypeFlags.Never) !== 0;
@@ -3827,9 +4108,7 @@ function mapTypeInner(type, ctx) {
3827
4108
  : !(payload.kind === "string" || (payload.kind === "bytes" && payload.elem === "u8")))) {
3828
4109
  return null;
3829
4110
  }
3830
- const count = ts.symbolName(psym) === "FileReadResult" ||
3831
- ts.symbolName(psym) === "FileReadvResult" ||
3832
- ts.symbolName(psym) === "ReadVResult"
4111
+ const count = psymName === "FileReadResult" || psymName === "FileReadvResult" || psymName === "ReadVResult"
3833
4112
  ? "bytesRead"
3834
4113
  : "bytesWritten";
3835
4114
  const payloadName = vector ? "buffers" : "buffer";
@@ -3856,7 +4135,7 @@ function mapTypeInner(type, ctx) {
3856
4135
  // declares it concrete (an interface; @types/node uses a class — both
3857
4136
  // provenance-checked, the Buffer/URL pattern).
3858
4137
  if (psym !== undefined &&
3859
- ts.symbolName(psym) === "Dirent" &&
4138
+ psymName === "Dirent" &&
3860
4139
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
3861
4140
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
3862
4141
  const args = checker.getTypeArguments(widened);
@@ -3946,6 +4225,20 @@ function mapTypeInner(type, ctx) {
3946
4225
  ], false, undefined, ["uid", "gid", "username", "homedir", "shell"]),
3947
4226
  };
3948
4227
  }
4228
+ // os.BufferUserInfo: os.userInfo({ encoding: 'buffer' }) — the same
4229
+ // record with the three passwd strings as Buffers (the u8 bytes kind).
4230
+ if (isStdlibInterface("BufferUserInfo")) {
4231
+ return {
4232
+ kind: "record",
4233
+ shapeId: ctx.shapes.intern([
4234
+ { name: "gid", type: F64 },
4235
+ { name: "homedir", type: bytesOf("u8") },
4236
+ { name: "shell", type: bytesOf("u8") },
4237
+ { name: "uid", type: F64 },
4238
+ { name: "username", type: bytesOf("u8") },
4239
+ ], false, undefined, ["uid", "gid", "username", "homedir", "shell"]),
4240
+ };
4241
+ }
3949
4242
  // The promisified exec/execFile result `{ stdout: string; stderr: string }`
3950
4243
  // and the promisified dns.lookupService result `{ hostname: string;
3951
4244
  // service: string }`: anonymous type literals (@types/node's
@@ -3987,8 +4280,7 @@ function mapTypeInner(type, ctx) {
3987
4280
  // mapped property types (KeyObjects, PEM strings or DER Buffers), in
3988
4281
  // Node's key order.
3989
4282
  if (psym !== undefined &&
3990
- (ts.symbolName(psym) === "KeyPairKeyObjectResult" ||
3991
- ts.symbolName(psym) === "KeyPairSyncResult") &&
4283
+ (psymName === "KeyPairKeyObjectResult" || psymName === "KeyPairSyncResult") &&
3992
4284
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
3993
4285
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
3994
4286
  isDeclaredInAmbientModule(d, "crypto"))) {
@@ -4011,8 +4303,7 @@ function mapTypeInner(type, ctx) {
4011
4303
  // X509Certificate.toLegacyObject()'s PeerCertificate (and tls's detailed
4012
4304
  // form) is a plain checked-dynamic object.
4013
4305
  if (psym !== undefined &&
4014
- (ts.symbolName(psym) === "PeerCertificate" ||
4015
- ts.symbolName(psym) === "DetailedPeerCertificate") &&
4306
+ (psymName === "PeerCertificate" || psymName === "DetailedPeerCertificate") &&
4016
4307
  psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
4017
4308
  return DYN;
4018
4309
  }
@@ -4024,7 +4315,7 @@ function mapTypeInner(type, ctx) {
4024
4315
  // it. JSON.stringify of one shows the fields where Node's internal-slot
4025
4316
  // object shows {} — the Dirent %dtype edge's cousin.
4026
4317
  if (psym !== undefined &&
4027
- ts.symbolName(psym) === "X509Certificate" &&
4318
+ psymName === "X509Certificate" &&
4028
4319
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
4029
4320
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
4030
4321
  isDeclaredInAmbientModule(d, "crypto"))) {
@@ -4048,9 +4339,9 @@ function mapTypeInner(type, ctx) {
4048
4339
  // record (util.inspect names the class from entryType, like Node).
4049
4340
  // @types/node declares the classes in perf_hooks and global interfaces
4050
4341
  // over them; the shipped fallback declares the classes.
4051
- if (((psym !== undefined && ts.symbolName(psym) === "PerformanceEntry") ||
4052
- (psym !== undefined && ts.symbolName(psym) === "PerformanceMark") ||
4053
- (psym !== undefined && ts.symbolName(psym) === "PerformanceMeasure")) &&
4342
+ if (((psym !== undefined && psymName === "PerformanceEntry") ||
4343
+ (psym !== undefined && psymName === "PerformanceMark") ||
4344
+ (psym !== undefined && psymName === "PerformanceMeasure")) &&
4054
4345
  psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
4055
4346
  ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
4056
4347
  return { kind: "record", shapeId: perfEntryShape(ctx.shapes, ctx.unions) };
@@ -4275,6 +4566,40 @@ function mapTypeInner(type, ctx) {
4275
4566
  // (als.snapshot), called through the dyn call path.
4276
4567
  if (callSigs.length === 1 && isAsyncLocalStorageSnapshot(callSigs[0], ctx))
4277
4568
  return DYN;
4569
+ // A process/net/stream `write` method taken as a value (`typeof
4570
+ // process.stdout.write`, the saved original of an output guard): its
4571
+ // overload set has no single compiled signature, and the value is the
4572
+ // stream's replaceable method slot, so it is the checked-dynamic function
4573
+ // the stream object hands out (scr_events.c ProcessStream).
4574
+ if (callSigs.length > 1 && isStdlibStreamWriteOverloads(callSigs, ctx))
4575
+ return DYN;
4576
+ // An overload set held as a VALUE (a callback parameter, an alias, a
4577
+ // variable, a member read): JavaScript stores ONE function, so the value
4578
+ // is that function's erased type, the same slot a record member of this
4579
+ // type stores (erasedOverloadMemberType). Calls through it convert the
4580
+ // result back to the resolved overload's type (lowerCallThroughValue).
4581
+ if (callSigs.length > 1 && isOverloadedCallableMemberType(widened, checker)) {
4582
+ const erased = erasedOverloadMemberType(widened, ctx);
4583
+ if (erased !== undefined)
4584
+ return erased;
4585
+ }
4586
+ // A generic signature as a VALUE (`const f: <T>(x: T) => T`, a generic
4587
+ // method's record slot, a union arm holding one): JavaScript erases type
4588
+ // parameters, so the value is the ONE function every instantiation calls,
4589
+ // and its type is that signature with each own type parameter bound to
4590
+ // `unknown` — the erased func type erasedGenericMemberType /
4591
+ // erasedOverloadMemberType already answer for generic-callable members.
4592
+ // The calls that instantiate it convert their arguments in and their
4593
+ // result out (lower-calls.ts, genericValueCall). A signature whose
4594
+ // erasure does not map (a rest parameter, an unmappable position) keeps
4595
+ // the fences below: undefined falls through to mapCallSignature's null.
4596
+ if (erasedGenericSignatureType(widened, callSigs, ctx)) {
4597
+ const erased = callSigs.length === 1
4598
+ ? erasedGenericMemberType(widened, ctx)
4599
+ : erasedOverloadMemberType(widened, ctx);
4600
+ if (erased !== undefined)
4601
+ return erased;
4602
+ }
4278
4603
  if (callSigs.length === 1)
4279
4604
  return mapCallSignature(callSigs[0], ctx);
4280
4605
  // Records: object types whose members are all data properties (shorthand
@@ -4395,6 +4720,43 @@ function mapTypeInner(type, ctx) {
4395
4720
  });
4396
4721
  if (childShaped && core >= 2)
4397
4722
  return CHILD_T;
4723
+ // A USER-declared writable-pipe interface — the writer half of the same
4724
+ // idiom (a hand-written `Pipe { write(chunk: string): boolean; end():
4725
+ // void }` naming child.stdin). Every member is named on the child
4726
+ // stdin surface, `write` takes a chunk the writer takes (a string, or
4727
+ // bytes such as a Uint8Array/Buffer) and answers the backpressure
4728
+ // boolean, and at least one other member says writer (a lone `write`
4729
+ // member is an ordinary record holding a function). The type maps to
4730
+ // the child writer handle: in a compiled program the only VALUE
4731
+ // producer is spawn's child.stdin, and the members lower against it.
4732
+ const chunkIsWritten = (chunk) => {
4733
+ const arms = chunk.kind === "union" ? (ctx.unions.get(chunk.unionId)?.arms ?? []) : [chunk];
4734
+ return (arms.length > 0 &&
4735
+ arms.every((arm) => arm.kind === "string" || (arm.kind === "bytes" && arm.elem === "u8")));
4736
+ };
4737
+ const writeMember = (p) => {
4738
+ const sigs = checker.getCallSignatures(checker.getTypeOfSymbol(p));
4739
+ if (sigs.length !== 1)
4740
+ return false;
4741
+ const sig = sigs[0];
4742
+ const params = sig.getParameters();
4743
+ if (params.length < 1 || params.length > 2)
4744
+ return false;
4745
+ if ((checker.getReturnTypeOfSignature(sig).flags & ts.TypeFlags.Boolean) === 0)
4746
+ return false;
4747
+ const chunk = mapType(checker.getTypeOfSymbol(params[0]), ctx);
4748
+ return chunk !== null && chunkIsWritten(chunk);
4749
+ };
4750
+ const writerProps = checker.getPropertiesOfType(widened);
4751
+ const writerShaped = writerProps.length >= 2 &&
4752
+ writerProps.some((p) => ts.symbolName(p) === "write" && writeMember(p)) &&
4753
+ writerProps.every((p) => CHILD_WRITER_MEMBERS.has(ts.symbolName(p)) &&
4754
+ (ts.symbolName(p) !== "write" || writeMember(p)));
4755
+ if (writerShaped) {
4756
+ return ctx.generalNodeStreams === true
4757
+ ? { kind: "object", className: "%Writable" }
4758
+ : { kind: "childWriter" };
4759
+ }
4398
4760
  }
4399
4761
  if (flags & (ts.TypeFlags.Object | ts.TypeFlags.Intersection) && callSigs.length === 0) {
4400
4762
  const viaMapped = mapBoundMappedType(widened, ctx);
@@ -4453,6 +4815,7 @@ function mapTypeInner(type, ctx) {
4453
4815
  try {
4454
4816
  const byKey = new Map();
4455
4817
  const recordParts = [];
4818
+ const classParts = [];
4456
4819
  const substitutedUnions = [];
4457
4820
  // The lib's `T extends readonly unknown[] | []` idiom (Promise.all,
4458
4821
  // allSettled) maps an array input to `X[] | []`: the empty tuple is
@@ -4543,6 +4906,19 @@ function mapTypeInner(type, ctx) {
4543
4906
  byKey.set(typeKey(mapped), mapped);
4544
4907
  if (mapped.kind === "record")
4545
4908
  recordParts.push({ source: part, mapped });
4909
+ if (mapped.kind === "object")
4910
+ classParts.push({ source: part, mapped });
4911
+ }
4912
+ // A subclass arm beside one of its ancestor classes (`Shape | Circle`
4913
+ // with `class Circle extends Shape`) is that ancestor: every instance
4914
+ // of the subclass is an instance of the ancestor, the ancestor's slot
4915
+ // holds it as the same pointer, and `instanceof` and member dispatch
4916
+ // read the instance's own class. A union would box each value.
4917
+ if (classParts.length > 1) {
4918
+ for (const { source, mapped } of classParts) {
4919
+ if (programClassBases(source, ctx).some((base) => byKey.has(typeKey(base))))
4920
+ byKey.delete(typeKey(mapped));
4921
+ }
4546
4922
  }
4547
4923
  const arms = [...byKey.values()];
4548
4924
  if (arms.length === 0)
@@ -4590,6 +4966,16 @@ function mapTypeInner(type, ctx) {
4590
4966
  !unions.recursivePending(widened)) {
4591
4967
  return DYN;
4592
4968
  }
4969
+ // A module namespace beside another value in one slot (`[path.posix,
4970
+ // path.win32]`, a `['posix', path.posix]` table row): a namespace has
4971
+ // no union representation, and as a value it is the runtime's module
4972
+ // object, so the slot is checked-dynamic. A namespace or null keeps
4973
+ // its union (a probed process.getBuiltinModule result).
4974
+ if (arms.some((a) => a.kind === "moduleNs") &&
4975
+ arms.filter((a) => !isUnitType(a)).length > 1 &&
4976
+ !unions.recursivePending(widened)) {
4977
+ return DYN;
4978
+ }
4593
4979
  // SEVERAL PROMISE ARMS are ONE: `Promise<A> | Promise<B>` is
4594
4980
  // `Promise<A | B>`. A promise arm's tag IS the `instanceof Promise`
4595
4981
  // test, so JavaScript cannot tell the arms apart at run time (both
@@ -4648,6 +5034,37 @@ function mapTypeInner(type, ctx) {
4648
5034
  }
4649
5035
  return null;
4650
5036
  }
5037
+ /** The classes a non-generic program class extends, nearest first, as
5038
+ * long as each is a non-generic class the program declares. Empty for
5039
+ * other types. */
5040
+ function programClassBases(instance, ctx) {
5041
+ const bases = [];
5042
+ let current = instance;
5043
+ while (bases.length < MAP_TYPE_MAX_DEPTH) {
5044
+ if (!programClassDeclaration(current, ctx))
5045
+ break;
5046
+ const base = ctx.checker.getBaseTypes(current)[0];
5047
+ if (base === undefined || !programClassDeclaration(base, ctx))
5048
+ break;
5049
+ const mapped = mapType(base, ctx);
5050
+ if (mapped?.kind !== "object")
5051
+ break;
5052
+ bases.push(mapped);
5053
+ current = base;
5054
+ }
5055
+ return bases;
5056
+ }
5057
+ /** Whether `type` is the instance type of a non-generic class declared in
5058
+ * the program's source. */
5059
+ function programClassDeclaration(type, ctx) {
5060
+ if ((type.flags & ts.TypeFlags.Object) === 0 || !type.isClassOrInterface())
5061
+ return false;
5062
+ const decl = type.getSymbol()?.valueDeclaration;
5063
+ if (decl === undefined || !ts.isClassDeclaration(decl) || decl.typeParameters?.nodes.length)
5064
+ return false;
5065
+ const file = ts.getSourceFileOfNode(decl);
5066
+ return !file.isDeclarationFile && ctx.isProgramFile(file);
5067
+ }
4651
5068
  /** One non-overloaded call signature's func type (mapTypeInner's
4652
5069
  * single-signature rule; erasedOverloadMemberType maps each overload of a
4653
5070
  * member through it). */
@@ -4669,6 +5086,27 @@ function isAsyncLocalStorageSnapshot(sig, ctx) {
4669
5086
  ctx.isStdlibFile(ts.getSourceFileOfNode(decl)) &&
4670
5087
  isDeclaredInAmbientModule(decl, "async_hooks"));
4671
5088
  }
5089
+ const STREAM_WRITE_OWNERS = new Set(["Socket", "Writable", "WriteStream", "WritableStream"]);
5090
+ /** Every signature is a `write` method declared on a standard-library
5091
+ * stream interface or class (net.Socket, stream.Writable, tty.WriteStream,
5092
+ * NodeJS.WritableStream) — @types/node's or the fallback declarations'. */
5093
+ function isStdlibStreamWriteOverloads(sigs, ctx) {
5094
+ return sigs.every((sig) => {
5095
+ const decl = sig.declaration;
5096
+ if (decl === undefined ||
5097
+ !(ts.isMethodSignatureDeclaration(decl) || ts.isMethodDeclaration(decl)))
5098
+ return false;
5099
+ if (!ts.isIdentifier(decl.name) || decl.name.text !== "write")
5100
+ return false;
5101
+ const owner = decl.parent;
5102
+ const ownerName = owner !== undefined && (ts.isInterfaceDeclaration(owner) || ts.isClassDeclaration(owner))
5103
+ ? (owner.name?.text ?? null)
5104
+ : null;
5105
+ return (ownerName !== null &&
5106
+ STREAM_WRITE_OWNERS.has(ownerName) &&
5107
+ ctx.isStdlibFile(ts.getSourceFileOfNode(decl)));
5108
+ });
5109
+ }
4672
5110
  function mapCallSignature(sig, ctx) {
4673
5111
  const { checker } = ctx;
4674
5112
  if (sig.getTypeParameters().length && ctx.erasingSignature !== sig)
@@ -6389,6 +6827,57 @@ function mapEqualConstituentsIntersection(widened, ctx) {
6389
6827
  }
6390
6828
  return same;
6391
6829
  }
6830
+ /** A CLASS INSTANCE carrying expando properties
6831
+ * (`Box & { preview?: Preview }`): one compiled class constituent and
6832
+ * data-only object constituents that are not part of the class's own
6833
+ * storage. It has no native layout — the class owns the struct and the
6834
+ * other constituents are properties the instance carries at run time —
6835
+ * and the checked-dynamic representation IS that object model: the value
6836
+ * is the instance (identity, prototype, method dispatch), the class fields
6837
+ * read and write through the live view in both directions, and the expando
6838
+ * members live in its property table. Every other intersection keeps its
6839
+ * existing treatment: reached only where the class view found extra
6840
+ * members, and refusing everything that is not one class plus data. */
6841
+ function mapClassExpandoIntersection(widened, ctx) {
6842
+ const { checker } = ctx;
6843
+ if (checker.getConstructSignatures(widened).length > 0)
6844
+ return null;
6845
+ let classPart = null;
6846
+ const expandoParts = [];
6847
+ for (const part of ts.constituentTypes(widened)) {
6848
+ const mapped = mapType(part, ctx);
6849
+ if (mapped === null)
6850
+ return null;
6851
+ if (mapped.kind === "object") {
6852
+ if (classPart !== null)
6853
+ return null;
6854
+ classPart = part;
6855
+ continue;
6856
+ }
6857
+ // The expando members are DATA: a plain record, with no call or
6858
+ // construct signature of its own.
6859
+ if (mapped.kind !== "record")
6860
+ return null;
6861
+ if (checker.getCallSignatures(part).length > 0)
6862
+ return null;
6863
+ expandoParts.push(part);
6864
+ }
6865
+ if (classPart === null)
6866
+ return null;
6867
+ // The expando members are properties the class does not declare. An
6868
+ // index signature names every key, and a member the class declares
6869
+ // restates the class's own storage: both refine the class's members
6870
+ // rather than add to them, and keep their diagnostics.
6871
+ const classMembers = new Set(checker.getPropertiesOfType(classPart).map((member) => ts.symbolName(member)));
6872
+ for (const part of expandoParts) {
6873
+ if (checker.getIndexInfosOfType(part).length > 0)
6874
+ return null;
6875
+ for (const member of checker.getPropertiesOfType(part))
6876
+ if (classMembers.has(ts.symbolName(member)))
6877
+ return null;
6878
+ }
6879
+ return DYN;
6880
+ }
6392
6881
  function mapHybridCallableIntersection(widened, ctx) {
6393
6882
  const { checker, shapes } = ctx;
6394
6883
  if (!widened.isIntersectionType())
@@ -6750,6 +7239,70 @@ function packageTypeFile(sf, ctx) {
6750
7239
  (/[\\/]node_modules[\\/]/.test(sf.fileName) || ctx.isExperimentalFile?.(sf) === true) &&
6751
7240
  !ctx.isStdlibFile(sf));
6752
7241
  }
7242
+ /** `type`'s declarations — through its alias, or its own symbol when the
7243
+ * checker gives it no alias — when EVERY one is a declaration-file
7244
+ * declaration outside the standard library and the external type
7245
+ * surfaces; null otherwise. */
7246
+ function packageDeclarations(sym, ctx) {
7247
+ const decls = sym ? sym.declarations : undefined;
7248
+ return decls &&
7249
+ decls.length > 0 &&
7250
+ decls.every((d) => {
7251
+ const sf = ts.getSourceFileOfNode(d);
7252
+ return sf.isDeclarationFile && !ctx.isStdlibFile(sf) && !ctx.isExternalTypeFile(sf);
7253
+ })
7254
+ ? decls
7255
+ : null;
7256
+ }
7257
+ /** One non-union part's package provenance: true when the part is
7258
+ * package-declared as data, false when it is package-declared with a value
7259
+ * or implementation shape, null when no package declares it. */
7260
+ function packageDataPart(type, ctx) {
7261
+ const aliasDecls = packageDeclarations(type.getAliasSymbol(), ctx);
7262
+ const ownDecls = packageDeclarations(type.getSymbol(), ctx);
7263
+ if (aliasDecls === null && (type.getAliasSymbol() !== undefined || ownDecls === null))
7264
+ return null;
7265
+ return purePackageDeclarations(aliasDecls, ctx) && purePackageDeclarations(ownDecls, ctx);
7266
+ }
7267
+ /** True when EVERY declaration `type` is spelled by is a pure data
7268
+ * declaration (interface, type alias, object or mapped type literal,
7269
+ * declared data class, type-only namespace) in a package declaration file —
7270
+ * no value declaration merged in, no class implementation. */
7271
+ function purePackageDeclarations(decls, ctx) {
7272
+ return (decls === null ||
7273
+ decls.every((d) => packageTypeFile(ts.getSourceFileOfNode(d), ctx) &&
7274
+ (ts.isInterfaceDeclaration(d) ||
7275
+ ts.isTypeAliasDeclaration(d) ||
7276
+ ts.isTypeLiteralNode(d) ||
7277
+ ts.isMappedTypeNode(d) ||
7278
+ isDeclaredDataClass(d) ||
7279
+ (decls.some(isDeclaredDataClass) && isTypeOnlyNamespace(d)))));
7280
+ }
7281
+ /** True when `type` is PACKAGE-DECLARED as data: some part of its
7282
+ * provenance is a package declaration, and no declaration it reaches is a
7283
+ * value or implementation shape. Such a type describes data the PROGRAM
7284
+ * built — `import type` from a package whose implementation is not part of
7285
+ * the compiled module graph — so the structural rules map it like a local
7286
+ * declaration, and a shape they cannot map is still that data, held as the
7287
+ * checked-dynamic value (`mapTypeEntry`'s fallback). A member the package
7288
+ * does not declare (a scalar beside a recursive knot) carries no provenance
7289
+ * of its own. */
7290
+ export function packageTypeIsData(type, ctx) {
7291
+ // `npmPackageOf` reaches the declaring package through the union's
7292
+ // members; the value-shape test is per member and never recurses (a
7293
+ // recursive alias reaches itself here).
7294
+ const parts = type.isUnionType() ? ts.constituentTypes(type) : [type];
7295
+ let declared = false;
7296
+ for (const part of parts) {
7297
+ const data = packageDataPart(part, ctx);
7298
+ if (data === null)
7299
+ continue;
7300
+ declared = true;
7301
+ if (!data)
7302
+ return false;
7303
+ }
7304
+ return declared;
7305
+ }
6753
7306
  /** The record path's provenance fence. Declared shapes (object literals,
6754
7307
  * interfaces, type literals) must come from user code or an explicitly
6755
7308
  * mapped external type surface, never an arbitrary .d.ts — the empty
@@ -6849,6 +7402,26 @@ function mentionsErasedTypeParam(type, ctx, depth) {
6849
7402
  return true;
6850
7403
  return false;
6851
7404
  }
7405
+ /** A type whose call signatures keep their own type parameters and that is
7406
+ * pure function-shaped — call signatures only, no data properties, no
7407
+ * construct or index signatures: the type of a generic function held as a
7408
+ * value (`const f: <T>(x: T) => T`, an interface's generic method, a union
7409
+ * arm naming one). mapType answers its erased func type
7410
+ * (erasedGenericMemberType / erasedOverloadMemberType). False while the
7411
+ * active erasure already IS one of these signatures: that mapping is
7412
+ * mapCallSignature's own, and re-entering the erasure would recurse. */
7413
+ function erasedGenericSignatureType(t, sigs, ctx) {
7414
+ if (sigs.length === 0)
7415
+ return false;
7416
+ if (!sigs.some((sig) => sig.getTypeParameters().length > 0))
7417
+ return false;
7418
+ if (ctx.erasingSignature !== undefined && sigs.includes(ctx.erasingSignature))
7419
+ return false;
7420
+ const { checker } = ctx;
7421
+ return (checker.getConstructSignatures(t).length === 0 &&
7422
+ checker.getPropertiesOfType(t).length === 0 &&
7423
+ checker.getIndexInfosOfType(t).length === 0);
7424
+ }
6852
7425
  /** A generic callable member's runtime type: its one call signature with
6853
7426
  * every own type parameter bound to `unknown`, the erased instance a stored
6854
7427
  * or escaping definition carries (JavaScript erases type parameters the
@@ -6884,12 +7457,14 @@ export function erasedGenericMemberType(t, ctx) {
6884
7457
  }
6885
7458
  /** An OVERLOADED callable member type (`on(event: "a", h: (x: number) =>
6886
7459
  * void): () => void; on(event: "b", h: (x: string) => void): () => void`
6887
- * in a program interface or type literal): two or more call signatures and
7460
+ * in a program interface or type literal, or a class's body-less overload
7461
+ * declarations above its implementation): two or more call signatures and
6888
7462
  * nothing else (no data properties, construct signatures, or index
6889
7463
  * signatures), every one declared in TypeScript program source. Such a
6890
7464
  * member keeps a record slot holding its erased runtime function
6891
7465
  * (erasedOverloadMemberType); calls convert per their resolved overload
6892
- * (lowerRecordFieldCall). */
7466
+ * (lowerRecordFieldCall). An overload set held as a value maps to the same
7467
+ * erased function (mapTypeInner). */
6893
7468
  export function isOverloadedCallableMemberType(t, checker) {
6894
7469
  const sigs = checker.getCallSignatures(t);
6895
7470
  if (sigs.length < 2)
@@ -6902,7 +7477,12 @@ export function isOverloadedCallableMemberType(t, checker) {
6902
7477
  const decl = sig.declaration;
6903
7478
  if (decl === undefined)
6904
7479
  return false;
6905
- if (!ts.isMethodSignatureDeclaration(decl) && !ts.isCallSignatureDeclaration(decl))
7480
+ // Interface and type-literal members, call signatures, and a class's
7481
+ // body-less overload declarations (`getAuth(id: string): R;` above its
7482
+ // implementation): each names one overload of ONE stored function.
7483
+ if (!ts.isMethodSignatureDeclaration(decl) &&
7484
+ !ts.isCallSignatureDeclaration(decl) &&
7485
+ !(ts.isMethodDeclaration(decl) && decl.body === undefined))
6906
7486
  return false;
6907
7487
  const file = ts.getSourceFileOfNode(decl);
6908
7488
  return !file.isDeclarationFile && !isJsSourceFile(file);
@@ -7984,6 +8564,14 @@ function mergePromiseArms(arms, ctx) {
7984
8564
  // exactly `Promise<void>`.
7985
8565
  if (payload.every((arm) => arm.kind === "undefinedT"))
7986
8566
  payload.length = 0;
8567
+ // SEVERAL MODULE NAMESPACES are ONE checked-dynamic payload: a namespace
8568
+ // has no union tag (its value is the module's namespace object, built by
8569
+ // the same dynamic box a bare namespace value crosses as), so JavaScript
8570
+ // cannot tell the merged arms apart — `then((m) => …)` reads a namespace
8571
+ // object either way. The joint payload is that object, exactly what
8572
+ // `Promise<unknown>` settles here (moduleNamespacePromiseDynValue).
8573
+ else if (payload.length > 1 && payload.every((arm) => arm.kind === "moduleNs"))
8574
+ payload.splice(0, payload.length, DYN);
7987
8575
  // One payload arm is that arm itself (a regex or a promise payload has a
7988
8576
  // promise slot but no union arm); a JOINT payload is a union, so its arms
7989
8577
  // need union homes.