@scriptc/compiler 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +2 -0
  2. package/dist/backend/llvm/alloc.d.ts +3 -0
  3. package/dist/backend/llvm/alloc.js +54 -13
  4. package/dist/backend/llvm/alloc.js.map +1 -1
  5. package/dist/backend/llvm/blocks.d.ts +9 -0
  6. package/dist/backend/llvm/blocks.js +9 -0
  7. package/dist/backend/llvm/blocks.js.map +1 -1
  8. package/dist/backend/llvm/borrowed-receivers.d.ts +7 -0
  9. package/dist/backend/llvm/borrowed-receivers.js +39 -0
  10. package/dist/backend/llvm/borrowed-receivers.js.map +1 -1
  11. package/dist/backend/llvm/call-lifetimes.d.ts +4 -1
  12. package/dist/backend/llvm/call-lifetimes.js +14 -3
  13. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  14. package/dist/backend/llvm/call-lifetimes.test.js +8 -3
  15. package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
  16. package/dist/backend/llvm/checked-narrows.d.ts +24 -0
  17. package/dist/backend/llvm/checked-narrows.js +108 -0
  18. package/dist/backend/llvm/checked-narrows.js.map +1 -0
  19. package/dist/backend/llvm/checked-narrows.test.d.ts +1 -0
  20. package/dist/backend/llvm/checked-narrows.test.js +208 -0
  21. package/dist/backend/llvm/checked-narrows.test.js.map +1 -0
  22. package/dist/backend/llvm/classes.d.ts +13 -1
  23. package/dist/backend/llvm/classes.js +26 -18
  24. package/dist/backend/llvm/classes.js.map +1 -1
  25. package/dist/backend/llvm/classes.test.js +32 -3
  26. package/dist/backend/llvm/classes.test.js.map +1 -1
  27. package/dist/backend/llvm/debug-info.d.ts +6 -2
  28. package/dist/backend/llvm/debug-info.js +11 -1
  29. package/dist/backend/llvm/debug-info.js.map +1 -1
  30. package/dist/backend/llvm/dense-array-access.test.js +89 -0
  31. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  32. package/dist/backend/llvm/dyn.d.ts +4 -0
  33. package/dist/backend/llvm/dyn.js +31 -20
  34. package/dist/backend/llvm/dyn.js.map +1 -1
  35. package/dist/backend/llvm/emitter.d.ts +184 -11
  36. package/dist/backend/llvm/emitter.js +1189 -125
  37. package/dist/backend/llvm/emitter.js.map +1 -1
  38. package/dist/backend/llvm/emitter.test.js +21 -1
  39. package/dist/backend/llvm/emitter.test.js.map +1 -1
  40. package/dist/backend/llvm/expr-async.js +4 -4
  41. package/dist/backend/llvm/expr-async.js.map +1 -1
  42. package/dist/backend/llvm/expr-bytes.d.ts +1 -1
  43. package/dist/backend/llvm/expr-bytes.js +85 -8
  44. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  45. package/dist/backend/llvm/expr-callbacks.js +29 -21
  46. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  47. package/dist/backend/llvm/expr-calls.d.ts +5 -0
  48. package/dist/backend/llvm/expr-calls.js +55 -10
  49. package/dist/backend/llvm/expr-calls.js.map +1 -1
  50. package/dist/backend/llvm/expr-containers.d.ts +7 -1
  51. package/dist/backend/llvm/expr-containers.js +230 -27
  52. package/dist/backend/llvm/expr-containers.js.map +1 -1
  53. package/dist/backend/llvm/expr-control.js +25 -10
  54. package/dist/backend/llvm/expr-control.js.map +1 -1
  55. package/dist/backend/llvm/expr-dynamic.js +72 -21
  56. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  57. package/dist/backend/llvm/expr-island.js +3 -8
  58. package/dist/backend/llvm/expr-island.js.map +1 -1
  59. package/dist/backend/llvm/expr-primitives.js +41 -12
  60. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  61. package/dist/backend/llvm/expr-primitives.test.js +50 -2
  62. package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
  63. package/dist/backend/llvm/expr-records.js +28 -14
  64. package/dist/backend/llvm/expr-records.js.map +1 -1
  65. package/dist/backend/llvm/expr-stream-bridges.js +41 -31
  66. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  67. package/dist/backend/llvm/expr-stream-callbacks.js +6 -3
  68. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  69. package/dist/backend/llvm/layouts.d.ts +2 -1
  70. package/dist/backend/llvm/layouts.js +2 -2
  71. package/dist/backend/llvm/layouts.js.map +1 -1
  72. package/dist/backend/llvm/lib-abi.js +10 -0
  73. package/dist/backend/llvm/lib-abi.js.map +1 -1
  74. package/dist/backend/llvm/lib-filesystem.js +7 -11
  75. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  76. package/dist/backend/llvm/lib-process.js +8 -8
  77. package/dist/backend/llvm/lib-process.js.map +1 -1
  78. package/dist/backend/llvm/lib-shared.js +1 -0
  79. package/dist/backend/llvm/lib-shared.js.map +1 -1
  80. package/dist/backend/llvm/local-array-reads.js +73 -13
  81. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  82. package/dist/backend/llvm/local-array-reads.test.js +7 -3
  83. package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
  84. package/dist/backend/llvm/local-union-storage.js +10 -6
  85. package/dist/backend/llvm/local-union-storage.js.map +1 -1
  86. package/dist/backend/llvm/local-union-storage.test.js +3 -2
  87. package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
  88. package/dist/backend/llvm/map-number-lookup.d.ts +18 -0
  89. package/dist/backend/llvm/map-number-lookup.js +62 -0
  90. package/dist/backend/llvm/map-number-lookup.js.map +1 -0
  91. package/dist/backend/llvm/map-read-lifetimes.d.ts +6 -0
  92. package/dist/backend/llvm/map-read-lifetimes.js +24 -3
  93. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  94. package/dist/backend/llvm/map-read-lifetimes.test.js +38 -19
  95. package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
  96. package/dist/backend/llvm/nullable-unions.d.ts +68 -0
  97. package/dist/backend/llvm/nullable-unions.js +132 -0
  98. package/dist/backend/llvm/nullable-unions.js.map +1 -0
  99. package/dist/backend/llvm/publish.d.ts +58 -0
  100. package/dist/backend/llvm/publish.js +286 -0
  101. package/dist/backend/llvm/publish.js.map +1 -0
  102. package/dist/backend/llvm/rebound-parameters.d.ts +12 -0
  103. package/dist/backend/llvm/rebound-parameters.js +72 -0
  104. package/dist/backend/llvm/rebound-parameters.js.map +1 -0
  105. package/dist/backend/llvm/rebound-parameters.test.d.ts +1 -0
  106. package/dist/backend/llvm/rebound-parameters.test.js +67 -0
  107. package/dist/backend/llvm/rebound-parameters.test.js.map +1 -0
  108. package/dist/backend/llvm/reference-effects.d.ts +18 -2
  109. package/dist/backend/llvm/reference-effects.js +106 -16
  110. package/dist/backend/llvm/reference-effects.js.map +1 -1
  111. package/dist/backend/llvm/reference-effects.test.js +52 -1
  112. package/dist/backend/llvm/reference-effects.test.js.map +1 -1
  113. package/dist/backend/llvm/shapes.d.ts +45 -17
  114. package/dist/backend/llvm/shapes.js +131 -53
  115. package/dist/backend/llvm/shapes.js.map +1 -1
  116. package/dist/backend/llvm/shapes.test.js +33 -8
  117. package/dist/backend/llvm/shapes.test.js.map +1 -1
  118. package/dist/backend/llvm/stack-unions.test.js +5 -2
  119. package/dist/backend/llvm/stack-unions.test.js.map +1 -1
  120. package/dist/backend/llvm/string-construction.d.ts +10 -0
  121. package/dist/backend/llvm/string-construction.js +42 -0
  122. package/dist/backend/llvm/string-construction.js.map +1 -1
  123. package/dist/backend/llvm/string-key-hash.d.ts +9 -2
  124. package/dist/backend/llvm/string-key-hash.js +20 -3
  125. package/dist/backend/llvm/string-key-hash.js.map +1 -1
  126. package/dist/backend/llvm/string-key-hash.test.js +14 -3
  127. package/dist/backend/llvm/string-key-hash.test.js.map +1 -1
  128. package/dist/backend/llvm/string-lifetimes.test.js +24 -11
  129. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  130. package/dist/backend/llvm/string-reads.d.ts +7 -0
  131. package/dist/backend/llvm/string-reads.js +76 -0
  132. package/dist/backend/llvm/string-reads.js.map +1 -0
  133. package/dist/backend/llvm/switch-dispatch.test.js +1 -1
  134. package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
  135. package/dist/backend/llvm/test-boxed-unions.d.ts +5 -0
  136. package/dist/backend/llvm/test-boxed-unions.js +13 -0
  137. package/dist/backend/llvm/test-boxed-unions.js.map +1 -0
  138. package/dist/backend/llvm/union-repr.d.ts +15 -0
  139. package/dist/backend/llvm/union-repr.js +89 -0
  140. package/dist/backend/llvm/union-repr.js.map +1 -0
  141. package/dist/backend/llvm/virtual-borrows.d.ts +31 -0
  142. package/dist/backend/llvm/virtual-borrows.js +82 -0
  143. package/dist/backend/llvm/virtual-borrows.js.map +1 -0
  144. package/dist/backend/llvm/walk-borrows.d.ts +43 -0
  145. package/dist/backend/llvm/walk-borrows.js +150 -0
  146. package/dist/backend/llvm/walk-borrows.js.map +1 -0
  147. package/dist/backend/llvm/walk-borrows.test.d.ts +1 -0
  148. package/dist/backend/llvm/walk-borrows.test.js +119 -0
  149. package/dist/backend/llvm/walk-borrows.test.js.map +1 -0
  150. package/dist/backend/llvm/walkers.d.ts +5 -1
  151. package/dist/backend/llvm/walkers.js +24 -21
  152. package/dist/backend/llvm/walkers.js.map +1 -1
  153. package/dist/backend/may-throw.d.ts +29 -1
  154. package/dist/backend/may-throw.js +346 -3
  155. package/dist/backend/may-throw.js.map +1 -1
  156. package/dist/backend/may-throw.test.js +113 -1
  157. package/dist/backend/may-throw.test.js.map +1 -1
  158. package/dist/backend/native/runtime-inputs.d.ts +1 -1
  159. package/dist/backend/native/runtime-inputs.js +1 -0
  160. package/dist/backend/native/runtime-inputs.js.map +1 -1
  161. package/dist/backend/native-codegen-core.d.ts +7 -5
  162. package/dist/backend/native-codegen-core.js +14 -9
  163. package/dist/backend/native-codegen-core.js.map +1 -1
  164. package/dist/backend/native-codegen.d.ts +4 -0
  165. package/dist/backend/native-codegen.js +49 -2
  166. package/dist/backend/native-codegen.js.map +1 -1
  167. package/dist/backend/native-codegen.test.js +41 -10
  168. package/dist/backend/native-codegen.test.js.map +1 -1
  169. package/dist/backend/native-tools.d.ts +2 -0
  170. package/dist/backend/native-tools.js +3 -0
  171. package/dist/backend/native-tools.js.map +1 -1
  172. package/dist/backend/publication.d.ts +28 -0
  173. package/dist/backend/publication.js +155 -0
  174. package/dist/backend/publication.js.map +1 -0
  175. package/dist/backend/publication.test.d.ts +1 -0
  176. package/dist/backend/publication.test.js +72 -0
  177. package/dist/backend/publication.test.js.map +1 -0
  178. package/dist/backend/runtime-abi.d.ts +2 -2
  179. package/dist/backend/runtime-abi.js +2 -2
  180. package/dist/backend/runtime-pack-targets.test.js +1 -1
  181. package/dist/backend/runtime-pack.test.js +1 -1
  182. package/dist/cli/command.js +70 -7
  183. package/dist/cli/command.js.map +1 -1
  184. package/dist/cli/usage.d.ts +4 -1
  185. package/dist/cli/usage.js +8 -1
  186. package/dist/cli/usage.js.map +1 -1
  187. package/dist/compile-types.d.ts +12 -3
  188. package/dist/coverage/report.d.ts +25 -2
  189. package/dist/coverage/report.js +161 -33
  190. package/dist/coverage/report.js.map +1 -1
  191. package/dist/coverage/verdict-cache.d.ts +63 -0
  192. package/dist/coverage/verdict-cache.js +193 -0
  193. package/dist/coverage/verdict-cache.js.map +1 -0
  194. package/dist/coverage/verdict-cache.test.d.ts +1 -0
  195. package/dist/coverage/verdict-cache.test.js +52 -0
  196. package/dist/coverage/verdict-cache.test.js.map +1 -0
  197. package/dist/coverage/verdict-semantic.d.ts +2 -0
  198. package/dist/coverage/verdict-semantic.js +24 -0
  199. package/dist/coverage/verdict-semantic.js.map +1 -0
  200. package/dist/coverage/verdict-startup.d.ts +15 -0
  201. package/dist/coverage/verdict-startup.js +66 -0
  202. package/dist/coverage/verdict-startup.js.map +1 -0
  203. package/dist/diagnostics/diagnostic.d.ts +29 -1
  204. package/dist/diagnostics/diagnostic.js +74 -4
  205. package/dist/diagnostics/diagnostic.js.map +1 -1
  206. package/dist/diagnostics/envelope.d.ts +130 -0
  207. package/dist/diagnostics/envelope.js +257 -0
  208. package/dist/diagnostics/envelope.js.map +1 -0
  209. package/dist/diagnostics/envelope.test.d.ts +1 -0
  210. package/dist/diagnostics/envelope.test.js +91 -0
  211. package/dist/diagnostics/envelope.test.js.map +1 -0
  212. package/dist/diagnostics/render.d.ts +3 -0
  213. package/dist/diagnostics/render.js +13 -2
  214. package/dist/diagnostics/render.js.map +1 -1
  215. package/dist/executable/prepare.d.ts +4 -0
  216. package/dist/executable/prepare.js +7 -1
  217. package/dist/executable/prepare.js.map +1 -1
  218. package/dist/frontend/analysis.js +1 -0
  219. package/dist/frontend/analysis.js.map +1 -1
  220. package/dist/frontend/lowering/array-values.d.ts +7 -0
  221. package/dist/frontend/lowering/array-values.js +120 -4
  222. package/dist/frontend/lowering/array-values.js.map +1 -1
  223. package/dist/frontend/lowering/builtins/numbers.js +29 -1
  224. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  225. package/dist/frontend/lowering/builtins/process.d.ts +4 -0
  226. package/dist/frontend/lowering/builtins/process.js +10 -0
  227. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  228. package/dist/frontend/lowering/builtins/workers.js +4 -2
  229. package/dist/frontend/lowering/builtins/workers.js.map +1 -1
  230. package/dist/frontend/lowering/class-assertions.d.ts +8 -0
  231. package/dist/frontend/lowering/class-assertions.js +217 -1
  232. package/dist/frontend/lowering/class-assertions.js.map +1 -1
  233. package/dist/frontend/lowering/class-dynamic-dispatch.js +8 -5
  234. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  235. package/dist/frontend/lowering/coercions/state.d.ts +6 -0
  236. package/dist/frontend/lowering/coercions/state.js +2 -0
  237. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  238. package/dist/frontend/lowering/coercions/unions.d.ts +8 -0
  239. package/dist/frontend/lowering/coercions/unions.js +67 -2
  240. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  241. package/dist/frontend/lowering/collation-repertoire.d.ts +1 -0
  242. package/dist/frontend/lowering/collation-repertoire.js +19 -0
  243. package/dist/frontend/lowering/collation-repertoire.js.map +1 -0
  244. package/dist/frontend/lowering/construction-escapes.d.ts +38 -0
  245. package/dist/frontend/lowering/construction-escapes.js +146 -0
  246. package/dist/frontend/lowering/construction-escapes.js.map +1 -0
  247. package/dist/frontend/lowering/construction-escapes.test.d.ts +1 -0
  248. package/dist/frontend/lowering/construction-escapes.test.js +150 -0
  249. package/dist/frontend/lowering/construction-escapes.test.js.map +1 -0
  250. package/dist/frontend/lowering/containers/array-callbacks.js +81 -44
  251. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  252. package/dist/frontend/lowering/containers/array-construction.js +15 -2
  253. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  254. package/dist/frontend/lowering/containers/array-methods.js +231 -12
  255. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  256. package/dist/frontend/lowering/containers/callback-arguments.js +43 -1
  257. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  258. package/dist/frontend/lowering/containers/string-and-regexp.js +7 -63
  259. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  260. package/dist/frontend/lowering/cycle-initialization.d.ts +6 -1
  261. package/dist/frontend/lowering/cycle-initialization.js +59 -33
  262. package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
  263. package/dist/frontend/lowering/divergences.d.ts +9 -0
  264. package/dist/frontend/lowering/divergences.js +630 -0
  265. package/dist/frontend/lowering/divergences.js.map +1 -0
  266. package/dist/frontend/lowering/expressions/object-literals.js +40 -2
  267. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  268. package/dist/frontend/lowering/lower-calls.d.ts +5 -0
  269. package/dist/frontend/lowering/lower-calls.js +226 -157
  270. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  271. package/dist/frontend/lowering/lower-classes.d.ts +4 -0
  272. package/dist/frontend/lowering/lower-classes.js +72 -22
  273. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  274. package/dist/frontend/lowering/lower-exprs.d.ts +13 -0
  275. package/dist/frontend/lowering/lower-exprs.js +431 -107
  276. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  277. package/dist/frontend/lowering/lower-generators.d.ts +19 -13
  278. package/dist/frontend/lowering/lower-generators.js +67 -44
  279. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  280. package/dist/frontend/lowering/lower-inspect.js +3 -2
  281. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  282. package/dist/frontend/lowering/lower-island.d.ts +1 -1
  283. package/dist/frontend/lowering/lower-island.js +24 -7
  284. package/dist/frontend/lowering/lower-island.js.map +1 -1
  285. package/dist/frontend/lowering/lower-modules.js +90 -1
  286. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  287. package/dist/frontend/lowering/lower-stmts.js +36 -6
  288. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  289. package/dist/frontend/lowering/lowerer.d.ts +78 -2
  290. package/dist/frontend/lowering/lowerer.js +986 -73
  291. package/dist/frontend/lowering/lowerer.js.map +1 -1
  292. package/dist/frontend/lowering/runtime-optional-bounds.d.ts +19 -0
  293. package/dist/frontend/lowering/runtime-optional-bounds.js +354 -0
  294. package/dist/frontend/lowering/runtime-optional-bounds.js.map +1 -0
  295. package/dist/frontend/lowering/runtime-optional-bounds.test.d.ts +1 -0
  296. package/dist/frontend/lowering/runtime-optional-bounds.test.js +66 -0
  297. package/dist/frontend/lowering/runtime-optional-bounds.test.js.map +1 -0
  298. package/dist/frontend/lowering/runtime-optional-elements.d.ts +117 -0
  299. package/dist/frontend/lowering/runtime-optional-elements.js +738 -0
  300. package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -0
  301. package/dist/frontend/lowering/runtime-optional-guards.d.ts +36 -0
  302. package/dist/frontend/lowering/runtime-optional-guards.js +375 -0
  303. package/dist/frontend/lowering/runtime-optional-guards.js.map +1 -0
  304. package/dist/frontend/lowering/runtime-optional-guards.test.d.ts +1 -0
  305. package/dist/frontend/lowering/runtime-optional-guards.test.js +92 -0
  306. package/dist/frontend/lowering/runtime-optional-guards.test.js.map +1 -0
  307. package/dist/frontend/lowering/runtime-optional-ownership.d.ts +63 -0
  308. package/dist/frontend/lowering/runtime-optional-ownership.js +382 -0
  309. package/dist/frontend/lowering/runtime-optional-ownership.js.map +1 -0
  310. package/dist/frontend/lowering/runtime-optional-provenance.d.ts +2 -1
  311. package/dist/frontend/lowering/runtime-optional-provenance.js +2 -1
  312. package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
  313. package/dist/frontend/lowering/string-index-bounds.d.ts +36 -0
  314. package/dist/frontend/lowering/string-index-bounds.js +537 -0
  315. package/dist/frontend/lowering/string-index-bounds.js.map +1 -0
  316. package/dist/frontend/lowering/string-index-bounds.test.d.ts +1 -0
  317. package/dist/frontend/lowering/string-index-bounds.test.js +223 -0
  318. package/dist/frontend/lowering/string-index-bounds.test.js.map +1 -0
  319. package/dist/frontend/lowering/union-narrow.d.ts +2 -0
  320. package/dist/frontend/lowering/union-narrow.js +10 -6
  321. package/dist/frontend/lowering/union-narrow.js.map +1 -1
  322. package/dist/frontend/program-analysis.d.ts +10 -0
  323. package/dist/frontend/program-analysis.js +7 -0
  324. package/dist/frontend/program-analysis.js.map +1 -1
  325. package/dist/frontend/program.d.ts +25 -0
  326. package/dist/frontend/program.js +613 -17
  327. package/dist/frontend/program.js.map +1 -1
  328. package/dist/frontend/program.test.js +64 -1
  329. package/dist/frontend/program.test.js.map +1 -1
  330. package/dist/frontend/resolve.d.ts +6 -0
  331. package/dist/frontend/resolve.js +14 -0
  332. package/dist/frontend/resolve.js.map +1 -1
  333. package/dist/frontend/threads-import.d.ts +5 -0
  334. package/dist/frontend/threads-import.js +21 -0
  335. package/dist/frontend/threads-import.js.map +1 -0
  336. package/dist/frontend/type-mapper.d.ts +3 -0
  337. package/dist/frontend/type-mapper.js +72 -6
  338. package/dist/frontend/type-mapper.js.map +1 -1
  339. package/dist/frontend/worker-target.d.ts +4 -0
  340. package/dist/frontend/worker-target.js +8 -1
  341. package/dist/frontend/worker-target.js.map +1 -1
  342. package/dist/index.d.ts +6 -1
  343. package/dist/index.js +47 -9
  344. package/dist/index.js.map +1 -1
  345. package/dist/ir/build.d.ts +5 -0
  346. package/dist/ir/build.js +7 -0
  347. package/dist/ir/build.js.map +1 -1
  348. package/dist/ir/builtin-signatures.d.ts +1 -1
  349. package/dist/ir/builtin-signatures.js +3 -0
  350. package/dist/ir/builtin-signatures.js.map +1 -1
  351. package/dist/ir/int32-slots.d.ts +72 -0
  352. package/dist/ir/int32-slots.js +837 -0
  353. package/dist/ir/int32-slots.js.map +1 -0
  354. package/dist/ir/int32-slots.test.d.ts +1 -0
  355. package/dist/ir/int32-slots.test.js +222 -0
  356. package/dist/ir/int32-slots.test.js.map +1 -0
  357. package/dist/ir/integer-ranges.d.ts +19 -3
  358. package/dist/ir/integer-ranges.js +168 -23
  359. package/dist/ir/integer-ranges.js.map +1 -1
  360. package/dist/ir/integer-ranges.test.js +74 -2
  361. package/dist/ir/integer-ranges.test.js.map +1 -1
  362. package/dist/ir/ir.d.ts +24 -6
  363. package/dist/ir/ir.js.map +1 -1
  364. package/dist/ir/validate.js +21 -2
  365. package/dist/ir/validate.js.map +1 -1
  366. package/dist/ir/validate.test.js +39 -0
  367. package/dist/ir/validate.test.js.map +1 -1
  368. package/dist/native/cache.d.ts +3 -0
  369. package/dist/native/cache.js +49 -1
  370. package/dist/native/cache.js.map +1 -1
  371. package/dist/native/cache.test.js +21 -1
  372. package/dist/native/cache.test.js.map +1 -1
  373. package/dist/native/cli.js +1 -1
  374. package/dist/native/cli.js.map +1 -1
  375. package/dist/native/compiler.d.ts +5 -0
  376. package/dist/native/compiler.js +51 -4
  377. package/dist/native/compiler.js.map +1 -1
  378. package/dist/native/prepare.d.ts +4 -0
  379. package/dist/native/prepare.js +2 -1
  380. package/dist/native/prepare.js.map +1 -1
  381. package/dist/startup-cache.d.ts +2 -0
  382. package/dist/startup-cache.js +2 -0
  383. package/dist/startup-cache.js.map +1 -1
  384. package/package.json +20 -20
  385. package/surface-manifest.json +1 -1
@@ -201,11 +201,24 @@ function adoptProjectConfig7(host, entryPath) {
201
201
  adopted["paths"] = paths;
202
202
  }
203
203
  const nullChecks = adopted["strictNullChecks"] ?? adopted["strict"] ?? false;
204
- if (nullChecks !== true) {
204
+ const forcedStrictNullChecks = nullChecks !== true;
205
+ if (forcedStrictNullChecks) {
205
206
  diags.push(strictNullChecksFloorDiag(configFile));
206
207
  adopted["strictNullChecks"] = true;
207
208
  }
208
- return { configFile, options: { ...BASE_OPTIONS, ...adopted, ...FORCED_OPTIONS }, diags };
209
+ // The project's own library selection, kept only to explain errors: the
210
+ // checker always uses scriptc's fixed library set (FORCED_OPTIONS).
211
+ const rawLib = parsed.options["lib"];
212
+ const projectLib = Array.isArray(rawLib)
213
+ ? rawLib.filter((entry) => typeof entry === "string")
214
+ : undefined;
215
+ return {
216
+ configFile,
217
+ options: { ...BASE_OPTIONS, ...adopted, ...FORCED_OPTIONS },
218
+ diags,
219
+ ...(projectLib === undefined ? {} : { projectLib }),
220
+ forcedStrictNullChecks,
221
+ };
209
222
  }
210
223
  /** The target project's @types/node, resolved with the OWN resolver's
211
224
  * type-directive lookup anchored at the ENTRY (typeRoots-free — exactly the
@@ -538,6 +551,11 @@ function loadProgram7(host, entryPath, externalTypes = new Map()) {
538
551
  entry,
539
552
  moduleOrder: [],
540
553
  configDiags: config.diags,
554
+ typeWorld: {
555
+ nodeFallback: nodeTypes === null,
556
+ projectLib: config.projectLib ?? null,
557
+ forcedStrictNullChecks: config.forcedStrictNullChecks ?? false,
558
+ },
541
559
  externalTypes,
542
560
  externalTypeSpecifiersByFile,
543
561
  projectWorld: () => (projectWorld ??= host.createProgram(programRoots, options)),
@@ -2013,11 +2031,7 @@ export function makeCycleAdmission(program, edgesOf) {
2013
2031
  const reason = exactCycleRefusal7(program, comp, lineOf);
2014
2032
  exactVerdict.set(comp, reason);
2015
2033
  if (reason === null) {
2016
- let members = exactCycleMembers7.get(program);
2017
- if (members === undefined) {
2018
- members = new Set();
2019
- exactCycleMembers7.set(program, members);
2020
- }
2034
+ const members = program.analysis.exactCycleMembers;
2021
2035
  for (const m of comp)
2022
2036
  members.add(m);
2023
2037
  }
@@ -2037,12 +2051,10 @@ export function makeCycleAdmission(program, edgesOf) {
2037
2051
  * initialization flag and checks it at every read or write that can run
2038
2052
  * before the declaration. The shapes below have no such representation
2039
2053
  * and keep the SC1016 fence. */
2040
- /** Program → the modules of every cycle the exact rule admitted. */
2041
- const exactCycleMembers7 = new WeakMap();
2042
2054
  /** The modules of `program` whose import cycles were admitted by the
2043
2055
  * exact initialization rule (not the declaration-only rule). */
2044
2056
  export function exactCycleMembers(program) {
2045
- return exactCycleMembers7.get(program) ?? new Set();
2057
+ return program.analysis.exactCycleMembers;
2046
2058
  }
2047
2059
  /** True when the module's top level (outside every function-like body)
2048
2060
  * contains `await` or `for await`. */
@@ -2137,19 +2149,18 @@ function exactCycleRefusal7(program, comp, lineOf) {
2137
2149
  * Otherwise every deferred reference and every top-level reference from
2138
2150
  * another member counts. */
2139
2151
  export function cycleEarlyBindings(program, entry, order, singleRoot) {
2140
- const exact = exactCycleMembers7.get(program);
2141
- if (exact === undefined || exact.size === 0)
2152
+ const exact = program.analysis.exactCycleMembers;
2153
+ if (exact.size === 0)
2142
2154
  return [];
2143
2155
  // Every lowering pass of one compile asks with the same inputs.
2144
2156
  const key = `${entry.fileName}\0${order.map((sf) => sf.fileName).join("\0")}\0${singleRoot}`;
2145
- const memo = earlyBindingsMemo7.get(program);
2146
- if (memo !== undefined && memo.key === key)
2157
+ const memo = program.analysis.cycleEarlyBindings;
2158
+ if (memo !== null && memo.key === key)
2147
2159
  return memo.bindings;
2148
2160
  const bindings = computeCycleEarlyBindings7(program, entry, order, singleRoot, exact);
2149
- earlyBindingsMemo7.set(program, { key, bindings });
2161
+ program.analysis.cycleEarlyBindings = { key, bindings };
2150
2162
  return bindings;
2151
2163
  }
2152
- const earlyBindingsMemo7 = new WeakMap();
2153
2164
  function computeCycleEarlyBindings7(program, entry, order, singleRoot, exact) {
2154
2165
  const inOrder = new Set(order);
2155
2166
  const members = [...exact].filter((m) => inOrder.has(m));
@@ -2347,6 +2358,468 @@ function computeCycleEarlyBindings7(program, entry, order, singleRoot, exact) {
2347
2358
  }
2348
2359
  return out;
2349
2360
  }
2361
+ /** Top-level let/const bindings, in modules outside the exactly-initialized
2362
+ * cycles, that code running before their declaration completes can read.
2363
+ * Function declarations are callable from the module's start, so a call
2364
+ * made by earlier top-level code (or by the declaration's own initializer)
2365
+ * can observe the temporal dead zone. Reachability is syntactic: a stored
2366
+ * callable (a function or class declaration, or a function, class or
2367
+ * object-literal method stored by a variable initializer) becomes reachable
2368
+ * once reachable code names its binding, and every other function-like in
2369
+ * reachable code counts as reachable because it may be handed to a callee.
2370
+ * A binding is reported only when one of its references in a deferred
2371
+ * position is reachable before the declaration ran, so modules that call
2372
+ * nothing early report nothing. Bindings of exactly-initialized cycles are
2373
+ * covered by cycleEarlyBindings. */
2374
+ export function moduleEarlyBindings(program, order) {
2375
+ const key = order.map((sf) => sf.fileName).join("\0");
2376
+ const memo = program.analysis.moduleEarlyBindings;
2377
+ if (memo !== null && memo.key === key)
2378
+ return memo.bindings;
2379
+ const exact = program.analysis.exactCycleMembers;
2380
+ const out = [];
2381
+ for (const sf of order) {
2382
+ if (sf.isDeclarationFile || exact.has(sf))
2383
+ continue;
2384
+ out.push(...moduleEarlyBindingsOf7(program, sf, order));
2385
+ }
2386
+ program.analysis.moduleEarlyBindings = { key, bindings: out };
2387
+ return out;
2388
+ }
2389
+ function moduleEarlyBindingsOf7(program, sf, order) {
2390
+ const ambient = (stmt) => (ts.getCombinedModifierFlags(stmt) & ts.ModifierFlags.Ambient) !==
2391
+ 0;
2392
+ const candidates = [];
2393
+ const candidateNames = new Set();
2394
+ // Stored callables, by the name of the binding that stores them.
2395
+ const stored = new Set();
2396
+ const storedBy = new Map();
2397
+ // Parts of a stored node that run where it is evaluated: a class's
2398
+ // heritage, computed keys, decorators and static initializers, and a
2399
+ // stored method's computed key.
2400
+ const immediate = new Map();
2401
+ const store = (name, units) => {
2402
+ if (units.length === 0)
2403
+ return;
2404
+ for (const u of units)
2405
+ stored.add(u);
2406
+ const list = storedBy.get(name.text) ?? [];
2407
+ list.push({ name, units });
2408
+ storedBy.set(name.text, list);
2409
+ };
2410
+ const checker = program.getTypeChecker();
2411
+ const storedIn = (e, units) => {
2412
+ while (ts.isParenthesizedExpression(e) ||
2413
+ ts.isAsExpression(e) ||
2414
+ ts.isSatisfiesExpression(e) ||
2415
+ ts.isNonNullExpression(e))
2416
+ e = e.expression;
2417
+ if (ts.isArrowFunction(e) || ts.isFunctionExpression(e)) {
2418
+ units.push(e);
2419
+ }
2420
+ else if (ts.isClassExpression(e)) {
2421
+ units.push(e);
2422
+ immediate.set(e, classSyncParts7(e));
2423
+ }
2424
+ else if (ts.isObjectLiteralExpression(e)) {
2425
+ for (const p of e.properties) {
2426
+ if (ts.isMethodDeclaration(p) ||
2427
+ ts.isGetAccessorDeclaration(p) ||
2428
+ ts.isSetAccessorDeclaration(p)) {
2429
+ // A computed key evaluates where the literal does; a plain
2430
+ // member-chain key (`[Equal.symbol]`) runs no user code.
2431
+ if (!ts.isComputedPropertyName(p.name))
2432
+ units.push(p);
2433
+ else if (memberChainKey7(p.name.expression)) {
2434
+ units.push(p);
2435
+ immediate.set(p, [p.name]);
2436
+ }
2437
+ }
2438
+ else if (ts.isPropertyAssignment(p))
2439
+ storedIn(p.initializer, units);
2440
+ }
2441
+ }
2442
+ else if (ts.isArrayLiteralExpression(e)) {
2443
+ for (const el of e.elements)
2444
+ if (!ts.isSpreadElement(el))
2445
+ storedIn(el, units);
2446
+ }
2447
+ else if (ts.isCallExpression(e)) {
2448
+ // `const f = wrap(callback)` where wrap only returns closures over
2449
+ // the callback: it runs when the stored result is called.
2450
+ e.arguments.forEach((arg, index) => {
2451
+ let fn = arg;
2452
+ while (ts.isParenthesizedExpression(fn))
2453
+ fn = fn.expression;
2454
+ if ((ts.isArrowFunction(fn) || ts.isFunctionExpression(fn)) &&
2455
+ returnsOnlyClosuresOver7(checker, e.expression, index))
2456
+ units.push(fn);
2457
+ });
2458
+ }
2459
+ };
2460
+ sf.statements.forEach((stmt, index) => {
2461
+ if (ambient(stmt))
2462
+ return;
2463
+ if (ts.isFunctionDeclaration(stmt) && stmt.name !== undefined && stmt.body !== undefined) {
2464
+ store(stmt.name, [stmt]);
2465
+ }
2466
+ else if (ts.isClassDeclaration(stmt) && stmt.name !== undefined) {
2467
+ store(stmt.name, [stmt]);
2468
+ }
2469
+ else if (ts.isVariableStatement(stmt)) {
2470
+ const lexical = (stmt.declarationList.flags & (ts.NodeFlags.Let | ts.NodeFlags.Const)) !== 0;
2471
+ for (const d of stmt.declarationList.declarations) {
2472
+ if (ts.isIdentifier(d.name) && d.initializer !== undefined) {
2473
+ const units = [];
2474
+ storedIn(d.initializer, units);
2475
+ store(d.name, units);
2476
+ }
2477
+ if (!lexical)
2478
+ continue;
2479
+ for (const name of boundNames7(d.name)) {
2480
+ candidates.push({ name, index, start: stmt.getStart(sf) });
2481
+ candidateNames.add(name.text);
2482
+ }
2483
+ }
2484
+ }
2485
+ });
2486
+ if (candidates.length === 0)
2487
+ return [];
2488
+ // Resolve every identifier that could name a candidate or a stored
2489
+ // callable in one batch.
2490
+ const idents = [];
2491
+ ts.walkPreorder(sf, (node) => {
2492
+ if (ts.isImportDeclaration(node))
2493
+ return "skip";
2494
+ if (ts.isIdentifier(node) && (candidateNames.has(node.text) || storedBy.has(node.text)))
2495
+ idents.push(node);
2496
+ return undefined;
2497
+ });
2498
+ checker.prefetchSymbolNodesExact(idents);
2499
+ const symbolOf = (id) => {
2500
+ const parent = id.parent;
2501
+ let symbol = checker.getSymbolAtLocation(id);
2502
+ if (parent !== undefined && ts.isShorthandPropertyAssignment(parent) && parent.name === id) {
2503
+ symbol = checker.getShorthandAssignmentValueSymbol(parent) ?? symbol;
2504
+ }
2505
+ if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {
2506
+ symbol = checker.getAliasedSymbol(symbol);
2507
+ }
2508
+ return symbol;
2509
+ };
2510
+ // A callback handed to a timer, a microtask queue, a promise reaction or
2511
+ // a host (Node) API runs as a later job or event. Without top-level await
2512
+ // the module's body completes before any job runs, so such a callback is
2513
+ // never early. JavaScript builtins (array callbacks, the promise
2514
+ // executor, replacers) and the host APIs that call back synchronously
2515
+ // keep the conservative rule.
2516
+ if (!hasTopLevelAwait7(sf)) {
2517
+ const callbacks = (e) => {
2518
+ while (ts.isParenthesizedExpression(e))
2519
+ e = e.expression;
2520
+ if (ts.isArrowFunction(e) || ts.isFunctionExpression(e))
2521
+ stored.add(e);
2522
+ else if (ts.isObjectLiteralExpression(e)) {
2523
+ for (const p of e.properties) {
2524
+ if (ts.isMethodDeclaration(p))
2525
+ stored.add(p);
2526
+ else if (ts.isPropertyAssignment(p))
2527
+ callbacks(p.initializer);
2528
+ }
2529
+ }
2530
+ };
2531
+ ts.walkPreorder(sf, (node) => {
2532
+ if ((ts.isCallExpression(node) || ts.isNewExpression(node)) &&
2533
+ laterJobCallee7(checker, node.expression)) {
2534
+ for (const arg of node.arguments ?? [])
2535
+ callbacks(arg);
2536
+ }
2537
+ return undefined;
2538
+ });
2539
+ }
2540
+ const unitsBySymbol = new Map();
2541
+ for (const list of storedBy.values()) {
2542
+ for (const { name, units } of list) {
2543
+ const symbol = checker.getSymbolAtLocation(name);
2544
+ if (symbol === undefined)
2545
+ continue;
2546
+ unitsBySymbol.set(symbol, [...(unitsBySymbol.get(symbol) ?? []), ...units]);
2547
+ }
2548
+ }
2549
+ const candidateSymbols = new Map();
2550
+ for (const c of candidates) {
2551
+ const symbol = checker.getSymbolAtLocation(c.name);
2552
+ if (symbol !== undefined)
2553
+ candidateSymbols.set(symbol, c);
2554
+ }
2555
+ // Walk reachable code, collecting the candidate references it holds.
2556
+ const reachedUnits = new Set();
2557
+ const reachedRefs = new Map();
2558
+ const work = [];
2559
+ const visit = (root) => {
2560
+ ts.walkPreorder(root, (node) => {
2561
+ if (node !== root && stored.has(node)) {
2562
+ for (const part of immediate.get(node) ?? [])
2563
+ visit(part);
2564
+ return "skip";
2565
+ }
2566
+ if (ts.isImportDeclaration(node))
2567
+ return "skip";
2568
+ if (!ts.isIdentifier(node))
2569
+ return undefined;
2570
+ if (!candidateNames.has(node.text) && !storedBy.has(node.text))
2571
+ return undefined;
2572
+ if (inTypePosition7(node))
2573
+ return undefined;
2574
+ const parent = node.parent;
2575
+ if (parent !== undefined && ts.isExportSpecifier(parent))
2576
+ return undefined;
2577
+ if (parent !== undefined && declaredName7(parent) === node)
2578
+ return undefined;
2579
+ const symbol = symbolOf(node);
2580
+ if (symbol === undefined)
2581
+ return undefined;
2582
+ const c = candidateSymbols.get(symbol);
2583
+ if (c !== undefined && node !== c.name && !reachedRefs.has(symbol)) {
2584
+ if (inDeferredPosition7(node) || node.getStart(sf) < c.start)
2585
+ reachedRefs.set(symbol, node);
2586
+ }
2587
+ for (const unit of unitsBySymbol.get(symbol) ?? []) {
2588
+ if (reachedUnits.has(unit))
2589
+ continue;
2590
+ reachedUnits.add(unit);
2591
+ work.push(unit);
2592
+ }
2593
+ return undefined;
2594
+ });
2595
+ };
2596
+ const drain = () => {
2597
+ while (work.length > 0)
2598
+ visit(work.pop());
2599
+ };
2600
+ const out = [];
2601
+ const settled = new Set(order.filter((m) => m !== sf));
2602
+ let next = 0;
2603
+ const report = (declaration) => {
2604
+ while (next < candidates.length &&
2605
+ candidates[next].name.getStart(sf) >= declaration.getStart(sf) &&
2606
+ candidates[next].name.getEnd() <= declaration.getEnd()) {
2607
+ const c = candidates[next++];
2608
+ const symbol = checker.getSymbolAtLocation(c.name);
2609
+ const reference = symbol === undefined ? undefined : reachedRefs.get(symbol);
2610
+ if (symbol === undefined || reference === undefined)
2611
+ continue;
2612
+ out.push({ symbol, name: c.name, kind: "lexical", module: sf, reference, settled });
2613
+ }
2614
+ };
2615
+ for (const stmt of sf.statements) {
2616
+ if (ts.isClassDeclaration(stmt))
2617
+ for (const part of classSyncParts7(stmt))
2618
+ visit(part);
2619
+ else if (ts.isVariableStatement(stmt)) {
2620
+ // Declarators run in order: a later declarator's initializer cannot
2621
+ // observe an earlier binding before it was initialized.
2622
+ for (const d of stmt.declarationList.declarations) {
2623
+ visit(d);
2624
+ drain();
2625
+ report(d);
2626
+ }
2627
+ }
2628
+ else if (!ts.isFunctionDeclaration(stmt))
2629
+ visit(stmt);
2630
+ drain();
2631
+ }
2632
+ return out;
2633
+ }
2634
+ /** True when the program function `callee` names reads its parameter
2635
+ * `index` only inside function expressions it returns directly, and never
2636
+ * through `arguments` in its own body: calling it cannot run that argument
2637
+ * before the returned closure is called. */
2638
+ function returnsOnlyClosuresOver7(checker, callee, index) {
2639
+ while (ts.isParenthesizedExpression(callee))
2640
+ callee = callee.expression;
2641
+ const name = ts.isIdentifier(callee)
2642
+ ? callee
2643
+ : ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.name)
2644
+ ? callee.name
2645
+ : undefined;
2646
+ if (name === undefined)
2647
+ return false;
2648
+ let symbol = checker.getSymbolAtLocation(name);
2649
+ if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {
2650
+ symbol = checker.getAliasedSymbol(symbol);
2651
+ }
2652
+ const decls = symbol === undefined ? [] : checker.declarationsOf(symbol);
2653
+ if (decls.length !== 1)
2654
+ return false;
2655
+ const decl = decls[0];
2656
+ if (decl.getSourceFile().isDeclarationFile)
2657
+ return false;
2658
+ let fn;
2659
+ if (ts.isFunctionDeclaration(decl))
2660
+ fn = decl;
2661
+ else if (ts.isVariableDeclaration(decl) && decl.initializer !== undefined) {
2662
+ let init = decl.initializer;
2663
+ while (ts.isParenthesizedExpression(init))
2664
+ init = init.expression;
2665
+ if (ts.isFunctionExpression(init) || ts.isArrowFunction(init))
2666
+ fn = init;
2667
+ }
2668
+ if (fn === undefined)
2669
+ return false;
2670
+ const like = fn;
2671
+ const body = like.body;
2672
+ const param = like.parameters[index];
2673
+ if (body === undefined || !ts.isBlock(body) || param === undefined)
2674
+ return false;
2675
+ if (!ts.isIdentifier(param.name) || param.dotDotDotToken !== undefined)
2676
+ return false;
2677
+ if (like.parameters.slice(0, index).some((p) => p.dotDotDotToken !== undefined))
2678
+ return false;
2679
+ const paramName = param.name.text;
2680
+ let deferred = true;
2681
+ ts.walkPreorder(body, (node) => {
2682
+ if (!deferred)
2683
+ return "stop";
2684
+ if (ts.isFunctionLike(node) || ts.isClassExpression(node) || ts.isClassDeclaration(node)) {
2685
+ let child = node;
2686
+ while (ts.isParenthesizedExpression(child.parent))
2687
+ child = child.parent;
2688
+ const returned = ts.isReturnStatement(child.parent) && child.parent.expression === child;
2689
+ const uses = (part) => {
2690
+ let found = false;
2691
+ ts.walkPreorder(part, (inner) => {
2692
+ if (ts.isIdentifier(inner) && inner.text === paramName)
2693
+ found = true;
2694
+ return found ? "stop" : undefined;
2695
+ });
2696
+ return found;
2697
+ };
2698
+ // A returned closure may use the parameter; any other nested
2699
+ // function could escape and run before the result is called. A
2700
+ // returned class still evaluates its heritage, computed keys,
2701
+ // decorators and static initializers when the callee runs.
2702
+ if (returned) {
2703
+ if ((ts.isClassExpression(node) || ts.isClassDeclaration(node)) &&
2704
+ classSyncParts7(node).some(uses))
2705
+ deferred = false;
2706
+ return "skip";
2707
+ }
2708
+ if (uses(node))
2709
+ deferred = false;
2710
+ return "skip";
2711
+ }
2712
+ if (ts.isIdentifier(node) && (node.text === paramName || node.text === "arguments")) {
2713
+ if (node !== param.name)
2714
+ deferred = false;
2715
+ }
2716
+ return undefined;
2717
+ });
2718
+ return deferred;
2719
+ }
2720
+ /** The parts of a class that run where the class is evaluated: heritage
2721
+ * expressions, decorators, computed member keys, static field
2722
+ * initializers and static blocks. Methods and instance fields wait for a
2723
+ * call or a construction. */
2724
+ function classSyncParts7(c) {
2725
+ const decorators = (n) => (n.modifiers ?? []).filter((m) => m.kind === ts.SyntaxKind.Decorator);
2726
+ const parts = [...decorators(c), ...(c.heritageClauses ?? [])];
2727
+ for (const m of c.members) {
2728
+ parts.push(...decorators(m));
2729
+ const memberName = m.name;
2730
+ if (memberName !== undefined && ts.isComputedPropertyName(memberName))
2731
+ parts.push(memberName);
2732
+ if (ts.isClassStaticBlockDeclaration(m))
2733
+ parts.push(m);
2734
+ else if (ts.isPropertyDeclaration(m) &&
2735
+ m.initializer !== undefined &&
2736
+ (ts.getCombinedModifierFlags(m) & ts.ModifierFlags.Static) !== 0)
2737
+ parts.push(m.initializer);
2738
+ }
2739
+ return parts;
2740
+ }
2741
+ /** An identifier or a chain of plain property reads. */
2742
+ function memberChainKey7(e) {
2743
+ while (ts.isPropertyAccessExpression(e))
2744
+ e = e.expression;
2745
+ return ts.isIdentifier(e);
2746
+ }
2747
+ /** The name a declaration node binds, if any. */
2748
+ function declaredName7(node) {
2749
+ if (ts.isVariableDeclaration(node) ||
2750
+ ts.isFunctionDeclaration(node) ||
2751
+ ts.isFunctionExpression(node) ||
2752
+ ts.isClassDeclaration(node) ||
2753
+ ts.isClassExpression(node) ||
2754
+ ts.isBindingElement(node) ||
2755
+ ts.isParameter(node))
2756
+ return node.name;
2757
+ return undefined;
2758
+ }
2759
+ /** A declared builtin whose callback arguments run only as later jobs or
2760
+ * events: the timers, queueMicrotask, promise reactions, and Node APIs
2761
+ * other than the ones that call back before returning. */
2762
+ function laterJobCallee7(checker, callee) {
2763
+ while (ts.isParenthesizedExpression(callee))
2764
+ callee = callee.expression;
2765
+ let name;
2766
+ if (ts.isIdentifier(callee))
2767
+ name = callee;
2768
+ else if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.name)) {
2769
+ name = callee.name;
2770
+ }
2771
+ else
2772
+ return false;
2773
+ if (SYNC_CALLBACK_HOST_APIS7.has(name.text))
2774
+ return false;
2775
+ let root = callee;
2776
+ while (ts.isPropertyAccessExpression(root))
2777
+ root = root.expression;
2778
+ if (ts.isIdentifier(root) && root.text === "assert")
2779
+ return false;
2780
+ let symbol = checker.getSymbolAtLocation(name);
2781
+ if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {
2782
+ symbol = checker.getAliasedSymbol(symbol);
2783
+ }
2784
+ if (symbol === undefined)
2785
+ return false;
2786
+ const decls = checker.declarationsOf(symbol);
2787
+ if (decls.length === 0 || !decls.every((d) => d.getSourceFile().isDeclarationFile))
2788
+ return false;
2789
+ if (LATER_JOB_BUILTINS7.has(name.text))
2790
+ return true;
2791
+ // The JavaScript standard library's callbacks mostly run synchronously;
2792
+ // package declarations describe user code.
2793
+ return decls.every((d) => {
2794
+ const file = d.getSourceFile().fileName;
2795
+ return isNodeTypesPath(file) || file === fallbackDtsPath();
2796
+ });
2797
+ }
2798
+ /** Standard-library functions whose callbacks run as later jobs. */
2799
+ const LATER_JOB_BUILTINS7 = new Set([
2800
+ "setTimeout",
2801
+ "setInterval",
2802
+ "setImmediate",
2803
+ "queueMicrotask",
2804
+ "then",
2805
+ "catch",
2806
+ "finally",
2807
+ ]);
2808
+ /** Host APIs that can invoke a callback argument before returning. */
2809
+ const SYNC_CALLBACK_HOST_APIS7 = new Set([
2810
+ "apply",
2811
+ "bind",
2812
+ "call",
2813
+ "doesNotReject",
2814
+ "doesNotThrow",
2815
+ "emit",
2816
+ "enterWith",
2817
+ "exit",
2818
+ "rejects",
2819
+ "run",
2820
+ "runInAsyncScope",
2821
+ "throws",
2822
+ ]);
2350
2823
  /** True for a reference whose value the lowering can take from the
2351
2824
  * binding's checker type instead of its storage: a property key (element
2352
2825
  * access argument, computed name, `in` operand, through parentheses,
@@ -2568,7 +3041,13 @@ function preflight7(load) {
2568
3041
  const file = d.fileName ?? entry.fileName;
2569
3042
  const start = d.fileName !== undefined ? d.pos : 0;
2570
3043
  const end = d.fileName !== undefined ? d.end : 0;
2571
- return tscPassthroughDiag(message, { file, start, end });
3044
+ const diag = tscPassthroughDiag(message, { file, start, end });
3045
+ const hint = typeWorldHint(d, message, load);
3046
+ if (hint !== null) {
3047
+ diag.typeWorld = true;
3048
+ diag.hint = hint;
3049
+ }
3050
+ return diag;
2572
3051
  };
2573
3052
  /* TS7 checker change (not finding 5, same discipline): tsgo types a
2574
3053
  * NAMESPACE import as the spec's non-callable module namespace object
@@ -4149,4 +4628,121 @@ export function isCjsExportTableLiteral(obj) {
4149
4628
  }
4150
4629
  return false;
4151
4630
  }
4631
+ /** Names other runtimes and the DOM declare that scriptc's type world
4632
+ * (the ES2025 library plus Node types) does not. */
4633
+ const FOREIGN_RUNTIME_GLOBALS = new Set(["Deno", "Bun"]);
4634
+ const DOM_GLOBALS = new Set([
4635
+ "window",
4636
+ "document",
4637
+ "navigator",
4638
+ "location",
4639
+ "localStorage",
4640
+ "sessionStorage",
4641
+ "HTMLElement",
4642
+ "Element",
4643
+ "Document",
4644
+ "Window",
4645
+ "BodyInit",
4646
+ "HeadersInit",
4647
+ "RequestInfo",
4648
+ "XMLHttpRequest",
4649
+ "requestAnimationFrame",
4650
+ ]);
4651
+ /** Root identifiers whose members the bundled Node fallback declares. */
4652
+ const NODE_GLOBAL_ROOTS = new Set(["process", "Buffer", "console", "globalThis"]);
4653
+ /** A hint when a TypeScript error comes from scriptc's own type world rather
4654
+ * than from the project: a library member newer than ES2025, a global of
4655
+ * another runtime or of the DOM, a Node member the bundled fallback types
4656
+ * leave out, or the strictNullChecks scriptc enforces. Null otherwise. */
4657
+ function typeWorldHint(d, message, load) {
4658
+ const world = load.typeWorld;
4659
+ if (world === undefined)
4660
+ return null;
4661
+ const quoted = /'([^']+)'/.exec(message)?.[1];
4662
+ // TS2304/TS2552: Cannot find name; TS2580/TS2591/TS2592: missing type
4663
+ // packages; TS2583: needs a newer library.
4664
+ if (d.code === 2304 || d.code === 2552 || d.code === 2583) {
4665
+ if (quoted !== undefined && FOREIGN_RUNTIME_GLOBALS.has(quoted)) {
4666
+ return `'${quoted}' is another runtime's global; scriptc's type world declares the ES2025 library and Node only — feature-test it through globalThis instead, e.g. '(globalThis as { ${quoted}?: unknown }).${quoted}' (the native program runs as Node would, where it is undefined)`;
4667
+ }
4668
+ if (quoted !== undefined && DOM_GLOBALS.has(quoted)) {
4669
+ return `'${quoted}' comes from the DOM library, which scriptc's type world does not include (it checks with the ES2025 library and Node types regardless of the project's "lib") — declare the shape you need locally, or move browser-only code out of the program`;
4670
+ }
4671
+ if (d.code === 2583) {
4672
+ return `scriptc checks with the ES2025 library regardless of the project's "lib" setting, and '${quoted ?? "this name"}' comes from a newer library that does not compile yet`;
4673
+ }
4674
+ }
4675
+ // TS2339/TS2550/TS2551: property does not exist (2550: on this lib).
4676
+ if (d.code === 2339 || d.code === 2550 || d.code === 2551) {
4677
+ const typeText = /on type '([^']+)'/.exec(message)?.[1] ?? "";
4678
+ const newerLib = world.projectLib !== null &&
4679
+ world.projectLib.some((lib) => /esnext|es202[6-9]|es20[3-9]\d/i.test(lib));
4680
+ if (d.code === 2550 || (newerLib && /^[A-Z][A-Za-z0-9]*(?:Constructor)?$/.test(typeText))) {
4681
+ return `scriptc checks with the ES2025 library regardless of the project's "lib" setting, and '${quoted ?? "this member"}' comes from a newer library that does not compile yet — use an ES2025 equivalent here`;
4682
+ }
4683
+ if (world.nodeFallback && d.fileName !== undefined) {
4684
+ const root = receiverRoot(load.program.getSourceFile(d.fileName)?.text ?? "", d.pos);
4685
+ if (root !== null &&
4686
+ (NODE_GLOBAL_ROOTS.has(root) || importsNodeBuiltin(load, d.fileName, root))) {
4687
+ return `the project has no @types/node, so scriptc types Node with its bundled declarations, which list only the members that compile natively — '${quoted ?? "this member"}' does not compile natively yet (https://scriptc.dev/limitations); installing @types/node turns this into a located refusal with a hint`;
4688
+ }
4689
+ }
4690
+ }
4691
+ if (world.forcedStrictNullChecks && /\b(?:null|undefined)\b/.test(message)) {
4692
+ return `the project disables strictNullChecks, which scriptc always enables — this error appears only under strict null checks; narrow the value (or enable "strictNullChecks" in the project to see the same errors from its own tsc)`;
4693
+ }
4694
+ return null;
4695
+ }
4696
+ /** The root identifier of the property access whose member name starts at
4697
+ * `pos` (`process.version` → `process`), or null. */
4698
+ function receiverRoot(text, pos) {
4699
+ let i = pos - 1;
4700
+ while (i >= 0 && /\s/.test(text[i]))
4701
+ i--;
4702
+ if (text[i] !== ".")
4703
+ return null;
4704
+ i--;
4705
+ if (text[i] === "?")
4706
+ i--;
4707
+ let root = null;
4708
+ for (;;) {
4709
+ while (i >= 0 && /\s/.test(text[i]))
4710
+ i--;
4711
+ let j = i;
4712
+ while (j >= 0 && /[\w$]/.test(text[j]))
4713
+ j--;
4714
+ if (j === i)
4715
+ return root;
4716
+ root = text.slice(j + 1, i + 1);
4717
+ i = j;
4718
+ while (i >= 0 && /\s/.test(text[i]))
4719
+ i--;
4720
+ if (text[i] !== ".")
4721
+ return root;
4722
+ i--;
4723
+ if (text[i] === "?")
4724
+ i--;
4725
+ }
4726
+ }
4727
+ /** Whether `name` is bound in `fileName` by an import of a Node builtin. */
4728
+ function importsNodeBuiltin(load, fileName, name) {
4729
+ const sf = load.program.getSourceFile(fileName);
4730
+ for (const stmt of sf?.statements ?? []) {
4731
+ if (!ts.isImportDeclaration(stmt) || !ts.isStringLiteral(stmt.moduleSpecifier))
4732
+ continue;
4733
+ if (canonicalBuiltinModule(stmt.moduleSpecifier.text) === null)
4734
+ continue;
4735
+ const clause = stmt.importClause;
4736
+ if (clause?.name?.text === name)
4737
+ return true;
4738
+ const bindings = clause?.namedBindings;
4739
+ if (bindings && ts.isNamespaceImport(bindings) && bindings.name.text === name)
4740
+ return true;
4741
+ if (bindings &&
4742
+ ts.isNamedImports(bindings) &&
4743
+ bindings.elements.some((e) => e.name.text === name))
4744
+ return true;
4745
+ }
4746
+ return false;
4747
+ }
4152
4748
  //# sourceMappingURL=program.js.map