@scriptc/compiler 0.1.6 → 0.2.0

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 (1060) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +73 -25
  2. package/ambient/scriptc-overrides.d.ts +10 -6
  3. package/ambient/scriptc.d.ts +28 -5
  4. package/dist/backend/build-cache.d.ts +1 -3
  5. package/dist/backend/build-cache.js +3 -22
  6. package/dist/backend/build-cache.js.map +1 -1
  7. package/dist/backend/cache-root.d.ts +3 -0
  8. package/dist/backend/cache-root.js +23 -0
  9. package/dist/backend/cache-root.js.map +1 -0
  10. package/dist/backend/cycle-analysis.d.ts +15 -0
  11. package/dist/backend/cycle-analysis.js +107 -0
  12. package/dist/backend/cycle-analysis.js.map +1 -0
  13. package/dist/backend/cycle-analysis.test.js +124 -0
  14. package/dist/backend/cycle-analysis.test.js.map +1 -0
  15. package/dist/backend/debug-symbols.d.ts +8 -0
  16. package/dist/backend/debug-symbols.js +52 -0
  17. package/dist/backend/debug-symbols.js.map +1 -0
  18. package/dist/backend/executable-features.d.ts +4 -0
  19. package/dist/backend/executable-features.js +42 -0
  20. package/dist/backend/executable-features.js.map +1 -0
  21. package/dist/backend/external-c.d.ts +5 -27
  22. package/dist/backend/external-c.js +5 -40
  23. package/dist/backend/external-c.js.map +1 -1
  24. package/dist/backend/ffi-callbacks.d.ts +2 -3
  25. package/dist/backend/ffi-callbacks.js +2 -3
  26. package/dist/backend/ffi-callbacks.js.map +1 -1
  27. package/dist/backend/library-identity-markers.d.ts +4 -9
  28. package/dist/backend/library-identity-markers.js +11 -49
  29. package/dist/backend/library-identity-markers.js.map +1 -1
  30. package/dist/backend/library-pack.d.ts +5 -0
  31. package/dist/backend/library-pack.js +123 -0
  32. package/dist/backend/library-pack.js.map +1 -0
  33. package/dist/backend/link-plan-core.d.ts +20 -0
  34. package/dist/backend/link-plan-core.js +18 -0
  35. package/dist/backend/link-plan-core.js.map +1 -0
  36. package/dist/backend/link-plan.d.ts +2 -1
  37. package/dist/backend/link-plan.js +18 -17
  38. package/dist/backend/link-plan.js.map +1 -1
  39. package/dist/backend/link-trace.d.ts +2 -0
  40. package/dist/backend/link-trace.js +24 -0
  41. package/dist/backend/link-trace.js.map +1 -0
  42. package/dist/backend/linker.js +9 -1
  43. package/dist/backend/linker.js.map +1 -1
  44. package/dist/backend/literals.d.ts +9 -0
  45. package/dist/backend/literals.js +35 -0
  46. package/dist/backend/literals.js.map +1 -0
  47. package/dist/backend/literals.test.d.ts +1 -0
  48. package/dist/backend/literals.test.js +53 -0
  49. package/dist/backend/literals.test.js.map +1 -0
  50. package/dist/backend/llvm/blocks.d.ts +4 -0
  51. package/dist/backend/llvm/blocks.js +25 -4
  52. package/dist/backend/llvm/blocks.js.map +1 -1
  53. package/dist/backend/llvm/blocks.test.d.ts +1 -0
  54. package/dist/backend/llvm/blocks.test.js +91 -0
  55. package/dist/backend/llvm/blocks.test.js.map +1 -0
  56. package/dist/backend/llvm/classes.d.ts +14 -8
  57. package/dist/backend/llvm/classes.js +70 -28
  58. package/dist/backend/llvm/classes.js.map +1 -1
  59. package/dist/backend/llvm/common.d.ts +5 -1
  60. package/dist/backend/llvm/common.js +45 -4
  61. package/dist/backend/llvm/common.js.map +1 -1
  62. package/dist/backend/llvm/debug-info.d.ts +32 -0
  63. package/dist/backend/llvm/debug-info.js +198 -0
  64. package/dist/backend/llvm/debug-info.js.map +1 -0
  65. package/dist/backend/llvm/debug-info.test.d.ts +1 -0
  66. package/dist/backend/llvm/debug-info.test.js +110 -0
  67. package/dist/backend/llvm/debug-info.test.js.map +1 -0
  68. package/dist/backend/llvm/dyn.d.ts +16 -2
  69. package/dist/backend/llvm/dyn.js +498 -175
  70. package/dist/backend/llvm/dyn.js.map +1 -1
  71. package/dist/backend/llvm/emitter.d.ts +598 -1
  72. package/dist/backend/llvm/emitter.js +739 -409
  73. package/dist/backend/llvm/emitter.js.map +1 -1
  74. package/dist/backend/llvm/emitter.test.d.ts +1 -0
  75. package/dist/backend/llvm/emitter.test.js +179 -0
  76. package/dist/backend/llvm/emitter.test.js.map +1 -0
  77. package/dist/backend/llvm/expr-async.js +23 -14
  78. package/dist/backend/llvm/expr-async.js.map +1 -1
  79. package/dist/backend/llvm/expr-bytes.d.ts +1 -1
  80. package/dist/backend/llvm/expr-bytes.js +32 -14
  81. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  82. package/dist/backend/llvm/expr-callbacks.d.ts +1 -1
  83. package/dist/backend/llvm/expr-callbacks.js +25 -22
  84. package/dist/backend/llvm/expr-callbacks.js.map +1 -1
  85. package/dist/backend/llvm/expr-calls.js +136 -35
  86. package/dist/backend/llvm/expr-calls.js.map +1 -1
  87. package/dist/backend/llvm/expr-containers.d.ts +1 -1
  88. package/dist/backend/llvm/expr-containers.js +43 -14
  89. package/dist/backend/llvm/expr-containers.js.map +1 -1
  90. package/dist/backend/llvm/expr-context.d.ts +5 -260
  91. package/dist/backend/llvm/expr-control.js +9 -5
  92. package/dist/backend/llvm/expr-control.js.map +1 -1
  93. package/dist/backend/llvm/expr-dispatch.d.ts +1 -1
  94. package/dist/backend/llvm/expr-dispatch.js +2 -0
  95. package/dist/backend/llvm/expr-dispatch.js.map +1 -1
  96. package/dist/backend/llvm/expr-dynamic.js +72 -74
  97. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  98. package/dist/backend/llvm/expr-island.d.ts +1 -1
  99. package/dist/backend/llvm/expr-island.js +11 -7
  100. package/dist/backend/llvm/expr-island.js.map +1 -1
  101. package/dist/backend/llvm/expr-primitives.d.ts +1 -1
  102. package/dist/backend/llvm/expr-primitives.js +51 -30
  103. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  104. package/dist/backend/llvm/expr-primitives.test.js +1 -1
  105. package/dist/backend/llvm/expr-records.d.ts +5 -1
  106. package/dist/backend/llvm/expr-records.js +43 -4
  107. package/dist/backend/llvm/expr-records.js.map +1 -1
  108. package/dist/backend/llvm/expr-stream-bridges.d.ts +4 -4
  109. package/dist/backend/llvm/expr-stream-bridges.js +102 -121
  110. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  111. package/dist/backend/llvm/expr-stream-bridges.test.d.ts +1 -0
  112. package/dist/backend/llvm/expr-stream-bridges.test.js +55 -0
  113. package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -0
  114. package/dist/backend/llvm/expr-stream-callbacks.d.ts +1 -1
  115. package/dist/backend/llvm/expr-stream-callbacks.js +12 -12
  116. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  117. package/dist/backend/llvm/layouts.d.ts +19 -0
  118. package/dist/backend/llvm/layouts.js +12 -0
  119. package/dist/backend/llvm/layouts.js.map +1 -0
  120. package/dist/backend/llvm/lib-abi.d.ts +19 -0
  121. package/dist/backend/llvm/lib-abi.js +82 -0
  122. package/dist/backend/llvm/lib-abi.js.map +1 -0
  123. package/dist/backend/llvm/lib-connect.d.ts +2 -0
  124. package/dist/backend/llvm/lib-connect.js +51 -0
  125. package/dist/backend/llvm/lib-connect.js.map +1 -0
  126. package/dist/backend/llvm/lib-datagram.d.ts +2 -0
  127. package/dist/backend/llvm/lib-datagram.js +135 -0
  128. package/dist/backend/llvm/lib-datagram.js.map +1 -0
  129. package/dist/backend/llvm/lib-dispatch.js +50 -6
  130. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  131. package/dist/backend/llvm/lib-filesystem.js +59 -18
  132. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  133. package/dist/backend/llvm/lib-http2.d.ts +2 -0
  134. package/dist/backend/llvm/lib-http2.js +215 -0
  135. package/dist/backend/llvm/lib-http2.js.map +1 -0
  136. package/dist/backend/llvm/lib-lookup.d.ts +2 -0
  137. package/dist/backend/llvm/lib-lookup.js +39 -0
  138. package/dist/backend/llvm/lib-lookup.js.map +1 -0
  139. package/dist/backend/llvm/lib-network.js +25 -2
  140. package/dist/backend/llvm/lib-network.js.map +1 -1
  141. package/dist/backend/llvm/lib-process.js +21 -16
  142. package/dist/backend/llvm/lib-process.js.map +1 -1
  143. package/dist/backend/llvm/lib-shared.js +125 -1
  144. package/dist/backend/llvm/lib-shared.js.map +1 -1
  145. package/dist/backend/llvm/lib-stream.js +3 -2
  146. package/dist/backend/llvm/lib-stream.js.map +1 -1
  147. package/dist/backend/llvm/lib-test.d.ts +2 -0
  148. package/dist/backend/llvm/lib-test.js +34 -0
  149. package/dist/backend/llvm/lib-test.js.map +1 -0
  150. package/dist/backend/llvm/lib-tls.d.ts +2 -0
  151. package/dist/backend/llvm/lib-tls.js +82 -0
  152. package/dist/backend/llvm/lib-tls.js.map +1 -0
  153. package/dist/backend/llvm/shapes.d.ts +10 -9
  154. package/dist/backend/llvm/shapes.js +35 -130
  155. package/dist/backend/llvm/shapes.js.map +1 -1
  156. package/dist/backend/llvm/split.js +4 -1
  157. package/dist/backend/llvm/split.js.map +1 -1
  158. package/dist/backend/llvm/split.test.js +26 -1
  159. package/dist/backend/llvm/split.test.js.map +1 -1
  160. package/dist/backend/llvm/unsupported.d.ts +1 -0
  161. package/dist/backend/llvm/unsupported.js +1 -2
  162. package/dist/backend/llvm/unsupported.js.map +1 -1
  163. package/dist/backend/llvm/walkers.js +1 -7
  164. package/dist/backend/llvm/walkers.js.map +1 -1
  165. package/dist/backend/mangle.d.ts +2 -2
  166. package/dist/backend/mangle.js +16 -5
  167. package/dist/backend/mangle.js.map +1 -1
  168. package/dist/backend/{c/may-throw.d.ts → may-throw.d.ts} +1 -1
  169. package/dist/backend/{c/may-throw.js → may-throw.js} +51 -46
  170. package/dist/backend/may-throw.js.map +1 -0
  171. package/dist/backend/may-throw.test.d.ts +1 -0
  172. package/dist/backend/may-throw.test.js +58 -0
  173. package/dist/backend/may-throw.test.js.map +1 -0
  174. package/dist/backend/native-codegen-core.d.ts +22 -0
  175. package/dist/backend/native-codegen-core.js +44 -0
  176. package/dist/backend/native-codegen-core.js.map +1 -0
  177. package/dist/backend/native-codegen.d.ts +3 -19
  178. package/dist/backend/native-codegen.js +5 -44
  179. package/dist/backend/native-codegen.js.map +1 -1
  180. package/dist/backend/native-codegen.test.js +2 -2
  181. package/dist/backend/native-codegen.test.js.map +1 -1
  182. package/dist/backend/native-link-info-core.d.ts +94 -0
  183. package/dist/backend/native-link-info-core.js +62 -0
  184. package/dist/backend/native-link-info-core.js.map +1 -0
  185. package/dist/backend/native-link-info.d.ts +3 -88
  186. package/dist/backend/native-link-info.js +12 -243
  187. package/dist/backend/native-link-info.js.map +1 -1
  188. package/dist/backend/native-link-info.test.js +41 -146
  189. package/dist/backend/native-link-info.test.js.map +1 -1
  190. package/dist/backend/native-toolchain.d.ts +10 -25
  191. package/dist/backend/native-toolchain.js +89 -219
  192. package/dist/backend/native-toolchain.js.map +1 -1
  193. package/dist/backend/native-toolchain.test.js +15 -5
  194. package/dist/backend/native-toolchain.test.js.map +1 -1
  195. package/dist/backend/native-tools.d.ts +24 -0
  196. package/dist/backend/native-tools.js +33 -0
  197. package/dist/backend/native-tools.js.map +1 -0
  198. package/dist/backend/object-localize.js +19 -8
  199. package/dist/backend/object-localize.js.map +1 -1
  200. package/dist/backend/object-localize.test.js +22 -0
  201. package/dist/backend/object-localize.test.js.map +1 -1
  202. package/dist/backend/runtime-abi.d.ts +2 -2
  203. package/dist/backend/runtime-abi.js +2 -2
  204. package/dist/backend/runtime-pack-core.d.ts +101 -0
  205. package/dist/backend/runtime-pack-core.js +172 -0
  206. package/dist/backend/runtime-pack-core.js.map +1 -0
  207. package/dist/backend/runtime-pack-native.d.ts +21 -0
  208. package/dist/backend/runtime-pack-native.js +70 -0
  209. package/dist/backend/runtime-pack-native.js.map +1 -0
  210. package/dist/backend/runtime-pack-targets.test.js +1 -1
  211. package/dist/backend/runtime-pack.d.ts +3 -83
  212. package/dist/backend/runtime-pack.js +8 -151
  213. package/dist/backend/runtime-pack.js.map +1 -1
  214. package/dist/backend/runtime-pack.test.js +24 -1
  215. package/dist/backend/runtime-pack.test.js.map +1 -1
  216. package/dist/backend/source-locations.d.ts +12 -0
  217. package/dist/backend/source-locations.js +32 -0
  218. package/dist/backend/source-locations.js.map +1 -0
  219. package/dist/backend/source-locations.test.d.ts +1 -0
  220. package/dist/backend/source-locations.test.js +16 -0
  221. package/dist/backend/source-locations.test.js.map +1 -0
  222. package/dist/backend/target-diagnostics.d.ts +22 -0
  223. package/dist/backend/target-diagnostics.js +108 -0
  224. package/dist/backend/target-diagnostics.js.map +1 -0
  225. package/dist/backend/target-platform.d.ts +15 -0
  226. package/dist/backend/target-platform.js +72 -0
  227. package/dist/backend/target-platform.js.map +1 -0
  228. package/dist/backend/targets.d.ts +13 -4
  229. package/dist/backend/targets.js +95 -30
  230. package/dist/backend/targets.js.map +1 -1
  231. package/dist/backend/targets.test.js +65 -4
  232. package/dist/backend/targets.test.js.map +1 -1
  233. package/dist/backend/toolchain-environment.d.ts +6 -0
  234. package/dist/backend/toolchain-environment.js +99 -0
  235. package/dist/backend/toolchain-environment.js.map +1 -0
  236. package/dist/backend/vendor-archives.d.ts +1 -9
  237. package/dist/backend/vendor-archives.js +2 -9
  238. package/dist/backend/vendor-archives.js.map +1 -1
  239. package/dist/backend/vendor-inputs.d.ts +9 -0
  240. package/dist/backend/vendor-inputs.js +10 -0
  241. package/dist/backend/vendor-inputs.js.map +1 -0
  242. package/dist/backend/warm-cache.d.ts +3 -0
  243. package/dist/backend/warm-cache.js +41 -0
  244. package/dist/backend/warm-cache.js.map +1 -0
  245. package/dist/cli/command.d.ts +3 -0
  246. package/dist/cli/command.js +328 -0
  247. package/dist/cli/command.js.map +1 -0
  248. package/dist/cli/host.d.ts +24 -0
  249. package/dist/cli/host.js +2 -0
  250. package/dist/cli/host.js.map +1 -0
  251. package/dist/cli/output-options.d.ts +26 -0
  252. package/dist/cli/output-options.js +60 -0
  253. package/dist/cli/output-options.js.map +1 -0
  254. package/dist/cli/paths.d.ts +12 -0
  255. package/dist/cli/paths.js +42 -0
  256. package/dist/cli/paths.js.map +1 -0
  257. package/dist/cli/usage.d.ts +74 -0
  258. package/dist/cli/usage.js +86 -0
  259. package/dist/cli/usage.js.map +1 -0
  260. package/dist/cli/wasi-paths.d.ts +8 -0
  261. package/dist/cli/wasi-paths.js +41 -0
  262. package/dist/cli/wasi-paths.js.map +1 -0
  263. package/dist/cli/wasi-runner.d.ts +2 -0
  264. package/dist/cli/wasi-runner.js +28 -0
  265. package/dist/cli/wasi-runner.js.map +1 -0
  266. package/dist/compat/fetch-profile.js +3 -3
  267. package/dist/compat/fetch-profile.js.map +1 -1
  268. package/dist/compile-types.d.ts +162 -0
  269. package/dist/compile-types.js +2 -0
  270. package/dist/compile-types.js.map +1 -0
  271. package/dist/coverage/report.js +11 -5
  272. package/dist/coverage/report.js.map +1 -1
  273. package/dist/coverage/surface-manifest.js +5 -2
  274. package/dist/coverage/surface-manifest.js.map +1 -1
  275. package/dist/diagnostics/diagnostic.d.ts +4 -0
  276. package/dist/diagnostics/diagnostic.js +15 -3
  277. package/dist/diagnostics/diagnostic.js.map +1 -1
  278. package/dist/executable/executable-cache.d.ts +3 -4
  279. package/dist/executable/executable-cache.js +33 -10
  280. package/dist/executable/executable-cache.js.map +1 -1
  281. package/dist/executable/executable-cache.test.js +38 -16
  282. package/dist/executable/executable-cache.test.js.map +1 -1
  283. package/dist/executable/prepare.d.ts +14 -0
  284. package/dist/executable/prepare.js +66 -0
  285. package/dist/executable/prepare.js.map +1 -0
  286. package/dist/ffi/ffi-manifest.d.ts +11 -4
  287. package/dist/ffi/ffi-manifest.js +170 -58
  288. package/dist/ffi/ffi-manifest.js.map +1 -1
  289. package/dist/ffi/ffi-manifest.test.d.ts +1 -0
  290. package/dist/ffi/ffi-manifest.test.js +111 -0
  291. package/dist/ffi/ffi-manifest.test.js.map +1 -0
  292. package/dist/format-integer.d.ts +3 -0
  293. package/dist/format-integer.js +14 -0
  294. package/dist/format-integer.js.map +1 -0
  295. package/dist/frontend/analysis.d.ts +5 -0
  296. package/dist/frontend/analysis.js +88 -0
  297. package/dist/frontend/analysis.js.map +1 -0
  298. package/dist/frontend/arguments-usage.d.ts +4 -0
  299. package/dist/frontend/arguments-usage.js +40 -0
  300. package/dist/frontend/arguments-usage.js.map +1 -0
  301. package/dist/frontend/binding-source.d.ts +4 -0
  302. package/dist/frontend/binding-source.js +18 -0
  303. package/dist/frontend/binding-source.js.map +1 -0
  304. package/dist/frontend/builtin-modules.d.ts +1 -1
  305. package/dist/frontend/builtin-modules.js +1 -1
  306. package/dist/frontend/builtin-modules.js.map +1 -1
  307. package/dist/frontend/cjs-lexer.d.ts +4 -25
  308. package/dist/frontend/cjs-lexer.js +6 -806
  309. package/dist/frontend/cjs-lexer.js.map +1 -1
  310. package/dist/frontend/cjs-resolve.d.ts +5 -0
  311. package/dist/frontend/cjs-resolve.js +429 -0
  312. package/dist/frontend/cjs-resolve.js.map +1 -0
  313. package/dist/frontend/cjs-syntax.d.ts +26 -0
  314. package/dist/frontend/cjs-syntax.js +806 -0
  315. package/dist/frontend/cjs-syntax.js.map +1 -0
  316. package/dist/frontend/comptime-node.d.ts +4 -0
  317. package/dist/frontend/comptime-node.js +16 -0
  318. package/dist/frontend/comptime-node.js.map +1 -0
  319. package/dist/frontend/comptime-node.test.d.ts +1 -0
  320. package/dist/frontend/comptime-node.test.js +37 -0
  321. package/dist/frontend/comptime-node.test.js.map +1 -0
  322. package/dist/frontend/dts-paths.d.ts +3 -4
  323. package/dist/frontend/dts-paths.js +15 -8
  324. package/dist/frontend/dts-paths.js.map +1 -1
  325. package/dist/frontend/fork-target.js +2 -2
  326. package/dist/frontend/fork-target.js.map +1 -1
  327. package/dist/frontend/helper-tokens.d.ts +1 -0
  328. package/dist/frontend/helper-tokens.js +147 -0
  329. package/dist/frontend/helper-tokens.js.map +1 -0
  330. package/dist/frontend/helper-tokens.test.d.ts +1 -0
  331. package/dist/frontend/helper-tokens.test.js +35 -0
  332. package/dist/frontend/helper-tokens.test.js.map +1 -0
  333. package/dist/frontend/inferred-js-diagnostics.d.ts +5 -0
  334. package/dist/frontend/inferred-js-diagnostics.js +69 -0
  335. package/dist/frontend/inferred-js-diagnostics.js.map +1 -0
  336. package/dist/frontend/inferred-js-diagnostics.test.d.ts +1 -0
  337. package/dist/frontend/inferred-js-diagnostics.test.js +58 -0
  338. package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -0
  339. package/dist/frontend/input-tracker.d.ts +5 -2
  340. package/dist/frontend/input-tracker.js +24 -3
  341. package/dist/frontend/input-tracker.js.map +1 -1
  342. package/dist/frontend/input-tracker.test.js +23 -0
  343. package/dist/frontend/input-tracker.test.js.map +1 -1
  344. package/dist/frontend/lib-contract.js +32 -24
  345. package/dist/frontend/lib-contract.js.map +1 -1
  346. package/dist/frontend/literal-values.d.ts +4 -0
  347. package/dist/frontend/literal-values.js +21 -0
  348. package/dist/frontend/literal-values.js.map +1 -0
  349. package/dist/frontend/literal-values.test.d.ts +1 -0
  350. package/dist/frontend/literal-values.test.js +91 -0
  351. package/dist/frontend/literal-values.test.js.map +1 -0
  352. package/dist/frontend/lowering/abstract-equality.d.ts +1 -1
  353. package/dist/frontend/lowering/abstract-equality.js +3 -0
  354. package/dist/frontend/lowering/abstract-equality.js.map +1 -1
  355. package/dist/frontend/lowering/array-indexed-mutation.js +11 -6
  356. package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
  357. package/dist/frontend/lowering/array-values.d.ts +4 -1
  358. package/dist/frontend/lowering/array-values.js +43 -1
  359. package/dist/frontend/lowering/array-values.js.map +1 -1
  360. package/dist/frontend/lowering/callback-arg.js +1 -0
  361. package/dist/frontend/lowering/callback-arg.js.map +1 -1
  362. package/dist/frontend/lowering/class-callbacks.d.ts +12 -0
  363. package/dist/frontend/lowering/class-callbacks.js +63 -0
  364. package/dist/frontend/lowering/class-callbacks.js.map +1 -0
  365. package/dist/frontend/lowering/class-descriptors.d.ts +9 -0
  366. package/dist/frontend/lowering/class-descriptors.js +73 -0
  367. package/dist/frontend/lowering/class-descriptors.js.map +1 -0
  368. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +41 -0
  369. package/dist/frontend/lowering/class-dynamic-dispatch.js +803 -0
  370. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -0
  371. package/dist/frontend/lowering/class-dynamic-dispatch.test.d.ts +1 -0
  372. package/dist/frontend/lowering/class-dynamic-dispatch.test.js +92 -0
  373. package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -0
  374. package/dist/frontend/lowering/class-instance-constructor.d.ts +7 -0
  375. package/dist/frontend/lowering/class-instance-constructor.js +64 -0
  376. package/dist/frontend/lowering/class-instance-constructor.js.map +1 -0
  377. package/dist/frontend/lowering/class-method-values.d.ts +10 -0
  378. package/dist/frontend/lowering/class-method-values.js +170 -0
  379. package/dist/frontend/lowering/class-method-values.js.map +1 -0
  380. package/dist/frontend/lowering/class-prototypes.d.ts +16 -0
  381. package/dist/frontend/lowering/class-prototypes.js +134 -0
  382. package/dist/frontend/lowering/class-prototypes.js.map +1 -0
  383. package/dist/frontend/lowering/class-static-data.d.ts +6 -0
  384. package/dist/frontend/lowering/class-static-data.js +56 -0
  385. package/dist/frontend/lowering/class-static-data.js.map +1 -0
  386. package/dist/frontend/lowering/containers/buffer-numeric-methods.d.ts +4 -0
  387. package/dist/frontend/lowering/containers/buffer-numeric-methods.js +26 -0
  388. package/dist/frontend/lowering/containers/buffer-numeric-methods.js.map +1 -0
  389. package/dist/frontend/lowering/containers/bytes.d.ts +11 -7
  390. package/dist/frontend/lowering/containers/bytes.js +164 -155
  391. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  392. package/dist/frontend/lowering/containers/string-and-regexp.d.ts +2 -2
  393. package/dist/frontend/lowering/containers/string-and-regexp.js +39 -16
  394. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  395. package/dist/frontend/lowering/containers/string-replacement.d.ts +7 -0
  396. package/dist/frontend/lowering/containers/string-replacement.js +217 -0
  397. package/dist/frontend/lowering/containers/string-replacement.js.map +1 -0
  398. package/dist/frontend/lowering/error-methods.d.ts +11 -0
  399. package/dist/frontend/lowering/error-methods.js +78 -0
  400. package/dist/frontend/lowering/error-methods.js.map +1 -0
  401. package/dist/frontend/lowering/expressions/global-symbols.d.ts +6 -0
  402. package/dist/frontend/lowering/expressions/global-symbols.js +11 -0
  403. package/dist/frontend/lowering/expressions/global-symbols.js.map +1 -0
  404. package/dist/frontend/lowering/expressions/native-proxy.d.ts +7 -0
  405. package/dist/frontend/lowering/expressions/native-proxy.js +49 -0
  406. package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -0
  407. package/dist/frontend/lowering/expressions/nullish-assignment.d.ts +6 -0
  408. package/dist/frontend/lowering/expressions/nullish-assignment.js +124 -0
  409. package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -0
  410. package/dist/frontend/lowering/expressions/object-literals.d.ts +8 -8
  411. package/dist/frontend/lowering/expressions/object-literals.js +485 -185
  412. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  413. package/dist/frontend/lowering/expressions/optional-chains.d.ts +5 -6
  414. package/dist/frontend/lowering/expressions/optional-chains.js +27 -14
  415. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  416. package/dist/frontend/lowering/expressions/try-lower-expression.js +1 -0
  417. package/dist/frontend/lowering/expressions/try-lower-expression.js.map +1 -1
  418. package/dist/frontend/lowering/expressions/union-field-write.d.ts +8 -0
  419. package/dist/frontend/lowering/expressions/union-field-write.js +71 -0
  420. package/dist/frontend/lowering/expressions/union-field-write.js.map +1 -0
  421. package/dist/frontend/lowering/function-context.d.ts +93 -0
  422. package/dist/frontend/lowering/function-context.js +103 -0
  423. package/dist/frontend/lowering/function-context.js.map +1 -0
  424. package/dist/frontend/lowering/generator-delegation.d.ts +7 -0
  425. package/dist/frontend/lowering/generator-delegation.js +85 -0
  426. package/dist/frontend/lowering/generator-delegation.js.map +1 -0
  427. package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +10 -0
  428. package/dist/frontend/lowering/generator-dynamic-dispatch.js +105 -0
  429. package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -0
  430. package/dist/frontend/lowering/lib-boundary.d.ts +2 -1
  431. package/dist/frontend/lowering/lib-boundary.js +59 -20
  432. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  433. package/dist/frontend/lowering/lib-boundary.test.d.ts +1 -0
  434. package/dist/frontend/lowering/lib-boundary.test.js +45 -0
  435. package/dist/frontend/lowering/lib-boundary.test.js.map +1 -0
  436. package/dist/frontend/lowering/lower-array-sort.d.ts +1 -1
  437. package/dist/frontend/lowering/lower-assert.d.ts +1 -1
  438. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  439. package/dist/frontend/lowering/lower-async-iteration.d.ts +1 -1
  440. package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
  441. package/dist/frontend/lowering/lower-builtin-values.d.ts +12 -0
  442. package/dist/frontend/lowering/lower-builtin-values.js +139 -0
  443. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -0
  444. package/dist/frontend/lowering/lower-builtins.d.ts +27 -41
  445. package/dist/frontend/lowering/lower-builtins.js +553 -346
  446. package/dist/frontend/lowering/lower-builtins.js.map +1 -1
  447. package/dist/frontend/lowering/lower-calls.d.ts +22 -26
  448. package/dist/frontend/lowering/lower-calls.js +1373 -380
  449. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  450. package/dist/frontend/lowering/lower-classes.d.ts +83 -45
  451. package/dist/frontend/lowering/lower-classes.js +952 -339
  452. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  453. package/dist/frontend/lowering/lower-comptime.d.ts +1 -1
  454. package/dist/frontend/lowering/lower-comptime.js +23 -32
  455. package/dist/frontend/lowering/lower-comptime.js.map +1 -1
  456. package/dist/frontend/lowering/lower-containers.d.ts +27 -32
  457. package/dist/frontend/lowering/lower-containers.js +796 -151
  458. package/dist/frontend/lowering/lower-containers.js.map +1 -1
  459. package/dist/frontend/lowering/lower-dgram.d.ts +1 -1
  460. package/dist/frontend/lowering/lower-dgram.js.map +1 -1
  461. package/dist/frontend/lowering/lower-enums.d.ts +1 -1
  462. package/dist/frontend/lowering/lower-enums.js.map +1 -1
  463. package/dist/frontend/lowering/lower-event-emitter.d.ts +30 -1
  464. package/dist/frontend/lowering/lower-event-emitter.js +58 -26
  465. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  466. package/dist/frontend/lowering/lower-expando.d.ts +7 -1
  467. package/dist/frontend/lowering/lower-expando.js +14 -6
  468. package/dist/frontend/lowering/lower-expando.js.map +1 -1
  469. package/dist/frontend/lowering/lower-exprs.d.ts +35 -11
  470. package/dist/frontend/lowering/lower-exprs.js +1785 -790
  471. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  472. package/dist/frontend/lowering/lower-generators.d.ts +2 -5
  473. package/dist/frontend/lowering/lower-generators.js +77 -46
  474. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  475. package/dist/frontend/lowering/lower-global-value.d.ts +7 -0
  476. package/dist/frontend/lowering/lower-global-value.js +17 -0
  477. package/dist/frontend/lowering/lower-global-value.js.map +1 -0
  478. package/dist/frontend/lowering/lower-inspect.d.ts +1 -1
  479. package/dist/frontend/lowering/lower-inspect.js +17 -8
  480. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  481. package/dist/frontend/lowering/lower-island.d.ts +5 -8
  482. package/dist/frontend/lowering/lower-island.js +34 -23
  483. package/dist/frontend/lowering/lower-island.js.map +1 -1
  484. package/dist/frontend/lowering/lower-mixins.d.ts +2 -2
  485. package/dist/frontend/lowering/lower-mixins.js +5 -3
  486. package/dist/frontend/lowering/lower-mixins.js.map +1 -1
  487. package/dist/frontend/lowering/lower-modules.d.ts +1 -1
  488. package/dist/frontend/lowering/lower-modules.js +252 -38
  489. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  490. package/dist/frontend/lowering/lower-namespaces.d.ts +1 -1
  491. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  492. package/dist/frontend/lowering/lower-node-module.d.ts +1 -1
  493. package/dist/frontend/lowering/lower-node-module.js +13 -10
  494. package/dist/frontend/lowering/lower-node-module.js.map +1 -1
  495. package/dist/frontend/lowering/lower-server.d.ts +1 -1
  496. package/dist/frontend/lowering/lower-server.js +6 -10
  497. package/dist/frontend/lowering/lower-server.js.map +1 -1
  498. package/dist/frontend/lowering/lower-stmts.d.ts +10 -14
  499. package/dist/frontend/lowering/lower-stmts.js +731 -532
  500. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  501. package/dist/frontend/lowering/lower-stream.d.ts +1 -1
  502. package/dist/frontend/lowering/lower-stream.js +19 -10
  503. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  504. package/dist/frontend/lowering/lower-test.d.ts +1 -1
  505. package/dist/frontend/lowering/lower-test.js.map +1 -1
  506. package/dist/frontend/lowering/lower-url.d.ts +6 -0
  507. package/dist/frontend/lowering/lower-url.js +77 -0
  508. package/dist/frontend/lowering/lower-url.js.map +1 -0
  509. package/dist/frontend/lowering/lowerer.d.ts +113 -189
  510. package/dist/frontend/lowering/lowerer.js +1033 -663
  511. package/dist/frontend/lowering/lowerer.js.map +1 -1
  512. package/dist/frontend/lowering/lowerer.test.d.ts +1 -0
  513. package/dist/frontend/lowering/lowerer.test.js +26 -0
  514. package/dist/frontend/lowering/lowerer.test.js.map +1 -0
  515. package/dist/frontend/lowering/native-ffi.d.ts +5 -0
  516. package/dist/frontend/lowering/native-ffi.js +40 -0
  517. package/dist/frontend/lowering/native-ffi.js.map +1 -0
  518. package/dist/frontend/lowering/object-enumeration-receiver.d.ts +7 -0
  519. package/dist/frontend/lowering/object-enumeration-receiver.js +33 -0
  520. package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -0
  521. package/dist/frontend/lowering/object-factory-new.d.ts +8 -0
  522. package/dist/frontend/lowering/object-factory-new.js +68 -0
  523. package/dist/frontend/lowering/object-factory-new.js.map +1 -0
  524. package/dist/frontend/lowering/optional-arguments.js +6 -1
  525. package/dist/frontend/lowering/optional-arguments.js.map +1 -1
  526. package/dist/frontend/lowering/pairs-snapshot.js +2 -1
  527. package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
  528. package/dist/frontend/lowering/runtime-optional-locals.d.ts +14 -0
  529. package/dist/frontend/lowering/runtime-optional-locals.js +41 -0
  530. package/dist/frontend/lowering/runtime-optional-locals.js.map +1 -0
  531. package/dist/frontend/lowering/runtime-optional-locals.test.d.ts +1 -0
  532. package/dist/frontend/lowering/runtime-optional-locals.test.js +85 -0
  533. package/dist/frontend/lowering/runtime-optional-locals.test.js.map +1 -0
  534. package/dist/frontend/lowering/sanitize-class-types.d.ts +8 -0
  535. package/dist/frontend/lowering/sanitize-class-types.js +79 -0
  536. package/dist/frontend/lowering/sanitize-class-types.js.map +1 -0
  537. package/dist/frontend/lowering/sanitize-class-types.test.d.ts +1 -0
  538. package/dist/frontend/lowering/sanitize-class-types.test.js +60 -0
  539. package/dist/frontend/lowering/sanitize-class-types.test.js.map +1 -0
  540. package/dist/frontend/lowering/static-this.d.ts +5 -1
  541. package/dist/frontend/lowering/static-this.js +28 -2
  542. package/dist/frontend/lowering/static-this.js.map +1 -1
  543. package/dist/frontend/lowering/string-index.d.ts +7 -0
  544. package/dist/frontend/lowering/string-index.js +39 -0
  545. package/dist/frontend/lowering/string-index.js.map +1 -0
  546. package/dist/frontend/lowering/surfaces.d.ts +9 -4
  547. package/dist/frontend/lowering/surfaces.js +98 -35
  548. package/dist/frontend/lowering/surfaces.js.map +1 -1
  549. package/dist/frontend/lowering/symbol-fields.d.ts +22 -0
  550. package/dist/frontend/lowering/symbol-fields.js +183 -0
  551. package/dist/frontend/lowering/symbol-fields.js.map +1 -0
  552. package/dist/frontend/lowering/symbol-methods.d.ts +7 -0
  553. package/dist/frontend/lowering/symbol-methods.js +30 -0
  554. package/dist/frontend/lowering/symbol-methods.js.map +1 -0
  555. package/dist/frontend/lowering/text-decoder-encoding.d.ts +10 -0
  556. package/dist/frontend/lowering/text-decoder-encoding.js +77 -0
  557. package/dist/frontend/lowering/text-decoder-encoding.js.map +1 -0
  558. package/dist/frontend/lowering/text-decoder-encoding.test.d.ts +1 -0
  559. package/dist/frontend/lowering/text-decoder-encoding.test.js +38 -0
  560. package/dist/frontend/lowering/text-decoder-encoding.test.js.map +1 -0
  561. package/dist/frontend/lowering/union-narrow.d.ts +9 -0
  562. package/dist/frontend/lowering/union-narrow.js +59 -0
  563. package/dist/frontend/lowering/union-narrow.js.map +1 -0
  564. package/dist/frontend/lowering/union-narrow.test.d.ts +1 -0
  565. package/dist/frontend/lowering/union-narrow.test.js +72 -0
  566. package/dist/frontend/lowering/union-narrow.test.js.map +1 -0
  567. package/dist/frontend/lowering/union-retag.d.ts +43 -0
  568. package/dist/frontend/lowering/union-retag.js +259 -0
  569. package/dist/frontend/lowering/union-retag.js.map +1 -0
  570. package/dist/frontend/lowering/union-retag.test.d.ts +1 -0
  571. package/dist/frontend/lowering/union-retag.test.js +405 -0
  572. package/dist/frontend/lowering/union-retag.test.js.map +1 -0
  573. package/dist/frontend/lowering/unregistered-class-types.d.ts +14 -0
  574. package/dist/frontend/lowering/unregistered-class-types.js +94 -0
  575. package/dist/frontend/lowering/unregistered-class-types.js.map +1 -0
  576. package/dist/frontend/lowering/unregistered-class-types.test.d.ts +1 -0
  577. package/dist/frontend/lowering/unregistered-class-types.test.js +65 -0
  578. package/dist/frontend/lowering/unregistered-class-types.test.js.map +1 -0
  579. package/dist/frontend/lowering/width-lift.d.ts +40 -0
  580. package/dist/frontend/lowering/width-lift.js +2 -0
  581. package/dist/frontend/lowering/width-lift.js.map +1 -0
  582. package/dist/frontend/module-syntax.d.ts +58 -0
  583. package/dist/frontend/module-syntax.js +123 -0
  584. package/dist/frontend/module-syntax.js.map +1 -0
  585. package/dist/frontend/module-syntax.test.d.ts +1 -0
  586. package/dist/frontend/module-syntax.test.js +78 -0
  587. package/dist/frontend/module-syntax.test.js.map +1 -0
  588. package/dist/frontend/npm-fetch-analysis.d.ts +17 -0
  589. package/dist/frontend/npm-fetch-analysis.js +100 -0
  590. package/dist/frontend/npm-fetch-analysis.js.map +1 -0
  591. package/dist/frontend/npm-fetch-analysis.test.d.ts +1 -0
  592. package/dist/frontend/npm-fetch-analysis.test.js +107 -0
  593. package/dist/frontend/npm-fetch-analysis.test.js.map +1 -0
  594. package/dist/frontend/npm-fetch-node.d.ts +2 -0
  595. package/dist/frontend/npm-fetch-node.js +12 -0
  596. package/dist/frontend/npm-fetch-node.js.map +1 -0
  597. package/dist/frontend/npm-fetch-syntax.d.ts +6 -0
  598. package/dist/frontend/npm-fetch-syntax.js +207 -0
  599. package/dist/frontend/npm-fetch-syntax.js.map +1 -0
  600. package/dist/frontend/npm-node.d.ts +10 -0
  601. package/dist/frontend/npm-node.js +14 -0
  602. package/dist/frontend/npm-node.js.map +1 -0
  603. package/dist/frontend/npm-static-bundled-cjs.d.ts +8 -0
  604. package/dist/frontend/npm-static-bundled-cjs.js +236 -0
  605. package/dist/frontend/npm-static-bundled-cjs.js.map +1 -0
  606. package/dist/frontend/npm-static-bundled-cjs.test.d.ts +1 -0
  607. package/dist/frontend/npm-static-bundled-cjs.test.js +69 -0
  608. package/dist/frontend/npm-static-bundled-cjs.test.js.map +1 -0
  609. package/dist/frontend/npm-static-declaration-syntax.d.ts +57 -0
  610. package/dist/frontend/npm-static-declaration-syntax.js +944 -0
  611. package/dist/frontend/npm-static-declaration-syntax.js.map +1 -0
  612. package/dist/frontend/npm-static-declarations.d.ts +11 -39
  613. package/dist/frontend/npm-static-declarations.js +22 -561
  614. package/dist/frontend/npm-static-declarations.js.map +1 -1
  615. package/dist/frontend/npm-static-declarations.test.js +245 -6
  616. package/dist/frontend/npm-static-declarations.test.js.map +1 -1
  617. package/dist/frontend/npm-static-prune.d.ts +1 -1
  618. package/dist/frontend/npm-static-prune.js +5 -4
  619. package/dist/frontend/npm-static-prune.js.map +1 -1
  620. package/dist/frontend/npm-static-prune.test.js +1 -1
  621. package/dist/frontend/npm-static-prune.test.js.map +1 -1
  622. package/dist/frontend/npm-static-rewrite-host.d.ts +4 -0
  623. package/dist/frontend/npm-static-rewrite-host.js +179 -0
  624. package/dist/frontend/npm-static-rewrite-host.js.map +1 -0
  625. package/dist/frontend/npm-static-rewrite-syntax.d.ts +16 -0
  626. package/dist/frontend/npm-static-rewrite-syntax.js +905 -0
  627. package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -0
  628. package/dist/frontend/npm-static-rewrite.d.ts +0 -5
  629. package/dist/frontend/npm-static-rewrite.js +2 -1079
  630. package/dist/frontend/npm-static-rewrite.js.map +1 -1
  631. package/dist/frontend/npm-static-subtyping.d.ts +5 -0
  632. package/dist/frontend/npm-static-subtyping.js +55 -0
  633. package/dist/frontend/npm-static-subtyping.js.map +1 -0
  634. package/dist/frontend/npm-static-subtyping.test.d.ts +1 -0
  635. package/dist/frontend/npm-static-subtyping.test.js +58 -0
  636. package/dist/frontend/npm-static-subtyping.test.js.map +1 -0
  637. package/dist/frontend/npm-static.d.ts +7 -15
  638. package/dist/frontend/npm-static.js +19 -28
  639. package/dist/frontend/npm-static.js.map +1 -1
  640. package/dist/frontend/npm.d.ts +8 -69
  641. package/dist/frontend/npm.js +21 -361
  642. package/dist/frontend/npm.js.map +1 -1
  643. package/dist/frontend/npm.test.js +2 -2
  644. package/dist/frontend/npm.test.js.map +1 -1
  645. package/dist/frontend/pipeline-native.d.ts +6 -0
  646. package/dist/frontend/pipeline-native.js +32 -0
  647. package/dist/frontend/pipeline-native.js.map +1 -0
  648. package/dist/frontend/pipeline.d.ts +54 -0
  649. package/dist/frontend/pipeline.js +382 -0
  650. package/dist/frontend/pipeline.js.map +1 -0
  651. package/dist/frontend/pipeline.test.d.ts +1 -0
  652. package/dist/frontend/pipeline.test.js +77 -0
  653. package/dist/frontend/pipeline.test.js.map +1 -0
  654. package/dist/frontend/program-analysis.d.ts +10 -0
  655. package/dist/frontend/program-analysis.js +14 -0
  656. package/dist/frontend/program-analysis.js.map +1 -0
  657. package/dist/frontend/program-node.d.ts +9 -0
  658. package/dist/frontend/program-node.js +48 -0
  659. package/dist/frontend/program-node.js.map +1 -0
  660. package/dist/frontend/program.d.ts +43 -19
  661. package/dist/frontend/program.js +556 -197
  662. package/dist/frontend/program.js.map +1 -1
  663. package/dist/frontend/program.test.d.ts +1 -0
  664. package/dist/frontend/program.test.js +202 -0
  665. package/dist/frontend/program.test.js.map +1 -0
  666. package/dist/frontend/provenance-core.d.ts +9 -0
  667. package/dist/frontend/provenance-core.js +435 -0
  668. package/dist/frontend/provenance-core.js.map +1 -0
  669. package/dist/frontend/provenance.d.ts +0 -4
  670. package/dist/frontend/provenance.js +4 -459
  671. package/dist/frontend/provenance.js.map +1 -1
  672. package/dist/frontend/resolve.d.ts +3 -1
  673. package/dist/frontend/resolve.js +6 -3
  674. package/dist/frontend/resolve.js.map +1 -1
  675. package/dist/frontend/runtime-resolve.d.ts +4 -3
  676. package/dist/frontend/runtime-resolve.js +22 -18
  677. package/dist/frontend/runtime-resolve.js.map +1 -1
  678. package/dist/frontend/runtime-resolve.test.js +53 -0
  679. package/dist/frontend/runtime-resolve.test.js.map +1 -1
  680. package/dist/frontend/services-node.d.ts +5 -0
  681. package/dist/frontend/services-node.js +19 -0
  682. package/dist/frontend/services-node.js.map +1 -0
  683. package/dist/frontend/services-node.test.d.ts +1 -0
  684. package/dist/frontend/services-node.test.js +70 -0
  685. package/dist/frontend/services-node.test.js.map +1 -0
  686. package/dist/frontend/services.d.ts +44 -0
  687. package/dist/frontend/services.js +90 -0
  688. package/dist/frontend/services.js.map +1 -0
  689. package/dist/frontend/services.test.d.ts +1 -0
  690. package/dist/frontend/services.test.js +174 -0
  691. package/dist/frontend/services.test.js.map +1 -0
  692. package/dist/frontend/ts7/adapter.d.ts +3 -3
  693. package/dist/frontend/ts7/adapter.js +14 -31
  694. package/dist/frontend/ts7/adapter.js.map +1 -1
  695. package/dist/frontend/ts7/api.d.ts +16 -0
  696. package/dist/frontend/ts7/api.js +24 -0
  697. package/dist/frontend/ts7/api.js.map +1 -0
  698. package/dist/frontend/ts7/ast-bytes.d.ts +31 -0
  699. package/dist/frontend/ts7/ast-bytes.js +137 -0
  700. package/dist/frontend/ts7/ast-bytes.js.map +1 -0
  701. package/dist/frontend/ts7/ast-bytes.test.d.ts +1 -0
  702. package/dist/frontend/ts7/ast-bytes.test.js +73 -0
  703. package/dist/frontend/ts7/ast-bytes.test.js.map +1 -0
  704. package/dist/frontend/ts7/ast-guards.generated.d.ts +353 -0
  705. package/dist/frontend/ts7/ast-guards.generated.js +1951 -0
  706. package/dist/frontend/ts7/ast-guards.generated.js.map +1 -0
  707. package/dist/frontend/ts7/ast-guards.test.d.ts +1 -0
  708. package/dist/frontend/ts7/ast-guards.test.js +43 -0
  709. package/dist/frontend/ts7/ast-guards.test.js.map +1 -0
  710. package/dist/frontend/ts7/ast-node.d.ts +194 -0
  711. package/dist/frontend/ts7/ast-node.js +448 -0
  712. package/dist/frontend/ts7/ast-node.js.map +1 -0
  713. package/dist/frontend/ts7/ast-node.test.d.ts +1 -0
  714. package/dist/frontend/ts7/ast-node.test.js +266 -0
  715. package/dist/frontend/ts7/ast-node.test.js.map +1 -0
  716. package/dist/frontend/ts7/ast-schema.generated.d.ts +503 -0
  717. package/dist/frontend/ts7/ast-schema.generated.js +1446 -0
  718. package/dist/frontend/ts7/ast-schema.generated.js.map +1 -0
  719. package/dist/frontend/ts7/ast-text.d.ts +6 -0
  720. package/dist/frontend/ts7/ast-text.js +124 -0
  721. package/dist/frontend/ts7/ast-text.js.map +1 -0
  722. package/dist/frontend/ts7/ast-text.test.d.ts +1 -0
  723. package/dist/frontend/ts7/ast-text.test.js +38 -0
  724. package/dist/frontend/ts7/ast-text.test.js.map +1 -0
  725. package/dist/frontend/ts7/ast-tokens.generated.d.ts +2 -0
  726. package/dist/frontend/ts7/ast-tokens.generated.js +155 -0
  727. package/dist/frontend/ts7/ast-tokens.generated.js.map +1 -0
  728. package/dist/frontend/ts7/ast-types.d.ts +42 -0
  729. package/dist/frontend/ts7/ast-types.generated.d.ts +1615 -0
  730. package/dist/frontend/ts7/ast-types.generated.js +5 -0
  731. package/dist/frontend/ts7/ast-types.generated.js.map +1 -0
  732. package/dist/frontend/ts7/ast-types.js +3 -0
  733. package/dist/frontend/ts7/ast-types.js.map +1 -0
  734. package/dist/frontend/ts7/ast-wire.d.ts +58 -0
  735. package/dist/frontend/ts7/ast-wire.js +267 -0
  736. package/dist/frontend/ts7/ast-wire.js.map +1 -0
  737. package/dist/frontend/ts7/ast-wire.test.d.ts +1 -0
  738. package/dist/frontend/ts7/ast-wire.test.js +151 -0
  739. package/dist/frontend/ts7/ast-wire.test.js.map +1 -0
  740. package/dist/frontend/ts7/ast.d.ts +14 -14
  741. package/dist/frontend/ts7/ast.js +21 -15
  742. package/dist/frontend/ts7/ast.js.map +1 -1
  743. package/dist/frontend/ts7/census-check.js +1 -0
  744. package/dist/frontend/ts7/census-check.js.map +1 -1
  745. package/dist/frontend/ts7/checker-cache.d.ts +48 -0
  746. package/dist/frontend/ts7/checker-cache.js +92 -0
  747. package/dist/frontend/ts7/checker-cache.js.map +1 -0
  748. package/dist/frontend/ts7/checker.d.ts +19 -46
  749. package/dist/frontend/ts7/checker.js +231 -161
  750. package/dist/frontend/ts7/checker.js.map +1 -1
  751. package/dist/frontend/ts7/checker.test.d.ts +1 -0
  752. package/dist/frontend/ts7/checker.test.js +335 -0
  753. package/dist/frontend/ts7/checker.test.js.map +1 -0
  754. package/dist/frontend/ts7/enums.d.ts +4 -27
  755. package/dist/frontend/ts7/enums.generated.d.ts +878 -0
  756. package/dist/frontend/ts7/enums.generated.js +1313 -0
  757. package/dist/frontend/ts7/enums.generated.js.map +1 -0
  758. package/dist/frontend/ts7/enums.js +4 -45
  759. package/dist/frontend/ts7/enums.js.map +1 -1
  760. package/dist/frontend/ts7/enums.test.d.ts +1 -0
  761. package/dist/frontend/ts7/enums.test.js +48 -0
  762. package/dist/frontend/ts7/enums.test.js.map +1 -0
  763. package/dist/frontend/ts7/native-api.d.ts +10 -0
  764. package/dist/frontend/ts7/native-api.js +10 -0
  765. package/dist/frontend/ts7/native-api.js.map +1 -0
  766. package/dist/frontend/ts7/native-host.d.ts +2 -0
  767. package/dist/frontend/ts7/native-host.js +11 -0
  768. package/dist/frontend/ts7/native-host.js.map +1 -0
  769. package/dist/frontend/ts7/native-process.d.ts +14 -0
  770. package/dist/frontend/ts7/native-process.js +62 -0
  771. package/dist/frontend/ts7/native-process.js.map +1 -0
  772. package/dist/frontend/ts7/program-adapter.d.ts +10 -98
  773. package/dist/frontend/ts7/program-adapter.js +16 -310
  774. package/dist/frontend/ts7/program-adapter.js.map +1 -1
  775. package/dist/frontend/ts7/program-host.d.ts +115 -0
  776. package/dist/frontend/ts7/program-host.js +347 -0
  777. package/dist/frontend/ts7/program-host.js.map +1 -0
  778. package/dist/frontend/ts7/program-host.test.d.ts +1 -0
  779. package/dist/frontend/ts7/program-host.test.js +207 -0
  780. package/dist/frontend/ts7/program-host.test.js.map +1 -0
  781. package/dist/frontend/ts7/rpc-api.d.ts +12 -0
  782. package/dist/frontend/ts7/rpc-api.js +23 -0
  783. package/dist/frontend/ts7/rpc-api.js.map +1 -0
  784. package/dist/frontend/ts7/rpc-client.d.ts +27 -0
  785. package/dist/frontend/ts7/rpc-client.js +102 -0
  786. package/dist/frontend/ts7/rpc-client.js.map +1 -0
  787. package/dist/frontend/ts7/rpc-client.test.d.ts +1 -0
  788. package/dist/frontend/ts7/rpc-client.test.js +133 -0
  789. package/dist/frontend/ts7/rpc-client.test.js.map +1 -0
  790. package/dist/frontend/ts7/rpc-filesystem.d.ts +16 -0
  791. package/dist/frontend/ts7/rpc-filesystem.js +42 -0
  792. package/dist/frontend/ts7/rpc-filesystem.js.map +1 -0
  793. package/dist/frontend/ts7/rpc-filesystem.test.d.ts +1 -0
  794. package/dist/frontend/ts7/rpc-filesystem.test.js +89 -0
  795. package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -0
  796. package/dist/frontend/ts7/rpc-process.d.ts +2 -0
  797. package/dist/frontend/ts7/rpc-process.js +148 -0
  798. package/dist/frontend/ts7/rpc-process.js.map +1 -0
  799. package/dist/frontend/ts7/rpc-process.test.d.ts +1 -0
  800. package/dist/frontend/ts7/rpc-process.test.js +29 -0
  801. package/dist/frontend/ts7/rpc-process.test.js.map +1 -0
  802. package/dist/frontend/ts7/rpc-wire.d.ts +46 -0
  803. package/dist/frontend/ts7/rpc-wire.js +195 -0
  804. package/dist/frontend/ts7/rpc-wire.js.map +1 -0
  805. package/dist/frontend/ts7/rpc-wire.test.d.ts +1 -0
  806. package/dist/frontend/ts7/rpc-wire.test.js +168 -0
  807. package/dist/frontend/ts7/rpc-wire.test.js.map +1 -0
  808. package/dist/frontend/ts7/semantic-checker.d.ts +137 -0
  809. package/dist/frontend/ts7/semantic-checker.js +221 -0
  810. package/dist/frontend/ts7/semantic-checker.js.map +1 -0
  811. package/dist/frontend/ts7/semantic-checker.test.d.ts +1 -0
  812. package/dist/frontend/ts7/semantic-checker.test.js +119 -0
  813. package/dist/frontend/ts7/semantic-checker.test.js.map +1 -0
  814. package/dist/frontend/ts7/semantic-json.d.ts +5 -0
  815. package/dist/frontend/ts7/semantic-json.js +52 -0
  816. package/dist/frontend/ts7/semantic-json.js.map +1 -0
  817. package/dist/frontend/ts7/semantic-json.test.d.ts +1 -0
  818. package/dist/frontend/ts7/semantic-json.test.js +42 -0
  819. package/dist/frontend/ts7/semantic-json.test.js.map +1 -0
  820. package/dist/frontend/ts7/semantic-model.d.ts +222 -0
  821. package/dist/frontend/ts7/semantic-model.js +423 -0
  822. package/dist/frontend/ts7/semantic-model.js.map +1 -0
  823. package/dist/frontend/ts7/semantic-model.test.d.ts +1 -0
  824. package/dist/frontend/ts7/semantic-model.test.js +322 -0
  825. package/dist/frontend/ts7/semantic-model.test.js.map +1 -0
  826. package/dist/frontend/ts7/semantic-schema.generated.d.ts +283 -0
  827. package/dist/frontend/ts7/semantic-schema.generated.js +222 -0
  828. package/dist/frontend/ts7/semantic-schema.generated.js.map +1 -0
  829. package/dist/frontend/ts7/semantic-types.d.ts +5 -0
  830. package/dist/frontend/ts7/semantic-types.js +2 -0
  831. package/dist/frontend/ts7/semantic-types.js.map +1 -0
  832. package/dist/frontend/ts7/session-cache.d.ts +17 -0
  833. package/dist/frontend/ts7/session-cache.js +97 -0
  834. package/dist/frontend/ts7/session-cache.js.map +1 -0
  835. package/dist/frontend/ts7/session-cache.test.d.ts +1 -0
  836. package/dist/frontend/ts7/session-cache.test.js +87 -0
  837. package/dist/frontend/ts7/session-cache.test.js.map +1 -0
  838. package/dist/frontend/ts7/session-path.d.ts +18 -0
  839. package/dist/frontend/ts7/session-path.js +203 -0
  840. package/dist/frontend/ts7/session-path.js.map +1 -0
  841. package/dist/frontend/ts7/session-path.test.d.ts +1 -0
  842. package/dist/frontend/ts7/session-path.test.js +34 -0
  843. package/dist/frontend/ts7/session-path.test.js.map +1 -0
  844. package/dist/frontend/ts7/session-schema.generated.d.ts +167 -0
  845. package/dist/frontend/ts7/session-schema.generated.js +5 -0
  846. package/dist/frontend/ts7/session-schema.generated.js.map +1 -0
  847. package/dist/frontend/ts7/session-timing.d.ts +50 -0
  848. package/dist/frontend/ts7/session-timing.js +61 -0
  849. package/dist/frontend/ts7/session-timing.js.map +1 -0
  850. package/dist/frontend/ts7/session-timing.test.d.ts +1 -0
  851. package/dist/frontend/ts7/session-timing.test.js +52 -0
  852. package/dist/frontend/ts7/session-timing.test.js.map +1 -0
  853. package/dist/frontend/ts7/session.d.ts +105 -0
  854. package/dist/frontend/ts7/session.js +233 -0
  855. package/dist/frontend/ts7/session.js.map +1 -0
  856. package/dist/frontend/ts7/session.test.d.ts +1 -0
  857. package/dist/frontend/ts7/session.test.js +215 -0
  858. package/dist/frontend/ts7/session.test.js.map +1 -0
  859. package/dist/frontend/ts7/source-parser-node.d.ts +6 -0
  860. package/dist/frontend/ts7/source-parser-node.js +15 -0
  861. package/dist/frontend/ts7/source-parser-node.js.map +1 -0
  862. package/dist/frontend/ts7/source-parser.d.ts +25 -0
  863. package/dist/frontend/ts7/source-parser.js +96 -0
  864. package/dist/frontend/ts7/source-parser.js.map +1 -0
  865. package/dist/frontend/ts7/source-parser.test.d.ts +1 -0
  866. package/dist/frontend/ts7/source-parser.test.js +151 -0
  867. package/dist/frontend/ts7/source-parser.test.js.map +1 -0
  868. package/dist/frontend/ts7/syntax.d.ts +3 -0
  869. package/dist/frontend/ts7/syntax.js +4 -0
  870. package/dist/frontend/ts7/syntax.js.map +1 -0
  871. package/dist/frontend/tsc-codes.js +3 -0
  872. package/dist/frontend/tsc-codes.js.map +1 -1
  873. package/dist/frontend/type-mapper.d.ts +29 -19
  874. package/dist/frontend/type-mapper.js +713 -306
  875. package/dist/frontend/type-mapper.js.map +1 -1
  876. package/dist/frontend/type-mapper.test.d.ts +1 -0
  877. package/dist/frontend/type-mapper.test.js +207 -0
  878. package/dist/frontend/type-mapper.test.js.map +1 -0
  879. package/dist/frontend/union-discriminants.d.ts +16 -0
  880. package/dist/frontend/union-discriminants.js +98 -0
  881. package/dist/frontend/union-discriminants.js.map +1 -0
  882. package/dist/frontend/union-discriminants.test.d.ts +1 -0
  883. package/dist/frontend/union-discriminants.test.js +182 -0
  884. package/dist/frontend/union-discriminants.test.js.map +1 -0
  885. package/dist/index.d.ts +7 -197
  886. package/dist/index.js +369 -1567
  887. package/dist/index.js.map +1 -1
  888. package/dist/ir/analysis.d.ts +16 -4
  889. package/dist/ir/analysis.js +25 -6
  890. package/dist/ir/analysis.js.map +1 -1
  891. package/dist/ir/analysis.test.js +15 -2
  892. package/dist/ir/analysis.test.js.map +1 -1
  893. package/dist/ir/constant-tables.js +67 -49
  894. package/dist/ir/constant-tables.js.map +1 -1
  895. package/dist/ir/constant-tables.test.js +1 -1
  896. package/dist/ir/control-flow.d.ts +6 -0
  897. package/dist/ir/control-flow.js +142 -0
  898. package/dist/ir/control-flow.js.map +1 -0
  899. package/dist/ir/control-flow.test.d.ts +1 -0
  900. package/dist/ir/control-flow.test.js +113 -0
  901. package/dist/ir/control-flow.test.js.map +1 -0
  902. package/dist/ir/integer-loops.js +7 -18
  903. package/dist/ir/integer-loops.js.map +1 -1
  904. package/dist/ir/integer-ranges.js +53 -27
  905. package/dist/ir/integer-ranges.js.map +1 -1
  906. package/dist/ir/ir.d.ts +309 -164
  907. package/dist/ir/ir.js +588 -879
  908. package/dist/ir/ir.js.map +1 -1
  909. package/dist/ir/ir.test.js +127 -1
  910. package/dist/ir/ir.test.js.map +1 -1
  911. package/dist/ir/scalar-records.js +165 -134
  912. package/dist/ir/scalar-records.js.map +1 -1
  913. package/dist/ir/scalar-records.test.js +1 -1
  914. package/dist/ir/serialize.d.ts +4 -2
  915. package/dist/ir/serialize.js +19 -12
  916. package/dist/ir/serialize.js.map +1 -1
  917. package/dist/ir/serialize.test.d.ts +1 -0
  918. package/dist/ir/serialize.test.js +53 -0
  919. package/dist/ir/serialize.test.js.map +1 -0
  920. package/dist/ir/traverse.d.ts +41 -0
  921. package/dist/ir/traverse.js +660 -0
  922. package/dist/ir/traverse.js.map +1 -0
  923. package/dist/ir/traverse.test.d.ts +1 -0
  924. package/dist/ir/traverse.test.js +242 -0
  925. package/dist/ir/traverse.test.js.map +1 -0
  926. package/dist/ir/validate.js +1956 -1496
  927. package/dist/ir/validate.js.map +1 -1
  928. package/dist/ir/validate.test.js +476 -2
  929. package/dist/ir/validate.test.js.map +1 -1
  930. package/dist/library/cache-primitives.d.ts +2 -3
  931. package/dist/library/cache-primitives.js +4 -6
  932. package/dist/library/cache-primitives.js.map +1 -1
  933. package/dist/library/compiler-self-identity.d.ts +1 -1
  934. package/dist/library/compiler-self-identity.js +31 -15
  935. package/dist/library/compiler-self-identity.js.map +1 -1
  936. package/dist/library/compiler-self-identity.test.d.ts +1 -0
  937. package/dist/library/compiler-self-identity.test.js +93 -0
  938. package/dist/library/compiler-self-identity.test.js.map +1 -0
  939. package/dist/library/fence-eval.js +2 -2
  940. package/dist/library/fence-eval.js.map +1 -1
  941. package/dist/library/int-infer.js +7 -6
  942. package/dist/library/int-infer.js.map +1 -1
  943. package/dist/library/int-infer.test.js +4 -4
  944. package/dist/library/library-cache.d.ts +3 -2
  945. package/dist/library/library-cache.js +5 -17
  946. package/dist/library/library-cache.js.map +1 -1
  947. package/dist/library/library-cache.test.js +54 -41
  948. package/dist/library/library-cache.test.js.map +1 -1
  949. package/dist/library/library-profile.d.ts +3 -1
  950. package/dist/library/library-profile.js +15 -6
  951. package/dist/library/library-profile.js.map +1 -1
  952. package/dist/library/prepare.d.ts +15 -0
  953. package/dist/library/prepare.js +584 -0
  954. package/dist/library/prepare.js.map +1 -0
  955. package/dist/library/semantic-source.d.ts +1 -1
  956. package/dist/library/semantic-source.js +8 -6
  957. package/dist/library/semantic-source.js.map +1 -1
  958. package/dist/library/sidecar-validate.js +4 -4
  959. package/dist/library/sidecar-validate.js.map +1 -1
  960. package/dist/library/sidecar.d.ts +2 -0
  961. package/dist/library/sidecar.js +10 -3
  962. package/dist/library/sidecar.js.map +1 -1
  963. package/dist/native/cache.d.ts +11 -0
  964. package/dist/native/cache.js +113 -0
  965. package/dist/native/cache.js.map +1 -0
  966. package/dist/native/cache.test.d.ts +1 -0
  967. package/dist/native/cache.test.js +66 -0
  968. package/dist/native/cache.test.js.map +1 -0
  969. package/dist/native/cli.d.ts +1 -0
  970. package/dist/native/cli.js +112 -0
  971. package/dist/native/cli.js.map +1 -0
  972. package/dist/native/compiler.d.ts +15 -0
  973. package/dist/native/compiler.js +336 -0
  974. package/dist/native/compiler.js.map +1 -0
  975. package/dist/native/compiler.test.d.ts +1 -0
  976. package/dist/native/compiler.test.js +174 -0
  977. package/dist/native/compiler.test.js.map +1 -0
  978. package/dist/native/comptime.d.ts +5 -0
  979. package/dist/native/comptime.js +73 -0
  980. package/dist/native/comptime.js.map +1 -0
  981. package/dist/native/comptime.test.d.ts +1 -0
  982. package/dist/native/comptime.test.js +65 -0
  983. package/dist/native/comptime.test.js.map +1 -0
  984. package/dist/native/executable-cache.d.ts +26 -0
  985. package/dist/native/executable-cache.js +228 -0
  986. package/dist/native/executable-cache.js.map +1 -0
  987. package/dist/native/executable-cache.test.d.ts +1 -0
  988. package/dist/native/executable-cache.test.js +151 -0
  989. package/dist/native/executable-cache.test.js.map +1 -0
  990. package/dist/native/file-identity.d.ts +4 -0
  991. package/dist/native/file-identity.js +14 -0
  992. package/dist/native/file-identity.js.map +1 -0
  993. package/dist/native/file-identity.test.d.ts +1 -0
  994. package/dist/native/file-identity.test.js +43 -0
  995. package/dist/native/file-identity.test.js.map +1 -0
  996. package/dist/native/library.d.ts +22 -0
  997. package/dist/native/library.js +83 -0
  998. package/dist/native/library.js.map +1 -0
  999. package/dist/native/prepare.d.ts +21 -0
  1000. package/dist/native/prepare.js +174 -0
  1001. package/dist/native/prepare.js.map +1 -0
  1002. package/dist/native/prepare.test.d.ts +1 -0
  1003. package/dist/native/prepare.test.js +70 -0
  1004. package/dist/native/prepare.test.js.map +1 -0
  1005. package/dist/native/sanitizer.d.ts +11 -0
  1006. package/dist/native/sanitizer.js +135 -0
  1007. package/dist/native/sanitizer.js.map +1 -0
  1008. package/dist/native/sanitizer.test.d.ts +1 -0
  1009. package/dist/native/sanitizer.test.js +58 -0
  1010. package/dist/native/sanitizer.test.js.map +1 -0
  1011. package/dist/native/task.d.ts +4 -0
  1012. package/dist/native/task.js +16 -0
  1013. package/dist/native/task.js.map +1 -0
  1014. package/dist/native/task.test.d.ts +1 -0
  1015. package/dist/native/task.test.js +17 -0
  1016. package/dist/native/task.test.js.map +1 -0
  1017. package/dist/native/toolchain.d.ts +45 -0
  1018. package/dist/native/toolchain.js +74 -0
  1019. package/dist/native/toolchain.js.map +1 -0
  1020. package/dist/native/toolchain.test.d.ts +1 -0
  1021. package/dist/native/toolchain.test.js +33 -0
  1022. package/dist/native/toolchain.test.js.map +1 -0
  1023. package/dist/startup-cache.d.ts +1 -1
  1024. package/dist/startup-cache.js +2 -5
  1025. package/dist/startup-cache.js.map +1 -1
  1026. package/dist/timing.d.ts +4 -0
  1027. package/dist/timing.js +19 -0
  1028. package/dist/timing.js.map +1 -0
  1029. package/dist/wasi-paths.js +10 -7
  1030. package/dist/wasi-paths.js.map +1 -1
  1031. package/package.json +28 -19
  1032. package/surface-manifest.json +171 -18
  1033. package/dist/backend/c/async.d.ts +0 -171
  1034. package/dist/backend/c/async.js +0 -1317
  1035. package/dist/backend/c/async.js.map +0 -1
  1036. package/dist/backend/c/c-emitter.d.ts +0 -531
  1037. package/dist/backend/c/c-emitter.js +0 -1917
  1038. package/dist/backend/c/c-emitter.js.map +0 -1
  1039. package/dist/backend/c/exprs.d.ts +0 -15
  1040. package/dist/backend/c/exprs.js +0 -8803
  1041. package/dist/backend/c/exprs.js.map +0 -1
  1042. package/dist/backend/c/island.d.ts +0 -45
  1043. package/dist/backend/c/island.js +0 -281
  1044. package/dist/backend/c/island.js.map +0 -1
  1045. package/dist/backend/c/may-throw.js.map +0 -1
  1046. package/dist/backend/c/shapes.d.ts +0 -142
  1047. package/dist/backend/c/shapes.js +0 -603
  1048. package/dist/backend/c/shapes.js.map +0 -1
  1049. package/dist/backend/c/stmts.d.ts +0 -76
  1050. package/dist/backend/c/stmts.js +0 -1084
  1051. package/dist/backend/c/stmts.js.map +0 -1
  1052. package/dist/backend/c/types.d.ts +0 -71
  1053. package/dist/backend/c/types.js +0 -459
  1054. package/dist/backend/c/types.js.map +0 -1
  1055. package/dist/backend/c/types.test.js +0 -32
  1056. package/dist/backend/c/types.test.js.map +0 -1
  1057. package/dist/backend/c/walkers.d.ts +0 -134
  1058. package/dist/backend/c/walkers.js +0 -1773
  1059. package/dist/backend/c/walkers.js.map +0 -1
  1060. /package/dist/backend/{c/types.test.d.ts → cycle-analysis.test.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,11 +1,15 @@
1
+ import { compilationTiming } from "./timing.js";
2
+ import { prepareExecutableModule } from "./executable/prepare.js";
3
+ import { prepareLibrary, libraryLocalizeSymbols, libraryWasmExports, libraryWasmRefusal } from "./library/prepare.js";
4
+ import { analyzeWithFrontend } from "./frontend/analysis.js";
5
+ import { llvmRefusalDiag, targetRefusalDiag } from "./backend/target-diagnostics.js";
6
+ import { compilePackedLibrary } from "./backend/library-pack.js";
1
7
  import { InternalCompilerError } from "./errors.js";
2
- import { mkdir, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
3
- import { tmpdir } from "node:os";
8
+ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
4
9
  import { basename, dirname, join, resolve } from "node:path";
5
10
  import { clearCcCaches, configuredTargetPlatform } from "./backend/native-toolchain.js";
6
11
  import { buildCacheRoot, prepareBuildCacheRoot, pruneBuildCache } from "./backend/build-cache.js";
7
- import { assertLegacyCExecutablePipelineEnabled, CcCompileError, compileExternalC, compileExternalCLibrary, executableNativeEnvironmentFingerprint, legacyCExecutablePathRequested, mobileLibraryTarget, mobileTargetRefusal, resolveCc, targetPlatform, } from "./backend/external-c.js";
8
- import { emitCModule } from "./backend/c/c-emitter.js";
12
+ import { CcCompileError, compileExternalC, compileExternalCLibrary, executableNativeEnvironmentFingerprint, mobileLibraryTarget, mobileTargetRefusal, resolveCc, } from "./backend/external-c.js";
9
13
  import { emitLlvmModule, LlvmUnsupportedError } from "./backend/llvm/emitter.js";
10
14
  import { emitNativeArtifact, NativeCodegenError } from "./backend/native-codegen.js";
11
15
  import { privateSiblingPath } from "./backend/build-cache.js";
@@ -16,40 +20,31 @@ import { RuntimePackError } from "./backend/runtime-pack.js";
16
20
  import { createNativeLinkPlan } from "./backend/link-plan.js";
17
21
  import { executableLinkerEnvironmentFingerprint, linkNativeExecutable, platformLinkerSupportsPersistentCache, resolvePlatformLinker, } from "./backend/linker.js";
18
22
  import { splitLlvmLibraryProgram, splitLlvmProgram } from "./backend/llvm/split.js";
19
- import { rebaseLibrarySourceComments, replaceLibraryIdentity, stripLibraryIdentity, stripLibrarySourceComments } from "./backend/library-identity-markers.js";
20
- import { checkerPanicDiag, ffiNativeBuildDiag, libAsyncExportDiag, libAsyncSurfaceDiag, libExportUnresolvedDiag, libGenericExportDiag, libIntBoundaryDiag, libNpmIneligibleDiag, libSidecarDiag, libUnmappableSignatureDiag, iceDiag, isCheckerPanic, LIB_INBOUND_BYTES_TRAP_CODE, LIB_RUNTIME_TRAP_CODES, nativeCodegenDiag } from "./diagnostics/diagnostic.js";
21
- import { checkLibraryIntegerSlots, classSeed, hasIntSlots, numberCarrierKind } from "./library/int-infer.js";
22
- import { loadLibraryProfile, profileRemediation, profileTeaching } from "./library/library-profile.js";
23
- import { clearFenceEvalCaches, decorateLibraryRefusals, evaluateLibraryFences } from "./library/fence-eval.js";
24
- import { assembleTrapTeaching } from "./library/trap-teaching.js";
25
- import { buildSidecar, canonicalModuleGraph, canonicalPath, clearSidecarCaches, compilerReleaseVersion, libraryIdentityHashes, updateSidecarIdentity, } from "./library/sidecar.js";
26
- import { validateSidecar } from "./library/sidecar-validate.js";
27
- import { entryFunctionExports } from "./frontend/lib-exports.js";
28
- import { entryContractFacts } from "./frontend/lib-contract.js";
29
- import { moduleLibAsyncSurface, moduleLibNondeterministicSurface, moduleEmbedsBuiltin, moduleEmbedsCompressedNpm, moduleUsesAssert, moduleUsesCopying, moduleUsesDc, moduleUsesDgram, moduleUsesDynAsync, moduleUsesDynInvoke, moduleUsesEmitter, moduleUsesFetch, moduleUsesFileHandle, moduleUsesFsWatch, moduleUsesHttp2, moduleUsesHttpServer, moduleUsesInspect, moduleUsesLegacyTextDecoder, moduleUsesNet, moduleUsesNodeTest, moduleUsesParseArgs, moduleUsesProcessEvents, moduleUsesQs, moduleUsesRegex, moduleUsesSearchParams, moduleUsesStream, moduleUsesSymbol, moduleUsesTls, moduleUsesTlsCa, moduleUsesZlib } from "./ir/ir.js";
30
- import { moduleUsesBigInt } from "./ir/ir.js";
23
+ import { emitLibraryIdentityLines, replaceLibraryIdentity, stripLibraryIdentity } from "./backend/library-identity-markers.js";
24
+ import { ffiNativeBuildDiag, iceDiag, nativeCodegenDiag } from "./diagnostics/diagnostic.js";
25
+ import { loadLibraryProfile } from "./library/library-profile.js";
26
+ import { clearFenceEvalCaches, decorateLibraryRefusals } from "./library/fence-eval.js";
27
+ import { canonicalModuleGraph, clearSidecarCaches, compilerReleaseVersion, libraryIdentityHashes, updateSidecarIdentity, } from "./library/sidecar.js";
28
+ import { moduleRuntimeFeatures } from "./ir/ir.js";
31
29
  import { serializeModule } from "./ir/serialize.js";
32
30
  import { validateModule } from "./ir/validate.js";
33
- import { canonicalBuiltinModule, checkPreflight, isNodeTypesPath, loadProgram, locOf, requiresOf, resolveNpmImport } from "./frontend/program.js";
34
- import { npmStaticIneligibleReason, npmStaticOffenders, npmStaticPackageOfPath } from "./frontend/npm-static.js";
31
+ import { loadProgram } from "./frontend/program-node.js";
32
+ import { runFrontend } from "./frontend/pipeline.js";
35
33
  import { provenanceSources } from "./frontend/provenance-registry.js";
36
- import { clearResolveCaches, resolveBareModule } from "./frontend/resolve.js";
37
- import { isJsSourceFileName } from "./frontend/tsc-codes.js";
38
- import { isRelativeSpecifier, packageNameOfSpecifier } from "./frontend/workspace-registry.js";
39
- import { lowerToIr } from "./frontend/lowering/lowerer.js";
34
+ import { clearResolveCaches } from "./frontend/resolve.js";
40
35
  import { loadFfiProfile } from "./ffi/ffi-manifest.js";
41
- import { hasForeignFfiCallback } from "./backend/ffi-callbacks.js";
36
+ import { executableLinkFeatures } from "./backend/executable-features.js";
42
37
  import { FrontendInputTracker, trackedReadFile } from "./frontend/input-tracker.js";
43
38
  import { libraryFrontendImplementationFingerprint, publishEarlyLibraryCache, readEarlyLibraryCache, readSemanticLibraryCache } from "./library/library-cache.js";
44
- import { createSourceLineRebaser } from "./library/semantic-source.js";
45
39
  import { publishEarlyExecutableCache, publishEarlyExecutableRoute, readEarlyExecutableCache } from "./executable/executable-cache.js";
46
40
  import { compilerImplementationIdentity } from "./library/compiler-self-identity.js";
47
41
  export const VERSION = "0.0.1";
48
42
  export { EXTERNAL_OBJECT_ABI_STABILITY, RUNTIME_ABI_MARKER, RUNTIME_ABI_VERSION, } from "./backend/runtime-abi.js";
49
43
  export { InternalCompilerError } from "./errors.js";
50
- export { compileExternalC as compileC, compileExternalC, runtimeSrcDir, warmNativeCaches, } from "./backend/external-c.js";
44
+ export { compileExternalC as compileC, compileExternalC, runtimeSrcDir, } from "./backend/external-c.js";
45
+ export { warmNativeCaches } from "./backend/warm-cache.js";
51
46
  export { ANDROID_MIN_API, IPHONEOS_MIN_VERSION, isAndroidTarget, isIosTarget, isMobileTarget, mobileLibraryTarget, mobileTargetRefusal } from "./backend/external-c.js";
52
- export { emitCModule, emitCModule as emitModule, } from "./backend/c/c-emitter.js";
47
+ export { emitLlvmModule } from "./backend/llvm/emitter.js";
53
48
  export { renderDiagnostics, renderDiagnostics as renderAll, renderDiagnostic, } from "./diagnostics/render.js";
54
49
  export { renderCoverage } from "./coverage/report.js";
55
50
  export { generateSurfaceManifest, renderSurfaceManifest, MANIFEST_SCHEMA_VERSION, } from "./coverage/surface-manifest.js";
@@ -64,134 +59,11 @@ export { abiExportSuffixes, buildSidecar, canonicalModuleGraph, canonicalPath, c
64
59
  export { validateSidecar } from "./library/sidecar-validate.js";
65
60
  export { BUILD_ID_SEED, SOURCE_HASH_SEED, hex16, lengthPrefixedStream, wyhash64 } from "./library/wyhash.js";
66
61
  export { ISLAND_SURFACE, STATIC_MATH_PROPS } from "./frontend/lowering/surfaces.js";
67
- export { ambientDtsPath, isExactExternalTypeSpecifier, overridesDtsPath } from "./frontend/program.js";
62
+ export { ambientDtsPath, isExactExternalTypeSpecifier, overridesDtsPath } from "./frontend/program-node.js";
68
63
  export { resolveProvenanceSources } from "./frontend/provenance.js";
69
64
  export { wasiGuestPath } from "./wasi-paths.js";
70
65
  export { setProvenanceSources, } from "./frontend/provenance-registry.js";
71
66
  export * as ir from "./ir/ir.js";
72
- /** The LLVM backend's tier refusal as a diagnostic. SC3xxx = backend
73
- * coverage (the program is fine — this backend doesn't compile it yet);
74
- * the parenthesized kind tag is machine-readable for the differential
75
- * harness's histogram. */
76
- function llvmRefusalDiag(err, entryPath) {
77
- return {
78
- code: "SC3001",
79
- message: err.message,
80
- loc: err.loc ?? { file: entryPath, start: 0, end: 0 },
81
- };
82
- }
83
- /** A valid IR surface the explicitly-selected code generator cannot host.
84
- * SC3001 is backend coverage (as with an LLVM tier refusal), not a target
85
- * capability gap: wasm32-wasi's production LLVM lane still accepts it. */
86
- function backendRefusalDiag(backend, target, surface, loc) {
87
- return {
88
- code: "SC3001",
89
- message: `${backend} backend does not support ${surface} for ${target}; use --backend llvm`,
90
- loc,
91
- };
92
- }
93
- /** A valid program surface that the selected execution target cannot host.
94
- * SC3xxx stays the backend/target-coverage family: source semantics are
95
- * valid, but this target deliberately refuses them instead of emitting a
96
- * binary that traps later. */
97
- function targetRefusalDiag(target, surface, loc) {
98
- return {
99
- code: "SC3002",
100
- message: `${target} target does not support ${surface}`,
101
- loc,
102
- };
103
- }
104
- /** APIs that require host capabilities absent from portable WASI Preview 1.
105
- * These are target diagnostics, not backend-tier gaps: the same language IR
106
- * (including async, generators, and the dynamic island) is otherwise valid.
107
- * Keep the fine-grained walk first so diagnostics point at the API use; the
108
- * embedded-module checks are the entry-anchored safety net for island code. */
109
- function moduleWasiUnavailableSurface(mod) {
110
- const entryLoc = { file: mod.sourceFile, start: 0, end: 0 };
111
- const prefixes = [
112
- ["cp.", "child processes (WASI Preview 1 has no process-spawning API)"],
113
- ["child.", "child processes (WASI Preview 1 has no process-spawning API)"],
114
- ["spawnRes.", "child processes (WASI Preview 1 has no process-spawning API)"],
115
- ["net.", "network sockets (WASI Preview 1 has no socket API)"],
116
- ["http.", "network sockets (WASI Preview 1 has no socket API)"],
117
- ["https.", "network sockets (WASI Preview 1 has no socket API)"],
118
- ["http2.", "network sockets (WASI Preview 1 has no socket API)"],
119
- ["h2.", "network sockets (WASI Preview 1 has no socket API)"],
120
- ["dgram.", "network sockets (WASI Preview 1 has no socket API)"],
121
- ["dns.", "network sockets (WASI Preview 1 has no socket API)"],
122
- ["tls.", "network sockets (WASI Preview 1 has no socket API)"],
123
- ["fetch.", "network-backed fetch (WASI Preview 1 has no socket API)"],
124
- ["fs.watch", "filesystem watching (WASI Preview 1 has no notification API)"],
125
- ["watcher.", "filesystem watching (WASI Preview 1 has no notification API)"],
126
- ];
127
- const kinds = new Map([
128
- ["child", "child processes (WASI Preview 1 has no process-spawning API)"],
129
- ["spawnRes", "child processes (WASI Preview 1 has no process-spawning API)"],
130
- ["childStream", "child processes (WASI Preview 1 has no process-spawning API)"],
131
- ["childWriter", "child processes (WASI Preview 1 has no process-spawning API)"],
132
- ["netServer", "network sockets (WASI Preview 1 has no socket API)"],
133
- ["netSocket", "network sockets (WASI Preview 1 has no socket API)"],
134
- ["http2Session", "network sockets (WASI Preview 1 has no socket API)"],
135
- ["http2Stream", "network sockets (WASI Preview 1 has no socket API)"],
136
- ["dgramSocket", "network sockets (WASI Preview 1 has no socket API)"],
137
- ["fsWatcher", "filesystem watching (WASI Preview 1 has no notification API)"],
138
- ["httpReq", "network sockets (WASI Preview 1 has no socket API)"],
139
- ["httpRes", "network sockets (WASI Preview 1 has no socket API)"],
140
- ["httpClientReq", "network sockets (WASI Preview 1 has no socket API)"],
141
- ["secureCtx", "network sockets (WASI Preview 1 has no socket API)"],
142
- ]);
143
- let found = null;
144
- const visit = (value, inheritedLoc) => {
145
- if (found !== null || value === null || typeof value !== "object")
146
- return;
147
- if (Array.isArray(value)) {
148
- for (const item of value)
149
- visit(item, inheritedLoc);
150
- return;
151
- }
152
- const node = value;
153
- const loc = node.loc ?? inheritedLoc;
154
- if (typeof node.kind === "string") {
155
- const kindSurface = kinds.get(node.kind);
156
- if (kindSurface !== undefined) {
157
- found = { surface: kindSurface, loc };
158
- return;
159
- }
160
- if (node.kind === "libCall" && typeof node.fn === "string") {
161
- if (node.fn === "process.kill" || node.fn === "process.killNum" ||
162
- node.fn === "process.onSignal" || node.fn === "process.offSignal") {
163
- found = { surface: "OS signals (WASI Preview 1 has no signal API)", loc };
164
- return;
165
- }
166
- if (node.fn === "os.networkInterfaces") {
167
- found = { surface: "network-interface enumeration (WASI Preview 1 has no interface API)", loc };
168
- return;
169
- }
170
- for (const [prefix, surface] of prefixes) {
171
- if (node.fn.startsWith(prefix)) {
172
- found = { surface, loc };
173
- return;
174
- }
175
- }
176
- }
177
- }
178
- for (const key of Object.keys(value)) {
179
- visit(value[key], loc);
180
- }
181
- };
182
- visit(mod, entryLoc);
183
- if (found !== null)
184
- return found;
185
- if (moduleUsesFetch(mod)) {
186
- return { surface: "network-backed fetch (WASI Preview 1 has no socket API)", loc: entryLoc };
187
- }
188
- for (const builtin of ["node:http", "node:https", "node:net", "node:tls"]) {
189
- if (moduleEmbedsBuiltin(mod, builtin)) {
190
- return { surface: `${builtin} networking (WASI Preview 1 has no socket API)`, loc: entryLoc };
191
- }
192
- }
193
- return null;
194
- }
195
67
  /** Clang may print every warning from the generated/runtime translation
196
68
  * units before the actionable linker failure. Keep the source diagnostic
197
69
  * precise by starting at the first portable linker marker; if the driver
@@ -204,19 +76,9 @@ function ffiNativeBuildDetail(err) {
204
76
  return (`${err.driver} ${linkerMarker >= 0 ? "could not link the generated program" : "failed while building the generated program"}` +
205
77
  (output.length > 0 ? `:\n${output}` : ""));
206
78
  }
207
- /** The platform the BUILD is for — the SCRIPTC_TARGET triple's OS under a
208
- * cross compile, the host's otherwise. The frontend needs it too (the
209
- * whole program compiles for ONE platform, so path.sep / os.EOL literals
210
- * and the path-module binding are compile-time constants); a malformed
211
- * SCRIPTC_CC/SCRIPTC_TARGET combination reports at compileC exactly as
212
- * before, so analysis falls back to the host here rather than throwing. */
79
+ /** Platform semantics depend on the output target, without compiler discovery. */
213
80
  export function buildTargetPlatform(env = process.env) {
214
- try {
215
- return targetPlatform(resolveCc(env));
216
- }
217
- catch {
218
- return process.platform;
219
- }
81
+ return configuredTargetPlatform(env);
220
82
  }
221
83
  /** Target-platform classification without compiler or SDK discovery. Source
222
84
  * artifacts need target semantics for lowering, but do not need a native
@@ -224,429 +86,11 @@ export function buildTargetPlatform(env = process.env) {
224
86
  export function sourceTargetPlatform(env = process.env) {
225
87
  return configuredTargetPlatform(env);
226
88
  }
227
- /** --npm-static=auto (and library mode's mandatory twin): one throwaway
228
- * load finds every bare npm import the program's own modules make, then
229
- * the eligibility heuristics (npm-static.ts) pick the packages whose
230
- * shipped JS is worth attempting. Rejected candidates report their reason
231
- * so the coverage output says why auto skipped them.
232
- *
233
- * "lib" widens the scan to the STATIC-OR-REFUSE posture (a fallback
234
- * status is a build-stopping SC4020 there, never an island note):
235
- * - opted-in packages' OWN files are scanned too — import statements
236
- * and top-level requires alike — so runFrontend's fixpoint loop
237
- * judges every bare edge the growing graph exposes (the executable
238
- * lane leaves a package's deps to the island; the library lane has
239
- * no island);
240
- * - a bare specifier no TYPES resolution answers but whose runtime JS
241
- * resolves (a package with no own .d.ts) is judged instead of
242
- * skipped — it fails the bar by name, not as a generic import fence;
243
- * - `judged` dedups across fixpoint iterations and `sites` records
244
- * each package's first import site, the SC4020 anchor. */
245
- function detectAutoPackages(load, statuses, mode = "auto", judged, sites) {
246
- // package → the resolved types file AND the file whose import found it:
247
- // the runtime-JS probe below must resolve from the SAME importing file,
248
- // or a package visible only to a nested package.json realm (a pnpm
249
- // monorepo's packages/*/node_modules, unreachable from the entry's own
250
- // walk-up) answers "no runtime JS" for perfectly ordinary installs.
251
- const seen = new Map();
252
- for (const sf of [...load.moduleOrder, load.entry]) {
253
- if (mode === "auto" && sf.fileName.includes("/node_modules/"))
254
- continue;
255
- const edges = [];
256
- for (const stmt of sf.statements) {
257
- if (ts7IsImportWithStringSpec(stmt)) {
258
- edges.push({ spec: stmt.moduleSpecifier.text, loc: locOf(stmt) });
259
- }
260
- else if (mode === "lib") {
261
- // CJS packages spell their dep edges as top-level requires; the
262
- // import-statement scan alone would miss every one of them.
263
- for (const req of requiresOf(stmt))
264
- edges.push({ spec: req.spec, loc: locOf(req.node) });
265
- }
266
- }
267
- for (const { spec, loc } of edges) {
268
- if (isRelativeSpecifier(spec) || spec.startsWith("node:") || spec.startsWith("#"))
269
- continue;
270
- // Bare builtin names ("fs", "path") are the builtin machinery's
271
- // business (and the SC4005 async_free gate's, in library mode) —
272
- // never npm candidates. Auto keeps its original path (the
273
- // @types/node answer skips them below), byte-for-byte.
274
- if (mode === "lib" && canonicalBuiltinModule(spec) !== null)
275
- continue;
276
- const npm = resolveNpmImport(sf.fileName, spec);
277
- if (npm !== null && isNodeTypesPath(npm.typesFile))
278
- continue;
279
- if (npm === null) {
280
- if (mode !== "lib")
281
- continue;
282
- const js = resolveBareModule(sf.fileName, spec, "js-only");
283
- if (js === null || judged.has(js.packageName))
284
- continue;
285
- judged.add(js.packageName);
286
- sites.set(js.packageName, loc);
287
- statuses.push({ package: js.packageName, status: "fallback", detail: "it ships no own .d.ts declaration surface" });
288
- continue;
289
- }
290
- if (judged?.has(npm.packageName))
291
- continue;
292
- if (!seen.has(npm.packageName)) {
293
- seen.set(npm.packageName, { typesFile: npm.typesFile, fromFile: sf.fileName });
294
- sites?.set(npm.packageName, loc);
295
- }
296
- }
297
- }
298
- const chosen = [];
299
- for (const [pkg, { typesFile, fromFile }] of seen) {
300
- judged?.add(pkg);
301
- const jsEntry = resolveBareModule(fromFile, pkg, "js-only");
302
- const reason = npmStaticIneligibleReason(pkg, typesFile, jsEntry !== null && isJsSourceFileName(jsEntry.typesFile) ? jsEntry.typesFile : null);
303
- if (reason === null)
304
- chosen.push(pkg);
305
- else
306
- statuses.push({ package: pkg, status: "fallback", detail: mode === "lib" ? reason : `auto: ${reason}` });
307
- }
308
- return chosen;
309
- }
310
- /** Duck-typed import-declaration test (the ts7 AST types stay inside the
311
- * frontend; this file only needs the specifier text). */
312
- function ts7IsImportWithStringSpec(stmt) {
313
- const s = stmt;
314
- return typeof s.moduleSpecifier?.text === "string";
315
- }
316
- /** The opted-in packages a consumer-anchored tsc message NAMES: module
317
- * specifiers in `Module '"spec"'` phrasings, and resolved file paths in
318
- * `import("…")` type spellings — the two ways the checker points at an
319
- * import surface from the importer's side. */
320
- function packagesNamedByDiag(message, optedIn) {
321
- const hits = new Set();
322
- for (const m of message.matchAll(/Module '"([^"]+)"'/g)) {
323
- const spec = m[1];
324
- const prefix = packageNameOfSpecifier(spec);
325
- if (optedIn.has(prefix))
326
- hits.add(prefix);
327
- }
328
- for (const m of message.matchAll(/import\("([^"]+)"\)/g)) {
329
- const pkg = npmStaticPackageOfPath(m[1]);
330
- if (pkg !== null && optedIn.has(pkg))
331
- hits.add(pkg);
332
- }
333
- return hits;
334
- }
335
- /** The one frontend, three npm postures: `undefined`/explicit package
336
- * lists and `"auto"` are the executable lane's (--npm-static; fallback =
337
- * island). `"lib"` is library mode's mandatory auto twin — the same
338
- * eligibility bar and the same opt-in machinery, but every fallback
339
- * status the shared loops record becomes compileLibrary's SC4020
340
- * static-or-refuse teaching, and the detection closes over the opted-in
341
- * packages' own bare edges (no island exists to serve a dep from). */
342
- function runFrontend(entryPath, npmStatic, externalTypes) {
343
- // Resolver package/workspace metadata is intentionally shared across the
344
- // several load attempts of ONE auto-detection fixpoint, but never across
345
- // separate compiles in a long-lived process. A cache miss must observe
346
- // package.json edits before it can publish a new early-library entry.
347
- clearResolveCaches();
348
- const statuses = [];
349
- const npmSites = new Map();
350
- const judged = new Set();
351
- let requested = [];
352
- let reusableScout = null;
353
- let reusablePreflight = null;
354
- if (npmStatic === "auto" || npmStatic === "lib") {
355
- const scout = loadProgram(entryPath, { externalTypes });
356
- let retained = false;
357
- try {
358
- const scoutPreflight = checkPreflight(scout);
359
- requested =
360
- npmStatic === "lib"
361
- ? detectAutoPackages(scout, statuses, "lib", judged, npmSites)
362
- : detectAutoPackages(scout, statuses);
363
- // With no package to opt in, the scout already IS the final frontend:
364
- // same roots, resolution posture, preflight, and module order. Retain it
365
- // instead of spawning a second tsgo server and checking the whole graph
366
- // again — the common library-mode path has no bare npm imports.
367
- if (requested.length === 0) {
368
- reusableScout = scout;
369
- reusablePreflight = scoutPreflight;
370
- retained = true;
371
- }
372
- }
373
- finally {
374
- if (!retained)
375
- scout.dispose();
376
- }
377
- }
378
- else if (npmStatic !== undefined) {
379
- requested = [...new Set(npmStatic)];
380
- }
381
- // One exact --external-types mapping makes the containing package an
382
- // external host boundary, which cannot simultaneously be compiled as a
383
- // package-wide --npm-static program graph. External wins; retain the
384
- // ordinary npm-static fallback record so explicit and auto requests both
385
- // explain why the package did not compile statically.
386
- if (requested.length > 0 && externalTypes !== undefined) {
387
- const externalSpecifiersByPackage = new Map();
388
- for (const specifier of Object.keys(externalTypes)) {
389
- const pkg = packageNameOfSpecifier(specifier);
390
- const specs = externalSpecifiersByPackage.get(pkg) ?? [];
391
- specs.push(specifier);
392
- externalSpecifiersByPackage.set(pkg, specs);
393
- }
394
- requested = requested.filter((pkg) => {
395
- const specs = externalSpecifiersByPackage.get(pkg);
396
- if (specs === undefined)
397
- return true;
398
- statuses.push({
399
- package: pkg,
400
- status: "fallback",
401
- detail: `mapped as an external host module by --external-types (${specs.map((s) => JSON.stringify(s)).join(", ")})`,
402
- });
403
- return false;
404
- });
405
- }
406
- // The all-or-nothing fallback loop: a preflight diagnostic ANCHORED in
407
- // an opted-in package's files (an unsupported require form, a builtin
408
- // fence) — or an offender the resolution itself reported — drops that
409
- // package from the set and the whole frontend reloads without it, so
410
- // its import takes the ordinary island path. Static compilation of a
411
- // package must never turn a working --dynamic build into a build
412
- // failure.
413
- //
414
- // CONSUMER-anchored attribution (the second source): an opted-in
415
- // package whose inferred export surface breaks the typecheck reports at
416
- // its IMPORT SITES — errors in program files no path-shaped attribution
417
- // reaches, but whose MESSAGES name the package ("Module '"pkg"' has no
418
- // exported member", "typeof import("…/pkg/dist/index")"). Bundle-shaped
419
- // dists carry surfaces inference can only partly reach (type-only
420
- // re-exports have no JS value to chase), and the ratified behavior is
421
- // graceful PER-PACKAGE degradation: the named package drops to the
422
- // island with a note, never a failed gate. Explicit opt-ins degrade
423
- // exactly like auto's — "the user asked for these packages" buys the
424
- // attempt, not a broken build.
425
- let load = reusableScout ?? loadProgram(entryPath, { npmStatic: requested, externalTypes });
426
- let preflight = reusablePreflight ?? checkPreflight(load);
427
- // Library mode's fixpoint: the opted-in packages' files joined the
428
- // program just now, and THEIR bare edges (import statements and
429
- // top-level requires) name packages the scout could not see. Judge each
430
- // by the same bar — eligible ones join the set and the frontend
431
- // reloads; ineligible ones record the fallback status compileLibrary
432
- // refuses on. Bounded by the dependency count (every iteration settles
433
- // at least one new package for good).
434
- if (npmStatic === "lib") {
435
- for (;;) {
436
- const grown = detectAutoPackages(load, statuses, "lib", judged, npmSites);
437
- if (grown.length === 0)
438
- break;
439
- requested = [...requested, ...grown];
440
- load.dispose();
441
- load = loadProgram(entryPath, { npmStatic: requested, externalTypes });
442
- preflight = checkPreflight(load);
443
- }
444
- }
445
- const effective = new Set(requested);
446
- while (effective.size > 0) {
447
- const reasons = new Map(npmStaticOffenders());
448
- for (const d of preflight) {
449
- const pkg = npmStaticPackageOfPath(d.loc.file);
450
- if (pkg !== null && !reasons.has(pkg))
451
- reasons.set(pkg, `${d.code}: ${d.message}`);
452
- }
453
- if (![...reasons.keys()].some((p) => effective.has(p))) {
454
- const named = new Map();
455
- for (const d of preflight) {
456
- if (d.code !== "SC0001")
457
- continue;
458
- for (const pkg of packagesNamedByDiag(d.message, effective)) {
459
- named.set(pkg, (named.get(pkg) ?? 0) + 1);
460
- }
461
- }
462
- for (const [pkg, count] of named) {
463
- reasons.set(pkg, `its inferred export surface breaks ${count} import site${count === 1 ? "" : "s"} in program files${npmStatic === "lib" ? "" : " — the package serves from the island instead"} (bundler-emitted surfaces type only as far as inference reaches)`);
464
- }
465
- }
466
- const dropping = [...reasons.keys()].filter((p) => effective.has(p));
467
- if (dropping.length === 0)
468
- break;
469
- for (const p of dropping) {
470
- effective.delete(p);
471
- statuses.push({ package: p, status: "fallback", detail: reasons.get(p) });
472
- }
473
- load.dispose();
474
- load = loadProgram(entryPath, { npmStatic: effective, externalTypes });
475
- preflight = checkPreflight(load);
476
- }
477
- // The last resort, ALL modes: an opt-in can change the PROGRAM's OWN
478
- // typecheck through errors that name no package at all (declaration
479
- // shapes outside the safe overload projection — generic overloads,
480
- // declaration-only members, or a .d.ts type-GUARD an inferred JS
481
- // function cannot reproduce). Those SC0001s anchor in USER files no
482
- // offender or
483
- // message attribution reaches, so each remaining package is probed
484
- // ALONE-dropped (n is the opt-in count — a handful of extra analysis
485
- // loads); culprits whose removal clears the errors fall back with a
486
- // note, and if no subset typechecks, everything drops. Explicit opt-ins
487
- // degrade the same way — the ratified stance for bundle-shaped dists is
488
- // graceful per-package degradation, never a failed gate the user cannot
489
- // act on (the note carries the why).
490
- if (effective.size > 0 && preflight.some((d) => d.code === "SC0001")) {
491
- const dropWithNote = (p) => {
492
- effective.delete(p);
493
- statuses.push({
494
- package: p,
495
- status: "fallback",
496
- detail: npmStatic === "auto"
497
- ? "auto: the program does not typecheck against its inferred surface"
498
- : npmStatic === "lib"
499
- ? "the program does not typecheck against its inferred surface (type-only declarations and .d.ts type guards have no JS value inference can chase)"
500
- : "the program does not typecheck against its inferred surface (type-only declarations and .d.ts type guards have no JS value inference can chase) — the package serves from the island instead",
501
- });
502
- };
503
- // Attribute per package by probing each SOLO (culprits are almost
504
- // always independent — each package's inferred surface breaks its own
505
- // import sites), then reload with the survivors; interaction effects
506
- // that still fail drop everything left.
507
- for (const p of [...effective]) {
508
- const probe = loadProgram(entryPath, { npmStatic: [p], externalTypes });
509
- const probeDiags = checkPreflight(probe);
510
- probe.dispose();
511
- if (probeDiags.some((d) => d.code === "SC0001"))
512
- dropWithNote(p);
513
- }
514
- load.dispose();
515
- load = loadProgram(entryPath, { npmStatic: effective, externalTypes });
516
- preflight = checkPreflight(load);
517
- if (preflight.some((d) => d.code === "SC0001") && effective.size > 0) {
518
- for (const p of [...effective])
519
- dropWithNote(p);
520
- load.dispose();
521
- load = loadProgram(entryPath, { npmStatic: effective, externalTypes });
522
- preflight = checkPreflight(load);
523
- }
524
- }
525
- for (const p of requested) {
526
- if (effective.has(p))
527
- statuses.push({ package: p, status: "static" });
528
- }
529
- const finalLoad = load;
530
- return {
531
- preflight,
532
- entryText: () => finalLoad.entry.text,
533
- entryExports: () => entryFunctionExports(finalLoad.entry),
534
- // The contract scans the PROGRAM's source files, not the runtime
535
- // module order: a type-only module (nothing but exported types) has no
536
- // runtime edge and never joins moduleOrder, yet its declarations are
537
- // contract surface. Declaration files (default libs, @types) stay out,
538
- // and so do statically-compiled npm packages' files: their .d.ts is
539
- // dropped by construction (inference types the bodies), so no npm
540
- // declaration can name a wire-contract type — the contract vocabulary
541
- // is authored program surface only, and a workspace-linked package's
542
- // shipped .ts must not smuggle same-name declarations into the type
543
- // table.
544
- entryContract: () => entryContractFacts(finalLoad.entry, finalLoad.program.getSourceFiles().filter((sf) => !sf.isDeclarationFile && npmStaticPackageOfPath(sf.fileName) === null)),
545
- // Runtime evaluation order first, then any type-only program modules
546
- // (no runtime edge, so absent from moduleOrder — but they are contract
547
- // surface now, and the library identity hashes cover the WHOLE module
548
- // graph; the Map dedups by fileName). Statically-compiled npm modules
549
- // are in moduleOrder like any program module, so their bytes join the
550
- // library identity hashes (source_hash/build_id) — compiled code is
551
- // identity, whatever directory it came from.
552
- sourceTexts: () => new Map([finalLoad.entry, ...finalLoad.moduleOrder, ...finalLoad.program.getSourceFiles().filter((sf) => !sf.isDeclarationFile)].map((sf) => [sf.fileName, sf.text])),
553
- lower: (opts) => lowerToIr(finalLoad.program, finalLoad.entry, finalLoad.moduleOrder, {
554
- ...opts,
555
- startupCrash: finalLoad.startupCrash ?? null,
556
- externalTypes: finalLoad.externalTypes,
557
- externalTypeSpecifiersByFile: finalLoad.externalTypeSpecifiersByFile,
558
- }),
559
- npmStatic: statuses,
560
- npmImportSites: npmSites,
561
- dispose: finalLoad.dispose,
562
- };
563
- }
564
- /** Analysis without codegen: how much of the program compiles statically.
565
- * Unlike compile(), lowering diagnostics are data here, not failure. */
566
89
  export function analyze(entryPath, opts = {}) {
567
- let ffi = null;
568
- if (opts.ffiProfilePath !== undefined) {
569
- const loaded = loadFfiProfile(opts.ffiProfilePath);
570
- if (!loaded.ok) {
571
- return {
572
- coverage: {
573
- file: entryPath,
574
- dynamic: opts.dynamic ?? false,
575
- stats: { statementsTotal: 0, statementsFailed: 0, statementsIsland: 0, functionsSkipped: 0 },
576
- diagnostics: loaded.diagnostics,
577
- preflightFailed: true,
578
- },
579
- sourceTexts: new Map(),
580
- };
581
- }
582
- ffi = loaded.profile;
583
- }
584
- const fe = runFrontend(entryPath, opts.npmStatic, opts.externalTypes);
585
- try {
586
- const emptyStats = { statementsTotal: 0, statementsFailed: 0, statementsIsland: 0, functionsSkipped: 0 };
587
- const preflight = fe.preflight;
588
- // Import-FORM fences don't stop the analysis: the module graph is still
589
- // computable (a fenced import contributes no edges), the imported
590
- // bindings poison at their use sites, and the fences join the blockers
591
- // list beside statement-level ones — the report shows a statement
592
- // percentage instead of stopping at the import lines. Everything else —
593
- // tsc errors, config incompatibilities, circular imports — still stops
594
- // at preflight (no trustworthy program to lower). Builds are unchanged:
595
- // compile() fails on every preflight diagnostic exactly as before.
596
- const IMPORT_FENCES = new Set(["SC1010", "SC1012", "SC1013", "SC1014", "SC1015"]);
597
- if (preflight.some((d) => !IMPORT_FENCES.has(d.code))) {
598
- return {
599
- coverage: {
600
- file: entryPath,
601
- dynamic: opts.dynamic ?? false,
602
- stats: emptyStats,
603
- diagnostics: preflight,
604
- ...(fe.npmStatic.length > 0 ? { npmStatic: fe.npmStatic } : {}),
605
- preflightFailed: true,
606
- },
607
- sourceTexts: fe.sourceTexts(),
608
- };
609
- }
610
- // Coverage is whole-program by design: builds stop at what the entry
611
- // reaches, but the analysis additionally lowers the unreached remainder
612
- // (throwaway) so the report covers everything the source declares — with
613
- // the unreached share in its own group.
614
- const lowered = fe.lower({
615
- dynamic: opts.dynamic ?? false,
616
- coverage: true,
617
- targetPlatform: buildTargetPlatform(),
618
- ...(ffi !== null ? { ffiImports: ffi.functions } : {}),
619
- });
620
- const provenance = provenanceSources();
621
- return {
622
- coverage: {
623
- file: entryPath,
624
- dynamic: opts.dynamic ?? false,
625
- stats: lowered.stats,
626
- // The import fences report as blockers alongside the statement-level
627
- // ones (use sites of the fenced bindings emit matching diagnostics,
628
- // which the report groups with these).
629
- diagnostics: [...preflight, ...lowered.diagnostics],
630
- ...(lowered.runtimeFences.length > 0 ? { runtimeFences: lowered.runtimeFences } : {}),
631
- ...(lowered.unreached ? { unreached: lowered.unreached } : {}),
632
- ...(lowered.npmBuiltins ? { npmBuiltins: lowered.npmBuiltins } : {}),
633
- ...(lowered.npmLazyTraps ? { npmLazyTraps: lowered.npmLazyTraps } : {}),
634
- ...(fe.npmStatic.length > 0 ? { npmStatic: fe.npmStatic } : {}),
635
- // --provenance-sources: the per-package attribution inputs (the
636
- // report aggregates statsByFile under each package's source dir).
637
- ...(provenance !== null ? { provenance } : {}),
638
- ...(lowered.statsByFile ? { statsByFile: lowered.statsByFile } : {}),
639
- ...(lowered.provenanceElided ? { provenanceElided: lowered.provenanceElided } : {}),
640
- preflightFailed: false,
641
- },
642
- sourceTexts: fe.sourceTexts(),
643
- };
644
- }
645
- finally {
646
- fe.dispose();
647
- }
90
+ return analyzeWithFrontend(entryPath, opts, buildTargetPlatform(), nodeFrontend);
648
91
  }
649
- /** The whole pipeline: load → preflight → lower → validate → emit C → clang. */
92
+ const nodeFrontend = (entry, npmStatic, externalTypes, libraryNpmStatic) => runFrontend(entry, loadProgram, npmStatic, externalTypes, libraryNpmStatic);
93
+ /** The whole pipeline: load → preflight → lower → validate → emit LLVM → link. */
650
94
  function clearCompileSessionCaches() {
651
95
  clearResolveCaches();
652
96
  clearCcCaches();
@@ -676,55 +120,22 @@ function assertCompileResultCompatibility(result) {
676
120
  }
677
121
  }
678
122
  void assertCompileResultCompatibility;
679
- function executableNativeFeatures(mod, backend, dynamic, optimization, llvmRefusal) {
123
+ function executableNativeFeatures(mod, backend, dynamic, optimization) {
680
124
  return {
681
125
  backend,
682
126
  ...(optimization === "dev" ? { optimization: "dev" } : {}),
683
- ...(llvmRefusal === undefined ? {} : { llvmRefusal }),
684
- dynamic,
685
- regex: moduleUsesRegex(mod),
686
- copying: moduleUsesCopying(mod),
687
- textDecoderLegacy: moduleUsesLegacyTextDecoder(mod),
688
- fileHandle: moduleUsesFileHandle(mod),
689
- fetch: moduleUsesFetch(mod),
690
- netIsland: moduleEmbedsBuiltin(mod, "node:http") ||
691
- moduleEmbedsBuiltin(mod, "node:https") ||
692
- moduleEmbedsBuiltin(mod, "node:net") ||
693
- moduleEmbedsBuiltin(mod, "node:tls"),
694
- zlib: moduleUsesZlib(mod) || moduleEmbedsCompressedNpm(mod),
695
- assert: moduleUsesAssert(mod),
696
- inspect: moduleUsesInspect(mod),
697
- dynInvoke: moduleUsesDynInvoke(mod),
698
- dc: moduleUsesDc(mod),
699
- dynAsync: moduleUsesDynAsync(mod),
700
- events: moduleUsesProcessEvents(mod),
701
- emitter: moduleUsesEmitter(mod),
702
- symbol: moduleUsesSymbol(mod),
703
- bigint: moduleUsesBigInt(mod),
704
- searchParams: moduleUsesSearchParams(mod),
705
- qs: moduleUsesQs(mod),
706
- parseArgs: moduleUsesParseArgs(mod),
707
- stream: moduleUsesStream(mod),
708
- net: moduleUsesNet(mod),
709
- http: moduleUsesHttpServer(mod),
710
- http2: moduleUsesHttp2(mod),
711
- dgram: moduleUsesDgram(mod),
712
- watch: moduleUsesFsWatch(mod),
713
- foreignFfi: hasForeignFfiCallback(mod.ffiImports ?? []),
714
- nodeTest: moduleUsesNodeTest(mod),
715
- tls: moduleUsesTls(mod),
716
- tlsCa: moduleUsesTlsCa(mod),
127
+ ...executableLinkFeatures(mod, dynamic),
717
128
  };
718
129
  }
719
- async function compileExecutableNative(features, cPath, outPath, sanitize, ffi, windowsSubsystem, strip, programSplit = null, programObjectDependencies = [], onArtifactReady) {
720
- const programIsObject = /\.(?:o|obj)$/.test(cPath);
721
- const runtimePackTarget = programIsObject && !sanitize && process.env["SCRIPTC_RUNTIME_PACK"] !== "0"
130
+ async function compileExecutableNative(features, llvmPath, outPath, sanitize, ffi, windowsSubsystem, strip, programSplit = null, programObjectDependencies = [], onArtifactReady) {
131
+ const programIsObject = /\.(?:o|obj)$/.test(llvmPath);
132
+ const runtimePackTarget = programIsObject && !sanitize
722
133
  ? nativeCodegenTarget()
723
134
  : null;
724
135
  if (runtimePackTarget !== null) {
725
136
  const plan = await createNativeLinkPlan({
726
137
  target: runtimePackTarget,
727
- programObject: cPath,
138
+ programObject: llvmPath,
728
139
  outPath,
729
140
  features,
730
141
  ffi,
@@ -746,79 +157,57 @@ async function compileExecutableNative(features, cPath, outPath, sanitize, ffi,
746
157
  }
747
158
  const effectiveProgramSplit = programSplit ??
748
159
  (!programIsObject && features.optimization === "dev" && features.backend === "llvm" && !sanitize
749
- ? splitLlvmProgram(await readFile(cPath, "utf8"))
160
+ ? splitLlvmProgram(await readFile(llvmPath, "utf8"))
750
161
  : null);
751
- const objectLinkDir = programIsObject
752
- ? await mkdtemp(join(tmpdir(), "scriptc-object-link-"))
753
- : null;
754
- const linkDriverSource = objectLinkDir === null
755
- ? cPath
756
- : join(objectLinkDir, "driver.c");
757
- if (objectLinkDir !== null)
758
- await writeFile(linkDriverSource, "/* scriptc object link driver */\n");
759
- try {
760
- assertLegacyCExecutablePipelineEnabled();
761
- await compileExternalC({
762
- cPath: linkDriverSource,
763
- outPath,
764
- cacheIdentity: "scriptc-generated-v1",
765
- ...(features.optimization === "dev" ? { optimization: "dev" } : {}),
766
- ...(strip ? { strip: true } : {}),
767
- ...(windowsSubsystem === undefined ? {} : { windowsSubsystem }),
768
- ...(effectiveProgramSplit === null
769
- ? {}
770
- : {
771
- programShards: effectiveProgramSplit.shards,
772
- programPublicSymbols: effectiveProgramSplit.publicSymbols,
773
- }),
774
- sanitize,
775
- dynamic: features.dynamic,
776
- regex: features.regex,
777
- copying: features.copying,
778
- textDecoderLegacy: features.textDecoderLegacy,
779
- fileHandle: features.fileHandle,
780
- fetch: features.fetch,
781
- netIsland: features.netIsland,
782
- zlib: features.zlib,
783
- assert: features.assert,
784
- inspect: features.inspect,
785
- dynInvoke: features.dynInvoke,
786
- dc: features.dc,
787
- dynAsync: features.dynAsync,
788
- events: features.events,
789
- emitter: features.emitter,
790
- symbol: features.symbol,
791
- bigint: features.bigint,
792
- searchParams: features.searchParams,
793
- qs: features.qs,
794
- parseArgs: features.parseArgs,
795
- stream: features.stream,
796
- net: features.net,
797
- http: features.http,
798
- http2: features.http2,
799
- dgram: features.dgram,
800
- watch: features.watch,
801
- foreignFfi: features.foreignFfi,
802
- nodeTest: features.nodeTest,
803
- tls: features.tls,
804
- tlsCa: features.tlsCa,
805
- ...(onArtifactReady === undefined ? {} : { onArtifactReady }),
806
- ...(ffi === null && !programIsObject
807
- ? {}
808
- : {
809
- linkInputs: [
810
- ...(programIsObject ? [cPath] : []),
811
- ...(ffi?.libraries ?? []),
812
- ],
813
- ...(ffi === null ? {} : { systemLibraries: ffi.systemLibraries }),
814
- }),
815
- });
816
- }
817
- finally {
818
- if (objectLinkDir !== null) {
819
- await rm(objectLinkDir, { recursive: true, force: true }).catch(() => undefined);
820
- }
821
- }
162
+ if (programIsObject)
163
+ throw new InternalCompilerError("program objects must link against a precompiled runtime pack");
164
+ await compileExternalC({
165
+ cPath: llvmPath,
166
+ outPath,
167
+ cacheIdentity: "scriptc-generated-v1",
168
+ ...(features.optimization === "dev" ? { optimization: "dev" } : {}),
169
+ ...(strip ? { strip: true } : {}),
170
+ ...(windowsSubsystem === undefined ? {} : { windowsSubsystem }),
171
+ ...(effectiveProgramSplit === null
172
+ ? {}
173
+ : {
174
+ programShards: effectiveProgramSplit.shards,
175
+ programPublicSymbols: effectiveProgramSplit.publicSymbols,
176
+ }),
177
+ sanitize,
178
+ dynamic: features.dynamic,
179
+ regex: features.regex,
180
+ copying: features.copying,
181
+ textDecoderLegacy: features.textDecoderLegacy,
182
+ fileHandle: features.fileHandle,
183
+ fetch: features.fetch,
184
+ netIsland: features.netIsland,
185
+ zlib: features.zlib,
186
+ assert: features.assert,
187
+ inspect: features.inspect,
188
+ dynInvoke: features.dynInvoke,
189
+ dc: features.dc,
190
+ dynAsync: features.dynAsync,
191
+ events: features.events,
192
+ emitter: features.emitter,
193
+ symbol: features.symbol,
194
+ bigint: features.bigint,
195
+ searchParams: features.searchParams,
196
+ qs: features.qs,
197
+ parseArgs: features.parseArgs,
198
+ stream: features.stream,
199
+ net: features.net,
200
+ http: features.http,
201
+ http2: features.http2,
202
+ dgram: features.dgram,
203
+ watch: features.watch,
204
+ foreignFfi: features.foreignFfi,
205
+ nodeTest: features.nodeTest,
206
+ tls: features.tls,
207
+ tlsCa: features.tlsCa,
208
+ ...(onArtifactReady === undefined ? {} : { onArtifactReady }),
209
+ ...(ffi === null ? {} : { linkInputs: ffi.libraries, systemLibraries: ffi.systemLibraries, frameworks: ffi.frameworks }),
210
+ });
822
211
  }
823
212
  async function emitNativeProgramObject(entryPath, opts, llvm) {
824
213
  const stem = basename(entryPath).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "");
@@ -845,17 +234,140 @@ async function emitNativeProgramObject(entryPath, opts, llvm) {
845
234
  }
846
235
  function usesPrecompiledRuntimePack(opts, backend) {
847
236
  if (backend !== "llvm" || opts.sanitize === true ||
848
- process.env["SCRIPTC_RUNTIME_PACK"] === "0" ||
849
- process.env["SCRIPTC_FETCH_CURL"] === "1" || legacyCExecutablePathRequested())
237
+ process.env["SCRIPTC_FETCH_CURL"] === "1")
850
238
  return false;
851
239
  return nativeCodegenTarget() !== null;
852
240
  }
853
241
  function runtimePackDiagnostic(error, entryPath) {
854
242
  return nativeCodegenDiag(error.code === "unsupported" ? "SC3002" : "SC3003", error.message, entryPath);
855
243
  }
244
+ /** Finish frontend work in a separate scope so the AST, checker caches and
245
+ * typed IR can be reclaimed before the native optimizer needs its heap. */
246
+ async function prepareExecutableInput(entryPath, opts, ffi, buildPlatform, timing) {
247
+ const outputKind = opts.outputKind ?? "exe";
248
+ const prepared = prepareExecutableModule(entryPath, opts, ffi, buildPlatform, nodeFrontend, timing);
249
+ if (!prepared.ok)
250
+ return prepared;
251
+ const { mod, sourceTexts } = prepared;
252
+ const stem = basename(entryPath).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "");
253
+ const defaultSourcePaths = {
254
+ ir: join(opts.outDir, `${stem}.ir.json`),
255
+ llvm: join(opts.outDir, `${stem}.ll`),
256
+ };
257
+ const debugOptions = opts.optimization === "dev" && !opts.strip
258
+ ? { debugSources: sourceTexts }
259
+ : {};
260
+ if (outputKind === "ir") {
261
+ await mkdir(dirname(opts.outPath), { recursive: true });
262
+ await writeFile(opts.outPath, serializeModule(mod, true));
263
+ return { ok: true, artifact: { kind: "ir", path: opts.outPath } };
264
+ }
265
+ if (outputKind === "llvm" || outputKind === "asm" || outputKind === "obj") {
266
+ let llvm;
267
+ try {
268
+ llvm = emitLlvmModule(mod, {
269
+ targetTriple: process.env["SCRIPTC_TARGET"] ?? "",
270
+ ...debugOptions,
271
+ pointerBits: buildPlatform === "wasi" ? 32 : 64,
272
+ wasi: buildPlatform === "wasi",
273
+ runtimeAbiMarker: outputKind === "obj",
274
+ });
275
+ }
276
+ catch (err) {
277
+ if (!(err instanceof LlvmUnsupportedError))
278
+ throw err;
279
+ return { ok: false, diagnostics: [llvmRefusalDiag(err, entryPath)], sourceTexts };
280
+ }
281
+ if (outputKind === "llvm") {
282
+ await mkdir(dirname(opts.outPath), { recursive: true });
283
+ await writeFile(opts.outPath, llvm);
284
+ }
285
+ else {
286
+ try {
287
+ await emitNativeArtifact({
288
+ outputPath: opts.outPath,
289
+ llvm,
290
+ outputKind,
291
+ sourcePath: entryPath,
292
+ optimization: opts.optimization === "dev" ? "0" : "2",
293
+ ...(opts.sanitize === undefined ? {} : { sanitize: opts.sanitize }),
294
+ });
295
+ }
296
+ catch (err) {
297
+ if (!(err instanceof NativeCodegenError))
298
+ throw err;
299
+ return {
300
+ ok: false,
301
+ diagnostics: [nativeCodegenDiag(err.diagnosticCode, err.message, entryPath)],
302
+ sourceTexts,
303
+ };
304
+ }
305
+ }
306
+ if (outputKind === "obj" && opts.nativeLinkInfo === true) {
307
+ const target = nativeCodegenTarget();
308
+ if (target === null) {
309
+ throw new InternalCompilerError("native object emitted without a native target");
310
+ }
311
+ return {
312
+ ok: true,
313
+ artifact: {
314
+ kind: "obj",
315
+ path: opts.outPath,
316
+ nativeLinkInfo: await createNativeLinkInfo({
317
+ programObject: opts.outPath,
318
+ target,
319
+ features: executableNativeFeatures(mod, "llvm", opts.dynamic ?? false, opts.optimization ?? "release"),
320
+ ffi,
321
+ optimization: opts.optimization ?? "release",
322
+ }),
323
+ },
324
+ };
325
+ }
326
+ return { ok: true, artifact: { kind: outputKind, path: opts.outPath } };
327
+ }
328
+ await mkdir(opts.outDir, { recursive: true });
329
+ const llvmPath = defaultSourcePaths.llvm;
330
+ const backend = "llvm";
331
+ let llvmSource;
332
+ try {
333
+ llvmSource = emitLlvmModule(mod, {
334
+ targetTriple: process.env["SCRIPTC_TARGET"] ?? "",
335
+ ...debugOptions,
336
+ pointerBits: buildPlatform === "wasi" ? 32 : 64,
337
+ wasi: buildPlatform === "wasi",
338
+ runtimeAbiMarker: opts.nativeProgramObject === true || usesPrecompiledRuntimePack(opts, "llvm"),
339
+ });
340
+ }
341
+ catch (err) {
342
+ if (!(err instanceof LlvmUnsupportedError))
343
+ throw err;
344
+ return { ok: false, diagnostics: [llvmRefusalDiag(err, entryPath)], sourceTexts };
345
+ }
346
+ timing("llvm-emit");
347
+ await writeFile(llvmPath, llvmSource);
348
+ timing("llvm-write");
349
+ let irPath;
350
+ if (opts.emitIr) {
351
+ irPath = defaultSourcePaths.ir;
352
+ await writeFile(irPath, serializeModule(mod, true));
353
+ }
354
+ const nativeFeatures = executableNativeFeatures(mod, backend, opts.dynamic ?? false, opts.optimization ?? "release");
355
+ timing("link-features");
356
+ const programSplit = backend === "llvm" && (opts.optimization ?? "release") === "dev" &&
357
+ !(opts.sanitize ?? false) && llvmSource !== null
358
+ ? splitLlvmProgram(llvmSource)
359
+ : null;
360
+ timing("llvm-split");
361
+ return { llvmSource, llvmPath, irPath, nativeFeatures, programSplit, sourceTexts };
362
+ }
856
363
  async function compileTracked(entryPath, opts, frontendInputs) {
364
+ const timing = compilationTiming();
857
365
  entryPath = resolve(entryPath);
858
366
  const outputKind = opts.outputKind ?? "exe";
367
+ if ((opts.backend !== undefined && opts.backend !== "llvm") ||
368
+ !["ir", "llvm", "asm", "obj", "exe"].includes(outputKind)) {
369
+ return { ok: false, diagnostics: [nativeCodegenDiag("SC3002", "LLVM is the only backend; supported outputs are ir, llvm, asm, obj, and exe", entryPath)], sourceTexts: new Map() };
370
+ }
859
371
  if (opts.windowsSubsystem !== undefined && outputKind !== "exe") {
860
372
  return {
861
373
  ok: false,
@@ -885,6 +397,37 @@ async function compileTracked(entryPath, opts, frontendInputs) {
885
397
  sourceTexts: new Map(),
886
398
  };
887
399
  }
400
+ // Mobile triples are library-mode targets: the archive an embedding app
401
+ // links is the artifact, and only the library-admissible runtime surface
402
+ // is verified on those device classes. The executable lane refuses before
403
+ // any frontend work — a pure env check, so the refusal needs no toolchain.
404
+ if (outputKind === "exe") {
405
+ const entryLoc = { file: entryPath, start: 0, end: 0 };
406
+ const mobileTarget = mobileLibraryTarget();
407
+ if (mobileTarget !== null) {
408
+ return {
409
+ ok: false,
410
+ diagnostics: [
411
+ targetRefusalDiag(mobileTarget, "standalone executable builds — mobile targets produce library-mode static archives (scriptc build --lib --profile <profile.json>) for an embedding app to link", entryLoc),
412
+ ],
413
+ sourceTexts: new Map(),
414
+ };
415
+ }
416
+ const rawTarget = process.env["SCRIPTC_TARGET"] ?? "";
417
+ const mobileRefusal = mobileTargetRefusal(rawTarget);
418
+ if (mobileRefusal !== null) {
419
+ return {
420
+ ok: false,
421
+ diagnostics: [{ code: "SC3002", message: mobileRefusal, loc: entryLoc }],
422
+ sourceTexts: new Map(),
423
+ };
424
+ }
425
+ }
426
+ if (outputKind === "exe" && opts.sanitize !== true && process.env["SCRIPTC_FETCH_CURL"] !== "1") {
427
+ const refusal = nativeCodegenTargetRefusal();
428
+ if (refusal !== null)
429
+ return { ok: false, diagnostics: [nativeCodegenDiag("SC3002", refusal, entryPath)], sourceTexts: new Map() };
430
+ }
888
431
  let ffi = null;
889
432
  let ffiProfileBytes = null;
890
433
  if (opts.ffiProfilePath !== undefined) {
@@ -959,32 +502,6 @@ async function compileTracked(entryPath, opts, frontendInputs) {
959
502
  sourceTexts: new Map(),
960
503
  };
961
504
  }
962
- // Mobile triples are library-mode targets: the archive an embedding app
963
- // links is the artifact, and only the library-admissible runtime surface
964
- // is verified on those device classes. The executable lane refuses before
965
- // any frontend work — a pure env check, so the refusal needs no toolchain.
966
- if (outputKind === "exe") {
967
- const entryLoc = { file: entryPath, start: 0, end: 0 };
968
- const mobileTarget = mobileLibraryTarget();
969
- if (mobileTarget !== null) {
970
- return {
971
- ok: false,
972
- diagnostics: [
973
- targetRefusalDiag(mobileTarget, "standalone executable builds — mobile targets produce library-mode static archives (SCRIPTC_CC=zigcc scriptc build --lib --profile <profile.json>) for an embedding app to link", entryLoc),
974
- ],
975
- sourceTexts: new Map(),
976
- };
977
- }
978
- const rawTarget = process.env["SCRIPTC_TARGET"] ?? "";
979
- const mobileRefusal = mobileTargetRefusal(rawTarget);
980
- if (mobileRefusal !== null) {
981
- return {
982
- ok: false,
983
- diagnostics: [{ code: "SC3002", message: mobileRefusal, loc: entryLoc }],
984
- sourceTexts: new Map(),
985
- };
986
- }
987
- }
988
505
  const cacheRoot = outputKind === "exe" && provenanceSources() === null
989
506
  ? await prepareBuildCacheRoot(buildCacheRoot())
990
507
  : null;
@@ -992,7 +509,7 @@ async function compileTracked(entryPath, opts, frontendInputs) {
992
509
  if (outputKind === "exe") {
993
510
  const implementation = await compilerImplementationIdentity();
994
511
  const helperObjectRoute = opts.nativeProgramObject === true ||
995
- (opts.backend !== "c" && usesPrecompiledRuntimePack(opts, "llvm"));
512
+ (usesPrecompiledRuntimePack(opts, "llvm"));
996
513
  earlyCacheOptions = {
997
514
  entryPath,
998
515
  outDir: opts.outDir,
@@ -1000,7 +517,7 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1000
517
  emitIr: opts.emitIr ?? false,
1001
518
  sanitize: opts.sanitize ?? false,
1002
519
  dynamic: opts.dynamic ?? false,
1003
- backend: opts.backend ?? "auto",
520
+ backend: "llvm",
1004
521
  ...(opts.optimization === "dev" ? { optimization: "dev" } : {}),
1005
522
  ...(opts.strip ? { strip: true } : {}),
1006
523
  ...(opts.windowsSubsystem === "gui" ? { windowsSubsystem: "gui" } : {}),
@@ -1028,6 +545,7 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1028
545
  ? null
1029
546
  : await readEarlyExecutableCache(cacheRoot, earlyCacheOptions);
1030
547
  if (earlyHit !== null) {
548
+ timing("executable-cache-hit");
1031
549
  if (earlyCacheOptions === null) {
1032
550
  throw new InternalCompilerError("executable cache hit without executable cache options");
1033
551
  }
@@ -1038,27 +556,22 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1038
556
  await publishEarlyExecutableRoute(cacheRoot, executableCacheOptions).catch(() => undefined);
1039
557
  if (earlyHit.executableRestored) {
1040
558
  await pruneBuildCache(cacheRoot);
559
+ timing("complete");
1041
560
  return {
1042
561
  ok: true,
1043
562
  artifact: {
1044
563
  kind: "exe",
1045
564
  path: opts.outPath,
1046
- translationUnitPath: earlyHit.cPath,
565
+ translationUnitPath: earlyHit.llvmPath,
1047
566
  backend: earlyHit.native.backend,
1048
- ...(earlyHit.native.llvmRefusal === undefined
1049
- ? {}
1050
- : { llvmRefusal: earlyHit.native.llvmRefusal }),
1051
567
  },
1052
568
  binaryPath: opts.outPath,
1053
- cPath: earlyHit.cPath,
569
+ llvmPath: earlyHit.llvmPath,
1054
570
  backend: earlyHit.native.backend,
1055
571
  ...(earlyHit.irPath === undefined ? {} : { irPath: earlyHit.irPath }),
1056
- ...(earlyHit.native.llvmRefusal === undefined
1057
- ? {}
1058
- : { llvmRefusal: earlyHit.native.llvmRefusal }),
1059
572
  };
1060
573
  }
1061
- let nativeInputPath = earlyHit.cPath;
574
+ let nativeInputPath = earlyHit.llvmPath;
1062
575
  let nativeProgramObject = null;
1063
576
  const useRuntimePack = opts.nativeProgramObject === true ||
1064
577
  usesPrecompiledRuntimePack(opts, earlyHit.native.backend);
@@ -1067,7 +580,7 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1067
580
  throw new InternalCompilerError("native program-object cache hit restored a non-LLVM translation unit");
1068
581
  }
1069
582
  try {
1070
- nativeProgramObject = await emitNativeProgramObject(entryPath, opts, await readFile(earlyHit.cPath, "utf8"));
583
+ nativeProgramObject = await emitNativeProgramObject(entryPath, opts, await readFile(earlyHit.llvmPath, "utf8"));
1071
584
  nativeInputPath = nativeProgramObject.linkPath;
1072
585
  }
1073
586
  catch (err) {
@@ -1117,209 +630,21 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1117
630
  artifact: {
1118
631
  kind: "exe",
1119
632
  path: opts.outPath,
1120
- translationUnitPath: earlyHit.cPath,
633
+ translationUnitPath: earlyHit.llvmPath,
1121
634
  backend: earlyHit.native.backend,
1122
- ...(earlyHit.native.llvmRefusal === undefined
1123
- ? {}
1124
- : { llvmRefusal: earlyHit.native.llvmRefusal }),
1125
635
  },
1126
636
  binaryPath: opts.outPath,
1127
- cPath: earlyHit.cPath,
637
+ llvmPath: earlyHit.llvmPath,
1128
638
  backend: earlyHit.native.backend,
1129
639
  ...(earlyHit.irPath === undefined ? {} : { irPath: earlyHit.irPath }),
1130
- ...(earlyHit.native.llvmRefusal === undefined
1131
- ? {}
1132
- : { llvmRefusal: earlyHit.native.llvmRefusal }),
1133
640
  };
1134
641
  }
1135
- const fe = runFrontend(entryPath, opts.npmStatic);
1136
- let lowered;
1137
- let entryText;
1138
- let sourceTexts;
1139
- // The frontend (and its tsgo server) is released as soon as lowering
1140
- // ends — clang and the link never hold it open.
1141
- try {
1142
- const fail = (diagnostics) => ({
1143
- ok: false,
1144
- diagnostics,
1145
- sourceTexts: fe.sourceTexts(),
1146
- });
1147
- if (fe.preflight.length > 0)
1148
- return fail(fe.preflight);
1149
- try {
1150
- lowered = fe.lower({
1151
- dynamic: opts.dynamic ?? false,
1152
- targetPlatform: buildPlatform,
1153
- ...(ffi !== null ? { ffiImports: ffi.functions } : {}),
1154
- });
1155
- }
1156
- catch (e) {
1157
- // The last-resort panic fence: an upstream tsgo panic that crossed a
1158
- // checker call no statement/collection fence wrapped still becomes a
1159
- // clean failed compile (anchored at the entry), never a crashed CLI.
1160
- if (!isCheckerPanic(e))
1161
- throw e;
1162
- return fail([
1163
- checkerPanicDiag(e.message.split("\n", 1)[0], { file: entryPath, start: 0, end: 0 }),
1164
- ]);
1165
- }
1166
- if (lowered.module === null)
1167
- return fail(lowered.diagnostics);
1168
- const validation = validateModule(lowered.module);
1169
- if (validation.length > 0) {
1170
- return fail(validation.map((v) => iceDiag(v.message, v.loc)));
1171
- }
1172
- if (buildPlatform === "wasi") {
1173
- const entryLoc = { file: entryPath, start: 0, end: 0 };
1174
- if (opts.sanitize) {
1175
- return fail([targetRefusalDiag("wasm32-wasi", "--sanitize", entryLoc)]);
1176
- }
1177
- if (ffi !== null) {
1178
- return fail([targetRefusalDiag("wasm32-wasi", "native FFI manifests", entryLoc)]);
1179
- }
1180
- const unavailable = moduleWasiUnavailableSurface(lowered.module);
1181
- if (unavailable !== null) {
1182
- return fail([targetRefusalDiag("wasm32-wasi", unavailable.surface, unavailable.loc)]);
1183
- }
1184
- if (opts.backend === "c" || outputKind === "c") {
1185
- const asyncSurface = moduleLibAsyncSurface(lowered.module);
1186
- if (asyncSurface !== null) {
1187
- return fail([
1188
- backendRefusalDiag("c", "wasm32-wasi", asyncSurface.surface, asyncSurface.loc),
1189
- ]);
1190
- }
1191
- }
1192
- }
1193
- entryText = fe.entryText();
1194
- sourceTexts = fe.sourceTexts();
1195
- }
1196
- finally {
1197
- fe.dispose();
1198
- }
1199
- const stem = basename(entryPath).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "");
1200
- const defaultSourcePaths = {
1201
- ir: join(opts.outDir, `${stem}.ir.json`),
1202
- c: join(opts.outDir, `${stem}.c`),
1203
- llvm: join(opts.outDir, `${stem}.ll`),
1204
- };
1205
- if (outputKind === "ir") {
1206
- await mkdir(dirname(opts.outPath), { recursive: true });
1207
- await writeFile(opts.outPath, serializeModule(lowered.module));
1208
- return { ok: true, artifact: { kind: "ir", path: opts.outPath } };
1209
- }
1210
- if (outputKind === "c") {
1211
- await mkdir(dirname(opts.outPath), { recursive: true });
1212
- await writeFile(opts.outPath, emitCModule(lowered.module, entryText));
1213
- return { ok: true, artifact: { kind: "c", path: opts.outPath } };
1214
- }
1215
- if (outputKind === "llvm" || outputKind === "asm" || outputKind === "obj") {
1216
- let llvm;
1217
- try {
1218
- llvm = emitLlvmModule(lowered.module, {
1219
- pointerBits: buildPlatform === "wasi" ? 32 : 64,
1220
- wasi: buildPlatform === "wasi",
1221
- runtimeAbiMarker: outputKind === "obj",
1222
- });
1223
- }
1224
- catch (err) {
1225
- if (!(err instanceof LlvmUnsupportedError))
1226
- throw err;
1227
- return { ok: false, diagnostics: [llvmRefusalDiag(err, entryPath)], sourceTexts };
1228
- }
1229
- if (outputKind === "llvm") {
1230
- await mkdir(dirname(opts.outPath), { recursive: true });
1231
- await writeFile(opts.outPath, llvm);
1232
- }
1233
- else {
1234
- try {
1235
- await emitNativeArtifact({
1236
- outputPath: opts.outPath,
1237
- llvm,
1238
- outputKind,
1239
- sourcePath: entryPath,
1240
- optimization: opts.optimization === "dev" ? "0" : "2",
1241
- ...(opts.sanitize === undefined ? {} : { sanitize: opts.sanitize }),
1242
- });
1243
- }
1244
- catch (err) {
1245
- if (!(err instanceof NativeCodegenError))
1246
- throw err;
1247
- return {
1248
- ok: false,
1249
- diagnostics: [nativeCodegenDiag(err.diagnosticCode, err.message, entryPath)],
1250
- sourceTexts,
1251
- };
1252
- }
1253
- }
1254
- if (outputKind === "obj" && opts.nativeLinkInfo === true) {
1255
- const target = nativeCodegenTarget();
1256
- if (target === null) {
1257
- throw new InternalCompilerError("native object emitted without a native target");
1258
- }
1259
- return {
1260
- ok: true,
1261
- artifact: {
1262
- kind: "obj",
1263
- path: opts.outPath,
1264
- nativeLinkInfo: await createNativeLinkInfo({
1265
- programObject: opts.outPath,
1266
- target,
1267
- features: executableNativeFeatures(lowered.module, "llvm", opts.dynamic ?? false, opts.optimization ?? "release"),
1268
- ffi,
1269
- optimization: opts.optimization ?? "release",
1270
- }),
1271
- },
1272
- };
1273
- }
1274
- return { ok: true, artifact: { kind: outputKind, path: opts.outPath } };
1275
- }
1276
- await mkdir(opts.outDir, { recursive: true });
1277
- // Both backends hang off the same in-memory IrModule (never the JSON
1278
- // dump); the LLVM backend's .ll takes the .c's seat on the exact clang
1279
- // command line below — compileC accepts either. The default lane tries
1280
- // LLVM first; a tier refusal retries ONLY the emit with the C backend
1281
- // (the frontend ran once, the IR is backend-agnostic — nothing recompiles).
1282
- let cPath = defaultSourcePaths.c;
1283
- let backend = "c";
1284
- let llvmSource = null;
1285
- let llvmRefusal;
1286
- if (opts.backend !== "c") {
1287
- try {
1288
- const ll = emitLlvmModule(lowered.module, {
1289
- pointerBits: buildPlatform === "wasi" ? 32 : 64,
1290
- wasi: buildPlatform === "wasi",
1291
- runtimeAbiMarker: opts.nativeProgramObject === true ||
1292
- usesPrecompiledRuntimePack(opts, "llvm"),
1293
- });
1294
- cPath = defaultSourcePaths.llvm;
1295
- await writeFile(cPath, ll);
1296
- llvmSource = ll;
1297
- backend = "llvm";
1298
- }
1299
- catch (err) {
1300
- if (!(err instanceof LlvmUnsupportedError))
1301
- throw err;
1302
- // Explicit backend "llvm" keeps the fail-loudly contract (the
1303
- // debugging/CI pin): SC3001, never a silent lane change.
1304
- if (opts.backend === "llvm" || buildPlatform === "wasi") {
1305
- return { ok: false, diagnostics: [llvmRefusalDiag(err, entryPath)], sourceTexts };
1306
- }
1307
- llvmRefusal = err.kind;
1308
- }
1309
- }
1310
- if (backend === "c") {
1311
- await writeFile(cPath, emitCModule(lowered.module, entryText));
1312
- }
1313
- let irPath;
1314
- if (opts.emitIr) {
1315
- irPath = defaultSourcePaths.ir;
1316
- await writeFile(irPath, serializeModule(lowered.module));
1317
- }
1318
- const nativeFeatures = executableNativeFeatures(lowered.module, backend, opts.dynamic ?? false, opts.optimization ?? "release", llvmRefusal);
1319
- const programSplit = backend === "llvm" && (opts.optimization ?? "release") === "dev" &&
1320
- !(opts.sanitize ?? false) && llvmSource !== null
1321
- ? splitLlvmProgram(llvmSource)
1322
- : null;
642
+ timing("executable-cache-miss");
643
+ const prepared = await prepareExecutableInput(entryPath, opts, ffi, buildPlatform, timing);
644
+ if ("ok" in prepared)
645
+ return prepared;
646
+ const { llvmSource, llvmPath, irPath, nativeFeatures, programSplit, sourceTexts } = prepared;
647
+ const backend = "llvm";
1323
648
  await mkdir(dirname(opts.outPath), { recursive: true });
1324
649
  if (earlyCacheOptions === null) {
1325
650
  throw new InternalCompilerError("executable emission without executable cache options");
@@ -1336,6 +661,7 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1336
661
  }
1337
662
  try {
1338
663
  nativeProgramObject = await emitNativeProgramObject(entryPath, opts, llvmSource);
664
+ timing("native-object");
1339
665
  }
1340
666
  catch (err) {
1341
667
  if (!(err instanceof NativeCodegenError))
@@ -1347,9 +673,9 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1347
673
  };
1348
674
  }
1349
675
  }
1350
- await compileExecutableNative(nativeFeatures, nativeProgramObject?.linkPath ?? cPath, opts.outPath, opts.sanitize ?? false, ffi, opts.windowsSubsystem, opts.strip, programSplit, nativeProgramObject?.dependencies, opts.nativeProgramObject === true ? undefined : async ({ dependencies }) => {
676
+ await compileExecutableNative(nativeFeatures, nativeProgramObject?.linkPath ?? llvmPath, opts.outPath, opts.sanitize ?? false, ffi, opts.windowsSubsystem, opts.strip, programSplit, nativeProgramObject?.dependencies, opts.nativeProgramObject === true ? undefined : async ({ dependencies }) => {
1351
677
  await publishEarlyExecutableCache(cacheRoot, executableCacheOptions, {
1352
- cPath,
678
+ llvmPath,
1353
679
  native: nativeFeatures,
1354
680
  executableRestored: true,
1355
681
  nativeDependencies: dependencies,
@@ -1358,6 +684,7 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1358
684
  });
1359
685
  publishedExecutable = true;
1360
686
  });
687
+ timing("native-link");
1361
688
  if (nativeProgramObject !== null && opts.nativeProgramObject === true) {
1362
689
  await rename(nativeProgramObject.linkPath, nativeProgramObject.artifactPath);
1363
690
  }
@@ -1384,7 +711,7 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1384
711
  }
1385
712
  if (!publishedExecutable) {
1386
713
  await publishEarlyExecutableCache(cacheRoot, executableCacheOptions, {
1387
- cPath,
714
+ llvmPath,
1388
715
  native: nativeFeatures,
1389
716
  executableRestored: false,
1390
717
  frontend: frontendInputs.snapshot(),
@@ -1392,405 +719,87 @@ async function compileTracked(entryPath, opts, frontendInputs) {
1392
719
  }).catch(() => undefined);
1393
720
  }
1394
721
  await pruneBuildCache(cacheRoot);
722
+ timing("complete");
1395
723
  return {
1396
724
  ok: true,
1397
725
  artifact: {
1398
726
  kind: "exe",
1399
727
  path: opts.outPath,
1400
- translationUnitPath: cPath,
728
+ translationUnitPath: llvmPath,
1401
729
  backend,
1402
- ...(llvmRefusal !== undefined ? { llvmRefusal } : {}),
1403
730
  },
1404
731
  binaryPath: opts.outPath,
1405
- cPath,
732
+ llvmPath,
1406
733
  backend,
1407
734
  ...(irPath !== undefined ? { irPath } : {}),
1408
- ...(llvmRefusal !== undefined ? { llvmRefusal } : {}),
1409
735
  };
1410
736
  }
1411
- /** The marshalling-class fit over IR types (design §4.2 + the ratified
1412
- * integer plumbing classes): number is every f64-backed class, bool/string
1413
- * map directly, bytes is the u8 element kind. */
1414
- function libClassFits(cls, t) {
1415
- switch (cls) {
1416
- case "bool":
1417
- return t.kind === "bool";
1418
- case "string":
1419
- return t.kind === "string";
1420
- case "bytes":
1421
- return t.kind === "bytes" && t.elem === "u8";
1422
- default: // f64 and the u8/u32/i32 plumbing classes
1423
- return t.kind === "f64";
1424
- }
1425
- }
1426
- /** Resolve the profile's export map against the entry module — SC4002/
1427
- * SC4004/SC4007 from the declaration facts, SC4003 from the lowered IR
1428
- * signatures — and land the library section on the module. */
1429
- function resolveLibrarySection(profile, entryInfo, mod, entryPath) {
1430
- const diagnostics = [];
1431
- const entryLoc = { file: entryPath, start: 0, end: 0 };
1432
- const fnByName = new Map(mod.functions.map((f) => [f.name, f]));
1433
- const exports = [];
1434
- for (const e of profile.exports) {
1435
- const info = entryInfo.get(e.export);
1436
- if (info === undefined) {
1437
- diagnostics.push(libExportUnresolvedDiag(e.export, "the entry module has no exported function declaration by that name", entryLoc));
1438
- continue;
1439
- }
1440
- if (info.generic) {
1441
- diagnostics.push(libGenericExportDiag(e.export, info.loc));
1442
- continue;
1443
- }
1444
- if (info.async || info.generator) {
1445
- diagnostics.push(libAsyncExportDiag(e.export, info.async ? "async" : "generator", info.loc));
1446
- continue;
1447
- }
1448
- const fn = fnByName.get(e.export);
1449
- if (fn === undefined) {
1450
- diagnostics.push(libExportUnresolvedDiag(e.export, "the export did not lower to a compiled function", info.loc));
1451
- continue;
1452
- }
1453
- if (fn.params.length !== e.params.length) {
1454
- diagnostics.push(libUnmappableSignatureDiag(e.export, "signature", `has ${fn.params.length} parameter(s) but the profile declares ${e.params.length} marshalling class(es)`, info.loc));
1455
- continue;
1456
- }
1457
- let bad = false;
1458
- e.params.forEach((cls, i) => {
1459
- if (!libClassFits(cls, fn.params[i].type)) {
1460
- bad = true;
1461
- diagnostics.push(libUnmappableSignatureDiag(e.export, `parameter ${i + 1} ('${fn.params[i].name}')`, `has IR type '${fn.params[i].type.kind}', which does not fit the declared marshalling class '${cls}'`, info.loc));
1462
- }
1463
- });
1464
- if (e.returns === "void" ? fn.returnType.kind !== "void" : !libClassFits(e.returns, fn.returnType)) {
1465
- bad = true;
1466
- diagnostics.push(libUnmappableSignatureDiag(e.export, "the return", `has IR type '${fn.returnType.kind}', which does not fit the declared marshalling class '${e.returns}'`, info.loc));
1467
- }
1468
- if (!bad) {
1469
- const resolvedExport = {
1470
- symbol: e.symbol,
1471
- fnName: e.export,
1472
- params: e.params,
1473
- returns: e.returns,
1474
- };
1475
- if (e.params.includes("bytes")) {
1476
- // The wrapper's one host-contract trap (an inbound bytes length
1477
- // past the marshalling class's range) is assembled HERE, once, as
1478
- // the structured trap-teaching message: the profile's teaching for
1479
- // SC4012 (or the mode's default text), the code, the trapping
1480
- // export's C symbol exactly as the host linked it, and the
1481
- // profile's remediation when supplied — so both backends emit the
1482
- // same bytes and the sink sees one canonical message.
1483
- resolvedExport.inboundBytesTrap = assembleTrapTeaching(profileTeaching(profile, LIB_INBOUND_BYTES_TRAP_CODE) ??
1484
- "scriptc: library inbound bytes length out of range\n", LIB_INBOUND_BYTES_TRAP_CODE, e.symbol, profileRemediation(profile, LIB_INBOUND_BYTES_TRAP_CODE));
1485
- }
1486
- if (e.params.includes("i64") || e.params.includes("u64")) {
1487
- // The sibling host-contract trap for inbound declared-integer
1488
- // parameters (ask 4): a value past ±(2^53−1) cannot ride f64
1489
- // exactly, and silent rounding is a coercion the author never
1490
- // wrote. Same code (SC4012 — one host-contract story), same
1491
- // assembly-once discipline.
1492
- resolvedExport.inboundIntTrap = assembleTrapTeaching(profileTeaching(profile, LIB_INBOUND_BYTES_TRAP_CODE) ??
1493
- "scriptc: library inbound integer parameter out of range\n", LIB_INBOUND_BYTES_TRAP_CODE, e.symbol, profileRemediation(profile, LIB_INBOUND_BYTES_TRAP_CODE));
1494
- }
1495
- exports.push(resolvedExport);
1496
- }
1497
- }
1498
- if (diagnostics.length > 0)
1499
- return { diagnostics };
1500
- // The runtime detected-trap overlay rows: one per family code the profile
1501
- // declares teaching or remediation text for, in the registry family's
1502
- // order. Both backends emit exactly these rows as the program TU's
1503
- // overlay table, so the funnel-assembled sink message is
1504
- // emission-invariant by construction. (SC4012 stays compile-time
1505
- // assembled into the wrapper's message above and never reaches the
1506
- // funnel's assembly path.)
1507
- const trapOverlays = [];
1508
- for (const code of LIB_RUNTIME_TRAP_CODES) {
1509
- const teaching = profileTeaching(profile, code);
1510
- const remediation = profileRemediation(profile, code);
1511
- if (teaching !== undefined || remediation !== undefined) {
1512
- trapOverlays.push({
1513
- code,
1514
- ...(teaching !== undefined ? { teaching } : {}),
1515
- ...(remediation !== undefined ? { remediation } : {}),
1516
- });
1517
- }
1518
- }
1519
- return {
1520
- lib: {
1521
- profileName: profile.name,
1522
- prefix: profile.prefix,
1523
- initSymbol: profile.initSymbol,
1524
- sinkRegisterSymbol: profile.sinkRegisterSymbol,
1525
- collectSymbol: profile.collectSymbol,
1526
- resultResetSymbol: profile.resultResetSymbol,
1527
- threadInstances: profile.instancePerThread,
1528
- // Host-callback channels: declaration order is the runtime slot
1529
- // assignment, and the unregistered-call trap text is assembled HERE,
1530
- // once, so both backends emit identical constant bytes (a DETECTED
1531
- // trap: the funnel classifies the "scriptc: library callback "
1532
- // prefix as SC4025 and names the entry the host called — the entry
1533
- // is runtime knowledge, so no compile-time SC4012-style assembly
1534
- // can carry it). Both fields stay absent on callback-free profiles
1535
- // (the byte-identity guarantee).
1536
- ...(profile.callbacks.length > 0
1537
- ? {
1538
- callbackRegisterSymbol: profile.callbackRegisterSymbol,
1539
- callbacks: profile.callbacks.map((cb, i) => ({
1540
- name: cb.name,
1541
- slot: i,
1542
- params: [...cb.params],
1543
- returns: cb.returns,
1544
- unregisteredTrap: `scriptc: library callback '${cb.name}' invoked before registration\n`,
1545
- })),
1546
- }
1547
- : {}),
1548
- exports,
1549
- trapOverlays,
1550
- },
1551
- };
1552
- }
1553
- /** The export map's integer-slot obligations (ask 4): i64/u64 params and
1554
- * returns become declared boundary slots keyed `exports.<name>.params[i]`
1555
- * / `exports.<name>.return`; the u8/u32/i32 plumbing classes contribute
1556
- * their proven inbound shapes as parameter seeds (the wrapper's coercion
1557
- * contract), tightening the intraprocedural analysis at zero declaration
1558
- * cost. Sidecar-declared slots (record fields, msg arms, helper params
1559
- * and returns) merge into the same config at sidecar build. */
1560
- function libraryIntSlotConfig(profile) {
1561
- const cfg = { fns: new Map(), records: new Map() };
1562
- for (const e of profile.exports) {
1563
- const params = e.params.map((c) => (c === "i64" || c === "u64" ? c : null));
1564
- const ret = e.returns === "i64" || e.returns === "u64" ? e.returns : null;
1565
- const paramSeeds = e.params.map((c) => (c === "u8" || c === "u32" || c === "i32" ? classSeed(c) : null));
1566
- if (params.every((p) => p === null) && ret === null && paramSeeds.every((s) => s === null))
1567
- continue;
1568
- const slots = {
1569
- fnName: e.export,
1570
- params,
1571
- paramPaths: e.params.map((c, i) => (c === "i64" || c === "u64" ? `exports.${e.export}.params[${i}]` : null)),
1572
- ret,
1573
- retPath: ret !== null ? `exports.${e.export}.return` : null,
1574
- paramSeeds,
1575
- };
1576
- cfg.fns.set(e.export, slots);
1577
- }
1578
- return cfg;
1579
- }
1580
- /** Match the sidecar syntax's exact structural type projection against the
1581
- * frontend's interned IR registries. The pattern deliberately mirrors
1582
- * ShapeRegistry's identity: every field name and recursively mapped field
1583
- * type participates. Tagged payload records additionally accept omission
1584
- * of their `kind` field because the lowering may carry that discriminant
1585
- * only in the surrounding union tag. */
1586
- function sidecarRecordMatcher(mod) {
1587
- const records = new Map((mod.records ?? []).map((shape) => [shape.id, shape]));
1588
- const unions = new Map((mod.unions ?? []).map((union) => [union.id, union]));
1589
- const recordMatches = (pattern, shape) => {
1590
- if (shape.tuple === true || shape.indexValue !== undefined)
1591
- return false;
1592
- const variants = [pattern.fields];
1593
- if (pattern.kindMayBeOmitted === true) {
1594
- variants.push(pattern.fields.filter((field) => field.name !== "kind"));
1595
- }
1596
- return variants.some((fields) => fields.length === shape.fields.length &&
1597
- fields.every((field) => {
1598
- const actual = shape.fields.find((candidate) => candidate.name === field.name);
1599
- return actual !== undefined && typeMatches(field.type, actual.type);
1600
- }));
1601
- };
1602
- const unionMatches = (patterns, actual) => {
1603
- if (patterns.length !== actual.length)
1604
- return false;
1605
- const used = new Set();
1606
- const visit = (index) => {
1607
- if (index === patterns.length)
1608
- return true;
1609
- for (let i = 0; i < actual.length; i++) {
1610
- if (used.has(i) || !typeMatches(patterns[index], actual[i]))
1611
- continue;
1612
- used.add(i);
1613
- if (visit(index + 1))
1614
- return true;
1615
- used.delete(i);
1616
- }
1617
- return false;
1618
- };
1619
- return visit(0);
1620
- };
1621
- const typeMatches = (pattern, actual) => {
1622
- switch (pattern.kind) {
1623
- case "f64":
1624
- case "string":
1625
- case "bool":
1626
- case "nullT":
1627
- case "undefinedT":
1628
- case "dyn":
1629
- return actual.kind === pattern.kind;
1630
- case "bytes":
1631
- return actual.kind === "bytes" && actual.elem === pattern.elem;
1632
- case "array":
1633
- return actual.kind === "array" && typeMatches(pattern.elem, actual.elem);
1634
- case "record": {
1635
- if (actual.kind !== "record")
1636
- return false;
1637
- const shape = records.get(actual.shapeId);
1638
- return shape !== undefined && recordMatches(pattern, shape);
1639
- }
1640
- case "union": {
1641
- if (actual.kind !== "union")
1642
- return false;
1643
- const union = unions.get(actual.unionId);
1644
- return union !== undefined && unionMatches(pattern.arms, union.arms);
1645
- }
1646
- }
1647
- };
1648
- return (pattern, shape) => recordMatches(pattern, shape);
1649
- }
1650
- /** Merge the sidecar-resolved integer slots (ask 4) into the inference
1651
- * config: helper slots key by function name and IR parameter index (the
1652
- * projection already shifted past the model receiver); record-field
1653
- * slots map onto every interned IR shape whose complete structural field
1654
- * signature matches the projected record's. Shapes intern structurally,
1655
- * so a same-shaped second type shares the obligation. DECLARED paths with
1656
- * the same class coalesce while retaining every source path for verdicts;
1657
- * differing classes refuse because one lowered field cannot seed or check
1658
- * two distinct class contracts without arm provenance. A
1659
- * record fact that matches no shape binds nothing: no compiled code
1660
- * constructs the type (the contract surface — init/update/subscriptions
1661
- * and every helper — is force-lowered whenever integer slots are
1662
- * declared, so this is genuine vacuity, not dead-stripping). */
1663
- function mergeSidecarIntSlots(cfg, facts, mod) {
1664
- const recordMatches = sidecarRecordMatcher(mod);
1665
- for (const h of facts.helpers) {
1666
- const fn = mod.functions.find((f) => f.name === h.fnName);
1667
- const arity = Math.max(fn?.params.length ?? 0, (h.index ?? 0) + 1);
1668
- let slots = cfg.fns.get(h.fnName);
1669
- if (slots === undefined) {
1670
- slots = {
1671
- fnName: h.fnName,
1672
- params: new Array(arity).fill(null),
1673
- paramPaths: new Array(arity).fill(null),
1674
- ret: null,
1675
- retPath: null,
1676
- paramSeeds: new Array(arity).fill(null),
1677
- };
1678
- cfg.fns.set(h.fnName, slots);
1679
- }
1680
- if (h.kind === "param") {
1681
- const i = h.index;
1682
- while (slots.params.length <= i) {
1683
- slots.params.push(null);
1684
- slots.paramPaths.push(null);
1685
- slots.paramSeeds.push(null);
1686
- }
1687
- slots.params[i] = h.cls;
1688
- slots.paramPaths[i] = h.path;
1689
- }
1690
- else {
1691
- slots.ret = h.cls;
1692
- slots.retPath = h.path;
1693
- }
1694
- }
1695
- for (const r of facts.records) {
1696
- for (const shape of mod.records ?? []) {
1697
- if (!recordMatches(r.shape, shape))
1698
- continue;
1699
- const target = shape.fields.find((f) => f.name === r.targetField);
1700
- if (target === undefined || numberCarrierKind(target.type, mod) === null)
1701
- continue;
1702
- let m = cfg.records.get(shape.id);
1703
- if (m === undefined) {
1704
- m = new Map();
1705
- cfg.records.set(shape.id, m);
1706
- }
1707
- const existing = m.get(r.targetField);
1708
- if (existing !== undefined && existing.cls !== r.cls) {
1709
- const paths = [
1710
- ...existing.paths.map((path) => `'${path}' (${existing.cls})`),
1711
- `'${r.path}' (${r.cls})`,
1712
- ];
1713
- return {
1714
- ok: false,
1715
- diagnostic: libSidecarDiag(`integer slots ${paths.join(" and ")} collapse to the same lowered record field '${r.targetField}' — their proof obligations cannot be kept distinct`, r.loc, "kind-tagged union arms and structurally identical records may share one lowered shape — same-class declarations coalesce, but differing classes require distinct structural shapes or at most one classified slot"),
1716
- };
1717
- }
1718
- if (existing === undefined) {
1719
- m.set(r.targetField, { cls: r.cls, paths: [r.path] });
1720
- }
1721
- else if (!existing.paths.includes(r.path)) {
1722
- existing.paths.push(r.path);
1723
- }
1724
- }
1725
- }
1726
- return { ok: true, config: cfg };
1727
- }
737
+ /* ── library emission mode ───────────────────────────────────────────────
738
+ * `scriptc build --lib --profile <file>`: compile the profile's ONE entry module
739
+ * to a linkable static archive (<name>.lib.a) exporting exactly the
740
+ * profile-declared C-ABI symbols — no main, no event loop, no signal
741
+ * handlers, traps to the host's registered sink. The profile pins the
742
+ * emission; there is no fallback concept on this path (an out-of-tier
743
+ * program under emission "llvm" is SC3001, fail-loudly). */
1728
744
  function libraryNativeFeatures(mod, backend) {
745
+ const features = moduleRuntimeFeatures(mod);
1729
746
  return {
1730
747
  backend,
1731
- regex: moduleUsesRegex(mod),
1732
- assert: moduleUsesAssert(mod),
1733
- inspect: moduleUsesInspect(mod),
1734
- symbol: moduleUsesSymbol(mod),
1735
- bigint: moduleUsesBigInt(mod),
1736
- searchParams: moduleUsesSearchParams(mod),
1737
- emitter: moduleUsesEmitter(mod),
1738
- zlib: moduleUsesZlib(mod),
1739
- copying: moduleUsesCopying(mod),
1740
- textDecoderLegacy: moduleUsesLegacyTextDecoder(mod),
748
+ regex: features.regex,
749
+ assert: features.assert,
750
+ inspect: features.inspect,
751
+ symbol: features.symbol,
752
+ bigint: features.bigint,
753
+ searchParams: features.searchParams,
754
+ emitter: features.emitter,
755
+ zlib: features.zlib,
756
+ copying: features.copying,
757
+ textDecoderLegacy: features.legacyTextDecoder,
758
+ dynInvoke: features.dynInvoke,
1741
759
  ...(mod.lib?.identity !== undefined ? { buildId: mod.lib.identity.buildId } : {}),
1742
760
  };
1743
761
  }
1744
- function libraryLocalizeSymbols(profile) {
1745
- return profile.localizeRuntime
1746
- ? [
1747
- profile.initSymbol,
1748
- profile.sinkRegisterSymbol,
1749
- ...(profile.collectSymbol !== null ? [profile.collectSymbol] : []),
1750
- ...(profile.resultResetSymbol !== null ? [profile.resultResetSymbol] : []),
1751
- ...(profile.callbackRegisterSymbol !== null ? [profile.callbackRegisterSymbol] : []),
1752
- ...(profile.sidecar !== null
1753
- ? [profile.sidecar.buildIdSymbol, profile.sidecar.abiVersionSymbol]
1754
- : []),
1755
- ...profile.exports.map((entry) => entry.symbol),
1756
- ]
1757
- : undefined;
1758
- }
1759
- async function compileLibraryNative(profile, cPath, archivePath, sanitize, features) {
762
+ async function compileLibraryNative(profile, llvmPath, archivePath, sanitize, features) {
763
+ const wasmTarget = nativeCodegenTarget();
764
+ if (wasmTarget?.platform === "wasi") {
765
+ await compilePackedLibrary({
766
+ cPath: llvmPath, outPath: archivePath, optimization: profile.optimization, ...features,
767
+ }, wasmTarget, libraryWasmExports(profile));
768
+ return;
769
+ }
1760
770
  const localizeSymbols = libraryLocalizeSymbols(profile);
1761
- let identityCSource;
771
+ let identityLlvmSource;
1762
772
  let programSource;
1763
- if (profile.sidecar !== null || profile.emission === "c" ||
773
+ if (profile.sidecar !== null ||
1764
774
  (profile.emission === "llvm" && profile.optimization === "dev" && !sanitize)) {
1765
- const publicSource = await readFile(cPath, "utf8");
775
+ const publicSource = await readFile(llvmPath, "utf8");
1766
776
  programSource = publicSource;
1767
777
  }
1768
778
  if (profile.sidecar !== null) {
1769
779
  if (features.buildId === undefined)
1770
780
  throw new InternalCompilerError("library identity TU has no build id");
1771
- const withoutIdentity = stripLibraryIdentity(programSource, profile.emission);
781
+ const withoutIdentity = stripLibraryIdentity(programSource);
1772
782
  if (withoutIdentity === programSource) {
1773
783
  throw new InternalCompilerError("generated public library TU has no identity region");
1774
784
  }
1775
785
  programSource = withoutIdentity;
1776
- identityCSource = [
1777
- "#include <stdint.h>",
1778
- "#include <inttypes.h>",
1779
- `uint64_t ${profile.sidecar.buildIdSymbol}(void) { return UINT64_C(0x${features.buildId}); }`,
1780
- `uint32_t ${profile.sidecar.abiVersionSymbol}(void) { return ${profile.sidecar.abiVersion}u; }`,
1781
- "",
1782
- ].join("\n");
1783
- }
1784
- if (profile.emission === "c") {
1785
- programSource = stripLibrarySourceComments(programSource, profile.entry);
786
+ identityLlvmSource = emitLibraryIdentityLines({
787
+ buildIdSymbol: profile.sidecar.buildIdSymbol,
788
+ abiVersionSymbol: profile.sidecar.abiVersionSymbol,
789
+ buildId: features.buildId,
790
+ abiVersion: profile.sidecar.abiVersion,
791
+ }, "").join("\n");
1786
792
  }
1787
793
  const llvmSplit = profile.emission === "llvm" && profile.optimization === "dev" && !sanitize && programSource !== undefined
1788
794
  ? splitLlvmLibraryProgram(programSource)
1789
795
  : null;
1790
- await compileExternalCLibrary({
1791
- cPath,
796
+ const packTarget = !sanitize ? nativeCodegenTarget() : null;
797
+ if (!sanitize && packTarget === null)
798
+ throw new NativeCodegenError("SC3002", nativeCodegenTargetRefusal() ?? "unsupported library target");
799
+ const archiveOptions = {
800
+ cPath: llvmPath,
1792
801
  ...(programSource !== undefined ? { programSource } : {}),
1793
- ...(identityCSource !== undefined ? { identityCSource } : {}),
802
+ ...(identityLlvmSource !== undefined ? { identityLlvmSource } : {}),
1794
803
  ...(llvmSplit !== null
1795
804
  ? {
1796
805
  programShards: llvmSplit.shards,
@@ -1813,7 +822,12 @@ async function compileLibraryNative(profile, cPath, archivePath, sanitize, featu
1813
822
  zlib: features.zlib,
1814
823
  copying: features.copying,
1815
824
  textDecoderLegacy: features.textDecoderLegacy,
1816
- });
825
+ dynInvoke: features.dynInvoke,
826
+ };
827
+ if (packTarget !== null)
828
+ await compilePackedLibrary(archiveOptions, packTarget);
829
+ else
830
+ await compileExternalCLibrary(archiveOptions);
1817
831
  }
1818
832
  async function emitSemanticLibraryHit(hit, profile, opts, archivePath, cacheRoot, cacheOptions, timing) {
1819
833
  const mod = hit.mod;
@@ -1839,30 +853,19 @@ async function emitSemanticLibraryHit(hit, profile, opts, archivePath, cacheRoot
1839
853
  }
1840
854
  await mkdir(opts.outDir, { recursive: true });
1841
855
  const stem = basename(profile.entry).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "");
1842
- const cPath = join(opts.outDir, `${stem}.lib.${profile.emission === "llvm" ? "ll" : "c"}`);
856
+ const llvmPath = join(opts.outDir, `${stem}.lib.ll`);
1843
857
  let translationUnit = hit.translationUnit;
1844
858
  if (profile.sidecar !== null) {
1845
- translationUnit = replaceLibraryIdentity(translationUnit, profile.emission, mod.lib.identity);
1846
- }
1847
- if (profile.emission === "llvm") {
1848
- await writeFile(cPath, translationUnit);
1849
- }
1850
- else {
1851
- const previous = hit.previousSources.get(mod.sourceFile);
1852
- const current = hit.sourceTexts.get(mod.sourceFile);
1853
- if (previous === undefined || current === undefined) {
1854
- throw new InternalCompilerError("semantic library cache lost the entry source text");
1855
- }
1856
- translationUnit = rebaseLibrarySourceComments(translationUnit, mod.sourceFile, createSourceLineRebaser(mod.sourceFile, previous, current));
1857
- await writeFile(cPath, translationUnit);
859
+ translationUnit = replaceLibraryIdentity(translationUnit, mod.lib.identity);
1858
860
  }
861
+ await writeFile(llvmPath, translationUnit);
1859
862
  timing("semantic-tu-restore", { output_bytes: Buffer.byteLength(translationUnit) });
1860
863
  let irPath;
1861
864
  if (opts.emitIr) {
1862
865
  irPath = join(opts.outDir, `${stem}.lib.ir.json`);
1863
- await writeFile(irPath, serializeModule(mod));
866
+ await writeFile(irPath, serializeModule(mod, true));
1864
867
  }
1865
- await compileLibraryNative(profile, cPath, archivePath, opts.sanitize ?? false, hit.native);
868
+ await compileLibraryNative(profile, llvmPath, archivePath, opts.sanitize ?? false, hit.native);
1866
869
  timing("native-archive");
1867
870
  let sidecarPath;
1868
871
  if (sidecarJson !== null) {
@@ -1872,7 +875,7 @@ async function emitSemanticLibraryHit(hit, profile, opts, archivePath, cacheRoot
1872
875
  await writeFile(sidecarPath, sidecarJson);
1873
876
  }
1874
877
  await publishEarlyLibraryCache(cacheRoot, cacheOptions, {
1875
- cPath,
878
+ llvmPath,
1876
879
  native: hit.native,
1877
880
  frontend: hit.frontend,
1878
881
  semantic: { mod, sources: hit.sourceTexts },
@@ -1885,7 +888,7 @@ async function emitSemanticLibraryHit(hit, profile, opts, archivePath, cacheRoot
1885
888
  return {
1886
889
  ok: true,
1887
890
  archivePath,
1888
- cPath,
891
+ llvmPath,
1889
892
  backend: profile.emission,
1890
893
  ...(irPath !== undefined ? { irPath } : {}),
1891
894
  ...(sidecarPath !== undefined ? { sidecarPath } : {}),
@@ -1894,7 +897,16 @@ async function emitSemanticLibraryHit(hit, profile, opts, archivePath, cacheRoot
1894
897
  export async function compileLibrary(opts) {
1895
898
  clearCompileSessionCaches();
1896
899
  const frontendInputs = new FrontendInputTracker();
1897
- return frontendInputs.run(() => compileLibraryTracked(opts, frontendInputs));
900
+ try {
901
+ return await frontendInputs.run(() => compileLibraryTracked(opts, frontendInputs));
902
+ }
903
+ catch (error) {
904
+ if (error instanceof RuntimePackError)
905
+ return { ok: false, diagnostics: [runtimePackDiagnostic(error, opts.profilePath)], sourceTexts: new Map() };
906
+ if (error instanceof NativeCodegenError)
907
+ return { ok: false, diagnostics: [nativeCodegenDiag(error.diagnosticCode, error.message, opts.profilePath)], sourceTexts: new Map() };
908
+ throw error;
909
+ }
1898
910
  }
1899
911
  async function compileLibraryTracked(opts, frontendInputs) {
1900
912
  const timingOn = process.env["SCRIPTC_TIMING"] === "1";
@@ -1920,7 +932,6 @@ async function compileLibraryTracked(opts, frontendInputs) {
1920
932
  }
1921
933
  const profile = loadedProfile.profile;
1922
934
  const entryPath = profile.entry;
1923
- const buildPlatform = buildTargetPlatform();
1924
935
  const profileDir = dirname(resolve(opts.profilePath));
1925
936
  for (let directory = dirname(entryPath);; directory = dirname(directory)) {
1926
937
  for (const name of ["tsconfig.json", "package.json"]) {
@@ -1935,7 +946,6 @@ async function compileLibraryTracked(opts, frontendInputs) {
1935
946
  if (directory === profileDir || dirname(directory) === directory)
1936
947
  break;
1937
948
  }
1938
- const archivePath = opts.outPath ?? join(opts.outDir, `${basename(entryPath).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "")}.lib.a`);
1939
949
  // Mobile-target admission first — a pure env/host check, so a refused
1940
950
  // pairing never reaches toolchain discovery. iOS targets (device and
1941
951
  // simulator) build on darwin hosts only: the Apple SDK sysroot and the
@@ -1952,6 +962,13 @@ async function compileLibraryTracked(opts, frontendInputs) {
1952
962
  };
1953
963
  }
1954
964
  }
965
+ const buildPlatform = buildTargetPlatform();
966
+ const archivePath = opts.outPath ?? join(opts.outDir, `${basename(entryPath).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "")}${buildPlatform === "wasi" ? ".wasm" : ".lib.a"}`);
967
+ if (buildPlatform === "wasi") {
968
+ const refusal = libraryWasmRefusal(profile, opts.sanitize ?? false);
969
+ if (refusal !== null)
970
+ return { ok: false, diagnostics: [refusal], sourceTexts: new Map() };
971
+ }
1955
972
  // Multi-instance library mode (abi.localize_runtime) localizes per
1956
973
  // OBJECT FORMAT: ELF and COFF archives localize from any host (cross
1957
974
  // ELF merges through the cross driver's own lld; COFF merges and
@@ -1959,11 +976,14 @@ async function compileLibraryTracked(opts, frontendInputs) {
1959
976
  // localization runs the macOS host linker, so macos and ios targets
1960
977
  // admit darwin hosts only (the mobile admission above already refused
1961
978
  // an ios triple off darwin). Everything else refuses before frontend/
1962
- // backend work, naming the pairing. WASI retains the general
1963
- // library-mode refusal below.
979
+ // backend work, naming the pairing. WASI refuses localization above:
980
+ // each WebAssembly.Instance already owns its runtime state.
1964
981
  if (profile.localizeRuntime && buildPlatform !== "wasi") {
1965
- const driver = resolveCc();
1966
- const platform = targetPlatform(driver);
982
+ const packTarget = nativeCodegenTarget();
983
+ const driver = opts.sanitize ? resolveCc() : {
984
+ target: packTarget?.llvmTriple ?? process.env["SCRIPTC_TARGET"] ?? null,
985
+ };
986
+ const platform = buildPlatform;
1967
987
  const targetArch = driver.target?.split("-", 1)[0] ?? null;
1968
988
  // Native Linux retains its host-binutils implementation. Cross ELF is
1969
989
  // rebuilt in process and currently accepts the two verified ELF64,
@@ -1986,7 +1006,7 @@ async function compileLibraryTracked(opts, frontendInputs) {
1986
1006
  return {
1987
1007
  ok: false,
1988
1008
  diagnostics: decorateLibraryRefusals([
1989
- targetRefusalDiag(driver.target ?? platform, subject, { file: entryPath, start: 0, end: 0 }),
1009
+ targetRefusalDiag(process.env["SCRIPTC_TARGET"] || driver.target || platform, subject, { file: entryPath, start: 0, end: 0 }),
1990
1010
  ], profile),
1991
1011
  sourceTexts: new Map(),
1992
1012
  };
@@ -2011,13 +1031,13 @@ async function compileLibraryTracked(opts, frontendInputs) {
2011
1031
  const earlyHit = await readEarlyLibraryCache(cacheRoot, earlyCacheOptions, profile.sidecar === null ? undefined : profile.sidecar.path);
2012
1032
  if (earlyHit !== null) {
2013
1033
  timing("early-cache-hit");
2014
- await compileLibraryNative(profile, earlyHit.cPath, archivePath, opts.sanitize ?? false, earlyHit.native);
1034
+ await compileLibraryNative(profile, earlyHit.llvmPath, archivePath, opts.sanitize ?? false, earlyHit.native);
2015
1035
  timing("native-archive");
2016
1036
  timing("complete");
2017
1037
  return {
2018
1038
  ok: true,
2019
1039
  archivePath,
2020
- cPath: earlyHit.cPath,
1040
+ llvmPath: earlyHit.llvmPath,
2021
1041
  backend: earlyHit.native.backend,
2022
1042
  ...(earlyHit.irPath !== undefined ? { irPath: earlyHit.irPath } : {}),
2023
1043
  ...(earlyHit.sidecarPath !== undefined ? { sidecarPath: earlyHit.sidecarPath } : {}),
@@ -2030,256 +1050,38 @@ async function compileLibraryTracked(opts, frontendInputs) {
2030
1050
  return emitSemanticLibraryHit(semanticHit, profile, opts, archivePath, cacheRoot, earlyCacheOptions, timing);
2031
1051
  }
2032
1052
  timing("semantic-cache-miss");
2033
- // Bare npm specifiers in a library graph take the STATIC-OR-REFUSE
2034
- // posture: "lib" runs the same auto-detection and eligibility bar as
2035
- // the executable lane's --npm-static (own .d.ts, unminified shipped JS,
2036
- // no build-transform markers), automatically — the library path has no
2037
- // island/dynamic tier to offer (SC4006's ground), so eligibility needs
2038
- // no flag and a miss is a refusal, never a fallback.
2039
- const fe = runFrontend(entryPath, "lib");
2040
- timing("frontend-load", {
2041
- entry_bytes: fe.entryText().length,
2042
- source_files: fe.sourceTexts().size,
2043
- });
2044
- let lowered;
2045
- let entryText;
2046
- let sourceTexts;
2047
- let entryInfo;
2048
- let contractFacts;
2049
- try {
2050
- // Every library refusal leaves through the ask-5 teaching decoration:
2051
- // profile text attaches by code, manifest id, or fence coverage as the
2052
- // attributed note (the SC4004/SC4005 rider generalized).
2053
- const fail = (diagnostics) => ({
2054
- ok: false,
2055
- diagnostics: decorateLibraryRefusals(diagnostics, profile),
2056
- sourceTexts: fe.sourceTexts(),
2057
- });
2058
- // Library mode emits a host-embedded static archive with native trap and
2059
- // C-ABI contracts. wasm32-wasi executable modules are supported, but the
2060
- // archive/reactor contract is not; refuse before emitting a host-width
2061
- // LLVM TU or asking Zig to compile the native library runtime for WASI.
2062
- if (buildPlatform === "wasi") {
2063
- return fail([
2064
- targetRefusalDiag("wasm32-wasi", "library-mode archive builds", { file: entryPath, start: 0, end: 0 }),
2065
- ]);
2066
- }
2067
- // The npm verdicts FIRST: whatever the shared frontend would have
2068
- // served from the island — an eligibility miss, an untyped install, a
2069
- // preflight offender inside a package's files, a dropped inferred
2070
- // surface — refuses here with the package and the specific bar it
2071
- // missed. Checked before the general preflight, whose diagnostics for
2072
- // these same imports speak executable-lane teachings (SC1010/SC0001 at
2073
- // the unresolvable edge); the library answer is this one.
2074
- const npmRefused = fe.npmStatic.filter((s) => s.status === "fallback");
2075
- if (npmRefused.length > 0) {
2076
- return fail(npmRefused.map((s) => libNpmIneligibleDiag(s.package,
2077
- // The one shared offender reason that narrates the executable
2078
- // lane's fallback loses that clause here — no island exists on
2079
- // this path to serve anything.
2080
- (s.detail ?? "its static compilation was refused").replace("; the island serves the package", ""), fe.npmImportSites.get(s.package) ?? { file: entryPath, start: 0, end: 0 })));
2081
- }
2082
- if (fe.preflight.length > 0)
2083
- return fail(fe.preflight);
2084
- contractFacts = profile.sidecar !== null ? fe.entryContract() : null;
2085
- // Ask 4, contract-surface reachability: when the sidecar declares ANY
2086
- // integer slot, the designated init/update/subscriptions exports and
2087
- // every contract helper (model-first exported function) seed lowering
2088
- // too. They are attested surface — a declared record-field or msg-arm
2089
- // class obligates EVERY write those bodies perform, and a declared
2090
- // helper param is checked at their internal call sites — so the
2091
- // attestation must cover COMPILED bodies, never a dead-stripped
2092
- // vacuity (the bug this closes: a model-slot declaration whose only
2093
- // writers were dead-stripped attested without any proof).
2094
- const contractSurfaceRoots = [];
2095
- if (profile.sidecar !== null && profile.sidecar.integerSlots.length > 0) {
2096
- const sc = profile.sidecar;
2097
- const fnNames = new Set(contractFacts.functions.filter((f) => !f.generic).map((f) => f.name));
2098
- for (const name of [sc.initExport, sc.updateExport, sc.subscriptionsExport]) {
2099
- if (fnNames.has(name))
2100
- contractSurfaceRoots.push(name);
2101
- }
2102
- for (const fn of contractFacts.functions) {
2103
- if (fn.generic)
2104
- continue;
2105
- const first = fn.params[0];
2106
- if (first !== undefined && first.shape !== null && first.shape.k === "ref" && first.shape.name === sc.model) {
2107
- contractSurfaceRoots.push(fn.name);
2108
- }
2109
- }
2110
- }
2111
- // The profile's host-callback channels ride the FFI import machinery:
2112
- // each channel is a signature-only ambient binding whose direct calls
2113
- // lower to ffiCall nodes (the classes are a subset of the FFI's), and
2114
- // `libraryCallbacks` flips the recognition to the library flavor —
2115
- // SC4024 diagnostics, unused channels legal, undeclared references
2116
- // refused with the callback teaching. The library lane never loads a
2117
- // native-FFI manifest, so the channel set owns the surface outright.
2118
- const cbImports = profile.callbacks.map((cb) => ({
2119
- name: cb.name,
2120
- symbol: cb.name,
2121
- params: [...cb.params],
2122
- returns: cb.returns,
2123
- }));
2124
- try {
2125
- lowered = fe.lower({
2126
- dynamic: false,
2127
- targetPlatform: buildPlatform,
2128
- ...(cbImports.length > 0 ? { ffiImports: cbImports, libraryCallbacks: true } : {}),
2129
- // The profile-mapped exports are called from OUTSIDE the graph:
2130
- // they seed reachability beside the entry's top level (an
2131
- // executable build would dead-strip an uncalled export). A helper
2132
- // with a declared integer slot (ask 4) seeds too: its attestation
2133
- // must cover a COMPILED body, never a dead-stripped vacuity — the
2134
- // sidecar advertises the slot's class, so the proof must exist.
2135
- libRoots: [
2136
- ...new Set([
2137
- ...profile.exports.map((e) => e.export),
2138
- ...(profile.sidecar?.integerSlots ?? [])
2139
- .map((s) => /^helpers\.([^.]+)\.(?:params\[\d+\]|return)$/.exec(s.slot)?.[1])
2140
- .filter((n) => n !== undefined),
2141
- ...contractSurfaceRoots,
2142
- ]),
2143
- ],
2144
- });
2145
- timing("lower", {
2146
- lib_roots: profile.exports.length + contractSurfaceRoots.length,
2147
- });
2148
- }
2149
- catch (e) {
2150
- if (!isCheckerPanic(e))
2151
- throw e;
2152
- return fail([checkerPanicDiag(e.message.split("\n", 1)[0], { file: entryPath, start: 0, end: 0 })]);
2153
- }
2154
- if (lowered.module === null)
2155
- return fail(lowered.diagnostics);
2156
- entryInfo = fe.entryExports();
2157
- entryText = fe.entryText();
2158
- sourceTexts = fe.sourceTexts();
2159
- }
2160
- finally {
2161
- fe.dispose();
2162
- }
2163
- const mod = lowered.module;
2164
- timing("frontend-dispose");
1053
+ const prepared = prepareLibrary(profile, opts.profilePath, compilerReleaseVersion(), buildPlatform, nodeFrontend, timing);
1054
+ if (!prepared.ok)
1055
+ return prepared;
1056
+ const { mod, sourceTexts, sidecarJson } = prepared;
2165
1057
  const fail = (diagnostics) => ({
2166
- ok: false,
2167
- diagnostics: decorateLibraryRefusals(diagnostics, profile),
2168
- sourceTexts,
1058
+ ok: false, diagnostics: decorateLibraryRefusals(diagnostics, profile), sourceTexts,
2169
1059
  });
2170
- // Export resolution first (SC4002/SC4003/SC4004/SC4007 anchor at the
2171
- // mapped declaration — a mapped async export reports as SC4004, not the
2172
- // graph-wide gate), then the async_free requirement (ratified, SC4005),
2173
- // then the profile's determinism fences (ask 5, SC4008) over the same
2174
- // compiled graph the attestation scan reads: all refused before anything
2175
- // is emitted, so the narrowed library link set below is structural fact.
2176
- const resolved = resolveLibrarySection(profile, entryInfo, mod, entryPath);
2177
- if ("diagnostics" in resolved)
2178
- return fail(resolved.diagnostics);
2179
- const asyncSurface = moduleLibAsyncSurface(mod);
2180
- if (asyncSurface !== null) {
2181
- return fail([libAsyncSurfaceDiag(asyncSurface.surface, asyncSurface.loc)]);
2182
- }
2183
- const fenced = evaluateLibraryFences(mod, profile);
2184
- if (fenced.length > 0)
2185
- return fail(fenced);
2186
- mod.lib = resolved.lib;
2187
- // Ask 4's declared integer slots: the export map's i64/u64 classes
2188
- // seed the config here; sidecar-declared slots (record fields, msg
2189
- // arms, helper params/returns) merge in after the projection resolves
2190
- // them below.
2191
- let intCfg = libraryIntSlotConfig(profile);
2192
- // The ask-2 contract sidecar rides the same invocation. Identity first
2193
- // (schema §2's worked build_id definition over compiler version, profile
2194
- // bytes, and the sorted canonical module graph; source_hash per the
2195
- // profile's "module-graph" contract) — the u64 lands on the IR so native
2196
- // archive assembly emits the identity getters from the ONE value the
2197
- // sidecar records (V12's coherence by construction), then the projection into
2198
- // the schema (declaration orders from the AST) and the V1–V14
2199
- // self-check before anything is written.
2200
- let sidecarJson = null;
2201
- if (profile.sidecar !== null) {
2202
- const rootDir = dirname(resolve(opts.profilePath));
2203
- const modules = canonicalModuleGraph(rootDir, sourceTexts);
2204
- const { buildId, sourceHash } = libraryIdentityHashes(compilerReleaseVersion(), profile.profileBytes, modules);
2205
- mod.lib.identity = {
2206
- buildIdSymbol: profile.sidecar.buildIdSymbol,
2207
- abiVersionSymbol: profile.sidecar.abiVersionSymbol,
2208
- buildId,
2209
- abiVersion: profile.sidecar.abiVersion,
2210
- };
2211
- const built = buildSidecar({
2212
- profile,
2213
- facts: contractFacts,
2214
- compilerVersion: compilerReleaseVersion(),
2215
- entry: canonicalPath(rootDir, entryPath),
2216
- buildId,
2217
- sourceHash,
2218
- deterministic: moduleLibNondeterministicSurface(mod) === null,
2219
- });
2220
- if (!built.ok)
2221
- return fail(built.diagnostics);
2222
- const violations = validateSidecar(built.doc);
2223
- if (violations.length > 0) {
2224
- // The projection above refuses every user-caused shape; a rule
2225
- // violation surviving to here is an emitter bug.
2226
- return fail(violations.map((v) => iceDiag(`sidecar self-check failed — ${v}`, { file: entryPath, start: 0, end: 0 })));
2227
- }
2228
- sidecarJson = built.json;
2229
- const merged = mergeSidecarIntSlots(intCfg, built.integerSlotFacts, mod);
2230
- if (!merged.ok)
2231
- return fail([merged.diagnostic]);
2232
- intCfg = merged.config;
2233
- }
2234
- timing("contract-sidecar", { source_files: sourceTexts.size });
2235
- // Ask 4: the integer-boundary inference — every value that can reach a
2236
- // profile-declared i64/u64 slot must PROVE representability, wholeness,
2237
- // and range, or the build refuses with the failed obligation, the
2238
- // observed evidence, and the author's fix (SC4021/SC4022/SC4023). Runs
2239
- // only when at least one integer slot is declared; the sidecar (already
2240
- // built above, written only on success) may then attest the classes —
2241
- // §5's invariant that an attested integer class means the proof was
2242
- // discharged holds because no artifact leaves this function otherwise.
2243
- if (hasIntSlots(intCfg)) {
2244
- const refusals = checkLibraryIntegerSlots(mod, intCfg).filter((v) => v.outcome === "refuse");
2245
- if (refusals.length > 0) {
2246
- return fail(refusals.map((v) => libIntBoundaryDiag(v.path, v.cls, v.obligation, v.detail, v.fix, v.loc)));
2247
- }
2248
- }
2249
- timing("integer-proof");
2250
- const validation = validateModule(mod);
2251
- if (validation.length > 0)
2252
- return fail(validation.map((v) => iceDiag(v.message, v.loc)));
2253
- timing("ir-validate");
2254
1060
  await mkdir(opts.outDir, { recursive: true });
2255
1061
  const stem = basename(entryPath).replace(/\.(ts|mts|cts|js|mjs|cjs)$/, "");
2256
- let cPath;
2257
- if (profile.emission === "llvm") {
2258
- try {
2259
- const ll = emitLlvmModule(mod);
2260
- timing("llvm-emit", { output_bytes: Buffer.byteLength(ll) });
2261
- cPath = join(opts.outDir, `${stem}.lib.ll`);
2262
- await writeFile(cPath, ll);
2263
- timing("llvm-write");
2264
- }
2265
- catch (err) {
2266
- if (!(err instanceof LlvmUnsupportedError))
2267
- throw err;
2268
- // The profile PINS the emission — fail-loudly, never a lane change.
2269
- return fail([llvmRefusalDiag(err, entryPath)]);
2270
- }
1062
+ const llvmPath = join(opts.outDir, `${stem}.lib.ll`);
1063
+ try {
1064
+ const ll = emitLlvmModule(mod, {
1065
+ targetTriple: process.env["SCRIPTC_TARGET"] ?? "",
1066
+ pointerBits: buildPlatform === "wasi" ? 32 : 64,
1067
+ wasi: buildPlatform === "wasi",
1068
+ });
1069
+ timing("llvm-emit", { output_bytes: Buffer.byteLength(ll) });
1070
+ await writeFile(llvmPath, ll);
1071
+ timing("llvm-write");
2271
1072
  }
2272
- else {
2273
- cPath = join(opts.outDir, `${stem}.lib.c`);
2274
- await writeFile(cPath, emitCModule(mod, entryText));
1073
+ catch (err) {
1074
+ if (!(err instanceof LlvmUnsupportedError))
1075
+ throw err;
1076
+ return fail([llvmRefusalDiag(err, entryPath)]);
2275
1077
  }
2276
1078
  let irPath;
2277
1079
  if (opts.emitIr) {
2278
1080
  irPath = join(opts.outDir, `${stem}.lib.ir.json`);
2279
- await writeFile(irPath, serializeModule(mod));
1081
+ await writeFile(irPath, serializeModule(mod, true));
2280
1082
  }
2281
1083
  const nativeFeatures = libraryNativeFeatures(mod, profile.emission);
2282
- await compileLibraryNative(profile, cPath, archivePath, opts.sanitize ?? false, nativeFeatures);
1084
+ await compileLibraryNative(profile, llvmPath, archivePath, opts.sanitize ?? false, nativeFeatures);
2283
1085
  timing("native-archive");
2284
1086
  // The sidecar lands beside the compiled object, written by the same
2285
1087
  // invocation (profile-declared name; the neutral default when the
@@ -2293,7 +1095,7 @@ async function compileLibraryTracked(opts, frontendInputs) {
2293
1095
  await writeFile(sidecarPath, sidecarJson);
2294
1096
  }
2295
1097
  const earlyPublish = {
2296
- cPath,
1098
+ llvmPath,
2297
1099
  native: nativeFeatures,
2298
1100
  frontend: frontendInputs.snapshot(),
2299
1101
  semantic: { mod, sources: sourceTexts },
@@ -2307,7 +1109,7 @@ async function compileLibraryTracked(opts, frontendInputs) {
2307
1109
  return {
2308
1110
  ok: true,
2309
1111
  archivePath,
2310
- cPath,
1112
+ llvmPath,
2311
1113
  backend: profile.emission,
2312
1114
  ...(irPath !== undefined ? { irPath } : {}),
2313
1115
  ...(sidecarPath !== undefined ? { sidecarPath } : {}),