@scriptc/compiler 0.4.8 → 0.4.9

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 (536) hide show
  1. package/ambient/node-fallback/buffer.d.ts +2 -0
  2. package/ambient/node-fallback/child_process.d.ts +9 -3
  3. package/ambient/node-fallback/dns-promises.d.ts +25 -0
  4. package/ambient/node-fallback/dns.d.ts +29 -0
  5. package/ambient/node-fallback/test.d.ts +7 -0
  6. package/ambient/scriptc-node-fallback.d.ts +145 -2
  7. package/ambient/scriptc-overrides.d.ts +22 -13
  8. package/dist/backend/build-cache.d.ts +1 -1
  9. package/dist/backend/build-cache.js +1 -1
  10. package/dist/backend/build-cache.js.map +1 -1
  11. package/dist/backend/cache-root.d.ts +7 -0
  12. package/dist/backend/cache-root.js +27 -0
  13. package/dist/backend/cache-root.js.map +1 -1
  14. package/dist/backend/executable-features.js +5 -1
  15. package/dist/backend/executable-features.js.map +1 -1
  16. package/dist/backend/link-plan.js +7 -1
  17. package/dist/backend/link-plan.js.map +1 -1
  18. package/dist/backend/llvm/bytes-loop-versions.d.ts +12 -1
  19. package/dist/backend/llvm/bytes-loop-versions.js +107 -30
  20. package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
  21. package/dist/backend/llvm/bytes-loop-versions.test.js +96 -0
  22. package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
  23. package/dist/backend/llvm/checked-value-lifetimes.js +1 -0
  24. package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
  25. package/dist/backend/llvm/classes.d.ts +16 -5
  26. package/dist/backend/llvm/classes.js +34 -6
  27. package/dist/backend/llvm/classes.js.map +1 -1
  28. package/dist/backend/llvm/classes.test.js +21 -2
  29. package/dist/backend/llvm/classes.test.js.map +1 -1
  30. package/dist/backend/llvm/common.d.ts +9 -0
  31. package/dist/backend/llvm/common.js +9 -0
  32. package/dist/backend/llvm/common.js.map +1 -1
  33. package/dist/backend/llvm/cpu-dispatch.d.ts +36 -2
  34. package/dist/backend/llvm/cpu-dispatch.js +96 -2
  35. package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
  36. package/dist/backend/llvm/dense-array-access.d.ts +5 -2
  37. package/dist/backend/llvm/dense-array-access.js +16 -12
  38. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  39. package/dist/backend/llvm/dense-array-access.test.js +3 -1
  40. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  41. package/dist/backend/llvm/dyn.d.ts +24 -0
  42. package/dist/backend/llvm/dyn.js +117 -3
  43. package/dist/backend/llvm/dyn.js.map +1 -1
  44. package/dist/backend/llvm/emit-function.js +6 -0
  45. package/dist/backend/llvm/emit-function.js.map +1 -1
  46. package/dist/backend/llvm/emit-journal.d.ts +1 -0
  47. package/dist/backend/llvm/emit-journal.js.map +1 -1
  48. package/dist/backend/llvm/emit-module.js +48 -5
  49. package/dist/backend/llvm/emit-module.js.map +1 -1
  50. package/dist/backend/llvm/emit-module.test.js +41 -0
  51. package/dist/backend/llvm/emit-module.test.js.map +1 -1
  52. package/dist/backend/llvm/emit-statements.js +11 -0
  53. package/dist/backend/llvm/emit-statements.js.map +1 -1
  54. package/dist/backend/llvm/emitter.d.ts +87 -7
  55. package/dist/backend/llvm/emitter.js +136 -15
  56. package/dist/backend/llvm/emitter.js.map +1 -1
  57. package/dist/backend/llvm/expr-async.js +28 -6
  58. package/dist/backend/llvm/expr-async.js.map +1 -1
  59. package/dist/backend/llvm/expr-containers.js +19 -5
  60. package/dist/backend/llvm/expr-containers.js.map +1 -1
  61. package/dist/backend/llvm/expr-dynamic.js +29 -1
  62. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  63. package/dist/backend/llvm/expr-primitives.js +104 -6
  64. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  65. package/dist/backend/llvm/expr-records.js +15 -1
  66. package/dist/backend/llvm/expr-records.js.map +1 -1
  67. package/dist/backend/llvm/expr-stream-bridges.js +53 -5
  68. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  69. package/dist/backend/llvm/inline-arrays.js +1 -1
  70. package/dist/backend/llvm/inline-arrays.js.map +1 -1
  71. package/dist/backend/llvm/js-ic.js +126 -2
  72. package/dist/backend/llvm/js-ic.js.map +1 -1
  73. package/dist/backend/llvm/lanes.d.ts +38 -0
  74. package/dist/backend/llvm/lanes.js +778 -0
  75. package/dist/backend/llvm/lanes.js.map +1 -0
  76. package/dist/backend/llvm/lanes.test.d.ts +1 -0
  77. package/dist/backend/llvm/lanes.test.js +402 -0
  78. package/dist/backend/llvm/lanes.test.js.map +1 -0
  79. package/dist/backend/llvm/lib-dispatch.js +9 -4
  80. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  81. package/dist/backend/llvm/lib-network.js +20 -0
  82. package/dist/backend/llvm/lib-network.js.map +1 -1
  83. package/dist/backend/llvm/lib-shared.js +27 -0
  84. package/dist/backend/llvm/lib-shared.js.map +1 -1
  85. package/dist/backend/llvm/lib-test.js +11 -0
  86. package/dist/backend/llvm/lib-test.js.map +1 -1
  87. package/dist/backend/llvm/local-array-reads.js +2 -2
  88. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  89. package/dist/backend/llvm/map-number-lookup.js +8 -2
  90. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  91. package/dist/backend/llvm/nullable-unions.js +5 -2
  92. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  93. package/dist/backend/llvm/publish.d.ts +3 -0
  94. package/dist/backend/llvm/publish.js +2 -2
  95. package/dist/backend/llvm/publish.js.map +1 -1
  96. package/dist/backend/llvm/reference-writes.js +1 -0
  97. package/dist/backend/llvm/reference-writes.js.map +1 -1
  98. package/dist/backend/llvm/region-groups.js +43 -4
  99. package/dist/backend/llvm/region-groups.js.map +1 -1
  100. package/dist/backend/llvm/region-groups.test.js +79 -0
  101. package/dist/backend/llvm/region-groups.test.js.map +1 -1
  102. package/dist/backend/llvm/runtime-registries.test.js +32 -1
  103. package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
  104. package/dist/backend/llvm/shapes.js +10 -1
  105. package/dist/backend/llvm/shapes.js.map +1 -1
  106. package/dist/backend/llvm/string-reads.d.ts +1 -1
  107. package/dist/backend/llvm/string-reads.js +1 -1
  108. package/dist/backend/llvm/string-reads.js.map +1 -1
  109. package/dist/backend/llvm/unwind-abi.js +24 -2
  110. package/dist/backend/llvm/unwind-abi.js.map +1 -1
  111. package/dist/backend/llvm/unwind-abi.test.js +38 -0
  112. package/dist/backend/llvm/unwind-abi.test.js.map +1 -1
  113. package/dist/backend/llvm/walkers.d.ts +3 -0
  114. package/dist/backend/llvm/walkers.js +20 -2
  115. package/dist/backend/llvm/walkers.js.map +1 -1
  116. package/dist/backend/native/contracts.d.ts +15 -3
  117. package/dist/backend/native/executable.js +19 -5
  118. package/dist/backend/native/executable.js.map +1 -1
  119. package/dist/backend/native-codegen-core.d.ts +20 -0
  120. package/dist/backend/native-codegen-core.js +15 -0
  121. package/dist/backend/native-codegen-core.js.map +1 -1
  122. package/dist/backend/native-codegen.d.ts +5 -0
  123. package/dist/backend/native-codegen.js +62 -8
  124. package/dist/backend/native-codegen.js.map +1 -1
  125. package/dist/backend/native-codegen.test.js +48 -8
  126. package/dist/backend/native-codegen.test.js.map +1 -1
  127. package/dist/backend/native-link-info-core.d.ts +27 -3
  128. package/dist/backend/native-link-info-core.js.map +1 -1
  129. package/dist/backend/native-link-info.test.js +17 -1
  130. package/dist/backend/native-link-info.test.js.map +1 -1
  131. package/dist/backend/native-toolchain.d.ts +1 -1
  132. package/dist/backend/native-toolchain.js +1 -1
  133. package/dist/backend/native-toolchain.js.map +1 -1
  134. package/dist/backend/native-toolchain.test.js +14 -1
  135. package/dist/backend/native-toolchain.test.js.map +1 -1
  136. package/dist/backend/runtime-pack-core.d.ts +9 -3
  137. package/dist/backend/runtime-pack-core.js +6 -1
  138. package/dist/backend/runtime-pack-core.js.map +1 -1
  139. package/dist/backend/runtime-pack.test.js +32 -1
  140. package/dist/backend/runtime-pack.test.js.map +1 -1
  141. package/dist/backend/targets.d.ts +9 -1
  142. package/dist/backend/targets.js +11 -2
  143. package/dist/backend/targets.js.map +1 -1
  144. package/dist/backend/targets.test.js +6 -0
  145. package/dist/backend/targets.test.js.map +1 -1
  146. package/dist/cli/command.js +15 -1
  147. package/dist/cli/command.js.map +1 -1
  148. package/dist/cli/host.d.ts +6 -0
  149. package/dist/cli/mcp.d.ts +72 -0
  150. package/dist/cli/mcp.js +601 -0
  151. package/dist/cli/mcp.js.map +1 -0
  152. package/dist/cli/mcp.test.d.ts +1 -0
  153. package/dist/cli/mcp.test.js +380 -0
  154. package/dist/cli/mcp.test.js.map +1 -0
  155. package/dist/cli/output-options.d.ts +1 -0
  156. package/dist/cli/output-options.js +3 -0
  157. package/dist/cli/output-options.js.map +1 -1
  158. package/dist/cli/usage.d.ts +51 -1
  159. package/dist/cli/usage.js +709 -186
  160. package/dist/cli/usage.js.map +1 -1
  161. package/dist/compat/fetch-profile.js +9 -4
  162. package/dist/compat/fetch-profile.js.map +1 -1
  163. package/dist/compile-types.d.ts +17 -0
  164. package/dist/coverage/report.d.ts +5 -9
  165. package/dist/coverage/report.js.map +1 -1
  166. package/dist/executable/executable-cache.d.ts +17 -3
  167. package/dist/executable/executable-cache.js +17 -3
  168. package/dist/executable/executable-cache.js.map +1 -1
  169. package/dist/executable/prepare.js +87 -10
  170. package/dist/executable/prepare.js.map +1 -1
  171. package/dist/frontend/analysis.js +3 -2
  172. package/dist/frontend/analysis.js.map +1 -1
  173. package/dist/frontend/canon-map.js +13 -8
  174. package/dist/frontend/canon-map.js.map +1 -1
  175. package/dist/frontend/decl-projection.d.ts +18 -0
  176. package/dist/frontend/decl-projection.js +90 -22
  177. package/dist/frontend/decl-projection.js.map +1 -1
  178. package/dist/frontend/decl-projection.test.js +47 -1
  179. package/dist/frontend/decl-projection.test.js.map +1 -1
  180. package/dist/frontend/default-library.d.ts +10 -0
  181. package/dist/frontend/default-library.js +43 -0
  182. package/dist/frontend/default-library.js.map +1 -0
  183. package/dist/frontend/fork-target.js +54 -9
  184. package/dist/frontend/fork-target.js.map +1 -1
  185. package/dist/frontend/fork-target.test.js +82 -0
  186. package/dist/frontend/fork-target.test.js.map +1 -1
  187. package/dist/frontend/inferred-js-diagnostics.test.js +73 -0
  188. package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
  189. package/dist/frontend/lowering/abstract-equality.d.ts +2 -1
  190. package/dist/frontend/lowering/abstract-equality.js +7 -1
  191. package/dist/frontend/lowering/abstract-equality.js.map +1 -1
  192. package/dist/frontend/lowering/array-values.js +2 -2
  193. package/dist/frontend/lowering/array-values.js.map +1 -1
  194. package/dist/frontend/lowering/assertion-members.js +52 -2
  195. package/dist/frontend/lowering/assertion-members.js.map +1 -1
  196. package/dist/frontend/lowering/builtin-namespaces.d.ts +5 -0
  197. package/dist/frontend/lowering/builtin-namespaces.js +19 -12
  198. package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
  199. package/dist/frontend/lowering/builtins/callable-aliases.js +42 -6
  200. package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
  201. package/dist/frontend/lowering/builtins/child-process.d.ts +12 -11
  202. package/dist/frontend/lowering/builtins/child-process.js +235 -38
  203. package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
  204. package/dist/frontend/lowering/builtins/compression.d.ts +6 -1
  205. package/dist/frontend/lowering/builtins/compression.js +3 -3
  206. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  207. package/dist/frontend/lowering/builtins/constants.js +2 -2
  208. package/dist/frontend/lowering/builtins/constants.js.map +1 -1
  209. package/dist/frontend/lowering/builtins/crypto.d.ts +3 -1
  210. package/dist/frontend/lowering/builtins/crypto.js +9 -1
  211. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  212. package/dist/frontend/lowering/builtins/dates.js +26 -6
  213. package/dist/frontend/lowering/builtins/dates.js.map +1 -1
  214. package/dist/frontend/lowering/builtins/environment.d.ts +13 -1
  215. package/dist/frontend/lowering/builtins/environment.js +15 -4
  216. package/dist/frontend/lowering/builtins/environment.js.map +1 -1
  217. package/dist/frontend/lowering/builtins/module-bindings.d.ts +33 -0
  218. package/dist/frontend/lowering/builtins/module-bindings.js +213 -11
  219. package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
  220. package/dist/frontend/lowering/builtins/module-resolution.d.ts +9 -2
  221. package/dist/frontend/lowering/builtins/module-resolution.js +187 -19
  222. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  223. package/dist/frontend/lowering/builtins/performance.js +1 -1
  224. package/dist/frontend/lowering/builtins/performance.js.map +1 -1
  225. package/dist/frontend/lowering/builtins/process.js +40 -2
  226. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  227. package/dist/frontend/lowering/builtins/promises.js +33 -0
  228. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  229. package/dist/frontend/lowering/builtins/readline.d.ts +9 -5
  230. package/dist/frontend/lowering/builtins/readline.js +184 -75
  231. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  232. package/dist/frontend/lowering/builtins/url.d.ts +4 -0
  233. package/dist/frontend/lowering/builtins/url.js +6 -0
  234. package/dist/frontend/lowering/builtins/url.js.map +1 -1
  235. package/dist/frontend/lowering/call-arguments.js +15 -0
  236. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  237. package/dist/frontend/lowering/callable-properties.d.ts +34 -0
  238. package/dist/frontend/lowering/callable-properties.js +210 -0
  239. package/dist/frontend/lowering/callable-properties.js.map +1 -0
  240. package/dist/frontend/lowering/cjs-inline-require.d.ts +16 -0
  241. package/dist/frontend/lowering/cjs-inline-require.js +105 -0
  242. package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
  243. package/dist/frontend/lowering/cjs-inline-require.test.d.ts +1 -0
  244. package/dist/frontend/lowering/cjs-inline-require.test.js +61 -0
  245. package/dist/frontend/lowering/cjs-inline-require.test.js.map +1 -0
  246. package/dist/frontend/lowering/class-dynamic-dispatch.js +82 -2
  247. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  248. package/dist/frontend/lowering/class-protocols.d.ts +57 -4
  249. package/dist/frontend/lowering/class-protocols.js +597 -30
  250. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  251. package/dist/frontend/lowering/class-unions.js +2 -2
  252. package/dist/frontend/lowering/class-unions.js.map +1 -1
  253. package/dist/frontend/lowering/coercions/function-adapters.d.ts +12 -0
  254. package/dist/frontend/lowering/coercions/function-adapters.js +62 -0
  255. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  256. package/dist/frontend/lowering/coercions/structural-plans.js +56 -1
  257. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  258. package/dist/frontend/lowering/coercions/structural.js +9 -4
  259. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  260. package/dist/frontend/lowering/collection-ingestion.d.ts +9 -0
  261. package/dist/frontend/lowering/collection-ingestion.js +115 -41
  262. package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
  263. package/dist/frontend/lowering/containers/array-callbacks.js +16 -0
  264. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  265. package/dist/frontend/lowering/containers/bytes.js +66 -10
  266. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  267. package/dist/frontend/lowering/containers/collection-methods.js +61 -5
  268. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  269. package/dist/frontend/lowering/containers/filter-predicates.js +11 -0
  270. package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
  271. package/dist/frontend/lowering/containers/indexed-objects.d.ts +15 -0
  272. package/dist/frontend/lowering/containers/indexed-objects.js +213 -30
  273. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  274. package/dist/frontend/lowering/error-name-order.d.ts +16 -0
  275. package/dist/frontend/lowering/error-name-order.js +61 -0
  276. package/dist/frontend/lowering/error-name-order.js.map +1 -1
  277. package/dist/frontend/lowering/expressions/asserted-receiver.d.ts +17 -0
  278. package/dist/frontend/lowering/expressions/asserted-receiver.js +123 -1
  279. package/dist/frontend/lowering/expressions/asserted-receiver.js.map +1 -1
  280. package/dist/frontend/lowering/expressions/binary.js +147 -20
  281. package/dist/frontend/lowering/expressions/binary.js.map +1 -1
  282. package/dist/frontend/lowering/expressions/element-access.js +63 -14
  283. package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
  284. package/dist/frontend/lowering/expressions/erased-delete.d.ts +59 -0
  285. package/dist/frontend/lowering/expressions/erased-delete.js +247 -0
  286. package/dist/frontend/lowering/expressions/erased-delete.js.map +1 -0
  287. package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +10 -0
  288. package/dist/frontend/lowering/expressions/hosted-narrowing.js +48 -1
  289. package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
  290. package/dist/frontend/lowering/expressions/identifiers.js +20 -0
  291. package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
  292. package/dist/frontend/lowering/expressions/narrowing.d.ts +7 -2
  293. package/dist/frontend/lowering/expressions/narrowing.js +77 -45
  294. package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
  295. package/dist/frontend/lowering/expressions/object-literals.js +62 -19
  296. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  297. package/dist/frontend/lowering/expressions/optional-chains.js +19 -0
  298. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  299. package/dist/frontend/lowering/expressions/property-access.d.ts +7 -7
  300. package/dist/frontend/lowering/expressions/property-access.js +247 -48
  301. package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
  302. package/dist/frontend/lowering/expressions/relational.d.ts +1 -0
  303. package/dist/frontend/lowering/expressions/relational.js +18 -8
  304. package/dist/frontend/lowering/expressions/relational.js.map +1 -1
  305. package/dist/frontend/lowering/expressions/union-fields.js +11 -5
  306. package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
  307. package/dist/frontend/lowering/expressions/updates.js +121 -11
  308. package/dist/frontend/lowering/expressions/updates.js.map +1 -1
  309. package/dist/frontend/lowering/function-context.d.ts +10 -0
  310. package/dist/frontend/lowering/function-context.js +36 -0
  311. package/dist/frontend/lowering/function-context.js.map +1 -1
  312. package/dist/frontend/lowering/function-returns.js +8 -8
  313. package/dist/frontend/lowering/function-returns.js.map +1 -1
  314. package/dist/frontend/lowering/handle-properties.d.ts +62 -3
  315. package/dist/frontend/lowering/handle-properties.js +674 -26
  316. package/dist/frontend/lowering/handle-properties.js.map +1 -1
  317. package/dist/frontend/lowering/handle-properties.test.js +95 -2
  318. package/dist/frontend/lowering/handle-properties.test.js.map +1 -1
  319. package/dist/frontend/lowering/lower-builtin-values.d.ts +12 -0
  320. package/dist/frontend/lowering/lower-builtin-values.js +44 -0
  321. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
  322. package/dist/frontend/lowering/lower-calls.js +328 -136
  323. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  324. package/dist/frontend/lowering/lower-classes.js +82 -17
  325. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  326. package/dist/frontend/lowering/lower-event-emitter.js +113 -9
  327. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  328. package/dist/frontend/lowering/lower-expando.d.ts +13 -21
  329. package/dist/frontend/lowering/lower-expando.js +90 -126
  330. package/dist/frontend/lowering/lower-expando.js.map +1 -1
  331. package/dist/frontend/lowering/lower-exprs.js +2 -2
  332. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  333. package/dist/frontend/lowering/lower-functions.js +65 -0
  334. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  335. package/dist/frontend/lowering/lower-inspect.js +471 -0
  336. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  337. package/dist/frontend/lowering/lower-modules.js +36 -10
  338. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  339. package/dist/frontend/lowering/lower-node-island.js +28 -0
  340. package/dist/frontend/lowering/lower-node-island.js.map +1 -1
  341. package/dist/frontend/lowering/lower-server.d.ts +53 -7
  342. package/dist/frontend/lowering/lower-server.js +213 -42
  343. package/dist/frontend/lowering/lower-server.js.map +1 -1
  344. package/dist/frontend/lowering/lower-stdlib.js +50 -7
  345. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  346. package/dist/frontend/lowering/lower-stmts.d.ts +24 -0
  347. package/dist/frontend/lowering/lower-stmts.js +463 -220
  348. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  349. package/dist/frontend/lowering/lower-stream.js +2 -2
  350. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  351. package/dist/frontend/lowering/lower-test.js +71 -2
  352. package/dist/frontend/lowering/lower-test.js.map +1 -1
  353. package/dist/frontend/lowering/lowerer.d.ts +81 -10
  354. package/dist/frontend/lowering/lowerer.js +319 -72
  355. package/dist/frontend/lowering/lowerer.js.map +1 -1
  356. package/dist/frontend/lowering/new-target.js +10 -2
  357. package/dist/frontend/lowering/new-target.js.map +1 -1
  358. package/dist/frontend/lowering/nullish-empty-pattern.js +3 -3
  359. package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -1
  360. package/dist/frontend/lowering/partial-assertions.js +30 -5
  361. package/dist/frontend/lowering/partial-assertions.js.map +1 -1
  362. package/dist/frontend/lowering/primitive-throws.js +91 -1
  363. package/dist/frontend/lowering/primitive-throws.js.map +1 -1
  364. package/dist/frontend/lowering/primitive-wrappers.d.ts +9 -0
  365. package/dist/frontend/lowering/primitive-wrappers.js +2 -2
  366. package/dist/frontend/lowering/primitive-wrappers.js.map +1 -1
  367. package/dist/frontend/lowering/promise-executor-adapter.js +5 -2
  368. package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -1
  369. package/dist/frontend/lowering/record-links.js +7 -2
  370. package/dist/frontend/lowering/record-links.js.map +1 -1
  371. package/dist/frontend/lowering/surfaces.d.ts +4 -0
  372. package/dist/frontend/lowering/surfaces.js +118 -2
  373. package/dist/frontend/lowering/surfaces.js.map +1 -1
  374. package/dist/frontend/lowering/surfaces.test.d.ts +1 -0
  375. package/dist/frontend/lowering/surfaces.test.js +31 -0
  376. package/dist/frontend/lowering/surfaces.test.js.map +1 -0
  377. package/dist/frontend/mock-shapes.js +3 -3
  378. package/dist/frontend/mock-shapes.js.map +1 -1
  379. package/dist/frontend/npm-static-ladder.d.ts +21 -0
  380. package/dist/frontend/npm-static-ladder.js +2 -0
  381. package/dist/frontend/npm-static-ladder.js.map +1 -0
  382. package/dist/frontend/npm-static-ladder.test.d.ts +1 -0
  383. package/dist/frontend/npm-static-ladder.test.js +138 -0
  384. package/dist/frontend/npm-static-ladder.test.js.map +1 -0
  385. package/dist/frontend/npm-static-status.d.ts +15 -0
  386. package/dist/frontend/npm-static-status.js +2 -0
  387. package/dist/frontend/npm-static-status.js.map +1 -0
  388. package/dist/frontend/package-shims.js +1 -1
  389. package/dist/frontend/package-shims.js.map +1 -1
  390. package/dist/frontend/pipeline.d.ts +1 -1
  391. package/dist/frontend/pipeline.js +222 -25
  392. package/dist/frontend/pipeline.js.map +1 -1
  393. package/dist/frontend/program-analysis.d.ts +4 -0
  394. package/dist/frontend/program-analysis.js +6 -0
  395. package/dist/frontend/program-analysis.js.map +1 -1
  396. package/dist/frontend/program.js +258 -32
  397. package/dist/frontend/program.js.map +1 -1
  398. package/dist/frontend/program.test.js +30 -0
  399. package/dist/frontend/program.test.js.map +1 -1
  400. package/dist/frontend/resolve.js +29 -5
  401. package/dist/frontend/resolve.js.map +1 -1
  402. package/dist/frontend/resolve.test.js +40 -0
  403. package/dist/frontend/resolve.test.js.map +1 -1
  404. package/dist/frontend/services.d.ts +8 -0
  405. package/dist/frontend/services.js +7 -0
  406. package/dist/frontend/services.js.map +1 -1
  407. package/dist/frontend/ts7/checker.d.ts +7 -0
  408. package/dist/frontend/ts7/checker.js +12 -0
  409. package/dist/frontend/ts7/checker.js.map +1 -1
  410. package/dist/frontend/ts7/checker.test.js +1 -0
  411. package/dist/frontend/ts7/checker.test.js.map +1 -1
  412. package/dist/frontend/ts7/program-host.d.ts +39 -2
  413. package/dist/frontend/ts7/program-host.js +62 -8
  414. package/dist/frontend/ts7/program-host.js.map +1 -1
  415. package/dist/frontend/ts7/program-host.test.js +33 -0
  416. package/dist/frontend/ts7/program-host.test.js.map +1 -1
  417. package/dist/frontend/ts7/session-cache.d.ts +5 -1
  418. package/dist/frontend/ts7/session-cache.js +7 -1
  419. package/dist/frontend/ts7/session-cache.js.map +1 -1
  420. package/dist/frontend/ts7/session-cache.test.js +37 -0
  421. package/dist/frontend/ts7/session-cache.test.js.map +1 -1
  422. package/dist/frontend/ts7/session.js +19 -1
  423. package/dist/frontend/ts7/session.js.map +1 -1
  424. package/dist/frontend/ts7/source-parser.d.ts +17 -2
  425. package/dist/frontend/ts7/source-parser.js +61 -2
  426. package/dist/frontend/ts7/source-parser.js.map +1 -1
  427. package/dist/frontend/ts7/source-parser.test.js +55 -2
  428. package/dist/frontend/ts7/source-parser.test.js.map +1 -1
  429. package/dist/frontend/tsc-codes.d.ts +3 -2
  430. package/dist/frontend/tsc-codes.js +129 -22
  431. package/dist/frontend/tsc-codes.js.map +1 -1
  432. package/dist/frontend/type-mapper.d.ts +5 -11
  433. package/dist/frontend/type-mapper.js +380 -70
  434. package/dist/frontend/type-mapper.js.map +1 -1
  435. package/dist/index.d.ts +1 -1
  436. package/dist/index.js +67 -7
  437. package/dist/index.js.map +1 -1
  438. package/dist/ir/builtin-effects.js +29 -0
  439. package/dist/ir/builtin-effects.js.map +1 -1
  440. package/dist/ir/builtin-signatures.d.ts +1 -1
  441. package/dist/ir/builtin-signatures.js +72 -6
  442. package/dist/ir/builtin-signatures.js.map +1 -1
  443. package/dist/ir/codec.generated.d.ts +1 -1
  444. package/dist/ir/codec.generated.js +321 -263
  445. package/dist/ir/codec.generated.js.map +1 -1
  446. package/dist/ir/constant-length-clones.d.ts +26 -0
  447. package/dist/ir/constant-length-clones.js +589 -0
  448. package/dist/ir/constant-length-clones.js.map +1 -0
  449. package/dist/ir/constant-length-clones.test.d.ts +1 -0
  450. package/dist/ir/constant-length-clones.test.js +292 -0
  451. package/dist/ir/constant-length-clones.test.js.map +1 -0
  452. package/dist/ir/constant-tables.d.ts +10 -5
  453. package/dist/ir/constant-tables.js +83 -17
  454. package/dist/ir/constant-tables.js.map +1 -1
  455. package/dist/ir/constant-tables.test.js +58 -1
  456. package/dist/ir/constant-tables.test.js.map +1 -1
  457. package/dist/ir/fields.generated.js +5 -2
  458. package/dist/ir/fields.generated.js.map +1 -1
  459. package/dist/ir/function-references.js +2 -0
  460. package/dist/ir/function-references.js.map +1 -1
  461. package/dist/ir/function-references.test.js +13 -0
  462. package/dist/ir/function-references.test.js.map +1 -1
  463. package/dist/ir/integer-loops.js +1 -0
  464. package/dist/ir/integer-loops.js.map +1 -1
  465. package/dist/ir/integer-loops.test.js +16 -0
  466. package/dist/ir/integer-loops.test.js.map +1 -1
  467. package/dist/ir/ir.d.ts +50 -6
  468. package/dist/ir/ir.js +44 -2
  469. package/dist/ir/ir.js.map +1 -1
  470. package/dist/ir/ir.test.js +83 -1
  471. package/dist/ir/ir.test.js.map +1 -1
  472. package/dist/ir/js-groups.js +5 -1
  473. package/dist/ir/js-groups.js.map +1 -1
  474. package/dist/ir/js-ic.d.ts +20 -0
  475. package/dist/ir/js-ic.js +81 -4
  476. package/dist/ir/js-ic.js.map +1 -1
  477. package/dist/ir/js-ic.test.js +8 -1
  478. package/dist/ir/js-ic.test.js.map +1 -1
  479. package/dist/ir/lane-plans.d.ts +86 -0
  480. package/dist/ir/lane-plans.js +589 -0
  481. package/dist/ir/lane-plans.js.map +1 -0
  482. package/dist/ir/lane-plans.test.d.ts +1 -0
  483. package/dist/ir/lane-plans.test.js +549 -0
  484. package/dist/ir/lane-plans.test.js.map +1 -0
  485. package/dist/ir/runtime-features.d.ts +68 -10
  486. package/dist/ir/runtime-features.js +285 -17
  487. package/dist/ir/runtime-features.js.map +1 -1
  488. package/dist/ir/runtime-features.test.js +190 -1
  489. package/dist/ir/runtime-features.test.js.map +1 -1
  490. package/dist/ir/validate.js +61 -24
  491. package/dist/ir/validate.js.map +1 -1
  492. package/dist/native/cache.d.ts +5 -0
  493. package/dist/native/cache.js +23 -1
  494. package/dist/native/cache.js.map +1 -1
  495. package/dist/native/cache.test.js +29 -1
  496. package/dist/native/cache.test.js.map +1 -1
  497. package/dist/native/cli.js +4 -2
  498. package/dist/native/cli.js.map +1 -1
  499. package/dist/native/compiler.d.ts +11 -3
  500. package/dist/native/compiler.js +102 -16
  501. package/dist/native/compiler.js.map +1 -1
  502. package/dist/native/compiler.test.js +244 -2
  503. package/dist/native/compiler.test.js.map +1 -1
  504. package/dist/native/prepare.d.ts +14 -1
  505. package/dist/native/prepare.js +79 -29
  506. package/dist/native/prepare.js.map +1 -1
  507. package/dist/native/sanitizer.test.js +3 -0
  508. package/dist/native/sanitizer.test.js.map +1 -1
  509. package/dist/native/unchanged.d.ts +80 -0
  510. package/dist/native/unchanged.js +301 -0
  511. package/dist/native/unchanged.js.map +1 -0
  512. package/dist/native/unchanged.test.d.ts +1 -0
  513. package/dist/native/unchanged.test.js +249 -0
  514. package/dist/native/unchanged.test.js.map +1 -0
  515. package/dist/node-islands/boundary.d.ts +16 -0
  516. package/dist/node-islands/boundary.js +70 -7
  517. package/dist/node-islands/boundary.js.map +1 -1
  518. package/dist/node-islands/boundary.test.js +59 -14
  519. package/dist/node-islands/boundary.test.js.map +1 -1
  520. package/dist/node-islands/detect.js +203 -47
  521. package/dist/node-islands/detect.js.map +1 -1
  522. package/dist/node-islands/detect.test.js +45 -0
  523. package/dist/node-islands/detect.test.js.map +1 -1
  524. package/dist/node-islands/growth.js +4 -16
  525. package/dist/node-islands/growth.js.map +1 -1
  526. package/dist/node-islands/modules.d.ts +3 -0
  527. package/dist/node-islands/modules.js +143 -12
  528. package/dist/node-islands/modules.js.map +1 -1
  529. package/dist/node-islands/modules.test.js +125 -0
  530. package/dist/node-islands/modules.test.js.map +1 -1
  531. package/dist/node-islands/report.d.ts +1 -1
  532. package/dist/node-islands/report.js +2 -1
  533. package/dist/node-islands/report.js.map +1 -1
  534. package/package.json +20 -20
  535. package/shims/undici/core/request.ts +7 -1
  536. package/surface-manifest.json +380 -2
@@ -79,6 +79,9 @@ export declare function moduleUsesWebCryptoAsymmetric(mod: IrModule): boolean;
79
79
  * (A1 adds dyn.intrinsic); the slices share one SCR_JS_OBJECT_MODEL build
80
80
  * of every unit they touch instead of one build column per feature. */
81
81
  export declare const JS_OBJECT_MODEL_LIB_FNS: ReadonlySet<IrLibFn>;
82
+ /** The member name Object.prototype answers as an accessor (protoAccessor):
83
+ * a dynamic read (`dynKeyGet`) or a dynamic key write names it. */
84
+ export declare function isProtoKeyLiteral(node: IrExpr): boolean;
82
85
  /** The JavaScript object model build's program facts (t262-da §J): every
83
86
  * runtime feature that shares the one SCR_JS_OBJECT_MODEL build ORs in here
84
87
  * (BigInt views today, array attributes and handle property tables next), so
@@ -87,7 +90,10 @@ export declare const JS_OBJECT_MODEL_LIB_FNS: ReadonlySet<IrLibFn>;
87
90
  export declare function jsObjectModelFact(features: {
88
91
  jsObjectModel?: boolean;
89
92
  bigintBytes?: boolean;
93
+ handleProps?: boolean;
90
94
  mutableBuffers?: boolean;
95
+ protoAccessor?: boolean;
96
+ sparseArrays?: boolean;
91
97
  }): boolean;
92
98
  /** One rule per runtime feature, sorted by name. A new feature is an
93
99
  * entry here and its line in noRuntimeFeatures; RuntimeFeatures, the scan
@@ -120,6 +126,12 @@ declare const RUNTIME_FEATURE_RULES: {
120
126
  * own, so a program that never passes those options keeps the default
121
127
  * object, byte for byte. */
122
128
  childOptionExt: RuntimeFeatureRule;
129
+ /** The spawnSync result's `.error` property answers Node's
130
+ * errnoException fields (errno, syscall, path, spawnargs). The fields
131
+ * ride a build of scr_child.c of their own (SCR_CHILD_ERR_FIELDS), so a
132
+ * program that never reads `.error` keeps the default object and the
133
+ * result container exactly as they were. */
134
+ childErrorFields: RuntimeFeatureRule;
123
135
  /** scr_cipher.c over the mbedTLS archive; DEP0182 reports through the
124
136
  * process-warning unit, and unknown output encodings render through the
125
137
  * inspect unit. WebCrypto's encrypt, decrypt, wrapKey and unwrapKey
@@ -156,6 +168,10 @@ declare const RUNTIME_FEATURE_RULES: {
156
168
  /** A standard library prototype object read as a value in a JavaScript
157
169
  * source (scr_dyn_stdlib_prototype.c): `Date.prototype`. */
158
170
  stdlibPrototypeValue: RuntimeFeatureRule;
171
+ /** DataView.prototype read as a value in a JavaScript source, and its
172
+ * members through it (scr_data_view_proto.c): the getter/setter family's
173
+ * prototype object. */
174
+ dataViewPrototypeValue: RuntimeFeatureRule;
159
175
  /** The dynamic global object's answer for the Node globals the native
160
176
  * runtime does not implement (scr_global_host_absent.c, plus the
161
177
  * SCR_GLOBAL_HOST_ABSENT build of scr_node_builtin.c): a computed read of
@@ -165,9 +181,9 @@ declare const RUNTIME_FEATURE_RULES: {
165
181
  * (scr_dyn_array_like.c), which delegates every other name to the
166
182
  * dyn-invoke unit's array dispatch. */
167
183
  arrayLikeDispatch: RuntimeFeatureRule;
168
- /** Number.prototype and Boolean.prototype as values
169
- * (scr_dyn_builtin_prototype.c). */
170
- builtinPrototypeValue: RuntimeFeatureRule;
184
+ /** A builtin prototype method as a function value (String's trim family,
185
+ * RegExp's exec/test/toString; scr_dyn_builtin_methods.c). */
186
+ builtinMethodValue: RuntimeFeatureRule;
171
187
  dynInvoke: RuntimeFeatureRule;
172
188
  /** The program has dynamic-tier jsval operations (js.* builtins, the
173
189
  * jsval pass): links the scr_js_* units (two-tier design I3). */
@@ -175,7 +191,8 @@ declare const RUNTIME_FEATURE_RULES: {
175
191
  /** Checked-dynamic stream slots test values and pipe into JavaScript
176
192
  * stream objects (scr_stream_dyn.c). */
177
193
  streamDyn: RuntimeFeatureRule;
178
- /** Own properties JavaScript adds to children (scr_dyn_handle_props.c). */
194
+ /** Own properties JavaScript adds to runtime handles (scr_dyn_handle_props.c):
195
+ * a Date, RegExp, Map, Set, weak collection, buffer or child. */
179
196
  handleProps: RuntimeFeatureRule;
180
197
  /** The declaration-typed boundary's adoption (scr_decl_adopt.c): its
181
198
  * casts, and closures boxed in a boundary program, which adopt their
@@ -226,6 +243,11 @@ declare const RUNTIME_FEATURE_RULES: {
226
243
  mime: RuntimeFeatureRule;
227
244
  /** Web streams in checked-dynamic code (scr_webstreams.c). */
228
245
  webStreams: RuntimeFeatureRule;
246
+ /** A program that builds a Blob or File can hand one to fetch: selects
247
+ * scr_fetch.c's SCR_WEB_BODIES build, which sends the blob's bytes and
248
+ * type as Node does. Every other program keeps the default fetch unit,
249
+ * byte for byte. */
250
+ webBodies: RuntimeFeatureRule;
229
251
  /** AbortController and AbortSignal (scr_abort.c, or the fetch unit).
230
252
  * A WritableStream controller's signal is one (scr_webstreams.c). */
231
253
  abortSignal: RuntimeFeatureRule;
@@ -309,11 +331,12 @@ declare const RUNTIME_FEATURE_RULES: {
309
331
  streamWriteErrors: RuntimeFeatureRule;
310
332
  /** The program reaches the process output streams' write slot — the
311
333
  * write method as a value (process.stdioSlot), its replacement, a patched
312
- * program's typed writes, or a run-time-typed chunk
313
- * (process.stdioWriteDyn): the SCR_STDIO_WRITE_SLOT build of the events
314
- * unit carries the shared write body, the dynamic-chunk entry point and
315
- * Node's anonymous write function. Every other program links the default
316
- * object, byte for byte. */
334
+ * program's typed writes, a run-time-typed chunk
335
+ * (process.stdioWriteDyn), or the untyped one-string write
336
+ * (process.stdioWriteStr): the SCR_STDIO_WRITE_SLOT build of the events
337
+ * unit carries the shared write body, the dynamic-chunk entry point,
338
+ * the string entry point and Node's anonymous write function. Every
339
+ * other program links the default object unchanged. */
317
340
  stdioWriteSlot: RuntimeFeatureRule;
318
341
  stream: RuntimeFeatureRule;
319
342
  /** A Dirent row converted to dyn carries Node's Symbol(type) key
@@ -339,6 +362,29 @@ declare const RUNTIME_FEATURE_RULES: {
339
362
  * build column of its own. Every other program keeps the byte-for-byte
340
363
  * default objects. */
341
364
  bigintBytes: RuntimeFeatureRule;
365
+ /** `new Promise` whose executor takes a checked-dynamic reject parameter,
366
+ * and `Promise.withResolvers` on a checked-dynamic promise whose resolver
367
+ * record does: that reason is the program's own value, not an Error, so
368
+ * the emitter builds the reject closure with scr_make_reject_dyn — which
369
+ * lives in the SCR_PROMISE_REJECT_DYN build of scr_async.c. A promise
370
+ * lowered with an Error-taking reject (the typed `util.promisify` family,
371
+ * even for an unknown settled value; any typed `withResolvers`) keeps the
372
+ * default object. Every other program links the default object, byte for
373
+ * byte. */
374
+ promiseRejectDyn: RuntimeFeatureRule;
375
+ /** Sparse arrays (t262 W7): an array whose length exceeds its dense
376
+ * prefix. Only a checked-dynamic member write can produce one, and only a
377
+ * write the source spells an index proves it: a key computed at run time
378
+ * (`a[k] = v`) may name any index, so proving sparseness from it would
379
+ * select this build for every program with a computed write. The elements
380
+ * past the prefix live in the JavaScript object model build (t262-da §J)
381
+ * of scr_json.c and scr_dyn_invoke.c, and that build's keyed read answers
382
+ * `length` from the array's own length instead of the prefix field. The
383
+ * fact ORs into jsObjectModel (jsObjectModelFact), so it selects no build
384
+ * column of its own. Every program that exists today keeps its build:
385
+ * a spelled index or `length` the runtime can place densely stays in the
386
+ * default objects, and a computed one keeps its SC2020 refusal. */
387
+ sparseArrays: RuntimeFeatureRule;
342
388
  /** Module namespace objects as checked-dynamic values
343
389
  * (scr_module_namespace.c). */
344
390
  moduleNamespace: RuntimeFeatureRule;
@@ -351,10 +397,22 @@ declare const RUNTIME_FEATURE_RULES: {
351
397
  mutableBuffers: RuntimeFeatureRule;
352
398
  /** A module namespace boxed for typed code (scr_module_namespace_dyn.c). */
353
399
  moduleNamespaceDyn: RuntimeFeatureRule;
354
- /** Primitive wrapper objects (scr_js_wrapper.c). */
400
+ /** Primitive wrapper objects (scr_js_wrapper.c), which also own
401
+ * Number.prototype and Boolean.prototype: the value a JavaScript source
402
+ * reads through dyn.builtinPrototype, and the compiled constructor's
403
+ * `prototype` member of the same object. */
355
404
  primitiveWrapper: RuntimeFeatureRule;
356
405
  /** %Iterator% and %Iterator.prototype% as values (scr_js_iterator.c). */
357
406
  iteratorProto: RuntimeFeatureRule;
407
+ /** A JavaScript source reads or writes the member named `__proto__` by
408
+ * that literal name on a dynamic value, or builds a literal member with
409
+ * that name: Object.prototype's accessor answers the read with the
410
+ * receiver's [[Prototype]] and the write by replacing it, while a literal
411
+ * member is a property definition, both of which the object model build
412
+ * models (scr_json.c, expr-dynamic.ts). The fact ORs into jsObjectModel
413
+ * (jsObjectModelFact), so a program that names the member links that one
414
+ * build; every other program keeps the default object, byte for byte. */
415
+ protoAccessor: RuntimeFeatureRule;
358
416
  /** The WebAssembly API (scr_wasm.c). */
359
417
  wasm: RuntimeFeatureRule;
360
418
  /** crypto.subtle importKey/sign/verify/digest and CryptoKey:
@@ -65,8 +65,9 @@ const DYN_ASYNC_LIB_FNS = new Set([
65
65
  "async.awaitDyn",
66
66
  // So does SlowBuffer's DEP0030.
67
67
  "buffer.slowBuffer",
68
- // The child property table adopts thenables through the dyn-async unit.
69
- "child.propsInstall",
68
+ // The handle property table adopts child thenables through the dyn-async
69
+ // unit.
70
+ "handle.propsInstall",
70
71
  "child.propsResolve",
71
72
  "crypto.native",
72
73
  // The crypto global's object extends crypto.native's.
@@ -172,6 +173,7 @@ const ASYNC_CONTEXT_LIB_FNS = new Set([
172
173
  const LEGACY_URL_LIB_FNS = new Set([
173
174
  "url.domainToASCII",
174
175
  "url.domainToUnicode",
176
+ "url.legacyClass",
175
177
  "url.legacyFormat",
176
178
  "url.legacyParse",
177
179
  "url.legacyResolve",
@@ -218,6 +220,8 @@ const ABORT_SIGNAL_LIB_FNS = new Set([
218
220
  "http.requestDynCb",
219
221
  "https.requestDyn",
220
222
  "https.requestDynCb",
223
+ "https.requestFnDyn",
224
+ "https.requestFnDynCb",
221
225
  "http.requestUrlDyn",
222
226
  "http.requestUrlDynCb",
223
227
  "https.requestUrlDyn",
@@ -325,9 +329,15 @@ const DYN_INVOKE_LIB_FNS = new Set([
325
329
  "dyn.arrayPrototype",
326
330
  "dyn.builtinFunction",
327
331
  "dyn.builtinMethod",
332
+ "dyn.builtinMethodValue",
328
333
  "dyn.stdlibPrototype",
334
+ "dyn.dataViewPrototype",
329
335
  "dyn.defineProperty",
330
336
  "dyn.definePropertyShapes",
337
+ "handle.propsDefineProps",
338
+ // The table's member test reads inherited prototype members through
339
+ // scr_dyn_invoke.c's scr_dyn_inherited_read.
340
+ "handle.propsInstall",
331
341
  "child.propsDefine",
332
342
  "dyn.defineProps",
333
343
  "dyn.definePropsShapes",
@@ -434,6 +444,9 @@ const SYMBOL_LIB_FNS = new Set([
434
444
  "buffer.staticValue",
435
445
  "buffer.prototypeMember",
436
446
  "buffer.prototypeObject",
447
+ // The array-like unit reads a receiver's @@isConcatSpreadable through
448
+ // scr_sym_well_known before it spreads that receiver's elements.
449
+ "dyn.arrayLikeProtoCall",
437
450
  ]);
438
451
  /** Entry points that link the querystring unit. */
439
452
  const QS_LIB_FNS = new Set([
@@ -641,6 +654,7 @@ const PROCESS_EVENT_LIB_FNS = new Set([
641
654
  "process.stdinIsRaw",
642
655
  "process.stdioSlot",
643
656
  "process.stdioWriteDyn",
657
+ "process.stdioWriteStr",
644
658
  "stdin.nextChunk",
645
659
  "stdin.onData",
646
660
  "stdin.onEnd",
@@ -847,6 +861,158 @@ export function moduleUsesWebCryptoAsymmetric(mod) {
847
861
  });
848
862
  return webcrypto && named;
849
863
  }
864
+ /** Whether a property name spells a canonical array index `String(i)` for
865
+ * an integer i below 2^32 - 1: digits only, and no leading zero unless the
866
+ * whole name is "0". */
867
+ function isIndexString(name) {
868
+ if (name.length === 0 || name.length > 10)
869
+ return false;
870
+ if (name.length > 1 && name[0] === "0")
871
+ return false;
872
+ let index = 0;
873
+ for (let i = 0; i < name.length; i++) {
874
+ const c = name.charCodeAt(i);
875
+ if (c < 48 || c > 57)
876
+ return false;
877
+ index = index * 10 + (c - 48);
878
+ }
879
+ return index < 4294967295;
880
+ }
881
+ /** The index past which an array write cannot materialize its holes: the
882
+ * dense prefix scr_json.c is willing to fill (`+ 1000000`). */
883
+ const SPARSE_INDEX_LIMIT = 1_000_000;
884
+ function literalOf(expr) {
885
+ const raw = expr.kind === "dynFrom" ? expr.value : expr;
886
+ return raw.kind === "numLit" || raw.kind === "strLit" ? raw : undefined;
887
+ }
888
+ /** The canonical index a value spells: a number that is one, or a string
889
+ * that names one. */
890
+ function literalIndex(expr) {
891
+ const lit = literalOf(expr);
892
+ if (lit === undefined)
893
+ return undefined;
894
+ if (lit.kind === "numLit")
895
+ return Number.isInteger(lit.value) && lit.value >= 0 && lit.value < 4294967295
896
+ ? lit.value
897
+ : undefined;
898
+ return isIndexString(lit.value) ? Number(lit.value) : undefined;
899
+ }
900
+ /** The receiver, key and value one dynamic member write takes, or three
901
+ * undefined for any other node. A write is a `dyn.keySet`/`dyn.keySetComputed`
902
+ * call or a call into a class-dispatch stub that carries the stored value
903
+ * (class-dynamic-dispatch.ts `%dyn.class.computed.<n>`). */
904
+ function writeArgs(node) {
905
+ const none = [undefined, undefined, undefined];
906
+ if (node.kind === "libCall") {
907
+ if (node.fn !== "dyn.keySet" && node.fn !== "dyn.keySetComputed")
908
+ return none;
909
+ return [node.args[0], node.args[1], node.args[2]];
910
+ }
911
+ if (node.kind === "call" &&
912
+ node.callee.startsWith("%dyn.class.computed.") &&
913
+ node.args.length >= 3)
914
+ return [node.args[0], node.args[1], node.args[2]];
915
+ return none;
916
+ }
917
+ /** Whether the module writes an array element at an index the source
918
+ * spells past SPARSE_INDEX_LIMIT, or sets `length` to a spelled value past
919
+ * it: the sparse writes a static fact can prove (see the sparseArrays
920
+ * rule). A keyed write evaluates its key into a hidden local first
921
+ * (lower-exprs.ts lowerDynMemberAssignment), so the write reads the literal
922
+ * the source spells back through that local's one definition. */
923
+ function moduleWritesSparseIndex(mod) {
924
+ const literals = new Map();
925
+ const definitions = new Map();
926
+ /** The assigns a global takes. A module-level `const view = typed`
927
+ * initializes its global with an assign rather than a varDecl; a local
928
+ * assigned more than once could hold anything by the time of the write. */
929
+ const assigns = new Map();
930
+ everyModuleNode(mod, {
931
+ expr: () => true,
932
+ stmt: (node) => {
933
+ if (node.kind === "assign") {
934
+ const taken = assigns.get(node.localId);
935
+ if (taken === undefined)
936
+ assigns.set(node.localId, [node.value]);
937
+ else
938
+ taken.push(node.value);
939
+ return true;
940
+ }
941
+ if (node.kind !== "varDecl" || node.init === null)
942
+ return true;
943
+ definitions.set(node.localId, node.init);
944
+ const literal = literalOf(node.init);
945
+ if (literal !== undefined)
946
+ literals.set(node.localId, literal);
947
+ return true;
948
+ },
949
+ type: () => true,
950
+ });
951
+ const reassigned = new Set();
952
+ for (const [localId, values] of assigns) {
953
+ if (values.length === 1)
954
+ definitions.set(localId, values[0]);
955
+ else
956
+ reassigned.add(localId);
957
+ }
958
+ /** The literal behind a hidden local, or the node itself when the
959
+ * lowering spelled it directly. */
960
+ const resolve = (expr) => expr.kind === "varRef" ? literals.get(expr.localId) : literalOf(expr);
961
+ /** Whether the value a local holds, followed through the locals and
962
+ * globals it is copied from, is a live view of a native array (`const
963
+ * view: any = typed`). Such an array already keeps the elements past its
964
+ * dense prefix in its own out-of-line storage (the ScrArr ext), so a far
965
+ * write through the view needs no part of the checked-dynamic array's
966
+ * sparse support: the typed path answers it, in the default build too. */
967
+ const holdsNativeView = (start) => {
968
+ let expr = start;
969
+ for (let hop = 0; hop < 4; hop++) {
970
+ if (expr.kind === "dynFrom") {
971
+ if (expr.value.type.kind === "array")
972
+ return true;
973
+ expr = expr.value;
974
+ continue;
975
+ }
976
+ if (expr.kind !== "varRef" || reassigned.has(expr.localId))
977
+ return false;
978
+ const next = definitions.get(expr.localId);
979
+ if (next === undefined)
980
+ return false;
981
+ expr = next;
982
+ }
983
+ return false;
984
+ };
985
+ const writesNativeView = (receiver) => {
986
+ const init = receiver.kind === "varRef" ? definitions.get(receiver.localId) : undefined;
987
+ return holdsNativeView(init ?? receiver);
988
+ };
989
+ let sparse = false;
990
+ everyModuleNode(mod, {
991
+ expr: (node) => {
992
+ if (sparse)
993
+ return false;
994
+ const [receiver, rawKey, rawValue] = writeArgs(node);
995
+ if (receiver === undefined || rawKey === undefined || rawValue === undefined)
996
+ return true;
997
+ if (writesNativeView(receiver))
998
+ return true;
999
+ const key = resolve(rawKey);
1000
+ const index = key === undefined ? undefined : literalIndex(key);
1001
+ if (index !== undefined && index > SPARSE_INDEX_LIMIT)
1002
+ sparse = true;
1003
+ else if (key?.kind === "strLit" && key.value === "length") {
1004
+ const value = resolve(rawValue);
1005
+ const length = value === undefined ? undefined : literalIndex(value);
1006
+ if (length !== undefined && length > SPARSE_INDEX_LIMIT)
1007
+ sparse = true;
1008
+ }
1009
+ return !sparse;
1010
+ },
1011
+ stmt: () => !sparse,
1012
+ type: () => true,
1013
+ });
1014
+ return sparse;
1015
+ }
850
1016
  /** The typed file reads that answer a ScrBytes: Node answers a Buffer, and
851
1017
  * scr_lib.c's read entries brand it, so a typed read makes a Buffer value. */
852
1018
  const FS_READ_BYTES_FNS = new Set([
@@ -869,6 +1035,19 @@ export const JS_OBJECT_MODEL_LIB_FNS = new Set([
869
1035
  "sharedArrayBuffer.newGrowable",
870
1036
  "arrayBuffer.armMutable",
871
1037
  ]);
1038
+ /** The member name Object.prototype answers as an accessor (protoAccessor):
1039
+ * a dynamic read (`dynKeyGet`) or a dynamic key write names it. */
1040
+ export function isProtoKeyLiteral(node) {
1041
+ return node.kind === "strLit" && node.value === "__proto__";
1042
+ }
1043
+ /** The dynamic key operations whose member-name argument reaches the write
1044
+ * path (dyn.keySet, and the bag entries a JavaScript source's object
1045
+ * literals use). */
1046
+ const PROTO_KEY_LIB_FNS = new Set([
1047
+ "dyn.bagGet",
1048
+ "dyn.bagSet",
1049
+ "dyn.keySet",
1050
+ ]);
872
1051
  /** The JavaScript object model build's program facts (t262-da §J): every
873
1052
  * runtime feature that shares the one SCR_JS_OBJECT_MODEL build ORs in here
874
1053
  * (BigInt views today, array attributes and handle property tables next), so
@@ -877,7 +1056,10 @@ export const JS_OBJECT_MODEL_LIB_FNS = new Set([
877
1056
  export function jsObjectModelFact(features) {
878
1057
  return (features.jsObjectModel === true ||
879
1058
  features.bigintBytes === true ||
880
- features.mutableBuffers === true);
1059
+ features.handleProps === true ||
1060
+ features.mutableBuffers === true ||
1061
+ features.protoAccessor === true ||
1062
+ features.sparseArrays === true);
881
1063
  }
882
1064
  /** One rule per runtime feature, sorted by name. A new feature is an
883
1065
  * entry here and its line in noRuntimeFeatures; RuntimeFeatures, the scan
@@ -928,6 +1110,12 @@ const RUNTIME_FEATURE_RULES = {
928
1110
  childOptionExt: rule({
929
1111
  fns: ["cp.spawnSyncExt", "cp.spawnSyncExtEnv", "cp.execFileCwd"],
930
1112
  }),
1113
+ /** The spawnSync result's `.error` property answers Node's
1114
+ * errnoException fields (errno, syscall, path, spawnargs). The fields
1115
+ * ride a build of scr_child.c of their own (SCR_CHILD_ERR_FIELDS), so a
1116
+ * program that never reads `.error` keeps the default object and the
1117
+ * result container exactly as they were. */
1118
+ childErrorFields: rule({ fns: ["spawnRes.error"] }),
931
1119
  /** scr_cipher.c over the mbedTLS archive; DEP0182 reports through the
932
1120
  * process-warning unit, and unknown output encodings render through the
933
1121
  * inspect unit. WebCrypto's encrypt, decrypt, wrapKey and unwrapKey
@@ -1012,6 +1200,10 @@ const RUNTIME_FEATURE_RULES = {
1012
1200
  /** A standard library prototype object read as a value in a JavaScript
1013
1201
  * source (scr_dyn_stdlib_prototype.c): `Date.prototype`. */
1014
1202
  stdlibPrototypeValue: rule({ fns: ["dyn.stdlibPrototype"] }),
1203
+ /** DataView.prototype read as a value in a JavaScript source, and its
1204
+ * members through it (scr_data_view_proto.c): the getter/setter family's
1205
+ * prototype object. */
1206
+ dataViewPrototypeValue: rule({ fns: ["dyn.dataViewPrototype"] }),
1015
1207
  /** The dynamic global object's answer for the Node globals the native
1016
1208
  * runtime does not implement (scr_global_host_absent.c, plus the
1017
1209
  * SCR_GLOBAL_HOST_ABSENT build of scr_node_builtin.c): a computed read of
@@ -1021,9 +1213,9 @@ const RUNTIME_FEATURE_RULES = {
1021
1213
  * (scr_dyn_array_like.c), which delegates every other name to the
1022
1214
  * dyn-invoke unit's array dispatch. */
1023
1215
  arrayLikeDispatch: rule({ fns: ["dyn.arrayLikeProtoCall"] }),
1024
- /** Number.prototype and Boolean.prototype as values
1025
- * (scr_dyn_builtin_prototype.c). */
1026
- builtinPrototypeValue: rule({ fns: ["dyn.builtinPrototype"] }),
1216
+ /** A builtin prototype method as a function value (String's trim family,
1217
+ * RegExp's exec/test/toString; scr_dyn_builtin_methods.c). */
1218
+ builtinMethodValue: rule({ fns: ["dyn.builtinMethodValue"] }),
1027
1219
  dynInvoke: rule({
1028
1220
  initial: (mod) => mod.workers === true,
1029
1221
  scan: computedBufferMemberScan,
@@ -1067,8 +1259,9 @@ const RUNTIME_FEATURE_RULES = {
1067
1259
  streamDyn: rule({
1068
1260
  fns: ["stream.dynNative", "stream.dynNativePipe", "stream.pipeDyn", "stream.unpipeDyn"],
1069
1261
  }),
1070
- /** Own properties JavaScript adds to children (scr_dyn_handle_props.c). */
1071
- handleProps: rule({ fns: ["child.propsInstall"] }),
1262
+ /** Own properties JavaScript adds to runtime handles (scr_dyn_handle_props.c):
1263
+ * a Date, RegExp, Map, Set, weak collection, buffer or child. */
1264
+ handleProps: rule({ fns: ["handle.propsInstall", "handle.propsGrant"] }),
1072
1265
  /** The declaration-typed boundary's adoption (scr_decl_adopt.c): its
1073
1266
  * casts, and closures boxed in a boundary program, which adopt their
1074
1267
  * arguments. */
@@ -1167,6 +1360,11 @@ const RUNTIME_FEATURE_RULES = {
1167
1360
  mime: rule({ prefixes: ["mime."] }),
1168
1361
  /** Web streams in checked-dynamic code (scr_webstreams.c). */
1169
1362
  webStreams: rule({ prefixes: ["webstream."] }),
1363
+ /** A program that builds a Blob or File can hand one to fetch: selects
1364
+ * scr_fetch.c's SCR_WEB_BODIES build, which sends the blob's bytes and
1365
+ * type as Node does. Every other program keeps the default fetch unit,
1366
+ * byte for byte. */
1367
+ webBodies: rule({ prefixes: ["blob."] }),
1170
1368
  /** AbortController and AbortSignal (scr_abort.c, or the fetch unit).
1171
1369
  * A WritableStream controller's signal is one (scr_webstreams.c). */
1172
1370
  abortSignal: rule({ prefixes: ["abort.", "webstream."] }),
@@ -1321,12 +1519,15 @@ const RUNTIME_FEATURE_RULES = {
1321
1519
  streamWriteErrors: rule({ fns: ["writable.writeEcb"] }),
1322
1520
  /** The program reaches the process output streams' write slot — the
1323
1521
  * write method as a value (process.stdioSlot), its replacement, a patched
1324
- * program's typed writes, or a run-time-typed chunk
1325
- * (process.stdioWriteDyn): the SCR_STDIO_WRITE_SLOT build of the events
1326
- * unit carries the shared write body, the dynamic-chunk entry point and
1327
- * Node's anonymous write function. Every other program links the default
1328
- * object, byte for byte. */
1329
- stdioWriteSlot: rule({ fns: ["process.stdioSlot", "process.stdioWriteDyn"] }),
1522
+ * program's typed writes, a run-time-typed chunk
1523
+ * (process.stdioWriteDyn), or the untyped one-string write
1524
+ * (process.stdioWriteStr): the SCR_STDIO_WRITE_SLOT build of the events
1525
+ * unit carries the shared write body, the dynamic-chunk entry point,
1526
+ * the string entry point and Node's anonymous write function. Every
1527
+ * other program links the default object unchanged. */
1528
+ stdioWriteSlot: rule({
1529
+ fns: ["process.stdioSlot", "process.stdioWriteDyn", "process.stdioWriteStr"],
1530
+ }),
1330
1531
  stream: rule({
1331
1532
  initial: (mod) => (mod.classes ?? []).some((c) => RUNTIME_STREAM_CLASSES.has(c.name)),
1332
1533
  fns: [...STREAM_LIB_FNS, "dyn.builtinStreamClass"],
@@ -1370,6 +1571,50 @@ const RUNTIME_FEATURE_RULES = {
1370
1571
  node.args[0]?.kind === "strLit" &&
1371
1572
  BIGINT_BYTES_NAMES.has(node.args[0].value),
1372
1573
  }),
1574
+ /** `new Promise` whose executor takes a checked-dynamic reject parameter,
1575
+ * and `Promise.withResolvers` on a checked-dynamic promise whose resolver
1576
+ * record does: that reason is the program's own value, not an Error, so
1577
+ * the emitter builds the reject closure with scr_make_reject_dyn — which
1578
+ * lives in the SCR_PROMISE_REJECT_DYN build of scr_async.c. A promise
1579
+ * lowered with an Error-taking reject (the typed `util.promisify` family,
1580
+ * even for an unknown settled value; any typed `withResolvers`) keeps the
1581
+ * default object. Every other program links the default object, byte for
1582
+ * byte. */
1583
+ promiseRejectDyn: rule({
1584
+ expr: (node, tables) => {
1585
+ if (node.kind === "newPromise")
1586
+ return (node.type.kind === "promise" &&
1587
+ node.type.inner.kind === "dyn" &&
1588
+ node.executor.type.kind === "func" &&
1589
+ node.executor.type.params.length === 2 &&
1590
+ node.executor.type.params[1] !== undefined &&
1591
+ node.executor.type.params[1].kind === "func" &&
1592
+ node.executor.type.params[1].params[0] !== undefined &&
1593
+ node.executor.type.params[1].params[0].kind === "dyn");
1594
+ if (node.kind !== "promiseWithResolvers" || node.type.kind !== "record")
1595
+ return false;
1596
+ const shape = tables().records.get(node.type.shapeId);
1597
+ const promT = shape?.fields.find((f) => f.name === "promise")?.type;
1598
+ const rejectT = shape?.fields.find((f) => f.name === "reject")?.type;
1599
+ return (promT?.kind === "promise" &&
1600
+ promT.inner.kind === "dyn" &&
1601
+ rejectT?.kind === "func" &&
1602
+ rejectT.params[0]?.kind === "dyn");
1603
+ },
1604
+ }),
1605
+ /** Sparse arrays (t262 W7): an array whose length exceeds its dense
1606
+ * prefix. Only a checked-dynamic member write can produce one, and only a
1607
+ * write the source spells an index proves it: a key computed at run time
1608
+ * (`a[k] = v`) may name any index, so proving sparseness from it would
1609
+ * select this build for every program with a computed write. The elements
1610
+ * past the prefix live in the JavaScript object model build (t262-da §J)
1611
+ * of scr_json.c and scr_dyn_invoke.c, and that build's keyed read answers
1612
+ * `length` from the array's own length instead of the prefix field. The
1613
+ * fact ORs into jsObjectModel (jsObjectModelFact), so it selects no build
1614
+ * column of its own. Every program that exists today keeps its build:
1615
+ * a spelled index or `length` the runtime can place densely stays in the
1616
+ * default objects, and a computed one keeps its SC2020 refusal. */
1617
+ sparseArrays: rule({ initial: (mod) => moduleWritesSparseIndex(mod) }),
1373
1618
  /** Module namespace objects as checked-dynamic values
1374
1619
  * (scr_module_namespace.c). */
1375
1620
  moduleNamespace: rule({ fns: ["module.namespaceValue"] }),
@@ -1384,10 +1629,27 @@ const RUNTIME_FEATURE_RULES = {
1384
1629
  }),
1385
1630
  /** A module namespace boxed for typed code (scr_module_namespace_dyn.c). */
1386
1631
  moduleNamespaceDyn: rule({ fns: ["module.namespaceDyn"] }),
1387
- /** Primitive wrapper objects (scr_js_wrapper.c). */
1388
- primitiveWrapper: rule({ prefixes: ["wrapper."] }),
1632
+ /** Primitive wrapper objects (scr_js_wrapper.c), which also own
1633
+ * Number.prototype and Boolean.prototype: the value a JavaScript source
1634
+ * reads through dyn.builtinPrototype, and the compiled constructor's
1635
+ * `prototype` member of the same object. */
1636
+ primitiveWrapper: rule({ prefixes: ["wrapper."], fns: ["dyn.builtinPrototype"] }),
1389
1637
  /** %Iterator% and %Iterator.prototype% as values (scr_js_iterator.c). */
1390
1638
  iteratorProto: rule({ prefixes: ["iterator."] }),
1639
+ /** A JavaScript source reads or writes the member named `__proto__` by
1640
+ * that literal name on a dynamic value, or builds a literal member with
1641
+ * that name: Object.prototype's accessor answers the read with the
1642
+ * receiver's [[Prototype]] and the write by replacing it, while a literal
1643
+ * member is a property definition, both of which the object model build
1644
+ * models (scr_json.c, expr-dynamic.ts). The fact ORs into jsObjectModel
1645
+ * (jsObjectModelFact), so a program that names the member links that one
1646
+ * build; every other program keeps the default object, byte for byte. */
1647
+ protoAccessor: rule({
1648
+ expr: (node) => (node.kind === "dynKeyGet" && isProtoKeyLiteral(node.key)) ||
1649
+ (node.kind === "dynObjLit" &&
1650
+ (node.fields ?? []).some((field) => isProtoKeyLiteral(field.key))),
1651
+ libCall: (node) => PROTO_KEY_LIB_FNS.has(node.fn) && node.args.some((arg) => isProtoKeyLiteral(arg)),
1652
+ }),
1391
1653
  /** The WebAssembly API (scr_wasm.c). */
1392
1654
  wasm: rule({ prefixes: ["wasm."] }),
1393
1655
  /** crypto.subtle importKey/sign/verify/digest and CryptoKey:
@@ -1480,10 +1742,11 @@ function noRuntimeFeatures() {
1480
1742
  dynBuiltinClass: false,
1481
1743
  dynBuiltinStream: false,
1482
1744
  stdlibPrototypeValue: false,
1745
+ dataViewPrototypeValue: false,
1483
1746
  hostAbsentGlobals: false,
1484
1747
  dynInvoke: false,
1485
1748
  arrayLikeDispatch: false,
1486
- builtinPrototypeValue: false,
1749
+ builtinMethodValue: false,
1487
1750
  dynTier: false,
1488
1751
  ecdh: false,
1489
1752
  x509: false,
@@ -1505,6 +1768,7 @@ function noRuntimeFeatures() {
1505
1768
  mutableBuffers: false,
1506
1769
  legacyTextDecoder: false,
1507
1770
  mime: false,
1771
+ webBodies: false,
1508
1772
  webStreams: false,
1509
1773
  abortSignal: false,
1510
1774
  utilTiming: false,
@@ -1530,12 +1794,14 @@ function noRuntimeFeatures() {
1530
1794
  moduleNamespaceDyn: false,
1531
1795
  primitiveWrapper: false,
1532
1796
  iteratorProto: false,
1797
+ protoAccessor: false,
1533
1798
  stream: false,
1534
1799
  strdecDyn: false,
1535
1800
  streamDyn: false,
1536
1801
  handleProps: false,
1537
1802
  childLifecycle: false,
1538
1803
  childOptionExt: false,
1804
+ childErrorFields: false,
1539
1805
  declAdopt: false,
1540
1806
  typeOrigins: false,
1541
1807
  dynForAwait: false,
@@ -1551,7 +1817,9 @@ function noRuntimeFeatures() {
1551
1817
  tlsCa: false,
1552
1818
  utilPromisify: false,
1553
1819
  warningReplace: false,
1820
+ promiseRejectDyn: false,
1554
1821
  bigintBytes: false,
1822
+ sparseArrays: false,
1555
1823
  wasm: false,
1556
1824
  webcrypto: false,
1557
1825
  zlib: false,