@scriptc/compiler 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (505) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +2 -36
  2. package/ambient/scriptc-overrides.d.ts +1 -25
  3. package/ambient/scriptc.d.ts +1 -9
  4. package/dist/backend/cycle-analysis.d.ts +56 -0
  5. package/dist/backend/cycle-analysis.js +175 -14
  6. package/dist/backend/cycle-analysis.js.map +1 -1
  7. package/dist/backend/cycle-analysis.test.js +95 -2
  8. package/dist/backend/cycle-analysis.test.js.map +1 -1
  9. package/dist/backend/cycle-mutability.d.ts +3 -7
  10. package/dist/backend/cycle-mutability.js +4 -30
  11. package/dist/backend/cycle-mutability.js.map +1 -1
  12. package/dist/backend/executable-features.d.ts +1 -1
  13. package/dist/backend/executable-features.js +3 -8
  14. package/dist/backend/executable-features.js.map +1 -1
  15. package/dist/backend/immutability.d.ts +57 -0
  16. package/dist/backend/immutability.js +178 -0
  17. package/dist/backend/immutability.js.map +1 -0
  18. package/dist/backend/immutability.test.js +131 -0
  19. package/dist/backend/immutability.test.js.map +1 -0
  20. package/dist/backend/library-pack.js +0 -2
  21. package/dist/backend/library-pack.js.map +1 -1
  22. package/dist/backend/linker.js +1 -1
  23. package/dist/backend/linker.js.map +1 -1
  24. package/dist/backend/llvm/borrowed-inputs.d.ts +9 -2
  25. package/dist/backend/llvm/borrowed-inputs.js +31 -3
  26. package/dist/backend/llvm/borrowed-inputs.js.map +1 -1
  27. package/dist/backend/llvm/checked-narrows.test.js +1 -1
  28. package/dist/backend/llvm/classes.d.ts +28 -0
  29. package/dist/backend/llvm/classes.js +48 -14
  30. package/dist/backend/llvm/classes.js.map +1 -1
  31. package/dist/backend/llvm/classes.test.js +134 -6
  32. package/dist/backend/llvm/classes.test.js.map +1 -1
  33. package/dist/backend/llvm/common.d.ts +13 -0
  34. package/dist/backend/llvm/common.js +13 -0
  35. package/dist/backend/llvm/common.js.map +1 -1
  36. package/dist/backend/llvm/constant-callbacks.d.ts +1 -1
  37. package/dist/backend/llvm/constant-callbacks.js +3 -3
  38. package/dist/backend/llvm/constant-callbacks.js.map +1 -1
  39. package/dist/backend/llvm/constant-callbacks.test.js +1 -1
  40. package/dist/backend/llvm/dense-array-access.js +5 -4
  41. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  42. package/dist/backend/llvm/dense-array-access.test.js +10 -2
  43. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  44. package/dist/backend/llvm/dyn.d.ts +2 -1
  45. package/dist/backend/llvm/dyn.js +3 -76
  46. package/dist/backend/llvm/dyn.js.map +1 -1
  47. package/dist/backend/llvm/emitter.d.ts +67 -19
  48. package/dist/backend/llvm/emitter.js +443 -226
  49. package/dist/backend/llvm/emitter.js.map +1 -1
  50. package/dist/backend/llvm/emitter.test.js +21 -3
  51. package/dist/backend/llvm/emitter.test.js.map +1 -1
  52. package/dist/backend/llvm/expr-async.test.js +1 -1
  53. package/dist/backend/llvm/expr-calls.js +14 -6
  54. package/dist/backend/llvm/expr-calls.js.map +1 -1
  55. package/dist/backend/llvm/expr-containers.js +41 -14
  56. package/dist/backend/llvm/expr-containers.js.map +1 -1
  57. package/dist/backend/llvm/expr-control.js +4 -107
  58. package/dist/backend/llvm/expr-control.js.map +1 -1
  59. package/dist/backend/llvm/expr-dispatch.d.ts +1 -2
  60. package/dist/backend/llvm/expr-dispatch.js +0 -41
  61. package/dist/backend/llvm/expr-dispatch.js.map +1 -1
  62. package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
  63. package/dist/backend/llvm/expr-dynamic.js +13 -27
  64. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  65. package/dist/backend/llvm/expr-primitives.js +30 -3
  66. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  67. package/dist/backend/llvm/expr-primitives.test.js +55 -2
  68. package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
  69. package/dist/backend/llvm/expr-stream-bridges.js +4 -4
  70. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  71. package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
  72. package/dist/backend/llvm/lib-dispatch.js +0 -1
  73. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  74. package/dist/backend/llvm/lib-filesystem.js +0 -13
  75. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  76. package/dist/backend/llvm/lib-shared.js +0 -8
  77. package/dist/backend/llvm/lib-shared.js.map +1 -1
  78. package/dist/backend/llvm/local-array-reads.js +3 -3
  79. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  80. package/dist/backend/llvm/local-array-reads.test.js +1 -1
  81. package/dist/backend/llvm/local-union-storage.test.js +1 -1
  82. package/dist/backend/llvm/loop-array-borrows.d.ts +5 -2
  83. package/dist/backend/llvm/loop-array-borrows.js +27 -8
  84. package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
  85. package/dist/backend/llvm/map-number-lookup.d.ts +14 -0
  86. package/dist/backend/llvm/map-number-lookup.js +33 -2
  87. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  88. package/dist/backend/llvm/map-read-lifetimes.d.ts +5 -0
  89. package/dist/backend/llvm/map-read-lifetimes.js +20 -4
  90. package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
  91. package/dist/backend/llvm/map-read-lifetimes.test.js +25 -3
  92. package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
  93. package/dist/backend/llvm/reference-writes.d.ts +124 -0
  94. package/dist/backend/llvm/reference-writes.js +1090 -0
  95. package/dist/backend/llvm/reference-writes.js.map +1 -0
  96. package/dist/backend/llvm/shapes.d.ts +8 -5
  97. package/dist/backend/llvm/shapes.js +37 -13
  98. package/dist/backend/llvm/shapes.js.map +1 -1
  99. package/dist/backend/llvm/shapes.test.js +3 -3
  100. package/dist/backend/llvm/stack-unions.test.js +1 -1
  101. package/dist/backend/llvm/string-construction.test.js +1 -1
  102. package/dist/backend/llvm/string-lifetimes.test.js +40 -11
  103. package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
  104. package/dist/backend/llvm/string-reads.d.ts +3 -0
  105. package/dist/backend/llvm/string-reads.js +31 -0
  106. package/dist/backend/llvm/string-reads.js.map +1 -1
  107. package/dist/backend/llvm/switch-dispatch.d.ts +2 -2
  108. package/dist/backend/llvm/switch-dispatch.js +35 -22
  109. package/dist/backend/llvm/switch-dispatch.js.map +1 -1
  110. package/dist/backend/llvm/switch-dispatch.test.js +29 -11
  111. package/dist/backend/llvm/switch-dispatch.test.js.map +1 -1
  112. package/dist/backend/llvm/walk-borrows.d.ts +8 -1
  113. package/dist/backend/llvm/walk-borrows.js +15 -4
  114. package/dist/backend/llvm/walk-borrows.js.map +1 -1
  115. package/dist/backend/may-throw.d.ts +36 -2
  116. package/dist/backend/may-throw.js +308 -21
  117. package/dist/backend/may-throw.js.map +1 -1
  118. package/dist/backend/may-throw.test.js +147 -2
  119. package/dist/backend/may-throw.test.js.map +1 -1
  120. package/dist/backend/native/artifact-stamps.js +0 -2
  121. package/dist/backend/native/artifact-stamps.js.map +1 -1
  122. package/dist/backend/native/cache-warm.d.ts +1 -1
  123. package/dist/backend/native/cache-warm.js +2 -3
  124. package/dist/backend/native/cache-warm.js.map +1 -1
  125. package/dist/backend/native/compiler-fingerprint.d.ts +1 -1
  126. package/dist/backend/native/compiler-fingerprint.js +4 -7
  127. package/dist/backend/native/compiler-fingerprint.js.map +1 -1
  128. package/dist/backend/native/contracts.d.ts +3 -28
  129. package/dist/backend/native/driver.js +1 -3
  130. package/dist/backend/native/driver.js.map +1 -1
  131. package/dist/backend/native/executable.d.ts +0 -15
  132. package/dist/backend/native/executable.js +17 -172
  133. package/dist/backend/native/executable.js.map +1 -1
  134. package/dist/backend/native/tool-identity.js +0 -1
  135. package/dist/backend/native/tool-identity.js.map +1 -1
  136. package/dist/backend/native/vendor.d.ts +1 -1
  137. package/dist/backend/native/vendor.js +1 -1
  138. package/dist/backend/native/vendor.js.map +1 -1
  139. package/dist/backend/native-link-info-core.d.ts +0 -2
  140. package/dist/backend/native-link-info-core.js.map +1 -1
  141. package/dist/backend/native-toolchain.test.js +23 -33
  142. package/dist/backend/native-toolchain.test.js.map +1 -1
  143. package/dist/backend/publication.d.ts +5 -0
  144. package/dist/backend/publication.js +10 -0
  145. package/dist/backend/publication.js.map +1 -1
  146. package/dist/backend/publication.test.js +1 -1
  147. package/dist/backend/runtime-abi.d.ts +2 -2
  148. package/dist/backend/runtime-abi.js +2 -2
  149. package/dist/backend/runtime-pack-core.d.ts +1 -2
  150. package/dist/backend/runtime-pack-core.js +5 -14
  151. package/dist/backend/runtime-pack-core.js.map +1 -1
  152. package/dist/backend/runtime-pack-targets.test.js +3 -8
  153. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  154. package/dist/backend/runtime-pack.test.js +22 -19
  155. package/dist/backend/runtime-pack.test.js.map +1 -1
  156. package/dist/backend/target-diagnostics.d.ts +0 -5
  157. package/dist/backend/target-diagnostics.js +1 -11
  158. package/dist/backend/target-diagnostics.js.map +1 -1
  159. package/dist/backend/target-diagnostics.test.js +1 -1
  160. package/dist/backend/vendor-archives.d.ts +1 -7
  161. package/dist/backend/vendor-archives.js +9 -189
  162. package/dist/backend/vendor-archives.js.map +1 -1
  163. package/dist/backend/vendor-inputs.d.ts +0 -1
  164. package/dist/backend/vendor-inputs.js +0 -1
  165. package/dist/backend/vendor-inputs.js.map +1 -1
  166. package/dist/backend/warm-cache.js +3 -5
  167. package/dist/backend/warm-cache.js.map +1 -1
  168. package/dist/cli/command.js +4 -8
  169. package/dist/cli/command.js.map +1 -1
  170. package/dist/cli/host.d.ts +1 -1
  171. package/dist/cli/usage.d.ts +1 -5
  172. package/dist/cli/usage.js +4 -9
  173. package/dist/cli/usage.js.map +1 -1
  174. package/dist/compat/fetch-profile.d.ts +2 -2
  175. package/dist/compat/fetch-profile.js +16 -25
  176. package/dist/compat/fetch-profile.js.map +1 -1
  177. package/dist/compile-types.d.ts +2 -17
  178. package/dist/contracts/check.d.ts +8 -0
  179. package/dist/contracts/check.js +1573 -0
  180. package/dist/contracts/check.js.map +1 -0
  181. package/dist/coverage/report.d.ts +5 -22
  182. package/dist/coverage/report.js +12 -76
  183. package/dist/coverage/report.js.map +1 -1
  184. package/dist/coverage/surface-manifest.d.ts +3 -3
  185. package/dist/coverage/surface-manifest.js +22 -27
  186. package/dist/coverage/surface-manifest.js.map +1 -1
  187. package/dist/coverage/verdict-cache.d.ts +1 -3
  188. package/dist/coverage/verdict-cache.js +2 -7
  189. package/dist/coverage/verdict-cache.js.map +1 -1
  190. package/dist/diagnostics/diagnostic.d.ts +11 -60
  191. package/dist/diagnostics/diagnostic.js +39 -118
  192. package/dist/diagnostics/diagnostic.js.map +1 -1
  193. package/dist/diagnostics/envelope.d.ts +3 -4
  194. package/dist/diagnostics/envelope.js +0 -9
  195. package/dist/diagnostics/envelope.js.map +1 -1
  196. package/dist/diagnostics/envelope.test.js +1 -1
  197. package/dist/diagnostics/envelope.test.js.map +1 -1
  198. package/dist/executable/executable-cache.d.ts +0 -3
  199. package/dist/executable/executable-cache.js +2 -4
  200. package/dist/executable/executable-cache.js.map +1 -1
  201. package/dist/executable/executable-cache.test.js +0 -4
  202. package/dist/executable/executable-cache.test.js.map +1 -1
  203. package/dist/executable/prepare.js +14 -2
  204. package/dist/executable/prepare.js.map +1 -1
  205. package/dist/frontend/analysis.js +10 -10
  206. package/dist/frontend/analysis.js.map +1 -1
  207. package/dist/frontend/cjs-syntax.js +0 -88
  208. package/dist/frontend/cjs-syntax.js.map +1 -1
  209. package/dist/frontend/contract-types.d.ts +50 -0
  210. package/dist/frontend/contract-types.js +232 -0
  211. package/dist/frontend/contract-types.js.map +1 -0
  212. package/dist/frontend/dts-paths.d.ts +1 -1
  213. package/dist/frontend/dts-paths.js +1 -1
  214. package/dist/frontend/lowering/abstract-equality.js +1 -4
  215. package/dist/frontend/lowering/abstract-equality.js.map +1 -1
  216. package/dist/frontend/lowering/array-values.js +4 -11
  217. package/dist/frontend/lowering/array-values.js.map +1 -1
  218. package/dist/frontend/lowering/builtins/arguments.js +0 -13
  219. package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
  220. package/dist/frontend/lowering/builtins/crypto.d.ts +0 -4
  221. package/dist/frontend/lowering/builtins/crypto.js +0 -4
  222. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  223. package/dist/frontend/lowering/builtins/json.js +1 -39
  224. package/dist/frontend/lowering/builtins/json.js.map +1 -1
  225. package/dist/frontend/lowering/builtins/module-resolution.d.ts +0 -15
  226. package/dist/frontend/lowering/builtins/module-resolution.js +5 -44
  227. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  228. package/dist/frontend/lowering/builtins/numbers.d.ts +0 -6
  229. package/dist/frontend/lowering/builtins/numbers.js +6 -57
  230. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  231. package/dist/frontend/lowering/builtins/promises.js +4 -67
  232. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  233. package/dist/frontend/lowering/builtins/workers.js +1 -1
  234. package/dist/frontend/lowering/builtins/workers.js.map +1 -1
  235. package/dist/frontend/lowering/call-arguments.d.ts +1 -37
  236. package/dist/frontend/lowering/call-arguments.js +11 -94
  237. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  238. package/dist/frontend/lowering/call-signatures.d.ts +1 -6
  239. package/dist/frontend/lowering/call-signatures.js +16 -68
  240. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  241. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +19 -4
  242. package/dist/frontend/lowering/class-dynamic-dispatch.js +168 -98
  243. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  244. package/dist/frontend/lowering/class-dynamic-dispatch.test.js +44 -4
  245. package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
  246. package/dist/frontend/lowering/class-method-mutations.js +0 -2
  247. package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
  248. package/dist/frontend/lowering/class-protocols.js +1 -1
  249. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  250. package/dist/frontend/lowering/coercions/function-adapters.js +5 -35
  251. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  252. package/dist/frontend/lowering/coercions/state.d.ts +0 -1
  253. package/dist/frontend/lowering/coercions/state.js +0 -1
  254. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  255. package/dist/frontend/lowering/coercions/structural-plans.js +2 -4
  256. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  257. package/dist/frontend/lowering/coercions/structural.js +2 -12
  258. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  259. package/dist/frontend/lowering/coercions/unions.d.ts +12 -0
  260. package/dist/frontend/lowering/coercions/unions.js +63 -1
  261. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  262. package/dist/frontend/lowering/containers/array-callbacks.js +9 -28
  263. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  264. package/dist/frontend/lowering/containers/array-construction.js +2 -3
  265. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  266. package/dist/frontend/lowering/containers/array-methods.js +10 -54
  267. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  268. package/dist/frontend/lowering/containers/bytes.js +0 -1
  269. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  270. package/dist/frontend/lowering/containers/callback-arguments.js +2 -10
  271. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  272. package/dist/frontend/lowering/containers/collection-methods.js +1 -6
  273. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  274. package/dist/frontend/lowering/containers/indexed-objects.js +0 -2
  275. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  276. package/dist/frontend/lowering/containers/string-and-regexp.d.ts +0 -6
  277. package/dist/frontend/lowering/containers/string-and-regexp.js +2 -10
  278. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  279. package/dist/frontend/lowering/expressions/evaluation-safety.js +0 -3
  280. package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
  281. package/dist/frontend/lowering/expressions/native-proxy.js +1 -1
  282. package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
  283. package/dist/frontend/lowering/expressions/nullish-assignment.js +0 -1
  284. package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
  285. package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -8
  286. package/dist/frontend/lowering/expressions/object-literals.js +8 -35
  287. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  288. package/dist/frontend/lowering/expressions/optional-chains.d.ts +0 -4
  289. package/dist/frontend/lowering/expressions/optional-chains.js +7 -67
  290. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  291. package/dist/frontend/lowering/function-context.js +0 -1
  292. package/dist/frontend/lowering/function-context.js.map +1 -1
  293. package/dist/frontend/lowering/generic-functions.js +0 -1
  294. package/dist/frontend/lowering/generic-functions.js.map +1 -1
  295. package/dist/frontend/lowering/lib-boundary.js +10 -77
  296. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  297. package/dist/frontend/lowering/lower-array-sort.js +1 -10
  298. package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
  299. package/dist/frontend/lowering/lower-array-sort.test.js +2 -2
  300. package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
  301. package/dist/frontend/lowering/lower-assert.js +2 -3
  302. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  303. package/dist/frontend/lowering/lower-async-iteration.js +1 -1
  304. package/dist/frontend/lowering/lower-calls.d.ts +2 -27
  305. package/dist/frontend/lowering/lower-calls.js +56 -465
  306. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  307. package/dist/frontend/lowering/lower-classes.js +11 -49
  308. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  309. package/dist/frontend/lowering/lower-comptime.js +2 -3
  310. package/dist/frontend/lowering/lower-comptime.js.map +1 -1
  311. package/dist/frontend/lowering/lower-enums.js +5 -8
  312. package/dist/frontend/lowering/lower-enums.js.map +1 -1
  313. package/dist/frontend/lowering/lower-event-emitter.js +3 -4
  314. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  315. package/dist/frontend/lowering/lower-expando.js +3 -5
  316. package/dist/frontend/lowering/lower-expando.js.map +1 -1
  317. package/dist/frontend/lowering/lower-exprs.d.ts +0 -8
  318. package/dist/frontend/lowering/lower-exprs.js +133 -908
  319. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  320. package/dist/frontend/lowering/lower-functions.js +2 -5
  321. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  322. package/dist/frontend/lowering/lower-inspect.js +1 -50
  323. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  324. package/dist/frontend/lowering/lower-modules.d.ts +0 -43
  325. package/dist/frontend/lowering/lower-modules.js +25 -329
  326. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  327. package/dist/frontend/lowering/lower-modules.test.js +5 -5
  328. package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
  329. package/dist/frontend/lowering/lower-server.js +0 -30
  330. package/dist/frontend/lowering/lower-server.js.map +1 -1
  331. package/dist/frontend/lowering/lower-stdlib.d.ts +98 -0
  332. package/dist/frontend/lowering/{lower-island.js → lower-stdlib.js} +97 -1160
  333. package/dist/frontend/lowering/lower-stdlib.js.map +1 -0
  334. package/dist/frontend/lowering/lower-stmts.d.ts +0 -16
  335. package/dist/frontend/lowering/lower-stmts.js +58 -1016
  336. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  337. package/dist/frontend/lowering/lower-stmts.test.js +1 -1
  338. package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
  339. package/dist/frontend/lowering/lower-stream.js +1 -3
  340. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  341. package/dist/frontend/lowering/lowerer.d.ts +26 -151
  342. package/dist/frontend/lowering/lowerer.js +120 -770
  343. package/dist/frontend/lowering/lowerer.js.map +1 -1
  344. package/dist/frontend/lowering/lowerer.test.js +4 -51
  345. package/dist/frontend/lowering/lowerer.test.js.map +1 -1
  346. package/dist/frontend/lowering/narrowing-stability.d.ts +100 -0
  347. package/dist/frontend/lowering/narrowing-stability.js +1174 -0
  348. package/dist/frontend/lowering/narrowing-stability.js.map +1 -0
  349. package/dist/frontend/lowering/narrowing-stability.test.js +150 -0
  350. package/dist/frontend/lowering/narrowing-stability.test.js.map +1 -0
  351. package/dist/frontend/lowering/optional-arguments.js +0 -2
  352. package/dist/frontend/lowering/optional-arguments.js.map +1 -1
  353. package/dist/frontend/lowering/sanitize-class-types.test.js +2 -2
  354. package/dist/frontend/lowering/strict-equality.js +1 -1
  355. package/dist/frontend/lowering/strict-equality.js.map +1 -1
  356. package/dist/frontend/lowering/surfaces.d.ts +6 -45
  357. package/dist/frontend/lowering/surfaces.js +5 -65
  358. package/dist/frontend/lowering/surfaces.js.map +1 -1
  359. package/dist/frontend/module-syntax.d.ts +0 -3
  360. package/dist/frontend/module-syntax.js.map +1 -1
  361. package/dist/frontend/npm-node.d.ts +0 -7
  362. package/dist/frontend/npm-node.js +0 -7
  363. package/dist/frontend/npm-node.js.map +1 -1
  364. package/dist/frontend/npm-static-rewrite-syntax.d.ts +1 -1
  365. package/dist/frontend/npm-static-rewrite-syntax.js +6 -82
  366. package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
  367. package/dist/frontend/npm-static.d.ts +1 -1
  368. package/dist/frontend/npm-static.js +6 -71
  369. package/dist/frontend/npm-static.js.map +1 -1
  370. package/dist/frontend/npm.d.ts +3 -319
  371. package/dist/frontend/npm.js +6 -1007
  372. package/dist/frontend/npm.js.map +1 -1
  373. package/dist/frontend/npm.test.js +2 -197
  374. package/dist/frontend/npm.test.js.map +1 -1
  375. package/dist/frontend/pipeline-native.js +1 -2
  376. package/dist/frontend/pipeline-native.js.map +1 -1
  377. package/dist/frontend/pipeline.d.ts +3 -11
  378. package/dist/frontend/pipeline.js +37 -56
  379. package/dist/frontend/pipeline.js.map +1 -1
  380. package/dist/frontend/pipeline.test.js +12 -6
  381. package/dist/frontend/pipeline.test.js.map +1 -1
  382. package/dist/frontend/program.d.ts +0 -34
  383. package/dist/frontend/program.js +13 -98
  384. package/dist/frontend/program.js.map +1 -1
  385. package/dist/frontend/provenance-core.d.ts +0 -4
  386. package/dist/frontend/provenance-core.js +4 -37
  387. package/dist/frontend/provenance-core.js.map +1 -1
  388. package/dist/frontend/provenance-registry.d.ts +0 -4
  389. package/dist/frontend/provenance-registry.js +0 -20
  390. package/dist/frontend/provenance-registry.js.map +1 -1
  391. package/dist/frontend/resolve.d.ts +0 -12
  392. package/dist/frontend/resolve.js +0 -34
  393. package/dist/frontend/resolve.js.map +1 -1
  394. package/dist/frontend/runtime-resolve.js +2 -2
  395. package/dist/frontend/runtime-resolve.js.map +1 -1
  396. package/dist/frontend/services-node.js +2 -3
  397. package/dist/frontend/services-node.js.map +1 -1
  398. package/dist/frontend/services.d.ts +1 -8
  399. package/dist/frontend/services.js +2 -22
  400. package/dist/frontend/services.js.map +1 -1
  401. package/dist/frontend/services.test.js +0 -38
  402. package/dist/frontend/services.test.js.map +1 -1
  403. package/dist/frontend/tsc-codes.js +0 -11
  404. package/dist/frontend/tsc-codes.js.map +1 -1
  405. package/dist/frontend/type-mapper.d.ts +2 -27
  406. package/dist/frontend/type-mapper.js +85 -153
  407. package/dist/frontend/type-mapper.js.map +1 -1
  408. package/dist/index.d.ts +1 -1
  409. package/dist/index.js +7 -10
  410. package/dist/index.js.map +1 -1
  411. package/dist/ir/api.d.ts +1 -1
  412. package/dist/ir/api.js +1 -1
  413. package/dist/ir/api.js.map +1 -1
  414. package/dist/ir/builtin-effects.js +0 -5
  415. package/dist/ir/builtin-effects.js.map +1 -1
  416. package/dist/ir/builtin-signatures.d.ts +1 -1
  417. package/dist/ir/builtin-signatures.js +1 -55
  418. package/dist/ir/builtin-signatures.js.map +1 -1
  419. package/dist/ir/constant-globals.test.js +1 -1
  420. package/dist/ir/constant-tables.test.js +1 -1
  421. package/dist/ir/final-fields.test.js +1 -1
  422. package/dist/ir/initializer-bindings.test.js +1 -1
  423. package/dist/ir/int32-slots.d.ts +29 -3
  424. package/dist/ir/int32-slots.js +152 -66
  425. package/dist/ir/int32-slots.js.map +1 -1
  426. package/dist/ir/int32-slots.test.js +1 -1
  427. package/dist/ir/integer-loops.js +3 -0
  428. package/dist/ir/integer-loops.js.map +1 -1
  429. package/dist/ir/integer-loops.test.js +26 -1
  430. package/dist/ir/integer-loops.test.js.map +1 -1
  431. package/dist/ir/integer-ranges.d.ts +20 -0
  432. package/dist/ir/integer-ranges.js +178 -21
  433. package/dist/ir/integer-ranges.js.map +1 -1
  434. package/dist/ir/integer-ranges.test.js +148 -3
  435. package/dist/ir/integer-ranges.test.js.map +1 -1
  436. package/dist/ir/ir.d.ts +44 -284
  437. package/dist/ir/ir.js +10 -259
  438. package/dist/ir/ir.js.map +1 -1
  439. package/dist/ir/ir.test.js +2 -7
  440. package/dist/ir/ir.test.js.map +1 -1
  441. package/dist/ir/runtime-features.d.ts +3 -30
  442. package/dist/ir/runtime-features.js +5 -41
  443. package/dist/ir/runtime-features.js.map +1 -1
  444. package/dist/ir/scalar-records.test.js +1 -1
  445. package/dist/ir/serialize.d.ts +6 -2
  446. package/dist/ir/serialize.js +11 -3
  447. package/dist/ir/serialize.js.map +1 -1
  448. package/dist/ir/traverse.js +0 -21
  449. package/dist/ir/traverse.js.map +1 -1
  450. package/dist/ir/unshare.d.ts +14 -0
  451. package/dist/ir/unshare.js +60 -0
  452. package/dist/ir/unshare.js.map +1 -0
  453. package/dist/ir/unshare.test.js +115 -0
  454. package/dist/ir/unshare.test.js.map +1 -0
  455. package/dist/ir/validate.js +9 -207
  456. package/dist/ir/validate.js.map +1 -1
  457. package/dist/ir/validate.test.js +6 -6
  458. package/dist/library/fence-eval.test.js +1 -1
  459. package/dist/library/int-infer.test.js +4 -4
  460. package/dist/library/library-cache.test.js +5 -5
  461. package/dist/library/prepare.js +14 -20
  462. package/dist/library/prepare.js.map +1 -1
  463. package/dist/native/cli.js +0 -2
  464. package/dist/native/cli.js.map +1 -1
  465. package/dist/native/compiler.test.js +2 -4
  466. package/dist/native/compiler.test.js.map +1 -1
  467. package/dist/native/prepare.js +2 -4
  468. package/dist/native/prepare.js.map +1 -1
  469. package/dist/native/sanitizer.js +2 -16
  470. package/dist/native/sanitizer.js.map +1 -1
  471. package/dist/native/sanitizer.test.js +0 -3
  472. package/dist/native/sanitizer.test.js.map +1 -1
  473. package/dist/startup-cache.js +0 -2
  474. package/dist/startup-cache.js.map +1 -1
  475. package/package.json +20 -20
  476. package/surface-manifest.json +80 -88
  477. package/dist/backend/llvm/expr-island.d.ts +0 -15
  478. package/dist/backend/llvm/expr-island.js +0 -709
  479. package/dist/backend/llvm/expr-island.js.map +0 -1
  480. package/dist/frontend/lowering/coercions/island.d.ts +0 -37
  481. package/dist/frontend/lowering/coercions/island.js +0 -350
  482. package/dist/frontend/lowering/coercions/island.js.map +0 -1
  483. package/dist/frontend/lowering/lower-island.d.ts +0 -229
  484. package/dist/frontend/lowering/lower-island.js.map +0 -1
  485. package/dist/frontend/lowering/lower-island.test.js +0 -56
  486. package/dist/frontend/lowering/lower-island.test.js.map +0 -1
  487. package/dist/frontend/npm-fetch-analysis.d.ts +0 -17
  488. package/dist/frontend/npm-fetch-analysis.js +0 -109
  489. package/dist/frontend/npm-fetch-analysis.js.map +0 -1
  490. package/dist/frontend/npm-fetch-analysis.test.js +0 -130
  491. package/dist/frontend/npm-fetch-analysis.test.js.map +0 -1
  492. package/dist/frontend/npm-fetch-node.d.ts +0 -2
  493. package/dist/frontend/npm-fetch-node.js +0 -12
  494. package/dist/frontend/npm-fetch-node.js.map +0 -1
  495. package/dist/frontend/npm-fetch-syntax.d.ts +0 -6
  496. package/dist/frontend/npm-fetch-syntax.js +0 -202
  497. package/dist/frontend/npm-fetch-syntax.js.map +0 -1
  498. package/dist/native/runtime-typescript.d.ts +0 -4
  499. package/dist/native/runtime-typescript.js +0 -74
  500. package/dist/native/runtime-typescript.js.map +0 -1
  501. package/dist/native/runtime-typescript.test.js +0 -41
  502. package/dist/native/runtime-typescript.test.js.map +0 -1
  503. /package/dist/{frontend/lowering/lower-island.test.d.ts → backend/immutability.test.d.ts} +0 -0
  504. /package/dist/frontend/{npm-fetch-analysis.test.d.ts → lowering/narrowing-stability.test.d.ts} +0 -0
  505. /package/dist/{native/runtime-typescript.test.d.ts → ir/unshare.test.d.ts} +0 -0
@@ -1,123 +1,3 @@
1
- import type { FrontendServices } from "./services.js";
2
- export type EmbeddedFormat = "esm" | "cjs" | "json";
3
- export interface EmbeddedModule {
4
- /** The resolved REAL path (symlinks followed) — the loader's cache key. */
5
- key: string;
6
- source: string;
7
- format: EmbeddedFormat;
8
- /** The parsed source reaches Node's global fetch binding. This is a
9
- * semantic capability fact, unlike the old whole-source word scan: comments,
10
- * strings, property names, and locally-bound `fetch` identifiers do not set
11
- * it. The IR/link gates consume this bit without reparsing embedded text. */
12
- usesFetch?: true;
13
- /** CommonJS only: the synthesized ESM facade the island's module loader
14
- * evaluates when an ES module imports this file — default plus the LEXED
15
- * named exports (cjsEsmFacadeSource). ESM sources compile natively and
16
- * JSON keeps the loader's default-only wrapper, so both leave this
17
- * unset. */
18
- esm?: string;
19
- }
20
- export interface EmbeddedEdge {
21
- /** Importer's key. */
22
- from: string;
23
- /** The specifier as written in the importer's source. */
24
- specifier: string;
25
- /** Resolved target: an embedded module's key, or a "node:*" builtin. */
26
- to: string;
27
- /** Which call forms this resolution serves — Node picks the "exports"
28
- * condition set from the EDGE KIND, not the importer's format, so one
29
- * (from, specifier) can name TWO targets: a dual package's "import"
30
- * condition for import/import() sites and its "require" condition for
31
- * require() sites. "any" (relative files, builtins, edges whose kinds
32
- * agree) answers both lookups. */
33
- kind: "any" | "import" | "require";
34
- }
35
- /** What a dynamic import() specifier resolves to at build time. */
36
- export type DynamicImportResolution =
37
- /** An embedded module's key or a shimmed builtin's "node:x" key —
38
- * island.importDyn loads it through the engine's module system. */
39
- {
40
- kind: "module";
41
- key: string;
42
- }
43
- /** A Node builtin the island ships no shim for — a build diagnostic,
44
- * exactly like a static import of it. */
45
- | {
46
- kind: "unsupported-builtin";
47
- builtin: string;
48
- }
49
- /** The specifier resolves into the compiled program's own TypeScript.
50
- * Static builds expose its nominal live namespace; dynamic builds
51
- * marshal a snapshot namespace into the island. */
52
- | {
53
- kind: "program-module";
54
- }
55
- /** A supported Node builtin imported by a static build. Its namespace
56
- * token routes member reads through the existing builtin tables. */
57
- | {
58
- kind: "static-builtin";
59
- module: string;
60
- }
61
- /** No resolution — a build diagnostic, like static imports. */
62
- | {
63
- kind: "unresolved";
64
- message: string;
65
- };
66
- export interface NpmGraphError {
67
- /** Human-readable failure ("package 'x' requires 'node:stream', which
68
- * the island does not provide"). The caller attaches the import site. */
69
- message: string;
70
- }
71
- /** One Node builtin the embedded graph imports — the coverage report's
72
- * honesty about what the island must (or cannot) provide. */
73
- export interface NpmBuiltinUse {
74
- /** Canonical "node:x" key. */
75
- builtin: string;
76
- /** Whether the island ships a shim for it. */
77
- shimmed: boolean;
78
- /** Unshimmed AND only require()/import() edges reach it: the build
79
- * embeds the island's lazy throw at the call instead of failing —
80
- * Node's laziness for those edge kinds (Node itself would LOAD the
81
- * builtin; the trap is the island's honest refusal at the only point
82
- * Node would have loaded it). Always false when shimmed or when any
83
- * static import reaches it (static keeps the eager build error). */
84
- lazy: boolean;
85
- /** The packages whose embedded code imports it (sorted). */
86
- packages: string[];
87
- }
88
- /** One unresolvable specifier reached ONLY by require()/dynamic import()
89
- * edges: the build embeds a runtime trap with Node's call-time error shape
90
- * (MODULE_NOT_FOUND for require, ERR_MODULE_NOT_FOUND for import()) instead
91
- * of failing — the coverage report lists these beside the builtins so the
92
- * build output stays honest about what the binary cannot reach. */
93
- export interface NpmLazyTrap {
94
- /** The specifier as written at the call site. */
95
- specifier: string;
96
- /** The call forms that reach it (sorted, require first). "import" is a
97
- * STATIC import inside a lazily-reached module — Node links that whole
98
- * subgraph at the require()/import() boundary that reaches it, so the
99
- * failure surfaces there, at the call. */
100
- via: ("require" | "import()" | "import")[];
101
- /** The packages whose embedded code holds the call sites (sorted). */
102
- packages: string[];
103
- /** The specifier RESOLVED — to a native .node addon the island cannot
104
- * dlopen. The build embeds a throwing stub (Node's ERR_DLOPEN_FAILED
105
- * code) instead of the addon's raw bytes; the require/import() throws
106
- * at the call. Unset for the unresolvable rows above. */
107
- native?: boolean;
108
- }
109
- export interface NpmRuntimeGraph {
110
- modules: EmbeddedModule[];
111
- edges: EmbeddedEdge[];
112
- /** (importing file dir + specifier) → the package's runtime entry key. */
113
- entryOf: (fromFile: string, specifier: string) => string | null;
114
- /** Every Node builtin the embedded graph imports, shimmed or not. */
115
- builtins: NpmBuiltinUse[];
116
- /** Unresolvable lazily-reached specifiers embedded as runtime traps. */
117
- lazyTraps: NpmLazyTrap[];
118
- errors: NpmGraphError[];
119
- }
120
- export type { SpecifierUse, ModuleSpecifiers } from "./module-syntax.js";
121
1
  export interface NpmGraphHost {
122
2
  readFile: (path: string) => string | null;
123
3
  isFile: (path: string) => boolean;
@@ -126,29 +6,7 @@ export interface NpmGraphHost {
126
6
  realpath: (path: string) => string;
127
7
  }
128
8
  export declare const realNpmGraphHost: NpmGraphHost;
129
- /** Package name from a PATH into node_modules ("…/node_modules/@s/p/d/x.js"
130
- * → "@s/p"), for diagnostics/chains when the entry is a file, not a bare
131
- * specifier. Null when the path holds no node_modules segment. */
132
9
  export declare function packageNameOfPath(path: string): string | null;
133
- /** A bare-specifier import edge Node's ESM resolution REFUSES, with Node's
134
- * exact error message and code — or null (resolvable, or a shape this
135
- * probe stays conservative about). The three refusal shapes it answers,
136
- * per Node's PACKAGE_RESOLVE with the ["import","node","default"]
137
- * condition set:
138
- * - nothing installed: no node_modules/<name> from the importer up to
139
- * the filesystem root (and no matching self-scope) — ERR_MODULE_NOT_FOUND
140
- * ("Cannot find package ...");
141
- * - an "exports" map that refuses the subpath (unmatched, or matched to
142
- * a null target) — ERR_PACKAGE_PATH_NOT_EXPORTED. Node's self-reference
143
- * rule participates: a nearest package scope whose "name" matches makes
144
- * that scope's "exports" the FINAL answer (no node_modules fallback);
145
- * - a matched exports target whose exact file does not exist —
146
- * ERR_MODULE_NOT_FOUND ("Cannot find module '<abs>' ..."). Exports
147
- * targets resolve to exact files in Node's ESM — no extension guessing.
148
- * Everything else (no "exports": legacy main/index resolution with its
149
- * leniencies; directory-shaped targets; unreadable package.json) answers
150
- * null — the caller keeps its existing story. Callers exclude builtins and
151
- * project-internal (#alias/self-name) resolutions BEFORE probing. */
152
10
  export interface NodeImportRefusal {
153
11
  message: string;
154
12
  code: "ERR_MODULE_NOT_FOUND" | "ERR_PACKAGE_PATH_NOT_EXPORTED";
@@ -157,193 +15,19 @@ export interface NodeImportRefusal {
157
15
  url?: string;
158
16
  }
159
17
  export declare function probeNodeImportRefusal(fromFile: string, specifier: string, host?: NpmGraphHost): NodeImportRefusal | null;
160
- /** A bare-specifier `require()` edge Node's CJS resolution REFUSES because
161
- * NOTHING INSTALLED resolves it: no node_modules/<name> from the requiring
162
- * file up to the filesystem root, and no self-scope whose "name" matches.
163
- * Answers Node's exact require-site Error message (MODULE_NOT_FOUND's
164
- * "Cannot find module '<spec>'" with the one-entry require stack — the
165
- * message property really carries both lines). Everything else — installed
166
- * packages (whatever their exports say), builtins, relative and "#"
167
- * specifiers — answers null: the callers' existing stories stand. Unlike
168
- * the ESM startup-crash channel (SEMANTICS.md 287), this refusal is a
169
- * RUNTIME throw at the require site, catchable — the optional-dependency
170
- * try/require pattern depends on exactly that. */
171
18
  export declare function probeNodeRequireRefusal(fromFile: string, specifier: string, host?: NpmGraphHost): {
172
19
  message: string;
173
20
  } | null;
174
- export declare class NpmGraphBuilder {
175
- private readonly services;
21
+ export declare class NodePackageResolver {
176
22
  private readonly host;
177
- private readonly modules;
178
- private readonly edges;
179
- private readonly edgeSeen;
180
- private readonly entries;
181
- readonly errors: NpmGraphError[];
23
+ private readonly errors;
182
24
  private readonly pkgJsonCache;
183
- /** Modules whose format the RESOLUTION decided (the "module" field names
184
- * ESM sources regardless of the package's "type"). */
185
25
  private readonly formatOverrides;
186
- /** Canonical "node:x" → packages whose code imports it. */
187
- private readonly builtinsSeen;
188
- /** Canonical "node:x" keys some STATIC import reaches — those keep the
189
- * eager build error, so their builtins never mark lazy. */
190
- private readonly builtinsEager;
191
- /** Unresolvable (or native-addon) lazily-reached specifiers → merged
192
- * call forms/packages. */
193
- private readonly lazyTrapsSeen;
194
- /** Synthetic keys for embedded import()-not-found stubs. */
195
- private importTrapCount;
196
- /** moduleSpecifiersOf per module key — sweepEdges parses each module
197
- * once; the `__require` attribution chain re-reads helper chunks
198
- * through this cache. */
199
- private readonly specifiersCache;
200
- /** Helper attribution can read a module before walk reaches it. Share
201
- * preparation so its edges and embedded source always use the same JS. */
202
- private readonly sourceCache;
203
- constructor(services: FrontendServices, host?: NpmGraphHost);
204
- /** Resolve one runtime module without embedding it. This is the package
205
- * half of import.meta.resolve/require.resolve: the answer is executable
206
- * source under Node's import/require conditions, never the declaration-file
207
- * answer from resolve.ts. Diagnostics produced by the graph-oriented
208
- * resolver are discarded here; the introspection lowering supplies Node's
209
- * public error shape separately. */
26
+ constructor(host?: NpmGraphHost);
210
27
  resolveForIntrospection(fromFile: string, specifier: string, mode: "import" | "require"): string | null;
211
- /** Registers one user-level npm import and walks everything it reaches.
212
- * Idempotent per (importing dir, specifier). */
213
- addImport(fromFile: string, specifier: string): void;
214
- /** Registers one user-level RELATIVE import whose target lives inside
215
- * node_modules — the e2e driver shape (`import "../node_modules/vercel/
216
- * dist/index.js"`): tsc resolves the FILE into the program, but shipped
217
- * package code has exactly one execution home, the embedded engine.
218
- * Resolves with Node's file rules, embeds the reached graph EAGERLY (a
219
- * static import links at the root), and answers the runtime entry key.
220
- * Idempotent per (importing dir, specifier). */
221
- addFileImport(fromFile: string, specifier: string): string | null;
222
- /** Registers one user-level dynamic `import(specifier)` and embeds what
223
- * it reaches, returning the build-time classification the lowering acts
224
- * on. Bare package specifiers take the same path as static imports;
225
- * builtins map to their island shim keys ("fs" → "node:fs") or report
226
- * the missing shim; RELATIVE specifiers — the shape static imports never
227
- * see, because tsc compiles those — resolve against the importing FILE
228
- * with Node's file/extension/directory rules and embed the reached JS
229
- * graph. A relative target that is TypeScript is the program's own
230
- * module (compiled natively and exposed through the import lowering), and one
231
- * with an extension no loader executes (.wasm, .node, ...) embeds a stub
232
- * whose EVALUATION throws Node's exact ERR_UNKNOWN_FILE_EXTENSION
233
- * TypeError — the build succeeds and the import() rejects at runtime,
234
- * which is precisely what Node does. */
235
- addDynamicImport(fromFile: string, specifier: string): DynamicImportResolution;
236
- /** Embeds (once per distinct refusal) the ESM stub whose EVALUATION
237
- * throws a probed Node refusal — the import() rejects at runtime with
238
- * Node's exact message and code, the build succeeds. */
239
- private refusalTrap;
240
- /** The runtime entry key a previously-added import resolved to. */
241
- entryOf(fromFile: string, specifier: string): string | null;
242
- /** Registers one user-level createRequire(...) require and walks what
243
- * it reaches, answering the runtime entry key — resolveEntry's twin
244
- * under Node's "require" condition (a dual package embeds its CJS arm,
245
- * exactly what Node's createRequire loads). The cache key carries the
246
- * mode so a file both importing and requiring one specifier keeps two
247
- * entries, like the graph's own kind-split edges. */
248
- addRequire(fromFile: string, specifier: string): string | null;
249
- /** The embedded format of a resolved module key ("cjs"/"esm"/"json") —
250
- * the require lowering picks its export name by it (a CJS facade's
251
- * default IS module.exports; an ESM entry answers its namespace, the
252
- * require(esm) shape). */
253
- moduleFormatOf(key: string): EmbeddedFormat | null;
254
- private entryKeyFor;
255
- private resolveEntry;
256
- /** The cjs-lexer.ts pass over every embedded CommonJS module: lex the
257
- * export names exactly as Node's vendored lexer would, follow the
258
- * re-export forms (`module.exports = require(…)`, table spreads/values,
259
- * the tsc/babel star patterns) through the ALREADY-RESOLVED edges
260
- * (builtin and unresolved targets are skipped; a require cycle
261
- * contributes what is known when re-entered, like Node's seen-set), then
262
- * synthesize each module's ESM facade. */
263
- private synthesizeCjsFacades;
264
- finish(): NpmRuntimeGraph;
265
- /** Records one unresolvable lazily-reached specifier for the build-time
266
- * inventory (the coverage report's lazy-trap rows). `via` carries only
267
- * the call forms whose OWN resolution failed — with per-kind condition
268
- * resolution, one form of a specifier can fail while another succeeds. */
269
- private noteLazyTrap;
270
- /** Embeds the throwing ESM stub for an unresolvable dynamic import()
271
- * edge — Node's exact ERR_MODULE_NOT_FOUND shape at evaluation: bare
272
- * specifiers say `Cannot find package 'x' imported from <file>`,
273
- * relative ones resolve against the importer first and say `Cannot find
274
- * module '<abs>' imported from <file>` carrying the file:// url, which
275
- * is what Node's ESM resolver rejects with. Returns the stub's key (the
276
- * edge target). require() never reaches these: unresolvable require
277
- * edges embed NO edge and the island's require shim throws Node's
278
- * MODULE_NOT_FOUND at the call, with the LIVE require stack. */
279
- private importNotFoundTrap;
280
- /** The throwing stub embedded for a resolved .node native addon: Node's
281
- * ERR_DLOPEN_FAILED code (what a broken dlopen throws) with the island's
282
- * honest message. Evaluation throws — at the require() call, at a
283
- * facade-mediated import, at import() — and the CJS cache keeps no entry
284
- * for a throwing module, so every retry throws again, like Node. */
285
- static nativeAddonStub(key: string): string;
286
28
  private pkgJsonOf;
287
- /** The nearest package.json "type" above `file` — the .js format rule.
288
- * Resolution-time overrides (the "module" field) win. */
289
- private formatOf;
290
- /** Node-style file resolution: exact file, extension candidates
291
- * (commander requires './suggestSimilar'; ".node" is in Node's require
292
- * probe list — the resolved addon embeds as a throwing dlopen stub),
293
- * then directory resolution (the directory's package.json "main", else
294
- * its index files). */
295
29
  private resolveFile;
296
- /** "a → b → c" — the package chain from the user's import to the point
297
- * of failure, for diagnostics. */
298
30
  private static chainOf;
299
- /** Locates node_modules/<name> by walking up from `fromDir` to the
300
- * filesystem ROOT (dependencies hoist arbitrarily far in workspace
301
- * layouts), following symlinks with realpath (pnpm/bun virtual stores),
302
- * then resolves the runtime entry: package.json "exports" with the
303
- * given condition (strict — an exports map that doesn't match is an
304
- * error, like Node's ERR_PACKAGE_PATH_NOT_EXPORTED), else the "module"/
305
- * "main" fallbacks. Returns the realpath'd entry key. */
306
31
  private resolvePackage;
307
- /** Resolves a package-internal "#" specifier from the nearest package
308
- * scope. Relative targets stay in that package; bare package targets
309
- * re-enter the same runtime resolver so edge-kind conditions and package
310
- * self-resolution remain consistent. */
311
32
  private resolvePackageImport;
312
- /** Modules reached ONLY through lazy edges so far. Node has not linked
313
- * these at the root: the whole subgraph behind a require()/import()
314
- * boundary links AT THE CALL, so every blocked edge inside it — static
315
- * imports included — fails there at runtime, never at build time. A
316
- * later STATIC path promotes the module to eager: its edges re-sweep so
317
- * blocked static ones become build errors, exactly the graph Node would
318
- * refuse at link. */
319
- private readonly lazilyReached;
320
- /** Embeds `key` and everything it reaches. `chain` is the package path
321
- * from the user's import to this module's package — diagnostics name it
322
- * so a failure five dependencies deep is attributable. `lazy` is the
323
- * REACHABILITY mode: true when every path from the user's import to this
324
- * module crosses a require()/dynamic-import() edge. */
325
- private walk;
326
- private sourceOf;
327
- /** moduleSpecifiersOf through the per-module cache (each module parses
328
- * once even across promotion re-sweeps, and the `__require` attribution
329
- * chain re-reads helper chunks it never sweeps itself). */
330
- private specifiersOf;
331
- /** The module whose scope DEFINES the `__require` helper that `key`'s
332
- * call sites invoke, or null when it is key's own (or unresolvable).
333
- * esbuild splits the helper into a shared chunk that every other chunk
334
- * imports; the helper closed over THAT chunk's banner require
335
- * (createRequire(import.meta.url)), so Node resolves its calls from the
336
- * DEFINING chunk — and the island's require shim looks the edge up
337
- * under that key at the call. Follows import → re-export hops through
338
- * intermediate chunks, bounded. */
339
- private requireHelperOriginOf;
340
- /** One module's edge sweep. Per-edge semantics match Node's: an edge is
341
- * EAGER only when the module itself is eagerly reached AND the site is a
342
- * static import/export declaration — Node's link-time surface, where a
343
- * blocked edge fails the BUILD. Everything else is LAZY — Node fails
344
- * require at the CALL and import() at evaluation, and a subgraph behind
345
- * either boundary (its static edges included) links at that call — so a
346
- * blocked lazy edge embeds a runtime trap and the build succeeds: a
347
- * program that never executes the call runs fine under Node too. */
348
- private sweepEdges;
349
33
  }