@scriptc/compiler 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1082) hide show
  1. package/ambient/node-fallback/child_process.d.ts +71 -22
  2. package/ambient/node-fallback/crypto.d.ts +15 -7
  3. package/ambient/node-fallback/events.d.ts +29 -6
  4. package/ambient/node-fallback/fs-promises.d.ts +1 -1
  5. package/ambient/node-fallback/fs.d.ts +57 -12
  6. package/ambient/node-fallback/http.d.ts +26 -18
  7. package/ambient/node-fallback/https.d.ts +5 -2
  8. package/ambient/node-fallback/net.d.ts +25 -0
  9. package/ambient/node-fallback/os.d.ts +11 -1
  10. package/ambient/node-fallback/path-posix.d.ts +6 -0
  11. package/ambient/node-fallback/path-win32.d.ts +5 -0
  12. package/ambient/node-fallback/path.d.ts +2 -0
  13. package/ambient/node-fallback/querystring.d.ts +3 -3
  14. package/ambient/node-fallback/zlib.d.ts +31 -2
  15. package/ambient/scriptc-node-fallback.d.ts +95 -20
  16. package/ambient/scriptc.d.ts +7 -2
  17. package/dist/backend/executable-features.js +22 -1
  18. package/dist/backend/executable-features.js.map +1 -1
  19. package/dist/backend/immutability.d.ts +12 -1
  20. package/dist/backend/immutability.js +50 -4
  21. package/dist/backend/immutability.js.map +1 -1
  22. package/dist/backend/immutability.test.js +95 -1
  23. package/dist/backend/immutability.test.js.map +1 -1
  24. package/dist/backend/library-pack.d.ts +6 -0
  25. package/dist/backend/library-pack.js +18 -5
  26. package/dist/backend/library-pack.js.map +1 -1
  27. package/dist/backend/library-pack.test.d.ts +1 -0
  28. package/dist/backend/library-pack.test.js +28 -0
  29. package/dist/backend/library-pack.test.js.map +1 -0
  30. package/dist/backend/linker.d.ts +20 -2
  31. package/dist/backend/linker.js +221 -35
  32. package/dist/backend/linker.js.map +1 -1
  33. package/dist/backend/lld.d.ts +15 -6
  34. package/dist/backend/lld.js +24 -16
  35. package/dist/backend/lld.js.map +1 -1
  36. package/dist/backend/lld.test.js +13 -5
  37. package/dist/backend/lld.test.js.map +1 -1
  38. package/dist/backend/llvm/alloc.d.ts +15 -2
  39. package/dist/backend/llvm/alloc.js +172 -36
  40. package/dist/backend/llvm/alloc.js.map +1 -1
  41. package/dist/backend/llvm/alloc.test.js +69 -1
  42. package/dist/backend/llvm/alloc.test.js.map +1 -1
  43. package/dist/backend/llvm/arenas.d.ts +17 -4
  44. package/dist/backend/llvm/arenas.js +105 -10
  45. package/dist/backend/llvm/arenas.js.map +1 -1
  46. package/dist/backend/llvm/arenas.test.js +229 -0
  47. package/dist/backend/llvm/arenas.test.js.map +1 -1
  48. package/dist/backend/llvm/bytes-alias.js +10 -1
  49. package/dist/backend/llvm/bytes-alias.js.map +1 -1
  50. package/dist/backend/llvm/bytes-headers.js +6 -0
  51. package/dist/backend/llvm/bytes-headers.js.map +1 -1
  52. package/dist/backend/llvm/bytes-loop-versions.test.js +25 -0
  53. package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
  54. package/dist/backend/llvm/call-lifetimes.js +10 -0
  55. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  56. package/dist/backend/llvm/classes.d.ts +16 -9
  57. package/dist/backend/llvm/classes.js +142 -37
  58. package/dist/backend/llvm/classes.js.map +1 -1
  59. package/dist/backend/llvm/classes.test.js +42 -0
  60. package/dist/backend/llvm/classes.test.js.map +1 -1
  61. package/dist/backend/llvm/constant-callbacks.test.js +50 -1
  62. package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
  63. package/dist/backend/llvm/cpu-dispatch.d.ts +15 -5
  64. package/dist/backend/llvm/cpu-dispatch.js +34 -9
  65. package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
  66. package/dist/backend/llvm/dyn.d.ts +64 -3
  67. package/dist/backend/llvm/dyn.js +251 -15
  68. package/dist/backend/llvm/dyn.js.map +1 -1
  69. package/dist/backend/llvm/emit-function.js +68 -5
  70. package/dist/backend/llvm/emit-function.js.map +1 -1
  71. package/dist/backend/llvm/emit-module.js +226 -77
  72. package/dist/backend/llvm/emit-module.js.map +1 -1
  73. package/dist/backend/llvm/emit-module.test.d.ts +1 -0
  74. package/dist/backend/llvm/emit-module.test.js +52 -0
  75. package/dist/backend/llvm/emit-module.test.js.map +1 -0
  76. package/dist/backend/llvm/emit-statements.js +138 -34
  77. package/dist/backend/llvm/emit-statements.js.map +1 -1
  78. package/dist/backend/llvm/emitter.d.ts +142 -10
  79. package/dist/backend/llvm/emitter.js +523 -73
  80. package/dist/backend/llvm/emitter.js.map +1 -1
  81. package/dist/backend/llvm/emitter.test.js +31 -3
  82. package/dist/backend/llvm/emitter.test.js.map +1 -1
  83. package/dist/backend/llvm/expr-async.js +19 -1
  84. package/dist/backend/llvm/expr-async.js.map +1 -1
  85. package/dist/backend/llvm/expr-bytes.js +16 -1
  86. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  87. package/dist/backend/llvm/expr-calls.d.ts +4 -1
  88. package/dist/backend/llvm/expr-calls.js +38 -6
  89. package/dist/backend/llvm/expr-calls.js.map +1 -1
  90. package/dist/backend/llvm/expr-dynamic.js +237 -23
  91. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  92. package/dist/backend/llvm/expr-primitives.js +123 -12
  93. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  94. package/dist/backend/llvm/expr-records.d.ts +1 -1
  95. package/dist/backend/llvm/expr-records.js +124 -56
  96. package/dist/backend/llvm/expr-records.js.map +1 -1
  97. package/dist/backend/llvm/expr-stream-bridges.d.ts +8 -0
  98. package/dist/backend/llvm/expr-stream-bridges.js +59 -2
  99. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  100. package/dist/backend/llvm/expr-stream-callbacks.d.ts +16 -0
  101. package/dist/backend/llvm/expr-stream-callbacks.js +206 -20
  102. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  103. package/dist/backend/llvm/integer-values.d.ts +2 -0
  104. package/dist/backend/llvm/integer-values.js +6 -0
  105. package/dist/backend/llvm/integer-values.js.map +1 -1
  106. package/dist/backend/llvm/js-groups.d.ts +21 -0
  107. package/dist/backend/llvm/js-groups.js +277 -0
  108. package/dist/backend/llvm/js-groups.js.map +1 -0
  109. package/dist/backend/llvm/js-ic.d.ts +57 -1
  110. package/dist/backend/llvm/js-ic.js +389 -22
  111. package/dist/backend/llvm/js-ic.js.map +1 -1
  112. package/dist/backend/llvm/lib-dispatch.js +152 -1
  113. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  114. package/dist/backend/llvm/lib-filesystem.js +116 -11
  115. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  116. package/dist/backend/llvm/lib-network.js +33 -6
  117. package/dist/backend/llvm/lib-network.js.map +1 -1
  118. package/dist/backend/llvm/lib-process.js +180 -27
  119. package/dist/backend/llvm/lib-process.js.map +1 -1
  120. package/dist/backend/llvm/lib-shared.js +139 -2
  121. package/dist/backend/llvm/lib-shared.js.map +1 -1
  122. package/dist/backend/llvm/lib-stream.js +67 -0
  123. package/dist/backend/llvm/lib-stream.js.map +1 -1
  124. package/dist/backend/llvm/local-union-storage.test.js +32 -0
  125. package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
  126. package/dist/backend/llvm/loop-entry-versions.d.ts +2 -2
  127. package/dist/backend/llvm/loop-entry-versions.js +43 -21
  128. package/dist/backend/llvm/loop-entry-versions.js.map +1 -1
  129. package/dist/backend/llvm/loop-state.d.ts +7 -1
  130. package/dist/backend/llvm/loop-state.js +26 -3
  131. package/dist/backend/llvm/loop-state.js.map +1 -1
  132. package/dist/backend/llvm/map-entry-fusion.d.ts +8 -0
  133. package/dist/backend/llvm/map-entry-fusion.js +3 -3
  134. package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
  135. package/dist/backend/llvm/map-number-lookup.d.ts +3 -1
  136. package/dist/backend/llvm/map-number-lookup.js +7 -3
  137. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  138. package/dist/backend/llvm/map-number-lookup.test.js +58 -17
  139. package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
  140. package/dist/backend/llvm/nullable-unions.js +7 -6
  141. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  142. package/dist/backend/llvm/nullable-unions.test.js +4 -1
  143. package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
  144. package/dist/backend/llvm/receiver-brackets.test.d.ts +1 -0
  145. package/dist/backend/llvm/receiver-brackets.test.js +68 -0
  146. package/dist/backend/llvm/receiver-brackets.test.js.map +1 -0
  147. package/dist/backend/llvm/receivers.js +3 -0
  148. package/dist/backend/llvm/receivers.js.map +1 -1
  149. package/dist/backend/llvm/record-entry-fusion.d.ts +32 -0
  150. package/dist/backend/llvm/record-entry-fusion.js +217 -0
  151. package/dist/backend/llvm/record-entry-fusion.js.map +1 -0
  152. package/dist/backend/llvm/record-results.d.ts +5 -2
  153. package/dist/backend/llvm/record-results.js +13 -12
  154. package/dist/backend/llvm/record-results.js.map +1 -1
  155. package/dist/backend/llvm/record-views.d.ts +22 -2
  156. package/dist/backend/llvm/record-views.js +147 -12
  157. package/dist/backend/llvm/record-views.js.map +1 -1
  158. package/dist/backend/llvm/record-views.test.js +76 -0
  159. package/dist/backend/llvm/record-views.test.js.map +1 -1
  160. package/dist/backend/llvm/reference-effects.js +1 -0
  161. package/dist/backend/llvm/reference-effects.js.map +1 -1
  162. package/dist/backend/llvm/reference-writes.js +4 -0
  163. package/dist/backend/llvm/reference-writes.js.map +1 -1
  164. package/dist/backend/llvm/region-ir.js +1 -0
  165. package/dist/backend/llvm/region-ir.js.map +1 -1
  166. package/dist/backend/llvm/region-sites.d.ts +18 -0
  167. package/dist/backend/llvm/region-sites.js +79 -1
  168. package/dist/backend/llvm/region-sites.js.map +1 -1
  169. package/dist/backend/llvm/runtime-registries.test.js +53 -6
  170. package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
  171. package/dist/backend/llvm/serialized-ir-emission.test.js +3 -1
  172. package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
  173. package/dist/backend/llvm/shapes.d.ts +36 -3
  174. package/dist/backend/llvm/shapes.js +201 -16
  175. package/dist/backend/llvm/shapes.js.map +1 -1
  176. package/dist/backend/llvm/shapes.test.js +4 -0
  177. package/dist/backend/llvm/shapes.test.js.map +1 -1
  178. package/dist/backend/llvm/speculative-integers.d.ts +10 -1
  179. package/dist/backend/llvm/speculative-integers.js +59 -8
  180. package/dist/backend/llvm/speculative-integers.js.map +1 -1
  181. package/dist/backend/llvm/stack-objects.d.ts +1 -2
  182. package/dist/backend/llvm/stack-objects.js +8 -5
  183. package/dist/backend/llvm/stack-objects.js.map +1 -1
  184. package/dist/backend/llvm/unwind-abi.d.ts +3 -3
  185. package/dist/backend/llvm/unwind-abi.js +8 -3
  186. package/dist/backend/llvm/unwind-abi.js.map +1 -1
  187. package/dist/backend/llvm/walkers.d.ts +12 -0
  188. package/dist/backend/llvm/walkers.js +47 -3
  189. package/dist/backend/llvm/walkers.js.map +1 -1
  190. package/dist/backend/may-throw.js +12 -2
  191. package/dist/backend/may-throw.js.map +1 -1
  192. package/dist/backend/may-throw.test.js +13 -0
  193. package/dist/backend/may-throw.test.js.map +1 -1
  194. package/dist/backend/native/contracts.d.ts +94 -0
  195. package/dist/backend/native/executable.js +134 -10
  196. package/dist/backend/native/executable.js.map +1 -1
  197. package/dist/backend/native/helper-identity-record.d.ts +11 -0
  198. package/dist/backend/native/helper-identity-record.js +76 -0
  199. package/dist/backend/native/helper-identity-record.js.map +1 -0
  200. package/dist/backend/native/helper-identity-record.test.d.ts +1 -0
  201. package/dist/backend/native/helper-identity-record.test.js +101 -0
  202. package/dist/backend/native/helper-identity-record.test.js.map +1 -0
  203. package/dist/backend/native/library.js +10 -2
  204. package/dist/backend/native/library.js.map +1 -1
  205. package/dist/backend/native/runtime-inputs.js +8 -1
  206. package/dist/backend/native/runtime-inputs.js.map +1 -1
  207. package/dist/backend/native/vendor.d.ts +1 -1
  208. package/dist/backend/native/vendor.js +1 -1
  209. package/dist/backend/native/vendor.js.map +1 -1
  210. package/dist/backend/native-codegen-core.d.ts +13 -10
  211. package/dist/backend/native-codegen-core.js +26 -13
  212. package/dist/backend/native-codegen-core.js.map +1 -1
  213. package/dist/backend/native-codegen.js +30 -8
  214. package/dist/backend/native-codegen.js.map +1 -1
  215. package/dist/backend/native-codegen.test.js +110 -14
  216. package/dist/backend/native-codegen.test.js.map +1 -1
  217. package/dist/backend/native-link-info-core.d.ts +72 -0
  218. package/dist/backend/native-link-info-core.js.map +1 -1
  219. package/dist/backend/native-link-info.js +1 -0
  220. package/dist/backend/native-link-info.js.map +1 -1
  221. package/dist/backend/native-profile.d.ts +4 -1
  222. package/dist/backend/native-profile.js +12 -1
  223. package/dist/backend/native-profile.js.map +1 -1
  224. package/dist/backend/native-profile.test.js +10 -0
  225. package/dist/backend/native-profile.test.js.map +1 -1
  226. package/dist/backend/publication.d.ts +4 -1
  227. package/dist/backend/publication.js +4 -2
  228. package/dist/backend/publication.js.map +1 -1
  229. package/dist/backend/runtime-abi.d.ts +2 -2
  230. package/dist/backend/runtime-abi.js +2 -2
  231. package/dist/backend/runtime-pack-core.d.ts +46 -7
  232. package/dist/backend/runtime-pack-core.js +37 -2
  233. package/dist/backend/runtime-pack-core.js.map +1 -1
  234. package/dist/backend/runtime-pack-native.d.ts +18 -1
  235. package/dist/backend/runtime-pack-native.js +138 -29
  236. package/dist/backend/runtime-pack-native.js.map +1 -1
  237. package/dist/backend/runtime-pack-native.test.js +166 -4
  238. package/dist/backend/runtime-pack-native.test.js.map +1 -1
  239. package/dist/backend/runtime-pack-targets.test.js +3 -1
  240. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  241. package/dist/backend/runtime-pack.d.ts +7 -0
  242. package/dist/backend/runtime-pack.js +25 -3
  243. package/dist/backend/runtime-pack.js.map +1 -1
  244. package/dist/backend/runtime-pack.test.js +213 -12
  245. package/dist/backend/runtime-pack.test.js.map +1 -1
  246. package/dist/backend/tree-classes.d.ts +42 -0
  247. package/dist/backend/tree-classes.js +723 -0
  248. package/dist/backend/tree-classes.js.map +1 -0
  249. package/dist/backend/tree-classes.test.d.ts +1 -0
  250. package/dist/backend/tree-classes.test.js +338 -0
  251. package/dist/backend/tree-classes.test.js.map +1 -0
  252. package/dist/backend/vendor-archives.d.ts +8 -1
  253. package/dist/backend/vendor-archives.js +313 -8
  254. package/dist/backend/vendor-archives.js.map +1 -1
  255. package/dist/backend/vendor-inputs.d.ts +60 -3
  256. package/dist/backend/vendor-inputs.js +109 -3
  257. package/dist/backend/vendor-inputs.js.map +1 -1
  258. package/dist/backend/vendor-inputs.test.js +62 -1
  259. package/dist/backend/vendor-inputs.test.js.map +1 -1
  260. package/dist/backend/warm-cache.js +2 -0
  261. package/dist/backend/warm-cache.js.map +1 -1
  262. package/dist/compat/fetch-profile.d.ts +7 -1
  263. package/dist/compat/fetch-profile.js +25 -12
  264. package/dist/compat/fetch-profile.js.map +1 -1
  265. package/dist/compile-types.d.ts +7 -0
  266. package/dist/contracts/check.d.ts +3 -0
  267. package/dist/contracts/check.js +18 -5
  268. package/dist/contracts/check.js.map +1 -1
  269. package/dist/coverage/report.js +47 -0
  270. package/dist/coverage/report.js.map +1 -1
  271. package/dist/coverage/surface-manifest.js +1 -1
  272. package/dist/coverage/surface-manifest.js.map +1 -1
  273. package/dist/diagnostics/codes.d.ts +14 -0
  274. package/dist/diagnostics/codes.js +14 -0
  275. package/dist/diagnostics/codes.js.map +1 -1
  276. package/dist/diagnostics/diagnostic.d.ts +68 -0
  277. package/dist/diagnostics/diagnostic.js +186 -6
  278. package/dist/diagnostics/diagnostic.js.map +1 -1
  279. package/dist/diagnostics/dynamic-tier.js +3 -1
  280. package/dist/diagnostics/dynamic-tier.js.map +1 -1
  281. package/dist/diagnostics/envelope.d.ts +18 -0
  282. package/dist/diagnostics/envelope.js.map +1 -1
  283. package/dist/executable/executable-cache.d.ts +48 -0
  284. package/dist/executable/executable-cache.js +38 -0
  285. package/dist/executable/executable-cache.js.map +1 -1
  286. package/dist/executable/executable-cache.test.js +127 -1
  287. package/dist/executable/executable-cache.test.js.map +1 -1
  288. package/dist/executable/prepare.d.ts +13 -3
  289. package/dist/executable/prepare.js +438 -234
  290. package/dist/executable/prepare.js.map +1 -1
  291. package/dist/frontend/analysis.js +200 -18
  292. package/dist/frontend/analysis.js.map +1 -1
  293. package/dist/frontend/builtin-modules.d.ts +4 -0
  294. package/dist/frontend/builtin-modules.js +10 -0
  295. package/dist/frontend/builtin-modules.js.map +1 -1
  296. package/dist/frontend/early-errors.d.ts +24 -0
  297. package/dist/frontend/early-errors.js +836 -0
  298. package/dist/frontend/early-errors.js.map +1 -0
  299. package/dist/frontend/early-errors.test.d.ts +1 -0
  300. package/dist/frontend/early-errors.test.js +207 -0
  301. package/dist/frontend/early-errors.test.js.map +1 -0
  302. package/dist/frontend/inferred-js-diagnostics.test.js +88 -0
  303. package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
  304. package/dist/frontend/input-tracker.d.ts +47 -0
  305. package/dist/frontend/input-tracker.js +173 -36
  306. package/dist/frontend/input-tracker.js.map +1 -1
  307. package/dist/frontend/input-tracker.test.js +86 -2
  308. package/dist/frontend/input-tracker.test.js.map +1 -1
  309. package/dist/frontend/js-inference.d.ts +2 -0
  310. package/dist/frontend/js-inference.js +18 -0
  311. package/dist/frontend/js-inference.js.map +1 -0
  312. package/dist/frontend/jsx-opinion-sites.test.d.ts +1 -0
  313. package/dist/frontend/jsx-opinion-sites.test.js +86 -0
  314. package/dist/frontend/jsx-opinion-sites.test.js.map +1 -0
  315. package/dist/frontend/lib-exports.d.ts +23 -4
  316. package/dist/frontend/lib-exports.js +98 -26
  317. package/dist/frontend/lib-exports.js.map +1 -1
  318. package/dist/frontend/lowering/binding-analysis.d.ts +2 -1
  319. package/dist/frontend/lowering/binding-analysis.js +86 -4
  320. package/dist/frontend/lowering/binding-analysis.js.map +1 -1
  321. package/dist/frontend/lowering/buffers.d.ts +8 -0
  322. package/dist/frontend/lowering/buffers.js +43 -0
  323. package/dist/frontend/lowering/buffers.js.map +1 -0
  324. package/dist/frontend/lowering/builtin-calls.js +13 -0
  325. package/dist/frontend/lowering/builtin-calls.js.map +1 -1
  326. package/dist/frontend/lowering/builtin-namespaces.d.ts +3 -2
  327. package/dist/frontend/lowering/builtin-namespaces.js +41 -3
  328. package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
  329. package/dist/frontend/lowering/builtin-statics.d.ts +24 -0
  330. package/dist/frontend/lowering/builtin-statics.js +407 -0
  331. package/dist/frontend/lowering/builtin-statics.js.map +1 -0
  332. package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
  333. package/dist/frontend/lowering/builtins/arguments.js +12 -0
  334. package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
  335. package/dist/frontend/lowering/builtins/atomics.d.ts +6 -1
  336. package/dist/frontend/lowering/builtins/atomics.js +87 -1
  337. package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
  338. package/dist/frontend/lowering/builtins/child-process-methods.d.ts +7 -0
  339. package/dist/frontend/lowering/builtins/child-process-methods.js +52 -12
  340. package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
  341. package/dist/frontend/lowering/builtins/child-process-sync.d.ts +13 -0
  342. package/dist/frontend/lowering/builtins/child-process-sync.js +1 -13
  343. package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
  344. package/dist/frontend/lowering/builtins/child-process.d.ts +10 -4
  345. package/dist/frontend/lowering/builtins/child-process.js +565 -28
  346. package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
  347. package/dist/frontend/lowering/builtins/compression.d.ts +2 -2
  348. package/dist/frontend/lowering/builtins/compression.js +41 -21
  349. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  350. package/dist/frontend/lowering/builtins/constants.js +7 -2
  351. package/dist/frontend/lowering/builtins/constants.js.map +1 -1
  352. package/dist/frontend/lowering/builtins/dates.d.ts +1 -1
  353. package/dist/frontend/lowering/builtins/dates.js +23 -1
  354. package/dist/frontend/lowering/builtins/dates.js.map +1 -1
  355. package/dist/frontend/lowering/builtins/environment.d.ts +55 -0
  356. package/dist/frontend/lowering/builtins/environment.js +213 -2
  357. package/dist/frontend/lowering/builtins/environment.js.map +1 -1
  358. package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -0
  359. package/dist/frontend/lowering/builtins/filesystem-calls.js +75 -18
  360. package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
  361. package/dist/frontend/lowering/builtins/filesystem.d.ts +25 -7
  362. package/dist/frontend/lowering/builtins/filesystem.js +185 -16
  363. package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
  364. package/dist/frontend/lowering/builtins/json.js +4 -0
  365. package/dist/frontend/lowering/builtins/json.js.map +1 -1
  366. package/dist/frontend/lowering/builtins/module-calls.js +42 -3
  367. package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
  368. package/dist/frontend/lowering/builtins/module-resolution.d.ts +8 -0
  369. package/dist/frontend/lowering/builtins/module-resolution.js +31 -5
  370. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  371. package/dist/frontend/lowering/builtins/numbers.d.ts +4 -1
  372. package/dist/frontend/lowering/builtins/numbers.js +10 -2
  373. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  374. package/dist/frontend/lowering/builtins/operating-system.d.ts +9 -5
  375. package/dist/frontend/lowering/builtins/operating-system.js +101 -20
  376. package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
  377. package/dist/frontend/lowering/builtins/process.d.ts +18 -2
  378. package/dist/frontend/lowering/builtins/process.js +386 -25
  379. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  380. package/dist/frontend/lowering/builtins/promises.js +169 -8
  381. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  382. package/dist/frontend/lowering/builtins/properties.js +6 -2
  383. package/dist/frontend/lowering/builtins/properties.js.map +1 -1
  384. package/dist/frontend/lowering/builtins/querystring.d.ts +8 -0
  385. package/dist/frontend/lowering/builtins/querystring.js +202 -18
  386. package/dist/frontend/lowering/builtins/querystring.js.map +1 -1
  387. package/dist/frontend/lowering/builtins/readline.d.ts +6 -4
  388. package/dist/frontend/lowering/builtins/readline.js +200 -38
  389. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  390. package/dist/frontend/lowering/builtins/reflection.js +60 -1
  391. package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
  392. package/dist/frontend/lowering/builtins/text-codecs.js +208 -59
  393. package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
  394. package/dist/frontend/lowering/builtins/url.js +55 -13
  395. package/dist/frontend/lowering/builtins/url.js.map +1 -1
  396. package/dist/frontend/lowering/builtins/v8.d.ts +5 -5
  397. package/dist/frontend/lowering/builtins/v8.js +7 -5
  398. package/dist/frontend/lowering/builtins/v8.js.map +1 -1
  399. package/dist/frontend/lowering/builtins/web-streams-dyn.d.ts +17 -2
  400. package/dist/frontend/lowering/builtins/web-streams-dyn.js +97 -9
  401. package/dist/frontend/lowering/builtins/web-streams-dyn.js.map +1 -1
  402. package/dist/frontend/lowering/builtins/webassembly.js +2 -0
  403. package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
  404. package/dist/frontend/lowering/call-arguments.d.ts +10 -0
  405. package/dist/frontend/lowering/call-arguments.js +37 -2
  406. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  407. package/dist/frontend/lowering/call-signatures.d.ts +10 -0
  408. package/dist/frontend/lowering/call-signatures.js +180 -0
  409. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  410. package/dist/frontend/lowering/cjs-exports-object.d.ts +3 -0
  411. package/dist/frontend/lowering/cjs-exports-object.js +1 -1
  412. package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
  413. package/dist/frontend/lowering/cjs-inline-require.js +5 -0
  414. package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
  415. package/dist/frontend/lowering/class-construction.d.ts +14 -2
  416. package/dist/frontend/lowering/class-construction.js +99 -5
  417. package/dist/frontend/lowering/class-construction.js.map +1 -1
  418. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +14 -0
  419. package/dist/frontend/lowering/class-dynamic-dispatch.js +1376 -1009
  420. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  421. package/dist/frontend/lowering/class-dynamic-dispatch.test.js +158 -0
  422. package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
  423. package/dist/frontend/lowering/class-protocols.js +59 -10
  424. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  425. package/dist/frontend/lowering/class-prototypes.js +20 -15
  426. package/dist/frontend/lowering/class-prototypes.js.map +1 -1
  427. package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
  428. package/dist/frontend/lowering/class-runtime-statics.js +35 -1
  429. package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
  430. package/dist/frontend/lowering/class-unions.js +21 -4
  431. package/dist/frontend/lowering/class-unions.js.map +1 -1
  432. package/dist/frontend/lowering/class-views.d.ts +13 -0
  433. package/dist/frontend/lowering/class-views.js +51 -0
  434. package/dist/frontend/lowering/class-views.js.map +1 -0
  435. package/dist/frontend/lowering/coercions/function-adapters.d.ts +15 -1
  436. package/dist/frontend/lowering/coercions/function-adapters.js +63 -10
  437. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  438. package/dist/frontend/lowering/coercions/state.d.ts +15 -0
  439. package/dist/frontend/lowering/coercions/state.js +24 -0
  440. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  441. package/dist/frontend/lowering/coercions/structural-plans.js +75 -3
  442. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  443. package/dist/frontend/lowering/coercions/structural.js +39 -2
  444. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  445. package/dist/frontend/lowering/coercions/unions.d.ts +2 -1
  446. package/dist/frontend/lowering/coercions/unions.js +54 -10
  447. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  448. package/dist/frontend/lowering/constructor-returns.d.ts +23 -2
  449. package/dist/frontend/lowering/constructor-returns.js +284 -58
  450. package/dist/frontend/lowering/constructor-returns.js.map +1 -1
  451. package/dist/frontend/lowering/containers/array-callbacks.d.ts +8 -1
  452. package/dist/frontend/lowering/containers/array-callbacks.js +288 -90
  453. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  454. package/dist/frontend/lowering/containers/array-construction.js +37 -8
  455. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  456. package/dist/frontend/lowering/containers/array-from-async.js +139 -3
  457. package/dist/frontend/lowering/containers/array-from-async.js.map +1 -1
  458. package/dist/frontend/lowering/containers/array-iteration.d.ts +14 -4
  459. package/dist/frontend/lowering/containers/array-iteration.js +24 -7
  460. package/dist/frontend/lowering/containers/array-iteration.js.map +1 -1
  461. package/dist/frontend/lowering/containers/array-methods.js +30 -11
  462. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  463. package/dist/frontend/lowering/containers/bytes.d.ts +6 -0
  464. package/dist/frontend/lowering/containers/bytes.js +450 -86
  465. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  466. package/dist/frontend/lowering/containers/callback-arguments.d.ts +16 -0
  467. package/dist/frontend/lowering/containers/callback-arguments.js +74 -12
  468. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  469. package/dist/frontend/lowering/containers/collection-grouping.js +421 -2
  470. package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
  471. package/dist/frontend/lowering/containers/collection-methods.js +52 -17
  472. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  473. package/dist/frontend/lowering/containers/filter-predicates.d.ts +10 -0
  474. package/dist/frontend/lowering/containers/filter-predicates.js +69 -3
  475. package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
  476. package/dist/frontend/lowering/containers/indexed-objects.js +46 -2
  477. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  478. package/dist/frontend/lowering/containers/iterator-helpers.d.ts +23 -0
  479. package/dist/frontend/lowering/containers/iterator-helpers.js +176 -10
  480. package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
  481. package/dist/frontend/lowering/containers/string-and-regexp.d.ts +5 -2
  482. package/dist/frontend/lowering/containers/string-and-regexp.js +45 -11
  483. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  484. package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
  485. package/dist/frontend/lowering/crypto-tables.js +5 -5
  486. package/dist/frontend/lowering/dispatch-sites.js +3 -0
  487. package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
  488. package/dist/frontend/lowering/divergences.d.ts +40 -0
  489. package/dist/frontend/lowering/divergences.js +239 -20
  490. package/dist/frontend/lowering/divergences.js.map +1 -1
  491. package/dist/frontend/lowering/effect-free.d.ts +12 -0
  492. package/dist/frontend/lowering/effect-free.js +44 -0
  493. package/dist/frontend/lowering/effect-free.js.map +1 -0
  494. package/dist/frontend/lowering/expressions/array-literals.d.ts +24 -0
  495. package/dist/frontend/lowering/expressions/array-literals.js +88 -10
  496. package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
  497. package/dist/frontend/lowering/expressions/binary.js +216 -14
  498. package/dist/frontend/lowering/expressions/binary.js.map +1 -1
  499. package/dist/frontend/lowering/expressions/element-access.js +272 -11
  500. package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
  501. package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +15 -0
  502. package/dist/frontend/lowering/expressions/hosted-narrowing.js +54 -1
  503. package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
  504. package/dist/frontend/lowering/expressions/identifiers.js +173 -4
  505. package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
  506. package/dist/frontend/lowering/expressions/keyed-field-targets.d.ts +11 -1
  507. package/dist/frontend/lowering/expressions/keyed-field-targets.js +22 -1
  508. package/dist/frontend/lowering/expressions/keyed-field-targets.js.map +1 -1
  509. package/dist/frontend/lowering/expressions/narrowing.d.ts +3 -0
  510. package/dist/frontend/lowering/expressions/narrowing.js +195 -18
  511. package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
  512. package/dist/frontend/lowering/expressions/object-literals.d.ts +5 -1
  513. package/dist/frontend/lowering/expressions/object-literals.js +951 -240
  514. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  515. package/dist/frontend/lowering/expressions/optional-chains.js +71 -21
  516. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  517. package/dist/frontend/lowering/expressions/property-access.d.ts +39 -0
  518. package/dist/frontend/lowering/expressions/property-access.js +1141 -87
  519. package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
  520. package/dist/frontend/lowering/expressions/relational.js +262 -4
  521. package/dist/frontend/lowering/expressions/relational.js.map +1 -1
  522. package/dist/frontend/lowering/expressions/typeof.js +25 -0
  523. package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
  524. package/dist/frontend/lowering/expressions/union-fields.d.ts +20 -1
  525. package/dist/frontend/lowering/expressions/union-fields.js +103 -13
  526. package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
  527. package/dist/frontend/lowering/expressions/updates.js +156 -22
  528. package/dist/frontend/lowering/expressions/updates.js.map +1 -1
  529. package/dist/frontend/lowering/frozen-records.d.ts +6 -0
  530. package/dist/frontend/lowering/frozen-records.js +10 -4
  531. package/dist/frontend/lowering/frozen-records.js.map +1 -1
  532. package/dist/frontend/lowering/frozen-records.test.d.ts +1 -0
  533. package/dist/frontend/lowering/frozen-records.test.js +44 -0
  534. package/dist/frontend/lowering/frozen-records.test.js.map +1 -0
  535. package/dist/frontend/lowering/function-names.d.ts +9 -0
  536. package/dist/frontend/lowering/function-names.js +95 -0
  537. package/dist/frontend/lowering/function-names.js.map +1 -0
  538. package/dist/frontend/lowering/function-returns.js +42 -13
  539. package/dist/frontend/lowering/function-returns.js.map +1 -1
  540. package/dist/frontend/lowering/general-streams.js +5 -0
  541. package/dist/frontend/lowering/general-streams.js.map +1 -1
  542. package/dist/frontend/lowering/generator-delegation.d.ts +15 -7
  543. package/dist/frontend/lowering/generator-delegation.js +301 -118
  544. package/dist/frontend/lowering/generator-delegation.js.map +1 -1
  545. package/dist/frontend/lowering/generic-functions.d.ts +75 -0
  546. package/dist/frontend/lowering/generic-functions.js +790 -18
  547. package/dist/frontend/lowering/generic-functions.js.map +1 -1
  548. package/dist/frontend/lowering/global-function-values.d.ts +25 -0
  549. package/dist/frontend/lowering/global-function-values.js +193 -0
  550. package/dist/frontend/lowering/global-function-values.js.map +1 -0
  551. package/dist/frontend/lowering/global-values.d.ts +15 -4
  552. package/dist/frontend/lowering/global-values.js +67 -9
  553. package/dist/frontend/lowering/global-values.js.map +1 -1
  554. package/dist/frontend/lowering/handle-properties.js +34 -1
  555. package/dist/frontend/lowering/handle-properties.js.map +1 -1
  556. package/dist/frontend/lowering/host-global-values.d.ts +31 -0
  557. package/dist/frontend/lowering/host-global-values.js +121 -0
  558. package/dist/frontend/lowering/host-global-values.js.map +1 -0
  559. package/dist/frontend/lowering/host-globals.d.ts +74 -0
  560. package/dist/frontend/lowering/host-globals.js +344 -0
  561. package/dist/frontend/lowering/host-globals.js.map +1 -0
  562. package/dist/frontend/lowering/http2-constants.js +1 -1
  563. package/dist/frontend/lowering/iterator-adapters.js +46 -17
  564. package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
  565. package/dist/frontend/lowering/iterator-prototype.d.ts +30 -0
  566. package/dist/frontend/lowering/iterator-prototype.js +160 -0
  567. package/dist/frontend/lowering/iterator-prototype.js.map +1 -0
  568. package/dist/frontend/lowering/key-order-witness.d.ts +54 -0
  569. package/dist/frontend/lowering/key-order-witness.js +571 -9
  570. package/dist/frontend/lowering/key-order-witness.js.map +1 -1
  571. package/dist/frontend/lowering/key-order-witness.test.js +1 -0
  572. package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
  573. package/dist/frontend/lowering/lib-boundary.js +25 -3
  574. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  575. package/dist/frontend/lowering/lower-assert.js +140 -16
  576. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  577. package/dist/frontend/lowering/lower-async-iteration.d.ts +11 -0
  578. package/dist/frontend/lowering/lower-async-iteration.js +15 -0
  579. package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
  580. package/dist/frontend/lowering/lower-builtin-values.d.ts +36 -6
  581. package/dist/frontend/lowering/lower-builtin-values.js +342 -58
  582. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
  583. package/dist/frontend/lowering/lower-calls.d.ts +47 -1
  584. package/dist/frontend/lowering/lower-calls.js +1354 -273
  585. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  586. package/dist/frontend/lowering/lower-calls.test.d.ts +1 -0
  587. package/dist/frontend/lowering/lower-calls.test.js +121 -0
  588. package/dist/frontend/lowering/lower-calls.test.js.map +1 -0
  589. package/dist/frontend/lowering/lower-classes.d.ts +36 -5
  590. package/dist/frontend/lowering/lower-classes.js +630 -89
  591. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  592. package/dist/frontend/lowering/lower-event-emitter.d.ts +15 -2
  593. package/dist/frontend/lowering/lower-event-emitter.js +610 -98
  594. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  595. package/dist/frontend/lowering/lower-exprs.d.ts +15 -1
  596. package/dist/frontend/lowering/lower-exprs.js +96 -20
  597. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  598. package/dist/frontend/lowering/lower-functions.js +27 -6
  599. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  600. package/dist/frontend/lowering/lower-generators.js +57 -10
  601. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  602. package/dist/frontend/lowering/lower-global-value.d.ts +6 -0
  603. package/dist/frontend/lowering/lower-global-value.js +14 -5
  604. package/dist/frontend/lowering/lower-global-value.js.map +1 -1
  605. package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
  606. package/dist/frontend/lowering/lower-inspect.js +713 -92
  607. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  608. package/dist/frontend/lowering/lower-modules.js +135 -27
  609. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  610. package/dist/frontend/lowering/lower-namespaces.js +18 -0
  611. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  612. package/dist/frontend/lowering/lower-node-island.d.ts +35 -4
  613. package/dist/frontend/lowering/lower-node-island.js +472 -67
  614. package/dist/frontend/lowering/lower-node-island.js.map +1 -1
  615. package/dist/frontend/lowering/lower-server.js +463 -96
  616. package/dist/frontend/lowering/lower-server.js.map +1 -1
  617. package/dist/frontend/lowering/lower-shared-modules.js +13 -1
  618. package/dist/frontend/lowering/lower-shared-modules.js.map +1 -1
  619. package/dist/frontend/lowering/lower-stdlib.d.ts +3 -2
  620. package/dist/frontend/lowering/lower-stdlib.js +77 -18
  621. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  622. package/dist/frontend/lowering/lower-stmts.d.ts +24 -4
  623. package/dist/frontend/lowering/lower-stmts.js +831 -136
  624. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  625. package/dist/frontend/lowering/lower-stream.js +126 -8
  626. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  627. package/dist/frontend/lowering/lower-timers.js +243 -48
  628. package/dist/frontend/lowering/lower-timers.js.map +1 -1
  629. package/dist/frontend/lowering/lower-url.js +6 -3
  630. package/dist/frontend/lowering/lower-url.js.map +1 -1
  631. package/dist/frontend/lowering/lowerer.d.ts +363 -21
  632. package/dist/frontend/lowering/lowerer.js +1224 -129
  633. package/dist/frontend/lowering/lowerer.js.map +1 -1
  634. package/dist/frontend/lowering/lowerer.test.js +19 -1
  635. package/dist/frontend/lowering/lowerer.test.js.map +1 -1
  636. package/dist/frontend/lowering/lowering-facts.d.ts +110 -0
  637. package/dist/frontend/lowering/lowering-facts.js +323 -0
  638. package/dist/frontend/lowering/lowering-facts.js.map +1 -0
  639. package/dist/frontend/lowering/lowering-facts.test.d.ts +1 -0
  640. package/dist/frontend/lowering/lowering-facts.test.js +100 -0
  641. package/dist/frontend/lowering/lowering-facts.test.js.map +1 -0
  642. package/dist/frontend/lowering/module-namespace-elements.js +15 -0
  643. package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
  644. package/dist/frontend/lowering/nan-coded-reads.d.ts +27 -4
  645. package/dist/frontend/lowering/nan-coded-reads.js +112 -9
  646. package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
  647. package/dist/frontend/lowering/new-target.js +2 -2
  648. package/dist/frontend/lowering/nullish-empty-pattern.d.ts +17 -0
  649. package/dist/frontend/lowering/nullish-empty-pattern.js +118 -0
  650. package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -0
  651. package/dist/frontend/lowering/optional-arguments.d.ts +4 -0
  652. package/dist/frontend/lowering/optional-arguments.js +26 -2
  653. package/dist/frontend/lowering/optional-arguments.js.map +1 -1
  654. package/dist/frontend/lowering/partial-assertions.d.ts +36 -0
  655. package/dist/frontend/lowering/partial-assertions.js +189 -0
  656. package/dist/frontend/lowering/partial-assertions.js.map +1 -0
  657. package/dist/frontend/lowering/primitive-throws.d.ts +100 -0
  658. package/dist/frontend/lowering/primitive-throws.js +241 -0
  659. package/dist/frontend/lowering/primitive-throws.js.map +1 -0
  660. package/dist/frontend/lowering/primitive-wrappers.d.ts +34 -0
  661. package/dist/frontend/lowering/primitive-wrappers.js +221 -0
  662. package/dist/frontend/lowering/primitive-wrappers.js.map +1 -0
  663. package/dist/frontend/lowering/private-statics.d.ts +46 -0
  664. package/dist/frontend/lowering/private-statics.js +322 -0
  665. package/dist/frontend/lowering/private-statics.js.map +1 -0
  666. package/dist/frontend/lowering/record-inherited.d.ts +17 -1
  667. package/dist/frontend/lowering/record-inherited.js +16 -2
  668. package/dist/frontend/lowering/record-inherited.js.map +1 -1
  669. package/dist/frontend/lowering/record-links.d.ts +73 -0
  670. package/dist/frontend/lowering/record-links.js +797 -0
  671. package/dist/frontend/lowering/record-links.js.map +1 -0
  672. package/dist/frontend/lowering/record-sources.d.ts +12 -1
  673. package/dist/frontend/lowering/record-sources.js +60 -0
  674. package/dist/frontend/lowering/record-sources.js.map +1 -1
  675. package/dist/frontend/lowering/runtime-optional-provenance.d.ts +27 -7
  676. package/dist/frontend/lowering/runtime-optional-provenance.js +25 -11
  677. package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
  678. package/dist/frontend/lowering/runtime-optional-report.d.ts +40 -0
  679. package/dist/frontend/lowering/runtime-optional-report.js +300 -0
  680. package/dist/frontend/lowering/runtime-optional-report.js.map +1 -0
  681. package/dist/frontend/lowering/scoped-type-memo.test.d.ts +1 -0
  682. package/dist/frontend/lowering/scoped-type-memo.test.js +86 -0
  683. package/dist/frontend/lowering/scoped-type-memo.test.js.map +1 -0
  684. package/dist/frontend/lowering/static-typeof.d.ts +3 -1
  685. package/dist/frontend/lowering/static-typeof.js +6 -1
  686. package/dist/frontend/lowering/static-typeof.js.map +1 -1
  687. package/dist/frontend/lowering/strict-equality.d.ts +4 -0
  688. package/dist/frontend/lowering/strict-equality.js +14 -0
  689. package/dist/frontend/lowering/strict-equality.js.map +1 -1
  690. package/dist/frontend/lowering/strict-mode.d.ts +1 -5
  691. package/dist/frontend/lowering/strict-mode.js +4 -30
  692. package/dist/frontend/lowering/strict-mode.js.map +1 -1
  693. package/dist/frontend/lowering/structural-instances.d.ts +7 -0
  694. package/dist/frontend/lowering/structural-instances.js +23 -0
  695. package/dist/frontend/lowering/structural-instances.js.map +1 -1
  696. package/dist/frontend/lowering/surfaces.d.ts +42 -1
  697. package/dist/frontend/lowering/surfaces.js +212 -71
  698. package/dist/frontend/lowering/surfaces.js.map +1 -1
  699. package/dist/frontend/lowering/union-retag.d.ts +13 -1
  700. package/dist/frontend/lowering/union-retag.js +55 -1
  701. package/dist/frontend/lowering/union-retag.js.map +1 -1
  702. package/dist/frontend/lowering/union-retag.test.js +51 -0
  703. package/dist/frontend/lowering/union-retag.test.js.map +1 -1
  704. package/dist/frontend/lowering/unit-journal.d.ts +136 -17
  705. package/dist/frontend/lowering/unit-journal.js +324 -53
  706. package/dist/frontend/lowering/unit-journal.js.map +1 -1
  707. package/dist/frontend/lowering/unit-journal.test.js +126 -3
  708. package/dist/frontend/lowering/unit-journal.test.js.map +1 -1
  709. package/dist/frontend/lowering/unit-reuse.d.ts +92 -0
  710. package/dist/frontend/lowering/unit-reuse.js +1008 -0
  711. package/dist/frontend/lowering/unit-reuse.js.map +1 -0
  712. package/dist/frontend/lowering/width-lift.d.ts +12 -0
  713. package/dist/frontend/lowering/zlib-constants.js +3 -2
  714. package/dist/frontend/lowering/zlib-constants.js.map +1 -1
  715. package/dist/frontend/npm-file-import.test.d.ts +1 -0
  716. package/dist/frontend/npm-file-import.test.js +76 -0
  717. package/dist/frontend/npm-file-import.test.js.map +1 -0
  718. package/dist/frontend/npm-static.js +95 -11
  719. package/dist/frontend/npm-static.js.map +1 -1
  720. package/dist/frontend/npm-static.test.js +95 -2
  721. package/dist/frontend/npm-static.test.js.map +1 -1
  722. package/dist/frontend/npm.d.ts +9 -0
  723. package/dist/frontend/npm.js +82 -0
  724. package/dist/frontend/npm.js.map +1 -1
  725. package/dist/frontend/pipeline-native.js +2 -1
  726. package/dist/frontend/pipeline-native.js.map +1 -1
  727. package/dist/frontend/pipeline.d.ts +9 -4
  728. package/dist/frontend/pipeline.js +162 -38
  729. package/dist/frontend/pipeline.js.map +1 -1
  730. package/dist/frontend/pipeline.test.js +68 -11
  731. package/dist/frontend/pipeline.test.js.map +1 -1
  732. package/dist/frontend/program-node.d.ts +3 -0
  733. package/dist/frontend/program-node.js +13 -6
  734. package/dist/frontend/program-node.js.map +1 -1
  735. package/dist/frontend/program.d.ts +71 -2
  736. package/dist/frontend/program.js +836 -411
  737. package/dist/frontend/program.js.map +1 -1
  738. package/dist/frontend/program.test.js +37 -1
  739. package/dist/frontend/program.test.js.map +1 -1
  740. package/dist/frontend/provenance-core.js +4 -0
  741. package/dist/frontend/provenance-core.js.map +1 -1
  742. package/dist/frontend/services-node.d.ts +7 -0
  743. package/dist/frontend/services-node.js +32 -1
  744. package/dist/frontend/services-node.js.map +1 -1
  745. package/dist/frontend/services-node.test.js +51 -0
  746. package/dist/frontend/services-node.test.js.map +1 -1
  747. package/dist/frontend/services.d.ts +14 -0
  748. package/dist/frontend/services.js +52 -2
  749. package/dist/frontend/services.js.map +1 -1
  750. package/dist/frontend/services.test.js +61 -1
  751. package/dist/frontend/services.test.js.map +1 -1
  752. package/dist/frontend/shape-inference/analyze.d.ts +5 -0
  753. package/dist/frontend/shape-inference/analyze.js +104 -4
  754. package/dist/frontend/shape-inference/analyze.js.map +1 -1
  755. package/dist/frontend/shape-inference/domain.js +0 -1
  756. package/dist/frontend/shape-inference/domain.js.map +1 -1
  757. package/dist/frontend/shape-inference/index.js +5 -1
  758. package/dist/frontend/shape-inference/index.js.map +1 -1
  759. package/dist/frontend/shape-inference/memo.d.ts +2 -1
  760. package/dist/frontend/shape-inference/memo.js +6 -2
  761. package/dist/frontend/shape-inference/memo.js.map +1 -1
  762. package/dist/frontend/shape-inference/overlay.d.ts +1 -1
  763. package/dist/frontend/shape-inference/overlay.js +184 -4
  764. package/dist/frontend/shape-inference/overlay.js.map +1 -1
  765. package/dist/frontend/shape-inference/static-objects.js +11 -6
  766. package/dist/frontend/shape-inference/static-objects.js.map +1 -1
  767. package/dist/frontend/source-phase-imports.test.d.ts +1 -0
  768. package/dist/frontend/source-phase-imports.test.js +37 -0
  769. package/dist/frontend/source-phase-imports.test.js.map +1 -0
  770. package/dist/frontend/tier-analysis.d.ts +9 -0
  771. package/dist/frontend/tier-analysis.js +1 -0
  772. package/dist/frontend/tier-analysis.js.map +1 -1
  773. package/dist/frontend/ts7/ast-node.d.ts +6 -1
  774. package/dist/frontend/ts7/ast-node.js +12 -0
  775. package/dist/frontend/ts7/ast-node.js.map +1 -1
  776. package/dist/frontend/ts7/ast-wire-protocols.test.js +11 -3
  777. package/dist/frontend/ts7/ast-wire-protocols.test.js.map +1 -1
  778. package/dist/frontend/ts7/ast-wire.js +3 -5
  779. package/dist/frontend/ts7/ast-wire.js.map +1 -1
  780. package/dist/frontend/ts7/checker-backend.d.ts +13 -0
  781. package/dist/frontend/ts7/checker-backend.js +84 -2
  782. package/dist/frontend/ts7/checker-backend.js.map +1 -1
  783. package/dist/frontend/ts7/checker-backend.test.js +126 -2
  784. package/dist/frontend/ts7/checker-backend.test.js.map +1 -1
  785. package/dist/frontend/ts7/program-host.d.ts +22 -1
  786. package/dist/frontend/ts7/program-host.js +49 -4
  787. package/dist/frontend/ts7/program-host.js.map +1 -1
  788. package/dist/frontend/ts7/program-host.test.js +83 -0
  789. package/dist/frontend/ts7/program-host.test.js.map +1 -1
  790. package/dist/frontend/ts7/rpc-process.d.ts +16 -1
  791. package/dist/frontend/ts7/rpc-process.js +170 -92
  792. package/dist/frontend/ts7/rpc-process.js.map +1 -1
  793. package/dist/frontend/ts7/rpc-process.test.js +49 -21
  794. package/dist/frontend/ts7/rpc-process.test.js.map +1 -1
  795. package/dist/frontend/tsc-codes.d.ts +57 -3
  796. package/dist/frontend/tsc-codes.js +956 -101
  797. package/dist/frontend/tsc-codes.js.map +1 -1
  798. package/dist/frontend/tsc-codes.test.js +221 -12
  799. package/dist/frontend/tsc-codes.test.js.map +1 -1
  800. package/dist/frontend/type-mapper.d.ts +98 -11
  801. package/dist/frontend/type-mapper.js +770 -182
  802. package/dist/frontend/type-mapper.js.map +1 -1
  803. package/dist/index.d.ts +1 -1
  804. package/dist/index.js +224 -15
  805. package/dist/index.js.map +1 -1
  806. package/dist/index.test.d.ts +1 -0
  807. package/dist/index.test.js +60 -0
  808. package/dist/index.test.js.map +1 -0
  809. package/dist/ir/api.d.ts +1 -1
  810. package/dist/ir/api.js +1 -1
  811. package/dist/ir/api.js.map +1 -1
  812. package/dist/ir/build.d.ts +3 -2
  813. package/dist/ir/build.js +4 -2
  814. package/dist/ir/build.js.map +1 -1
  815. package/dist/ir/builtin-effects.js +96 -0
  816. package/dist/ir/builtin-effects.js.map +1 -1
  817. package/dist/ir/builtin-signatures.d.ts +1 -1
  818. package/dist/ir/builtin-signatures.js +453 -26
  819. package/dist/ir/builtin-signatures.js.map +1 -1
  820. package/dist/ir/callback-specialization.d.ts +3 -2
  821. package/dist/ir/callback-specialization.js +35 -25
  822. package/dist/ir/callback-specialization.js.map +1 -1
  823. package/dist/ir/capture-values.d.ts +8 -4
  824. package/dist/ir/capture-values.js +9 -6
  825. package/dist/ir/capture-values.js.map +1 -1
  826. package/dist/ir/char-unit-locals.d.ts +6 -2
  827. package/dist/ir/char-unit-locals.js +11 -2
  828. package/dist/ir/char-unit-locals.js.map +1 -1
  829. package/dist/ir/class-key-index.d.ts +18 -0
  830. package/dist/ir/class-key-index.js +29 -0
  831. package/dist/ir/class-key-index.js.map +1 -0
  832. package/dist/ir/class-key-index.test.d.ts +1 -0
  833. package/dist/ir/class-key-index.test.js +25 -0
  834. package/dist/ir/class-key-index.test.js.map +1 -0
  835. package/dist/ir/codec.d.ts +82 -0
  836. package/dist/ir/codec.generated.d.ts +13 -0
  837. package/dist/ir/codec.generated.js +5350 -0
  838. package/dist/ir/codec.generated.js.map +1 -0
  839. package/dist/ir/codec.js +325 -0
  840. package/dist/ir/codec.js.map +1 -0
  841. package/dist/ir/codec.test.d.ts +1 -0
  842. package/dist/ir/codec.test.js +225 -0
  843. package/dist/ir/codec.test.js.map +1 -0
  844. package/dist/ir/constant-globals.d.ts +5 -2
  845. package/dist/ir/constant-globals.js +25 -27
  846. package/dist/ir/constant-globals.js.map +1 -1
  847. package/dist/ir/expression-inlining.d.ts +4 -2
  848. package/dist/ir/expression-inlining.js +8 -2
  849. package/dist/ir/expression-inlining.js.map +1 -1
  850. package/dist/ir/field-values.d.ts +5 -2
  851. package/dist/ir/field-values.js +32 -21
  852. package/dist/ir/field-values.js.map +1 -1
  853. package/dist/ir/fields.generated.d.ts +29 -10
  854. package/dist/ir/fields.generated.js +1039 -11
  855. package/dist/ir/fields.generated.js.map +1 -1
  856. package/dist/ir/fields.test.js +46 -2
  857. package/dist/ir/fields.test.js.map +1 -1
  858. package/dist/ir/final-fields.js +1 -1
  859. package/dist/ir/final-fields.js.map +1 -1
  860. package/dist/ir/function-references.d.ts +6 -4
  861. package/dist/ir/function-references.js +11 -4
  862. package/dist/ir/function-references.js.map +1 -1
  863. package/dist/ir/function-references.test.js +14 -0
  864. package/dist/ir/function-references.test.js.map +1 -1
  865. package/dist/ir/init-only-globals.d.ts +4 -2
  866. package/dist/ir/init-only-globals.js +17 -18
  867. package/dist/ir/init-only-globals.js.map +1 -1
  868. package/dist/ir/inline-array-sources.js +4 -1
  869. package/dist/ir/inline-array-sources.js.map +1 -1
  870. package/dist/ir/inline-array-views.d.ts +13 -0
  871. package/dist/ir/inline-array-views.js +945 -0
  872. package/dist/ir/inline-array-views.js.map +1 -0
  873. package/dist/ir/inline-arrays.d.ts +7 -0
  874. package/dist/ir/inline-arrays.js +190 -55
  875. package/dist/ir/inline-arrays.js.map +1 -1
  876. package/dist/ir/inline-arrays.test.js +140 -2
  877. package/dist/ir/inline-arrays.test.js.map +1 -1
  878. package/dist/ir/int32-slots.js +7 -0
  879. package/dist/ir/int32-slots.js.map +1 -1
  880. package/dist/ir/integer-ranges.js +16 -6
  881. package/dist/ir/integer-ranges.js.map +1 -1
  882. package/dist/ir/ir.d.ts +130 -44
  883. package/dist/ir/ir.js +7 -0
  884. package/dist/ir/ir.js.map +1 -1
  885. package/dist/ir/js-groups.d.ts +51 -0
  886. package/dist/ir/js-groups.js +394 -0
  887. package/dist/ir/js-groups.js.map +1 -0
  888. package/dist/ir/js-groups.test.d.ts +1 -0
  889. package/dist/ir/js-groups.test.js +555 -0
  890. package/dist/ir/js-groups.test.js.map +1 -0
  891. package/dist/ir/js-ic.d.ts +10 -9
  892. package/dist/ir/js-ic.js +58 -25
  893. package/dist/ir/js-ic.js.map +1 -1
  894. package/dist/ir/js-ic.test.js +37 -3
  895. package/dist/ir/js-ic.test.js.map +1 -1
  896. package/dist/ir/jsval.js +374 -63
  897. package/dist/ir/jsval.js.map +1 -1
  898. package/dist/ir/jsval.test.js +96 -2
  899. package/dist/ir/jsval.test.js.map +1 -1
  900. package/dist/ir/loop-entry-ranges.js +112 -9
  901. package/dist/ir/loop-entry-ranges.js.map +1 -1
  902. package/dist/ir/loop-entry-ranges.test.js +40 -0
  903. package/dist/ir/loop-entry-ranges.test.js.map +1 -1
  904. package/dist/ir/node-index.d.ts +23 -6
  905. package/dist/ir/node-index.js +126 -49
  906. package/dist/ir/node-index.js.map +1 -1
  907. package/dist/ir/numeric-call-specialization.d.ts +4 -2
  908. package/dist/ir/numeric-call-specialization.js +40 -26
  909. package/dist/ir/numeric-call-specialization.js.map +1 -1
  910. package/dist/ir/paired-while-loops.d.ts +4 -2
  911. package/dist/ir/paired-while-loops.js +8 -2
  912. package/dist/ir/paired-while-loops.js.map +1 -1
  913. package/dist/ir/parameter-versions.d.ts +13 -3
  914. package/dist/ir/parameter-versions.js +63 -40
  915. package/dist/ir/parameter-versions.js.map +1 -1
  916. package/dist/ir/property-bags.d.ts +4 -2
  917. package/dist/ir/property-bags.js +22 -17
  918. package/dist/ir/property-bags.js.map +1 -1
  919. package/dist/ir/receiver-readers.js +58 -2
  920. package/dist/ir/receiver-readers.js.map +1 -1
  921. package/dist/ir/row-pairs.d.ts +4 -2
  922. package/dist/ir/row-pairs.js +12 -11
  923. package/dist/ir/row-pairs.js.map +1 -1
  924. package/dist/ir/runtime-features.d.ts +139 -5
  925. package/dist/ir/runtime-features.js +397 -19
  926. package/dist/ir/runtime-features.js.map +1 -1
  927. package/dist/ir/runtime-features.test.js +135 -1
  928. package/dist/ir/runtime-features.test.js.map +1 -1
  929. package/dist/ir/runtime-jam-loops.d.ts +35 -0
  930. package/dist/ir/runtime-jam-loops.js +604 -0
  931. package/dist/ir/runtime-jam-loops.js.map +1 -0
  932. package/dist/ir/runtime-jam-loops.test.d.ts +1 -0
  933. package/dist/ir/runtime-jam-loops.test.js +565 -0
  934. package/dist/ir/runtime-jam-loops.test.js.map +1 -0
  935. package/dist/ir/saturating-loop-jams.d.ts +11 -2
  936. package/dist/ir/saturating-loop-jams.js +56 -16
  937. package/dist/ir/saturating-loop-jams.js.map +1 -1
  938. package/dist/ir/saturating-loop-jams.test.js +39 -1
  939. package/dist/ir/saturating-loop-jams.test.js.map +1 -1
  940. package/dist/ir/scalar-records.d.ts +5 -2
  941. package/dist/ir/scalar-records.js +12 -2
  942. package/dist/ir/scalar-records.js.map +1 -1
  943. package/dist/ir/self-captures.d.ts +4 -2
  944. package/dist/ir/self-captures.js +40 -28
  945. package/dist/ir/self-captures.js.map +1 -1
  946. package/dist/ir/self-captures.test.js +15 -0
  947. package/dist/ir/self-captures.test.js.map +1 -1
  948. package/dist/ir/serialize.d.ts +8 -2
  949. package/dist/ir/serialize.js +92 -24
  950. package/dist/ir/serialize.js.map +1 -1
  951. package/dist/ir/serialize.test.js +26 -0
  952. package/dist/ir/serialize.test.js.map +1 -1
  953. package/dist/ir/tiers.js +1 -0
  954. package/dist/ir/tiers.js.map +1 -1
  955. package/dist/ir/traverse.js +4 -0
  956. package/dist/ir/traverse.js.map +1 -1
  957. package/dist/ir/typed-argument-clones.d.ts +30 -0
  958. package/dist/ir/typed-argument-clones.js +789 -0
  959. package/dist/ir/typed-argument-clones.js.map +1 -0
  960. package/dist/ir/union-arm-loops.d.ts +3 -0
  961. package/dist/ir/union-arm-loops.js +373 -0
  962. package/dist/ir/union-arm-loops.js.map +1 -0
  963. package/dist/ir/union-arm-loops.test.d.ts +1 -0
  964. package/dist/ir/union-arm-loops.test.js +230 -0
  965. package/dist/ir/union-arm-loops.test.js.map +1 -0
  966. package/dist/ir/validate.js +170 -22
  967. package/dist/ir/validate.js.map +1 -1
  968. package/dist/ir/validate.test.js +46 -0
  969. package/dist/ir/validate.test.js.map +1 -1
  970. package/dist/library/compiler-self-identity.d.ts +8 -2
  971. package/dist/library/compiler-self-identity.js +92 -18
  972. package/dist/library/compiler-self-identity.js.map +1 -1
  973. package/dist/library/compiler-self-identity.test.js +150 -3
  974. package/dist/library/compiler-self-identity.test.js.map +1 -1
  975. package/dist/library/int-infer.d.ts +5 -0
  976. package/dist/library/int-infer.js +15 -3
  977. package/dist/library/int-infer.js.map +1 -1
  978. package/dist/library/ir-policy.js +4 -0
  979. package/dist/library/ir-policy.js.map +1 -1
  980. package/dist/library/library-cache.d.ts +4 -0
  981. package/dist/library/library-cache.js +2 -0
  982. package/dist/library/library-cache.js.map +1 -1
  983. package/dist/library/library-cache.test.js +26 -0
  984. package/dist/library/library-cache.test.js.map +1 -1
  985. package/dist/library/prepare.js +99 -31
  986. package/dist/library/prepare.js.map +1 -1
  987. package/dist/native/cache.d.ts +7 -0
  988. package/dist/native/cache.js +49 -0
  989. package/dist/native/cache.js.map +1 -1
  990. package/dist/native/cache.test.js +13 -1
  991. package/dist/native/cache.test.js.map +1 -1
  992. package/dist/native/cli.js +2 -0
  993. package/dist/native/cli.js.map +1 -1
  994. package/dist/native/compiler.js +26 -5
  995. package/dist/native/compiler.js.map +1 -1
  996. package/dist/native/executable-cache-open.test.js +31 -5
  997. package/dist/native/executable-cache-open.test.js.map +1 -1
  998. package/dist/native/executable-cache.d.ts +6 -1
  999. package/dist/native/executable-cache.js +7 -1
  1000. package/dist/native/executable-cache.js.map +1 -1
  1001. package/dist/native/prepare.d.ts +3 -0
  1002. package/dist/native/prepare.js +74 -28
  1003. package/dist/native/prepare.js.map +1 -1
  1004. package/dist/native/prepare.test.js +25 -3
  1005. package/dist/native/prepare.test.js.map +1 -1
  1006. package/dist/native/sanitizer.js +63 -4
  1007. package/dist/native/sanitizer.js.map +1 -1
  1008. package/dist/native/sanitizer.test.js +93 -2
  1009. package/dist/native/sanitizer.test.js.map +1 -1
  1010. package/dist/native/toolchain.js +9 -2
  1011. package/dist/native/toolchain.js.map +1 -1
  1012. package/dist/node-islands/boundary.d.ts +37 -1
  1013. package/dist/node-islands/boundary.js +65 -7
  1014. package/dist/node-islands/boundary.js.map +1 -1
  1015. package/dist/node-islands/boundary.test.d.ts +1 -0
  1016. package/dist/node-islands/boundary.test.js +76 -0
  1017. package/dist/node-islands/boundary.test.js.map +1 -0
  1018. package/dist/node-islands/detect.d.ts +27 -1
  1019. package/dist/node-islands/detect.js +475 -40
  1020. package/dist/node-islands/detect.js.map +1 -1
  1021. package/dist/node-islands/detect.test.js +175 -4
  1022. package/dist/node-islands/detect.test.js.map +1 -1
  1023. package/dist/node-islands/effect-gate.js +30 -20
  1024. package/dist/node-islands/effect-gate.js.map +1 -1
  1025. package/dist/node-islands/effect-gate.test.js +4 -1
  1026. package/dist/node-islands/effect-gate.test.js.map +1 -1
  1027. package/dist/node-islands/graph-islands.d.ts +40 -0
  1028. package/dist/node-islands/graph-islands.js +128 -0
  1029. package/dist/node-islands/graph-islands.js.map +1 -0
  1030. package/dist/node-islands/growth.d.ts +57 -0
  1031. package/dist/node-islands/growth.js +205 -0
  1032. package/dist/node-islands/growth.js.map +1 -0
  1033. package/dist/node-islands/libnode.d.ts +1 -1
  1034. package/dist/node-islands/libnode.js +1 -1
  1035. package/dist/node-islands/libnode.js.map +1 -1
  1036. package/dist/node-islands/modules.d.ts +28 -0
  1037. package/dist/node-islands/modules.js +156 -0
  1038. package/dist/node-islands/modules.js.map +1 -1
  1039. package/dist/node-islands/modules.test.js +105 -1
  1040. package/dist/node-islands/modules.test.js.map +1 -1
  1041. package/dist/node-islands/policy.js +2 -3
  1042. package/dist/node-islands/policy.js.map +1 -1
  1043. package/dist/node-islands/probe-recorder.d.ts +1 -0
  1044. package/dist/node-islands/probe-recorder.js +596 -0
  1045. package/dist/node-islands/probe-recorder.js.map +1 -0
  1046. package/dist/node-islands/probe-recorder.test.d.ts +1 -0
  1047. package/dist/node-islands/probe-recorder.test.js +80 -0
  1048. package/dist/node-islands/probe-recorder.test.js.map +1 -0
  1049. package/dist/node-islands/report.d.ts +12 -0
  1050. package/dist/node-islands/report.js +28 -0
  1051. package/dist/node-islands/report.js.map +1 -1
  1052. package/dist/node-islands/report.test.js +4 -0
  1053. package/dist/node-islands/report.test.js.map +1 -1
  1054. package/dist/node-islands/rules.js +9 -0
  1055. package/dist/node-islands/rules.js.map +1 -1
  1056. package/dist/node-islands/scan.d.ts +16 -1
  1057. package/dist/node-islands/scan.js +110 -9
  1058. package/dist/node-islands/scan.js.map +1 -1
  1059. package/dist/node-islands/snapshot.d.ts +38 -1
  1060. package/dist/node-islands/snapshot.js +165 -161
  1061. package/dist/node-islands/snapshot.js.map +1 -1
  1062. package/dist/node-islands/snapshot.test.js +63 -2
  1063. package/dist/node-islands/snapshot.test.js.map +1 -1
  1064. package/dist/node-islands/summary.js +8 -0
  1065. package/dist/node-islands/summary.js.map +1 -1
  1066. package/dist/node-islands/type-strip.d.ts +11 -0
  1067. package/dist/node-islands/type-strip.js +157 -0
  1068. package/dist/node-islands/type-strip.js.map +1 -0
  1069. package/dist/node-islands/type-strip.test.d.ts +1 -0
  1070. package/dist/node-islands/type-strip.test.js +31 -0
  1071. package/dist/node-islands/type-strip.test.js.map +1 -0
  1072. package/dist/project-config.d.ts +4 -0
  1073. package/dist/project-config.js +19 -0
  1074. package/dist/project-config.js.map +1 -1
  1075. package/dist/project-config.test.js +10 -0
  1076. package/dist/project-config.test.js.map +1 -1
  1077. package/dist/wasm/translate.js +11 -5
  1078. package/dist/wasm/translate.js.map +1 -1
  1079. package/dist/wasm/translate.test.js +35 -0
  1080. package/dist/wasm/translate.test.js.map +1 -1
  1081. package/package.json +20 -20
  1082. package/surface-manifest.json +221 -122
@@ -42,6 +42,7 @@ import { isFrontendIsland } from "../node-islands/boundary.js";
42
42
  import { builtinModules } from "node:module";
43
43
  import { dirname, isAbsolute, resolve } from "node:path";
44
44
  import * as ts from "./ts7/adapter.js";
45
+ import { isSourcePhaseImport } from "./ts7/ast-node.js";
45
46
  import { commonJsModuleSyntaxDiag, invalidPackageConfigDiag, strictNullChecksFloorDiag, tscPassthroughDiag, unsupportedDiag, } from "../diagnostics/diagnostic.js";
46
47
  import { isNodeModulesPath, nearestInvalidPackageJsonPath, nearestPackageType, nearestPkgJsonPath, packageImportTarget, projectDtsRuntimeSibling, resolveBareModule, resolveProjectModule, resolveTypeDirective, setProjectPathMappings, setProjectRealm, } from "./resolve.js";
47
48
  import { probeNodeImportRefusal, probeNodeRequireRefusal } from "./npm.js";
@@ -56,8 +57,9 @@ import { cjsLexedExportsOfFile, cjsVisibleNames } from "./cjs-syntax.js";
56
57
  import { ambientDtsPath, fallbackDtsPath, fallbackModulesNamedIn, isFallbackDtsPath, isNodeTypesPath, overridesDtsPath, tsgoPath, } from "./dts-paths.js";
57
58
  import { builtinDefaultImportModule, canonicalBuiltinModule, npmBuiltinAliasOf, SUPPORTED_NODE_MODULES, unsupportedModuleFeatureOf, TEMPORAL_GLOBAL, } from "./builtin-modules.js";
58
59
  import { clearWorkspacePackages, isRelativeSpecifier, isWorkspacePackageName, npmPackageNameOf, packageNameOfSpecifier, registerWorkspacePackage, workspacePackageOfPath, } from "./workspace-registry.js";
59
- import { ADOPTED_OPTIONS, isJsSourceFileName, JS_ANY_OPERATOR_CODES, JS_RELAXED_TSC_CODES, } from "./tsc-codes.js";
60
+ import { ADOPTED_OPTIONS, isJsSourceFileName, jsOpinion, jsTscCodeTriage, } from "./tsc-codes.js";
60
61
  import { trackedFileExists, trackedReadFile, trackedRealpath } from "./input-tracker.js";
62
+ import { earlyErrorDiagnostics7 } from "./early-errors.js";
61
63
  import { forkTargetPaths } from "./fork-target.js";
62
64
  import { workerTargetPaths } from "./worker-target.js";
63
65
  import { erasedTypeOnlyImport, typeOnlyNamedImport, typeOnlyReachedFiles, } from "./type-only-imports.js";
@@ -66,6 +68,7 @@ import { planDeclProjection, resetDeclBoundaryOrigins, } from "./decl-projection
66
68
  import { configureTypePatches, packageSourceText } from "./type-patches/layer.js";
67
69
  import { resetDeclOriginVersions } from "./lowering/decl-origin.js";
68
70
  import { reportShapes, resetShapeOverlay, shapeOverlayDone, shapeOverlayEnabled, shapeOverlayer, captureShapeOverlayState, } from "./shape-inference/index.js";
71
+ import { jsInferenceEnabled } from "./js-inference.js";
69
72
  import { inferredJsDiagnosticSuppressed } from "./inferred-js-diagnostics.js";
70
73
  import { containsJsx, firstJsx, jsxEmitName, jsxEmitPlan, jsxPragmas, lowerJsx, } from "./jsx-source.js";
71
74
  const BASE_OPTIONS = {
@@ -704,7 +707,8 @@ overlayer) {
704
707
  if (extraRoots.length === 0)
705
708
  break;
706
709
  program.dispose();
707
- programRoots.push(...extraRoots);
710
+ for (const root of extraRoots)
711
+ programRoots.push(root);
708
712
  program = host.createProgram([...programRoots, overridesDtsPath()], options);
709
713
  if (pass === 31)
710
714
  throw new Error("static program-root discovery did not converge");
@@ -1095,7 +1099,10 @@ export function loadProgram(entryPath, services, opts) {
1095
1099
  // of the same build, which preflight can create after the overlay
1096
1100
  // rounds, so it leaves the registry as this load set it.
1097
1101
  resetShapeOverlay();
1098
- const load = loadProgram7(host, entryPath, externalTypes, npmStaticPackages.length > 0, projector, npmStaticPackages.length > 0 && shapeOverlayEnabled() ? shapeOverlayer : undefined);
1102
+ const load = loadProgram7(host, entryPath, externalTypes, npmStaticPackages.length > 0, projector, (npmStaticPackages.length > 0 && shapeOverlayEnabled()) ||
1103
+ (jsInferenceEnabled() && process.env["SCRIPTC_SHAPE_OVERLAY"] !== "0")
1104
+ ? shapeOverlayer
1105
+ : undefined);
1099
1106
  // Shape inference, stage S1: a report only (SCRIPTC_DEBUG_SHAPES).
1100
1107
  const shapes = process.env["SCRIPTC_DEBUG_SHAPES"];
1101
1108
  if (shapes !== undefined && shapes !== "" && shapes !== "0" && npmStaticPackages.length > 0)
@@ -1166,63 +1173,103 @@ function declBoundaryDroppedDiag(file) {
1166
1173
  * preflight diagnostics. Preserve the caller's complete load shape when
1167
1174
  * mutating it, including its owned services and disposal callback. */
1168
1175
  export function checkPreflight(load) {
1169
- const { diags, moduleOrder, startupCrash, inlineRequireCycleCalls, moduleEdges, dynamicImportRejections, } = preflight7(load);
1176
+ const { diags, moduleOrder, startupCrash, inlineRequireCycleCalls, moduleEdges, dynamicImportRejections, admittedOpinions, } = preflight7(load);
1170
1177
  load.moduleOrder = moduleOrder;
1171
1178
  load.startupCrash = startupCrash;
1172
1179
  load.inlineRequireCycleCalls = inlineRequireCycleCalls;
1173
1180
  load.moduleEdges = moduleEdges;
1174
1181
  load.dynamicImportRejections = dynamicImportRejections;
1182
+ load.admittedOpinions = admittedOpinions;
1183
+ // Measurement aid: prints every opinion site this preflight admitted, so a
1184
+ // corpus run can show which rows carry evidence (SCRIPTC_DEBUG_ADMITTED=1).
1185
+ // Silent by default; no lowering reads the set.
1186
+ if (process.env["SCRIPTC_DEBUG_ADMITTED"] === "1")
1187
+ for (const site of admittedOpinions)
1188
+ process.stderr.write(`scriptc admitted TS${site.code} ${site.view} ${site.file}:${site.pos}-${site.end}\n`);
1175
1189
  return diags;
1176
1190
  }
1177
- /* Finding 5: tsgo's strict CommonJS modeling fires checker codes on JS
1178
- * shapes 5.9.3 accepted, and the real hazards those shapes carry are fenced
1179
- * by scriptc's OWN analysis, never by these codes — so for JS FILES ONLY
1180
- * they join the relaxation (TS sources keep the full gate; the order-parity
1181
- * harness holds both lanes to identical verdicts, so a case where 5.9.3
1182
- * itself raises one of these on a JS file would fail there, not slip by):
1183
- * - TS2309 ("export assignment with other exported elements") on the
1184
- * table-then-member pattern — cjsExportDiscardReason names every export
1185
- * Node actually discards.
1186
- * - TS2323 ("cannot redeclare exported variable") on symbol-keyed expando
1187
- * assignments in CJS classes (`this[kSym] = v` under `module.exports =
1188
- * Class`) — 5.9.3 synthesized expando symbols, tsgo trips its
1189
- * redeclaration check instead (the corpus's countdown fixture). */
1190
- // Ordinary JavaScript functions are constructable even when the checker
1191
- // retains only their call signature after a factory return. Heritage
1192
- // lowering separately verifies the actual constructor implementation.
1193
- const TS7_JS_RELAXED_EXTRA = new Set([2309, 2323, 2507]);
1194
- /** Relaxed JavaScript codes that checked JavaScript files keep: values of
1195
- * another type in a typed slot (2322 and its elaborations 2740/2741/2559,
1196
- * 2345, 2769), call arity (2554-2556) and incompatible subclass members
1197
- * (2415). */
1198
- const CHECKED_JS_ENFORCED_CODES = new Set([
1199
- 2322, 2345, 2415, 2554, 2555, 2556, 2559, 2740, 2741, 2769,
1200
- ]);
1201
- function suppressedJsStrictness7(d) {
1202
- const file = d.fileName;
1203
- if (!file || !isJsSourceFileName(file))
1204
- return false;
1205
- if (JS_RELAXED_TSC_CODES.has(d.code) || TS7_JS_RELAXED_EXTRA.has(d.code))
1206
- return true;
1207
- // The 8xxx range is TypeScript's JSDoc-specific diagnostic family
1208
- // (malformed tags, signature/tag mismatches): comment semantics with no
1209
- // runtime meaning in a JS file.
1210
- if (d.code >= 8000 && d.code <= 8999)
1211
- return true;
1212
- if (JS_ANY_OPERATOR_CODES.has(d.code)) {
1213
- return ts.flattenDiagnosticMessageText(d, "\n").includes("'any'");
1214
- }
1215
- // The deprecated Buffer(...) call without `new`, which Node's Buffer
1216
- // function accepts (containers/bytes.ts lowers it), and fs.ReadStream(...)
1217
- // and fs.WriteStream(...), which construct their stream
1218
- // (builtins/fs-streams.ts).
1219
- if (d.code === 2348) {
1220
- const text = ts.flattenDiagnosticMessageText(d, "\n");
1221
- return (text.includes("'BufferConstructor'") ||
1222
- text.includes("'typeof ReadStream'") ||
1223
- text.includes("'typeof WriteStream'"));
1191
+ /** The module evaluation order and the graph facts derived with it, without
1192
+ * the diagnostics. `--npm-static`'s library fixpoint reloads the program
1193
+ * once per package it discovers and reads the order alone (to find the next
1194
+ * package); only the last program's diagnostics are ever reported, and its
1195
+ * checkPreflight completes this walk instead of repeating it. */
1196
+ export function checkModuleOrder(load) {
1197
+ registerWorkspaceEdges(load);
1198
+ fillPreflightFields(load, preflightStructure(load));
1199
+ }
1200
+ function fillPreflightFields(load, structure) {
1201
+ load.moduleOrder = structure.order;
1202
+ load.inlineRequireCycleCalls = structure.inlineRequireCycleCalls;
1203
+ load.moduleEdges = structure.moduleEdges;
1204
+ load.dynamicImportRejections = structure.dynamicImportRejections;
1205
+ }
1206
+ /** The innermost node whose token span contains [pos, end): the node an
1207
+ * opinion row's site guard inspects, and the one `island` rows ask about
1208
+ * (a diagnostic carries no node). */
1209
+ function diagnosticNode7(sf, pos, end) {
1210
+ let node = sf;
1211
+ // The lowering's nesting fence is 200 levels; a recovered AST is never
1212
+ // deeper than that on the path to one diagnostic.
1213
+ for (let depth = 0; depth < 200; depth++) {
1214
+ let next;
1215
+ ts.forEachChild(node, (child) => {
1216
+ if (ts.tokenStartOfNode(child) <= pos && end <= child.end) {
1217
+ next = child;
1218
+ return true;
1219
+ }
1220
+ return undefined;
1221
+ });
1222
+ if (next === undefined)
1223
+ break;
1224
+ node = next;
1224
1225
  }
1225
- return false;
1226
+ return node;
1227
+ }
1228
+ /** The JS_OPINIONS admission for one checker diagnostic (tsc-codes.ts), or
1229
+ * null when the diagnostic stays. Five conditions, in order:
1230
+ *
1231
+ * 1. the file is a JavaScript source (never .ts/.mts/.cts/.tsx/.d.ts);
1232
+ * 2. a row admits the code, and the file is unchecked JavaScript unless the
1233
+ * row is one a checked project has always seen (`checkedJs: "enforce"`);
1234
+ * 3. the diagnostic is a checker diagnostic, not a parser one (a syntactic
1235
+ * diagnostic leaves a recovered AST);
1236
+ * 4. the row's site guard accepts the diagnostic's node, if it has one;
1237
+ * 5. an `island` row does not apply in strict code (scriptc's own
1238
+ * isStrictCode, never tsc's module opinion).
1239
+ *
1240
+ * Admission says nothing about the LOWERING: the caller records the site
1241
+ * (AdmittedOpinion) so a view's lowering path can be gated on it. */
1242
+ function jsOpinionOf7(p, d, projectCheckJs, syntacticOf) {
1243
+ if (d.fileName === undefined || !isJsSourceFileName(d.fileName))
1244
+ return null;
1245
+ const opinion = jsOpinion(d.code);
1246
+ if (opinion === null)
1247
+ return null;
1248
+ const sf = p.getSourceFile(d.fileName);
1249
+ if (sf !== undefined &&
1250
+ opinion.checkedJs === "enforce" &&
1251
+ isCheckedJsSourceFile(sf, projectCheckJs))
1252
+ return null;
1253
+ const pos = d.pos;
1254
+ const end = d.end;
1255
+ const spanless = pos === undefined || end === undefined;
1256
+ // A diagnostic with no span, or one that names a file the program does
1257
+ // not carry, cannot be placed in the AST. A row with no node guard needs
1258
+ // no node, so the admission applies exactly as it always has; the caller
1259
+ // records nothing (there is no site a view could be gated on).
1260
+ const nodeFree = opinion.site === undefined && opinion.view !== "island";
1261
+ if (spanless || sf === undefined)
1262
+ return nodeFree ? opinion : null;
1263
+ if (syntacticOf(sf).some((s) => s.code === d.code && s.pos === pos && s.end === end))
1264
+ return null;
1265
+ if (nodeFree)
1266
+ return opinion;
1267
+ const node = diagnosticNode7(sf, pos, end);
1268
+ if (opinion.site !== undefined && !opinion.site(node, d))
1269
+ return null;
1270
+ if (opinion.view === "island" && isStrictCode(node))
1271
+ return null;
1272
+ return opinion;
1226
1273
  }
1227
1274
  /** The specifier of a `require("...")` call: the callee is the bare
1228
1275
  * identifier `require` and the single argument a string literal. The one
@@ -2398,6 +2445,96 @@ function isAssignmentTarget7(node) {
2398
2445
  parent.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
2399
2446
  parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment);
2400
2447
  }
2448
+ /** True when the identifier is a reference position that WRITES: an
2449
+ * assignment (or compound-assignment) target, a `++`/`--` operand, a
2450
+ * for-in/for-of head, or an element of a destructuring pattern — through
2451
+ * parentheses and pattern containers, exactly the shapes a sloppy-mode
2452
+ * implicit global can be introduced by. */
2453
+ export function isJsWriteTarget7(node) {
2454
+ let cur = node;
2455
+ for (;;) {
2456
+ const parent = cur.parent;
2457
+ if (parent === undefined)
2458
+ return false;
2459
+ if (ts.isParenthesizedExpression(parent)) {
2460
+ cur = parent;
2461
+ continue;
2462
+ }
2463
+ if (ts.isBinaryExpression(parent))
2464
+ return (parent.left === cur &&
2465
+ parent.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
2466
+ parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment);
2467
+ if (ts.isPrefixUnaryExpression(parent) || ts.isPostfixUnaryExpression(parent))
2468
+ return (parent.operand === cur &&
2469
+ (parent.operator === ts.SyntaxKind.PlusPlusToken ||
2470
+ parent.operator === ts.SyntaxKind.MinusMinusToken));
2471
+ if (ts.isForInStatement(parent) || ts.isForOfStatement(parent))
2472
+ return parent.initializer === cur;
2473
+ if (ts.isArrayLiteralExpression(parent) || ts.isObjectLiteralExpression(parent)) {
2474
+ cur = parent;
2475
+ continue;
2476
+ }
2477
+ if ((ts.isShorthandPropertyAssignment(parent) && parent.name === cur) ||
2478
+ (ts.isPropertyAssignment(parent) && parent.initializer === cur) ||
2479
+ ((ts.isSpreadElement(parent) || ts.isSpreadAssignment(parent)) && parent.expression === cur)) {
2480
+ cur = parent;
2481
+ continue;
2482
+ }
2483
+ return false;
2484
+ }
2485
+ }
2486
+ /** Nothing binds `node`: the tsc had no symbol, and a shorthand pattern's
2487
+ * name has no VALUE binding either (its property symbol is the target, not a
2488
+ * declaration of the name being written). */
2489
+ function undeclaredJsName7(checker, node) {
2490
+ const parent = node.parent;
2491
+ if (parent !== undefined && ts.isShorthandPropertyAssignment(parent) && parent.name === node)
2492
+ return checker.getShorthandAssignmentValueSymbol(parent) === undefined;
2493
+ return checker.getSymbolAtLocation(node) === undefined;
2494
+ }
2495
+ /** A `.js` WRITE to a name nothing declares (plan D-2/D-5). Sloppy mode
2496
+ * resolves such a write by creating a property on Node's global object —
2497
+ * process-wide state a native binary has no object for — so the program is
2498
+ * refused at build time, under SC1091, whose text names the Node-island
2499
+ * route those semantics need. A READ of the same name is admitted instead:
2500
+ * it throws Node's own catchable `ReferenceError` at the access
2501
+ * (lowering/expressions/identifiers.ts). TypeScript input never reaches
2502
+ * either path — an undeclared name is a compile error there. */
2503
+ function jsUndeclaredWriteDiags(program, files) {
2504
+ const diags = [];
2505
+ const checker = program.getTypeChecker();
2506
+ for (const sf of files) {
2507
+ if (!isJsSourceFileName(sf.fileName))
2508
+ continue;
2509
+ const stack = [sf];
2510
+ while (stack.length > 0) {
2511
+ const node = stack.pop();
2512
+ // An empty name is a parse-recovery artifact (`@import x = require(…)`
2513
+ // in a JSDoc prologue leaves one behind), never a reference a program
2514
+ // writes; the syntax error that created it is already reported.
2515
+ if (ts.isIdentifier(node) &&
2516
+ node.text !== "" &&
2517
+ isJsWriteTarget7(node) &&
2518
+ undeclaredJsName7(checker, node)) {
2519
+ const sloppyWrite = !isStrictCode(node);
2520
+ const diag = unsupportedDiag("SC1091", { file: sf.fileName, start: node.getStart(sf), end: node.end }, `writing the undeclared name '${node.text}' in a JavaScript source`);
2521
+ // A sloppy-mode write creates the global at run time, a sloppy-only
2522
+ // semantic the native tier does not implement: the reason lets an
2523
+ // automatic island policy put this module in a Node island instead
2524
+ // of refusing the build. A strict-mode write throws ReferenceError,
2525
+ // which is an ordinary lowering gap and stays a plain refusal.
2526
+ if (sloppyWrite)
2527
+ diag.reason = "implicit-global-write";
2528
+ diags.push(diag);
2529
+ }
2530
+ ts.forEachChild(node, (child) => {
2531
+ stack.push(child);
2532
+ return undefined;
2533
+ });
2534
+ }
2535
+ }
2536
+ return diags;
2537
+ }
2401
2538
  /** True when `node` is inside the try block of a try statement in the same
2402
2539
  * function (a catch clause or finally block does not count). A class field
2403
2540
  * initializer runs when the class is instantiated, so it is a boundary too. */
@@ -2690,6 +2827,36 @@ function isCjsJsFile7(sf, program) {
2690
2827
  export function isCjsJsFile(sf, program) {
2691
2828
  return isCjsJsFile7(sf, program);
2692
2829
  }
2830
+ function hasUseStrictDirective(statements) {
2831
+ for (const statement of statements) {
2832
+ if (!ts.isExpressionStatement(statement) || !ts.isStringLiteral(statement.expression))
2833
+ return false;
2834
+ if (statement.expression.text === "use strict")
2835
+ return true;
2836
+ }
2837
+ return false;
2838
+ }
2839
+ /** Whether `node` runs in strict mode code: inside a class body, a function
2840
+ * with a "use strict" directive, a module, or a script that starts with
2841
+ * "use strict". CommonJS JavaScript is sloppy otherwise; the sloppy-only
2842
+ * semantics (implicit globals, `with`, direct eval, Annex B) need a Node
2843
+ * island. */
2844
+ export function isStrictCode(node) {
2845
+ for (let parent = node.parent; parent; parent = parent.parent) {
2846
+ if (ts.isClassDeclaration(parent) || ts.isClassExpression(parent))
2847
+ return true;
2848
+ if (ts.isFunctionLike(parent) &&
2849
+ parent.body &&
2850
+ ts.isBlock(parent.body) &&
2851
+ hasUseStrictDirective(parent.body.statements.nodes))
2852
+ return true;
2853
+ if (ts.isSourceFile(parent)) {
2854
+ return (hasUseStrictDirective(parent.statements.nodes) ||
2855
+ (!isCjsJsFile7(parent) && (isNodeEsmFile7(parent) || ts.isExternalModule(parent))));
2856
+ }
2857
+ }
2858
+ return false;
2859
+ }
2693
2860
  /** The self-import TDZ fences: for `import { x } from "<self>"` (default
2694
2861
  * and namespace forms included), any TOP-LEVEL reference lexically above
2695
2862
  * the aliased declaration observes Node's temporal dead zone — the direct
@@ -4107,7 +4274,8 @@ function cycleReachedDeferredReferences7(program, evaluation, candidates) {
4107
4274
  continue;
4108
4275
  const units = unitsOfName.get(name);
4109
4276
  unitsBySymbol.set(symbol, [...(unitsBySymbol.get(symbol) ?? []), ...units]);
4110
- allUnits.push(...units);
4277
+ for (const unit of units)
4278
+ allUnits.push(unit);
4111
4279
  }
4112
4280
  // A named class expression's inner name (`class Impl { static x =
4113
4281
  // Impl.m(); }`) names the class inside its own body, as the binding it
@@ -4295,7 +4463,8 @@ export function moduleEarlyBindings(program, order) {
4295
4463
  for (const sf of order) {
4296
4464
  if (sf.isDeclarationFile || exact.has(sf))
4297
4465
  continue;
4298
- out.push(...moduleEarlyBindingsOf7(program, sf, order));
4466
+ for (const binding of moduleEarlyBindingsOf7(program, sf, order))
4467
+ out.push(binding);
4299
4468
  }
4300
4469
  program.analysis.moduleEarlyBindings = { key, bindings: out };
4301
4470
  return out;
@@ -4795,13 +4964,18 @@ function typeOnlyNamespace7(decl) {
4795
4964
  * program, or null (unresolvable / outside the program). Exported (as
4796
4965
  * resolveImport) for the lowering: CommonJS require statements lower to
4797
4966
  * guarded %init calls of exactly the module preflight resolved here. */
4798
- function resolveImport7(program, from, specifier, resolutionKind = "import") {
4967
+ function resolveImport7(program, from, specifier, resolutionKind = "import",
4968
+ /** False for the graph passes that over-approximate edges (see
4969
+ * `resolveRuntimeEdge`): they resolve specifiers Node may never load, so
4970
+ * a miss there is no evidence about the package's entry and must not
4971
+ * classify it. The walks that model real loads pass the default. */
4972
+ reportMiss = true) {
4799
4973
  const resolved = resolveProjectModule(from.fileName, specifier);
4800
4974
  if (resolved !== null)
4801
4975
  return program.getSourceFile(resolved) ?? null;
4802
4976
  const npm = resolveNpmImport7(from.fileName, specifier, resolutionKind);
4803
4977
  return npm && isNpmStaticPackage(npm.packageName)
4804
- ? npmStaticProgramDep(program, npm.packageName, npm.typesFile)
4978
+ ? npmStaticProgramDep(program, npm.packageName, npm.typesFile, reportMiss)
4805
4979
  : null;
4806
4980
  }
4807
4981
  function resolveNpmImport7(fromFileName, specifier, resolutionKind = "import") {
@@ -4871,14 +5045,16 @@ function npmStaticProgramFile(program, resolvedFile) {
4871
5045
  * entry maps to, or null with the package marked an offender (resolution
4872
5046
  * still answering declarations, or the file missing from the type-checked
4873
5047
  * program — a path-identity mismatch between the two resolvers). */
4874
- function npmStaticProgramDep(program, packageName, resolvedFile) {
5048
+ function npmStaticProgramDep(program, packageName, resolvedFile, reportMiss = true) {
4875
5049
  if (!isJsSourceFileName(resolvedFile)) {
4876
- reportNpmStaticOffender(packageName, `its import resolves to '${resolvedFile}', not to runtime JavaScript`);
5050
+ if (reportMiss)
5051
+ reportNpmStaticOffender(packageName, `its import resolves to '${resolvedFile}', not to runtime JavaScript`);
4877
5052
  return null;
4878
5053
  }
4879
5054
  const dep = npmStaticProgramFile(program, resolvedFile);
4880
5055
  if (dep === null) {
4881
- reportNpmStaticOffender(packageName, `its entry '${resolvedFile}' did not join the type-checked program`);
5056
+ if (reportMiss)
5057
+ reportNpmStaticOffender(packageName, `its entry '${resolvedFile}' did not join the type-checked program`);
4882
5058
  return null;
4883
5059
  }
4884
5060
  return dep;
@@ -4917,27 +5093,58 @@ export function checkPreflightTs7(entryPath, host) {
4917
5093
  load.disposeAll();
4918
5094
  }
4919
5095
  }
4920
- function preflight7(load) {
4921
- const { program, entry } = load;
4922
- const diags = [...load.configDiags];
4923
- // An explicit entry can itself live in an installed package. Its own
4924
- // source files are program code, including relative barrels and sibling
4925
- // modules; their location must not erase the module graph.
4926
- // Match the full installed directory, not just the package name, and
4927
- // exclude nested installations so dependencies keep their npm policy.
4928
- const entryPackageFile = entryPackageFilePredicate(entry.fileName);
4929
- // Workspace-linked packages register BEFORE the tsc gate. Their files
4930
- // live at realpaths OUTSIDE node_modules (the monorepo-tool symlink
4931
- // shape), so nothing path-shaped marks them as npm surface — yet their
4932
- // shipped JS follows the same foreign-tsconfig rules as node_modules JS.
4933
- // The lazy
4934
- // registration inside the import-fence walk below runs AFTER errorsOf,
4935
- // too late for the gate, so one pass over the program's import edges
4936
- // registers them up front: every bare specifier any program file loads —
4937
- // import/export declarations, dynamic import("literal") (tsgo chases
4938
- // those into the program too; a CLI reaches its workspace sibling exactly
4939
- // that way), require("literal") — resolved with the own resolver,
4940
- // workspace answers recorded.
5096
+ /** Whether a declaration file has the runtime file TypeScript pairs it
5097
+ * with (`x.d.ts` with `x.js`, `x.d.mts` with `x.mjs`, `x.d.cts` with
5098
+ * `x.cjs`): a specifier that resolves to the declaration then still names a
5099
+ * module Node can load. */
5100
+ function declarationHasRuntimeFile(declaration) {
5101
+ const name = declaration.fileName;
5102
+ const pairs = [
5103
+ [".d.ts", ".js"],
5104
+ [".d.mts", ".mjs"],
5105
+ [".d.cts", ".cjs"],
5106
+ ];
5107
+ for (const [declared, runtime] of pairs)
5108
+ if (name.endsWith(declared))
5109
+ return trackedFileExists(name.slice(0, -declared.length) + runtime);
5110
+ return false;
5111
+ }
5112
+ /** Whether two resolutions name the same module file. Their spellings differ
5113
+ * routinely — a tsconfig `paths` answer keeps the project's spelling where
5114
+ * the npm resolver answers realpath'd — so the real paths decide. */
5115
+ function sameResolvedFile(a, b) {
5116
+ const normalize = (path) => path.replaceAll("\\", "/");
5117
+ if (normalize(a) === normalize(b))
5118
+ return true;
5119
+ return normalize(trackedRealpath(a) ?? a) === normalize(trackedRealpath(b) ?? b);
5120
+ }
5121
+ /** A program file TypeScript's checker pulled in from a package the build
5122
+ * does not compile — unselected node_modules JavaScript, or an unselected
5123
+ * workspace package's shipped JavaScript at a realpath outside node_modules
5124
+ * (the symlinked-install shape): Node never loads it as program source. */
5125
+ function unselectedPackageJsFilePredicate(entryFileName) {
5126
+ const entryPackageFile = entryPackageFilePredicate(entryFileName);
5127
+ return (file) => isJsSourceFileName(file) &&
5128
+ !entryPackageFile(file) &&
5129
+ npmStaticPackageOfPath(file) === null &&
5130
+ (isNodeModulesPath(file) || workspacePackageOfPath(file) !== null);
5131
+ }
5132
+ /** Workspace-linked packages register before the tsc gate. Their files live
5133
+ * at realpaths OUTSIDE node_modules (the monorepo-tool symlink shape), so
5134
+ * nothing path-shaped marks them as npm surface — yet their shipped JS
5135
+ * follows the same foreign-tsconfig rules as node_modules JS. The lazy
5136
+ * registration inside the import-fence walk registers them too, but too late
5137
+ * for the gate, so one pass over the program's import edges registers them up
5138
+ * front: every bare specifier any program file loads — import/export
5139
+ * declarations, dynamic import("literal") (tsgo chases those into the program
5140
+ * too; a CLI reaches its workspace sibling exactly that way),
5141
+ * require("literal") — resolved with the own resolver, workspace answers
5142
+ * recorded. Runs once per load, ahead of the gate and the walk. */
5143
+ function registerWorkspaceEdges(load) {
5144
+ if (load.workspaceProbed === true)
5145
+ return;
5146
+ load.workspaceProbed = true;
5147
+ const { program } = load;
4941
5148
  {
4942
5149
  const supportedBuiltins = new Set(SUPPORTED_NODE_MODULES);
4943
5150
  const probed = new Set();
@@ -4963,317 +5170,126 @@ function preflight7(load) {
4963
5170
  probe(sf.fileName, specifier);
4964
5171
  }
4965
5172
  }
4966
- const toPassthrough = (d) => {
4967
- const message = ts.flattenDiagnosticMessageText(d, "\n");
4968
- // File-less (global/options) diagnostics anchor at the entry with a
4969
- // zero span, exactly like the 5.9.3 lane's `d.start ?? 0` fallback.
4970
- const file = d.fileName ?? entry.fileName;
4971
- const start = d.fileName !== undefined ? d.pos : 0;
4972
- const end = d.fileName !== undefined ? d.end : 0;
4973
- const diag = tscPassthroughDiag(message, { file, start, end });
4974
- const hint = typeWorldHint(d, message, load);
4975
- if (hint !== null) {
4976
- diag.typeWorld = true;
4977
- diag.hint = hint;
5173
+ }
5174
+ function preflightStructure(load) {
5175
+ if (load.preflightStructure === undefined)
5176
+ load.preflightStructure = preflightStructure7(load);
5177
+ return load.preflightStructure;
5178
+ }
5179
+ function preflightStructure7(load) {
5180
+ const { program, entry } = load;
5181
+ // The walk's own diagnostics. The config diagnostics and the tsc gate are
5182
+ // preflightDiagnostics7's, which reports them ahead of these.
5183
+ const diags = [];
5184
+ const unselectedPackageJsFile = unselectedPackageJsFilePredicate(entry.fileName);
5185
+ // An explicit entry can itself live in an installed package. Its own
5186
+ // source files are program code, including relative barrels and sibling
5187
+ // modules; their location must not erase the module graph.
5188
+ // Match the full installed directory, not just the package name, and
5189
+ // exclude nested installations so dependencies keep their npm policy.
5190
+ const entryPackageFile = entryPackageFilePredicate(entry.fileName);
5191
+ // Preflight and lowering share this CheckerFacade. Claim executable
5192
+ // source files after workspace discovery and the tsc gate but before
5193
+ // structural preflight checker queries, so a miss cannot trigger the old
5194
+ // whole-file sweep (and eagerly fetch every dead body's answers). The
5195
+ // structure wave includes declaration headers and top-level code;
5196
+ // reachable bodies are added by lowering's worklists.
5197
+ const ambient = ambientDtsPath();
5198
+ const programFiles = program
5199
+ .getImplementationSourceFiles()
5200
+ .filter((sf) => sf.fileName !== ambient &&
5201
+ !sf.isDeclarationFile &&
5202
+ !sf.fileName.endsWith(".json") &&
5203
+ (!isNodeModulesPath(sf.fileName) ||
5204
+ entryPackageFile(sf.fileName) ||
5205
+ npmStaticPackageOfPath(sf.fileName) !== null) &&
5206
+ !unselectedPackageJsFile(sf.fileName));
5207
+ // Files reached only through `import type` / `export type … from` are
5208
+ // checker input, never program modules: Node does not load them, so
5209
+ // their imports and syntax must not fence the program.
5210
+ //
5211
+ // Reachability over-approximates: `callReferencesOf` and the reexport
5212
+ // planner count EVERY call with a leading string literal as a loading
5213
+ // edge, so a bare specifier that merely names a package — a model id
5214
+ // passed to a catalog helper, a settings key passed to `markModified` —
5215
+ // reaches npm resolution here. Whether this walk runs at all depends on
5216
+ // the program it is handed (it early-returns unless an erased reference
5217
+ // resolves, and the island rounds change the program), so classifying a
5218
+ // miss from it made package selection depend on program composition: the
5219
+ // same build could refuse a static package's entry as "did not join the
5220
+ // type-checked program" or compile it, run to run. Report nothing from
5221
+ // these edges; the walks that model real loads (import/export
5222
+ // declarations and `require()`/`import()` calls) own the offender
5223
+ // classification.
5224
+ const resolveRuntimeEdge = (sf, spec, resolutionKind) => resolveImport7(program, sf, spec, resolutionKind, false) ??
5225
+ npmStaticDepSf7(program, sf, spec, resolutionKind);
5226
+ const typeOnlyFiles = typeOnlyReachedFiles(program, entry, programFiles, () => [
5227
+ ...forkTargetPaths(program, program.getImplementationSourceFiles()),
5228
+ ...workerTargetPaths(program, program.getImplementationSourceFiles()),
5229
+ ], resolveRuntimeEdge);
5230
+ const runtimeFiles = typeOnlyFiles.size === 0 ? programFiles : programFiles.filter((sf) => !typeOnlyFiles.has(sf));
5231
+ const userFiles = npmStaticActive()
5232
+ ? planNpmStaticReexports(program, entry, runtimeFiles, [
5233
+ ...createRequireProgramRoots7(program),
5234
+ ...forkTargetPaths(program, program.getImplementationSourceFiles()),
5235
+ ...workerTargetPaths(program, program.getImplementationSourceFiles()),
5236
+ ], resolveRuntimeEdge)
5237
+ : runtimeFiles;
5238
+ program.getTypeChecker().prefetchSourceFileStructures(userFiles);
5239
+ // Unselected node_modules JS is not native program source even when
5240
+ // maxNodeModuleJsDepth pulled it into the checker (nodeModulesJsSuppressed).
5241
+ // Node stops at the nearest package.json even when it is malformed, and
5242
+ // an explicit CommonJS scope (or .cjs/.cts extension) disables ambiguous-
5243
+ // file syntax detection entirely. TypeScript's bundler checker models
5244
+ // neither loader rule, so restore them before any module-edge analysis:
5245
+ // one malformed-scope diagnostic per package file, and one pointed syntax
5246
+ // diagnostic per CommonJS source file.
5247
+ const invalidPackageConfigs = new Set();
5248
+ for (const sf of userFiles) {
5249
+ const invalidConfig = nearestInvalidPackageJsonPath(sf.fileName);
5250
+ if (invalidConfig !== null) {
5251
+ if (!invalidPackageConfigs.has(invalidConfig)) {
5252
+ invalidPackageConfigs.add(invalidConfig);
5253
+ diags.push(invalidPackageConfigDiag(invalidConfig, { file: sf.fileName, start: 0, end: 0 }));
5254
+ }
5255
+ continue;
4978
5256
  }
4979
- return diag;
4980
- };
4981
- /* TS7 checker change (not finding 5, same discipline): tsgo types a
4982
- * NAMESPACE import as the spec's non-callable module namespace object
4983
- * even when the module is declared with the callable `export =` shape —
4984
- * 5.9.3 bound the callable value directly, so `import * as a from
4985
- * "node:assert"; a(x)` typechecked there and draws TS2349 here. Those
4986
- * callable module objects are scriptc's OWN declared surface, and calls
4987
- * through the namespace binding are fenced per site by the lowering (the
4988
- * assert-fences fixture pins the wording), so tsgo's extra TS2349 on
4989
- * exactly those callees — an identifier that is a namespace-import
4990
- * binding of a supported builtin module — is suppressed to the 5.9.3
4991
- * verdict. Nothing else rides this: any other non-callable call keeps
4992
- * tsc's voice in both lanes. */
4993
- const builtinNamespaceNames = new Map();
4994
- const namespaceCalleeSuppressed = (p, d) => {
4995
- if (d.code !== 2349 || d.fileName === undefined)
4996
- return false;
4997
- let names = builtinNamespaceNames.get(d.fileName);
4998
- if (!names) {
4999
- names = new Set();
5000
- builtinNamespaceNames.set(d.fileName, names);
5001
- const sf = p.getSourceFile(d.fileName);
5002
- for (const stmt of sf?.statements?.nodes ?? []) {
5003
- if (!ts.isImportDeclaration(stmt) || !ts.isStringLiteral(stmt.moduleSpecifier))
5004
- continue;
5005
- if (canonicalBuiltinModule(stmt.moduleSpecifier.text) === null)
5006
- continue;
5007
- const bindings = stmt.importClause?.namedBindings;
5008
- if (bindings && ts.isNamespaceImport(bindings))
5009
- names.add(bindings.name.text);
5257
+ if (!isNodeEsmFile7(sf, program)) {
5258
+ const marker = nodeEsmSyntaxMarker7(sf);
5259
+ if (marker !== null)
5260
+ diags.push(commonJsModuleSyntaxDiag(locOf7(marker)));
5261
+ }
5262
+ }
5263
+ const ambientModules = new Set(SUPPORTED_NODE_MODULES);
5264
+ // Ambient `declare module "name"` declarations anywhere in the program —
5265
+ // exact names and `*` patterns — so the import fence can say "type
5266
+ // surface only, no runtime module" instead of the generic package story.
5267
+ // Computed lazily: the scan only runs when a bare-import fence is about
5268
+ // to fire.
5269
+ let ambientModuleDecls = null;
5270
+ const ambientDeclared = (spec) => {
5271
+ if (ambientModuleDecls === null) {
5272
+ ambientModuleDecls = { names: new Set(), patterns: [] };
5273
+ for (const f of program.getSourceFiles()) {
5274
+ for (const s of f.statements.nodes) {
5275
+ if (!ts.isModuleDeclaration(s) || !ts.isStringLiteral(s.name))
5276
+ continue;
5277
+ const name = s.name.text;
5278
+ if (name.includes("*"))
5279
+ ambientModuleDecls.patterns.push(name);
5280
+ else
5281
+ ambientModuleDecls.names.add(name);
5282
+ }
5010
5283
  }
5011
5284
  }
5012
- if (names.size === 0)
5013
- return false;
5014
- const sf = p.getSourceFile(d.fileName);
5015
- return sf !== undefined && names.has(sf.text.slice(d.pos, d.end));
5016
- };
5017
- const npmStaticFileSuppressed = (d) => d.fileName !== undefined && npmStaticPackageOfPath(d.fileName) !== null;
5018
- const unselectedPackageJsFile = (file) => isJsSourceFileName(file) &&
5019
- !entryPackageFile(file) &&
5020
- npmStaticPackageOfPath(file) === null &&
5021
- (isNodeModulesPath(file) || workspacePackageOfPath(file) !== null);
5022
- const nodeModulesJsSuppressed = (d) => d.fileName !== undefined && unselectedPackageJsFile(d.fileName);
5023
- /* JSDoc TYPE positions in JS files are documentation Node never reads:
5024
- * a name-resolution failure THERE (2304/2552 — the pattern's utilities.js
5025
- * spells a mapped type over a @template name it never declared) types
5026
- * as the error-any and the per-site fences apply, same stance as the
5027
- * strictness families above. A 2300 duplicate-identifier PAIR formed by
5028
- * a @typedef and a same-named class/function is the same story — the
5029
- * typedef half sits inside the comment, and the code half is suppressed
5030
- * exactly when its partner (same file, same name) was comment-side, so
5031
- * a REAL duplicate declaration (both halves in code — Node's own
5032
- * SyntaxError) keeps tsc's voice. */
5033
- const insideBlockComment = (text, pos) => {
5034
- const open = text.lastIndexOf("/*", pos);
5035
- if (open < 0)
5036
- return false;
5037
- const close = text.indexOf("*/", open + 2);
5038
- return close === -1 || close >= pos;
5039
- };
5040
- const jsdocTypeSuppressed = (p, d, commentDup) => {
5041
- if (d.fileName === undefined || !isJsSourceFileName(d.fileName))
5042
- return false;
5043
- if (d.code !== 2304 && d.code !== 2552 && d.code !== 2300 && d.code !== 1003)
5044
- return false;
5045
- if (d.pos === undefined)
5046
- return false;
5047
- const sf = p.getSourceFile(d.fileName);
5048
- if (!sf)
5049
- return false;
5050
- if (insideBlockComment(sf.text, d.pos))
5285
+ if (ambientModuleDecls.names.has(spec))
5051
5286
  return true;
5052
- return d.code === 2300 && commentDup.has(`${d.fileName}:${sf.text.slice(d.pos, d.end)}`);
5053
- };
5054
- /* `typeof window` / `typeof self` in a JavaScript file: the operand of
5055
- * typeof may name a global nothing declares (Node answers "undefined"
5056
- * and never throws), the feature-detection idiom every isomorphic
5057
- * package uses, and the guarded uses of that name (`typeof window < "u"
5058
- * ? window : …`) are code Node never runs. A name the file feature-tests
5059
- * this way is therefore not a type error in JavaScript; a reached use
5060
- * still meets the lowering's located refusal. TypeScript files keep the
5061
- * error and its hint. */
5062
- const typeofTestedNameSuppressed = (p, d) => {
5063
- if (d.code !== 2304 && d.code !== 2552 && d.code !== 2584)
5064
- return false;
5065
- if (d.fileName === undefined || !isJsSourceFileName(d.fileName))
5066
- return false;
5067
- if (d.pos === undefined || d.end === undefined)
5068
- return false;
5069
- const sf = p.getSourceFile(d.fileName);
5070
- if (!sf)
5071
- return false;
5072
- const name = sf.text.slice(d.pos, d.end);
5073
- if (!/^[A-Za-z_$][\w$]*$/.test(name))
5074
- return false;
5075
- return new RegExp(`\\btypeof\\s*\\(?\\s*${name.replace(/\$/g, "\\$")}(?![\\w$])`).test(sf.text);
5076
- };
5077
- // A `return` at the top level of a CommonJS module (TS1108): Node runs
5078
- // the module as a function body, so the return ends the module's
5079
- // evaluation. ES modules and TypeScript keep the error.
5080
- const cjsTopLevelReturnSuppressed = (p, d) => {
5081
- if (d.code !== 1108 || d.fileName === undefined || !isJsSourceFileName(d.fileName))
5082
- return false;
5083
- const sf = p.getSourceFile(d.fileName);
5084
- return sf !== undefined && isCjsJsFile7(sf, p);
5085
- };
5086
- const workspaceImplicitAnySuppressed = (p, d) => {
5087
- if (d.code !== 7016 || d.fileName === undefined || d.pos === undefined || d.end === undefined)
5088
- return false;
5089
- const sf = p.getSourceFile(d.fileName);
5090
- if (!sf)
5091
- return false;
5092
- const spec = sf.text.slice(d.pos, d.end).replace(/^['"]|['"]$/g, "");
5093
- const prefix = spec.startsWith("@")
5094
- ? spec.split("/").slice(0, 2).join("/")
5095
- : spec.split("/")[0];
5096
- return isWorkspacePackageName(prefix);
5097
- };
5098
- // A JavaScript file that TypeScript checks keeps the type errors that
5099
- // protect its JSDoc types: a value of another type reaching a typed slot,
5100
- // a call with the wrong arity, and a subclass member that does not
5101
- // match its base.
5102
- const projectCheckJs = load.typeWorld?.projectCheckJs ?? false;
5103
- const enforcedInCheckedJs = (p, d) => {
5104
- if (!CHECKED_JS_ENFORCED_CODES.has(d.code) || d.fileName === undefined)
5105
- return false;
5106
- const sf = p.getSourceFile(d.fileName);
5107
- return sf !== undefined && isCheckedJsSourceFile(sf, projectCheckJs);
5108
- };
5109
- // keptErrors drops every diagnostic of these files: the gate does not ask
5110
- // the checker for them.
5111
- const diagnosticsKept = (fileName) => npmStaticPackageOfPath(fileName) === null &&
5112
- !unselectedPackageJsFile(fileName) &&
5113
- !isPackageShimFile(fileName);
5114
- const errorsOf = (p) => keptErrors(p, ts.getPreEmitDiagnostics(p, diagnosticsKept));
5115
- const keptErrors = (p, all) => {
5116
- // First pass: every comment-side 2300's (file, name) — the partners
5117
- // the second pass forgives.
5118
- const commentDup = new Set();
5119
- for (const d of all) {
5120
- if (d.code !== 2300 || d.fileName === undefined || d.pos === undefined || d.end === undefined)
5121
- continue;
5122
- if (!isJsSourceFileName(d.fileName))
5123
- continue;
5124
- const sf = p.getSourceFile(d.fileName);
5125
- if (sf && insideBlockComment(sf.text, d.pos))
5126
- commentDup.add(`${d.fileName}:${sf.text.slice(d.pos, d.end)}`);
5127
- }
5128
- return all.filter((d) => d.category === ts.DiagnosticCategory.Error &&
5129
- (!suppressedJsStrictness7(d) || enforcedInCheckedJs(p, d)) &&
5130
- !npmStaticFileSuppressed(d) &&
5131
- !nodeModulesJsSuppressed(d) &&
5132
- (d.fileName === undefined || !isPackageShimFile(d.fileName)) &&
5133
- !namespaceCalleeSuppressed(p, d) &&
5134
- !inferredJsDiagnosticSuppressed(p, d) &&
5135
- !isNpmStaticSubclassArgument(p, d) &&
5136
- !workspaceImplicitAnySuppressed(p, d) &&
5137
- !typeofTestedNameSuppressed(p, d) &&
5138
- !cjsTopLevelReturnSuppressed(p, d) &&
5139
- !jsdocTypeSuppressed(p, d, commentDup));
5140
- };
5141
- // The tsc gate, with a second chance: the LOWERING world's checker
5142
- // includes the divergence overrides (JSON.parse(): unknown, the Promise
5143
- // executor shape, ...), which are TIGHTER than the standard lib — a
5144
- // project that typechecks clean under its own tsc can still error here
5145
- // (any-typed JSON.parse results, most commonly). Those errors are OURS,
5146
- // not the project's, so they must not fail preflight: when the lowering
5147
- // world has errors, the PROJECT world (same program without the override
5148
- // declarations) is built and consulted. Clean there → preflight passes
5149
- // and the override-affected sites meet the lowerer's honest fences
5150
- // instead (the SC1100 checked-cast family). Dirty there → the project-
5151
- // world errors are the ones reported: they are reproducible with the
5152
- // project's own tsc, which is what "fix type errors first" asks for.
5153
- // With JSX sources, the program over the original text answers the tsc
5154
- // gate; its positions move into the rewritten text the program holds.
5155
- // Errors only the rewritten text has come from the calls the JSX lowers
5156
- // to (a factory whose signature does not accept them).
5157
- const tscWorld = load.tscWorld;
5158
- const tscErrors = tscWorld === undefined ? errorsOf(program) : keptErrors(tscWorld.program, tscWorld.diagnostics);
5159
- if (tscErrors.length > 0) {
5160
- const world = tscWorld === undefined || tscWorld.declWorldFallback === true
5161
- ? load.projectWorld()
5162
- : (tscWorld.projectWorld ?? tscWorld.program);
5163
- for (const d of errorsOf(world)) {
5164
- const diag = toPassthrough(d);
5165
- const lowered = tscWorld === undefined ? undefined : load.jsxSources?.get(diag.loc.file);
5166
- if (lowered !== undefined) {
5167
- diag.loc = {
5168
- ...diag.loc,
5169
- start: lowered.rewrittenPosition(diag.loc.start, false),
5170
- end: lowered.rewrittenPosition(diag.loc.end, true),
5171
- };
5172
- }
5173
- diags.push(diag);
5174
- }
5175
- }
5176
- else if (load.jsxSources !== undefined) {
5177
- for (const file of load.jsxSources.keys()) {
5178
- const sf = program.getSourceFile(file);
5179
- if (sf === undefined)
5180
- continue;
5181
- const own = [...program.getSyntacticDiagnostics(sf), ...program.getSemanticDiagnostics(sf)];
5182
- for (const d of keptErrors(program, own)) {
5183
- const diag = toPassthrough(d);
5184
- diag.message = `${diag.message} (in the call this JSX lowers to)`;
5185
- diags.push(diag);
5186
- }
5187
- }
5188
- }
5189
- // Preflight and lowering share this CheckerFacade. Claim executable
5190
- // source files after workspace discovery and the tsc gate but before
5191
- // structural preflight checker queries, so a miss cannot trigger the old
5192
- // whole-file sweep (and eagerly fetch every dead body's answers). The
5193
- // structure wave includes declaration headers and top-level code;
5194
- // reachable bodies are added by lowering's worklists.
5195
- const ambient = ambientDtsPath();
5196
- const programFiles = program
5197
- .getImplementationSourceFiles()
5198
- .filter((sf) => sf.fileName !== ambient &&
5199
- !sf.isDeclarationFile &&
5200
- !sf.fileName.endsWith(".json") &&
5201
- (!isNodeModulesPath(sf.fileName) ||
5202
- entryPackageFile(sf.fileName) ||
5203
- npmStaticPackageOfPath(sf.fileName) !== null) &&
5204
- !unselectedPackageJsFile(sf.fileName));
5205
- // Files reached only through `import type` / `export type … from` are
5206
- // checker input, never program modules: Node does not load them, so
5207
- // their imports and syntax must not fence the program.
5208
- const resolveRuntimeEdge = (sf, spec, resolutionKind) => resolveImport7(program, sf, spec, resolutionKind) ??
5209
- npmStaticDepSf7(program, sf, spec, resolutionKind);
5210
- const typeOnlyFiles = typeOnlyReachedFiles(program, entry, programFiles, () => [
5211
- ...forkTargetPaths(program, program.getImplementationSourceFiles()),
5212
- ...workerTargetPaths(program, program.getImplementationSourceFiles()),
5213
- ], resolveRuntimeEdge);
5214
- const runtimeFiles = typeOnlyFiles.size === 0 ? programFiles : programFiles.filter((sf) => !typeOnlyFiles.has(sf));
5215
- const userFiles = npmStaticActive()
5216
- ? planNpmStaticReexports(program, entry, runtimeFiles, [
5217
- ...createRequireProgramRoots7(program),
5218
- ...forkTargetPaths(program, program.getImplementationSourceFiles()),
5219
- ...workerTargetPaths(program, program.getImplementationSourceFiles()),
5220
- ], resolveRuntimeEdge)
5221
- : runtimeFiles;
5222
- program.getTypeChecker().prefetchSourceFileStructures(userFiles);
5223
- // Unselected node_modules JS is not native program source even when
5224
- // maxNodeModuleJsDepth pulled it into the checker (nodeModulesJsSuppressed).
5225
- // Node stops at the nearest package.json even when it is malformed, and
5226
- // an explicit CommonJS scope (or .cjs/.cts extension) disables ambiguous-
5227
- // file syntax detection entirely. TypeScript's bundler checker models
5228
- // neither loader rule, so restore them before any module-edge analysis:
5229
- // one malformed-scope diagnostic per package file, and one pointed syntax
5230
- // diagnostic per CommonJS source file.
5231
- const invalidPackageConfigs = new Set();
5232
- for (const sf of userFiles) {
5233
- const invalidConfig = nearestInvalidPackageJsonPath(sf.fileName);
5234
- if (invalidConfig !== null) {
5235
- if (!invalidPackageConfigs.has(invalidConfig)) {
5236
- invalidPackageConfigs.add(invalidConfig);
5237
- diags.push(invalidPackageConfigDiag(invalidConfig, { file: sf.fileName, start: 0, end: 0 }));
5238
- }
5239
- continue;
5240
- }
5241
- if (!isNodeEsmFile7(sf, program)) {
5242
- const marker = nodeEsmSyntaxMarker7(sf);
5243
- if (marker !== null)
5244
- diags.push(commonJsModuleSyntaxDiag(locOf7(marker)));
5245
- }
5246
- }
5247
- const ambientModules = new Set(SUPPORTED_NODE_MODULES);
5248
- // Ambient `declare module "name"` declarations anywhere in the program —
5249
- // exact names and `*` patterns — so the import fence can say "type
5250
- // surface only, no runtime module" instead of the generic package story.
5251
- // Computed lazily: the scan only runs when a bare-import fence is about
5252
- // to fire.
5253
- let ambientModuleDecls = null;
5254
- const ambientDeclared = (spec) => {
5255
- if (ambientModuleDecls === null) {
5256
- ambientModuleDecls = { names: new Set(), patterns: [] };
5257
- for (const f of program.getSourceFiles()) {
5258
- for (const s of f.statements.nodes) {
5259
- if (!ts.isModuleDeclaration(s) || !ts.isStringLiteral(s.name))
5260
- continue;
5261
- const name = s.name.text;
5262
- if (name.includes("*"))
5263
- ambientModuleDecls.patterns.push(name);
5264
- else
5265
- ambientModuleDecls.names.add(name);
5266
- }
5267
- }
5268
- }
5269
- if (ambientModuleDecls.names.has(spec))
5270
- return true;
5271
- return ambientModuleDecls.patterns.some((p) => {
5272
- const star = p.indexOf("*");
5273
- return (spec.length >= p.length - 1 &&
5274
- spec.startsWith(p.slice(0, star)) &&
5275
- spec.endsWith(p.slice(star + 1)));
5276
- });
5287
+ return ambientModuleDecls.patterns.some((p) => {
5288
+ const star = p.indexOf("*");
5289
+ return (spec.length >= p.length - 1 &&
5290
+ spec.startsWith(p.slice(0, star)) &&
5291
+ spec.endsWith(p.slice(star + 1)));
5292
+ });
5277
5293
  };
5278
5294
  // Module edges. An edge that closes a cycle is judged by the shared
5279
5295
  // admission engine (makeCycleAdmission): admissible when nothing can
@@ -5385,6 +5401,15 @@ function preflight7(load) {
5385
5401
  continue;
5386
5402
  }
5387
5403
  }
5404
+ // A re-export whose specifier resolves ONLY to a declaration file
5405
+ // has no runtime module to link (Node throws
5406
+ // ERR_MODULE_NOT_FOUND), and a declaration file is not a program
5407
+ // module: an edge to it would lower the declarations' own imports
5408
+ // as code.
5409
+ if (reDep !== null && reDep.isDeclarationFile && !declarationHasRuntimeFile(reDep)) {
5410
+ diags.push(unsupportedDiag("SC1010", locOf7(stmt), `the '${fromSpec}' re-export (it resolves only to type declarations — there is no runtime implementation to compile)`));
5411
+ continue;
5412
+ }
5388
5413
  if (reDep && !reDep.fileName.endsWith(".json")) {
5389
5414
  deps.push({ dep: reDep, stmt });
5390
5415
  depPositions.get(sf).push({ dep: reDep, pos: ts.tokenStartOfNode(stmt) });
@@ -5395,6 +5420,12 @@ function preflight7(load) {
5395
5420
  continue;
5396
5421
  if (erasedTypeOnlyImport(stmt))
5397
5422
  continue;
5423
+ // `import source x from "./x.wasm"` (TypeScript 7.1) binds the module's source object, such
5424
+ // as a WebAssembly.Module; compiled programs do not support it yet.
5425
+ if (isSourcePhaseImport(stmt.importClause)) {
5426
+ diags.push(unsupportedDiag("SC1090", locOf7(stmt), "source phase imports (`import source`)"));
5427
+ continue;
5428
+ }
5398
5429
  // Import-like nodes whose specifier the parse could not shape into a
5399
5430
  // string literal — the jsdoc `/** @import x = require(...) */`
5400
5431
  // materialization and `import defer type * as ns` both arrive here
@@ -5440,12 +5471,30 @@ function preflight7(load) {
5440
5471
  // Project modules win before npm fallback: this is the source graph
5441
5472
  // tsgo type-checked for tsconfig paths, package imports/self-references,
5442
5473
  // and provenance entries. Ordinary packages still answer null here.
5443
- const projDep = isBare ? resolveImport7(program, sf, spec) : null;
5444
- // "#" specifiers can never name an npm package — they are the
5445
- // imports-field family, resolved by the project arm above.
5446
- const npm = isBare && projDep === null && !spec.startsWith("#")
5447
- ? resolveNpmImport7(sf.fileName, spec)
5448
- : null;
5474
+ const projectAnswer = isBare ? resolveImport7(program, sf, spec) : null;
5475
+ let projDep = projectAnswer;
5476
+ let npm = null;
5477
+ if (isBare && !spec.startsWith("#")) {
5478
+ // A tsconfig `paths` target can name an installed package's directory
5479
+ // (pi maps "typebox": ["./node_modules/typebox"]): its declarations
5480
+ // are the package's own, so Node resolves the same specifier to the
5481
+ // same answer and the import is an npm import after all. The npm arm
5482
+ // below owns it then — its runtime refusal, npm-static membership and
5483
+ // island policy included. A mapping whose answer the npm resolver does
5484
+ // not reproduce stays a project import (and its SC1010).
5485
+ const installed = projectAnswer !== null &&
5486
+ projectAnswer.isDeclarationFile &&
5487
+ isNodeModulesPath(projectAnswer.fileName)
5488
+ ? resolveNpmImport7(sf.fileName, spec)
5489
+ : null;
5490
+ if (installed !== null && sameResolvedFile(installed.typesFile, projectAnswer.fileName)) {
5491
+ projDep = null;
5492
+ npm = installed;
5493
+ }
5494
+ else if (projectAnswer === null) {
5495
+ npm = resolveNpmImport7(sf.fileName, spec);
5496
+ }
5497
+ }
5449
5498
  if (npm && isNodeTypesPath(npm.typesFile)) {
5450
5499
  diags.push(unsupportedDiag("SC1010", locOf7(stmt), unsupportedModuleFeatureOf(spec)));
5451
5500
  continue;
@@ -5539,6 +5588,16 @@ function preflight7(load) {
5539
5588
  const clause = stmt.importClause;
5540
5589
  const dep = isRelative ? resolveImport7(program, sf, spec) : (npmStaticDep ?? projDep);
5541
5590
  const isJson = dep !== null && dep.fileName.endsWith(".json");
5591
+ // A specifier that resolves ONLY to a declaration file has no runtime
5592
+ // module to link: Node throws ERR_MODULE_NOT_FOUND at this import.
5593
+ // Declarations are not program modules — taking one as a module-order
5594
+ // edge would lower its imports as if it were code (SC2013 for every
5595
+ // specifier inside a package's `.d.ts`). Type-only imports were
5596
+ // already erased above; this is the value form.
5597
+ if (dep !== null && dep.isDeclarationFile && !isJson && !declarationHasRuntimeFile(dep)) {
5598
+ diags.push(unsupportedDiag("SC1010", locOf7(stmt), `the '${spec}' import (it resolves only to type declarations — there is no runtime implementation to compile)`));
5599
+ continue;
5600
+ }
5542
5601
  // SELF-imports: the bindings alias this module's OWN declarations,
5543
5602
  // so a TOP-LEVEL read lexically above the aliased declaration is
5544
5603
  // Node's TDZ ReferenceError at runtime (exactly what tsc's TS2448
@@ -5775,6 +5834,11 @@ function preflight7(load) {
5775
5834
  }
5776
5835
  if (earlyRequireFence(req, bindingKind, loc))
5777
5836
  continue;
5837
+ // A declaration file is never a runtime module (see the import
5838
+ // arm): the require throws MODULE_NOT_FOUND in Node, so it is not
5839
+ // a module-order edge.
5840
+ if (dep !== null && dep.isDeclarationFile)
5841
+ continue;
5778
5842
  if (dep)
5779
5843
  deps.push({ dep });
5780
5844
  }
@@ -5855,7 +5919,7 @@ function preflight7(load) {
5855
5919
  const edgeTo = (dep) => lazy ? { dep, lazy: true, call } : { dep, call };
5856
5920
  const projectDep = resolveImport7(program, sf, spec, "require");
5857
5921
  if (projectDep !== null) {
5858
- if (!projectDep.fileName.endsWith(".json"))
5922
+ if (!projectDep.fileName.endsWith(".json") && !projectDep.isDeclarationFile)
5859
5923
  deps.push(edgeTo(projectDep));
5860
5924
  continue;
5861
5925
  }
@@ -5953,6 +6017,7 @@ function preflight7(load) {
5953
6017
  // Node's fetch/resolve phase runs before instantiate.
5954
6018
  let resolveCrash = null;
5955
6019
  const dynamicImportRejections = new Map();
6020
+ const fallbacks = [];
5956
6021
  {
5957
6022
  const seen = new Set();
5958
6023
  const walk = (sf) => {
@@ -6025,29 +6090,389 @@ function preflight7(load) {
6025
6090
  // preflight: when any other diagnostic already fails the build, every
6026
6091
  // refusal keeps its compile-fence fallback instead — the report names
6027
6092
  // each import's story, so edges whose crash will never compile still
6028
- // get a diagnostic. (No reachable refusal → same: fallbacks only.)
6029
- if (resolveCrash === null || diags.length > 0) {
6030
- resolveCrash = null;
6031
- for (const [sf, cands] of refusals) {
6032
- if (covered.has(sf) && !startup.has(sf))
6033
- continue;
6034
- for (const c of cands)
6035
- diags.push(c.fallback);
6036
- }
6093
+ // get a diagnostic. (No reachable refusal → same: fallbacks only.) The
6094
+ // "otherwise pass" half of that question is preflightDiagnostics7's:
6095
+ // it alone sees the tsc gate's diagnostics, so it reports `fallbacks`.
6096
+ for (const [sf, cands] of refusals) {
6097
+ if (covered.has(sf) && !startup.has(sf))
6098
+ continue;
6099
+ for (const c of cands)
6100
+ fallbacks.push(c.fallback);
6037
6101
  }
6038
6102
  }
6039
- const linkCrash = resolveCrash !== null
6040
- ? null
6041
- : earlierLinkCrash(order, cjsNamedImportLinkCheck(program, entry, order, diags), esmNamedImportLinkCheck(program, entry, order, diags));
6042
6103
  return {
6043
- diags,
6044
- moduleOrder: order,
6045
- startupCrash: resolveCrash ?? linkCrash,
6046
- inlineRequireCycleCalls,
6104
+ order,
6047
6105
  moduleEdges: edges,
6048
6106
  dynamicImportRejections,
6107
+ inlineRequireCycleCalls,
6108
+ diags,
6109
+ resolveCrash,
6110
+ fallbacks,
6111
+ };
6112
+ }
6113
+ /** The whole preflight for one load: the tsc gate, the module graph walk and
6114
+ * every diagnostic they report, in report order. The structure is memoized,
6115
+ * so a caller that asked for the order first (checkModuleOrder) pays for the
6116
+ * walk once. */
6117
+ function preflight7(load) {
6118
+ registerWorkspaceEdges(load);
6119
+ const gate = preflightGate7(load);
6120
+ const structure = preflightStructure(load);
6121
+ const { diags, startupCrash } = preflightDiagnostics7(load, structure, gate.diags);
6122
+ return {
6123
+ diags,
6124
+ moduleOrder: structure.order,
6125
+ startupCrash,
6126
+ inlineRequireCycleCalls: structure.inlineRequireCycleCalls,
6127
+ moduleEdges: structure.moduleEdges,
6128
+ dynamicImportRejections: structure.dynamicImportRejections,
6129
+ admittedOpinions: gate.admittedOpinions,
6049
6130
  };
6050
6131
  }
6132
+ /** The diagnostics half of preflight: the tsc gate ahead of the walk's own
6133
+ * diagnostics, then the passes that judge the completed module order. The
6134
+ * tsc gate runs first on every load whose order was not requested on its
6135
+ * own, exactly as it did inside the single pass. */
6136
+ function preflightDiagnostics7(load, structure, gate) {
6137
+ const { program, entry } = load;
6138
+ const order = structure.order;
6139
+ const diags = [...load.configDiags];
6140
+ for (const d of gate)
6141
+ diags.push(d);
6142
+ for (const d of structure.diags)
6143
+ diags.push(d);
6144
+ // ECMAScript's sloppy-mode WRITE to an undeclared name, which the JS
6145
+ // relaxation above admits for READS (plan D-2): refused by name, with the
6146
+ // island route in the text (SC1091).
6147
+ for (const d of jsUndeclaredWriteDiags(program, order))
6148
+ diags.push(d);
6149
+ // The crash channel engages only when nothing else fails preflight.
6150
+ let startupCrash = structure.resolveCrash;
6151
+ if (startupCrash === null || diags.length > 0) {
6152
+ startupCrash = null;
6153
+ for (const d of structure.fallbacks)
6154
+ diags.push(d);
6155
+ }
6156
+ const linkCrash = startupCrash !== null
6157
+ ? null
6158
+ : earlierLinkCrash(order, cjsNamedImportLinkCheck(program, entry, order, diags), esmNamedImportLinkCheck(program, entry, order, diags));
6159
+ // ECMAScript early errors the TypeScript checker does not model (plan
6160
+ // §7.7 D-4): a JavaScript source the spec makes a SyntaxError fails here,
6161
+ // before any lowering, exactly where a tsc parse error fails.
6162
+ diags.push(...earlyErrorDiagnostics7(order, (sf) => isNodeEsmFile7(sf, program)));
6163
+ return { diags, startupCrash: startupCrash ?? linkCrash };
6164
+ }
6165
+ function preflightGate7(load) {
6166
+ const { program, entry } = load;
6167
+ const diags = [];
6168
+ const unselectedPackageJsFile = unselectedPackageJsFilePredicate(entry.fileName);
6169
+ const toPassthrough = (d) => {
6170
+ const message = ts.flattenDiagnosticMessageText(d, "\n");
6171
+ // File-less (global/options) diagnostics anchor at the entry with a
6172
+ // zero span, exactly like the 5.9.3 lane's `d.start ?? 0` fallback.
6173
+ const file = d.fileName ?? entry.fileName;
6174
+ const start = d.fileName !== undefined ? d.pos : 0;
6175
+ const end = d.fileName !== undefined ? d.end : 0;
6176
+ // A JavaScript source's `refuse`/`rewrite` code names the construct
6177
+ // scriptc does not lower (tsc-codes.ts): the user sees what is missing
6178
+ // instead of TypeScript's opinion about legal JavaScript.
6179
+ const triaged = d.fileName !== undefined && isJsSourceFileName(d.fileName) ? jsTscCodeTriage(d.code) : null;
6180
+ if (triaged?.action === "refuse" || triaged?.action === "rewrite") {
6181
+ const diag = unsupportedDiag("SC1090", { file, start, end }, triaged.feature, `${triaged.hint} (TypeScript reports TS${d.code} here.)`);
6182
+ return diag;
6183
+ }
6184
+ const diag = tscPassthroughDiag(message, { file, start, end });
6185
+ const hint = typeWorldHint(d, message, load);
6186
+ if (hint !== null) {
6187
+ diag.typeWorld = true;
6188
+ diag.hint = hint;
6189
+ }
6190
+ return diag;
6191
+ };
6192
+ /* TS7 checker change (not finding 5, same discipline): tsgo types a
6193
+ * NAMESPACE import as the spec's non-callable module namespace object
6194
+ * even when the module is declared with the callable `export =` shape —
6195
+ * 5.9.3 bound the callable value directly, so `import * as a from
6196
+ * "node:assert"; a(x)` typechecked there and draws TS2349 here. Those
6197
+ * callable module objects are scriptc's OWN declared surface, and calls
6198
+ * through the namespace binding are fenced per site by the lowering (the
6199
+ * assert-fences fixture pins the wording), so tsgo's extra TS2349 on
6200
+ * exactly those callees — an identifier that is a namespace-import
6201
+ * binding of a supported builtin module — is suppressed to the 5.9.3
6202
+ * verdict. Nothing else rides this: any other non-callable call keeps
6203
+ * tsc's voice in both lanes. */
6204
+ const builtinNamespaceNames = new Map();
6205
+ const namespaceCalleeSuppressed = (p, d) => {
6206
+ if (d.code !== 2349 || d.fileName === undefined)
6207
+ return false;
6208
+ let names = builtinNamespaceNames.get(d.fileName);
6209
+ if (!names) {
6210
+ names = new Set();
6211
+ builtinNamespaceNames.set(d.fileName, names);
6212
+ const sf = p.getSourceFile(d.fileName);
6213
+ for (const stmt of sf?.statements?.nodes ?? []) {
6214
+ if (!ts.isImportDeclaration(stmt) || !ts.isStringLiteral(stmt.moduleSpecifier))
6215
+ continue;
6216
+ if (canonicalBuiltinModule(stmt.moduleSpecifier.text) === null)
6217
+ continue;
6218
+ const bindings = stmt.importClause?.namedBindings;
6219
+ if (bindings && ts.isNamespaceImport(bindings))
6220
+ names.add(bindings.name.text);
6221
+ }
6222
+ }
6223
+ if (names.size === 0)
6224
+ return false;
6225
+ const sf = p.getSourceFile(d.fileName);
6226
+ return sf !== undefined && names.has(sf.text.slice(d.pos, d.end));
6227
+ };
6228
+ const npmStaticFileSuppressed = (d) => d.fileName !== undefined && npmStaticPackageOfPath(d.fileName) !== null;
6229
+ const nodeModulesJsSuppressed = (d) => d.fileName !== undefined && unselectedPackageJsFile(d.fileName);
6230
+ /* JSDoc TYPE positions in JS files are documentation Node never reads:
6231
+ * a name-resolution failure THERE (2304/2552 — the pattern's utilities.js
6232
+ * spells a mapped type over a @template name it never declared) types
6233
+ * as the error-any and the per-site fences apply, same stance as the
6234
+ * strictness families above. A 2300 duplicate-identifier PAIR formed by
6235
+ * a @typedef and a same-named class/function is the same story — the
6236
+ * typedef half sits inside the comment, and the code half is suppressed
6237
+ * exactly when its partner (same file, same name) was comment-side, so
6238
+ * a REAL duplicate declaration (both halves in code — Node's own
6239
+ * SyntaxError) keeps tsc's voice. */
6240
+ const insideBlockComment = (text, pos) => {
6241
+ const open = text.lastIndexOf("/*", pos);
6242
+ if (open < 0)
6243
+ return false;
6244
+ const close = text.indexOf("*/", open + 2);
6245
+ return close === -1 || close >= pos;
6246
+ };
6247
+ const jsdocTypeSuppressed = (p, d, commentDup) => {
6248
+ if (d.fileName === undefined || !isJsSourceFileName(d.fileName))
6249
+ return false;
6250
+ if (d.code !== 2304 && d.code !== 2552 && d.code !== 2300 && d.code !== 1003)
6251
+ return false;
6252
+ if (d.pos === undefined)
6253
+ return false;
6254
+ const sf = p.getSourceFile(d.fileName);
6255
+ if (!sf)
6256
+ return false;
6257
+ if (insideBlockComment(sf.text, d.pos))
6258
+ return true;
6259
+ return d.code === 2300 && commentDup.has(`${d.fileName}:${sf.text.slice(d.pos, d.end)}`);
6260
+ };
6261
+ /* `typeof window` / `typeof self` in a JavaScript file: the operand of
6262
+ * typeof may name a global nothing declares (Node answers "undefined"
6263
+ * and never throws), the feature-detection idiom every isomorphic
6264
+ * package uses, and the guarded uses of that name (`typeof window < "u"
6265
+ * ? window : …`) are code Node never runs. A name the file feature-tests
6266
+ * this way is therefore not a type error in JavaScript; a reached use
6267
+ * still meets the lowering's located refusal. TypeScript files keep the
6268
+ * error and its hint. */
6269
+ const typeofTestedNameSuppressed = (p, d) => {
6270
+ if (d.code !== 2304 && d.code !== 2552 && d.code !== 2584)
6271
+ return false;
6272
+ if (d.fileName === undefined || !isJsSourceFileName(d.fileName))
6273
+ return false;
6274
+ if (d.pos === undefined || d.end === undefined)
6275
+ return false;
6276
+ const sf = p.getSourceFile(d.fileName);
6277
+ if (!sf)
6278
+ return false;
6279
+ const name = sf.text.slice(d.pos, d.end);
6280
+ if (!/^[A-Za-z_$][\w$]*$/.test(name))
6281
+ return false;
6282
+ return new RegExp(`\\btypeof\\s*\\(?\\s*${name.replace(/\$/g, "\\$")}(?![\\w$])`).test(sf.text);
6283
+ };
6284
+ // A `return` at the top level of a CommonJS module (TS1108): Node runs
6285
+ // the module as a function body, so the return ends the module's
6286
+ // evaluation. ES modules and TypeScript keep the error.
6287
+ const cjsTopLevelReturnSuppressed = (p, d) => {
6288
+ if (d.code !== 1108 || d.fileName === undefined || !isJsSourceFileName(d.fileName))
6289
+ return false;
6290
+ const sf = p.getSourceFile(d.fileName);
6291
+ return sf !== undefined && isCjsJsFile7(sf, p);
6292
+ };
6293
+ const workspaceImplicitAnySuppressed = (p, d) => {
6294
+ if (d.code !== 7016 || d.fileName === undefined || d.pos === undefined || d.end === undefined)
6295
+ return false;
6296
+ const sf = p.getSourceFile(d.fileName);
6297
+ if (!sf)
6298
+ return false;
6299
+ const spec = sf.text.slice(d.pos, d.end).replace(/^['"]|['"]$/g, "");
6300
+ const prefix = spec.startsWith("@")
6301
+ ? spec.split("/").slice(0, 2).join("/")
6302
+ : spec.split("/")[0];
6303
+ return isWorkspacePackageName(prefix);
6304
+ };
6305
+ // A JavaScript file that TypeScript checks keeps the type errors that
6306
+ // protect its JSDoc types: a value of another type reaching a typed slot,
6307
+ // a call with the wrong arity, and a subclass member that does not
6308
+ // match its base (the rows that say `checkedJs: "enforce"` in
6309
+ // JS_OPINIONS).
6310
+ const projectCheckJs = load.typeWorld?.projectCheckJs ?? false;
6311
+ // The opinion sites this preflight admits (tsc-codes.ts, JS_OPINIONS),
6312
+ // deduped across the worlds the gate consults (the lowering world, the
6313
+ // project world, the JSX text). The lowering asks opinionAt about one of
6314
+ // them; a view's lowering path is gated on the record, never on syntax.
6315
+ const admittedOpinions = new Map();
6316
+ const recordAdmittedOpinion = (site) => {
6317
+ admittedOpinions.set(`${site.file}\0${site.pos}\0${site.end}\0${site.code}`, site);
6318
+ };
6319
+ // A diagnostic's span is an offset into the text of the program that
6320
+ // answered it. With JSX sources the gate's worlds hold the files as
6321
+ // written, while the lowering asks opinionAt about nodes of `program`,
6322
+ // which carries the rewritten text; an original offset recorded as a site
6323
+ // would name an unrelated node wherever a rewrite moved the text. The span
6324
+ // moves into that text exactly as a reported diagnostic's location does
6325
+ // below: copied text keeps its offset, a span inside JSX maps to the call
6326
+ // it lowered to.
6327
+ const admittedSite = (p, site) => {
6328
+ if (p === program)
6329
+ return site;
6330
+ const lowered = load.jsxSources?.get(site.file);
6331
+ if (lowered === undefined)
6332
+ return site;
6333
+ return {
6334
+ ...site,
6335
+ pos: lowered.rewrittenPosition(site.pos, false),
6336
+ end: lowered.rewrittenPosition(site.end, true),
6337
+ };
6338
+ };
6339
+ // keptErrors drops every diagnostic of these files: the gate does not ask
6340
+ // the checker for them.
6341
+ const diagnosticsKept = (fileName) => npmStaticPackageOfPath(fileName) === null &&
6342
+ !unselectedPackageJsFile(fileName) &&
6343
+ !isPackageShimFile(fileName);
6344
+ const errorsOf = (p) => keptErrors(p, ts.getPreEmitDiagnostics(p, diagnosticsKept));
6345
+ const keptErrors = (p, all) => {
6346
+ // First pass: every comment-side 2300's (file, name) — the partners
6347
+ // the second pass forgives.
6348
+ const commentDup = new Set();
6349
+ for (const d of all) {
6350
+ if (d.code !== 2300 || d.fileName === undefined || d.pos === undefined || d.end === undefined)
6351
+ continue;
6352
+ if (!isJsSourceFileName(d.fileName))
6353
+ continue;
6354
+ const sf = p.getSourceFile(d.fileName);
6355
+ if (sf && insideBlockComment(sf.text, d.pos))
6356
+ commentDup.add(`${d.fileName}:${sf.text.slice(d.pos, d.end)}`);
6357
+ }
6358
+ // The syntactic diagnostics of a JS file, asked for only when a
6359
+ // diagnostic names a code an opinion row covers.
6360
+ const syntactic = new Map();
6361
+ const syntacticOf = (sf) => {
6362
+ let list = syntactic.get(sf.fileName);
6363
+ if (list === undefined) {
6364
+ list = p.getSyntacticDiagnostics(sf);
6365
+ syntactic.set(sf.fileName, list);
6366
+ }
6367
+ return list;
6368
+ };
6369
+ // The older filters that answer from the file name, the source text or
6370
+ // the syntax alone. The recording pass below uses this subset: the two
6371
+ // filters that ask the CHECKER a question
6372
+ // (inferredJsDiagnosticSuppressed, isNpmStaticSubclassArgument) are
6373
+ // deliberately not consulted for an admitted diagnostic. Before this
6374
+ // table, an admitted diagnostic was dropped before the chain reached
6375
+ // them, so asking now would add a checker query a program's compile
6376
+ // never made — and tsgo answers the query on a destructuring pattern
6377
+ // with a panic ("Value is not an instance of 'TupleType'"), which is how
6378
+ // this slice's Test262 replay first failed. The kept path still consults
6379
+ // every filter, in the order it always did.
6380
+ const keptApartFromOpinionTextually = (d) => !npmStaticFileSuppressed(d) &&
6381
+ !nodeModulesJsSuppressed(d) &&
6382
+ (d.fileName === undefined || !isPackageShimFile(d.fileName)) &&
6383
+ !namespaceCalleeSuppressed(p, d) &&
6384
+ !workspaceImplicitAnySuppressed(p, d) &&
6385
+ !typeofTestedNameSuppressed(p, d) &&
6386
+ !cjsTopLevelReturnSuppressed(p, d) &&
6387
+ !jsdocTypeSuppressed(p, d, commentDup);
6388
+ // Every filter except the opinion admission, in its historical order.
6389
+ const keptApartFromOpinion = (d) => keptApartFromOpinionTextually(d) &&
6390
+ !inferredJsDiagnosticSuppressed(p, d) &&
6391
+ !isNpmStaticSubclassArgument(p, d);
6392
+ const admitted = [];
6393
+ const kept = all.filter((d) => {
6394
+ if (d.category !== ts.DiagnosticCategory.Error)
6395
+ return false;
6396
+ // The 8xxx range is TypeScript's JSDoc-specific diagnostic family
6397
+ // (malformed tags, signature/tag mismatches): comment semantics with no
6398
+ // runtime meaning in a JS file, and no lowering view to record.
6399
+ if (d.fileName !== undefined &&
6400
+ isJsSourceFileName(d.fileName) &&
6401
+ d.code >= 8000 &&
6402
+ d.code <= 8999)
6403
+ return false;
6404
+ const opinion = jsOpinionOf7(p, d, projectCheckJs, syntacticOf);
6405
+ if (opinion !== null) {
6406
+ admitted.push({ d, opinion });
6407
+ return false;
6408
+ }
6409
+ return keptApartFromOpinion(d);
6410
+ });
6411
+ for (const { d, opinion } of admitted) {
6412
+ // No span, no site: nothing a view's lowering could be gated on.
6413
+ if (d.fileName === undefined || d.pos === undefined || d.end === undefined)
6414
+ continue;
6415
+ if (keptApartFromOpinionTextually(d))
6416
+ recordAdmittedOpinion(admittedSite(p, {
6417
+ file: d.fileName,
6418
+ pos: d.pos,
6419
+ end: d.end,
6420
+ code: d.code,
6421
+ view: opinion.view,
6422
+ }));
6423
+ }
6424
+ return kept;
6425
+ };
6426
+ // The tsc gate, with a second chance: the LOWERING world's checker
6427
+ // includes the divergence overrides (JSON.parse(): unknown, the Promise
6428
+ // executor shape, ...), which are TIGHTER than the standard lib — a
6429
+ // project that typechecks clean under its own tsc can still error here
6430
+ // (any-typed JSON.parse results, most commonly). Those errors are OURS,
6431
+ // not the project's, so they must not fail preflight: when the lowering
6432
+ // world has errors, the PROJECT world (same program without the override
6433
+ // declarations) is built and consulted. Clean there → preflight passes
6434
+ // and the override-affected sites meet the lowerer's honest fences
6435
+ // instead (the SC1100 checked-cast family). Dirty there → the project-
6436
+ // world errors are the ones reported: they are reproducible with the
6437
+ // project's own tsc, which is what "fix type errors first" asks for.
6438
+ // With JSX sources, the program over the original text answers the tsc
6439
+ // gate; its positions move into the rewritten text the program holds.
6440
+ // Errors only the rewritten text has come from the calls the JSX lowers
6441
+ // to (a factory whose signature does not accept them).
6442
+ const tscWorld = load.tscWorld;
6443
+ const tscErrors = tscWorld === undefined ? errorsOf(program) : keptErrors(tscWorld.program, tscWorld.diagnostics);
6444
+ if (tscErrors.length > 0) {
6445
+ const world = tscWorld === undefined || tscWorld.declWorldFallback === true
6446
+ ? load.projectWorld()
6447
+ : (tscWorld.projectWorld ?? tscWorld.program);
6448
+ for (const d of errorsOf(world)) {
6449
+ const diag = toPassthrough(d);
6450
+ const lowered = tscWorld === undefined ? undefined : load.jsxSources?.get(diag.loc.file);
6451
+ if (lowered !== undefined) {
6452
+ diag.loc = {
6453
+ ...diag.loc,
6454
+ start: lowered.rewrittenPosition(diag.loc.start, false),
6455
+ end: lowered.rewrittenPosition(diag.loc.end, true),
6456
+ };
6457
+ }
6458
+ diags.push(diag);
6459
+ }
6460
+ }
6461
+ else if (load.jsxSources !== undefined) {
6462
+ for (const file of load.jsxSources.keys()) {
6463
+ const sf = program.getSourceFile(file);
6464
+ if (sf === undefined)
6465
+ continue;
6466
+ const own = [...program.getSyntacticDiagnostics(sf), ...program.getSemanticDiagnostics(sf)];
6467
+ for (const d of keptErrors(program, own)) {
6468
+ const diag = toPassthrough(d);
6469
+ diag.message = `${diag.message} (in the call this JSX lowers to)`;
6470
+ diags.push(diag);
6471
+ }
6472
+ }
6473
+ }
6474
+ return { diags, admittedOpinions: [...admittedOpinions.values()] };
6475
+ }
6051
6476
  /* ── the CJS named-import link check ─────────────────────────────────────
6052
6477
  * Node builds a CommonJS module's ESM facade from its LEXER (cjs-lexer.ts
6053
6478
  * mirrors it), never from execution — so a named import the checker binds
@@ -6642,7 +7067,7 @@ const nodeBuiltinNames = new Set(builtinModules);
6642
7067
  export { ambientDtsPath, fallbackDtsPath, isFallbackDtsPath, isNodeTypesPath, overridesDtsPath, } from "./dts-paths.js";
6643
7068
  export { builtinDefaultImportModule, canonicalBuiltinModule, npmBuiltinAliasOf, SUPPORTED_BUILTIN_MODULES, } from "./builtin-modules.js";
6644
7069
  export { npmPackageNameOf, workspacePackageOfPath } from "./workspace-registry.js";
6645
- export { requireSpecOf7 as requireSpecOf, isRequireStatement7 as isRequireStatement, requiresOf7 as requiresOf, splitRequireCallOf7 as splitRequireCallOf, isNodeEsmFile7 as isNodeEsmFile, resolveImport7 as resolveImport, resolveNpmImport7 as resolveNpmImport, locOf7 as locOf, requireEarlyReference7 as requireEarlyReference, inDeferredPosition7 as inDeferredPosition, };
7070
+ export { requireSpecOf7 as requireSpecOf, requireCallBindingKind7 as requireCallBindingKind, isRequireStatement7 as isRequireStatement, requiresOf7 as requiresOf, splitRequireCallOf7 as splitRequireCallOf, isNodeEsmFile7 as isNodeEsmFile, resolveImport7 as resolveImport, resolveNpmImport7 as resolveNpmImport, locOf7 as locOf, requireEarlyReference7 as requireEarlyReference, inDeferredPosition7 as inDeferredPosition, };
6646
7071
  /** True for JavaScript source files (.js/.mjs/.cjs) — the files whose
6647
7072
  * types come entirely from inference (checkJs + JSDoc) and whose classes
6648
7073
  * declare fields by constructor assignment. */