@scriptc/compiler 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (536) hide show
  1. package/ambient/node-fallback/buffer.d.ts +2 -0
  2. package/ambient/node-fallback/child_process.d.ts +9 -3
  3. package/ambient/node-fallback/dns-promises.d.ts +25 -0
  4. package/ambient/node-fallback/dns.d.ts +29 -0
  5. package/ambient/node-fallback/test.d.ts +7 -0
  6. package/ambient/scriptc-node-fallback.d.ts +145 -2
  7. package/ambient/scriptc-overrides.d.ts +22 -13
  8. package/dist/backend/build-cache.d.ts +1 -1
  9. package/dist/backend/build-cache.js +1 -1
  10. package/dist/backend/build-cache.js.map +1 -1
  11. package/dist/backend/cache-root.d.ts +7 -0
  12. package/dist/backend/cache-root.js +27 -0
  13. package/dist/backend/cache-root.js.map +1 -1
  14. package/dist/backend/executable-features.js +5 -1
  15. package/dist/backend/executable-features.js.map +1 -1
  16. package/dist/backend/link-plan.js +7 -1
  17. package/dist/backend/link-plan.js.map +1 -1
  18. package/dist/backend/llvm/bytes-loop-versions.d.ts +12 -1
  19. package/dist/backend/llvm/bytes-loop-versions.js +107 -30
  20. package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
  21. package/dist/backend/llvm/bytes-loop-versions.test.js +96 -0
  22. package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
  23. package/dist/backend/llvm/checked-value-lifetimes.js +1 -0
  24. package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
  25. package/dist/backend/llvm/classes.d.ts +16 -5
  26. package/dist/backend/llvm/classes.js +34 -6
  27. package/dist/backend/llvm/classes.js.map +1 -1
  28. package/dist/backend/llvm/classes.test.js +21 -2
  29. package/dist/backend/llvm/classes.test.js.map +1 -1
  30. package/dist/backend/llvm/common.d.ts +9 -0
  31. package/dist/backend/llvm/common.js +9 -0
  32. package/dist/backend/llvm/common.js.map +1 -1
  33. package/dist/backend/llvm/cpu-dispatch.d.ts +36 -2
  34. package/dist/backend/llvm/cpu-dispatch.js +96 -2
  35. package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
  36. package/dist/backend/llvm/dense-array-access.d.ts +5 -2
  37. package/dist/backend/llvm/dense-array-access.js +16 -12
  38. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  39. package/dist/backend/llvm/dense-array-access.test.js +3 -1
  40. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  41. package/dist/backend/llvm/dyn.d.ts +24 -0
  42. package/dist/backend/llvm/dyn.js +117 -3
  43. package/dist/backend/llvm/dyn.js.map +1 -1
  44. package/dist/backend/llvm/emit-function.js +6 -0
  45. package/dist/backend/llvm/emit-function.js.map +1 -1
  46. package/dist/backend/llvm/emit-journal.d.ts +1 -0
  47. package/dist/backend/llvm/emit-journal.js.map +1 -1
  48. package/dist/backend/llvm/emit-module.js +48 -5
  49. package/dist/backend/llvm/emit-module.js.map +1 -1
  50. package/dist/backend/llvm/emit-module.test.js +41 -0
  51. package/dist/backend/llvm/emit-module.test.js.map +1 -1
  52. package/dist/backend/llvm/emit-statements.js +11 -0
  53. package/dist/backend/llvm/emit-statements.js.map +1 -1
  54. package/dist/backend/llvm/emitter.d.ts +87 -7
  55. package/dist/backend/llvm/emitter.js +136 -15
  56. package/dist/backend/llvm/emitter.js.map +1 -1
  57. package/dist/backend/llvm/expr-async.js +28 -6
  58. package/dist/backend/llvm/expr-async.js.map +1 -1
  59. package/dist/backend/llvm/expr-containers.js +19 -5
  60. package/dist/backend/llvm/expr-containers.js.map +1 -1
  61. package/dist/backend/llvm/expr-dynamic.js +29 -1
  62. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  63. package/dist/backend/llvm/expr-primitives.js +104 -6
  64. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  65. package/dist/backend/llvm/expr-records.js +15 -1
  66. package/dist/backend/llvm/expr-records.js.map +1 -1
  67. package/dist/backend/llvm/expr-stream-bridges.js +53 -5
  68. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  69. package/dist/backend/llvm/inline-arrays.js +1 -1
  70. package/dist/backend/llvm/inline-arrays.js.map +1 -1
  71. package/dist/backend/llvm/js-ic.js +126 -2
  72. package/dist/backend/llvm/js-ic.js.map +1 -1
  73. package/dist/backend/llvm/lanes.d.ts +38 -0
  74. package/dist/backend/llvm/lanes.js +778 -0
  75. package/dist/backend/llvm/lanes.js.map +1 -0
  76. package/dist/backend/llvm/lanes.test.d.ts +1 -0
  77. package/dist/backend/llvm/lanes.test.js +402 -0
  78. package/dist/backend/llvm/lanes.test.js.map +1 -0
  79. package/dist/backend/llvm/lib-dispatch.js +9 -4
  80. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  81. package/dist/backend/llvm/lib-network.js +20 -0
  82. package/dist/backend/llvm/lib-network.js.map +1 -1
  83. package/dist/backend/llvm/lib-shared.js +27 -0
  84. package/dist/backend/llvm/lib-shared.js.map +1 -1
  85. package/dist/backend/llvm/lib-test.js +11 -0
  86. package/dist/backend/llvm/lib-test.js.map +1 -1
  87. package/dist/backend/llvm/local-array-reads.js +2 -2
  88. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  89. package/dist/backend/llvm/map-number-lookup.js +8 -2
  90. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  91. package/dist/backend/llvm/nullable-unions.js +5 -2
  92. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  93. package/dist/backend/llvm/publish.d.ts +3 -0
  94. package/dist/backend/llvm/publish.js +2 -2
  95. package/dist/backend/llvm/publish.js.map +1 -1
  96. package/dist/backend/llvm/reference-writes.js +1 -0
  97. package/dist/backend/llvm/reference-writes.js.map +1 -1
  98. package/dist/backend/llvm/region-groups.js +43 -4
  99. package/dist/backend/llvm/region-groups.js.map +1 -1
  100. package/dist/backend/llvm/region-groups.test.js +79 -0
  101. package/dist/backend/llvm/region-groups.test.js.map +1 -1
  102. package/dist/backend/llvm/runtime-registries.test.js +32 -1
  103. package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
  104. package/dist/backend/llvm/shapes.js +10 -1
  105. package/dist/backend/llvm/shapes.js.map +1 -1
  106. package/dist/backend/llvm/string-reads.d.ts +1 -1
  107. package/dist/backend/llvm/string-reads.js +1 -1
  108. package/dist/backend/llvm/string-reads.js.map +1 -1
  109. package/dist/backend/llvm/unwind-abi.js +24 -2
  110. package/dist/backend/llvm/unwind-abi.js.map +1 -1
  111. package/dist/backend/llvm/unwind-abi.test.js +38 -0
  112. package/dist/backend/llvm/unwind-abi.test.js.map +1 -1
  113. package/dist/backend/llvm/walkers.d.ts +3 -0
  114. package/dist/backend/llvm/walkers.js +20 -2
  115. package/dist/backend/llvm/walkers.js.map +1 -1
  116. package/dist/backend/native/contracts.d.ts +15 -3
  117. package/dist/backend/native/executable.js +19 -5
  118. package/dist/backend/native/executable.js.map +1 -1
  119. package/dist/backend/native-codegen-core.d.ts +20 -0
  120. package/dist/backend/native-codegen-core.js +15 -0
  121. package/dist/backend/native-codegen-core.js.map +1 -1
  122. package/dist/backend/native-codegen.d.ts +5 -0
  123. package/dist/backend/native-codegen.js +62 -8
  124. package/dist/backend/native-codegen.js.map +1 -1
  125. package/dist/backend/native-codegen.test.js +48 -8
  126. package/dist/backend/native-codegen.test.js.map +1 -1
  127. package/dist/backend/native-link-info-core.d.ts +27 -3
  128. package/dist/backend/native-link-info-core.js.map +1 -1
  129. package/dist/backend/native-link-info.test.js +17 -1
  130. package/dist/backend/native-link-info.test.js.map +1 -1
  131. package/dist/backend/native-toolchain.d.ts +1 -1
  132. package/dist/backend/native-toolchain.js +1 -1
  133. package/dist/backend/native-toolchain.js.map +1 -1
  134. package/dist/backend/native-toolchain.test.js +14 -1
  135. package/dist/backend/native-toolchain.test.js.map +1 -1
  136. package/dist/backend/runtime-pack-core.d.ts +9 -3
  137. package/dist/backend/runtime-pack-core.js +6 -1
  138. package/dist/backend/runtime-pack-core.js.map +1 -1
  139. package/dist/backend/runtime-pack.test.js +32 -1
  140. package/dist/backend/runtime-pack.test.js.map +1 -1
  141. package/dist/backend/targets.d.ts +9 -1
  142. package/dist/backend/targets.js +11 -2
  143. package/dist/backend/targets.js.map +1 -1
  144. package/dist/backend/targets.test.js +6 -0
  145. package/dist/backend/targets.test.js.map +1 -1
  146. package/dist/cli/command.js +15 -1
  147. package/dist/cli/command.js.map +1 -1
  148. package/dist/cli/host.d.ts +6 -0
  149. package/dist/cli/mcp.d.ts +72 -0
  150. package/dist/cli/mcp.js +601 -0
  151. package/dist/cli/mcp.js.map +1 -0
  152. package/dist/cli/mcp.test.d.ts +1 -0
  153. package/dist/cli/mcp.test.js +380 -0
  154. package/dist/cli/mcp.test.js.map +1 -0
  155. package/dist/cli/output-options.d.ts +1 -0
  156. package/dist/cli/output-options.js +3 -0
  157. package/dist/cli/output-options.js.map +1 -1
  158. package/dist/cli/usage.d.ts +51 -1
  159. package/dist/cli/usage.js +709 -186
  160. package/dist/cli/usage.js.map +1 -1
  161. package/dist/compat/fetch-profile.js +9 -4
  162. package/dist/compat/fetch-profile.js.map +1 -1
  163. package/dist/compile-types.d.ts +17 -0
  164. package/dist/coverage/report.d.ts +5 -9
  165. package/dist/coverage/report.js.map +1 -1
  166. package/dist/executable/executable-cache.d.ts +17 -3
  167. package/dist/executable/executable-cache.js +17 -3
  168. package/dist/executable/executable-cache.js.map +1 -1
  169. package/dist/executable/prepare.js +87 -10
  170. package/dist/executable/prepare.js.map +1 -1
  171. package/dist/frontend/analysis.js +3 -2
  172. package/dist/frontend/analysis.js.map +1 -1
  173. package/dist/frontend/canon-map.js +13 -8
  174. package/dist/frontend/canon-map.js.map +1 -1
  175. package/dist/frontend/decl-projection.d.ts +18 -0
  176. package/dist/frontend/decl-projection.js +90 -22
  177. package/dist/frontend/decl-projection.js.map +1 -1
  178. package/dist/frontend/decl-projection.test.js +47 -1
  179. package/dist/frontend/decl-projection.test.js.map +1 -1
  180. package/dist/frontend/default-library.d.ts +10 -0
  181. package/dist/frontend/default-library.js +43 -0
  182. package/dist/frontend/default-library.js.map +1 -0
  183. package/dist/frontend/fork-target.js +54 -9
  184. package/dist/frontend/fork-target.js.map +1 -1
  185. package/dist/frontend/fork-target.test.js +82 -0
  186. package/dist/frontend/fork-target.test.js.map +1 -1
  187. package/dist/frontend/inferred-js-diagnostics.test.js +73 -0
  188. package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
  189. package/dist/frontend/lowering/abstract-equality.d.ts +2 -1
  190. package/dist/frontend/lowering/abstract-equality.js +7 -1
  191. package/dist/frontend/lowering/abstract-equality.js.map +1 -1
  192. package/dist/frontend/lowering/array-values.js +2 -2
  193. package/dist/frontend/lowering/array-values.js.map +1 -1
  194. package/dist/frontend/lowering/assertion-members.js +52 -2
  195. package/dist/frontend/lowering/assertion-members.js.map +1 -1
  196. package/dist/frontend/lowering/builtin-namespaces.d.ts +5 -0
  197. package/dist/frontend/lowering/builtin-namespaces.js +19 -12
  198. package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
  199. package/dist/frontend/lowering/builtins/callable-aliases.js +42 -6
  200. package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
  201. package/dist/frontend/lowering/builtins/child-process.d.ts +12 -11
  202. package/dist/frontend/lowering/builtins/child-process.js +235 -38
  203. package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
  204. package/dist/frontend/lowering/builtins/compression.d.ts +6 -1
  205. package/dist/frontend/lowering/builtins/compression.js +3 -3
  206. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  207. package/dist/frontend/lowering/builtins/constants.js +2 -2
  208. package/dist/frontend/lowering/builtins/constants.js.map +1 -1
  209. package/dist/frontend/lowering/builtins/crypto.d.ts +3 -1
  210. package/dist/frontend/lowering/builtins/crypto.js +9 -1
  211. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  212. package/dist/frontend/lowering/builtins/dates.js +26 -6
  213. package/dist/frontend/lowering/builtins/dates.js.map +1 -1
  214. package/dist/frontend/lowering/builtins/environment.d.ts +13 -1
  215. package/dist/frontend/lowering/builtins/environment.js +15 -4
  216. package/dist/frontend/lowering/builtins/environment.js.map +1 -1
  217. package/dist/frontend/lowering/builtins/module-bindings.d.ts +33 -0
  218. package/dist/frontend/lowering/builtins/module-bindings.js +213 -11
  219. package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
  220. package/dist/frontend/lowering/builtins/module-resolution.d.ts +9 -2
  221. package/dist/frontend/lowering/builtins/module-resolution.js +187 -19
  222. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  223. package/dist/frontend/lowering/builtins/performance.js +1 -1
  224. package/dist/frontend/lowering/builtins/performance.js.map +1 -1
  225. package/dist/frontend/lowering/builtins/process.js +40 -2
  226. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  227. package/dist/frontend/lowering/builtins/promises.js +33 -0
  228. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  229. package/dist/frontend/lowering/builtins/readline.d.ts +9 -5
  230. package/dist/frontend/lowering/builtins/readline.js +184 -75
  231. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  232. package/dist/frontend/lowering/builtins/url.d.ts +4 -0
  233. package/dist/frontend/lowering/builtins/url.js +6 -0
  234. package/dist/frontend/lowering/builtins/url.js.map +1 -1
  235. package/dist/frontend/lowering/call-arguments.js +15 -0
  236. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  237. package/dist/frontend/lowering/callable-properties.d.ts +34 -0
  238. package/dist/frontend/lowering/callable-properties.js +210 -0
  239. package/dist/frontend/lowering/callable-properties.js.map +1 -0
  240. package/dist/frontend/lowering/cjs-inline-require.d.ts +16 -0
  241. package/dist/frontend/lowering/cjs-inline-require.js +105 -0
  242. package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
  243. package/dist/frontend/lowering/cjs-inline-require.test.d.ts +1 -0
  244. package/dist/frontend/lowering/cjs-inline-require.test.js +61 -0
  245. package/dist/frontend/lowering/cjs-inline-require.test.js.map +1 -0
  246. package/dist/frontend/lowering/class-dynamic-dispatch.js +82 -2
  247. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  248. package/dist/frontend/lowering/class-protocols.d.ts +57 -4
  249. package/dist/frontend/lowering/class-protocols.js +597 -30
  250. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  251. package/dist/frontend/lowering/class-unions.js +2 -2
  252. package/dist/frontend/lowering/class-unions.js.map +1 -1
  253. package/dist/frontend/lowering/coercions/function-adapters.d.ts +12 -0
  254. package/dist/frontend/lowering/coercions/function-adapters.js +62 -0
  255. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  256. package/dist/frontend/lowering/coercions/structural-plans.js +56 -1
  257. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  258. package/dist/frontend/lowering/coercions/structural.js +9 -4
  259. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  260. package/dist/frontend/lowering/collection-ingestion.d.ts +9 -0
  261. package/dist/frontend/lowering/collection-ingestion.js +115 -41
  262. package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
  263. package/dist/frontend/lowering/containers/array-callbacks.js +16 -0
  264. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  265. package/dist/frontend/lowering/containers/bytes.js +66 -10
  266. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  267. package/dist/frontend/lowering/containers/collection-methods.js +61 -5
  268. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  269. package/dist/frontend/lowering/containers/filter-predicates.js +11 -0
  270. package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
  271. package/dist/frontend/lowering/containers/indexed-objects.d.ts +15 -0
  272. package/dist/frontend/lowering/containers/indexed-objects.js +213 -30
  273. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  274. package/dist/frontend/lowering/error-name-order.d.ts +16 -0
  275. package/dist/frontend/lowering/error-name-order.js +61 -0
  276. package/dist/frontend/lowering/error-name-order.js.map +1 -1
  277. package/dist/frontend/lowering/expressions/asserted-receiver.d.ts +17 -0
  278. package/dist/frontend/lowering/expressions/asserted-receiver.js +123 -1
  279. package/dist/frontend/lowering/expressions/asserted-receiver.js.map +1 -1
  280. package/dist/frontend/lowering/expressions/binary.js +147 -20
  281. package/dist/frontend/lowering/expressions/binary.js.map +1 -1
  282. package/dist/frontend/lowering/expressions/element-access.js +63 -14
  283. package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
  284. package/dist/frontend/lowering/expressions/erased-delete.d.ts +59 -0
  285. package/dist/frontend/lowering/expressions/erased-delete.js +247 -0
  286. package/dist/frontend/lowering/expressions/erased-delete.js.map +1 -0
  287. package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +10 -0
  288. package/dist/frontend/lowering/expressions/hosted-narrowing.js +48 -1
  289. package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
  290. package/dist/frontend/lowering/expressions/identifiers.js +20 -0
  291. package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
  292. package/dist/frontend/lowering/expressions/narrowing.d.ts +7 -2
  293. package/dist/frontend/lowering/expressions/narrowing.js +77 -45
  294. package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
  295. package/dist/frontend/lowering/expressions/object-literals.js +62 -19
  296. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  297. package/dist/frontend/lowering/expressions/optional-chains.js +19 -0
  298. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  299. package/dist/frontend/lowering/expressions/property-access.d.ts +7 -7
  300. package/dist/frontend/lowering/expressions/property-access.js +247 -48
  301. package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
  302. package/dist/frontend/lowering/expressions/relational.d.ts +1 -0
  303. package/dist/frontend/lowering/expressions/relational.js +18 -8
  304. package/dist/frontend/lowering/expressions/relational.js.map +1 -1
  305. package/dist/frontend/lowering/expressions/union-fields.js +11 -5
  306. package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
  307. package/dist/frontend/lowering/expressions/updates.js +121 -11
  308. package/dist/frontend/lowering/expressions/updates.js.map +1 -1
  309. package/dist/frontend/lowering/function-context.d.ts +10 -0
  310. package/dist/frontend/lowering/function-context.js +36 -0
  311. package/dist/frontend/lowering/function-context.js.map +1 -1
  312. package/dist/frontend/lowering/function-returns.js +8 -8
  313. package/dist/frontend/lowering/function-returns.js.map +1 -1
  314. package/dist/frontend/lowering/handle-properties.d.ts +62 -3
  315. package/dist/frontend/lowering/handle-properties.js +674 -26
  316. package/dist/frontend/lowering/handle-properties.js.map +1 -1
  317. package/dist/frontend/lowering/handle-properties.test.js +95 -2
  318. package/dist/frontend/lowering/handle-properties.test.js.map +1 -1
  319. package/dist/frontend/lowering/lower-builtin-values.d.ts +12 -0
  320. package/dist/frontend/lowering/lower-builtin-values.js +44 -0
  321. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
  322. package/dist/frontend/lowering/lower-calls.js +328 -136
  323. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  324. package/dist/frontend/lowering/lower-classes.js +82 -17
  325. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  326. package/dist/frontend/lowering/lower-event-emitter.js +113 -9
  327. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  328. package/dist/frontend/lowering/lower-expando.d.ts +13 -21
  329. package/dist/frontend/lowering/lower-expando.js +90 -126
  330. package/dist/frontend/lowering/lower-expando.js.map +1 -1
  331. package/dist/frontend/lowering/lower-exprs.js +2 -2
  332. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  333. package/dist/frontend/lowering/lower-functions.js +65 -0
  334. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  335. package/dist/frontend/lowering/lower-inspect.js +471 -0
  336. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  337. package/dist/frontend/lowering/lower-modules.js +36 -10
  338. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  339. package/dist/frontend/lowering/lower-node-island.js +28 -0
  340. package/dist/frontend/lowering/lower-node-island.js.map +1 -1
  341. package/dist/frontend/lowering/lower-server.d.ts +53 -7
  342. package/dist/frontend/lowering/lower-server.js +213 -42
  343. package/dist/frontend/lowering/lower-server.js.map +1 -1
  344. package/dist/frontend/lowering/lower-stdlib.js +50 -7
  345. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  346. package/dist/frontend/lowering/lower-stmts.d.ts +24 -0
  347. package/dist/frontend/lowering/lower-stmts.js +463 -220
  348. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  349. package/dist/frontend/lowering/lower-stream.js +2 -2
  350. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  351. package/dist/frontend/lowering/lower-test.js +71 -2
  352. package/dist/frontend/lowering/lower-test.js.map +1 -1
  353. package/dist/frontend/lowering/lowerer.d.ts +81 -10
  354. package/dist/frontend/lowering/lowerer.js +319 -72
  355. package/dist/frontend/lowering/lowerer.js.map +1 -1
  356. package/dist/frontend/lowering/new-target.js +10 -2
  357. package/dist/frontend/lowering/new-target.js.map +1 -1
  358. package/dist/frontend/lowering/nullish-empty-pattern.js +3 -3
  359. package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -1
  360. package/dist/frontend/lowering/partial-assertions.js +30 -5
  361. package/dist/frontend/lowering/partial-assertions.js.map +1 -1
  362. package/dist/frontend/lowering/primitive-throws.js +91 -1
  363. package/dist/frontend/lowering/primitive-throws.js.map +1 -1
  364. package/dist/frontend/lowering/primitive-wrappers.d.ts +9 -0
  365. package/dist/frontend/lowering/primitive-wrappers.js +2 -2
  366. package/dist/frontend/lowering/primitive-wrappers.js.map +1 -1
  367. package/dist/frontend/lowering/promise-executor-adapter.js +5 -2
  368. package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -1
  369. package/dist/frontend/lowering/record-links.js +7 -2
  370. package/dist/frontend/lowering/record-links.js.map +1 -1
  371. package/dist/frontend/lowering/surfaces.d.ts +4 -0
  372. package/dist/frontend/lowering/surfaces.js +118 -2
  373. package/dist/frontend/lowering/surfaces.js.map +1 -1
  374. package/dist/frontend/lowering/surfaces.test.d.ts +1 -0
  375. package/dist/frontend/lowering/surfaces.test.js +31 -0
  376. package/dist/frontend/lowering/surfaces.test.js.map +1 -0
  377. package/dist/frontend/mock-shapes.js +3 -3
  378. package/dist/frontend/mock-shapes.js.map +1 -1
  379. package/dist/frontend/npm-static-ladder.d.ts +21 -0
  380. package/dist/frontend/npm-static-ladder.js +2 -0
  381. package/dist/frontend/npm-static-ladder.js.map +1 -0
  382. package/dist/frontend/npm-static-ladder.test.d.ts +1 -0
  383. package/dist/frontend/npm-static-ladder.test.js +138 -0
  384. package/dist/frontend/npm-static-ladder.test.js.map +1 -0
  385. package/dist/frontend/npm-static-status.d.ts +15 -0
  386. package/dist/frontend/npm-static-status.js +2 -0
  387. package/dist/frontend/npm-static-status.js.map +1 -0
  388. package/dist/frontend/package-shims.js +1 -1
  389. package/dist/frontend/package-shims.js.map +1 -1
  390. package/dist/frontend/pipeline.d.ts +1 -1
  391. package/dist/frontend/pipeline.js +222 -25
  392. package/dist/frontend/pipeline.js.map +1 -1
  393. package/dist/frontend/program-analysis.d.ts +4 -0
  394. package/dist/frontend/program-analysis.js +6 -0
  395. package/dist/frontend/program-analysis.js.map +1 -1
  396. package/dist/frontend/program.js +258 -32
  397. package/dist/frontend/program.js.map +1 -1
  398. package/dist/frontend/program.test.js +30 -0
  399. package/dist/frontend/program.test.js.map +1 -1
  400. package/dist/frontend/resolve.js +29 -5
  401. package/dist/frontend/resolve.js.map +1 -1
  402. package/dist/frontend/resolve.test.js +40 -0
  403. package/dist/frontend/resolve.test.js.map +1 -1
  404. package/dist/frontend/services.d.ts +8 -0
  405. package/dist/frontend/services.js +7 -0
  406. package/dist/frontend/services.js.map +1 -1
  407. package/dist/frontend/ts7/checker.d.ts +7 -0
  408. package/dist/frontend/ts7/checker.js +12 -0
  409. package/dist/frontend/ts7/checker.js.map +1 -1
  410. package/dist/frontend/ts7/checker.test.js +1 -0
  411. package/dist/frontend/ts7/checker.test.js.map +1 -1
  412. package/dist/frontend/ts7/program-host.d.ts +39 -2
  413. package/dist/frontend/ts7/program-host.js +62 -8
  414. package/dist/frontend/ts7/program-host.js.map +1 -1
  415. package/dist/frontend/ts7/program-host.test.js +33 -0
  416. package/dist/frontend/ts7/program-host.test.js.map +1 -1
  417. package/dist/frontend/ts7/session-cache.d.ts +5 -1
  418. package/dist/frontend/ts7/session-cache.js +7 -1
  419. package/dist/frontend/ts7/session-cache.js.map +1 -1
  420. package/dist/frontend/ts7/session-cache.test.js +37 -0
  421. package/dist/frontend/ts7/session-cache.test.js.map +1 -1
  422. package/dist/frontend/ts7/session.js +19 -1
  423. package/dist/frontend/ts7/session.js.map +1 -1
  424. package/dist/frontend/ts7/source-parser.d.ts +17 -2
  425. package/dist/frontend/ts7/source-parser.js +61 -2
  426. package/dist/frontend/ts7/source-parser.js.map +1 -1
  427. package/dist/frontend/ts7/source-parser.test.js +55 -2
  428. package/dist/frontend/ts7/source-parser.test.js.map +1 -1
  429. package/dist/frontend/tsc-codes.d.ts +3 -2
  430. package/dist/frontend/tsc-codes.js +129 -22
  431. package/dist/frontend/tsc-codes.js.map +1 -1
  432. package/dist/frontend/type-mapper.d.ts +5 -11
  433. package/dist/frontend/type-mapper.js +380 -70
  434. package/dist/frontend/type-mapper.js.map +1 -1
  435. package/dist/index.d.ts +1 -1
  436. package/dist/index.js +67 -7
  437. package/dist/index.js.map +1 -1
  438. package/dist/ir/builtin-effects.js +29 -0
  439. package/dist/ir/builtin-effects.js.map +1 -1
  440. package/dist/ir/builtin-signatures.d.ts +1 -1
  441. package/dist/ir/builtin-signatures.js +72 -6
  442. package/dist/ir/builtin-signatures.js.map +1 -1
  443. package/dist/ir/codec.generated.d.ts +1 -1
  444. package/dist/ir/codec.generated.js +321 -263
  445. package/dist/ir/codec.generated.js.map +1 -1
  446. package/dist/ir/constant-length-clones.d.ts +26 -0
  447. package/dist/ir/constant-length-clones.js +589 -0
  448. package/dist/ir/constant-length-clones.js.map +1 -0
  449. package/dist/ir/constant-length-clones.test.d.ts +1 -0
  450. package/dist/ir/constant-length-clones.test.js +292 -0
  451. package/dist/ir/constant-length-clones.test.js.map +1 -0
  452. package/dist/ir/constant-tables.d.ts +10 -5
  453. package/dist/ir/constant-tables.js +83 -17
  454. package/dist/ir/constant-tables.js.map +1 -1
  455. package/dist/ir/constant-tables.test.js +58 -1
  456. package/dist/ir/constant-tables.test.js.map +1 -1
  457. package/dist/ir/fields.generated.js +5 -2
  458. package/dist/ir/fields.generated.js.map +1 -1
  459. package/dist/ir/function-references.js +2 -0
  460. package/dist/ir/function-references.js.map +1 -1
  461. package/dist/ir/function-references.test.js +13 -0
  462. package/dist/ir/function-references.test.js.map +1 -1
  463. package/dist/ir/integer-loops.js +1 -0
  464. package/dist/ir/integer-loops.js.map +1 -1
  465. package/dist/ir/integer-loops.test.js +16 -0
  466. package/dist/ir/integer-loops.test.js.map +1 -1
  467. package/dist/ir/ir.d.ts +50 -6
  468. package/dist/ir/ir.js +44 -2
  469. package/dist/ir/ir.js.map +1 -1
  470. package/dist/ir/ir.test.js +83 -1
  471. package/dist/ir/ir.test.js.map +1 -1
  472. package/dist/ir/js-groups.js +5 -1
  473. package/dist/ir/js-groups.js.map +1 -1
  474. package/dist/ir/js-ic.d.ts +20 -0
  475. package/dist/ir/js-ic.js +81 -4
  476. package/dist/ir/js-ic.js.map +1 -1
  477. package/dist/ir/js-ic.test.js +8 -1
  478. package/dist/ir/js-ic.test.js.map +1 -1
  479. package/dist/ir/lane-plans.d.ts +86 -0
  480. package/dist/ir/lane-plans.js +589 -0
  481. package/dist/ir/lane-plans.js.map +1 -0
  482. package/dist/ir/lane-plans.test.d.ts +1 -0
  483. package/dist/ir/lane-plans.test.js +549 -0
  484. package/dist/ir/lane-plans.test.js.map +1 -0
  485. package/dist/ir/runtime-features.d.ts +68 -10
  486. package/dist/ir/runtime-features.js +285 -17
  487. package/dist/ir/runtime-features.js.map +1 -1
  488. package/dist/ir/runtime-features.test.js +190 -1
  489. package/dist/ir/runtime-features.test.js.map +1 -1
  490. package/dist/ir/validate.js +61 -24
  491. package/dist/ir/validate.js.map +1 -1
  492. package/dist/native/cache.d.ts +5 -0
  493. package/dist/native/cache.js +23 -1
  494. package/dist/native/cache.js.map +1 -1
  495. package/dist/native/cache.test.js +29 -1
  496. package/dist/native/cache.test.js.map +1 -1
  497. package/dist/native/cli.js +4 -2
  498. package/dist/native/cli.js.map +1 -1
  499. package/dist/native/compiler.d.ts +11 -3
  500. package/dist/native/compiler.js +102 -16
  501. package/dist/native/compiler.js.map +1 -1
  502. package/dist/native/compiler.test.js +244 -2
  503. package/dist/native/compiler.test.js.map +1 -1
  504. package/dist/native/prepare.d.ts +14 -1
  505. package/dist/native/prepare.js +79 -29
  506. package/dist/native/prepare.js.map +1 -1
  507. package/dist/native/sanitizer.test.js +3 -0
  508. package/dist/native/sanitizer.test.js.map +1 -1
  509. package/dist/native/unchanged.d.ts +80 -0
  510. package/dist/native/unchanged.js +301 -0
  511. package/dist/native/unchanged.js.map +1 -0
  512. package/dist/native/unchanged.test.d.ts +1 -0
  513. package/dist/native/unchanged.test.js +249 -0
  514. package/dist/native/unchanged.test.js.map +1 -0
  515. package/dist/node-islands/boundary.d.ts +16 -0
  516. package/dist/node-islands/boundary.js +70 -7
  517. package/dist/node-islands/boundary.js.map +1 -1
  518. package/dist/node-islands/boundary.test.js +59 -14
  519. package/dist/node-islands/boundary.test.js.map +1 -1
  520. package/dist/node-islands/detect.js +203 -47
  521. package/dist/node-islands/detect.js.map +1 -1
  522. package/dist/node-islands/detect.test.js +45 -0
  523. package/dist/node-islands/detect.test.js.map +1 -1
  524. package/dist/node-islands/growth.js +4 -16
  525. package/dist/node-islands/growth.js.map +1 -1
  526. package/dist/node-islands/modules.d.ts +3 -0
  527. package/dist/node-islands/modules.js +143 -12
  528. package/dist/node-islands/modules.js.map +1 -1
  529. package/dist/node-islands/modules.test.js +125 -0
  530. package/dist/node-islands/modules.test.js.map +1 -1
  531. package/dist/node-islands/report.d.ts +1 -1
  532. package/dist/node-islands/report.js +2 -1
  533. package/dist/node-islands/report.js.map +1 -1
  534. package/package.json +20 -20
  535. package/shims/undici/core/request.ts +7 -1
  536. package/surface-manifest.json +380 -2
package/dist/cli/usage.js CHANGED
@@ -1,189 +1,6 @@
1
- export const USAGE = `scriptc — TypeScript/JavaScript to native and WebAssembly executables (experimental)
2
-
3
- Usage:
4
- scriptc build <file.ts|.js> [options] compile to an executable or source artifact
5
- scriptc run <file.ts|.js> [options] compile and run
6
- scriptc coverage <file.ts|.js> how much compiles statically, and why not
7
- scriptc coverage <file.ts|.js> --external-types <specifier=file.d.ts>
8
- type-resolve an embedder-provided module for analysis
9
- scriptc build --lib --profile <p.json> library mode: compile the profile's entry
10
- module to a linkable static archive
11
- (<name>.lib.a), or a Wasm reactor
12
- (<name>.wasm) on wasm32-wasi,
13
- exporting the profile symbols; a profile
14
- with a sidecar section also gets the
15
- contract sidecar JSON beside the archive
16
- scriptc types patch <package> <selector> <type> [--range <r>] [--dry-run]
17
- fix a wrong declaration of an installed
18
- package: shows what the selector
19
- matches and adds the type patch to
20
- package.json ("| undefined" widens)
21
- scriptc types list the project's type patches and what
22
- they match
23
- scriptc cache warm [runtime|tls…] verify and load precompiled runtime families
24
- for the current compiler/SDK/target
25
- scriptc merge-profiles -o <out.profdata> [--sparse] <profile…>
26
- merge the raw profiles that
27
- --profile-generate runs wrote (or
28
- earlier merged profiles) into one
29
- profile for --profile-use;
30
- --sparse leaves out functions
31
- that never ran (a smaller file)
32
-
33
- Options:
34
- -o, --out <path> primary output path (default: .scriptc/<name><suffix>)
35
- --emit <kind> primary output: ir, llvm, asm, obj, or exe
36
- (default: exe). asm/obj use the matching platform helper
37
- --print <kind> print machine-readable metadata instead of the output path
38
- (native-link-info implies --emit=obj and never links;
39
- diagnostics prints the versioned JSON diagnostics
40
- envelope for build and coverage)
41
- --fail-on <blockers|divergences|dynamic|dynamic-slots|node-islands|eager-node-islands|island-gaps>
42
- coverage only: exit 1 when the entry path has blockers
43
- (a build would fail), or also when it has Node
44
- divergences, likely-hot functions that use untyped
45
- values (SC6101), dynamic slots (SC6104), any Node
46
- island (eager-node-islands is the same until deferred
47
- evaluation lands), or a gap island (a package scriptc
48
- should compile but cannot yet)
49
- --backend <b> code generator (llvm)
50
- --optimization <release|dev|speed>
51
- native optimization posture (default: release/-O2). dev
52
- uses -O0, source breakpoints, and cached LLVM object shards;
53
- macOS executable builds also produce an adjacent .dSYM.
54
- speed trades larger executables and longer builds for
55
- faster programs (runtime inlining, inline reference
56
- counting, cache-line-aligned runtime code on x86-64)
57
- --strip remove symbol/debug payload from the linked executable
58
- for smaller builds (opt in; --emit=exe only)
59
- --static Linux: link the C library into the executable, which
60
- then starts without the dynamic loader. glibc builds
61
- need its static libraries (libc.a) on the build host
62
- and refuse executables that include host, user or
63
- group name lookups (opt in; --emit=exe only)
64
- --windows-subsystem <console|gui>
65
- Windows executable subsystem (default: console). gui
66
- prevents Windows from opening a console window
67
- --detached-exit
68
- Linux: after process.exit, free the program's memory in
69
- a helper process so the parent sees the exit sooner. The
70
- helper keeps the executable mapped and its memory charged
71
- for up to ~100 ms after exit (opt in; --emit=exe only)
72
- --libnode <dir|beside>
73
- the libnode pack that calls into Node.js (@scriptc/node)
74
- load at run time, or beside to copy it next to the
75
- executable (default: SCRIPTC_LIBNODE at build time;
76
- SCRIPTC_LIBNODE overrides it at run time)
77
- --large-pages Linux: at startup, move the executable's code onto 2 MiB
78
- transparent huge pages when the system allows them, for
79
- large programs. Takes about 3 ms per 10 MiB of code, and
80
- all of the moved code stays resident (opt in; --emit=exe
81
- only)
82
- --exceptions <common|rare>
83
- Linux: how often the program throws (default: common).
84
- rare lets recursive functions and functions near a
85
- throw propagate exceptions by unwinding: their calls
86
- need no exception check, and a throw that crosses them
87
- costs a native unwind of several microseconds
88
- --target-cpu <baseline|x86-64-v2|x86-64-v3|x86-64-v4|native>
89
- x86-64: compile the program's code for a CPU level
90
- (default: baseline, which runs on any x86-64 CPU). The
91
- executable then requires that level: v3 adds AVX2, BMI2
92
- and FMA, v4 adds AVX-512. native uses the build host's
93
- level. The runtime keeps its baseline code
94
- --cpu-dispatch x86-64: also compile the program's code for x86-64-v3
95
- (AVX2), and run that copy on CPUs that support it. The
96
- executable still runs on any x86-64 CPU. Not used with
97
- --target-cpu above baseline. The SCRIPTC_CPU_LEVEL
98
- environment variable (0 to 4, or a level name) caps the
99
- level at run time (opt in; --emit=exe only)
100
- --profile-generate <pattern>
101
- Linux: instrument the executable for profile-guided
102
- optimization. Each run writes a raw profile to the
103
- pattern (%p expands to the process id; the
104
- LLVM_PROFILE_FILE environment variable overrides it).
105
- Instrumented programs run slower (--emit=exe only)
106
- --profile-use <file.profdata>
107
- optimize with a merged profile (scriptc merge-profiles):
108
- code is laid out, inlined and split by how the profiled
109
- runs used it. Code the profile does not describe, or
110
- describes from an older version of the program, is
111
- optimized as without one, unless a .blocks file beside
112
- the profile describes it. build prints how the profile
113
- matched on stderr, and warns when more than 10% of the
114
- functions it describes changed (release or speed;
115
- --emit=exe only)
116
- --keep-llvm keep generated LLVM IR beside the executable (default)
117
- --no-keep-llvm delete generated LLVM IR after compiling
118
- --emit-ir also write IR beside an executable or library archive;
119
- deprecated for executables: use --emit=ir for primary IR
120
- --sanitize build with ASan + runtime RC audit
121
- --ffi <file> bind signature-only TypeScript declarations to native
122
- C symbols and link the manifest's archives/libraries
123
- --npm-static <pkg[,pkg…]|auto>
124
- compile the named npm packages' shipped JS statically as
125
- program modules (repeatable; "auto" opts in every eligible
126
- direct import: own .d.ts, no build-transform markers;
127
- "pkg..." also names every package pkg depends on).
128
- Packages that fail preflight are refused with a
129
- diagnostic. Eligible dependencies compile automatically.
130
- --no-shape-overlay
131
- compile npm packages' JavaScript without the types shape
132
- inference proves (per package: "scriptc": {"packages":
133
- {"<name>": {"shapes": false}}} in package.json)
134
- --provenance-sources
135
- EXPERIMENTAL: compile npm dependencies from their
136
- provenance-attested SOURCE (fetched at the attested
137
- commit) as static program modules; packages without a
138
- usable attestation use their published source
139
- --external-types <specifier=file.d.ts>
140
- coverage only: map an exact bare module specifier to a
141
- local declaration file. The declaration supplies types
142
- for analysis; the host module remains an explicit
143
- external-boundary blocker (repeatable)
144
- --tier <auto|static-only>
145
- tier policy (default: auto). static-only keeps every
146
- construct without a static lowering a compile error, so
147
- the program has no dynamic-tier demotions. Both modes
148
- currently compile identically
149
- --explain-dynamic[=<name>]
150
- coverage only: list the functions that operate on dynamic
151
- values and the bindings, fields, functions, classes and
152
- modules the dynamic tier would take over, with the
153
- refusal behind each; a name shows only that unit's chain
154
- --no-dynamic-tier-warning
155
- build and coverage: leave out SC6101, the warning that
156
- names likely-hot functions that use untyped values
157
- --node-islands <auto|explicit|off>
158
- Node island policy (default: auto): npm packages outside
159
- the native subset run in Node automatically; explicit
160
- allows only marked islands; off allows none. REPORT-ONLY
161
- in this version: coverage reports the islands a build
162
- would choose; builds compile as before
163
- --node-island <pkg-or-path>
164
- mark an npm package or one of your modules (a path or
165
- glob) to run in a Node island (repeatable, comma lists;
166
- report-only)
167
- --native <pkg> require an npm package to compile natively; outside the
168
- native subset it is SC8003 (repeatable; report-only)
169
- --node <path> the node executable Node islands use (report-only)
170
- --explain-island <pkg>
171
- coverage only: why a package would run in a Node island,
172
- with the first reason per module, the native import
173
- sites and the packages inside its closure
174
- --strict-user-js
175
- coverage only: report constructor functions, prototype
176
- and shape mutation, sloppy-mode semantics and builtin
177
- patching in your own .js/.cjs/.mjs modules as
178
- SC8101–SC8105 blockers
179
- --wasm <file.wasm>
180
- coverage only: report a WebAssembly module the program
181
- loads whose path its sources do not spell (repeatable;
182
- modules the sources name, inline modules and packaged
183
- .wasm files are found without it)
184
- -h, --help show this help
185
- -v, --version print the version
186
- `;
1
+ /** The scriptc command line's commands and options. `CLI_OPTIONS` configures the argument
2
+ * parser, `CLI_OPTION_DOCS` and `CLI_COMMANDS` describe every option and command, and the help
3
+ * text and the MCP tools are both generated from these tables. */
187
4
  export const CLI_OPTIONS = {
188
5
  out: { type: "string", short: "o" },
189
6
  emit: { type: "string" },
@@ -195,6 +12,7 @@ export const CLI_OPTIONS = {
195
12
  static: { type: "boolean", default: false },
196
13
  "windows-subsystem": { type: "string" },
197
14
  "detached-exit": { type: "boolean", default: false },
15
+ "stdout-buffering": { type: "boolean", default: false },
198
16
  libnode: { type: "string" },
199
17
  "large-pages": { type: "boolean", default: false },
200
18
  exceptions: { type: "string" },
@@ -228,4 +46,709 @@ export const CLI_OPTIONS = {
228
46
  help: { type: "boolean", short: "h", default: false },
229
47
  version: { type: "boolean", short: "v", default: false },
230
48
  };
49
+ /** Every option's documentation, in the order the Options section lists them; `satisfies`
50
+ * makes the compiler require one entry per option. */
51
+ export const CLI_OPTION_DOCS = {
52
+ out: {
53
+ entries: [
54
+ {
55
+ term: "-o, --out <path>",
56
+ help: ["primary output path (default: .scriptc/<name><suffix>)"],
57
+ },
58
+ ],
59
+ },
60
+ emit: {
61
+ entries: [
62
+ {
63
+ term: "--emit <kind>",
64
+ help: [
65
+ "primary output: ir, llvm, asm, obj, or exe",
66
+ "(default: exe). asm/obj use the matching platform helper",
67
+ ],
68
+ },
69
+ ],
70
+ },
71
+ print: {
72
+ entries: [
73
+ {
74
+ term: "--print <kind>",
75
+ help: [
76
+ "print machine-readable metadata instead of the output path",
77
+ "(native-link-info implies --emit=obj and never links;",
78
+ "diagnostics prints the versioned JSON diagnostics",
79
+ "envelope for build and coverage)",
80
+ ],
81
+ },
82
+ ],
83
+ },
84
+ "fail-on": {
85
+ entries: [
86
+ {
87
+ term: "--fail-on <blockers|divergences|dynamic|dynamic-slots|node-islands|eager-node-islands|island-gaps>",
88
+ help: [
89
+ "coverage only: exit 1 when the entry path has blockers",
90
+ "(a build would fail), or also when it has Node",
91
+ "divergences, likely-hot functions that use untyped",
92
+ "values (SC6101), dynamic slots (SC6104), any Node",
93
+ "island (eager-node-islands is the same until deferred",
94
+ "evaluation lands), or a gap island (a package scriptc",
95
+ "should compile but cannot yet)",
96
+ ],
97
+ },
98
+ ],
99
+ },
100
+ backend: { entries: [{ term: "--backend <b>", help: ["code generator (llvm)"] }] },
101
+ optimization: {
102
+ entries: [
103
+ {
104
+ term: "--optimization <release|dev|speed>",
105
+ help: [
106
+ "native optimization posture (default: release/-O2). dev",
107
+ "uses -O0, source breakpoints, and cached LLVM object shards;",
108
+ "macOS executable builds also produce an adjacent .dSYM.",
109
+ "speed trades larger executables and longer builds for",
110
+ "faster programs (runtime inlining, inline reference",
111
+ "counting, cache-line-aligned runtime code on x86-64)",
112
+ ],
113
+ },
114
+ ],
115
+ },
116
+ strip: {
117
+ entries: [
118
+ {
119
+ term: "--strip",
120
+ help: [
121
+ "remove symbol/debug payload from the linked executable",
122
+ "for smaller builds (opt in; --emit=exe only)",
123
+ ],
124
+ },
125
+ ],
126
+ },
127
+ static: {
128
+ entries: [
129
+ {
130
+ term: "--static",
131
+ help: [
132
+ "Linux: link the C library into the executable, which",
133
+ "then starts without the dynamic loader. glibc builds",
134
+ "need its static libraries (libc.a) on the build host",
135
+ "and refuse executables that include host, user or",
136
+ "group name lookups (opt in; --emit=exe only)",
137
+ ],
138
+ },
139
+ ],
140
+ },
141
+ "windows-subsystem": {
142
+ entries: [
143
+ {
144
+ term: "--windows-subsystem <console|gui>",
145
+ help: [
146
+ "Windows executable subsystem (default: console). gui",
147
+ "prevents Windows from opening a console window",
148
+ ],
149
+ },
150
+ ],
151
+ },
152
+ "detached-exit": {
153
+ entries: [
154
+ {
155
+ term: "--detached-exit",
156
+ help: [
157
+ "Linux: after process.exit, free the program's memory in",
158
+ "a helper process so the parent sees the exit sooner. The",
159
+ "helper keeps the executable mapped and its memory charged",
160
+ "for up to ~100 ms after exit (opt in; --emit=exe only)",
161
+ ],
162
+ },
163
+ ],
164
+ },
165
+ "stdout-buffering": {
166
+ entries: [
167
+ {
168
+ term: "--stdout-buffering",
169
+ help: [
170
+ "keep console and process stdout bytes in a 64 KiB buffer",
171
+ "when stdout is not a terminal, for programs that print",
172
+ "many lines. A terminal keeps one write per call. The",
173
+ "buffer settles when it fills, before stderr, when the",
174
+ "event loop sleeps, before a blocking stdin read, on",
175
+ "process.kill and process.exit, and at exit; a crash such",
176
+ "as SIGKILL can lose up to 64 KiB (experimental; opt in;",
177
+ "--emit=exe only)",
178
+ ],
179
+ },
180
+ ],
181
+ },
182
+ libnode: {
183
+ entries: [
184
+ {
185
+ term: "--libnode <dir|beside>",
186
+ help: [
187
+ "the libnode pack that calls into Node.js (@scriptc/node)",
188
+ "load at run time, or beside to copy it next to the",
189
+ "executable (default: SCRIPTC_LIBNODE at build time;",
190
+ "SCRIPTC_LIBNODE overrides it at run time)",
191
+ ],
192
+ },
193
+ ],
194
+ },
195
+ "large-pages": {
196
+ entries: [
197
+ {
198
+ term: "--large-pages",
199
+ help: [
200
+ "Linux: at startup, move the executable's code onto 2 MiB",
201
+ "transparent huge pages when the system allows them, for",
202
+ "large programs. Takes about 3 ms per 10 MiB of code, and",
203
+ "all of the moved code stays resident (opt in; --emit=exe",
204
+ "only)",
205
+ ],
206
+ },
207
+ ],
208
+ },
209
+ exceptions: {
210
+ entries: [
211
+ {
212
+ term: "--exceptions <common|rare>",
213
+ help: [
214
+ "Linux: how often the program throws (default: common).",
215
+ "rare lets recursive functions and functions near a",
216
+ "throw propagate exceptions by unwinding: their calls",
217
+ "need no exception check, and a throw that crosses them",
218
+ "costs a native unwind of several microseconds",
219
+ ],
220
+ },
221
+ ],
222
+ },
223
+ "target-cpu": {
224
+ entries: [
225
+ {
226
+ term: "--target-cpu <baseline|x86-64-v2|x86-64-v3|x86-64-v4|native>",
227
+ help: [
228
+ "x86-64: compile the program's code for a CPU level",
229
+ "(default: baseline, which runs on any x86-64 CPU). The",
230
+ "executable then requires that level: v3 adds AVX2, BMI2",
231
+ "and FMA, v4 adds AVX-512. native uses the build host's",
232
+ "level. The runtime keeps its baseline code",
233
+ ],
234
+ },
235
+ ],
236
+ },
237
+ "cpu-dispatch": {
238
+ entries: [
239
+ {
240
+ term: "--cpu-dispatch",
241
+ help: [
242
+ "x86-64: also compile the program's code for x86-64-v3",
243
+ "(AVX2), and run that copy on CPUs that support it. The",
244
+ "executable still runs on any x86-64 CPU. Not used with",
245
+ "--target-cpu above baseline. The SCRIPTC_CPU_LEVEL",
246
+ "environment variable (0 to 4, or a level name) caps the",
247
+ "level at run time (opt in; --emit=exe only)",
248
+ ],
249
+ },
250
+ ],
251
+ },
252
+ "profile-generate": {
253
+ entries: [
254
+ {
255
+ term: "--profile-generate <pattern>",
256
+ help: [
257
+ "Linux: instrument the executable for profile-guided",
258
+ "optimization. Each run writes a raw profile to the",
259
+ "pattern (%p expands to the process id; the",
260
+ "LLVM_PROFILE_FILE environment variable overrides it).",
261
+ "Instrumented programs run slower (--emit=exe only)",
262
+ ],
263
+ },
264
+ ],
265
+ },
266
+ "profile-use": {
267
+ entries: [
268
+ {
269
+ term: "--profile-use <file.profdata>",
270
+ help: [
271
+ "optimize with a merged profile (scriptc merge-profiles):",
272
+ "code is laid out, inlined and split by how the profiled",
273
+ "runs used it. Code the profile does not describe, or",
274
+ "describes from an older version of the program, is",
275
+ "optimized as without one, unless a .blocks file beside",
276
+ "the profile describes it. build prints how the profile",
277
+ "matched on stderr, and warns when more than 10% of the",
278
+ "functions it describes changed (release or speed;",
279
+ "--emit=exe only)",
280
+ ],
281
+ },
282
+ ],
283
+ },
284
+ "keep-llvm": {
285
+ entries: [
286
+ { term: "--keep-llvm", help: ["keep generated LLVM IR beside the executable (default)"] },
287
+ { term: "--no-keep-llvm", help: ["delete generated LLVM IR after compiling"] },
288
+ ],
289
+ },
290
+ "emit-ir": {
291
+ entries: [
292
+ {
293
+ term: "--emit-ir",
294
+ help: [
295
+ "also write IR beside an executable or library archive;",
296
+ "deprecated for executables: use --emit=ir for primary IR",
297
+ ],
298
+ },
299
+ ],
300
+ },
301
+ sanitize: { entries: [{ term: "--sanitize", help: ["build with ASan + runtime RC audit"] }] },
302
+ ffi: {
303
+ entries: [
304
+ {
305
+ term: "--ffi <file>",
306
+ help: [
307
+ "bind signature-only TypeScript declarations to native",
308
+ "C symbols and link the manifest's archives/libraries",
309
+ ],
310
+ },
311
+ ],
312
+ },
313
+ "npm-static": {
314
+ entries: [
315
+ {
316
+ term: "--npm-static <pkg[,pkg…]|auto>",
317
+ help: [
318
+ "compile the named npm packages' shipped JS statically as",
319
+ 'program modules (repeatable; "auto" opts in every eligible',
320
+ "direct import: own .d.ts, no build-transform markers;",
321
+ '"pkg..." also names every package pkg depends on).',
322
+ "Packages that fail preflight are refused with a",
323
+ "diagnostic. Eligible dependencies compile automatically.",
324
+ ],
325
+ },
326
+ ],
327
+ },
328
+ "shape-overlay": {
329
+ entries: [
330
+ {
331
+ term: "--no-shape-overlay",
332
+ help: [
333
+ "compile npm packages' JavaScript without the types shape",
334
+ 'inference proves (per package: "scriptc": {"packages":',
335
+ '{"<name>": {"shapes": false}}} in package.json)',
336
+ ],
337
+ },
338
+ ],
339
+ },
340
+ "provenance-sources": {
341
+ entries: [
342
+ {
343
+ term: "--provenance-sources",
344
+ help: [
345
+ "EXPERIMENTAL: compile npm dependencies from their",
346
+ "provenance-attested SOURCE (fetched at the attested",
347
+ "commit) as static program modules; packages without a",
348
+ "usable attestation use their published source",
349
+ ],
350
+ },
351
+ ],
352
+ },
353
+ "external-types": {
354
+ entries: [
355
+ {
356
+ term: "--external-types <specifier=file.d.ts>",
357
+ help: [
358
+ "coverage only: map an exact bare module specifier to a",
359
+ "local declaration file. The declaration supplies types",
360
+ "for analysis; the host module remains an explicit",
361
+ "external-boundary blocker (repeatable)",
362
+ ],
363
+ },
364
+ ],
365
+ },
366
+ tier: {
367
+ entries: [
368
+ {
369
+ term: "--tier <auto|static-only>",
370
+ help: [
371
+ "tier policy (default: auto). static-only keeps every",
372
+ "construct without a static lowering a compile error, so",
373
+ "the program has no dynamic-tier demotions. Both modes",
374
+ "currently compile identically",
375
+ ],
376
+ },
377
+ ],
378
+ },
379
+ "explain-dynamic": {
380
+ entries: [
381
+ {
382
+ term: "--explain-dynamic[=<name>]",
383
+ help: [
384
+ "coverage only: list the functions that operate on dynamic",
385
+ "values and the bindings, fields, functions, classes and",
386
+ "modules the dynamic tier would take over, with the",
387
+ "refusal behind each; a name shows only that unit's chain",
388
+ ],
389
+ },
390
+ ],
391
+ },
392
+ "dynamic-tier-warning": {
393
+ entries: [
394
+ {
395
+ term: "--no-dynamic-tier-warning",
396
+ help: [
397
+ "build and coverage: leave out SC6101, the warning that",
398
+ "names likely-hot functions that use untyped values",
399
+ ],
400
+ },
401
+ ],
402
+ },
403
+ "node-islands": {
404
+ entries: [
405
+ {
406
+ term: "--node-islands <auto|explicit|off>",
407
+ help: [
408
+ "Node island policy (default: auto): npm packages outside",
409
+ "the native subset run in Node automatically; explicit",
410
+ "allows only marked islands; off allows none. REPORT-ONLY",
411
+ "in this version: coverage reports the islands a build",
412
+ "would choose; builds compile as before",
413
+ ],
414
+ },
415
+ ],
416
+ },
417
+ "node-island": {
418
+ entries: [
419
+ {
420
+ term: "--node-island <pkg-or-path>",
421
+ help: [
422
+ "mark an npm package or one of your modules (a path or",
423
+ "glob) to run in a Node island (repeatable, comma lists;",
424
+ "report-only)",
425
+ ],
426
+ },
427
+ ],
428
+ },
429
+ native: {
430
+ entries: [
431
+ {
432
+ term: "--native <pkg>",
433
+ help: [
434
+ "require an npm package to compile natively; outside the",
435
+ "native subset it is SC8003 (repeatable; report-only)",
436
+ ],
437
+ },
438
+ ],
439
+ },
440
+ node: {
441
+ entries: [
442
+ { term: "--node <path>", help: ["the node executable Node islands use (report-only)"] },
443
+ ],
444
+ },
445
+ "explain-island": {
446
+ entries: [
447
+ {
448
+ term: "--explain-island <pkg>",
449
+ help: [
450
+ "coverage only: why a package would run in a Node island,",
451
+ "with the first reason per module, the native import",
452
+ "sites and the packages inside its closure",
453
+ ],
454
+ },
455
+ ],
456
+ },
457
+ "strict-user-js": {
458
+ entries: [
459
+ {
460
+ term: "--strict-user-js",
461
+ help: [
462
+ "coverage only: report constructor functions, prototype",
463
+ "and shape mutation, sloppy-mode semantics and builtin",
464
+ "patching in your own .js/.cjs/.mjs modules as",
465
+ "SC8101–SC8105 blockers",
466
+ ],
467
+ },
468
+ ],
469
+ },
470
+ wasm: {
471
+ entries: [
472
+ {
473
+ term: "--wasm <file.wasm>",
474
+ help: [
475
+ "coverage only: report a WebAssembly module the program",
476
+ "loads whose path its sources do not spell (repeatable;",
477
+ "modules the sources name, inline modules and packaged",
478
+ ".wasm files are found without it)",
479
+ ],
480
+ },
481
+ ],
482
+ },
483
+ help: { entries: [{ term: "-h, --help", help: ["show this help"] }] },
484
+ version: { entries: [{ term: "-v, --version", help: ["print the version"] }] },
485
+ sparse: { entries: [], summary: "leave out functions that never ran, for a smaller file" },
486
+ range: {
487
+ entries: [],
488
+ summary: "the version range the patch applies to (default: ^<installed version>)",
489
+ },
490
+ "dry-run": { entries: [], summary: "print what the selector matches without writing the patch" },
491
+ lib: { entries: [], summary: "compile a library instead of an executable" },
492
+ profile: {
493
+ entries: [],
494
+ summary: "the library profile, which names the entry module and the exported symbols",
495
+ },
496
+ };
497
+ const ENTRY = {
498
+ name: "file",
499
+ summary: "the TypeScript or JavaScript entry file (.ts, .mts, .cts, .js, .mjs or .cjs)",
500
+ required: true,
501
+ variadic: false,
502
+ };
503
+ const NODE_ISLAND_OPTIONS = [
504
+ "node-islands",
505
+ "node-island",
506
+ "native",
507
+ "node",
508
+ ];
509
+ const EXECUTABLE_OPTIONS = [
510
+ "out",
511
+ "emit",
512
+ "backend",
513
+ "optimization",
514
+ "strip",
515
+ "static",
516
+ "windows-subsystem",
517
+ "detached-exit",
518
+ "stdout-buffering",
519
+ "libnode",
520
+ "large-pages",
521
+ "exceptions",
522
+ "target-cpu",
523
+ "cpu-dispatch",
524
+ "profile-generate",
525
+ "profile-use",
526
+ "keep-llvm",
527
+ "emit-ir",
528
+ "sanitize",
529
+ "ffi",
530
+ "npm-static",
531
+ "shape-overlay",
532
+ "provenance-sources",
533
+ "tier",
534
+ "dynamic-tier-warning",
535
+ ...NODE_ISLAND_OPTIONS,
536
+ ];
537
+ /** Every command, in the order the help lists them. */
538
+ export const CLI_COMMANDS = [
539
+ {
540
+ name: "build",
541
+ argv: ["build"],
542
+ usage: [
543
+ {
544
+ term: "scriptc build <file.ts|.js> [options]",
545
+ help: ["compile to an executable or source artifact"],
546
+ },
547
+ ],
548
+ positionals: [ENTRY],
549
+ options: [...EXECUTABLE_OPTIONS, "print"],
550
+ requiredOptions: [],
551
+ diagnostics: true,
552
+ effect: "write",
553
+ },
554
+ {
555
+ name: "run",
556
+ argv: ["run"],
557
+ usage: [{ term: "scriptc run <file.ts|.js> [options]", help: ["compile and run"] }],
558
+ positionals: [ENTRY],
559
+ options: EXECUTABLE_OPTIONS,
560
+ requiredOptions: [],
561
+ diagnostics: false,
562
+ effect: "execute",
563
+ },
564
+ {
565
+ name: "coverage",
566
+ argv: ["coverage"],
567
+ usage: [
568
+ {
569
+ term: "scriptc coverage <file.ts|.js>",
570
+ help: ["how much compiles statically, and why not"],
571
+ },
572
+ {
573
+ term: "scriptc coverage <file.ts|.js> --external-types <specifier=file.d.ts>",
574
+ help: ["type-resolve an embedder-provided module for analysis"],
575
+ },
576
+ ],
577
+ positionals: [ENTRY],
578
+ options: [
579
+ "print",
580
+ "fail-on",
581
+ "ffi",
582
+ "npm-static",
583
+ "provenance-sources",
584
+ "external-types",
585
+ "tier",
586
+ "explain-dynamic",
587
+ "dynamic-tier-warning",
588
+ ...NODE_ISLAND_OPTIONS,
589
+ "explain-island",
590
+ "strict-user-js",
591
+ "wasm",
592
+ ],
593
+ requiredOptions: [],
594
+ diagnostics: true,
595
+ effect: "read",
596
+ },
597
+ {
598
+ name: "build-lib",
599
+ argv: ["build", "--lib"],
600
+ usage: [
601
+ {
602
+ term: "scriptc build --lib --profile <p.json>",
603
+ help: [
604
+ "library mode: compile the profile's entry",
605
+ "module to a linkable static archive",
606
+ "(<name>.lib.a), or a Wasm reactor",
607
+ "(<name>.wasm) on wasm32-wasi,",
608
+ "exporting the profile symbols; a profile",
609
+ "with a sidecar section also gets the",
610
+ "contract sidecar JSON beside the archive",
611
+ ],
612
+ },
613
+ ],
614
+ positionals: [],
615
+ options: ["profile", "out", "emit-ir", "sanitize", "keep-llvm"],
616
+ requiredOptions: ["profile"],
617
+ diagnostics: false,
618
+ effect: "write",
619
+ },
620
+ {
621
+ name: "types-patch",
622
+ argv: ["types", "patch"],
623
+ usage: [
624
+ {
625
+ term: "scriptc types patch <package> <selector> <type> [--range <r>] [--dry-run]",
626
+ help: [
627
+ "fix a wrong declaration of an installed",
628
+ "package: shows what the selector",
629
+ "matches and adds the type patch to",
630
+ 'package.json ("| undefined" widens)',
631
+ ],
632
+ },
633
+ ],
634
+ positionals: [
635
+ {
636
+ name: "package",
637
+ summary: "the installed package to patch",
638
+ required: true,
639
+ variadic: false,
640
+ },
641
+ {
642
+ name: "selector",
643
+ summary: "the declaration to patch, such as HelpContext.helpWidth",
644
+ required: true,
645
+ variadic: false,
646
+ },
647
+ {
648
+ name: "type",
649
+ summary: "the corrected type; a type starting with | widens the declared one",
650
+ required: true,
651
+ variadic: false,
652
+ },
653
+ ],
654
+ options: ["range", "dry-run"],
655
+ requiredOptions: [],
656
+ diagnostics: false,
657
+ effect: "write",
658
+ },
659
+ {
660
+ name: "types-list",
661
+ argv: ["types", "list"],
662
+ usage: [
663
+ { term: "scriptc types list", help: ["the project's type patches and what", "they match"] },
664
+ ],
665
+ positionals: [],
666
+ options: [],
667
+ requiredOptions: [],
668
+ diagnostics: false,
669
+ effect: "read",
670
+ },
671
+ {
672
+ name: "cache-warm",
673
+ argv: ["cache", "warm"],
674
+ usage: [
675
+ {
676
+ term: "scriptc cache warm [runtime|tls…]",
677
+ help: [
678
+ "verify and load precompiled runtime families",
679
+ "for the current compiler/SDK/target",
680
+ ],
681
+ },
682
+ ],
683
+ positionals: [
684
+ {
685
+ name: "profiles",
686
+ summary: "the runtime families to warm, runtime or tls (default: all)",
687
+ required: false,
688
+ variadic: true,
689
+ },
690
+ ],
691
+ options: ["optimization", "sanitize"],
692
+ requiredOptions: [],
693
+ diagnostics: false,
694
+ effect: "write",
695
+ },
696
+ {
697
+ name: "merge-profiles",
698
+ argv: ["merge-profiles"],
699
+ usage: [
700
+ {
701
+ term: "scriptc merge-profiles -o <out.profdata> [--sparse] <profile…>",
702
+ help: [
703
+ "merge the raw profiles that",
704
+ "--profile-generate runs wrote (or",
705
+ "earlier merged profiles) into one",
706
+ "profile for --profile-use;",
707
+ "--sparse leaves out functions",
708
+ "that never ran (a smaller file)",
709
+ ],
710
+ },
711
+ ],
712
+ positionals: [
713
+ {
714
+ name: "profiles",
715
+ summary: "the raw profiles that --profile-generate runs wrote, or earlier merged profiles",
716
+ required: true,
717
+ variadic: true,
718
+ },
719
+ ],
720
+ options: ["out", "sparse"],
721
+ requiredOptions: ["out"],
722
+ diagnostics: false,
723
+ effect: "write",
724
+ },
725
+ ];
726
+ const USAGE_HELP_COLUMN = 44;
727
+ const OPTION_HELP_COLUMN = 21;
728
+ /** Renders help entries as a definition list: the term, indented further when it is a long-only
729
+ * flag, then its help from `column` on, starting on the term's line when the term leaves room. */
730
+ function renderEntries(entries, column) {
731
+ let text = "";
732
+ for (const entry of entries) {
733
+ const term = (entry.term.startsWith("--") ? " " : " ") + entry.term;
734
+ const [first, ...rest] = entry.help;
735
+ const lines = first !== undefined && term.length < column
736
+ ? [term.padEnd(column) + first]
737
+ : [term, ...(first === undefined ? [] : [" ".repeat(column) + first])];
738
+ for (const line of rest)
739
+ lines.push(" ".repeat(column) + line);
740
+ text += lines.join("\n") + "\n";
741
+ }
742
+ return text;
743
+ }
744
+ /** `scriptc mcp`, which serves the commands above and so is not one of `CLI_COMMANDS`. */
745
+ const MCP_USAGE = {
746
+ term: "scriptc mcp",
747
+ help: ["serve these commands as MCP tools over stdio"],
748
+ };
749
+ /** The `--help` text. */
750
+ export const USAGE = "scriptc — TypeScript/JavaScript to native and WebAssembly executables (experimental)\n\nUsage:\n" +
751
+ renderEntries([...CLI_COMMANDS.flatMap((command) => command.usage), MCP_USAGE], USAGE_HELP_COLUMN) +
752
+ "\nOptions:\n" +
753
+ renderEntries(Object.values(CLI_OPTION_DOCS).flatMap((doc) => doc.entries), OPTION_HELP_COLUMN);
231
754
  //# sourceMappingURL=usage.js.map