@scriptc/compiler 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (852) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +270 -72
  2. package/ambient/scriptc-overrides.d.ts +21 -0
  3. package/dist/backend/executable-features.js +3 -0
  4. package/dist/backend/executable-features.js.map +1 -1
  5. package/dist/backend/library-pack.js +2 -1
  6. package/dist/backend/library-pack.js.map +1 -1
  7. package/dist/backend/linker.js +11 -1
  8. package/dist/backend/linker.js.map +1 -1
  9. package/dist/backend/lld.d.ts +9 -0
  10. package/dist/backend/lld.js +48 -0
  11. package/dist/backend/lld.js.map +1 -0
  12. package/dist/backend/lld.test.d.ts +1 -0
  13. package/dist/backend/lld.test.js +53 -0
  14. package/dist/backend/lld.test.js.map +1 -0
  15. package/dist/backend/llvm/appended-array-literals.d.ts +11 -1
  16. package/dist/backend/llvm/appended-array-literals.js +29 -0
  17. package/dist/backend/llvm/appended-array-literals.js.map +1 -1
  18. package/dist/backend/llvm/blocks.js +10 -1
  19. package/dist/backend/llvm/blocks.js.map +1 -1
  20. package/dist/backend/llvm/bytes-alias.d.ts +13 -4
  21. package/dist/backend/llvm/bytes-alias.js +16 -5
  22. package/dist/backend/llvm/bytes-alias.js.map +1 -1
  23. package/dist/backend/llvm/bytes-bounds.d.ts +5 -1
  24. package/dist/backend/llvm/bytes-bounds.js +199 -2
  25. package/dist/backend/llvm/bytes-bounds.js.map +1 -1
  26. package/dist/backend/llvm/bytes-loop-versions.d.ts +45 -3
  27. package/dist/backend/llvm/bytes-loop-versions.js +244 -20
  28. package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
  29. package/dist/backend/llvm/bytes-loop-versions.test.js +18 -6
  30. package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
  31. package/dist/backend/llvm/call-lifetimes.d.ts +8 -2
  32. package/dist/backend/llvm/call-lifetimes.js +87 -18
  33. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  34. package/dist/backend/llvm/call-lifetimes.test.js +132 -0
  35. package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
  36. package/dist/backend/llvm/classes.d.ts +3 -2
  37. package/dist/backend/llvm/classes.js +4 -4
  38. package/dist/backend/llvm/classes.js.map +1 -1
  39. package/dist/backend/llvm/counted-loops.d.ts +14 -2
  40. package/dist/backend/llvm/counted-loops.js +54 -5
  41. package/dist/backend/llvm/counted-loops.js.map +1 -1
  42. package/dist/backend/llvm/debug-info.d.ts +42 -1
  43. package/dist/backend/llvm/debug-info.js +72 -6
  44. package/dist/backend/llvm/debug-info.js.map +1 -1
  45. package/dist/backend/llvm/dense-array-loops.js +2 -2
  46. package/dist/backend/llvm/dense-array-loops.js.map +1 -1
  47. package/dist/backend/llvm/dense-array-loops.test.js +1 -0
  48. package/dist/backend/llvm/dense-array-loops.test.js.map +1 -1
  49. package/dist/backend/llvm/dyn.d.ts +69 -8
  50. package/dist/backend/llvm/dyn.js +396 -49
  51. package/dist/backend/llvm/dyn.js.map +1 -1
  52. package/dist/backend/llvm/emit-function.js +30 -16
  53. package/dist/backend/llvm/emit-function.js.map +1 -1
  54. package/dist/backend/llvm/emit-journal.d.ts +8 -4
  55. package/dist/backend/llvm/emit-journal.js +75 -5
  56. package/dist/backend/llvm/emit-journal.js.map +1 -1
  57. package/dist/backend/llvm/emit-module.d.ts +4 -0
  58. package/dist/backend/llvm/emit-module.js +74 -29
  59. package/dist/backend/llvm/emit-module.js.map +1 -1
  60. package/dist/backend/llvm/emit-statements.js +297 -28
  61. package/dist/backend/llvm/emit-statements.js.map +1 -1
  62. package/dist/backend/llvm/emitter.d.ts +144 -13
  63. package/dist/backend/llvm/emitter.js +523 -92
  64. package/dist/backend/llvm/emitter.js.map +1 -1
  65. package/dist/backend/llvm/emitter.test.js +11 -2
  66. package/dist/backend/llvm/emitter.test.js.map +1 -1
  67. package/dist/backend/llvm/expr-async.js +11 -13
  68. package/dist/backend/llvm/expr-async.js.map +1 -1
  69. package/dist/backend/llvm/expr-bytes.d.ts +6 -4
  70. package/dist/backend/llvm/expr-bytes.js +45 -16
  71. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  72. package/dist/backend/llvm/expr-calls.js +13 -11
  73. package/dist/backend/llvm/expr-calls.js.map +1 -1
  74. package/dist/backend/llvm/expr-containers.d.ts +11 -0
  75. package/dist/backend/llvm/expr-containers.js +101 -9
  76. package/dist/backend/llvm/expr-containers.js.map +1 -1
  77. package/dist/backend/llvm/expr-context.d.ts +3 -0
  78. package/dist/backend/llvm/expr-control.js +83 -0
  79. package/dist/backend/llvm/expr-control.js.map +1 -1
  80. package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
  81. package/dist/backend/llvm/expr-dynamic.js +22 -4
  82. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  83. package/dist/backend/llvm/expr-primitives.js +121 -14
  84. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  85. package/dist/backend/llvm/expr-stream-bridges.js +111 -26
  86. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  87. package/dist/backend/llvm/forked-analysis.d.ts +8 -0
  88. package/dist/backend/llvm/forked-analysis.js +43 -0
  89. package/dist/backend/llvm/forked-analysis.js.map +1 -0
  90. package/dist/backend/llvm/integer-values.d.ts +12 -0
  91. package/dist/backend/llvm/integer-values.js +69 -5
  92. package/dist/backend/llvm/integer-values.js.map +1 -1
  93. package/dist/backend/llvm/integer-views.d.ts +2 -1
  94. package/dist/backend/llvm/integer-views.js +12 -1
  95. package/dist/backend/llvm/integer-views.js.map +1 -1
  96. package/dist/backend/llvm/js-ic.d.ts +4 -0
  97. package/dist/backend/llvm/js-ic.js +133 -15
  98. package/dist/backend/llvm/js-ic.js.map +1 -1
  99. package/dist/backend/llvm/layouts.d.ts +1 -0
  100. package/dist/backend/llvm/layouts.js.map +1 -1
  101. package/dist/backend/llvm/lazy-captures.d.ts +6 -1
  102. package/dist/backend/llvm/lazy-captures.js +10 -5
  103. package/dist/backend/llvm/lazy-captures.js.map +1 -1
  104. package/dist/backend/llvm/lib-abi.d.ts +5 -0
  105. package/dist/backend/llvm/lib-abi.js +19 -0
  106. package/dist/backend/llvm/lib-abi.js.map +1 -1
  107. package/dist/backend/llvm/lib-dispatch.js +249 -33
  108. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  109. package/dist/backend/llvm/lib-filesystem.d.ts +10 -0
  110. package/dist/backend/llvm/lib-filesystem.js +32 -0
  111. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  112. package/dist/backend/llvm/lib-http2.js +2 -2
  113. package/dist/backend/llvm/lib-http2.js.map +1 -1
  114. package/dist/backend/llvm/lib-network.js +2 -0
  115. package/dist/backend/llvm/lib-network.js.map +1 -1
  116. package/dist/backend/llvm/lib-process.js +48 -1
  117. package/dist/backend/llvm/lib-process.js.map +1 -1
  118. package/dist/backend/llvm/lib-shared.js +64 -0
  119. package/dist/backend/llvm/lib-shared.js.map +1 -1
  120. package/dist/backend/llvm/lib-tls.js +28 -3
  121. package/dist/backend/llvm/lib-tls.js.map +1 -1
  122. package/dist/backend/llvm/local-union-storage.test.js +2 -1
  123. package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
  124. package/dist/backend/llvm/loop-array-borrows.d.ts +4 -1
  125. package/dist/backend/llvm/loop-array-borrows.js +11 -5
  126. package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
  127. package/dist/backend/llvm/map-entry-fusion.d.ts +5 -3
  128. package/dist/backend/llvm/map-entry-fusion.js +20 -11
  129. package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
  130. package/dist/backend/llvm/map-entry-fusion.test.js +14 -6
  131. package/dist/backend/llvm/map-entry-fusion.test.js.map +1 -1
  132. package/dist/backend/llvm/map-number-lookup.d.ts +16 -6
  133. package/dist/backend/llvm/map-number-lookup.js +41 -9
  134. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  135. package/dist/backend/llvm/map-number-lookup.test.js +70 -2
  136. package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
  137. package/dist/backend/llvm/map-read-lifetimes.d.ts +25 -2
  138. package/dist/backend/llvm/map-read-lifetimes.js +136 -6
  139. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  140. package/dist/backend/llvm/map-read-lifetimes.test.js +8 -3
  141. package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
  142. package/dist/backend/llvm/nullable-unions.d.ts +5 -0
  143. package/dist/backend/llvm/nullable-unions.js +29 -2
  144. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  145. package/dist/backend/llvm/nullable-unions.test.js +25 -1
  146. package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
  147. package/dist/backend/llvm/publish.js +3 -3
  148. package/dist/backend/llvm/publish.js.map +1 -1
  149. package/dist/backend/llvm/record-union-keys.test.d.ts +1 -0
  150. package/dist/backend/llvm/record-union-keys.test.js +161 -0
  151. package/dist/backend/llvm/record-union-keys.test.js.map +1 -0
  152. package/dist/backend/llvm/reference-effects.js +3 -0
  153. package/dist/backend/llvm/reference-effects.js.map +1 -1
  154. package/dist/backend/llvm/serialized-ir-emission.test.js +2 -0
  155. package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
  156. package/dist/backend/llvm/shapes.d.ts +4 -5
  157. package/dist/backend/llvm/shapes.js +106 -58
  158. package/dist/backend/llvm/shapes.js.map +1 -1
  159. package/dist/backend/llvm/shapes.test.js +14 -2
  160. package/dist/backend/llvm/shapes.test.js.map +1 -1
  161. package/dist/backend/llvm/speculative-integers.d.ts +50 -3
  162. package/dist/backend/llvm/speculative-integers.js +411 -24
  163. package/dist/backend/llvm/speculative-integers.js.map +1 -1
  164. package/dist/backend/llvm/speculative-integers.test.js +103 -1
  165. package/dist/backend/llvm/speculative-integers.test.js.map +1 -1
  166. package/dist/backend/llvm/split.d.ts +10 -1
  167. package/dist/backend/llvm/split.js +243 -59
  168. package/dist/backend/llvm/split.js.map +1 -1
  169. package/dist/backend/llvm/split.test.js +92 -13
  170. package/dist/backend/llvm/split.test.js.map +1 -1
  171. package/dist/backend/llvm/stack-captures.js +1 -5
  172. package/dist/backend/llvm/stack-captures.js.map +1 -1
  173. package/dist/backend/llvm/stack-objects.test.js +3 -2
  174. package/dist/backend/llvm/stack-objects.test.js.map +1 -1
  175. package/dist/backend/llvm/string-lifetimes.test.js +1 -1
  176. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  177. package/dist/backend/llvm/string-reads.d.ts +13 -0
  178. package/dist/backend/llvm/string-reads.js +22 -0
  179. package/dist/backend/llvm/string-reads.js.map +1 -1
  180. package/dist/backend/llvm/string-slices.d.ts +36 -2
  181. package/dist/backend/llvm/string-slices.js +308 -12
  182. package/dist/backend/llvm/string-slices.js.map +1 -1
  183. package/dist/backend/llvm/string-slices.test.js +182 -3
  184. package/dist/backend/llvm/string-slices.test.js.map +1 -1
  185. package/dist/backend/llvm/string-unit-versions.d.ts +11 -0
  186. package/dist/backend/llvm/string-unit-versions.js +191 -0
  187. package/dist/backend/llvm/string-unit-versions.js.map +1 -0
  188. package/dist/backend/llvm/string-unit-versions.test.d.ts +1 -0
  189. package/dist/backend/llvm/string-unit-versions.test.js +117 -0
  190. package/dist/backend/llvm/string-unit-versions.test.js.map +1 -0
  191. package/dist/backend/llvm/test-boxed-unions.d.ts +5 -2
  192. package/dist/backend/llvm/test-boxed-unions.js +24 -8
  193. package/dist/backend/llvm/test-boxed-unions.js.map +1 -1
  194. package/dist/backend/llvm/union-repr.d.ts +4 -3
  195. package/dist/backend/llvm/union-repr.js +6 -5
  196. package/dist/backend/llvm/union-repr.js.map +1 -1
  197. package/dist/backend/llvm/unwind-abi.d.ts +52 -0
  198. package/dist/backend/llvm/unwind-abi.js +498 -0
  199. package/dist/backend/llvm/unwind-abi.js.map +1 -0
  200. package/dist/backend/llvm/unwind-abi.test.d.ts +1 -0
  201. package/dist/backend/llvm/unwind-abi.test.js +255 -0
  202. package/dist/backend/llvm/unwind-abi.test.js.map +1 -0
  203. package/dist/backend/llvm/walkers.js +13 -0
  204. package/dist/backend/llvm/walkers.js.map +1 -1
  205. package/dist/backend/llvm/wrapping-sums.d.ts +14 -10
  206. package/dist/backend/llvm/wrapping-sums.js +31 -14
  207. package/dist/backend/llvm/wrapping-sums.js.map +1 -1
  208. package/dist/backend/loop-polls.d.ts +6 -0
  209. package/dist/backend/loop-polls.js +24 -0
  210. package/dist/backend/loop-polls.js.map +1 -1
  211. package/dist/backend/may-throw.js +8 -8
  212. package/dist/backend/may-throw.js.map +1 -1
  213. package/dist/backend/native/contracts.d.ts +12 -2
  214. package/dist/backend/native/executable.js +48 -6
  215. package/dist/backend/native/executable.js.map +1 -1
  216. package/dist/backend/native/library.js +4 -3
  217. package/dist/backend/native/library.js.map +1 -1
  218. package/dist/backend/native/program-shards.d.ts +2 -2
  219. package/dist/backend/native/program-shards.js +2 -2
  220. package/dist/backend/native/program-shards.js.map +1 -1
  221. package/dist/backend/native/runtime-inputs.d.ts +1 -1
  222. package/dist/backend/native/runtime-inputs.js +4 -1
  223. package/dist/backend/native/runtime-inputs.js.map +1 -1
  224. package/dist/backend/native/vendor.d.ts +1 -1
  225. package/dist/backend/native/vendor.js +1 -1
  226. package/dist/backend/native/vendor.js.map +1 -1
  227. package/dist/backend/native-codegen-core.d.ts +5 -3
  228. package/dist/backend/native-codegen-core.js +13 -6
  229. package/dist/backend/native-codegen-core.js.map +1 -1
  230. package/dist/backend/native-codegen.d.ts +3 -1
  231. package/dist/backend/native-codegen.js +4 -3
  232. package/dist/backend/native-codegen.js.map +1 -1
  233. package/dist/backend/native-codegen.test.js +6 -4
  234. package/dist/backend/native-codegen.test.js.map +1 -1
  235. package/dist/backend/native-link-info-core.d.ts +8 -0
  236. package/dist/backend/native-link-info-core.js.map +1 -1
  237. package/dist/backend/native-profile.d.ts +14 -0
  238. package/dist/backend/native-profile.js +28 -0
  239. package/dist/backend/native-profile.js.map +1 -1
  240. package/dist/backend/native-profile.test.js +8 -1
  241. package/dist/backend/native-profile.test.js.map +1 -1
  242. package/dist/backend/native-toolchain.test.js +11 -11
  243. package/dist/backend/native-toolchain.test.js.map +1 -1
  244. package/dist/backend/runtime-abi.d.ts +2 -2
  245. package/dist/backend/runtime-abi.js +2 -2
  246. package/dist/backend/runtime-pack-core.d.ts +3 -1
  247. package/dist/backend/runtime-pack-core.js +2 -0
  248. package/dist/backend/runtime-pack-core.js.map +1 -1
  249. package/dist/backend/runtime-pack-native.d.ts +17 -5
  250. package/dist/backend/runtime-pack-native.js +186 -14
  251. package/dist/backend/runtime-pack-native.js.map +1 -1
  252. package/dist/backend/runtime-pack-native.test.js +160 -3
  253. package/dist/backend/runtime-pack-native.test.js.map +1 -1
  254. package/dist/backend/runtime-pack-targets.test.js +2 -1
  255. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  256. package/dist/backend/runtime-pack.test.js +2 -1
  257. package/dist/backend/runtime-pack.test.js.map +1 -1
  258. package/dist/backend/target-cpu.d.ts +26 -0
  259. package/dist/backend/target-cpu.js +98 -0
  260. package/dist/backend/target-cpu.js.map +1 -0
  261. package/dist/backend/target-cpu.test.d.ts +1 -0
  262. package/dist/backend/target-cpu.test.js +38 -0
  263. package/dist/backend/target-cpu.test.js.map +1 -0
  264. package/dist/backend/vendor-archives.d.ts +4 -1
  265. package/dist/backend/vendor-archives.js +78 -4
  266. package/dist/backend/vendor-archives.js.map +1 -1
  267. package/dist/backend/vendor-inputs.d.ts +3 -1
  268. package/dist/backend/vendor-inputs.js +3 -1
  269. package/dist/backend/vendor-inputs.js.map +1 -1
  270. package/dist/backend/warm-cache.js +1 -0
  271. package/dist/backend/warm-cache.js.map +1 -1
  272. package/dist/cli/command.js +98 -12
  273. package/dist/cli/command.js.map +1 -1
  274. package/dist/cli/usage.d.ts +25 -1
  275. package/dist/cli/usage.js +40 -3
  276. package/dist/cli/usage.js.map +1 -1
  277. package/dist/compat/fetch-profile.d.ts +15 -6
  278. package/dist/compat/fetch-profile.js +519 -498
  279. package/dist/compat/fetch-profile.js.map +1 -1
  280. package/dist/compile-types.d.ts +14 -0
  281. package/dist/contracts/int32-elements.js +2 -1
  282. package/dist/contracts/int32-elements.js.map +1 -1
  283. package/dist/coverage/report.d.ts +14 -3
  284. package/dist/coverage/report.js +216 -0
  285. package/dist/coverage/report.js.map +1 -1
  286. package/dist/coverage/surface-manifest.js +25 -25
  287. package/dist/coverage/surface-manifest.js.map +1 -1
  288. package/dist/coverage/verdict-cache.d.ts +2 -0
  289. package/dist/coverage/verdict-cache.js +10 -1
  290. package/dist/coverage/verdict-cache.js.map +1 -1
  291. package/dist/diagnostics/diagnostic.d.ts +19 -0
  292. package/dist/diagnostics/diagnostic.js +53 -2
  293. package/dist/diagnostics/diagnostic.js.map +1 -1
  294. package/dist/diagnostics/envelope.d.ts +54 -0
  295. package/dist/diagnostics/envelope.js +7 -1
  296. package/dist/diagnostics/envelope.js.map +1 -1
  297. package/dist/diagnostics/render.d.ts +7 -0
  298. package/dist/diagnostics/render.js +15 -4
  299. package/dist/diagnostics/render.js.map +1 -1
  300. package/dist/executable/executable-cache.d.ts +6 -0
  301. package/dist/executable/executable-cache.js +5 -0
  302. package/dist/executable/executable-cache.js.map +1 -1
  303. package/dist/executable/executable-cache.test.js +3 -0
  304. package/dist/executable/executable-cache.test.js.map +1 -1
  305. package/dist/executable/prepare.js +5 -1
  306. package/dist/executable/prepare.js.map +1 -1
  307. package/dist/frontend/analysis.js +26 -2
  308. package/dist/frontend/analysis.js.map +1 -1
  309. package/dist/frontend/decl-projection.js +105 -10
  310. package/dist/frontend/decl-projection.js.map +1 -1
  311. package/dist/frontend/fork-target.js +67 -1
  312. package/dist/frontend/fork-target.js.map +1 -1
  313. package/dist/frontend/fork-target.test.js +43 -0
  314. package/dist/frontend/fork-target.test.js.map +1 -1
  315. package/dist/frontend/input-tracker.d.ts +4 -1
  316. package/dist/frontend/input-tracker.js +42 -4
  317. package/dist/frontend/input-tracker.js.map +1 -1
  318. package/dist/frontend/input-tracker.test.js +45 -0
  319. package/dist/frontend/input-tracker.test.js.map +1 -1
  320. package/dist/frontend/lowering/abstract-equality.js +38 -1
  321. package/dist/frontend/lowering/abstract-equality.js.map +1 -1
  322. package/dist/frontend/lowering/argument-counts.d.ts +36 -0
  323. package/dist/frontend/lowering/argument-counts.js +201 -0
  324. package/dist/frontend/lowering/argument-counts.js.map +1 -0
  325. package/dist/frontend/lowering/array-values.d.ts +27 -0
  326. package/dist/frontend/lowering/array-values.js +112 -0
  327. package/dist/frontend/lowering/array-values.js.map +1 -1
  328. package/dist/frontend/lowering/binding-analysis.d.ts +3 -0
  329. package/dist/frontend/lowering/binding-analysis.js +9 -3
  330. package/dist/frontend/lowering/binding-analysis.js.map +1 -1
  331. package/dist/frontend/lowering/builtin-namespaces.d.ts +13 -0
  332. package/dist/frontend/lowering/builtin-namespaces.js +238 -0
  333. package/dist/frontend/lowering/builtin-namespaces.js.map +1 -0
  334. package/dist/frontend/lowering/builtins/async-context.d.ts +8 -2
  335. package/dist/frontend/lowering/builtins/async-context.js +62 -3
  336. package/dist/frontend/lowering/builtins/async-context.js.map +1 -1
  337. package/dist/frontend/lowering/builtins/compression.d.ts +4 -3
  338. package/dist/frontend/lowering/builtins/compression.js +86 -5
  339. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  340. package/dist/frontend/lowering/builtins/crypto.js +3 -1
  341. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  342. package/dist/frontend/lowering/builtins/date-classes.js +17 -1
  343. package/dist/frontend/lowering/builtins/date-classes.js.map +1 -1
  344. package/dist/frontend/lowering/builtins/dates.d.ts +19 -5
  345. package/dist/frontend/lowering/builtins/dates.js +163 -9
  346. package/dist/frontend/lowering/builtins/dates.js.map +1 -1
  347. package/dist/frontend/lowering/builtins/filesystem-calls.js +29 -4
  348. package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
  349. package/dist/frontend/lowering/builtins/fs-glob.js +6 -3
  350. package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -1
  351. package/dist/frontend/lowering/builtins/fs-paths.d.ts +43 -5
  352. package/dist/frontend/lowering/builtins/fs-paths.js +245 -93
  353. package/dist/frontend/lowering/builtins/fs-paths.js.map +1 -1
  354. package/dist/frontend/lowering/builtins/fs-streams.d.ts +4 -0
  355. package/dist/frontend/lowering/builtins/fs-streams.js +24 -1
  356. package/dist/frontend/lowering/builtins/fs-streams.js.map +1 -1
  357. package/dist/frontend/lowering/builtins/json.d.ts +4 -1
  358. package/dist/frontend/lowering/builtins/json.js +9 -3
  359. package/dist/frontend/lowering/builtins/json.js.map +1 -1
  360. package/dist/frontend/lowering/builtins/module-bindings.d.ts +6 -0
  361. package/dist/frontend/lowering/builtins/module-bindings.js +23 -1
  362. package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
  363. package/dist/frontend/lowering/builtins/module-calls.js +6 -3
  364. package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
  365. package/dist/frontend/lowering/builtins/module-resolution.d.ts +5 -0
  366. package/dist/frontend/lowering/builtins/module-resolution.js +95 -4
  367. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  368. package/dist/frontend/lowering/builtins/promises.d.ts +1 -1
  369. package/dist/frontend/lowering/builtins/promises.js +293 -139
  370. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  371. package/dist/frontend/lowering/builtins/readline.d.ts +5 -1
  372. package/dist/frontend/lowering/builtins/readline.js +22 -11
  373. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  374. package/dist/frontend/lowering/builtins/reflection.d.ts +4 -1
  375. package/dist/frontend/lowering/builtins/reflection.js +41 -1
  376. package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
  377. package/dist/frontend/lowering/builtins/text-codecs.js +31 -2
  378. package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
  379. package/dist/frontend/lowering/builtins/webassembly.js +4 -1
  380. package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
  381. package/dist/frontend/lowering/builtins/x509.d.ts +33 -0
  382. package/dist/frontend/lowering/builtins/x509.js +431 -0
  383. package/dist/frontend/lowering/builtins/x509.js.map +1 -0
  384. package/dist/frontend/lowering/call-arguments.js +44 -0
  385. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  386. package/dist/frontend/lowering/call-signatures.js +1 -2
  387. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  388. package/dist/frontend/lowering/cjs-exports-object.js +1 -1
  389. package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
  390. package/dist/frontend/lowering/cjs-inline-require.d.ts +32 -0
  391. package/dist/frontend/lowering/cjs-inline-require.js +308 -5
  392. package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
  393. package/dist/frontend/lowering/class-attributes.d.ts +7 -0
  394. package/dist/frontend/lowering/class-attributes.js +52 -10
  395. package/dist/frontend/lowering/class-attributes.js.map +1 -1
  396. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +23 -0
  397. package/dist/frontend/lowering/class-dynamic-dispatch.js +288 -9
  398. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  399. package/dist/frontend/lowering/class-method-mutations.js +97 -26
  400. package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
  401. package/dist/frontend/lowering/class-method-values.js +71 -1
  402. package/dist/frontend/lowering/class-method-values.js.map +1 -1
  403. package/dist/frontend/lowering/class-protocols.d.ts +25 -0
  404. package/dist/frontend/lowering/class-protocols.js +183 -1
  405. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  406. package/dist/frontend/lowering/class-prototypes.d.ts +8 -0
  407. package/dist/frontend/lowering/class-prototypes.js +83 -2
  408. package/dist/frontend/lowering/class-prototypes.js.map +1 -1
  409. package/dist/frontend/lowering/class-to-primitive.d.ts +5 -0
  410. package/dist/frontend/lowering/class-to-primitive.js +79 -7
  411. package/dist/frontend/lowering/class-to-primitive.js.map +1 -1
  412. package/dist/frontend/lowering/coercions/state.d.ts +1 -0
  413. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  414. package/dist/frontend/lowering/coercions/structural.js +89 -10
  415. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  416. package/dist/frontend/lowering/coercions/unions.d.ts +4 -2
  417. package/dist/frontend/lowering/coercions/unions.js +13 -6
  418. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  419. package/dist/frontend/lowering/completion-callbacks.d.ts +4 -0
  420. package/dist/frontend/lowering/completion-callbacks.js +146 -0
  421. package/dist/frontend/lowering/completion-callbacks.js.map +1 -0
  422. package/dist/frontend/lowering/containers/array-callbacks.d.ts +5 -4
  423. package/dist/frontend/lowering/containers/array-callbacks.js +58 -21
  424. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  425. package/dist/frontend/lowering/containers/array-construction.d.ts +4 -1
  426. package/dist/frontend/lowering/containers/array-construction.js +107 -9
  427. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  428. package/dist/frontend/lowering/containers/array-methods.js +96 -8
  429. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  430. package/dist/frontend/lowering/containers/array-pipelines.js +346 -77
  431. package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
  432. package/dist/frontend/lowering/containers/bytes.d.ts +25 -17
  433. package/dist/frontend/lowering/containers/bytes.js +453 -45
  434. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  435. package/dist/frontend/lowering/containers/callback-arguments.js +11 -1
  436. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  437. package/dist/frontend/lowering/containers/collection-methods.js +12 -0
  438. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  439. package/dist/frontend/lowering/containers/indexed-objects.js +73 -25
  440. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  441. package/dist/frontend/lowering/containers/iterator-helpers.d.ts +4 -4
  442. package/dist/frontend/lowering/containers/iterator-helpers.js +8 -2
  443. package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
  444. package/dist/frontend/lowering/containers/replacer-params.d.ts +37 -0
  445. package/dist/frontend/lowering/containers/replacer-params.js +294 -0
  446. package/dist/frontend/lowering/containers/replacer-params.js.map +1 -0
  447. package/dist/frontend/lowering/containers/replacer-params.test.d.ts +1 -0
  448. package/dist/frontend/lowering/containers/replacer-params.test.js +61 -0
  449. package/dist/frontend/lowering/containers/replacer-params.test.js.map +1 -0
  450. package/dist/frontend/lowering/containers/string-and-regexp.js +2 -1
  451. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  452. package/dist/frontend/lowering/containers/string-replacement.js +7 -3
  453. package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
  454. package/dist/frontend/lowering/cycle-initialization.d.ts +4 -2
  455. package/dist/frontend/lowering/cycle-initialization.js +4 -1
  456. package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
  457. package/dist/frontend/lowering/date-values.d.ts +14 -0
  458. package/dist/frontend/lowering/date-values.js +254 -0
  459. package/dist/frontend/lowering/date-values.js.map +1 -0
  460. package/dist/frontend/lowering/deferred-module-initializers.js +16 -8
  461. package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
  462. package/dist/frontend/lowering/deferred-module-initializers.test.js +22 -6
  463. package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
  464. package/dist/frontend/lowering/dispatch-sites.js +1 -0
  465. package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
  466. package/dist/frontend/lowering/expressions/array-literals.d.ts +0 -8
  467. package/dist/frontend/lowering/expressions/array-literals.js +125 -26
  468. package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
  469. package/dist/frontend/lowering/expressions/binary.js +102 -26
  470. package/dist/frontend/lowering/expressions/binary.js.map +1 -1
  471. package/dist/frontend/lowering/expressions/element-access.js +129 -6
  472. package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
  473. package/dist/frontend/lowering/expressions/identifiers.js +66 -4
  474. package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
  475. package/dist/frontend/lowering/expressions/narrowing.d.ts +2 -1
  476. package/dist/frontend/lowering/expressions/narrowing.js +8 -1
  477. package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
  478. package/dist/frontend/lowering/expressions/object-literals.js +8 -2
  479. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  480. package/dist/frontend/lowering/expressions/property-access.js +121 -34
  481. package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
  482. package/dist/frontend/lowering/expressions/relational.js +76 -11
  483. package/dist/frontend/lowering/expressions/relational.js.map +1 -1
  484. package/dist/frontend/lowering/expressions/typeof.js +12 -1
  485. package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
  486. package/dist/frontend/lowering/expressions/updates.js +37 -11
  487. package/dist/frontend/lowering/expressions/updates.js.map +1 -1
  488. package/dist/frontend/lowering/f64-handles.d.ts +8 -0
  489. package/dist/frontend/lowering/f64-handles.js +16 -0
  490. package/dist/frontend/lowering/f64-handles.js.map +1 -0
  491. package/dist/frontend/lowering/frozen-records.d.ts +5 -0
  492. package/dist/frontend/lowering/frozen-records.js +12 -4
  493. package/dist/frontend/lowering/frozen-records.js.map +1 -1
  494. package/dist/frontend/lowering/function-context.d.ts +3 -0
  495. package/dist/frontend/lowering/function-context.js.map +1 -1
  496. package/dist/frontend/lowering/function-returns.js +30 -0
  497. package/dist/frontend/lowering/function-returns.js.map +1 -1
  498. package/dist/frontend/lowering/generic-functions.js +17 -6
  499. package/dist/frontend/lowering/generic-functions.js.map +1 -1
  500. package/dist/frontend/lowering/indexed-unions.d.ts +54 -0
  501. package/dist/frontend/lowering/indexed-unions.js +401 -0
  502. package/dist/frontend/lowering/indexed-unions.js.map +1 -0
  503. package/dist/frontend/lowering/instantiation-path.d.ts +3 -2
  504. package/dist/frontend/lowering/instantiation-path.js.map +1 -1
  505. package/dist/frontend/lowering/instantiation-path.test.js +6 -4
  506. package/dist/frontend/lowering/instantiation-path.test.js.map +1 -1
  507. package/dist/frontend/lowering/iterator-adapters.d.ts +4 -2
  508. package/dist/frontend/lowering/iterator-adapters.js +26 -33
  509. package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
  510. package/dist/frontend/lowering/js-collection-types.d.ts +11 -0
  511. package/dist/frontend/lowering/js-collection-types.js +490 -0
  512. package/dist/frontend/lowering/js-collection-types.js.map +1 -0
  513. package/dist/frontend/lowering/key-order-witness.js +210 -32
  514. package/dist/frontend/lowering/key-order-witness.js.map +1 -1
  515. package/dist/frontend/lowering/key-order-witness.test.js +104 -4
  516. package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
  517. package/dist/frontend/lowering/lib-boundary.js +2 -2
  518. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  519. package/dist/frontend/lowering/lower-assert.d.ts +14 -0
  520. package/dist/frontend/lowering/lower-assert.js +298 -29
  521. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  522. package/dist/frontend/lowering/lower-builtin-values.js +3 -3
  523. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
  524. package/dist/frontend/lowering/lower-calls.js +116 -10
  525. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  526. package/dist/frontend/lowering/lower-classes.d.ts +59 -7
  527. package/dist/frontend/lowering/lower-classes.js +668 -222
  528. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  529. package/dist/frontend/lowering/lower-console.js +2 -1
  530. package/dist/frontend/lowering/lower-console.js.map +1 -1
  531. package/dist/frontend/lowering/lower-exprs.d.ts +5 -0
  532. package/dist/frontend/lowering/lower-exprs.js +254 -3
  533. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  534. package/dist/frontend/lowering/lower-functions.js +7 -0
  535. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  536. package/dist/frontend/lowering/lower-generators.js +5 -4
  537. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  538. package/dist/frontend/lowering/lower-inspect.d.ts +1 -1
  539. package/dist/frontend/lowering/lower-inspect.js +299 -57
  540. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  541. package/dist/frontend/lowering/lower-modules.js +49 -22
  542. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  543. package/dist/frontend/lowering/lower-namespaces.d.ts +3 -0
  544. package/dist/frontend/lowering/lower-namespaces.js +44 -1
  545. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  546. package/dist/frontend/lowering/lower-node-module.js +1 -1
  547. package/dist/frontend/lowering/lower-node-module.js.map +1 -1
  548. package/dist/frontend/lowering/lower-server.js +126 -32
  549. package/dist/frontend/lowering/lower-server.js.map +1 -1
  550. package/dist/frontend/lowering/lower-stdlib.d.ts +4 -1
  551. package/dist/frontend/lowering/lower-stdlib.js +51 -37
  552. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  553. package/dist/frontend/lowering/lower-stmts.js +393 -79
  554. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  555. package/dist/frontend/lowering/lower-stream.js +515 -121
  556. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  557. package/dist/frontend/lowering/lowerer.d.ts +82 -12
  558. package/dist/frontend/lowering/lowerer.js +317 -44
  559. package/dist/frontend/lowering/lowerer.js.map +1 -1
  560. package/dist/frontend/lowering/lowerer.test.js +1 -1
  561. package/dist/frontend/lowering/lowerer.test.js.map +1 -1
  562. package/dist/frontend/lowering/module-namespace-elements.d.ts +13 -0
  563. package/dist/frontend/lowering/module-namespace-elements.js +118 -1
  564. package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
  565. package/dist/frontend/lowering/object-factory-new.d.ts +5 -0
  566. package/dist/frontend/lowering/object-factory-new.js +20 -6
  567. package/dist/frontend/lowering/object-factory-new.js.map +1 -1
  568. package/dist/frontend/lowering/overload-choice.d.ts +33 -0
  569. package/dist/frontend/lowering/overload-choice.js +190 -0
  570. package/dist/frontend/lowering/overload-choice.js.map +1 -0
  571. package/dist/frontend/lowering/private-brands.d.ts +5 -0
  572. package/dist/frontend/lowering/private-brands.js +39 -0
  573. package/dist/frontend/lowering/private-brands.js.map +1 -1
  574. package/dist/frontend/lowering/runtime-optional-elements.d.ts +6 -0
  575. package/dist/frontend/lowering/runtime-optional-elements.js +14 -3
  576. package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
  577. package/dist/frontend/lowering/sanitize-class-types.js +2 -0
  578. package/dist/frontend/lowering/sanitize-class-types.js.map +1 -1
  579. package/dist/frontend/lowering/site-dependencies.d.ts +7 -2
  580. package/dist/frontend/lowering/site-dependencies.js +0 -15
  581. package/dist/frontend/lowering/site-dependencies.js.map +1 -1
  582. package/dist/frontend/lowering/site-dependencies.test.js +7 -5
  583. package/dist/frontend/lowering/site-dependencies.test.js.map +1 -1
  584. package/dist/frontend/lowering/string-index-bounds.d.ts +7 -4
  585. package/dist/frontend/lowering/string-index-bounds.js +21 -7
  586. package/dist/frontend/lowering/string-index-bounds.js.map +1 -1
  587. package/dist/frontend/lowering/surfaces.d.ts +12 -3
  588. package/dist/frontend/lowering/surfaces.js +1630 -1540
  589. package/dist/frontend/lowering/surfaces.js.map +1 -1
  590. package/dist/frontend/lowering/symbol-fields.d.ts +7 -0
  591. package/dist/frontend/lowering/symbol-fields.js +45 -2
  592. package/dist/frontend/lowering/symbol-fields.js.map +1 -1
  593. package/dist/frontend/lowering/union-narrow.d.ts +5 -2
  594. package/dist/frontend/lowering/union-narrow.js +6 -3
  595. package/dist/frontend/lowering/union-narrow.js.map +1 -1
  596. package/dist/frontend/lowering/union-narrow.test.js +10 -0
  597. package/dist/frontend/lowering/union-narrow.test.js.map +1 -1
  598. package/dist/frontend/npm-static-namespace-defaults.d.ts +6 -0
  599. package/dist/frontend/npm-static-namespace-defaults.js +163 -0
  600. package/dist/frontend/npm-static-namespace-defaults.js.map +1 -0
  601. package/dist/frontend/npm-static-namespace-defaults.test.d.ts +1 -0
  602. package/dist/frontend/npm-static-namespace-defaults.test.js +72 -0
  603. package/dist/frontend/npm-static-namespace-defaults.test.js.map +1 -0
  604. package/dist/frontend/npm-static-prune.js +152 -111
  605. package/dist/frontend/npm-static-prune.js.map +1 -1
  606. package/dist/frontend/npm-static.js +35 -32
  607. package/dist/frontend/npm-static.js.map +1 -1
  608. package/dist/frontend/package-shims.d.ts +7 -4
  609. package/dist/frontend/package-shims.js +39 -40
  610. package/dist/frontend/package-shims.js.map +1 -1
  611. package/dist/frontend/pipeline-native.d.ts +2 -2
  612. package/dist/frontend/pipeline-native.js +2 -2
  613. package/dist/frontend/pipeline-native.js.map +1 -1
  614. package/dist/frontend/pipeline.d.ts +19 -2
  615. package/dist/frontend/pipeline.js +103 -12
  616. package/dist/frontend/pipeline.js.map +1 -1
  617. package/dist/frontend/program-analysis.d.ts +7 -1
  618. package/dist/frontend/program-analysis.js +8 -0
  619. package/dist/frontend/program-analysis.js.map +1 -1
  620. package/dist/frontend/program.d.ts +28 -5
  621. package/dist/frontend/program.js +422 -76
  622. package/dist/frontend/program.js.map +1 -1
  623. package/dist/frontend/resolve.d.ts +2 -0
  624. package/dist/frontend/resolve.js +5 -0
  625. package/dist/frontend/resolve.js.map +1 -1
  626. package/dist/frontend/services.d.ts +3 -0
  627. package/dist/frontend/services.js +31 -4
  628. package/dist/frontend/services.js.map +1 -1
  629. package/dist/frontend/shape-inference/analyze.d.ts +93 -0
  630. package/dist/frontend/shape-inference/analyze.js +3138 -0
  631. package/dist/frontend/shape-inference/analyze.js.map +1 -0
  632. package/dist/frontend/shape-inference/constant-graphs.d.ts +54 -0
  633. package/dist/frontend/shape-inference/constant-graphs.js +357 -0
  634. package/dist/frontend/shape-inference/constant-graphs.js.map +1 -0
  635. package/dist/frontend/shape-inference/domain.d.ts +32 -0
  636. package/dist/frontend/shape-inference/domain.js +104 -0
  637. package/dist/frontend/shape-inference/domain.js.map +1 -0
  638. package/dist/frontend/shape-inference/index.d.ts +7 -0
  639. package/dist/frontend/shape-inference/index.js +19 -0
  640. package/dist/frontend/shape-inference/index.js.map +1 -0
  641. package/dist/frontend/shape-inference/report.d.ts +21 -0
  642. package/dist/frontend/shape-inference/report.js +348 -0
  643. package/dist/frontend/shape-inference/report.js.map +1 -0
  644. package/dist/frontend/token-equivalence.d.ts +6 -0
  645. package/dist/frontend/token-equivalence.js +66 -9
  646. package/dist/frontend/token-equivalence.js.map +1 -1
  647. package/dist/frontend/token-equivalence.test.js +33 -1
  648. package/dist/frontend/token-equivalence.test.js.map +1 -1
  649. package/dist/frontend/ts7/checker-features.d.ts +15 -0
  650. package/dist/frontend/ts7/checker-features.js +45 -0
  651. package/dist/frontend/ts7/checker-features.js.map +1 -0
  652. package/dist/frontend/ts7/checker-features.test.d.ts +1 -0
  653. package/dist/frontend/ts7/checker-features.test.js +40 -0
  654. package/dist/frontend/ts7/checker-features.test.js.map +1 -0
  655. package/dist/frontend/ts7/checker-server.d.ts +19 -0
  656. package/dist/frontend/ts7/checker-server.js +46 -0
  657. package/dist/frontend/ts7/checker-server.js.map +1 -0
  658. package/dist/frontend/ts7/checker-server.test.d.ts +1 -0
  659. package/dist/frontend/ts7/checker-server.test.js +38 -0
  660. package/dist/frontend/ts7/checker-server.test.js.map +1 -0
  661. package/dist/frontend/ts7/lib-diagnostics.js +39 -13
  662. package/dist/frontend/ts7/lib-diagnostics.js.map +1 -1
  663. package/dist/frontend/ts7/lib-diagnostics.test.js +40 -0
  664. package/dist/frontend/ts7/lib-diagnostics.test.js.map +1 -1
  665. package/dist/frontend/ts7/native-api.d.ts +1 -0
  666. package/dist/frontend/ts7/native-api.js +25 -2
  667. package/dist/frontend/ts7/native-api.js.map +1 -1
  668. package/dist/frontend/ts7/native-process.d.ts +9 -2
  669. package/dist/frontend/ts7/native-process.js +22 -4
  670. package/dist/frontend/ts7/native-process.js.map +1 -1
  671. package/dist/frontend/ts7/program-host.d.ts +11 -0
  672. package/dist/frontend/ts7/program-host.js +36 -22
  673. package/dist/frontend/ts7/program-host.js.map +1 -1
  674. package/dist/frontend/ts7/semantic-json.d.ts +9 -0
  675. package/dist/frontend/ts7/semantic-json.js +25 -5
  676. package/dist/frontend/ts7/semantic-json.js.map +1 -1
  677. package/dist/frontend/ts7/semantic-model.d.ts +3 -0
  678. package/dist/frontend/ts7/semantic-model.js +8 -1
  679. package/dist/frontend/ts7/semantic-model.js.map +1 -1
  680. package/dist/frontend/ts7/semantic-model.test.js +6 -1
  681. package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
  682. package/dist/frontend/ts7/semantic-types.d.ts +1 -1
  683. package/dist/frontend/ts7/semantic-types.js +1 -1
  684. package/dist/frontend/ts7/semantic-types.js.map +1 -1
  685. package/dist/frontend/ts7/source-parser.js +3 -1
  686. package/dist/frontend/ts7/source-parser.js.map +1 -1
  687. package/dist/frontend/tsc-codes.js +10 -0
  688. package/dist/frontend/tsc-codes.js.map +1 -1
  689. package/dist/frontend/type-mapper.d.ts +18 -6
  690. package/dist/frontend/type-mapper.js +205 -44
  691. package/dist/frontend/type-mapper.js.map +1 -1
  692. package/dist/index.d.ts +44 -3
  693. package/dist/index.js +39 -8
  694. package/dist/index.js.map +1 -1
  695. package/dist/ir/builtin-effects.js +37 -0
  696. package/dist/ir/builtin-effects.js.map +1 -1
  697. package/dist/ir/builtin-signatures.d.ts +7 -2
  698. package/dist/ir/builtin-signatures.js +5104 -4894
  699. package/dist/ir/builtin-signatures.js.map +1 -1
  700. package/dist/ir/callback-specialization.d.ts +4 -2
  701. package/dist/ir/callback-specialization.js +24 -9
  702. package/dist/ir/callback-specialization.js.map +1 -1
  703. package/dist/ir/capture-values.js +4 -2
  704. package/dist/ir/capture-values.js.map +1 -1
  705. package/dist/ir/char-unit-locals.d.ts +12 -2
  706. package/dist/ir/char-unit-locals.js +400 -58
  707. package/dist/ir/char-unit-locals.js.map +1 -1
  708. package/dist/ir/char-unit-locals.test.js +111 -0
  709. package/dist/ir/char-unit-locals.test.js.map +1 -1
  710. package/dist/ir/constant-globals.js +18 -4
  711. package/dist/ir/constant-globals.js.map +1 -1
  712. package/dist/ir/expression-inlining.d.ts +15 -0
  713. package/dist/ir/expression-inlining.js +166 -0
  714. package/dist/ir/expression-inlining.js.map +1 -0
  715. package/dist/ir/expression-inlining.test.d.ts +1 -0
  716. package/dist/ir/expression-inlining.test.js +123 -0
  717. package/dist/ir/expression-inlining.test.js.map +1 -0
  718. package/dist/ir/function-references.js +2 -0
  719. package/dist/ir/function-references.js.map +1 -1
  720. package/dist/ir/function-references.test.js +6 -0
  721. package/dist/ir/function-references.test.js.map +1 -1
  722. package/dist/ir/int32-arrays.d.ts +27 -6
  723. package/dist/ir/int32-arrays.js +106 -18
  724. package/dist/ir/int32-arrays.js.map +1 -1
  725. package/dist/ir/int32-slots.d.ts +26 -1
  726. package/dist/ir/int32-slots.js +291 -5
  727. package/dist/ir/int32-slots.js.map +1 -1
  728. package/dist/ir/int32-slots.test.js +38 -0
  729. package/dist/ir/int32-slots.test.js.map +1 -1
  730. package/dist/ir/integer-loop-facts.d.ts +5 -0
  731. package/dist/ir/integer-loop-facts.js +90 -1
  732. package/dist/ir/integer-loop-facts.js.map +1 -1
  733. package/dist/ir/integer-loops.d.ts +14 -1
  734. package/dist/ir/integer-loops.js +107 -11
  735. package/dist/ir/integer-loops.js.map +1 -1
  736. package/dist/ir/integer-loops.test.js +70 -0
  737. package/dist/ir/integer-loops.test.js.map +1 -1
  738. package/dist/ir/integer-ranges.js +18 -2
  739. package/dist/ir/integer-ranges.js.map +1 -1
  740. package/dist/ir/integer-ranges.test.js +64 -4
  741. package/dist/ir/integer-ranges.test.js.map +1 -1
  742. package/dist/ir/ir.d.ts +63 -11
  743. package/dist/ir/ir.js +47 -7
  744. package/dist/ir/ir.js.map +1 -1
  745. package/dist/ir/ir.test.js +2 -1
  746. package/dist/ir/ir.test.js.map +1 -1
  747. package/dist/ir/js-ic.d.ts +10 -3
  748. package/dist/ir/js-ic.js +14 -2
  749. package/dist/ir/js-ic.js.map +1 -1
  750. package/dist/ir/js-ic.test.js +11 -0
  751. package/dist/ir/js-ic.test.js.map +1 -1
  752. package/dist/ir/node-index.d.ts +7 -0
  753. package/dist/ir/node-index.js +32 -0
  754. package/dist/ir/node-index.js.map +1 -1
  755. package/dist/ir/receiver-readers.d.ts +6 -1
  756. package/dist/ir/receiver-readers.js +53 -28
  757. package/dist/ir/receiver-readers.js.map +1 -1
  758. package/dist/ir/row-pairs.d.ts +15 -0
  759. package/dist/ir/row-pairs.js +373 -0
  760. package/dist/ir/row-pairs.js.map +1 -0
  761. package/dist/ir/row-pairs.test.d.ts +1 -0
  762. package/dist/ir/row-pairs.test.js +129 -0
  763. package/dist/ir/row-pairs.test.js.map +1 -0
  764. package/dist/ir/runtime-features.d.ts +17 -4
  765. package/dist/ir/runtime-features.js +94 -13
  766. package/dist/ir/runtime-features.js.map +1 -1
  767. package/dist/ir/scalar-records.d.ts +15 -0
  768. package/dist/ir/scalar-records.js +301 -1
  769. package/dist/ir/scalar-records.js.map +1 -1
  770. package/dist/ir/scalar-records.test.js +181 -1
  771. package/dist/ir/scalar-records.test.js.map +1 -1
  772. package/dist/ir/self-captures.js +8 -0
  773. package/dist/ir/self-captures.js.map +1 -1
  774. package/dist/ir/validate.js +78 -28
  775. package/dist/ir/validate.js.map +1 -1
  776. package/dist/library/fence-eval.js +4 -4
  777. package/dist/library/fence-eval.js.map +1 -1
  778. package/dist/library/ir-policy.js +5 -0
  779. package/dist/library/ir-policy.js.map +1 -1
  780. package/dist/library/library-cache.d.ts +1 -0
  781. package/dist/library/library-cache.js +1 -0
  782. package/dist/library/library-cache.js.map +1 -1
  783. package/dist/library/library-cache.test.js +13 -0
  784. package/dist/library/library-cache.test.js.map +1 -1
  785. package/dist/native/cache.d.ts +5 -1
  786. package/dist/native/cache.js +15 -3
  787. package/dist/native/cache.js.map +1 -1
  788. package/dist/native/cli.js +6 -0
  789. package/dist/native/cli.js.map +1 -1
  790. package/dist/native/compiler.d.ts +3 -0
  791. package/dist/native/compiler.js +72 -26
  792. package/dist/native/compiler.js.map +1 -1
  793. package/dist/native/compiler.test.js +87 -2
  794. package/dist/native/compiler.test.js.map +1 -1
  795. package/dist/native/executable-cache-open.test.d.ts +1 -0
  796. package/dist/native/executable-cache-open.test.js +80 -0
  797. package/dist/native/executable-cache-open.test.js.map +1 -0
  798. package/dist/native/executable-cache.d.ts +43 -3
  799. package/dist/native/executable-cache.js +177 -36
  800. package/dist/native/executable-cache.js.map +1 -1
  801. package/dist/native/executable-cache.test.js +103 -0
  802. package/dist/native/executable-cache.test.js.map +1 -1
  803. package/dist/native/prepare.d.ts +1 -1
  804. package/dist/native/prepare.js +49 -17
  805. package/dist/native/prepare.js.map +1 -1
  806. package/dist/native/prepare.test.js +69 -3
  807. package/dist/native/prepare.test.js.map +1 -1
  808. package/dist/native/sanitizer.d.ts +1 -1
  809. package/dist/native/sanitizer.js +17 -3
  810. package/dist/native/sanitizer.js.map +1 -1
  811. package/dist/native/sanitizer.test.js +4 -0
  812. package/dist/native/sanitizer.test.js.map +1 -1
  813. package/dist/node-islands/classify.d.ts +14 -0
  814. package/dist/node-islands/classify.js +114 -0
  815. package/dist/node-islands/classify.js.map +1 -0
  816. package/dist/node-islands/detect.d.ts +13 -0
  817. package/dist/node-islands/detect.js +805 -0
  818. package/dist/node-islands/detect.js.map +1 -0
  819. package/dist/node-islands/detect.test.d.ts +1 -0
  820. package/dist/node-islands/detect.test.js +136 -0
  821. package/dist/node-islands/detect.test.js.map +1 -0
  822. package/dist/node-islands/origin.d.ts +21 -0
  823. package/dist/node-islands/origin.js +60 -0
  824. package/dist/node-islands/origin.js.map +1 -0
  825. package/dist/node-islands/policy.d.ts +49 -0
  826. package/dist/node-islands/policy.js +130 -0
  827. package/dist/node-islands/policy.js.map +1 -0
  828. package/dist/node-islands/report.d.ts +22 -0
  829. package/dist/node-islands/report.js +326 -0
  830. package/dist/node-islands/report.js.map +1 -0
  831. package/dist/node-islands/report.test.d.ts +1 -0
  832. package/dist/node-islands/report.test.js +228 -0
  833. package/dist/node-islands/report.test.js.map +1 -0
  834. package/dist/node-islands/rules.d.ts +20 -0
  835. package/dist/node-islands/rules.js +91 -0
  836. package/dist/node-islands/rules.js.map +1 -0
  837. package/dist/node-islands/scan.d.ts +53 -0
  838. package/dist/node-islands/scan.js +104 -0
  839. package/dist/node-islands/scan.js.map +1 -0
  840. package/dist/node-islands/summary.d.ts +78 -0
  841. package/dist/node-islands/summary.js +26 -0
  842. package/dist/node-islands/summary.js.map +1 -0
  843. package/dist/project-config.d.ts +50 -0
  844. package/dist/project-config.js +372 -0
  845. package/dist/project-config.js.map +1 -0
  846. package/dist/project-config.test.d.ts +1 -0
  847. package/dist/project-config.test.js +154 -0
  848. package/dist/project-config.test.js.map +1 -0
  849. package/dist/wasm/discover.js +6 -31
  850. package/dist/wasm/discover.js.map +1 -1
  851. package/package.json +20 -20
  852. package/surface-manifest.json +21 -38
@@ -5,6 +5,17 @@ function unparenthesized(e) {
5
5
  e = e.expression;
6
6
  return e;
7
7
  }
8
+ /** `e` without parentheses and type-only wrappers (as, satisfies, type
9
+ * assertions, non-null assertions), which change no runtime value. */
10
+ function withoutTypeCasts(e) {
11
+ while (ts.isParenthesizedExpression(e) ||
12
+ ts.isAsExpression(e) ||
13
+ ts.isSatisfiesExpression(e) ||
14
+ ts.isTypeAssertion(e) ||
15
+ ts.isNonNullExpression(e))
16
+ e = e.expression;
17
+ return e;
18
+ }
8
19
  import { UNSUPPORTED } from "../../diagnostics/diagnostic.js";
9
20
  import { BOOL, BYTES_U8, CHILD_T, CRYPTOHASH_T, CRYPTOHMAC_T, DIR_T, DYN, F64, FILEHANDLE_T, SPAWNRES_T, STATS_T, STRING, URL_T, VOID, arrayOf, } from "../../ir/ir.js";
10
21
  import { isJsSourceFile, isNodeTypesPath, requireSpecOf } from "../program.js";
@@ -722,6 +733,12 @@ export const OBJECT_CALLABLE_VALUES = {
722
733
  result: DYN,
723
734
  valueParams: exactValueParams(DYN, DYN),
724
735
  },
736
+ hasOwn: {
737
+ fn: "dyn.hasOwnComputed",
738
+ params: [DYN, DYN],
739
+ result: BOOL,
740
+ valueParams: exactValueParams(DYN, DYN),
741
+ },
725
742
  keys: { fn: "dyn.objKeys", params: [DYN], result: DYN, valueParams: exactValueParams(DYN) },
726
743
  values: { fn: "dyn.objValues", params: [DYN], result: DYN, valueParams: exactValueParams(DYN) },
727
744
  entries: { fn: "dyn.objEntries", params: [DYN], result: DYN, valueParams: exactValueParams(DYN) },
@@ -965,908 +982,936 @@ export const UTIL_TYPES_KEYS = [
965
982
  "isKeyObject",
966
983
  "isCryptoKey",
967
984
  ];
968
- export const BUILTIN_MODULE_FNS = {
969
- fs: {
970
- readFileSync: { fn: "fs.readFileSync", params: [STRING, STRING], result: STRING },
971
- // The exact-API subset is first-class. A fixed native ABI is not enough:
972
- // rows whose Node function has behavior-bearing trailing options remain
973
- // call-only, or function-width adaptation could discard those options
974
- // without a diagnostic before entering the fixed runtime call.
975
- writeFileSync: { fn: "fs.writeFileSync", params: [STRING, STRING], result: VOID },
976
- appendFileSync: { fn: "fs.appendFileSync", params: [STRING, STRING], result: VOID },
977
- existsSync: {
978
- fn: "fs.existsSync",
979
- params: [STRING],
980
- result: BOOL,
981
- valueParams: exactValueParams(STRING),
982
- },
983
- mkdirSync: { fn: "fs.mkdirSync", params: [STRING], result: VOID },
984
- rmSync: { fn: "fs.rmSync", params: [STRING], result: VOID },
985
- rmdirSync: { fn: "fs.rmdirSync", params: [STRING], result: VOID },
986
- readdirSync: { fn: "fs.readdirSync", params: [STRING], result: arrayOf(STRING) },
987
- // Pattern and options are checked by the runtime (lowerFsGlobSyncCall).
988
- globSync: { fn: "fs.globSync", params: [DYN, DYN], result: arrayOf(STRING) },
989
- statSync: { fn: "fs.statSync", params: [STRING], result: STATS_T },
990
- mkdtempSync: { fn: "fs.mkdtempSync", params: [STRING], result: STRING },
991
- // accessSync's omitted mode completes to 0 (F_OK) in the special case
992
- // in lowerBuiltinModuleCall — string `defaults` can't spell a number.
993
- accessSync: { fn: "fs.accessSync", params: [STRING, F64], result: VOID },
994
- unlinkSync: {
995
- fn: "fs.unlinkSync",
996
- params: [STRING],
997
- result: VOID,
998
- valueParams: exactValueParams(STRING),
999
- },
1000
- chmodSync: {
1001
- fn: "fs.chmodSync",
1002
- params: [STRING, F64],
1003
- result: VOID,
1004
- valueParams: exactValueParams(STRING, F64),
1005
- },
1006
- chownSync: {
1007
- fn: "fs.chownSync",
1008
- params: [STRING, F64, F64],
1009
- result: VOID,
1010
- valueParams: exactValueParams(STRING, F64, F64),
1011
- },
1012
- lchownSync: {
1013
- fn: "fs.lchownSync",
1014
- params: [STRING, F64, F64],
1015
- result: VOID,
1016
- valueParams: exactValueParams(STRING, F64, F64),
1017
- },
1018
- fchownSync: {
1019
- fn: "fs.fchownSync",
1020
- params: [F64, F64, F64],
1021
- result: VOID,
1022
- valueParams: exactValueParams(F64, F64, F64),
1023
- },
1024
- // truncateSync's omitted len completes to 0 in lowerBuiltinModuleCall,
1025
- // like accessSync's mode.
1026
- truncateSync: { fn: "fs.truncateSync", params: [STRING, F64], result: VOID },
1027
- // The 2-argument form only: Node's mode flags (COPYFILE_EXCL, ...)
1028
- // land on the arity fence.
1029
- copyFileSync: { fn: "fs.copyFileSync", params: [STRING, STRING], result: VOID },
1030
- // The callback form is special-cased in lowerBuiltinModuleCall: its
1031
- // Error | null parameter is program-shaped and needs an emitted
1032
- // adapter. The row still projects the static surface and routes the
1033
- // dispatch.
1034
- rename: { fn: "fs.renameCb", params: [], result: VOID },
1035
- renameSync: {
1036
- fn: "fs.renameSync",
1037
- params: [STRING, STRING],
1038
- result: VOID,
1039
- valueParams: exactValueParams(STRING, STRING),
1040
- },
1041
- // statSync's no-follow sibling; stats.isSymbolicLink answers what the
1042
- // follow-free snapshot saw.
1043
- // opendirSync's options (a literal { bufferSize, encoding: "utf8" })
1044
- // lower in lowerBuiltinModuleCall; the row routes the dispatch.
1045
- opendirSync: { fn: "fs.opendirSync", params: [STRING, F64], result: DIR_T },
1046
- // createReadStream/createWriteStream lower in lowerBuiltinModuleCall
1047
- // (path and options cross as dyn values); the rows route the dispatch.
1048
- createReadStream: {
1049
- fn: "fs.createReadStream",
1050
- params: [DYN, DYN],
1051
- result: { kind: "object", className: "%Readable" },
1052
- },
1053
- createWriteStream: {
1054
- fn: "fs.createWriteStream",
1055
- params: [DYN, DYN],
1056
- result: { kind: "object", className: "%Writable" },
1057
- },
1058
- lstatSync: { fn: "fs.lstatSync", params: [STRING], result: STATS_T },
1059
- fstatSync: {
1060
- fn: "fs.fstatSync",
1061
- params: [F64],
1062
- result: STATS_T,
1063
- valueParams: exactValueParams(F64),
1064
- },
1065
- fchmodSync: {
1066
- fn: "fs.fchmodSync",
1067
- params: [F64, F64],
1068
- result: VOID,
1069
- valueParams: exactValueParams(F64, F64),
1070
- },
1071
- fsyncSync: {
1072
- fn: "fs.fsyncSync",
1073
- params: [F64],
1074
- result: VOID,
1075
- valueParams: exactValueParams(F64),
1076
- },
1077
- fdatasyncSync: {
1078
- fn: "fs.fdatasyncSync",
1079
- params: [F64],
1080
- result: VOID,
1081
- valueParams: exactValueParams(F64),
1082
- },
1083
- ftruncateSync: { fn: "fs.ftruncateSync", params: [F64, F64], result: VOID },
1084
- utimesSync: { fn: "fs.utimesSync", params: [DYN, DYN, DYN], result: VOID },
1085
- futimesSync: { fn: "fs.futimesSync", params: [DYN, DYN, DYN], result: VOID },
1086
- lutimesSync: { fn: "fs.lutimesSync", params: [DYN, DYN, DYN], result: VOID },
1087
- readvSync: { fn: "fs.readvSync", params: [F64, arrayOf(BYTES_U8), F64], result: F64 },
1088
- writevSync: { fn: "fs.writevSync", params: [F64, arrayOf(BYTES_U8), F64], result: F64 },
1089
- linkSync: {
1090
- fn: "fs.linkSync",
1091
- params: [DYN, DYN],
1092
- result: VOID,
1093
- valueParams: exactValueParams(DYN, DYN),
1094
- },
1095
- // Options and paths are checked by the runtime (scr_fs_cp_begin).
1096
- cpSync: {
1097
- fn: "fs.cpSync",
1098
- params: [DYN, DYN, DYN],
1099
- result: VOID,
1100
- valueParams: [
1101
- ...exactValueParams(DYN, DYN),
1102
- { mode: "optional", type: DYN, defaultValue: undefined },
1103
- ],
1104
- },
1105
- symlinkSync: {
1106
- fn: "fs.symlinkSync",
1107
- params: [DYN, DYN, DYN],
1108
- result: VOID,
1109
- valueParams: [
1110
- ...exactValueParams(DYN, DYN),
1111
- { mode: "optional", type: DYN, defaultValue: undefined },
1112
- ],
1113
- },
1114
- readlinkSync: {
1115
- fn: "fs.readlinkSync",
1116
- params: [DYN, DYN],
1117
- result: DYN,
1118
- valueParams: [
1119
- ...exactValueParams(DYN),
1120
- { mode: "optional", type: DYN, defaultValue: undefined },
1121
- ],
1122
- },
1123
- statfsSync: {
1124
- fn: "fs.statfsSync",
1125
- params: [DYN, DYN],
1126
- result: DYN,
1127
- valueParams: [
1128
- ...exactValueParams(DYN),
1129
- { mode: "optional", type: DYN, defaultValue: undefined },
1130
- ],
1131
- },
1132
- // realpath(3) — Node's realpathSync (failures spell syscall "lstat",
1133
- // Node's own message shape).
1134
- realpathSync: { fn: "fs.realpathSync", params: [STRING], result: STRING },
1135
- "realpathSync.native": { fn: "fs.realpathNativeSync", params: [STRING], result: STRING },
1136
- // The fd pair behind spawn's fd-stdio form (the daemon-log idiom:
1137
- // openSync(logPath, "a") → spawn stdio ["ignore", fd, fd] →
1138
- // closeSync). String flags use the established two-argument path;
1139
- // inline numeric O_* expressions route through openNumericSync, with
1140
- // an optional creation mode as the third argument.
1141
- openSync: { fn: "fs.openSync", params: [STRING, STRING], result: F64 },
1142
- // The buffer forms (fd, buffer, offset, length[, position]). The
1143
- // lowering completes an omitted or literal-null position to -1 (the
1144
- // runtime's current-offset sentinel); numeric positions read without
1145
- // advancing the fd. The options-object and bigint forms still fence.
1146
- readSync: { fn: "fs.readSync", params: [F64, BYTES_U8, F64, F64, F64], result: F64 },
1147
- // Entirely special-cased: the classic Buffer window and utf8 string
1148
- // overloads lower to separate fixed-width runtime ABIs. As with
1149
- // readSync, -1 is the current-offset sentinel.
1150
- writeSync: { fn: "fs.writeSync", params: [F64, BYTES_U8, F64, F64, F64], result: F64 },
1151
- closeSync: {
1152
- fn: "fs.closeSync",
1153
- params: [F64],
1154
- result: VOID,
1155
- valueParams: exactValueParams(F64),
1156
- },
1157
- // Entirely special-cased (lowerFsWatchCall — the callback needs an
1158
- // adapter per listener shape); this entry only routes the dispatch.
1159
- watch: { fn: "fs.watch", params: [], result: VOID },
1160
- },
1161
- "fs/promises": {
1162
- // The sync operations behind already-settled promises: failures
1163
- // REJECT (catchable at the await) instead of throwing. readFile is
1164
- // utf8-fenced exactly like readFileSync (same special case below).
1165
- readFile: {
1166
- fn: "fsp.readFile",
1167
- params: [STRING, STRING],
1168
- result: { kind: "promise", inner: STRING },
1169
- },
1170
- writeFile: {
1171
- fn: "fsp.writeFile",
1172
- params: [STRING, STRING],
1173
- result: { kind: "promise", inner: VOID },
1174
- },
1175
- mkdir: { fn: "fsp.mkdir", params: [STRING], result: { kind: "promise", inner: VOID } },
1176
- readdir: {
1177
- fn: "fsp.readdir",
1178
- params: [STRING],
1179
- result: { kind: "promise", inner: arrayOf(STRING) },
1180
- },
1181
- rm: { fn: "fsp.rm", params: [STRING], result: { kind: "promise", inner: VOID } },
1182
- // The async iterator lowers only as a for await head (lowerFspGlobCall).
1183
- glob: { fn: "fsp.globStrings", params: [DYN, DYN], result: arrayOf(STRING) },
1184
- stat: { fn: "fsp.stat", params: [STRING], result: { kind: "promise", inner: STATS_T } },
1185
- realpath: { fn: "fsp.realpath", params: [STRING], result: { kind: "promise", inner: STRING } },
1186
- lstat: { fn: "fsp.lstat", params: [STRING], result: { kind: "promise", inner: STATS_T } },
1187
- opendir: {
1188
- fn: "fsp.opendir",
1189
- params: [STRING, F64],
1190
- result: { kind: "promise", inner: DIR_T },
1191
- },
1192
- unlink: {
1193
- fn: "fsp.unlink",
1194
- params: [STRING],
1195
- result: { kind: "promise", inner: VOID },
1196
- valueParams: exactValueParams(STRING),
1197
- },
1198
- chmod: {
1199
- fn: "fsp.chmod",
1200
- params: [STRING, F64],
1201
- result: { kind: "promise", inner: VOID },
1202
- valueParams: exactValueParams(STRING, F64),
1203
- },
1204
- chown: {
1205
- fn: "fsp.chown",
1206
- params: [STRING, F64, F64],
1207
- result: { kind: "promise", inner: VOID },
1208
- valueParams: exactValueParams(STRING, F64, F64),
1209
- },
1210
- lchown: {
1211
- fn: "fsp.lchown",
1212
- params: [STRING, F64, F64],
1213
- result: { kind: "promise", inner: VOID },
1214
- valueParams: exactValueParams(STRING, F64, F64),
1215
- },
1216
- // access' omitted mode and truncate's omitted len complete to 0 in
1217
- // lowerBuiltinModuleCall, like their sync spellings.
1218
- access: { fn: "fsp.access", params: [STRING, F64], result: { kind: "promise", inner: VOID } },
1219
- truncate: {
1220
- fn: "fsp.truncate",
1221
- params: [STRING, F64],
1222
- result: { kind: "promise", inner: VOID },
1223
- },
1224
- // String data; Uint8Array/Buffer data routes to fsp.appendFileBytes in
1225
- // lowerBuiltinModuleCall.
1226
- appendFile: {
1227
- fn: "fsp.appendFile",
1228
- params: [STRING, STRING],
1229
- result: { kind: "promise", inner: VOID },
1230
- },
1231
- // The 2-argument form only, like copyFileSync.
1232
- copyFile: {
1233
- fn: "fsp.copyFile",
1234
- params: [STRING, STRING],
1235
- result: { kind: "promise", inner: VOID },
1236
- },
1237
- mkdtemp: { fn: "fsp.mkdtemp", params: [STRING], result: { kind: "promise", inner: STRING } },
1238
- rmdir: { fn: "fsp.rmdir", params: [STRING], result: { kind: "promise", inner: VOID } },
1239
- link: {
1240
- fn: "fsp.link",
1241
- params: [DYN, DYN],
1242
- result: { kind: "promise", inner: VOID },
1243
- valueParams: exactValueParams(DYN, DYN),
1244
- },
1245
- cp: {
1246
- fn: "fsp.cp",
1247
- params: [DYN, DYN, DYN],
1248
- result: { kind: "promise", inner: VOID },
1249
- valueParams: [
1250
- ...exactValueParams(DYN, DYN),
1251
- { mode: "optional", type: DYN, defaultValue: undefined },
1252
- ],
1253
- },
1254
- symlink: {
1255
- fn: "fsp.symlink",
1256
- params: [DYN, DYN, DYN],
1257
- result: { kind: "promise", inner: VOID },
1258
- valueParams: [
1259
- ...exactValueParams(DYN, DYN),
1260
- { mode: "optional", type: DYN, defaultValue: undefined },
1261
- ],
1262
- },
1263
- readlink: {
1264
- fn: "fsp.readlink",
1265
- params: [DYN, DYN],
1266
- result: { kind: "promise", inner: DYN },
1267
- valueParams: [
1268
- ...exactValueParams(DYN),
1269
- { mode: "optional", type: DYN, defaultValue: undefined },
1270
- ],
1271
- },
1272
- statfs: {
1273
- fn: "fsp.statfs",
1274
- params: [DYN, DYN],
1275
- result: { kind: "promise", inner: DYN },
1276
- valueParams: [
1277
- ...exactValueParams(DYN),
1278
- { mode: "optional", type: DYN, defaultValue: undefined },
1279
- ],
1280
- },
1281
- utimes: { fn: "fsp.utimes", params: [DYN, DYN, DYN], result: { kind: "promise", inner: VOID } },
1282
- lutimes: {
1283
- fn: "fsp.lutimes",
1284
- params: [DYN, DYN, DYN],
1285
- result: { kind: "promise", inner: VOID },
1286
- },
1287
- rename: {
1288
- fn: "fsp.rename",
1289
- params: [STRING, STRING],
1290
- result: { kind: "promise", inner: VOID },
1291
- valueParams: exactValueParams(STRING, STRING),
1292
- },
1293
- // open's optional flags/mode completion is special-cased in
1294
- // lowerBuiltinModuleCall; this row routes all import spellings and
1295
- // gives coverage the static member.
1296
- open: {
1297
- fn: "fsp.open",
1298
- params: [STRING, STRING, F64],
1299
- result: { kind: "promise", inner: FILEHANDLE_T },
1300
- valueParams: [
1301
- { mode: "required", type: STRING },
1302
- { mode: "optional", type: STRING, defaultValue: "r" },
1303
- { mode: "optional", type: F64, defaultValue: 0o666 },
1304
- ],
1305
- },
1306
- },
1307
- // The bare module's POSIX-target binding; a win32 target rebinds it to
1308
- // the win32 table (builtinModuleFnsOf — Node on Windows IS path.win32).
1309
- path: PATH_MODULE_FNS,
1310
- // Real Node modules ("node:path/posix" resolves), and the receivers of
1311
- // `path.posix.<member>` / `path.win32.<member>` through the namespace
1312
- // chain (builtinNamespaceModuleOf composes "path" + ".posix" to these
1313
- // keys). Both namespaces carry the FULL surface on every platform,
1314
- // Node's own rule: each answers its own platform's semantics anywhere.
1315
- "path/posix": PATH_MODULE_FNS,
1316
- "path/win32": PATH_WIN32_MODULE_FNS,
1317
- os: {
1318
- // One platform implementation: os.platform() === process.platform.
1319
- platform: { fn: "process.platform", params: [], result: STRING, valueParams: [] },
1320
- homedir: { fn: "os.homedir", params: [], result: STRING, valueParams: [] },
1321
- tmpdir: { fn: "os.tmpdir", params: [], result: STRING, valueParams: [] },
1322
- // uname(2)'s release field — Node's own implementation.
1323
- release: { fn: "os.release", params: [], result: STRING, valueParams: [] },
1324
- // uname(2)'s sysname field ("Darwin", "Linux", "Windows_NT") — the
1325
- // libFn/runtime pair predates this entry (the portless surface used
1326
- // them); this row makes the MODULE call reach them (test/common's
1327
- // isAIX/isIBMi getters are the canonical callers).
1328
- type: { fn: "os.type", params: [], result: STRING, valueParams: [] },
1329
- // Total physical memory in bytes — same predating-pair story.
1330
- totalmem: { fn: "os.totalmem", params: [], result: F64, valueParams: [] },
1331
- // uv_available_parallelism: the CPUs this process may use (affinity,
1332
- // then cgroup quota on Linux), at least 1.
1333
- availableParallelism: {
1334
- fn: "os.availableParallelism",
1335
- params: [],
1336
- result: F64,
1337
- valueParams: [],
1338
- },
1339
- // os.arch() IS process.arch, like platform().
1340
- arch: { fn: "process.arch", params: [], result: STRING, valueParams: [] },
1341
- hostname: { fn: "os.hostname", params: [], result: STRING, valueParams: [] },
1342
- // uv_os_uname's machine and version fields, read once at module load
1343
- // in Node (they never change while a process runs).
1344
- machine: { fn: "os.machine", params: [], result: STRING, valueParams: [] },
1345
- version: { fn: "os.version", params: [], result: STRING, valueParams: [] },
1346
- endianness: { fn: "os.endianness", params: [], result: STRING, valueParams: [] },
1347
- freemem: { fn: "os.freemem", params: [], result: F64, valueParams: [] },
1348
- uptime: { fn: "os.uptime", params: [], result: F64, valueParams: [] },
1349
- loadavg: { fn: "os.loadavg", params: [], result: arrayOf(F64), valueParams: [] },
1350
- // An omitted (or undefined) pid is 0, the current process
1351
- // (lowerOsGetPriorityCall completes it).
1352
- getPriority: {
1353
- fn: "os.getPriority",
1354
- params: [F64],
1355
- result: F64,
1356
- valueParams: [{ mode: "optional", type: F64, defaultValue: 0 }],
1357
- },
1358
- // A one-argument call is setPriority(0, priority)
1359
- // (lowerOsSetPriorityCall completes it).
1360
- setPriority: { fn: "os.setPriority", params: [F64, F64], result: VOID },
1361
- // Special-cased (lowerOsCpusCall): the call site's CpuInfo[] assembles
1362
- // from one uv_cpu_info snapshot.
1363
- cpus: { fn: "os.cpusTake", params: [], result: VOID },
1364
- // Entirely special-cased (lowerOsNetworkInterfacesCall): the result is
1365
- // the call site's mapped Dict<NetworkInterfaceInfo[]> shape, verified
1366
- // structurally there — this entry only routes the dispatch.
1367
- networkInterfaces: { fn: "os.networkInterfaces", params: [], result: VOID },
1368
- // Special-cased too (lowerOsUserInfoCall): the call site's mapped
1369
- // UserInfo record assembles field-by-field from scalar libCalls.
1370
- userInfo: { fn: "os.userName", params: [], result: VOID },
1371
- },
1372
- crypto: {
1373
- randomUUID: {
1374
- fn: "crypto.randomUUID",
1375
- params: [],
1376
- result: STRING,
1377
- // As a value (uuid's `export default { randomUUID }`), the optional
1378
- // options argument goes through the validating entry point.
1379
- valueFn: "crypto.randomUUIDOpts",
1380
- valueParams: [{ mode: "optional", type: DYN, defaultValue: undefined }],
1381
- },
1382
- // A real Buffer result. The composed randomBytes(n).toString(enc)
1383
- // form KEEPS its one-libCall lowering (lowerCryptoComposedCall runs
1384
- // first and the Buffer never materializes there); this entry covers
1385
- // the bare calls and non-composed uses.
1386
- randomBytes: {
1387
- fn: "crypto.randomBytes",
1388
- params: [F64],
1389
- result: BYTES_U8,
1390
- valueParams: exactValueParams(F64),
1391
- },
1392
- // The crypto utility surface is special-cased for overloads and
1393
- // string/Buffer splits in lowerCryptoModuleCall. These rows carry the
1394
- // canonical signatures for manifest projection and fallback dispatch.
1395
- createHash: { fn: "crypto.hashNew", params: [STRING], result: CRYPTOHASH_T },
1396
- createHmac: { fn: "crypto.hmacNewStr", params: [STRING, STRING], result: CRYPTOHMAC_T },
1397
- hash: { fn: "crypto.hashDigestStr", params: [STRING, STRING, STRING], result: STRING },
1398
- timingSafeEqual: { fn: "crypto.timingSafeEqual", params: [BYTES_U8, BYTES_U8], result: BOOL },
1399
- randomFillSync: { fn: "crypto.randomFill", params: [BYTES_U8, F64, F64], result: BYTES_U8 },
1400
- getRandomValues: { fn: "crypto.getRandomValues", params: [BYTES_U8], result: BYTES_U8 },
1401
- randomInt: { fn: "crypto.randomInt", params: [F64, F64], result: F64 },
1402
- randomFill: { fn: "crypto.randomFillCb", params: [], result: VOID },
1403
- randomUUIDv7: {
1404
- fn: "crypto.randomUUIDv7",
1405
- params: [DYN],
1406
- result: STRING,
1407
- valueParams: [{ mode: "optional", type: DYN, defaultValue: undefined }],
1408
- },
1409
- createSecretKey: { fn: "crypto.createSecretKey", params: [DYN, DYN], result: DYN },
1410
- generateKeySync: { fn: "crypto.generateKeySync", params: [DYN, DYN], result: DYN },
1411
- generateKey: { fn: "crypto.generateKeyCb", params: [], result: VOID },
1412
- // Asymmetric keys and signatures (lowerPkiCall): checked-dynamic
1413
- // arguments, results converted to the call site's type.
1414
- createPrivateKey: { fn: "crypto.createPrivateKey", params: [DYN], result: DYN },
1415
- createPublicKey: { fn: "crypto.createPublicKey", params: [DYN], result: DYN },
1416
- createSign: { fn: "crypto.createSign", params: [DYN], result: DYN },
1417
- createVerify: { fn: "crypto.createVerify", params: [DYN], result: DYN },
1418
- generateKeyPairSync: { fn: "crypto.generateKeyPairSync", params: [], result: DYN },
1419
- generateKeyPair: { fn: "crypto.generateKeyPairCb", params: [], result: VOID },
1420
- sign: { fn: "crypto.signOneshot", params: [], result: DYN },
1421
- verify: { fn: "crypto.verifyOneshot", params: [], result: DYN },
1422
- pbkdf2Sync: {
1423
- fn: "crypto.pbkdf2",
1424
- params: [BYTES_U8, BYTES_U8, F64, F64, STRING],
1425
- result: BYTES_U8,
1426
- },
1427
- pbkdf2: { fn: "crypto.pbkdf2Cb", params: [], result: VOID },
1428
- hkdfSync: {
1429
- fn: "crypto.hkdf",
1430
- params: [STRING, BYTES_U8, BYTES_U8, BYTES_U8, F64],
1431
- result: DYN,
1432
- },
1433
- hkdf: { fn: "crypto.hkdfCb", params: [], result: VOID },
1434
- scryptSync: { fn: "crypto.scrypt", params: [BYTES_U8, BYTES_U8, F64, DYN], result: BYTES_U8 },
1435
- scrypt: { fn: "crypto.scryptCb", params: [], result: VOID },
1436
- // Checked-dynamic arguments; the result is a native Cipheriv or
1437
- // Decipheriv handle (lowerCryptoModuleCall).
1438
- createCipheriv: { fn: "crypto.cipherNew", params: [BOOL, DYN, DYN, DYN, DYN], result: DYN },
1439
- createDecipheriv: { fn: "crypto.cipherNew", params: [BOOL, DYN, DYN, DYN, DYN], result: DYN },
1440
- // A checked-dynamic curve name; the result is a native ECDH handle
1441
- // (lowerCreateEcdh).
1442
- createECDH: { fn: "crypto.ecdhNew", params: [DYN], result: DYN },
1443
- // Checked-dynamic arguments; the result is a native DiffieHellman or
1444
- // DiffieHellmanGroup handle (lowerCreateDiffieHellman and
1445
- // lowerGetDiffieHellman).
1446
- createDiffieHellman: { fn: "crypto.dhNew", params: [DYN, DYN, DYN, DYN], result: DYN },
1447
- getDiffieHellman: { fn: "crypto.dhGroupNew", params: [DYN], result: DYN },
1448
- createDiffieHellmanGroup: { fn: "crypto.dhGroupNew", params: [DYN], result: DYN },
1449
- // Prime checks and generation (lowerPrimeCall): checked-dynamic
1450
- // arguments, results converted to the call site's type.
1451
- checkPrimeSync: { fn: "crypto.checkPrimeSync", params: [], result: DYN },
1452
- // Checked-dynamic arguments, the result converted to the call site's
1453
- // type (lowerPrimeCall).
1454
- getCipherInfo: { fn: "crypto.getCipherInfo", params: [], result: DYN },
1455
- checkPrime: { fn: "crypto.checkPrimeCb", params: [], result: VOID },
1456
- generatePrimeSync: { fn: "crypto.generatePrimeSync", params: [], result: DYN },
1457
- generatePrime: { fn: "crypto.generatePrimeCb", params: [], result: VOID },
1458
- },
1459
- zlib: {
1460
- // The default-options convenience family is special-cased in
1461
- // lowerBuiltinModuleCall: string inputs UTF-8 encode, callback forms
1462
- // carry program-shaped closures, and explicit options fence per site.
1463
- // native-toolchain.ts links libz only when these appear on the IR.
1464
- deflate: { fn: "zlib.deflateCb", params: [], result: VOID },
1465
- deflateSync: { fn: "zlib.deflateSync", params: [BYTES_U8], result: BYTES_U8 },
1466
- inflate: { fn: "zlib.inflateCb", params: [], result: VOID },
1467
- inflateSync: { fn: "zlib.inflateSync", params: [BYTES_U8], result: BYTES_U8 },
1468
- deflateRaw: { fn: "zlib.deflateRawCb", params: [], result: VOID },
1469
- deflateRawSync: { fn: "zlib.deflateRawSync", params: [BYTES_U8], result: BYTES_U8 },
1470
- inflateRaw: { fn: "zlib.inflateRawCb", params: [], result: VOID },
1471
- inflateRawSync: { fn: "zlib.inflateRawSync", params: [BYTES_U8], result: BYTES_U8 },
1472
- gzip: { fn: "zlib.gzipCb", params: [], result: VOID },
1473
- gzipSync: { fn: "zlib.gzipSync", params: [BYTES_U8], result: BYTES_U8 },
1474
- gunzip: { fn: "zlib.gunzipCb", params: [], result: VOID },
1475
- gunzipSync: { fn: "zlib.gunzipSync", params: [BYTES_U8], result: BYTES_U8 },
1476
- unzip: { fn: "zlib.unzipCb", params: [], result: VOID },
1477
- unzipSync: { fn: "zlib.unzipSync", params: [BYTES_U8], result: BYTES_U8 },
1478
- crc32: { fn: "zlib.crc32", params: [], result: F64 },
1479
- // The stream factories (special-cased in lowerZlibModuleCall): each
1480
- // answers a runtime Transform stream over the zlib engine.
1481
- createDeflate: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1482
- createInflate: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1483
- createGzip: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1484
- createGunzip: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1485
- createDeflateRaw: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1486
- createInflateRaw: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1487
- createUnzip: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1488
- },
1489
- url: {
1490
- fileURLToPath: {
1491
- fn: "url.fileURLToPathOptions",
1492
- params: [DYN, DYN],
1493
- result: STRING,
1494
- valueParams: [
1495
- { mode: "required", type: DYN },
1496
- { mode: "optional", type: DYN, defaultValue: undefined },
1497
- ],
1498
- },
1499
- fileURLToPathBuffer: {
1500
- fn: "url.fileURLToPathBuffer",
1501
- params: [DYN, DYN],
1502
- result: BYTES_U8,
1503
- valueParams: [
1504
- { mode: "required", type: DYN },
1505
- { mode: "optional", type: DYN, defaultValue: undefined },
1506
- ],
1507
- },
1508
- pathToFileURL: {
1509
- fn: "url.pathToFileURLChecked",
1510
- params: [DYN, DYN],
1511
- result: URL_T,
1512
- valueParams: [
1513
- { mode: "required", type: DYN },
1514
- { mode: "optional", type: DYN, defaultValue: undefined },
1515
- ],
1516
- },
1517
- // The legacy API and the domain pair (lowerLegacyUrlCall): arguments
1518
- // cross as dyn values for Node's own validators; url.parse() answers
1519
- // the checked-dynamic Url instance.
1520
- parse: { fn: "url.legacyParse", params: [DYN, DYN, DYN], result: DYN },
1521
- format: { fn: "url.legacyFormat", params: [DYN, DYN], result: STRING },
1522
- resolve: { fn: "url.legacyResolve", params: [DYN, DYN], result: STRING },
1523
- domainToASCII: { fn: "url.domainToASCII", params: [DYN], result: STRING },
1524
- domainToUnicode: { fn: "url.domainToUnicode", params: [DYN], result: STRING },
1525
- },
1526
- child_process: {
1527
- // spawnSync's and spawn's call completions are entirely special-cased
1528
- // (an omitted args list completes to an empty string[]; spawnSync
1529
- // accepts its documented literal options, while spawn supports the
1530
- // stdio/detached/env/cwd/windowsHide/shell subset — see
1531
- // lowerBuiltinModuleCall); the
1532
- // entries carry the canonical shapes.
1533
- spawnSync: { fn: "cp.spawnSync", params: [STRING, arrayOf(STRING)], result: SPAWNRES_T },
1534
- spawn: { fn: "cp.spawn", params: [STRING, arrayOf(STRING)], result: CHILD_T },
1535
- fork: { fn: "cp.fork", params: [STRING, arrayOf(STRING)], result: CHILD_T },
1536
- // execFileSync(file, args?, options?) and execSync(command, options?)
1537
- // share the cp.execSync runtime entry (execSync sets the shell flag);
1538
- // both call completions are special-cased in lowerBuiltinModuleCall.
1539
- // The entries carry canonical shapes for the coverage/fence machinery.
1540
- execFileSync: { fn: "cp.execSync", params: [STRING, arrayOf(STRING)], result: STRING },
1541
- execSync: { fn: "cp.execSync", params: [STRING], result: STRING },
1542
- },
1543
- // node:util lowers through dedicated paths: promisify
1544
- // only in the const-binding-over-execFile shape — recognized in
1545
- // lowerVarDecl / collectGlobals BEFORE any call lowering runs — and
1546
- // inspect/format/formatWithOptions plus parseArgs through the util spoke
1547
- // (lower-inspect.ts: per-type synthesized traversal helpers,
1548
- // compile-time format strings, checked-dynamic config/result for
1549
- // parseArgs), which both dispatch paths try before the generic table.
1550
- // parseArgs is tabled as well so the generated surface manifest records
1551
- // the dedicated static member; the spoke owns its optional arity and
1552
- // call-site-specific result type before this canonical signature is used.
1553
- util: {
1554
- styleText: {
1555
- fn: "util.styleText",
1556
- params: [DYN, DYN, DYN],
1557
- result: STRING,
1558
- valueParams: [
1559
- { mode: "required", type: DYN },
1560
- { mode: "required", type: DYN },
1561
- { mode: "optional", type: DYN, defaultValue: undefined },
1562
- ],
1563
- },
1564
- isDeepStrictEqual: {
1565
- fn: "util.isDeepStrictEqual",
1566
- params: [DYN, DYN, DYN],
1567
- result: BOOL,
1568
- valueParams: [
1569
- { mode: "required", type: DYN },
1570
- { mode: "required", type: DYN },
1571
- { mode: "optional", type: DYN, defaultValue: undefined },
1572
- ],
1573
- },
1574
- parseArgs: { fn: "util.parseArgs", params: [DYN], result: DYN },
1575
- parseEnv: { fn: "util.parseEnv", params: [DYN], result: DYN },
1576
- getSystemErrorName: {
1577
- fn: "util.getSystemErrorName",
1578
- params: [DYN],
1579
- result: STRING,
1580
- valueParams: exactValueParams(DYN),
1581
- },
1582
- getSystemErrorMessage: {
1583
- fn: "util.getSystemErrorMessage",
1584
- params: [DYN],
1585
- result: STRING,
1586
- valueParams: exactValueParams(DYN),
1587
- },
1588
- getSystemErrorMap: { fn: "util.systemErrorEntries", params: [], result: DYN },
1589
- stripVTControlCharacters: {
1590
- fn: "util.stripVTControlCharacters",
1591
- params: [DYN],
1592
- result: STRING,
1593
- valueParams: exactValueParams(DYN),
1594
- },
1595
- toUSVString: {
1596
- fn: "util.toUSVString",
1597
- params: [DYN],
1598
- result: STRING,
1599
- valueParams: exactValueParams(DYN),
1600
- },
1601
- // The function helpers take checked-dynamic arguments and answer native
1602
- // dyn functions, which a static function slot checks when it receives
1603
- // one (lowerUtilCallableCall in the util spoke).
1604
- inherits: {
1605
- fn: "util.inherits",
1606
- params: [DYN, DYN],
1607
- result: VOID,
1608
- valueParams: [
1609
- { mode: "required", type: DYN },
1610
- { mode: "required", type: DYN },
1611
- ],
1612
- },
1613
- deprecate: {
1614
- fn: "util.deprecate",
1615
- params: [DYN, DYN, DYN, DYN],
1616
- result: DYN,
1617
- valueParams: [
1618
- { mode: "required", type: DYN },
1619
- { mode: "required", type: DYN },
1620
- { mode: "optional", type: DYN, defaultValue: undefined },
1621
- { mode: "optional", type: DYN, defaultValue: undefined },
1622
- ],
1623
- },
1624
- callbackify: {
1625
- fn: "util.callbackify",
1626
- params: [DYN],
1627
- result: DYN,
1628
- valueParams: [{ mode: "required", type: DYN }],
1629
- },
1630
- debuglog: {
1631
- fn: "util.debuglog",
1632
- params: [DYN, DYN],
1633
- result: DYN,
1634
- valueParams: [
1635
- { mode: "required", type: DYN },
1636
- { mode: "optional", type: DYN, defaultValue: undefined },
1637
- ],
1638
- },
1639
- debug: {
1640
- fn: "util.debuglog",
1641
- params: [DYN, DYN],
1642
- result: DYN,
1643
- valueParams: [
1644
- { mode: "required", type: DYN },
1645
- { mode: "optional", type: DYN, defaultValue: undefined },
1646
- ],
1647
- },
1648
- },
1649
- // The util/types spoke supplies the probe name to the shared brand check.
1650
- "util/types": {
1651
- isAnyArrayBuffer: { fn: "util.typeIs", params: [DYN], result: BOOL },
1652
- isArrayBuffer: { fn: "util.typeIs", params: [DYN], result: BOOL },
1653
- isArrayBufferView: { fn: "util.typeIs", params: [DYN], result: BOOL },
1654
- isDataView: { fn: "util.typeIs", params: [DYN], result: BOOL },
1655
- isTypedArray: { fn: "util.typeIs", params: [DYN], result: BOOL },
1656
- isUint8Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1657
- isUint8ClampedArray: { fn: "util.typeIs", params: [DYN], result: BOOL },
1658
- isUint16Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1659
- isUint32Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1660
- isInt8Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1661
- isInt16Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1662
- isInt32Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1663
- isFloat32Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1664
- isFloat64Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1665
- isMap: { fn: "util.typeIs", params: [DYN], result: BOOL },
1666
- isSet: { fn: "util.typeIs", params: [DYN], result: BOOL },
1667
- isWeakMap: { fn: "util.typeIs", params: [DYN], result: BOOL },
1668
- isWeakSet: { fn: "util.typeIs", params: [DYN], result: BOOL },
1669
- isRegExp: { fn: "util.typeIs", params: [DYN], result: BOOL },
1670
- isNativeError: { fn: "util.typeIs", params: [DYN], result: BOOL },
1671
- isPromise: { fn: "util.typeIs", params: [DYN], result: BOOL },
1672
- isProxy: { fn: "util.typeIs", params: [DYN], result: BOOL },
1673
- isAsyncFunction: { fn: "util.typeIs", params: [DYN], result: BOOL },
1674
- isGeneratorFunction: { fn: "util.typeIs", params: [DYN], result: BOOL },
1675
- isGeneratorObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1676
- isDate: { fn: "util.typeIs", params: [DYN], result: BOOL },
1677
- isSharedArrayBuffer: { fn: "util.typeIs", params: [DYN], result: BOOL },
1678
- isMapIterator: { fn: "util.typeIs", params: [DYN], result: BOOL },
1679
- isSetIterator: { fn: "util.typeIs", params: [DYN], result: BOOL },
1680
- isKeyObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1681
- isNumberObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1682
- isStringObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1683
- isBooleanObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1684
- isBigIntObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1685
- isSymbolObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1686
- isBoxedPrimitive: { fn: "util.typeIs", params: [DYN], result: BOOL },
1687
- isBigInt64Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1688
- isBigUint64Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1689
- isFloat16Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1690
- isCryptoKey: { fn: "util.typeIs", params: [DYN], result: BOOL },
1691
- isExternal: { fn: "util.typeIs", params: [DYN], result: BOOL },
1692
- },
1693
- buffer: {
1694
- isAscii: { fn: "buffer.isAscii", params: [DYN], result: BOOL },
1695
- isUtf8: { fn: "buffer.isUtf8", params: [DYN], result: BOOL },
1696
- transcode: { fn: "buffer.transcode", params: [DYN, DYN, DYN], result: BYTES_U8 },
1697
- },
1698
- tty: {
1699
- isatty: { fn: "process.isTTY", params: [F64], result: BOOL },
1700
- },
1701
- process: {
1702
- loadEnvFile: { fn: "process.loadEnvFile", params: [DYN], result: VOID },
1703
- },
1704
- // node:string_decoder's surface is the StringDecoder CLASS — new/write/
1705
- // end are special-cased (lowerNew + lowerStringDecoderMethodCall); no
1706
- // function members exist to table.
1707
- string_decoder: {},
1708
- // node:querystring — the legacy query-string codec (NOT URLSearchParams;
1709
- // the escaping and '+' rules differ). escape/unescape ride the table
1710
- // path directly; parse and stringify are special-cased in
1711
- // lowerBuiltinModuleCall (parse's result is the call site's mapped
1712
- // ParsedUrlQuery dictionary — the networkInterfaces verification stance
1713
- // — and its sep/eq/options complete there; stringify's object argument
1714
- // crosses as a dyn value). decode/encode are Node's own aliases of
1715
- // parse/stringify (`const decode = parse` in lib/querystring.js) and
1716
- // route to the same special cases; the entries carry canonical shapes.
1717
- querystring: {
1718
- parse: { fn: "qs.parse", params: [STRING], result: VOID },
1719
- decode: { fn: "qs.parse", params: [STRING], result: VOID },
1720
- stringify: { fn: "qs.stringify", params: [DYN], result: STRING },
1721
- encode: { fn: "qs.stringify", params: [DYN], result: STRING },
1722
- escape: {
1723
- fn: "qs.escape",
1724
- params: [STRING],
1725
- result: STRING,
1726
- valueParams: [{ mode: "required", type: STRING }],
1727
- },
1728
- unescape: {
1729
- fn: "qs.unescape",
1730
- params: [STRING],
1731
- result: STRING,
1732
- valueParams: [{ mode: "required", type: STRING }],
1733
- },
1734
- },
1735
- // node:punycode (deprecated): punycode.js 2.1.0's conversions over
1736
- // strings (scr_url.c). ucs2.decode/encode are members of the module's
1737
- // ucs2 object, dispatched as module members (builtinMemberOf). The
1738
- // DEP0040 report rides the module's load sites (punycodeLoadWarning).
1739
- punycode: {
1740
- decode: { fn: "punycode.decode", params: [STRING], result: STRING },
1741
- encode: { fn: "punycode.encode", params: [STRING], result: STRING },
1742
- toASCII: { fn: "punycode.toASCII", params: [STRING], result: STRING },
1743
- toUnicode: { fn: "punycode.toUnicode", params: [STRING], result: STRING },
1744
- "ucs2.decode": { fn: "punycode.ucs2Decode", params: [STRING], result: arrayOf(F64) },
1745
- "ucs2.encode": { fn: "punycode.ucs2Encode", params: [arrayOf(F64)], result: STRING },
1746
- },
1747
- // node:constants (deprecated) is one frozen object (Object.assign of
1748
- // os.constants' groups, fs.constants and crypto.constants): bindings of
1749
- // the module read it as a checked-dynamic value (builtinConstantsObject).
1750
- constants: {},
1751
- // node:readline: createInterface's options are entirely special-cased
1752
- // (exactly { input: process.stdin, output?: process.stdout } — see
1753
- // lowerBuiltinModuleCall); the entry carries the canonical shape. The
1754
- // interface's question/close/on lower through
1755
- // lowerReadlineMethodCall.
1756
- readline: {
1757
- createInterface: { fn: "rl.create", params: [], result: F64 },
1758
- },
1759
- // node:readline/promises: the same Interface with the promise question
1760
- // (lowerReadlineMethodCall tells the forms apart by the call's result).
1761
- "readline/promises": {
1762
- createInterface: { fn: "rl.create", params: [], result: F64 },
1763
- },
1764
- // node:net and node:http lower ENTIRELY through the server spoke
1765
- // (lower-server.ts — every call shape is special-cased: closures, the
1766
- // optional connect host, writeHead's literal headers); the member list
1767
- // is the lower-server dispatch there. The modules still need keys here so future
1768
- // table entries have a home, and so the "recognized module, unlowered
1769
- // member" fence wording applies.
1770
- net: {
1771
- // The process-wide happy-eyeballs attempt budget: one runtime double
1772
- // in the core unit (never links scr_net.c by itself), default 250ms
1773
- // like Node's.
1774
- getDefaultAutoSelectFamilyAttemptTimeout: {
1775
- fn: "net.getAutoSelTimeout",
1776
- params: [],
1777
- result: F64,
1778
- },
1779
- setDefaultAutoSelectFamilyAttemptTimeout: {
1780
- fn: "net.setAutoSelTimeout",
1781
- params: [F64],
1782
- result: VOID,
1783
- },
1784
- // Node's IPv4Reg / IPv6Reg tests over String(input).
1785
- isIP: { fn: "net.isIP", params: [DYN], result: F64 },
1786
- isIPv4: { fn: "net.isIPv4", params: [DYN], result: BOOL },
1787
- isIPv6: { fn: "net.isIPv6", params: [DYN], result: BOOL },
1788
- },
1789
- http: {},
1790
- // node:tls and node:https ride the same spoke (tls.createServer's
1791
- // options + secureConnection handler, https.createServer, and the
1792
- // https client's rejectUnauthorized/ca options are all special-cased
1793
- // in lower-server.ts).
1794
- tls: {},
1795
- https: {},
1796
- // node:dgram and node:dns lower ENTIRELY through the dgram spoke
1797
- // (lower-dgram.ts — createSocket's option literal, dns.lookup's
1798
- // options + callback, and the Socket method surface are all
1799
- // special-cased); the keys exist for the same reason net/http's do.
1800
- dgram: {},
1801
- dns: {},
1802
- // node:dns/promises rides the same spoke (lookup's promise form).
1803
- "dns/promises": {},
1804
- // node:v8: getHeapStatistics answers allocator-derived figures in
1805
- // Node's shape (builtins/v8.ts — the entry carries the canonical
1806
- // shape); every other member fences with the by-design reason
1807
- // (builtinFenceHintOf).
1808
- v8: {
1809
- getHeapStatistics: { fn: "process.memoryUsageTake", params: [], result: VOID },
1810
- },
1811
- // node:stream/web re-exports the web stream globals (the same objects);
1812
- // its members lower through the globals' own paths.
1813
- "stream/web": {},
1814
- // node:assert lowers ENTIRELY through the assert spoke (lower-assert.ts
1815
- // — every call shape is special-cased: optional messages complete, the
1816
- // comparisons pick per-type libCalls, deep equality synthesizes
1817
- // helpers); the keys exist so unlowered members fence module-qualified
1818
- // with the hints below.
1819
- assert: {},
1820
- "assert/strict": {},
1821
- // node:test lowers ENTIRELY through the test spoke (lower-test.ts —
1822
- // registrations, suites, hooks, the TestContext surface); the key
1823
- // exists so unlowered members fence module-qualified.
1824
- test: {},
1825
- // node:stream/promises lowers through the stream spoke too
1826
- // (lower-stream.ts — finished/pipeline's promise forms special-case
1827
- // their stream arguments exactly like the callback forms); the key
1828
- // exists so unlowered members fence module-qualified.
1829
- "stream/promises": {},
1830
- // node:stream/consumers rides the stream spoke as well (text/json/
1831
- // buffer/arrayBuffer special-case their stream argument); blob fences
1832
- // module-qualified with the pointed hint below.
1833
- "stream/consumers": {},
1834
- // node:timers/promises — the delay-only setTimeout and bare setImmediate
1835
- // (void promises the shared timer heap settles), and scheduler.wait /
1836
- // scheduler.yield, which Node defines as setTimeout(delay, undefined,
1837
- // options) and setImmediate(). The arity completion (omitted delay =
1838
- // Node's 1ms) and the value/options fences are special-cased in
1839
- // lowerBuiltinModuleCall; these entries carry the canonical shapes and
1840
- // route the dispatch.
1841
- "timers/promises": {
1842
- setTimeout: { fn: "tp.setTimeout", params: [F64], result: { kind: "promise", inner: VOID } },
1843
- setImmediate: { fn: "tp.setImmediate", params: [], result: { kind: "promise", inner: VOID } },
1844
- "scheduler.wait": {
1845
- fn: "tp.setTimeout",
1846
- params: [F64],
1847
- result: { kind: "promise", inner: VOID },
1848
- },
1849
- "scheduler.yield": {
1850
- fn: "tp.setImmediate",
1851
- params: [],
1852
- result: { kind: "promise", inner: VOID },
985
+ let builtinModuleFnTable;
986
+ /** Every builtin module's lowered function members, keyed by module and
987
+ * member. The table is built on the first call, so runs that do not lower
988
+ * a module do not construct it. */
989
+ export function builtinModuleFns() {
990
+ builtinModuleFnTable ??= buildBuiltinModuleFns();
991
+ return builtinModuleFnTable;
992
+ }
993
+ function buildBuiltinModuleFns() {
994
+ return {
995
+ fs: {
996
+ readFileSync: { fn: "fs.readFileSync", params: [STRING, STRING], result: STRING },
997
+ // The exact-API subset is first-class. A fixed native ABI is not enough:
998
+ // rows whose Node function has behavior-bearing trailing options remain
999
+ // call-only, or function-width adaptation could discard those options
1000
+ // without a diagnostic before entering the fixed runtime call.
1001
+ writeFileSync: { fn: "fs.writeFileSync", params: [STRING, STRING], result: VOID },
1002
+ appendFileSync: { fn: "fs.appendFileSync", params: [STRING, STRING], result: VOID },
1003
+ existsSync: {
1004
+ fn: "fs.existsSync",
1005
+ params: [STRING],
1006
+ result: BOOL,
1007
+ valueParams: exactValueParams(STRING),
1008
+ },
1009
+ mkdirSync: { fn: "fs.mkdirSync", params: [STRING], result: VOID },
1010
+ rmSync: { fn: "fs.rmSync", params: [STRING], result: VOID },
1011
+ rmdirSync: { fn: "fs.rmdirSync", params: [STRING], result: VOID },
1012
+ readdirSync: { fn: "fs.readdirSync", params: [STRING], result: arrayOf(STRING) },
1013
+ // Pattern and options are checked by the runtime (lowerFsGlobSyncCall).
1014
+ globSync: { fn: "fs.globSync", params: [DYN, DYN], result: arrayOf(STRING) },
1015
+ statSync: { fn: "fs.statSync", params: [STRING], result: STATS_T },
1016
+ mkdtempSync: { fn: "fs.mkdtempSync", params: [STRING], result: STRING },
1017
+ // accessSync's omitted mode completes to 0 (F_OK) in the special case
1018
+ // in lowerBuiltinModuleCall — string `defaults` can't spell a number.
1019
+ accessSync: { fn: "fs.accessSync", params: [STRING, F64], result: VOID },
1020
+ unlinkSync: {
1021
+ fn: "fs.unlinkSync",
1022
+ params: [STRING],
1023
+ result: VOID,
1024
+ valueParams: exactValueParams(STRING),
1025
+ },
1026
+ chmodSync: {
1027
+ fn: "fs.chmodSync",
1028
+ params: [STRING, F64],
1029
+ result: VOID,
1030
+ valueParams: exactValueParams(STRING, F64),
1031
+ },
1032
+ chownSync: {
1033
+ fn: "fs.chownSync",
1034
+ params: [STRING, F64, F64],
1035
+ result: VOID,
1036
+ valueParams: exactValueParams(STRING, F64, F64),
1037
+ },
1038
+ lchownSync: {
1039
+ fn: "fs.lchownSync",
1040
+ params: [STRING, F64, F64],
1041
+ result: VOID,
1042
+ valueParams: exactValueParams(STRING, F64, F64),
1043
+ },
1044
+ fchownSync: {
1045
+ fn: "fs.fchownSync",
1046
+ params: [F64, F64, F64],
1047
+ result: VOID,
1048
+ valueParams: exactValueParams(F64, F64, F64),
1049
+ },
1050
+ // truncateSync's omitted len completes to 0 in lowerBuiltinModuleCall,
1051
+ // like accessSync's mode.
1052
+ truncateSync: { fn: "fs.truncateSync", params: [STRING, F64], result: VOID },
1053
+ // The 2-argument form only: Node's mode flags (COPYFILE_EXCL, ...)
1054
+ // land on the arity fence.
1055
+ copyFileSync: { fn: "fs.copyFileSync", params: [STRING, STRING], result: VOID },
1056
+ // The callback form is special-cased in lowerBuiltinModuleCall: its
1057
+ // Error | null parameter is program-shaped and needs an emitted
1058
+ // adapter. The row still projects the static surface and routes the
1059
+ // dispatch.
1060
+ rename: { fn: "fs.renameCb", params: [], result: VOID },
1061
+ renameSync: {
1062
+ fn: "fs.renameSync",
1063
+ params: [STRING, STRING],
1064
+ result: VOID,
1065
+ valueParams: exactValueParams(STRING, STRING),
1066
+ },
1067
+ // statSync's no-follow sibling; stats.isSymbolicLink answers what the
1068
+ // follow-free snapshot saw.
1069
+ // opendirSync's options (a literal { bufferSize, encoding: "utf8" })
1070
+ // lower in lowerBuiltinModuleCall; the row routes the dispatch.
1071
+ opendirSync: { fn: "fs.opendirSync", params: [STRING, F64], result: DIR_T },
1072
+ // createReadStream/createWriteStream lower in lowerBuiltinModuleCall
1073
+ // (path and options cross as dyn values); the rows route the dispatch.
1074
+ createReadStream: {
1075
+ fn: "fs.createReadStream",
1076
+ params: [DYN, DYN],
1077
+ result: { kind: "object", className: "%Readable" },
1078
+ },
1079
+ createWriteStream: {
1080
+ fn: "fs.createWriteStream",
1081
+ params: [DYN, DYN],
1082
+ result: { kind: "object", className: "%Writable" },
1083
+ },
1084
+ lstatSync: { fn: "fs.lstatSync", params: [STRING], result: STATS_T },
1085
+ fstatSync: {
1086
+ fn: "fs.fstatSync",
1087
+ params: [F64],
1088
+ result: STATS_T,
1089
+ valueParams: exactValueParams(F64),
1090
+ },
1091
+ fchmodSync: {
1092
+ fn: "fs.fchmodSync",
1093
+ params: [F64, F64],
1094
+ result: VOID,
1095
+ valueParams: exactValueParams(F64, F64),
1096
+ },
1097
+ fsyncSync: {
1098
+ fn: "fs.fsyncSync",
1099
+ params: [F64],
1100
+ result: VOID,
1101
+ valueParams: exactValueParams(F64),
1102
+ },
1103
+ fdatasyncSync: {
1104
+ fn: "fs.fdatasyncSync",
1105
+ params: [F64],
1106
+ result: VOID,
1107
+ valueParams: exactValueParams(F64),
1108
+ },
1109
+ ftruncateSync: { fn: "fs.ftruncateSync", params: [F64, F64], result: VOID },
1110
+ utimesSync: { fn: "fs.utimesSync", params: [DYN, DYN, DYN], result: VOID },
1111
+ futimesSync: { fn: "fs.futimesSync", params: [DYN, DYN, DYN], result: VOID },
1112
+ lutimesSync: { fn: "fs.lutimesSync", params: [DYN, DYN, DYN], result: VOID },
1113
+ readvSync: { fn: "fs.readvSync", params: [F64, arrayOf(BYTES_U8), F64], result: F64 },
1114
+ writevSync: { fn: "fs.writevSync", params: [F64, arrayOf(BYTES_U8), F64], result: F64 },
1115
+ linkSync: {
1116
+ fn: "fs.linkSync",
1117
+ params: [DYN, DYN],
1118
+ result: VOID,
1119
+ valueParams: exactValueParams(DYN, DYN),
1120
+ },
1121
+ // Options and paths are checked by the runtime (scr_fs_cp_begin).
1122
+ cpSync: {
1123
+ fn: "fs.cpSync",
1124
+ params: [DYN, DYN, DYN],
1125
+ result: VOID,
1126
+ valueParams: [
1127
+ ...exactValueParams(DYN, DYN),
1128
+ { mode: "optional", type: DYN, defaultValue: undefined },
1129
+ ],
1130
+ },
1131
+ symlinkSync: {
1132
+ fn: "fs.symlinkSync",
1133
+ params: [DYN, DYN, DYN],
1134
+ result: VOID,
1135
+ valueParams: [
1136
+ ...exactValueParams(DYN, DYN),
1137
+ { mode: "optional", type: DYN, defaultValue: undefined },
1138
+ ],
1139
+ },
1140
+ readlinkSync: {
1141
+ fn: "fs.readlinkSync",
1142
+ params: [DYN, DYN],
1143
+ result: DYN,
1144
+ valueParams: [
1145
+ ...exactValueParams(DYN),
1146
+ { mode: "optional", type: DYN, defaultValue: undefined },
1147
+ ],
1148
+ },
1149
+ statfsSync: {
1150
+ fn: "fs.statfsSync",
1151
+ params: [DYN, DYN],
1152
+ result: DYN,
1153
+ valueParams: [
1154
+ ...exactValueParams(DYN),
1155
+ { mode: "optional", type: DYN, defaultValue: undefined },
1156
+ ],
1157
+ },
1158
+ // realpath(3) — Node's realpathSync (failures spell syscall "lstat",
1159
+ // Node's own message shape).
1160
+ realpathSync: { fn: "fs.realpathSync", params: [STRING], result: STRING },
1161
+ "realpathSync.native": { fn: "fs.realpathNativeSync", params: [STRING], result: STRING },
1162
+ // The fd pair behind spawn's fd-stdio form (the daemon-log idiom:
1163
+ // openSync(logPath, "a") → spawn stdio ["ignore", fd, fd] →
1164
+ // closeSync). String flags use the established two-argument path;
1165
+ // inline numeric O_* expressions route through openNumericSync, with
1166
+ // an optional creation mode as the third argument.
1167
+ openSync: { fn: "fs.openSync", params: [STRING, STRING], result: F64 },
1168
+ // The buffer forms (fd, buffer, offset, length[, position]). The
1169
+ // lowering completes an omitted or literal-null position to -1 (the
1170
+ // runtime's current-offset sentinel); numeric positions read without
1171
+ // advancing the fd. The options-object and bigint forms still fence.
1172
+ readSync: { fn: "fs.readSync", params: [F64, BYTES_U8, F64, F64, F64], result: F64 },
1173
+ // Entirely special-cased: the classic Buffer window and utf8 string
1174
+ // overloads lower to separate fixed-width runtime ABIs. As with
1175
+ // readSync, -1 is the current-offset sentinel.
1176
+ writeSync: { fn: "fs.writeSync", params: [F64, BYTES_U8, F64, F64, F64], result: F64 },
1177
+ closeSync: {
1178
+ fn: "fs.closeSync",
1179
+ params: [F64],
1180
+ result: VOID,
1181
+ valueParams: exactValueParams(F64),
1182
+ },
1183
+ // Entirely special-cased (lowerFsWatchCall — the callback needs an
1184
+ // adapter per listener shape); this entry only routes the dispatch.
1185
+ watch: { fn: "fs.watch", params: [], result: VOID },
1186
+ },
1187
+ "fs/promises": {
1188
+ // The sync operations behind already-settled promises: failures
1189
+ // REJECT (catchable at the await) instead of throwing. readFile is
1190
+ // utf8-fenced exactly like readFileSync (same special case below).
1191
+ readFile: {
1192
+ fn: "fsp.readFile",
1193
+ params: [STRING, STRING],
1194
+ result: { kind: "promise", inner: STRING },
1195
+ },
1196
+ writeFile: {
1197
+ fn: "fsp.writeFile",
1198
+ params: [STRING, STRING],
1199
+ result: { kind: "promise", inner: VOID },
1200
+ },
1201
+ mkdir: { fn: "fsp.mkdir", params: [STRING], result: { kind: "promise", inner: VOID } },
1202
+ readdir: {
1203
+ fn: "fsp.readdir",
1204
+ params: [STRING],
1205
+ result: { kind: "promise", inner: arrayOf(STRING) },
1206
+ },
1207
+ rm: { fn: "fsp.rm", params: [STRING], result: { kind: "promise", inner: VOID } },
1208
+ // The async iterator lowers only as a for await head (lowerFspGlobCall).
1209
+ glob: { fn: "fsp.globStrings", params: [DYN, DYN], result: arrayOf(STRING) },
1210
+ stat: { fn: "fsp.stat", params: [STRING], result: { kind: "promise", inner: STATS_T } },
1211
+ realpath: {
1212
+ fn: "fsp.realpath",
1213
+ params: [STRING],
1214
+ result: { kind: "promise", inner: STRING },
1215
+ },
1216
+ lstat: { fn: "fsp.lstat", params: [STRING], result: { kind: "promise", inner: STATS_T } },
1217
+ opendir: {
1218
+ fn: "fsp.opendir",
1219
+ params: [STRING, F64],
1220
+ result: { kind: "promise", inner: DIR_T },
1221
+ },
1222
+ unlink: {
1223
+ fn: "fsp.unlink",
1224
+ params: [STRING],
1225
+ result: { kind: "promise", inner: VOID },
1226
+ valueParams: exactValueParams(STRING),
1227
+ },
1228
+ chmod: {
1229
+ fn: "fsp.chmod",
1230
+ params: [STRING, F64],
1231
+ result: { kind: "promise", inner: VOID },
1232
+ valueParams: exactValueParams(STRING, F64),
1233
+ },
1234
+ chown: {
1235
+ fn: "fsp.chown",
1236
+ params: [STRING, F64, F64],
1237
+ result: { kind: "promise", inner: VOID },
1238
+ valueParams: exactValueParams(STRING, F64, F64),
1239
+ },
1240
+ lchown: {
1241
+ fn: "fsp.lchown",
1242
+ params: [STRING, F64, F64],
1243
+ result: { kind: "promise", inner: VOID },
1244
+ valueParams: exactValueParams(STRING, F64, F64),
1245
+ },
1246
+ // access' omitted mode and truncate's omitted len complete to 0 in
1247
+ // lowerBuiltinModuleCall, like their sync spellings.
1248
+ access: { fn: "fsp.access", params: [STRING, F64], result: { kind: "promise", inner: VOID } },
1249
+ truncate: {
1250
+ fn: "fsp.truncate",
1251
+ params: [STRING, F64],
1252
+ result: { kind: "promise", inner: VOID },
1253
+ },
1254
+ // String data; Uint8Array/Buffer data routes to fsp.appendFileBytes in
1255
+ // lowerBuiltinModuleCall.
1256
+ appendFile: {
1257
+ fn: "fsp.appendFile",
1258
+ params: [STRING, STRING],
1259
+ result: { kind: "promise", inner: VOID },
1260
+ },
1261
+ // The 2-argument form only, like copyFileSync.
1262
+ copyFile: {
1263
+ fn: "fsp.copyFile",
1264
+ params: [STRING, STRING],
1265
+ result: { kind: "promise", inner: VOID },
1266
+ },
1267
+ mkdtemp: { fn: "fsp.mkdtemp", params: [STRING], result: { kind: "promise", inner: STRING } },
1268
+ rmdir: { fn: "fsp.rmdir", params: [STRING], result: { kind: "promise", inner: VOID } },
1269
+ link: {
1270
+ fn: "fsp.link",
1271
+ params: [DYN, DYN],
1272
+ result: { kind: "promise", inner: VOID },
1273
+ valueParams: exactValueParams(DYN, DYN),
1274
+ },
1275
+ cp: {
1276
+ fn: "fsp.cp",
1277
+ params: [DYN, DYN, DYN],
1278
+ result: { kind: "promise", inner: VOID },
1279
+ valueParams: [
1280
+ ...exactValueParams(DYN, DYN),
1281
+ { mode: "optional", type: DYN, defaultValue: undefined },
1282
+ ],
1283
+ },
1284
+ symlink: {
1285
+ fn: "fsp.symlink",
1286
+ params: [DYN, DYN, DYN],
1287
+ result: { kind: "promise", inner: VOID },
1288
+ valueParams: [
1289
+ ...exactValueParams(DYN, DYN),
1290
+ { mode: "optional", type: DYN, defaultValue: undefined },
1291
+ ],
1292
+ },
1293
+ readlink: {
1294
+ fn: "fsp.readlink",
1295
+ params: [DYN, DYN],
1296
+ result: { kind: "promise", inner: DYN },
1297
+ valueParams: [
1298
+ ...exactValueParams(DYN),
1299
+ { mode: "optional", type: DYN, defaultValue: undefined },
1300
+ ],
1301
+ },
1302
+ statfs: {
1303
+ fn: "fsp.statfs",
1304
+ params: [DYN, DYN],
1305
+ result: { kind: "promise", inner: DYN },
1306
+ valueParams: [
1307
+ ...exactValueParams(DYN),
1308
+ { mode: "optional", type: DYN, defaultValue: undefined },
1309
+ ],
1310
+ },
1311
+ utimes: {
1312
+ fn: "fsp.utimes",
1313
+ params: [DYN, DYN, DYN],
1314
+ result: { kind: "promise", inner: VOID },
1315
+ },
1316
+ lutimes: {
1317
+ fn: "fsp.lutimes",
1318
+ params: [DYN, DYN, DYN],
1319
+ result: { kind: "promise", inner: VOID },
1320
+ },
1321
+ rename: {
1322
+ fn: "fsp.rename",
1323
+ params: [STRING, STRING],
1324
+ result: { kind: "promise", inner: VOID },
1325
+ valueParams: exactValueParams(STRING, STRING),
1326
+ },
1327
+ // open's optional flags/mode completion is special-cased in
1328
+ // lowerBuiltinModuleCall; this row routes all import spellings and
1329
+ // gives coverage the static member.
1330
+ open: {
1331
+ fn: "fsp.open",
1332
+ params: [STRING, STRING, F64],
1333
+ result: { kind: "promise", inner: FILEHANDLE_T },
1334
+ valueParams: [
1335
+ { mode: "required", type: STRING },
1336
+ { mode: "optional", type: STRING, defaultValue: "r" },
1337
+ { mode: "optional", type: F64, defaultValue: 0o666 },
1338
+ ],
1339
+ },
1340
+ },
1341
+ // The bare module's POSIX-target binding; a win32 target rebinds it to
1342
+ // the win32 table (builtinModuleFnsOf — Node on Windows IS path.win32).
1343
+ path: PATH_MODULE_FNS,
1344
+ // Real Node modules ("node:path/posix" resolves), and the receivers of
1345
+ // `path.posix.<member>` / `path.win32.<member>` through the namespace
1346
+ // chain (builtinNamespaceModuleOf composes "path" + ".posix" to these
1347
+ // keys). Both namespaces carry the FULL surface on every platform,
1348
+ // Node's own rule: each answers its own platform's semantics anywhere.
1349
+ "path/posix": PATH_MODULE_FNS,
1350
+ "path/win32": PATH_WIN32_MODULE_FNS,
1351
+ os: {
1352
+ // One platform implementation: os.platform() === process.platform.
1353
+ platform: { fn: "process.platform", params: [], result: STRING, valueParams: [] },
1354
+ homedir: { fn: "os.homedir", params: [], result: STRING, valueParams: [] },
1355
+ tmpdir: { fn: "os.tmpdir", params: [], result: STRING, valueParams: [] },
1356
+ // uname(2)'s release field — Node's own implementation.
1357
+ release: { fn: "os.release", params: [], result: STRING, valueParams: [] },
1358
+ // uname(2)'s sysname field ("Darwin", "Linux", "Windows_NT") — the
1359
+ // libFn/runtime pair predates this entry (the portless surface used
1360
+ // them); this row makes the MODULE call reach them (test/common's
1361
+ // isAIX/isIBMi getters are the canonical callers).
1362
+ type: { fn: "os.type", params: [], result: STRING, valueParams: [] },
1363
+ // Total physical memory in bytes — same predating-pair story.
1364
+ totalmem: { fn: "os.totalmem", params: [], result: F64, valueParams: [] },
1365
+ // uv_available_parallelism: the CPUs this process may use (affinity,
1366
+ // then cgroup quota on Linux), at least 1.
1367
+ availableParallelism: {
1368
+ fn: "os.availableParallelism",
1369
+ params: [],
1370
+ result: F64,
1371
+ valueParams: [],
1372
+ },
1373
+ // os.arch() IS process.arch, like platform().
1374
+ arch: { fn: "process.arch", params: [], result: STRING, valueParams: [] },
1375
+ hostname: { fn: "os.hostname", params: [], result: STRING, valueParams: [] },
1376
+ // uv_os_uname's machine and version fields, read once at module load
1377
+ // in Node (they never change while a process runs).
1378
+ machine: { fn: "os.machine", params: [], result: STRING, valueParams: [] },
1379
+ version: { fn: "os.version", params: [], result: STRING, valueParams: [] },
1380
+ endianness: { fn: "os.endianness", params: [], result: STRING, valueParams: [] },
1381
+ freemem: { fn: "os.freemem", params: [], result: F64, valueParams: [] },
1382
+ uptime: { fn: "os.uptime", params: [], result: F64, valueParams: [] },
1383
+ loadavg: { fn: "os.loadavg", params: [], result: arrayOf(F64), valueParams: [] },
1384
+ // An omitted (or undefined) pid is 0, the current process
1385
+ // (lowerOsGetPriorityCall completes it).
1386
+ getPriority: {
1387
+ fn: "os.getPriority",
1388
+ params: [F64],
1389
+ result: F64,
1390
+ valueParams: [{ mode: "optional", type: F64, defaultValue: 0 }],
1391
+ },
1392
+ // A one-argument call is setPriority(0, priority)
1393
+ // (lowerOsSetPriorityCall completes it).
1394
+ setPriority: { fn: "os.setPriority", params: [F64, F64], result: VOID },
1395
+ // Special-cased (lowerOsCpusCall): the call site's CpuInfo[] assembles
1396
+ // from one uv_cpu_info snapshot.
1397
+ cpus: { fn: "os.cpusTake", params: [], result: VOID },
1398
+ // Entirely special-cased (lowerOsNetworkInterfacesCall): the result is
1399
+ // the call site's mapped Dict<NetworkInterfaceInfo[]> shape, verified
1400
+ // structurally there — this entry only routes the dispatch.
1401
+ networkInterfaces: { fn: "os.networkInterfaces", params: [], result: VOID },
1402
+ // Special-cased too (lowerOsUserInfoCall): the call site's mapped
1403
+ // UserInfo record assembles field-by-field from scalar libCalls.
1404
+ userInfo: { fn: "os.userName", params: [], result: VOID },
1405
+ },
1406
+ crypto: {
1407
+ randomUUID: {
1408
+ fn: "crypto.randomUUID",
1409
+ params: [],
1410
+ result: STRING,
1411
+ // As a value (uuid's `export default { randomUUID }`), the optional
1412
+ // options argument goes through the validating entry point.
1413
+ valueFn: "crypto.randomUUIDOpts",
1414
+ valueParams: [{ mode: "optional", type: DYN, defaultValue: undefined }],
1415
+ },
1416
+ // A real Buffer result. The composed randomBytes(n).toString(enc)
1417
+ // form KEEPS its one-libCall lowering (lowerCryptoComposedCall runs
1418
+ // first and the Buffer never materializes there); this entry covers
1419
+ // the bare calls and non-composed uses.
1420
+ randomBytes: {
1421
+ fn: "crypto.randomBytes",
1422
+ params: [F64],
1423
+ result: BYTES_U8,
1424
+ valueParams: exactValueParams(F64),
1425
+ },
1426
+ // The crypto utility surface is special-cased for overloads and
1427
+ // string/Buffer splits in lowerCryptoModuleCall. These rows carry the
1428
+ // canonical signatures for manifest projection and fallback dispatch.
1429
+ createHash: { fn: "crypto.hashNew", params: [STRING], result: CRYPTOHASH_T },
1430
+ createHmac: { fn: "crypto.hmacNewStr", params: [STRING, STRING], result: CRYPTOHMAC_T },
1431
+ hash: { fn: "crypto.hashDigestStr", params: [STRING, STRING, STRING], result: STRING },
1432
+ timingSafeEqual: { fn: "crypto.timingSafeEqual", params: [BYTES_U8, BYTES_U8], result: BOOL },
1433
+ randomFillSync: { fn: "crypto.randomFill", params: [BYTES_U8, F64, F64], result: BYTES_U8 },
1434
+ getRandomValues: { fn: "crypto.getRandomValues", params: [BYTES_U8], result: BYTES_U8 },
1435
+ randomInt: { fn: "crypto.randomInt", params: [F64, F64], result: F64 },
1436
+ randomFill: { fn: "crypto.randomFillCb", params: [], result: VOID },
1437
+ randomUUIDv7: {
1438
+ fn: "crypto.randomUUIDv7",
1439
+ params: [DYN],
1440
+ result: STRING,
1441
+ valueParams: [{ mode: "optional", type: DYN, defaultValue: undefined }],
1442
+ },
1443
+ createSecretKey: { fn: "crypto.createSecretKey", params: [DYN, DYN], result: DYN },
1444
+ generateKeySync: { fn: "crypto.generateKeySync", params: [DYN, DYN], result: DYN },
1445
+ generateKey: { fn: "crypto.generateKeyCb", params: [], result: VOID },
1446
+ // Asymmetric keys and signatures (lowerPkiCall): checked-dynamic
1447
+ // arguments, results converted to the call site's type.
1448
+ createPrivateKey: { fn: "crypto.createPrivateKey", params: [DYN], result: DYN },
1449
+ createPublicKey: { fn: "crypto.createPublicKey", params: [DYN], result: DYN },
1450
+ createSign: { fn: "crypto.createSign", params: [DYN], result: DYN },
1451
+ createVerify: { fn: "crypto.createVerify", params: [DYN], result: DYN },
1452
+ generateKeyPairSync: { fn: "crypto.generateKeyPairSync", params: [], result: DYN },
1453
+ generateKeyPair: { fn: "crypto.generateKeyPairCb", params: [], result: VOID },
1454
+ sign: { fn: "crypto.signOneshot", params: [], result: DYN },
1455
+ verify: { fn: "crypto.verifyOneshot", params: [], result: DYN },
1456
+ diffieHellman: { fn: "crypto.diffieHellman", params: [], result: DYN },
1457
+ pbkdf2Sync: {
1458
+ fn: "crypto.pbkdf2",
1459
+ params: [BYTES_U8, BYTES_U8, F64, F64, STRING],
1460
+ result: BYTES_U8,
1461
+ },
1462
+ pbkdf2: { fn: "crypto.pbkdf2Cb", params: [], result: VOID },
1463
+ hkdfSync: {
1464
+ fn: "crypto.hkdf",
1465
+ params: [STRING, BYTES_U8, BYTES_U8, BYTES_U8, F64],
1466
+ result: DYN,
1467
+ },
1468
+ hkdf: { fn: "crypto.hkdfCb", params: [], result: VOID },
1469
+ scryptSync: { fn: "crypto.scrypt", params: [BYTES_U8, BYTES_U8, F64, DYN], result: BYTES_U8 },
1470
+ scrypt: { fn: "crypto.scryptCb", params: [], result: VOID },
1471
+ // Checked-dynamic arguments; the result is a native Cipheriv or
1472
+ // Decipheriv handle (lowerCryptoModuleCall).
1473
+ createCipheriv: { fn: "crypto.cipherNew", params: [BOOL, DYN, DYN, DYN, DYN], result: DYN },
1474
+ createDecipheriv: { fn: "crypto.cipherNew", params: [BOOL, DYN, DYN, DYN, DYN], result: DYN },
1475
+ // A checked-dynamic curve name; the result is a native ECDH handle
1476
+ // (lowerCreateEcdh).
1477
+ createECDH: { fn: "crypto.ecdhNew", params: [DYN], result: DYN },
1478
+ // Checked-dynamic arguments; the result is a native DiffieHellman or
1479
+ // DiffieHellmanGroup handle (lowerCreateDiffieHellman and
1480
+ // lowerGetDiffieHellman).
1481
+ createDiffieHellman: { fn: "crypto.dhNew", params: [DYN, DYN, DYN, DYN], result: DYN },
1482
+ getDiffieHellman: { fn: "crypto.dhGroupNew", params: [DYN], result: DYN },
1483
+ createDiffieHellmanGroup: { fn: "crypto.dhGroupNew", params: [DYN], result: DYN },
1484
+ // Prime checks and generation (lowerPrimeCall): checked-dynamic
1485
+ // arguments, results converted to the call site's type.
1486
+ checkPrimeSync: { fn: "crypto.checkPrimeSync", params: [], result: DYN },
1487
+ // Checked-dynamic arguments, the result converted to the call site's
1488
+ // type (lowerPrimeCall).
1489
+ getCipherInfo: { fn: "crypto.getCipherInfo", params: [], result: DYN },
1490
+ checkPrime: { fn: "crypto.checkPrimeCb", params: [], result: VOID },
1491
+ generatePrimeSync: { fn: "crypto.generatePrimeSync", params: [], result: DYN },
1492
+ generatePrime: { fn: "crypto.generatePrimeCb", params: [], result: VOID },
1493
+ },
1494
+ zlib: {
1495
+ // The default-options convenience family is special-cased in
1496
+ // lowerBuiltinModuleCall: string inputs UTF-8 encode, callback forms
1497
+ // carry program-shaped closures, and explicit options fence per site.
1498
+ // native-toolchain.ts links libz only when these appear on the IR.
1499
+ deflate: { fn: "zlib.deflateCb", params: [], result: VOID },
1500
+ deflateSync: { fn: "zlib.deflateSync", params: [BYTES_U8], result: BYTES_U8 },
1501
+ inflate: { fn: "zlib.inflateCb", params: [], result: VOID },
1502
+ inflateSync: { fn: "zlib.inflateSync", params: [BYTES_U8], result: BYTES_U8 },
1503
+ deflateRaw: { fn: "zlib.deflateRawCb", params: [], result: VOID },
1504
+ deflateRawSync: { fn: "zlib.deflateRawSync", params: [BYTES_U8], result: BYTES_U8 },
1505
+ inflateRaw: { fn: "zlib.inflateRawCb", params: [], result: VOID },
1506
+ inflateRawSync: { fn: "zlib.inflateRawSync", params: [BYTES_U8], result: BYTES_U8 },
1507
+ gzip: { fn: "zlib.gzipCb", params: [], result: VOID },
1508
+ gzipSync: { fn: "zlib.gzipSync", params: [BYTES_U8], result: BYTES_U8 },
1509
+ gunzip: { fn: "zlib.gunzipCb", params: [], result: VOID },
1510
+ gunzipSync: { fn: "zlib.gunzipSync", params: [BYTES_U8], result: BYTES_U8 },
1511
+ unzip: { fn: "zlib.unzipCb", params: [], result: VOID },
1512
+ unzipSync: { fn: "zlib.unzipSync", params: [BYTES_U8], result: BYTES_U8 },
1513
+ crc32: { fn: "zlib.crc32", params: [], result: F64 },
1514
+ // Brotli (special-cased in lowerZlibModuleCall): every form takes the
1515
+ // options entries with Node's BROTLI_ENCODE or BROTLI_DECODE mode.
1516
+ brotliCompress: { fn: "zlib.cbOpts", params: [], result: VOID },
1517
+ brotliCompressSync: { fn: "zlib.syncOpts", params: [], result: BYTES_U8 },
1518
+ brotliDecompress: { fn: "zlib.cbOpts", params: [], result: VOID },
1519
+ brotliDecompressSync: { fn: "zlib.syncOpts", params: [], result: BYTES_U8 },
1520
+ // The stream factories (special-cased in lowerZlibModuleCall): each
1521
+ // answers a runtime Transform stream over the zlib engine.
1522
+ createDeflate: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1523
+ createInflate: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1524
+ createGzip: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1525
+ createGunzip: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1526
+ createDeflateRaw: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1527
+ createInflateRaw: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1528
+ createUnzip: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1529
+ createBrotliCompress: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1530
+ createBrotliDecompress: { fn: "zlib.streamNew", params: [], result: ZLIB_STREAM },
1531
+ },
1532
+ url: {
1533
+ fileURLToPath: {
1534
+ fn: "url.fileURLToPathOptions",
1535
+ params: [DYN, DYN],
1536
+ result: STRING,
1537
+ valueParams: [
1538
+ { mode: "required", type: DYN },
1539
+ { mode: "optional", type: DYN, defaultValue: undefined },
1540
+ ],
1541
+ },
1542
+ fileURLToPathBuffer: {
1543
+ fn: "url.fileURLToPathBuffer",
1544
+ params: [DYN, DYN],
1545
+ result: BYTES_U8,
1546
+ valueParams: [
1547
+ { mode: "required", type: DYN },
1548
+ { mode: "optional", type: DYN, defaultValue: undefined },
1549
+ ],
1550
+ },
1551
+ pathToFileURL: {
1552
+ fn: "url.pathToFileURLChecked",
1553
+ params: [DYN, DYN],
1554
+ result: URL_T,
1555
+ valueParams: [
1556
+ { mode: "required", type: DYN },
1557
+ { mode: "optional", type: DYN, defaultValue: undefined },
1558
+ ],
1559
+ },
1560
+ // The legacy API and the domain pair (lowerLegacyUrlCall): arguments
1561
+ // cross as dyn values for Node's own validators; url.parse() answers
1562
+ // the checked-dynamic Url instance.
1563
+ parse: { fn: "url.legacyParse", params: [DYN, DYN, DYN], result: DYN },
1564
+ format: { fn: "url.legacyFormat", params: [DYN, DYN], result: STRING },
1565
+ resolve: { fn: "url.legacyResolve", params: [DYN, DYN], result: STRING },
1566
+ domainToASCII: { fn: "url.domainToASCII", params: [DYN], result: STRING },
1567
+ domainToUnicode: { fn: "url.domainToUnicode", params: [DYN], result: STRING },
1568
+ urlToHttpOptions: { fn: "url.toHttpOptions", params: [DYN], result: DYN },
1569
+ },
1570
+ child_process: {
1571
+ // spawnSync's and spawn's call completions are entirely special-cased
1572
+ // (an omitted args list completes to an empty string[]; spawnSync
1573
+ // accepts its documented literal options, while spawn supports the
1574
+ // stdio/detached/env/cwd/windowsHide/shell subset — see
1575
+ // lowerBuiltinModuleCall); the
1576
+ // entries carry the canonical shapes.
1577
+ spawnSync: { fn: "cp.spawnSync", params: [STRING, arrayOf(STRING)], result: SPAWNRES_T },
1578
+ spawn: { fn: "cp.spawn", params: [STRING, arrayOf(STRING)], result: CHILD_T },
1579
+ fork: { fn: "cp.fork", params: [STRING, arrayOf(STRING)], result: CHILD_T },
1580
+ // execFileSync(file, args?, options?) and execSync(command, options?)
1581
+ // share the cp.execSync runtime entry (execSync sets the shell flag);
1582
+ // both call completions are special-cased in lowerBuiltinModuleCall.
1583
+ // The entries carry canonical shapes for the coverage/fence machinery.
1584
+ execFileSync: { fn: "cp.execSync", params: [STRING, arrayOf(STRING)], result: STRING },
1585
+ execSync: { fn: "cp.execSync", params: [STRING], result: STRING },
1586
+ },
1587
+ // node:util lowers through dedicated paths: promisify
1588
+ // only in the const-binding-over-execFile shape — recognized in
1589
+ // lowerVarDecl / collectGlobals BEFORE any call lowering runs — and
1590
+ // inspect/format/formatWithOptions plus parseArgs through the util spoke
1591
+ // (lower-inspect.ts: per-type synthesized traversal helpers,
1592
+ // compile-time format strings, checked-dynamic config/result for
1593
+ // parseArgs), which both dispatch paths try before the generic table.
1594
+ // parseArgs is tabled as well so the generated surface manifest records
1595
+ // the dedicated static member; the spoke owns its optional arity and
1596
+ // call-site-specific result type before this canonical signature is used.
1597
+ util: {
1598
+ styleText: {
1599
+ fn: "util.styleText",
1600
+ params: [DYN, DYN, DYN],
1601
+ result: STRING,
1602
+ valueParams: [
1603
+ { mode: "required", type: DYN },
1604
+ { mode: "required", type: DYN },
1605
+ { mode: "optional", type: DYN, defaultValue: undefined },
1606
+ ],
1607
+ },
1608
+ isDeepStrictEqual: {
1609
+ fn: "util.isDeepStrictEqual",
1610
+ params: [DYN, DYN, DYN],
1611
+ result: BOOL,
1612
+ valueParams: [
1613
+ { mode: "required", type: DYN },
1614
+ { mode: "required", type: DYN },
1615
+ { mode: "optional", type: DYN, defaultValue: undefined },
1616
+ ],
1617
+ },
1618
+ parseArgs: { fn: "util.parseArgs", params: [DYN], result: DYN },
1619
+ parseEnv: { fn: "util.parseEnv", params: [DYN], result: DYN },
1620
+ getSystemErrorName: {
1621
+ fn: "util.getSystemErrorName",
1622
+ params: [DYN],
1623
+ result: STRING,
1624
+ valueParams: exactValueParams(DYN),
1625
+ },
1626
+ getSystemErrorMessage: {
1627
+ fn: "util.getSystemErrorMessage",
1628
+ params: [DYN],
1629
+ result: STRING,
1630
+ valueParams: exactValueParams(DYN),
1631
+ },
1632
+ getSystemErrorMap: { fn: "util.systemErrorEntries", params: [], result: DYN },
1633
+ stripVTControlCharacters: {
1634
+ fn: "util.stripVTControlCharacters",
1635
+ params: [DYN],
1636
+ result: STRING,
1637
+ valueParams: exactValueParams(DYN),
1638
+ },
1639
+ toUSVString: {
1640
+ fn: "util.toUSVString",
1641
+ params: [DYN],
1642
+ result: STRING,
1643
+ valueParams: exactValueParams(DYN),
1644
+ },
1645
+ // The function helpers take checked-dynamic arguments and answer native
1646
+ // dyn functions, which a static function slot checks when it receives
1647
+ // one (lowerUtilCallableCall in the util spoke).
1648
+ inherits: {
1649
+ fn: "util.inherits",
1650
+ params: [DYN, DYN],
1651
+ result: VOID,
1652
+ valueParams: [
1653
+ { mode: "required", type: DYN },
1654
+ { mode: "required", type: DYN },
1655
+ ],
1656
+ },
1657
+ deprecate: {
1658
+ fn: "util.deprecate",
1659
+ params: [DYN, DYN, DYN, DYN],
1660
+ result: DYN,
1661
+ valueParams: [
1662
+ { mode: "required", type: DYN },
1663
+ { mode: "required", type: DYN },
1664
+ { mode: "optional", type: DYN, defaultValue: undefined },
1665
+ { mode: "optional", type: DYN, defaultValue: undefined },
1666
+ ],
1667
+ },
1668
+ callbackify: {
1669
+ fn: "util.callbackify",
1670
+ params: [DYN],
1671
+ result: DYN,
1672
+ valueParams: [{ mode: "required", type: DYN }],
1673
+ },
1674
+ debuglog: {
1675
+ fn: "util.debuglog",
1676
+ params: [DYN, DYN],
1677
+ result: DYN,
1678
+ valueParams: [
1679
+ { mode: "required", type: DYN },
1680
+ { mode: "optional", type: DYN, defaultValue: undefined },
1681
+ ],
1682
+ },
1683
+ debug: {
1684
+ fn: "util.debuglog",
1685
+ params: [DYN, DYN],
1686
+ result: DYN,
1687
+ valueParams: [
1688
+ { mode: "required", type: DYN },
1689
+ { mode: "optional", type: DYN, defaultValue: undefined },
1690
+ ],
1691
+ },
1692
+ },
1693
+ // The util/types spoke supplies the probe name to the shared brand check.
1694
+ "util/types": {
1695
+ isAnyArrayBuffer: { fn: "util.typeIs", params: [DYN], result: BOOL },
1696
+ isArrayBuffer: { fn: "util.typeIs", params: [DYN], result: BOOL },
1697
+ isArrayBufferView: { fn: "util.typeIs", params: [DYN], result: BOOL },
1698
+ isDataView: { fn: "util.typeIs", params: [DYN], result: BOOL },
1699
+ isTypedArray: { fn: "util.typeIs", params: [DYN], result: BOOL },
1700
+ isUint8Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1701
+ isUint8ClampedArray: { fn: "util.typeIs", params: [DYN], result: BOOL },
1702
+ isUint16Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1703
+ isUint32Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1704
+ isInt8Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1705
+ isInt16Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1706
+ isInt32Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1707
+ isFloat32Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1708
+ isFloat64Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1709
+ isMap: { fn: "util.typeIs", params: [DYN], result: BOOL },
1710
+ isSet: { fn: "util.typeIs", params: [DYN], result: BOOL },
1711
+ isWeakMap: { fn: "util.typeIs", params: [DYN], result: BOOL },
1712
+ isWeakSet: { fn: "util.typeIs", params: [DYN], result: BOOL },
1713
+ isRegExp: { fn: "util.typeIs", params: [DYN], result: BOOL },
1714
+ isNativeError: { fn: "util.typeIs", params: [DYN], result: BOOL },
1715
+ isPromise: { fn: "util.typeIs", params: [DYN], result: BOOL },
1716
+ isProxy: { fn: "util.typeIs", params: [DYN], result: BOOL },
1717
+ isAsyncFunction: { fn: "util.typeIs", params: [DYN], result: BOOL },
1718
+ isGeneratorFunction: { fn: "util.typeIs", params: [DYN], result: BOOL },
1719
+ isGeneratorObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1720
+ isDate: { fn: "util.typeIs", params: [DYN], result: BOOL },
1721
+ isSharedArrayBuffer: { fn: "util.typeIs", params: [DYN], result: BOOL },
1722
+ isMapIterator: { fn: "util.typeIs", params: [DYN], result: BOOL },
1723
+ isSetIterator: { fn: "util.typeIs", params: [DYN], result: BOOL },
1724
+ isKeyObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1725
+ isNumberObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1726
+ isStringObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1727
+ isBooleanObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1728
+ isBigIntObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1729
+ isSymbolObject: { fn: "util.typeIs", params: [DYN], result: BOOL },
1730
+ isBoxedPrimitive: { fn: "util.typeIs", params: [DYN], result: BOOL },
1731
+ isBigInt64Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1732
+ isBigUint64Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1733
+ isFloat16Array: { fn: "util.typeIs", params: [DYN], result: BOOL },
1734
+ isCryptoKey: { fn: "util.typeIs", params: [DYN], result: BOOL },
1735
+ isExternal: { fn: "util.typeIs", params: [DYN], result: BOOL },
1736
+ },
1737
+ buffer: {
1738
+ isAscii: { fn: "buffer.isAscii", params: [DYN], result: BOOL },
1739
+ isUtf8: { fn: "buffer.isUtf8", params: [DYN], result: BOOL },
1740
+ transcode: { fn: "buffer.transcode", params: [DYN, DYN, DYN], result: BYTES_U8 },
1741
+ },
1742
+ tty: {
1743
+ isatty: { fn: "process.isTTY", params: [F64], result: BOOL },
1744
+ },
1745
+ process: {
1746
+ loadEnvFile: { fn: "process.loadEnvFile", params: [DYN], result: VOID },
1747
+ },
1748
+ // node:string_decoder's surface is the StringDecoder CLASS — new/write/
1749
+ // end are special-cased (lowerNew + lowerStringDecoderMethodCall); no
1750
+ // function members exist to table.
1751
+ string_decoder: {},
1752
+ // node:querystring — the legacy query-string codec (NOT URLSearchParams;
1753
+ // the escaping and '+' rules differ). escape/unescape ride the table
1754
+ // path directly; parse and stringify are special-cased in
1755
+ // lowerBuiltinModuleCall (parse's result is the call site's mapped
1756
+ // ParsedUrlQuery dictionary — the networkInterfaces verification stance
1757
+ // — and its sep/eq/options complete there; stringify's object argument
1758
+ // crosses as a dyn value). decode/encode are Node's own aliases of
1759
+ // parse/stringify (`const decode = parse` in lib/querystring.js) and
1760
+ // route to the same special cases; the entries carry canonical shapes.
1761
+ querystring: {
1762
+ parse: { fn: "qs.parse", params: [STRING], result: VOID },
1763
+ decode: { fn: "qs.parse", params: [STRING], result: VOID },
1764
+ stringify: { fn: "qs.stringify", params: [DYN], result: STRING },
1765
+ encode: { fn: "qs.stringify", params: [DYN], result: STRING },
1766
+ escape: {
1767
+ fn: "qs.escape",
1768
+ params: [STRING],
1769
+ result: STRING,
1770
+ valueParams: [{ mode: "required", type: STRING }],
1771
+ },
1772
+ unescape: {
1773
+ fn: "qs.unescape",
1774
+ params: [STRING],
1775
+ result: STRING,
1776
+ valueParams: [{ mode: "required", type: STRING }],
1777
+ },
1778
+ },
1779
+ // node:punycode (deprecated): punycode.js 2.1.0's conversions over
1780
+ // strings (scr_url.c). ucs2.decode/encode are members of the module's
1781
+ // ucs2 object, dispatched as module members (builtinMemberOf). The
1782
+ // DEP0040 report rides the module's load sites (punycodeLoadWarning).
1783
+ punycode: {
1784
+ decode: { fn: "punycode.decode", params: [STRING], result: STRING },
1785
+ encode: { fn: "punycode.encode", params: [STRING], result: STRING },
1786
+ toASCII: { fn: "punycode.toASCII", params: [STRING], result: STRING },
1787
+ toUnicode: { fn: "punycode.toUnicode", params: [STRING], result: STRING },
1788
+ "ucs2.decode": { fn: "punycode.ucs2Decode", params: [STRING], result: arrayOf(F64) },
1789
+ "ucs2.encode": { fn: "punycode.ucs2Encode", params: [arrayOf(F64)], result: STRING },
1790
+ },
1791
+ // node:constants (deprecated) is one frozen object (Object.assign of
1792
+ // os.constants' groups, fs.constants and crypto.constants): bindings of
1793
+ // the module read it as a checked-dynamic value (builtinConstantsObject).
1794
+ constants: {},
1795
+ // node:readline: createInterface's options are entirely special-cased
1796
+ // (exactly { input: process.stdin, output?: process.stdout } — see
1797
+ // lowerBuiltinModuleCall); the entry carries the canonical shape. The
1798
+ // interface's question/close/on lower through
1799
+ // lowerReadlineMethodCall.
1800
+ readline: {
1801
+ createInterface: { fn: "rl.create", params: [], result: F64 },
1802
+ },
1803
+ // node:readline/promises: the same Interface with the promise question
1804
+ // (lowerReadlineMethodCall tells the forms apart by the call's result).
1805
+ "readline/promises": {
1806
+ createInterface: { fn: "rl.create", params: [], result: F64 },
1807
+ },
1808
+ // node:net and node:http lower ENTIRELY through the server spoke
1809
+ // (lower-server.ts — every call shape is special-cased: closures, the
1810
+ // optional connect host, writeHead's literal headers); the member list
1811
+ // is the lower-server dispatch there. The modules still need keys here so future
1812
+ // table entries have a home, and so the "recognized module, unlowered
1813
+ // member" fence wording applies.
1814
+ net: {
1815
+ // The process-wide happy-eyeballs attempt budget: one runtime double
1816
+ // in the core unit (never links scr_net.c by itself), default 250ms
1817
+ // like Node's.
1818
+ getDefaultAutoSelectFamilyAttemptTimeout: {
1819
+ fn: "net.getAutoSelTimeout",
1820
+ params: [],
1821
+ result: F64,
1822
+ },
1823
+ setDefaultAutoSelectFamilyAttemptTimeout: {
1824
+ fn: "net.setAutoSelTimeout",
1825
+ params: [F64],
1826
+ result: VOID,
1827
+ },
1828
+ // Node's IPv4Reg / IPv6Reg tests over String(input).
1829
+ isIP: { fn: "net.isIP", params: [DYN], result: F64 },
1830
+ isIPv4: { fn: "net.isIPv4", params: [DYN], result: BOOL },
1831
+ isIPv6: { fn: "net.isIPv6", params: [DYN], result: BOOL },
1832
+ },
1833
+ http: {},
1834
+ // node:tls and node:https ride the same spoke (tls.createServer's
1835
+ // options + secureConnection handler, https.createServer, and the
1836
+ // https client's rejectUnauthorized/ca options are all special-cased
1837
+ // in lower-server.ts).
1838
+ tls: {},
1839
+ https: {},
1840
+ // node:dgram and node:dns lower ENTIRELY through the dgram spoke
1841
+ // (lower-dgram.ts — createSocket's option literal, dns.lookup's
1842
+ // options + callback, and the Socket method surface are all
1843
+ // special-cased); the keys exist for the same reason net/http's do.
1844
+ dgram: {},
1845
+ dns: {},
1846
+ // node:dns/promises rides the same spoke (lookup's promise form).
1847
+ "dns/promises": {},
1848
+ // node:v8: getHeapStatistics answers allocator-derived figures in
1849
+ // Node's shape (builtins/v8.ts — the entry carries the canonical
1850
+ // shape); every other member fences with the by-design reason
1851
+ // (builtinFenceHintOf).
1852
+ v8: {
1853
+ getHeapStatistics: { fn: "process.memoryUsageTake", params: [], result: VOID },
1854
+ },
1855
+ // node:stream/web re-exports the web stream globals (the same objects);
1856
+ // its members lower through the globals' own paths.
1857
+ "stream/web": {},
1858
+ // node:assert lowers ENTIRELY through the assert spoke (lower-assert.ts
1859
+ // — every call shape is special-cased: optional messages complete, the
1860
+ // comparisons pick per-type libCalls, deep equality synthesizes
1861
+ // helpers); the keys exist so unlowered members fence module-qualified
1862
+ // with the hints below.
1863
+ assert: {},
1864
+ "assert/strict": {},
1865
+ // node:test lowers ENTIRELY through the test spoke (lower-test.ts —
1866
+ // registrations, suites, hooks, the TestContext surface); the key
1867
+ // exists so unlowered members fence module-qualified.
1868
+ test: {},
1869
+ // node:stream/promises lowers through the stream spoke too
1870
+ // (lower-stream.ts — finished/pipeline's promise forms special-case
1871
+ // their stream arguments exactly like the callback forms); the key
1872
+ // exists so unlowered members fence module-qualified.
1873
+ "stream/promises": {},
1874
+ // node:stream/consumers rides the stream spoke as well (text/json/
1875
+ // buffer/arrayBuffer special-case their stream argument); blob fences
1876
+ // module-qualified with the pointed hint below.
1877
+ "stream/consumers": {},
1878
+ // node:timers/promises — the delay-only setTimeout and bare setImmediate
1879
+ // (void promises the shared timer heap settles), and scheduler.wait /
1880
+ // scheduler.yield, which Node defines as setTimeout(delay, undefined,
1881
+ // options) and setImmediate(). The arity completion (omitted delay =
1882
+ // Node's 1ms) and the value/options fences are special-cased in
1883
+ // lowerBuiltinModuleCall; these entries carry the canonical shapes and
1884
+ // route the dispatch.
1885
+ "timers/promises": {
1886
+ setTimeout: { fn: "tp.setTimeout", params: [F64], result: { kind: "promise", inner: VOID } },
1887
+ setImmediate: { fn: "tp.setImmediate", params: [], result: { kind: "promise", inner: VOID } },
1888
+ "scheduler.wait": {
1889
+ fn: "tp.setTimeout",
1890
+ params: [F64],
1891
+ result: { kind: "promise", inner: VOID },
1892
+ },
1893
+ "scheduler.yield": {
1894
+ fn: "tp.setImmediate",
1895
+ params: [],
1896
+ result: { kind: "promise", inner: VOID },
1897
+ },
1898
+ },
1899
+ // node:diagnostics_channel — the pub/sub core. channel() answers an f64
1900
+ // handle (type-mapper.ts maps Channel to F64); the subscriber arguments box
1901
+ // into the checked-dynamic tree (special-cased in lowerBuiltinModuleCall — the entries
1902
+ // carry canonical shapes and route the dispatch). The Channel method
1903
+ // surface lowers through lowerDiagnosticsChannelMethodCall/lowerDiagnosticsChannelProperty.
1904
+ diagnostics_channel: {
1905
+ channel: { fn: "dc.channel", params: [STRING], result: F64 },
1906
+ subscribe: { fn: "dc.subscribe", params: [STRING, DYN], result: VOID },
1907
+ unsubscribe: { fn: "dc.unsubscribe", params: [STRING, DYN], result: BOOL },
1908
+ hasSubscribers: { fn: "dc.hasSubscribers", params: [STRING], result: BOOL },
1909
+ // The string form's canonical shape; the collection form (an object
1910
+ // literal of five Channels) is special-cased in lowerBuiltinModuleCall.
1911
+ tracingChannel: { fn: "dc.tracingChannel", params: [STRING], result: F64 },
1853
1912
  },
1854
- },
1855
- // node:diagnostics_channel — the pub/sub core. channel() answers an f64
1856
- // handle (type-mapper.ts maps Channel to F64); the subscriber arguments box
1857
- // into the checked-dynamic tree (special-cased in lowerBuiltinModuleCall — the entries
1858
- // carry canonical shapes and route the dispatch). The Channel method
1859
- // surface lowers through lowerDiagnosticsChannelMethodCall/lowerDiagnosticsChannelProperty.
1860
- diagnostics_channel: {
1861
- channel: { fn: "dc.channel", params: [STRING], result: F64 },
1862
- subscribe: { fn: "dc.subscribe", params: [STRING, DYN], result: VOID },
1863
- unsubscribe: { fn: "dc.unsubscribe", params: [STRING, DYN], result: BOOL },
1864
- hasSubscribers: { fn: "dc.hasSubscribers", params: [STRING], result: BOOL },
1865
- // The string form's canonical shape; the collection form (an object
1866
- // literal of five Channels) is special-cased in lowerBuiltinModuleCall.
1867
- tracingChannel: { fn: "dc.tracingChannel", params: [STRING], result: F64 },
1868
- },
1869
- };
1913
+ };
1914
+ }
1870
1915
  /** Builtin-module CONSTANTS (value reads of named imports): each lowers to
1871
1916
  * a literal of its value's kind. The bare-module values are the TARGET
1872
1917
  * platform's (builtinModuleConstOf swaps the win32 values in under a win32
@@ -1896,7 +1941,7 @@ export const BUILTIN_MODULE_CONSTS = {
1896
1941
  * the sidecar's determinism attestation demotes on them by prefix, so the
1897
1942
  * member's fence detector must witness them too (fencing one spelling
1898
1943
  * fences the operation, the trimLeft/trimStart rule). Keyed like
1899
- * BUILTIN_MODULE_FNS; consumed by the fence taxonomy
1944
+ * builtinModuleFns(); consumed by the fence taxonomy
1900
1945
  * (library/fence-eval.ts) and the attestation-parity test. */
1901
1946
  export const BUILTIN_MODULE_FN_ALIASES = {
1902
1947
  url: {
@@ -1916,7 +1961,16 @@ export const BUILTIN_MODULE_FN_ALIASES = {
1916
1961
  "fs.readFdEncoded",
1917
1962
  "fs.readFdSync",
1918
1963
  "fs.readFdSyncBytes",
1964
+ // The runtime encoding's check before a URL path converts
1965
+ // (fs-paths.ts).
1966
+ "fs.checkReadEncoding",
1919
1967
  ],
1968
+ // The string source's check before a URL destination converts
1969
+ // (fs-paths.ts).
1970
+ copyFileSync: ["fs.checkPath"],
1971
+ renameSync: ["fs.checkPath"],
1972
+ copyFile: ["fs.checkPath"],
1973
+ rename: ["fs.checkPath"],
1920
1974
  readlinkSync: ["fs.readlinkSyncStr", "fs.readlinkSyncBuffer"],
1921
1975
  // The bytes-data form and the { mode } options form.
1922
1976
  writeFileSync: ["fs.writeFileSyncBytes", "fs.writeFileModeSync"],
@@ -1940,6 +1994,8 @@ export const BUILTIN_MODULE_FN_ALIASES = {
1940
1994
  ],
1941
1995
  // The utf8 string overload; the table row is the Buffer-window form.
1942
1996
  writeSync: ["fs.writeStrSync"],
1997
+ // The form whose arguments Node checks at run time.
1998
+ readSync: ["fs.readSyncDyn"],
1943
1999
  // The { recursive, mode } option lowerings.
1944
2000
  mkdirSync: ["fs.mkdirModeSync", "fs.mkdirRecursiveSync", "fs.mkdirRecursiveModeSync"],
1945
2001
  // The { recursive, force } and maxRetries/retryDelay option lowerings.
@@ -2014,621 +2070,641 @@ export const BUILTIN_MODULE_FN_ALIASES = {
2014
2070
  cpus: ["os.cpusModel", "os.cpusField"],
2015
2071
  },
2016
2072
  };
2017
- export const AMBIENT_SURFACE_FNS = [
2018
- {
2019
- id: "node-builtin.worker_threads.Worker",
2020
- kind: "node-builtin",
2021
- name: "worker_threads.Worker",
2022
- fns: ["worker.new"],
2023
- note: "native threads with statically compiled entry points, workerData, argv and message events",
2024
- },
2025
- {
2026
- id: "node-builtin.worker_threads.metadata",
2027
- kind: "node-builtin",
2028
- name: "worker_threads metadata",
2029
- fns: [
2030
- "worker.isMainThread",
2031
- "worker.threadId",
2032
- "worker.data",
2033
- "worker.parentPort",
2034
- "worker.resourceLimits",
2035
- "worker.threadName",
2036
- ],
2037
- note: "current-thread metadata and the worker's parent message port",
2038
- },
2039
- {
2040
- id: "stdlib.sharedArrayBuffer",
2041
- kind: "stdlib",
2042
- name: "SharedArrayBuffer",
2043
- fns: ["sharedArrayBuffer.new"],
2044
- note: "fixed shared storage with context-local typed-array and DataView wrappers",
2045
- },
2046
- {
2047
- id: "stdlib.blob",
2048
- kind: "stdlib",
2049
- name: "Blob",
2050
- fns: ["blob.new", "blob.slice", "blob.text", "blob.bytes", "blob.arrayBuffer", "blob.is"],
2051
- note: "immutable bytes with size, type, slice(), text(), bytes(), arrayBuffer() and structured cloning",
2052
- },
2053
- {
2054
- id: "stdlib.file",
2055
- kind: "stdlib",
2056
- name: "File",
2057
- fns: ["blob.fileNew"],
2058
- note: "a Blob with name and lastModified (Date.now() when absent)",
2059
- },
2060
- {
2061
- id: "stdlib.webcrypto.subtle",
2062
- kind: "stdlib",
2063
- name: "globalThis.crypto.subtle",
2064
- fns: [
2065
- "webcrypto.generateKey",
2066
- "webcrypto.importKey",
2067
- "webcrypto.exportKey",
2068
- "webcrypto.encrypt",
2069
- "webcrypto.decrypt",
2070
- "webcrypto.wrapKey",
2071
- "webcrypto.unwrapKey",
2072
- "webcrypto.deriveBits",
2073
- "webcrypto.deriveKey",
2074
- "webcrypto.sign",
2075
- "webcrypto.verify",
2076
- "webcrypto.digest",
2077
- ],
2078
- note: "importKey, generateKey and exportKey (raw and jwk) for HMAC and AES keys, importKey for PBKDF2 and HKDF keys, AES-GCM, AES-CBC and AES-CTR encrypt and decrypt, wrapKey and unwrapKey of secret keys with AES-KW or those ciphers, PBKDF2 and HKDF deriveBits and deriveKey, HMAC sign and verify, generateKey, importKey, exportKey, sign and verify for ECDSA, Ed25519, RSASSA-PKCS1-v1_5 and RSA-PSS, and SHA-1/SHA-2 digest; other methods, algorithms and key formats are refused",
2079
- },
2080
- {
2081
- id: "stdlib.webcrypto.CryptoKey",
2082
- kind: "stdlib",
2083
- name: "CryptoKey",
2084
- fns: ["webcrypto.isCryptoKey"],
2085
- note: "secret HMAC, AES, PBKDF2 and HKDF keys with type, extractable, algorithm and usages, and instanceof CryptoKey",
2086
- },
2087
- {
2088
- id: "stdlib.atomics",
2089
- kind: "stdlib",
2090
- name: "Atomics",
2091
- fns: ["atomics.op", "atomics.wait", "atomics.notify"],
2092
- note: "8-, 16- and 32-bit integer operations, plus Int32Array wait and notify",
2093
- },
2094
- {
2095
- id: "node-builtin.fs.callbacks",
2096
- kind: "node-builtin",
2097
- name: "fs error-first callbacks",
2098
- fns: ["fs.callbackValue", "fs.callbackCall", "fs.callbackGlob"],
2099
- note: "native filesystem callbacks, including stored platform adapter functions",
2100
- },
2101
- // ── the Date slice (lowerDateCall/lowerNew): statics, construction,
2102
- // stored read-only values, calendar getters, and ISO formatting.
2103
- {
2104
- id: "stdlib.date.now",
2105
- kind: "stdlib",
2106
- name: "Date.now",
2107
- fns: ["date.now"],
2108
- note: "the live clock",
2109
- },
2110
- {
2111
- id: "stdlib.date.parse",
2112
- kind: "stdlib",
2113
- name: "Date.parse",
2114
- fns: ["date.parse"],
2115
- note: "one date string, using V8's date parser shared with new Date(dateString)",
2116
- },
2117
- {
2118
- id: "stdlib.date.constructor",
2119
- kind: "stdlib",
2120
- name: "Date constructor",
2121
- fns: [
2122
- "date.newNow",
2123
- "date.newMs",
2124
- "date.newString",
2125
- "date.nativeNew",
2126
- "date.newLocal",
2127
- "date.nativeNewFields",
2128
- "date.nativeNewValue",
2129
- "date.argumentsTime",
2130
- "date.classOperation",
2131
- ],
2132
- note: "zero arguments, one milliseconds/date-string argument, or local-time year/month fields; values are the read-only TimeClip scalar slice",
2133
- },
2134
- {
2135
- id: "stdlib.date.UTC",
2136
- kind: "stdlib",
2137
- name: "Date.UTC",
2138
- fns: ["date.utc"],
2139
- note: "the lowered call form takes 1 to 7 number arguments",
2140
- },
2141
- {
2142
- id: "stdlib.date.getTime",
2143
- kind: "stdlib",
2144
- name: "Date.prototype.getTime",
2145
- fns: ["date.getTime", "date.parseGetTime"],
2146
- note: "the millisecond value of a stored Date",
2147
- },
2148
- {
2149
- id: "stdlib.date.valueOf",
2150
- kind: "stdlib",
2151
- name: "Date.prototype.valueOf",
2152
- fns: ["date.valueOf"],
2153
- note: "the same millisecond read as getTime()",
2154
- },
2155
- {
2156
- id: "stdlib.date.toISOString",
2157
- kind: "stdlib",
2158
- name: "Date.prototype.toISOString",
2159
- fns: ["date.toISOString", "date.toISOStringValue"],
2160
- note: "UTC ISO formatting over constructed and stored Date values",
2161
- },
2162
- {
2163
- id: "stdlib.date.toUTCString",
2164
- kind: "stdlib",
2165
- name: "Date.prototype.toUTCString",
2166
- fns: ["date.toUTCString"],
2167
- note: "RFC 7231 IMF-fixdate formatting over stored Date values",
2168
- },
2169
- {
2170
- id: "stdlib.date.getFullYear",
2171
- kind: "stdlib",
2172
- name: "Date.prototype.getFullYear",
2173
- fns: ["date.getFullYear"],
2174
- },
2175
- {
2176
- id: "stdlib.date.getUTCFullYear",
2177
- kind: "stdlib",
2178
- name: "Date.prototype.getUTCFullYear",
2179
- fns: ["date.getUTCFullYear"],
2180
- },
2181
- {
2182
- id: "stdlib.date.getMonth",
2183
- kind: "stdlib",
2184
- name: "Date.prototype.getMonth",
2185
- fns: ["date.getMonth"],
2186
- },
2187
- {
2188
- id: "stdlib.date.getUTCMonth",
2189
- kind: "stdlib",
2190
- name: "Date.prototype.getUTCMonth",
2191
- fns: ["date.getUTCMonth"],
2192
- },
2193
- {
2194
- id: "stdlib.date.getDate",
2195
- kind: "stdlib",
2196
- name: "Date.prototype.getDate",
2197
- fns: ["date.getDate"],
2198
- },
2199
- {
2200
- id: "stdlib.date.getUTCDate",
2201
- kind: "stdlib",
2202
- name: "Date.prototype.getUTCDate",
2203
- fns: ["date.getUTCDate"],
2204
- },
2205
- { id: "stdlib.date.getDay", kind: "stdlib", name: "Date.prototype.getDay", fns: ["date.getDay"] },
2206
- {
2207
- id: "stdlib.date.getUTCDay",
2208
- kind: "stdlib",
2209
- name: "Date.prototype.getUTCDay",
2210
- fns: ["date.getUTCDay"],
2211
- },
2212
- {
2213
- id: "stdlib.date.getHours",
2214
- kind: "stdlib",
2215
- name: "Date.prototype.getHours",
2216
- fns: ["date.getHours"],
2217
- },
2218
- {
2219
- id: "stdlib.date.getUTCHours",
2220
- kind: "stdlib",
2221
- name: "Date.prototype.getUTCHours",
2222
- fns: ["date.getUTCHours"],
2223
- },
2224
- {
2225
- id: "stdlib.date.getMinutes",
2226
- kind: "stdlib",
2227
- name: "Date.prototype.getMinutes",
2228
- fns: ["date.getMinutes"],
2229
- },
2230
- {
2231
- id: "stdlib.date.getUTCMinutes",
2232
- kind: "stdlib",
2233
- name: "Date.prototype.getUTCMinutes",
2234
- fns: ["date.getUTCMinutes"],
2235
- },
2236
- {
2237
- id: "stdlib.date.getSeconds",
2238
- kind: "stdlib",
2239
- name: "Date.prototype.getSeconds",
2240
- fns: ["date.getSeconds"],
2241
- },
2242
- {
2243
- id: "stdlib.date.getUTCSeconds",
2244
- kind: "stdlib",
2245
- name: "Date.prototype.getUTCSeconds",
2246
- fns: ["date.getUTCSeconds"],
2247
- },
2248
- {
2249
- id: "stdlib.date.getMilliseconds",
2250
- kind: "stdlib",
2251
- name: "Date.prototype.getMilliseconds",
2252
- fns: ["date.getMilliseconds"],
2253
- },
2254
- {
2255
- id: "stdlib.date.getUTCMilliseconds",
2256
- kind: "stdlib",
2257
- name: "Date.prototype.getUTCMilliseconds",
2258
- fns: ["date.getUTCMilliseconds"],
2259
- },
2260
- {
2261
- id: "stdlib.date.getTimezoneOffset",
2262
- kind: "stdlib",
2263
- name: "Date.prototype.getTimezoneOffset",
2264
- fns: ["date.getTimezoneOffset"],
2265
- },
2266
- {
2267
- id: "stdlib.date.toString",
2268
- kind: "stdlib",
2269
- name: "Date.prototype.toString",
2270
- fns: ["date.toString"],
2271
- note: "local time with the host zone's long English name; String(date) and template literals use it",
2272
- },
2273
- {
2274
- id: "stdlib.date.toDateString",
2275
- kind: "stdlib",
2276
- name: "Date.prototype.toDateString",
2277
- fns: ["date.toDateString"],
2278
- },
2279
- {
2280
- id: "stdlib.date.toTimeString",
2281
- kind: "stdlib",
2282
- name: "Date.prototype.toTimeString",
2283
- fns: ["date.toTimeString"],
2284
- },
2285
- // ── perf_hooks (lowerPerfHooksCall): the monotonic clock.
2286
- {
2287
- id: "node-builtin.perf_hooks.performance.now",
2288
- kind: "node-builtin",
2289
- name: "perf_hooks.performance.now",
2290
- fns: ["perf.now"],
2291
- note: "the global performance object and the performance.now.bind(performance) function value reach the same clock",
2292
- },
2293
- {
2294
- id: "node-builtin.perf_hooks.performance.mark",
2295
- kind: "node-builtin",
2296
- name: "perf_hooks.performance.mark",
2297
- fns: [
2298
- "perf.mark",
2299
- "perf.entryName",
2300
- "perf.entryType",
2301
- "perf.entryStart",
2302
- "perf.entryDuration",
2303
- "perf.entryDetail",
2304
- "perf.entryKeep",
2305
- "perf.entryRef",
2306
- ],
2307
- note: "records a mark in the thread's performance timeline at the live clock or the given startTime",
2308
- },
2309
- {
2310
- id: "node-builtin.perf_hooks.performance.measure",
2311
- kind: "node-builtin",
2312
- name: "perf_hooks.performance.measure",
2313
- fns: ["perf.measure"],
2314
- note: "the mark-name, timestamp, and options forms are one surface",
2315
- },
2316
- {
2317
- id: "node-builtin.perf_hooks.performance.getEntries",
2318
- kind: "node-builtin",
2319
- name: "perf_hooks.performance.getEntries",
2320
- fns: ["perf.entries"],
2321
- note: "getEntries, getEntriesByName, and getEntriesByType read the same timeline",
2322
- },
2323
- {
2324
- id: "node-builtin.perf_hooks.performance.clearMarks",
2325
- kind: "node-builtin",
2326
- name: "perf_hooks.performance.clearMarks",
2327
- fns: ["perf.clearMarks"],
2328
- },
2329
- {
2330
- id: "node-builtin.perf_hooks.performance.clearMeasures",
2331
- kind: "node-builtin",
2332
- name: "perf_hooks.performance.clearMeasures",
2333
- fns: ["perf.clearMeasures"],
2334
- },
2335
- {
2336
- id: "node-builtin.perf_hooks.performance.eventLoopUtilization",
2337
- kind: "node-builtin",
2338
- name: "perf_hooks.performance.eventLoopUtilization",
2339
- fns: ["perf.loopStart", "perf.idleTime"],
2340
- note: "active time is the main thread's CPU time since the loop started; the one- and two-argument difference forms are supported",
2341
- },
2342
- {
2343
- id: "node-builtin.perf_hooks.monitorEventLoopDelay",
2344
- kind: "node-builtin",
2345
- name: "perf_hooks.monitorEventLoopDelay",
2346
- fns: [
2347
- "perf.eldNew",
2348
- "perf.eldEnable",
2349
- "perf.eldDisable",
2350
- "perf.eldReset",
2351
- "perf.eldPercentile",
2352
- "perf.eldStat",
2353
- ],
2354
- note: "an unref'd sampling interval records the delay histogram; enable, disable, reset, percentile and the min, max, mean, stddev, count and exceeds readings are supported",
2355
- },
2356
- // ── the process global's ambient reads and authority calls
2357
- // (lowerProcessProperty/lowerProcessMethodCall — process is a
2358
- // provenance-checked global here, not an importable module).
2359
- {
2360
- id: "node-builtin.process.env",
2361
- kind: "node-builtin",
2362
- name: "process.env",
2363
- fns: ["process.envGet", "process.envSet", "process.envUnset", "process.envPairs"],
2364
- note: "reads, writes, deletes, and enumeration of the process environment (the process global)",
2365
- },
2366
- {
2367
- id: "node-builtin.process.argv",
2368
- kind: "node-builtin",
2369
- name: "process.argv",
2370
- fns: ["process.argv"],
2371
- },
2372
- {
2373
- id: "node-builtin.process.hrtime",
2374
- kind: "node-builtin",
2375
- name: "process.hrtime",
2376
- fns: ["process.hrtimeValue"],
2377
- note: "native monotonic tuple clock and bigint member; direct calls and stored JavaScript callable values",
2378
- },
2379
- {
2380
- id: "node-builtin.process.getBuiltinModule",
2381
- kind: "node-builtin",
2382
- name: "process.getBuiltinModule",
2383
- fns: ["process.builtinId", "process.builtinModule", "process.builtinUnsupported"],
2384
- note: "native path and os export subsets plus current-thread worker_threads metadata; other modules and exports throw SC2020",
2385
- },
2386
- {
2387
- id: "node-builtin.process.versions",
2388
- kind: "node-builtin",
2389
- name: "process.versions",
2390
- fns: ["process.versions"],
2391
- note: "shared version dictionary containing node and openssl; other components are absent unless defined by the program",
2392
- },
2393
- {
2394
- id: "node-builtin.process.release",
2395
- kind: "node-builtin",
2396
- name: "process.release",
2397
- fns: ["process.release"],
2398
- note: "the compatibility target's release metadata as one stable read-only object",
2399
- },
2400
- {
2401
- id: "node-builtin.process.cwd",
2402
- kind: "node-builtin",
2403
- name: "process.cwd",
2404
- fns: ["process.cwd"],
2405
- },
2406
- {
2407
- id: "node-builtin.process.chdir",
2408
- kind: "node-builtin",
2409
- name: "process.chdir",
2410
- fns: ["process.chdir"],
2411
- },
2412
- {
2413
- id: "node-builtin.process.pid",
2414
- kind: "node-builtin",
2415
- name: "process.pid",
2416
- fns: ["process.pid"],
2417
- },
2418
- {
2419
- id: "node-builtin.process.getuid",
2420
- kind: "node-builtin",
2421
- name: "process.getuid",
2422
- fns: ["process.getuid"],
2423
- },
2424
- {
2425
- id: "node-builtin.process.getgid",
2426
- kind: "node-builtin",
2427
- name: "process.getgid",
2428
- fns: ["process.getgid"],
2429
- },
2430
- {
2431
- id: "node-builtin.process.geteuid",
2432
- kind: "node-builtin",
2433
- name: "process.geteuid",
2434
- fns: ["process.geteuid"],
2435
- },
2436
- {
2437
- id: "node-builtin.process.getegid",
2438
- kind: "node-builtin",
2439
- name: "process.getegid",
2440
- fns: ["process.getegid"],
2441
- },
2442
- {
2443
- id: "node-builtin.process.getgroups",
2444
- kind: "node-builtin",
2445
- name: "process.getgroups",
2446
- fns: ["process.getgroups"],
2447
- },
2448
- {
2449
- id: "node-builtin.process.ppid",
2450
- kind: "node-builtin",
2451
- name: "process.ppid",
2452
- fns: ["process.ppid"],
2453
- },
2454
- {
2455
- id: "node-builtin.process.title",
2456
- kind: "node-builtin",
2457
- name: "process.title",
2458
- fns: ["process.title", "process.setTitle"],
2459
- note: "reads and writes of the process title are one surface",
2460
- },
2461
- {
2462
- id: "node-builtin.process.argv0",
2463
- kind: "node-builtin",
2464
- name: "process.argv0",
2465
- fns: ["process.argv0"],
2466
- },
2467
- {
2468
- id: "node-builtin.process.execArgv",
2469
- kind: "node-builtin",
2470
- name: "process.execArgv",
2471
- fns: ["process.execArgv"],
2472
- },
2473
- {
2474
- id: "node-builtin.process.execPath",
2475
- kind: "node-builtin",
2476
- name: "process.execPath",
2477
- fns: ["process.execPath"],
2478
- },
2479
- {
2480
- id: "node-builtin.process.uptime",
2481
- kind: "node-builtin",
2482
- name: "process.uptime",
2483
- fns: ["process.uptime"],
2484
- },
2485
- {
2486
- id: "node-builtin.process.availableMemory",
2487
- kind: "node-builtin",
2488
- name: "process.availableMemory",
2489
- fns: ["process.availableMemory"],
2490
- },
2491
- {
2492
- id: "node-builtin.process.constrainedMemory",
2493
- kind: "node-builtin",
2494
- name: "process.constrainedMemory",
2495
- fns: ["process.constrainedMemory"],
2496
- },
2497
- {
2498
- id: "node-builtin.process.memoryUsage",
2499
- kind: "node-builtin",
2500
- name: "process.memoryUsage",
2501
- fns: ["process.memoryUsageTake", "process.memoryUsageField", "process.rss"],
2502
- note: "the record and memoryUsage.rss() read live memory state; external and arrayBuffers are 0",
2503
- },
2504
- {
2505
- id: "node-builtin.process.resourceUsage",
2506
- kind: "node-builtin",
2507
- name: "process.resourceUsage",
2508
- fns: ["process.rusage"],
2509
- note: "getrusage's 16 fields — every field read samples live machine state",
2510
- },
2511
- {
2512
- id: "node-builtin.process.cpuUsage",
2513
- kind: "node-builtin",
2514
- name: "process.cpuUsage",
2515
- fns: [
2516
- "process.cpuUser",
2517
- "process.cpuSystem",
2518
- "process.cpuUserDiff",
2519
- "process.cpuSystemDiff",
2520
- "process.cpuPrevValidate",
2521
- ],
2522
- note: "the plain-sample and previous-value diff forms are one surface",
2523
- },
2524
- {
2525
- id: "node-builtin.process.threadCpuUsage",
2526
- kind: "node-builtin",
2527
- name: "process.threadCpuUsage",
2528
- fns: [
2529
- "process.threadCpuUser",
2530
- "process.threadCpuSystem",
2531
- "process.threadCpuUserDiff",
2532
- "process.threadCpuSystemDiff",
2533
- ],
2534
- note: "the plain-sample and previous-value diff forms are one surface",
2535
- },
2536
- {
2537
- id: "node-builtin.process.isTTY",
2538
- kind: "node-builtin",
2539
- name: "process.isTTY",
2540
- fns: ["process.isTTY"],
2541
- note: "the isTTY read on process.stdin/stdout/stderr — one surface across the three streams",
2542
- },
2543
- {
2544
- id: "node-builtin.process.columns",
2545
- kind: "node-builtin",
2546
- name: "process.columns",
2547
- fns: ["process.columns"],
2548
- note: "the columns read on the process stdio streams (terminal geometry)",
2549
- },
2550
- {
2551
- id: "node-builtin.process.rows",
2552
- kind: "node-builtin",
2553
- name: "process.rows",
2554
- fns: ["process.rows"],
2555
- note: "the rows read on process.stdout/stderr (terminal geometry)",
2556
- },
2557
- {
2558
- id: "node-builtin.process.kill",
2559
- kind: "node-builtin",
2560
- name: "process.kill",
2561
- fns: ["process.kill", "process.killNum"],
2562
- note: "the signal-name and signal-number forms are one surface",
2563
- },
2564
- {
2565
- id: "node-builtin.process.umask",
2566
- kind: "node-builtin",
2567
- name: "process.umask",
2568
- fns: ["process.umask"],
2569
- },
2570
- {
2571
- id: "node-builtin.process.exit",
2572
- kind: "node-builtin",
2573
- name: "process.exit",
2574
- fns: ["process.exit", "process.exiting"],
2575
- note: "process.exit and the process._exiting flag read are one surface",
2576
- },
2577
- {
2578
- id: "node-builtin.process.exitCode",
2579
- kind: "node-builtin",
2580
- name: "process.exitCode",
2581
- fns: ["process.setExitCode", "process.setExitCodeTracked", "process.hasExitCode"],
2582
- note: "numeric writes in statement position set the implicit exit status; reads answer the assigned code or undefined; process.exit() reads it",
2583
- },
2584
- // ── the tls CA store (lowerTlsCaCall / lowerTlsRootCertificates): the
2585
- // host's trust anchors, read and replaced. Dedicated paths, and
2586
- // rootCertificates is a VALUE read with no call form at all, so none of
2587
- // the three can hang off a lowering-table row. Split three ways rather
2588
- // than folded into one "CA store" surface: a library author who denies
2589
- // REPLACING the trust anchors is making a different decision from one
2590
- // who denies reading them, and each Node spelling is the name they will
2591
- // reach for when writing the fence.
2592
- {
2593
- id: "node-builtin.tls.getCACertificates",
2594
- kind: "node-builtin",
2595
- name: "tls.getCACertificates",
2596
- fns: ["tlsca.get"],
2597
- note: "the per-type cached PEM bundle: 'default' and 'extra' additionally read NODE_EXTRA_CA_CERTS, 'system' the platform store",
2598
- },
2599
- {
2600
- id: "node-builtin.tls.rootCertificates",
2601
- kind: "node-builtin",
2602
- name: "tls.rootCertificates",
2603
- fns: ["tlsca.root"],
2604
- note: "the value read; answers the same bundled array as getCACertificates('bundled'), but fenced under its own id — the spelling an author writes",
2605
- },
2606
- {
2607
- id: "node-builtin.tls.setDefaultCACertificates",
2608
- kind: "node-builtin",
2609
- name: "tls.setDefaultCACertificates",
2610
- fns: ["tlsca.set"],
2611
- note: "replaces the default set and the client trust anchors for the rest of the process",
2612
- },
2613
- // os.constants is a VALUE read (lowerNamespaceBuiltinProperty and the
2614
- // named-import path): the platform's null-prototype constants object.
2615
- {
2616
- id: "node-builtin.os.constants",
2617
- kind: "node-builtin",
2618
- name: "os.constants",
2619
- fns: ["os.constants"],
2620
- note: "the platform's dlopen, errno, signals and priority groups; members a platform lacks read as undefined",
2621
- },
2622
- // fs.constants as a value, and its members beyond the baked access-mode
2623
- // bits: the target libc's null-prototype constants object.
2624
- {
2625
- id: "node-builtin.fs.constants",
2626
- kind: "node-builtin",
2627
- name: "fs.constants",
2628
- fns: ["fs.constants"],
2629
- note: "node_constants.cc's fs group under the target libc's macros; members a platform lacks read as undefined",
2630
- },
2631
- ];
2073
+ let ambientSurfaceRows;
2074
+ /** The ambient surface rows, built on the first call. */
2075
+ export function ambientSurfaceFns() {
2076
+ ambientSurfaceRows ??= buildAmbientSurfaceFns();
2077
+ return ambientSurfaceRows;
2078
+ }
2079
+ function buildAmbientSurfaceFns() {
2080
+ return [
2081
+ {
2082
+ id: "node-builtin.worker_threads.Worker",
2083
+ kind: "node-builtin",
2084
+ name: "worker_threads.Worker",
2085
+ fns: ["worker.new"],
2086
+ note: "native threads with statically compiled entry points, workerData, argv and message events",
2087
+ },
2088
+ {
2089
+ id: "node-builtin.worker_threads.metadata",
2090
+ kind: "node-builtin",
2091
+ name: "worker_threads metadata",
2092
+ fns: [
2093
+ "worker.isMainThread",
2094
+ "worker.threadId",
2095
+ "worker.data",
2096
+ "worker.parentPort",
2097
+ "worker.resourceLimits",
2098
+ "worker.threadName",
2099
+ ],
2100
+ note: "current-thread metadata and the worker's parent message port",
2101
+ },
2102
+ {
2103
+ id: "stdlib.sharedArrayBuffer",
2104
+ kind: "stdlib",
2105
+ name: "SharedArrayBuffer",
2106
+ fns: ["sharedArrayBuffer.new"],
2107
+ note: "fixed shared storage with context-local typed-array and DataView wrappers",
2108
+ },
2109
+ {
2110
+ id: "stdlib.blob",
2111
+ kind: "stdlib",
2112
+ name: "Blob",
2113
+ fns: ["blob.new", "blob.slice", "blob.text", "blob.bytes", "blob.arrayBuffer", "blob.is"],
2114
+ note: "immutable bytes with size, type, slice(), text(), bytes(), arrayBuffer() and structured cloning",
2115
+ },
2116
+ {
2117
+ id: "stdlib.file",
2118
+ kind: "stdlib",
2119
+ name: "File",
2120
+ fns: ["blob.fileNew"],
2121
+ note: "a Blob with name and lastModified (Date.now() when absent)",
2122
+ },
2123
+ {
2124
+ id: "stdlib.webcrypto.subtle",
2125
+ kind: "stdlib",
2126
+ name: "globalThis.crypto.subtle",
2127
+ fns: [
2128
+ "webcrypto.generateKey",
2129
+ "webcrypto.importKey",
2130
+ "webcrypto.exportKey",
2131
+ "webcrypto.encrypt",
2132
+ "webcrypto.decrypt",
2133
+ "webcrypto.wrapKey",
2134
+ "webcrypto.unwrapKey",
2135
+ "webcrypto.deriveBits",
2136
+ "webcrypto.deriveKey",
2137
+ "webcrypto.sign",
2138
+ "webcrypto.verify",
2139
+ "webcrypto.digest",
2140
+ ],
2141
+ note: "importKey, generateKey and exportKey (raw and jwk) for HMAC and AES keys, importKey for PBKDF2 and HKDF keys, AES-GCM, AES-CBC and AES-CTR encrypt and decrypt, wrapKey and unwrapKey of secret keys with AES-KW or those ciphers, PBKDF2 and HKDF deriveBits and deriveKey, HMAC sign and verify, generateKey, importKey, exportKey, sign and verify for ECDSA, Ed25519, RSASSA-PKCS1-v1_5 and RSA-PSS, and SHA-1/SHA-2 digest; other methods, algorithms and key formats are refused",
2142
+ },
2143
+ {
2144
+ id: "stdlib.webcrypto.CryptoKey",
2145
+ kind: "stdlib",
2146
+ name: "CryptoKey",
2147
+ fns: ["webcrypto.isCryptoKey"],
2148
+ note: "secret HMAC, AES, PBKDF2 and HKDF keys with type, extractable, algorithm and usages, and instanceof CryptoKey",
2149
+ },
2150
+ {
2151
+ id: "stdlib.atomics",
2152
+ kind: "stdlib",
2153
+ name: "Atomics",
2154
+ fns: ["atomics.op", "atomics.wait", "atomics.notify"],
2155
+ note: "8-, 16- and 32-bit integer operations, plus Int32Array wait and notify",
2156
+ },
2157
+ {
2158
+ id: "node-builtin.fs.callbacks",
2159
+ kind: "node-builtin",
2160
+ name: "fs error-first callbacks",
2161
+ fns: ["fs.callbackValue", "fs.callbackCall", "fs.callbackGlob"],
2162
+ note: "native filesystem callbacks, including stored platform adapter functions",
2163
+ },
2164
+ // ── the Date slice (lowerDateCall/lowerNew): statics, construction,
2165
+ // stored read-only values, calendar getters, and ISO formatting.
2166
+ {
2167
+ id: "stdlib.date.now",
2168
+ kind: "stdlib",
2169
+ name: "Date.now",
2170
+ fns: ["date.now"],
2171
+ note: "the live clock",
2172
+ },
2173
+ {
2174
+ id: "stdlib.date.parse",
2175
+ kind: "stdlib",
2176
+ name: "Date.parse",
2177
+ fns: ["date.parse"],
2178
+ note: "one date string, using V8's date parser shared with new Date(dateString)",
2179
+ },
2180
+ {
2181
+ id: "stdlib.date.constructor",
2182
+ kind: "stdlib",
2183
+ name: "Date constructor",
2184
+ fns: [
2185
+ "date.newNow",
2186
+ "date.newMs",
2187
+ "date.newString",
2188
+ "date.nativeNew",
2189
+ "date.newLocal",
2190
+ "date.nativeNewFields",
2191
+ "date.nativeNewValue",
2192
+ "date.argumentsTime",
2193
+ "date.classOperation",
2194
+ ],
2195
+ note: "zero arguments, one milliseconds/date-string argument, or local-time year/month fields; values are the read-only TimeClip scalar slice",
2196
+ },
2197
+ {
2198
+ id: "stdlib.date.setters",
2199
+ kind: "stdlib",
2200
+ name: "Date.prototype setters",
2201
+ fns: ["date.setFields", "date.timeClip", "date.store"],
2202
+ note: "setTime and the local and UTC field setters, with their optional arguments",
2203
+ },
2204
+ {
2205
+ id: "stdlib.date.UTC",
2206
+ kind: "stdlib",
2207
+ name: "Date.UTC",
2208
+ fns: ["date.utc"],
2209
+ note: "the lowered call form takes 1 to 7 number arguments",
2210
+ },
2211
+ {
2212
+ id: "stdlib.date.getTime",
2213
+ kind: "stdlib",
2214
+ name: "Date.prototype.getTime",
2215
+ fns: ["date.getTime", "date.parseGetTime"],
2216
+ note: "the millisecond value of a stored Date",
2217
+ },
2218
+ {
2219
+ id: "stdlib.date.valueOf",
2220
+ kind: "stdlib",
2221
+ name: "Date.prototype.valueOf",
2222
+ fns: ["date.valueOf"],
2223
+ note: "the same millisecond read as getTime()",
2224
+ },
2225
+ {
2226
+ id: "stdlib.date.toISOString",
2227
+ kind: "stdlib",
2228
+ name: "Date.prototype.toISOString",
2229
+ fns: ["date.toISOString", "date.toISOStringValue"],
2230
+ note: "UTC ISO formatting over constructed and stored Date values",
2231
+ },
2232
+ {
2233
+ id: "stdlib.date.toUTCString",
2234
+ kind: "stdlib",
2235
+ name: "Date.prototype.toUTCString",
2236
+ fns: ["date.toUTCString"],
2237
+ note: "RFC 7231 IMF-fixdate formatting over stored Date values",
2238
+ },
2239
+ {
2240
+ id: "stdlib.date.getFullYear",
2241
+ kind: "stdlib",
2242
+ name: "Date.prototype.getFullYear",
2243
+ fns: ["date.getFullYear"],
2244
+ },
2245
+ {
2246
+ id: "stdlib.date.getUTCFullYear",
2247
+ kind: "stdlib",
2248
+ name: "Date.prototype.getUTCFullYear",
2249
+ fns: ["date.getUTCFullYear"],
2250
+ },
2251
+ {
2252
+ id: "stdlib.date.getMonth",
2253
+ kind: "stdlib",
2254
+ name: "Date.prototype.getMonth",
2255
+ fns: ["date.getMonth"],
2256
+ },
2257
+ {
2258
+ id: "stdlib.date.getUTCMonth",
2259
+ kind: "stdlib",
2260
+ name: "Date.prototype.getUTCMonth",
2261
+ fns: ["date.getUTCMonth"],
2262
+ },
2263
+ {
2264
+ id: "stdlib.date.getDate",
2265
+ kind: "stdlib",
2266
+ name: "Date.prototype.getDate",
2267
+ fns: ["date.getDate"],
2268
+ },
2269
+ {
2270
+ id: "stdlib.date.getUTCDate",
2271
+ kind: "stdlib",
2272
+ name: "Date.prototype.getUTCDate",
2273
+ fns: ["date.getUTCDate"],
2274
+ },
2275
+ {
2276
+ id: "stdlib.date.getDay",
2277
+ kind: "stdlib",
2278
+ name: "Date.prototype.getDay",
2279
+ fns: ["date.getDay"],
2280
+ },
2281
+ {
2282
+ id: "stdlib.date.getUTCDay",
2283
+ kind: "stdlib",
2284
+ name: "Date.prototype.getUTCDay",
2285
+ fns: ["date.getUTCDay"],
2286
+ },
2287
+ {
2288
+ id: "stdlib.date.getHours",
2289
+ kind: "stdlib",
2290
+ name: "Date.prototype.getHours",
2291
+ fns: ["date.getHours"],
2292
+ },
2293
+ {
2294
+ id: "stdlib.date.getUTCHours",
2295
+ kind: "stdlib",
2296
+ name: "Date.prototype.getUTCHours",
2297
+ fns: ["date.getUTCHours"],
2298
+ },
2299
+ {
2300
+ id: "stdlib.date.getMinutes",
2301
+ kind: "stdlib",
2302
+ name: "Date.prototype.getMinutes",
2303
+ fns: ["date.getMinutes"],
2304
+ },
2305
+ {
2306
+ id: "stdlib.date.getUTCMinutes",
2307
+ kind: "stdlib",
2308
+ name: "Date.prototype.getUTCMinutes",
2309
+ fns: ["date.getUTCMinutes"],
2310
+ },
2311
+ {
2312
+ id: "stdlib.date.getSeconds",
2313
+ kind: "stdlib",
2314
+ name: "Date.prototype.getSeconds",
2315
+ fns: ["date.getSeconds"],
2316
+ },
2317
+ {
2318
+ id: "stdlib.date.getUTCSeconds",
2319
+ kind: "stdlib",
2320
+ name: "Date.prototype.getUTCSeconds",
2321
+ fns: ["date.getUTCSeconds"],
2322
+ },
2323
+ {
2324
+ id: "stdlib.date.getMilliseconds",
2325
+ kind: "stdlib",
2326
+ name: "Date.prototype.getMilliseconds",
2327
+ fns: ["date.getMilliseconds"],
2328
+ },
2329
+ {
2330
+ id: "stdlib.date.getUTCMilliseconds",
2331
+ kind: "stdlib",
2332
+ name: "Date.prototype.getUTCMilliseconds",
2333
+ fns: ["date.getUTCMilliseconds"],
2334
+ },
2335
+ {
2336
+ id: "stdlib.date.getTimezoneOffset",
2337
+ kind: "stdlib",
2338
+ name: "Date.prototype.getTimezoneOffset",
2339
+ fns: ["date.getTimezoneOffset"],
2340
+ },
2341
+ {
2342
+ id: "stdlib.date.toString",
2343
+ kind: "stdlib",
2344
+ name: "Date.prototype.toString",
2345
+ fns: ["date.toString"],
2346
+ note: "local time with the host zone's long English name; String(date) and template literals use it",
2347
+ },
2348
+ {
2349
+ id: "stdlib.date.toDateString",
2350
+ kind: "stdlib",
2351
+ name: "Date.prototype.toDateString",
2352
+ fns: ["date.toDateString"],
2353
+ },
2354
+ {
2355
+ id: "stdlib.date.toTimeString",
2356
+ kind: "stdlib",
2357
+ name: "Date.prototype.toTimeString",
2358
+ fns: ["date.toTimeString"],
2359
+ },
2360
+ // ── perf_hooks (lowerPerfHooksCall): the monotonic clock.
2361
+ {
2362
+ id: "node-builtin.perf_hooks.performance.now",
2363
+ kind: "node-builtin",
2364
+ name: "perf_hooks.performance.now",
2365
+ fns: ["perf.now"],
2366
+ note: "the global performance object and the performance.now.bind(performance) function value reach the same clock",
2367
+ },
2368
+ {
2369
+ id: "node-builtin.perf_hooks.performance.mark",
2370
+ kind: "node-builtin",
2371
+ name: "perf_hooks.performance.mark",
2372
+ fns: [
2373
+ "perf.mark",
2374
+ "perf.entryName",
2375
+ "perf.entryType",
2376
+ "perf.entryStart",
2377
+ "perf.entryDuration",
2378
+ "perf.entryDetail",
2379
+ "perf.entryKeep",
2380
+ "perf.entryRef",
2381
+ ],
2382
+ note: "records a mark in the thread's performance timeline at the live clock or the given startTime",
2383
+ },
2384
+ {
2385
+ id: "node-builtin.perf_hooks.performance.measure",
2386
+ kind: "node-builtin",
2387
+ name: "perf_hooks.performance.measure",
2388
+ fns: ["perf.measure"],
2389
+ note: "the mark-name, timestamp, and options forms are one surface",
2390
+ },
2391
+ {
2392
+ id: "node-builtin.perf_hooks.performance.getEntries",
2393
+ kind: "node-builtin",
2394
+ name: "perf_hooks.performance.getEntries",
2395
+ fns: ["perf.entries"],
2396
+ note: "getEntries, getEntriesByName, and getEntriesByType read the same timeline",
2397
+ },
2398
+ {
2399
+ id: "node-builtin.perf_hooks.performance.clearMarks",
2400
+ kind: "node-builtin",
2401
+ name: "perf_hooks.performance.clearMarks",
2402
+ fns: ["perf.clearMarks"],
2403
+ },
2404
+ {
2405
+ id: "node-builtin.perf_hooks.performance.clearMeasures",
2406
+ kind: "node-builtin",
2407
+ name: "perf_hooks.performance.clearMeasures",
2408
+ fns: ["perf.clearMeasures"],
2409
+ },
2410
+ {
2411
+ id: "node-builtin.perf_hooks.performance.eventLoopUtilization",
2412
+ kind: "node-builtin",
2413
+ name: "perf_hooks.performance.eventLoopUtilization",
2414
+ fns: ["perf.loopStart", "perf.idleTime"],
2415
+ note: "active time is the main thread's CPU time since the loop started; the one- and two-argument difference forms are supported",
2416
+ },
2417
+ {
2418
+ id: "node-builtin.perf_hooks.monitorEventLoopDelay",
2419
+ kind: "node-builtin",
2420
+ name: "perf_hooks.monitorEventLoopDelay",
2421
+ fns: [
2422
+ "perf.eldNew",
2423
+ "perf.eldEnable",
2424
+ "perf.eldDisable",
2425
+ "perf.eldReset",
2426
+ "perf.eldPercentile",
2427
+ "perf.eldStat",
2428
+ ],
2429
+ note: "an unref'd sampling interval records the delay histogram; enable, disable, reset, percentile and the min, max, mean, stddev, count and exceeds readings are supported",
2430
+ },
2431
+ // ── the process global's ambient reads and authority calls
2432
+ // (lowerProcessProperty/lowerProcessMethodCall — process is a
2433
+ // provenance-checked global here, not an importable module).
2434
+ {
2435
+ id: "node-builtin.process.env",
2436
+ kind: "node-builtin",
2437
+ name: "process.env",
2438
+ fns: ["process.envGet", "process.envSet", "process.envUnset", "process.envPairs"],
2439
+ note: "reads, writes, deletes, and enumeration of the process environment (the process global)",
2440
+ },
2441
+ {
2442
+ id: "node-builtin.process.argv",
2443
+ kind: "node-builtin",
2444
+ name: "process.argv",
2445
+ fns: ["process.argv"],
2446
+ },
2447
+ {
2448
+ id: "node-builtin.process.hrtime",
2449
+ kind: "node-builtin",
2450
+ name: "process.hrtime",
2451
+ fns: ["process.hrtimeValue"],
2452
+ note: "native monotonic tuple clock and bigint member; direct calls and stored JavaScript callable values",
2453
+ },
2454
+ {
2455
+ id: "node-builtin.process.getBuiltinModule",
2456
+ kind: "node-builtin",
2457
+ name: "process.getBuiltinModule",
2458
+ fns: ["process.builtinId", "process.builtinModule", "process.builtinUnsupported"],
2459
+ note: "native path and os export subsets plus current-thread worker_threads metadata; other modules and exports throw SC2020",
2460
+ },
2461
+ {
2462
+ id: "node-builtin.process.versions",
2463
+ kind: "node-builtin",
2464
+ name: "process.versions",
2465
+ fns: ["process.versions"],
2466
+ note: "shared version dictionary containing node and openssl; other components are absent unless defined by the program",
2467
+ },
2468
+ {
2469
+ id: "node-builtin.process.release",
2470
+ kind: "node-builtin",
2471
+ name: "process.release",
2472
+ fns: ["process.release"],
2473
+ note: "the compatibility target's release metadata as one stable read-only object",
2474
+ },
2475
+ {
2476
+ id: "node-builtin.process.cwd",
2477
+ kind: "node-builtin",
2478
+ name: "process.cwd",
2479
+ fns: ["process.cwd"],
2480
+ },
2481
+ {
2482
+ id: "node-builtin.process.chdir",
2483
+ kind: "node-builtin",
2484
+ name: "process.chdir",
2485
+ fns: ["process.chdir"],
2486
+ },
2487
+ {
2488
+ id: "node-builtin.process.pid",
2489
+ kind: "node-builtin",
2490
+ name: "process.pid",
2491
+ fns: ["process.pid"],
2492
+ },
2493
+ {
2494
+ id: "node-builtin.process.getuid",
2495
+ kind: "node-builtin",
2496
+ name: "process.getuid",
2497
+ fns: ["process.getuid"],
2498
+ },
2499
+ {
2500
+ id: "node-builtin.process.getgid",
2501
+ kind: "node-builtin",
2502
+ name: "process.getgid",
2503
+ fns: ["process.getgid"],
2504
+ },
2505
+ {
2506
+ id: "node-builtin.process.geteuid",
2507
+ kind: "node-builtin",
2508
+ name: "process.geteuid",
2509
+ fns: ["process.geteuid"],
2510
+ },
2511
+ {
2512
+ id: "node-builtin.process.getegid",
2513
+ kind: "node-builtin",
2514
+ name: "process.getegid",
2515
+ fns: ["process.getegid"],
2516
+ },
2517
+ {
2518
+ id: "node-builtin.process.getgroups",
2519
+ kind: "node-builtin",
2520
+ name: "process.getgroups",
2521
+ fns: ["process.getgroups"],
2522
+ },
2523
+ {
2524
+ id: "node-builtin.process.ppid",
2525
+ kind: "node-builtin",
2526
+ name: "process.ppid",
2527
+ fns: ["process.ppid"],
2528
+ },
2529
+ {
2530
+ id: "node-builtin.process.title",
2531
+ kind: "node-builtin",
2532
+ name: "process.title",
2533
+ fns: ["process.title", "process.setTitle"],
2534
+ note: "reads and writes of the process title are one surface",
2535
+ },
2536
+ {
2537
+ id: "node-builtin.process.argv0",
2538
+ kind: "node-builtin",
2539
+ name: "process.argv0",
2540
+ fns: ["process.argv0"],
2541
+ },
2542
+ {
2543
+ id: "node-builtin.process.execArgv",
2544
+ kind: "node-builtin",
2545
+ name: "process.execArgv",
2546
+ fns: ["process.execArgv"],
2547
+ },
2548
+ {
2549
+ id: "node-builtin.process.execPath",
2550
+ kind: "node-builtin",
2551
+ name: "process.execPath",
2552
+ fns: ["process.execPath"],
2553
+ },
2554
+ {
2555
+ id: "node-builtin.process.uptime",
2556
+ kind: "node-builtin",
2557
+ name: "process.uptime",
2558
+ fns: ["process.uptime"],
2559
+ },
2560
+ {
2561
+ id: "node-builtin.process.availableMemory",
2562
+ kind: "node-builtin",
2563
+ name: "process.availableMemory",
2564
+ fns: ["process.availableMemory"],
2565
+ },
2566
+ {
2567
+ id: "node-builtin.process.constrainedMemory",
2568
+ kind: "node-builtin",
2569
+ name: "process.constrainedMemory",
2570
+ fns: ["process.constrainedMemory"],
2571
+ },
2572
+ {
2573
+ id: "node-builtin.process.memoryUsage",
2574
+ kind: "node-builtin",
2575
+ name: "process.memoryUsage",
2576
+ fns: ["process.memoryUsageTake", "process.memoryUsageField", "process.rss"],
2577
+ note: "the record and memoryUsage.rss() read live memory state; external and arrayBuffers are 0",
2578
+ },
2579
+ {
2580
+ id: "node-builtin.process.resourceUsage",
2581
+ kind: "node-builtin",
2582
+ name: "process.resourceUsage",
2583
+ fns: ["process.rusage"],
2584
+ note: "getrusage's 16 fields — every field read samples live machine state",
2585
+ },
2586
+ {
2587
+ id: "node-builtin.process.cpuUsage",
2588
+ kind: "node-builtin",
2589
+ name: "process.cpuUsage",
2590
+ fns: [
2591
+ "process.cpuUser",
2592
+ "process.cpuSystem",
2593
+ "process.cpuUserDiff",
2594
+ "process.cpuSystemDiff",
2595
+ "process.cpuPrevValidate",
2596
+ ],
2597
+ note: "the plain-sample and previous-value diff forms are one surface",
2598
+ },
2599
+ {
2600
+ id: "node-builtin.process.threadCpuUsage",
2601
+ kind: "node-builtin",
2602
+ name: "process.threadCpuUsage",
2603
+ fns: [
2604
+ "process.threadCpuUser",
2605
+ "process.threadCpuSystem",
2606
+ "process.threadCpuUserDiff",
2607
+ "process.threadCpuSystemDiff",
2608
+ ],
2609
+ note: "the plain-sample and previous-value diff forms are one surface",
2610
+ },
2611
+ {
2612
+ id: "node-builtin.process.isTTY",
2613
+ kind: "node-builtin",
2614
+ name: "process.isTTY",
2615
+ fns: ["process.isTTY"],
2616
+ note: "the isTTY read on process.stdin/stdout/stderr — one surface across the three streams",
2617
+ },
2618
+ {
2619
+ id: "node-builtin.process.columns",
2620
+ kind: "node-builtin",
2621
+ name: "process.columns",
2622
+ fns: ["process.columns"],
2623
+ note: "the columns read on the process stdio streams (terminal geometry)",
2624
+ },
2625
+ {
2626
+ id: "node-builtin.process.rows",
2627
+ kind: "node-builtin",
2628
+ name: "process.rows",
2629
+ fns: ["process.rows"],
2630
+ note: "the rows read on process.stdout/stderr (terminal geometry)",
2631
+ },
2632
+ {
2633
+ id: "node-builtin.process.kill",
2634
+ kind: "node-builtin",
2635
+ name: "process.kill",
2636
+ fns: ["process.kill", "process.killNum"],
2637
+ note: "the signal-name and signal-number forms are one surface",
2638
+ },
2639
+ {
2640
+ id: "node-builtin.process.umask",
2641
+ kind: "node-builtin",
2642
+ name: "process.umask",
2643
+ fns: ["process.umask"],
2644
+ },
2645
+ {
2646
+ id: "node-builtin.process.exit",
2647
+ kind: "node-builtin",
2648
+ name: "process.exit",
2649
+ fns: ["process.exit", "process.exiting"],
2650
+ note: "process.exit and the process._exiting flag read are one surface",
2651
+ },
2652
+ {
2653
+ id: "node-builtin.process.exitCode",
2654
+ kind: "node-builtin",
2655
+ name: "process.exitCode",
2656
+ fns: ["process.setExitCode", "process.setExitCodeTracked", "process.hasExitCode"],
2657
+ note: "numeric writes in statement position set the implicit exit status; reads answer the assigned code or undefined; process.exit() reads it",
2658
+ },
2659
+ // ── the tls CA store (lowerTlsCaCall / lowerTlsRootCertificates): the
2660
+ // host's trust anchors, read and replaced. Dedicated paths, and
2661
+ // rootCertificates is a VALUE read with no call form at all, so none of
2662
+ // the three can hang off a lowering-table row. Split three ways rather
2663
+ // than folded into one "CA store" surface: a library author who denies
2664
+ // REPLACING the trust anchors is making a different decision from one
2665
+ // who denies reading them, and each Node spelling is the name they will
2666
+ // reach for when writing the fence.
2667
+ {
2668
+ id: "node-builtin.tls.getCACertificates",
2669
+ kind: "node-builtin",
2670
+ name: "tls.getCACertificates",
2671
+ fns: ["tlsca.get"],
2672
+ note: "the per-type cached PEM bundle: 'default' and 'extra' additionally read NODE_EXTRA_CA_CERTS, 'system' the platform store",
2673
+ },
2674
+ {
2675
+ id: "node-builtin.tls.rootCertificates",
2676
+ kind: "node-builtin",
2677
+ name: "tls.rootCertificates",
2678
+ fns: ["tlsca.root"],
2679
+ note: "the value read; answers the same bundled array as getCACertificates('bundled'), but fenced under its own id — the spelling an author writes",
2680
+ },
2681
+ {
2682
+ id: "node-builtin.tls.setDefaultCACertificates",
2683
+ kind: "node-builtin",
2684
+ name: "tls.setDefaultCACertificates",
2685
+ fns: ["tlsca.set"],
2686
+ note: "replaces the default set and the client trust anchors for the rest of the process",
2687
+ },
2688
+ // os.constants is a VALUE read (lowerNamespaceBuiltinProperty and the
2689
+ // named-import path): the platform's null-prototype constants object.
2690
+ {
2691
+ id: "node-builtin.os.constants",
2692
+ kind: "node-builtin",
2693
+ name: "os.constants",
2694
+ fns: ["os.constants"],
2695
+ note: "the platform's dlopen, errno, signals and priority groups; members a platform lacks read as undefined",
2696
+ },
2697
+ // fs.constants as a value, and its members beyond the baked access-mode
2698
+ // bits: the target libc's null-prototype constants object.
2699
+ {
2700
+ id: "node-builtin.fs.constants",
2701
+ kind: "node-builtin",
2702
+ name: "fs.constants",
2703
+ fns: ["fs.constants"],
2704
+ note: "node_constants.cc's fs group under the target libc's macros; members a platform lacks read as undefined",
2705
+ },
2706
+ ];
2707
+ }
2632
2708
  /** The win32-target overrides of the bare modules' constants: path's
2633
2709
  * constants ARE the path/win32 namespace's, and os.EOL is CRLF (Node's
2634
2710
  * `isWindows ? '\r\n' : '\n'`). */
@@ -2636,16 +2712,16 @@ const WIN32_TARGET_CONSTS = {
2636
2712
  path: BUILTIN_MODULE_CONSTS["path/win32"],
2637
2713
  os: { EOL: "\r\n", devNull: "\\\\.\\nul" },
2638
2714
  };
2639
- /** BUILTIN_MODULE_FNS with the platform-conditional modules bound per
2715
+ /** builtinModuleFns() with the platform-conditional modules bound per
2640
2716
  * TARGET: a win32 triple compiles Node-on-Windows semantics — `path` is
2641
2717
  * path.win32 and url's bridge selects the Windows runtime behavior. Fence wording is
2642
2718
  * unaffected — callers keep naming the module the source spelled. */
2643
2719
  function builtinModuleFnsOf(lowerer, module) {
2644
2720
  if (lowerer.targetPlatform === "win32") {
2645
2721
  if (module === "path")
2646
- return BUILTIN_MODULE_FNS["path/win32"];
2722
+ return builtinModuleFns()["path/win32"];
2647
2723
  }
2648
- return ownEntry(BUILTIN_MODULE_FNS, module);
2724
+ return ownEntry(builtinModuleFns(), module);
2649
2725
  }
2650
2726
  /** Own-property lookup — lowerer.ts's own(), duplicated locally because
2651
2727
  * lowerer.ts already imports surfaces.ts (a value import back would
@@ -2835,14 +2911,6 @@ export function builtinModulesArrayLit(loc) {
2835
2911
  loc,
2836
2912
  };
2837
2913
  }
2838
- /** Member-specific hints for RECOGNIZED builtin modules whose member has
2839
- * no lowering. The default-options one-shot zlib/deflate-raw/gzip codecs
2840
- * lower for strings and Buffers; the remaining surface points at them. */
2841
- const ZLIB_HINT = "the deflate/inflate, raw, gzip/gunzip, and unzip sync/callback forms with Node's options, crc32, " +
2842
- "and the Deflate/Inflate/Gzip/Gunzip/DeflateRaw/InflateRaw/Unzip streams are the lowered zlib surface";
2843
- /** Brotli has no codec in the static runtime (zlib is the only vendored
2844
- * compression library). */
2845
- const BROTLI_HINT = "Brotli needs a Brotli codec, which the static runtime does not vendor — " + ZLIB_HINT;
2846
2914
  const ASSERT_MODULE_HINTS = {
2847
2915
  ifError: "test explicitly instead: assert.strictEqual(err, null) / " +
2848
2916
  "assert.strictEqual(err, undefined)",
@@ -2886,21 +2954,9 @@ export const BUILTIN_MODULE_FENCE_HINTS = {
2886
2954
  "RSA and EC KeyObjects (generateKeyPair, createPrivateKey, createPublicKey), sign, verify, " +
2887
2955
  "createSign, createVerify, createECDH, and createDiffieHellman",
2888
2956
  ])),
2889
- diffieHellman: "crypto.diffieHellman takes DH, EC or X25519 KeyObjects and has no lowering; " +
2890
- "the objects of createDiffieHellman, getDiffieHellman and createECDH compute shared secrets",
2891
2957
  setFips: "a compiled binary has no FIPS provider to enable, and Node itself throws on setFips(true) " +
2892
2958
  "in a non-FIPS build — getFips() answers 0 here",
2893
2959
  },
2894
- zlib: {
2895
- brotliCompressSync: BROTLI_HINT,
2896
- brotliDecompressSync: BROTLI_HINT,
2897
- brotliCompress: BROTLI_HINT,
2898
- brotliDecompress: BROTLI_HINT,
2899
- createBrotliCompress: BROTLI_HINT,
2900
- createBrotliDecompress: BROTLI_HINT,
2901
- BrotliCompress: BROTLI_HINT,
2902
- BrotliDecompress: BROTLI_HINT,
2903
- },
2904
2960
  http2: {
2905
2961
  connect: "HTTP/2 client sessions have no lowering — the lowered http2 surface is the SERVER side: " +
2906
2962
  "createSecureServer({ allowHTTP1: true, cert, key }), which serves HTTP/1.1 only " +
@@ -3214,6 +3270,22 @@ export function stdlibGlobalNameOf(lowerer, expr) {
3214
3270
  return ts.symbolName(resolved) === "global" ? "globalThis" : ts.symbolName(resolved);
3215
3271
  }
3216
3272
  if (ts.isPropertyAccessExpression(expr) && !expr.questionDotToken) {
3273
+ // The buffer module's Buffer (`require("buffer").Buffer`, `buffer_1.Buffer`)
3274
+ // is the global constructor.
3275
+ if (bufferNamespaceMember(lowerer, expr))
3276
+ return "Buffer";
3277
+ // A cast of the global object (`(globalThis as { Buffer?: B }).Buffer`,
3278
+ // `(globalThis as any).Buffer`) changes only its static type: the
3279
+ // member is the global object's own.
3280
+ const uncast = withoutTypeCasts(expr.expression);
3281
+ if (uncast !== unparenthesized(expr.expression)) {
3282
+ if (!ts.isIdentifier(uncast) || stdlibGlobalNameOf(lowerer, uncast) !== "globalThis")
3283
+ return null;
3284
+ const member = lowerer.checker.getPropertyOfType(lowerer.typeOf(uncast), expr.name.text);
3285
+ if (!member || !lowerer.isStdlibSymbol(member))
3286
+ return null;
3287
+ return ts.symbolName(member) === "global" ? "globalThis" : ts.symbolName(member);
3288
+ }
3217
3289
  if (stdlibGlobalNameOf(lowerer, expr.expression) !== "globalThis")
3218
3290
  return null;
3219
3291
  // Through a detection chain the checker types the receiver as the
@@ -3334,8 +3406,26 @@ export function stdlibGlobalAliasDecl(lowerer, nameNode, init) {
3334
3406
  if (!symbol)
3335
3407
  return false;
3336
3408
  lowerer.stdlibGlobalAliases.set(symbol, name);
3409
+ if (init !== undefined && castGlobalAliasSource(lowerer, init))
3410
+ lowerer.castGlobalAliases.add(symbol);
3337
3411
  return true;
3338
3412
  }
3413
+ /** True when an alias initializer reads its global through a cast of the
3414
+ * global object (`(globalThis as { Buffer?: B }).Buffer`), directly or as
3415
+ * the left operand of `||` (stdlibGlobalAliasNameOf's guard), or copies an
3416
+ * alias made that way. Such an alias carries the cast's static type. */
3417
+ function castGlobalAliasSource(lowerer, init) {
3418
+ let source = unparenthesized(init);
3419
+ if (ts.isBinaryExpression(source) && source.operatorToken.kind === ts.SyntaxKind.BarBarToken)
3420
+ source = unparenthesized(source.left);
3421
+ if (ts.isPropertyAccessExpression(source))
3422
+ return withoutTypeCasts(source.expression) !== unparenthesized(source.expression);
3423
+ if (ts.isIdentifier(source)) {
3424
+ const symbol = lowerer.checker.getSymbolAtLocation(source);
3425
+ return symbol !== undefined && lowerer.castGlobalAliases.has(symbol);
3426
+ }
3427
+ return false;
3428
+ }
3339
3429
  /** True iff the symbol is declared ONLY by the adopted @types/node
3340
3430
  * surface (no es-lib or shipped-ambient declaration merges in) — chooses
3341
3431
  * the SC2020 fence's wording: "typed by @types/node", not "standard