eliscript 0.0.1 → 0.0.3

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 (417) hide show
  1. package/README.md +61 -0
  2. package/bootstrap/README.md +26 -0
  3. package/bootstrap/backends/README.md +515 -0
  4. package/bootstrap/backends/async.eli +230 -0
  5. package/bootstrap/backends/binary.eli +173 -0
  6. package/bootstrap/backends/capabilities.eli +74 -0
  7. package/bootstrap/backends/elf.eli +246 -0
  8. package/bootstrap/backends/managed.eli +5976 -0
  9. package/bootstrap/backends/memory.eli +100 -0
  10. package/bootstrap/backends/native.eli +2000 -0
  11. package/bootstrap/backends/numeric.eli +1362 -0
  12. package/bootstrap/backends/optimize.eli +79 -0
  13. package/bootstrap/backends/regexp.eli +2263 -0
  14. package/bootstrap/backends/sha256.eli +138 -0
  15. package/bootstrap/backends/wasm.eli +1161 -0
  16. package/bootstrap/compiler/analyzer.eli +165 -77
  17. package/bootstrap/compiler/compiler.eli +43 -19
  18. package/bootstrap/compiler/emitter.eli +780 -170
  19. package/bootstrap/compiler/expander.eli +136 -45
  20. package/bootstrap/compiler/formatter.eli +8 -1
  21. package/bootstrap/compiler/ir.eli +148 -45
  22. package/bootstrap/compiler/lower.eli +29 -2
  23. package/bootstrap/compiler/project.eli +51 -21
  24. package/bootstrap/compiler/reader.eli +128 -36
  25. package/bootstrap/compiler/source-map.eli +46 -4
  26. package/bootstrap/compiler/symbol.eli +2 -1
  27. package/bootstrap/compiler/syntax.eli +47 -12
  28. package/bootstrap/compiler/transient-analysis.eli +40 -4
  29. package/bootstrap/host/check-cli-legacy.mjs +163 -0
  30. package/bootstrap/host/check-cli.mjs +59 -158
  31. package/bootstrap/host/check-cli.mjs.map +1 -0
  32. package/bootstrap/host/compiler-session.eli +1579 -0
  33. package/bootstrap/host/compiler-tools.eli +513 -0
  34. package/bootstrap/host/eliscript-cli.mjs +53 -33
  35. package/bootstrap/host/eliscript-cli.mjs.map +1 -0
  36. package/bootstrap/host/project-cli-legacy.mjs +295 -0
  37. package/bootstrap/host/project-cli.mjs +74 -289
  38. package/bootstrap/host/project-cli.mjs.map +1 -0
  39. package/bootstrap/host/project-legacy.mjs +1080 -0
  40. package/bootstrap/host/project.mjs +210 -1060
  41. package/bootstrap/host/project.mjs.map +1 -0
  42. package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
  43. package/bootstrap/runtime/memory.eli +30379 -0
  44. package/browser/host.mjs +732 -11
  45. package/browser/worker.mjs +6 -3
  46. package/compiler/eliscript-analyzer.el +371 -4
  47. package/compiler/eliscript-cli.el +84 -1
  48. package/compiler/eliscript-emitter.el +1189 -256
  49. package/compiler/eliscript-expander.el +147 -10
  50. package/compiler/eliscript-ir-emitter.el +725 -208
  51. package/compiler/eliscript-lower.el +127 -1
  52. package/compiler/eliscript-portable.el +177 -51
  53. package/compiler/eliscript-project.el +20 -2
  54. package/compiler/eliscript-reader.el +141 -57
  55. package/compiler/eliscript-source-map.el +26 -12
  56. package/compiler/eliscript-transient-analysis.el +382 -19
  57. package/dist/backends/async.mjs +561 -0
  58. package/dist/backends/async.mjs.macro-origins.json +1 -0
  59. package/dist/backends/async.mjs.map +1 -0
  60. package/dist/backends/binary.mjs +381 -0
  61. package/dist/backends/binary.mjs.macro-origins.json +1 -0
  62. package/dist/backends/binary.mjs.map +1 -0
  63. package/dist/backends/capabilities.mjs +237 -0
  64. package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
  65. package/dist/backends/capabilities.mjs.map +1 -0
  66. package/dist/backends/elf.mjs +540 -0
  67. package/dist/backends/elf.mjs.macro-origins.json +1 -0
  68. package/dist/backends/elf.mjs.map +1 -0
  69. package/dist/backends/managed.mjs +10616 -0
  70. package/dist/backends/managed.mjs.macro-origins.json +1 -0
  71. package/dist/backends/managed.mjs.map +1 -0
  72. package/dist/backends/memory.mjs +278 -0
  73. package/dist/backends/memory.mjs.macro-origins.json +1 -0
  74. package/dist/backends/memory.mjs.map +1 -0
  75. package/dist/backends/native.mjs +4099 -0
  76. package/dist/backends/native.mjs.macro-origins.json +1 -0
  77. package/dist/backends/native.mjs.map +1 -0
  78. package/dist/backends/numeric.mjs +2458 -0
  79. package/dist/backends/numeric.mjs.macro-origins.json +1 -0
  80. package/dist/backends/numeric.mjs.map +1 -0
  81. package/dist/backends/optimize.mjs +204 -0
  82. package/dist/backends/optimize.mjs.macro-origins.json +1 -0
  83. package/dist/backends/optimize.mjs.map +1 -0
  84. package/dist/backends/regexp.mjs +2033 -0
  85. package/dist/backends/regexp.mjs.macro-origins.json +1 -0
  86. package/dist/backends/regexp.mjs.map +1 -0
  87. package/dist/backends/sha256.mjs +310 -0
  88. package/dist/backends/sha256.mjs.macro-origins.json +1 -0
  89. package/dist/backends/sha256.mjs.map +1 -0
  90. package/dist/backends/wasm.mjs +2258 -0
  91. package/dist/backends/wasm.mjs.macro-origins.json +1 -0
  92. package/dist/backends/wasm.mjs.map +1 -0
  93. package/dist/bootstrap/analyzer.mjs +1908 -776
  94. package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
  95. package/dist/bootstrap/analyzer.mjs.map +1 -1
  96. package/dist/bootstrap/compiler.mjs +450 -142
  97. package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
  98. package/dist/bootstrap/compiler.mjs.map +1 -1
  99. package/dist/bootstrap/emitter.mjs +3083 -909
  100. package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
  101. package/dist/bootstrap/emitter.mjs.map +1 -1
  102. package/dist/bootstrap/expander.mjs +2887 -1233
  103. package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
  104. package/dist/bootstrap/expander.mjs.map +1 -1
  105. package/dist/bootstrap/formatter.mjs +582 -218
  106. package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
  107. package/dist/bootstrap/formatter.mjs.map +1 -1
  108. package/dist/bootstrap/ir.mjs +670 -116
  109. package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
  110. package/dist/bootstrap/ir.mjs.map +1 -1
  111. package/dist/bootstrap/lower.mjs +866 -257
  112. package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
  113. package/dist/bootstrap/lower.mjs.map +1 -1
  114. package/dist/bootstrap/package.json +1 -0
  115. package/dist/bootstrap/project.mjs +1168 -498
  116. package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
  117. package/dist/bootstrap/project.mjs.map +1 -1
  118. package/dist/bootstrap/reader.mjs +674 -175
  119. package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
  120. package/dist/bootstrap/reader.mjs.map +1 -1
  121. package/dist/bootstrap/runtime/math.mjs +1117 -0
  122. package/dist/bootstrap/runtime/math.mjs.map +1 -0
  123. package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
  124. package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
  125. package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
  126. package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
  127. package/dist/bootstrap/source-map.mjs +430 -119
  128. package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
  129. package/dist/bootstrap/source-map.mjs.map +1 -1
  130. package/dist/bootstrap/symbol.mjs +229 -53
  131. package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
  132. package/dist/bootstrap/symbol.mjs.map +1 -1
  133. package/dist/bootstrap/syntax.mjs +205 -7
  134. package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
  135. package/dist/bootstrap/syntax.mjs.map +1 -1
  136. package/dist/bootstrap/transient-analysis.mjs +1185 -489
  137. package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
  138. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  139. package/dist/browser/compiler.js +199 -6478
  140. package/dist/browser/host.mjs +1078 -0
  141. package/dist/browser/loader.js +1 -0
  142. package/dist/browser/loader.mjs +231 -0
  143. package/dist/browser/worker.mjs +63 -0
  144. package/dist/compiler-artifact.json +1 -0
  145. package/dist/host/compiler-session.mjs +2980 -0
  146. package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
  147. package/dist/host/compiler-session.mjs.map +1 -0
  148. package/dist/host/compiler-tools.mjs +1084 -0
  149. package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
  150. package/dist/host/compiler-tools.mjs.map +1 -0
  151. package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
  152. package/dist/literal-sources/runtime/core/collection.eli +639 -0
  153. package/dist/literal-sources/runtime/core/data-text.eli +290 -0
  154. package/dist/literal-sources/runtime/core/data.eli +22 -0
  155. package/dist/literal-sources/runtime/core/identifier.eli +44 -0
  156. package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
  157. package/dist/literal-sources/runtime/core/list.eli +19 -0
  158. package/dist/literal-sources/runtime/core/map.eli +9 -0
  159. package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
  160. package/dist/literal-sources/runtime/core/metadata.eli +40 -0
  161. package/dist/literal-sources/runtime/core/object.eli +8 -0
  162. package/dist/literal-sources/runtime/core/order.eli +123 -0
  163. package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
  164. package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
  165. package/dist/literal-sources/runtime/core/protocol.eli +28 -0
  166. package/dist/literal-sources/runtime/core/queue.eli +9 -0
  167. package/dist/literal-sources/runtime/core/record.eli +191 -0
  168. package/dist/literal-sources/runtime/core/regex.eli +158 -0
  169. package/dist/literal-sources/runtime/core/sequence.eli +305 -0
  170. package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
  171. package/dist/literal-sources/runtime/core/set.eli +9 -0
  172. package/dist/literal-sources/runtime/core/sorted.eli +408 -0
  173. package/dist/literal-sources/runtime/core/text.eli +14 -0
  174. package/dist/literal-sources/runtime/core/transducer.eli +268 -0
  175. package/dist/literal-sources/runtime/core/transient.eli +17 -0
  176. package/dist/literal-sources/runtime/core/truth.eli +4 -0
  177. package/dist/literal-sources/runtime/core/type.eli +232 -0
  178. package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
  179. package/dist/literal-sources/runtime/core/value.eli +19 -0
  180. package/dist/literal-sources/runtime/core/vector.eli +25 -0
  181. package/dist/literal-sources/runtime/literals.eli +23 -0
  182. package/dist/literal-sources/runtime/testing/value.eli +6 -0
  183. package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
  184. package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
  185. package/dist/literal-sources/runtime/wire/schema.eli +193 -0
  186. package/dist/literal-sources/stdlib/bit.eli +36 -0
  187. package/dist/literal-sources/stdlib/core/data.eli +306 -0
  188. package/dist/literal-sources/stdlib/core/object.eli +89 -0
  189. package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
  190. package/dist/literal-sources/stdlib/core/set.eli +312 -0
  191. package/dist/literal-sources/stdlib/core/text.eli +103 -0
  192. package/dist/literal-sources/stdlib/managed-literal-protocols.eli +494 -0
  193. package/dist/literal-sources/stdlib/managed-literals.eli +1469 -0
  194. package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
  195. package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
  196. package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
  197. package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
  198. package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
  199. package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
  200. package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
  201. package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
  202. package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
  203. package/dist/literal-sources/stdlib/value.eli +325 -0
  204. package/dist/package.json +10 -0
  205. package/dist/runtime/math.mjs +1116 -0
  206. package/dist/runtime/math.mjs.macro-origins.json +1 -0
  207. package/dist/runtime/math.mjs.map +1 -0
  208. package/dist/runtime/unicode-case-data.mjs +10124 -0
  209. package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
  210. package/dist/runtime/unicode-case-data.mjs.map +1 -0
  211. package/dist/runtime/unicode-case.mjs +280 -0
  212. package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
  213. package/dist/runtime/unicode-case.mjs.map +1 -0
  214. package/dist/runtime.eli +30379 -0
  215. package/dist/stage3-release.json +1 -0
  216. package/editor/README.md +1 -1
  217. package/editor/eliscript-mode.el +1 -1
  218. package/editor/eliscript-repl.el +1 -1
  219. package/package.json +106 -11
  220. package/platform/http.mjs +20 -0
  221. package/runtime/array-text.mjs +159 -0
  222. package/runtime/core/map-internals.mjs +27 -9
  223. package/runtime/core/object-impl.mjs +26 -17
  224. package/runtime/core/object-impl.mjs.map +1 -1
  225. package/runtime/core/protocol-impl.mjs +682 -255
  226. package/runtime/core/protocol-impl.mjs.map +1 -1
  227. package/runtime/core/protocol.mjs +4 -0
  228. package/runtime/core/record.mjs +23 -2
  229. package/runtime/core/regex.mjs +4 -0
  230. package/runtime/core/sorted.mjs +53 -0
  231. package/runtime/core/text-impl.mjs +167 -48
  232. package/runtime/core/text-impl.mjs.map +1 -1
  233. package/runtime/core/type.mjs +75 -3
  234. package/runtime/core/vector.mjs +6 -0
  235. package/runtime/math.eli +429 -0
  236. package/runtime/math.mjs +1116 -0
  237. package/runtime/math.mjs.map +1 -0
  238. package/runtime/number-radix.mjs +105 -0
  239. package/runtime/unicode-case-data.eli +29 -0
  240. package/runtime/unicode-case-data.mjs +10124 -0
  241. package/runtime/unicode-case-data.mjs.map +1 -0
  242. package/runtime/unicode-case.eli +100 -0
  243. package/runtime/unicode-case.mjs +280 -0
  244. package/runtime/unicode-case.mjs.map +1 -0
  245. package/runtime/wire/http-rpc.mjs +168 -0
  246. package/runtime/wire/markdown.mjs +196 -0
  247. package/runtime/wire/schema.mjs +109 -0
  248. package/stdlib/README.md +54 -0
  249. package/stdlib/core/protocol.eli +81 -17
  250. package/stdlib/core/seq.eli +1 -1
  251. package/stdlib/core/zipper.eli +172 -72
  252. package/stdlib/gepo.eli +12 -0
  253. package/stdlib/interop/js.eli +56 -15
  254. package/stdlib/managed-literal-protocols.eli +494 -0
  255. package/stdlib/managed-literals.eli +1469 -0
  256. package/stdlib/managed-protocol-error.eli +32 -0
  257. package/stdlib/managed-queue-state.eli +65 -0
  258. package/stdlib/managed-runtime-collection-internals.eli +60 -0
  259. package/stdlib/managed-runtime-collection.eli +639 -0
  260. package/stdlib/managed-runtime-data-text.eli +290 -0
  261. package/stdlib/managed-runtime-data.eli +22 -0
  262. package/stdlib/managed-runtime-identifier.eli +44 -0
  263. package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
  264. package/stdlib/managed-runtime-list.eli +19 -0
  265. package/stdlib/managed-runtime-literals.eli +23 -0
  266. package/stdlib/managed-runtime-map.eli +9 -0
  267. package/stdlib/managed-runtime-metadata-internals.eli +6 -0
  268. package/stdlib/managed-runtime-metadata.eli +40 -0
  269. package/stdlib/managed-runtime-object.eli +8 -0
  270. package/stdlib/managed-runtime-order.eli +123 -0
  271. package/stdlib/managed-runtime-persistent-kind.eli +28 -0
  272. package/stdlib/managed-runtime-protocol.eli +28 -0
  273. package/stdlib/managed-runtime-queue.eli +9 -0
  274. package/stdlib/managed-runtime-record.eli +191 -0
  275. package/stdlib/managed-runtime-regex.eli +158 -0
  276. package/stdlib/managed-runtime-sequence.eli +305 -0
  277. package/stdlib/managed-runtime-set-algebra.eli +28 -0
  278. package/stdlib/managed-runtime-set.eli +9 -0
  279. package/stdlib/managed-runtime-sorted.eli +408 -0
  280. package/stdlib/managed-runtime-text.eli +14 -0
  281. package/stdlib/managed-runtime-transducer.eli +268 -0
  282. package/stdlib/managed-runtime-transient.eli +17 -0
  283. package/stdlib/managed-runtime-truth.eli +4 -0
  284. package/stdlib/managed-runtime-type.eli +232 -0
  285. package/stdlib/managed-runtime-value-internals.eli +13 -0
  286. package/stdlib/managed-runtime-value.eli +19 -0
  287. package/stdlib/managed-runtime-vector.eli +25 -0
  288. package/stdlib/managed-sorted-state.eli +233 -0
  289. package/stdlib/managed-testing-value.eli +6 -0
  290. package/stdlib/managed-transient-state.eli +348 -0
  291. package/stdlib/managed-value-state.eli +153 -0
  292. package/stdlib/managed-vector-view-state.eli +102 -0
  293. package/stdlib/managed-wire-http-rpc.eli +362 -0
  294. package/stdlib/managed-wire-markdown.eli +275 -0
  295. package/stdlib/managed-wire-schema.eli +193 -0
  296. package/stdlib/mdp.eli +7 -0
  297. package/stdlib/mds.eli +4 -0
  298. package/stdlib/persistent-vector.eli +23 -6
  299. package/tools/acceptance/check-legacy.mjs +687 -0
  300. package/tools/acceptance/check.eli +431 -0
  301. package/tools/acceptance/compile-evidence.el +49 -0
  302. package/tools/acceptance/finalize-legacy.mjs +498 -0
  303. package/tools/acceptance/finalize.eli +270 -0
  304. package/tools/backends/benchmark.mjs +175 -0
  305. package/tools/backends/build.mjs +135 -0
  306. package/tools/backends/compile.mjs +94 -0
  307. package/tools/backends/compiler-bootstrap.mjs +1001 -0
  308. package/tools/backends/compiler-browser.mjs +361 -0
  309. package/tools/backends/compiler-build.mjs +1628 -0
  310. package/tools/backends/compiler-cli-legacy.mjs +334 -0
  311. package/tools/backends/compiler-cli.mjs +29 -0
  312. package/tools/backends/compiler-corpus-bit.mjs +234 -0
  313. package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
  314. package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
  315. package/tools/backends/compiler-corpus-debugging.mjs +221 -0
  316. package/tools/backends/compiler-corpus-emitter.mjs +324 -0
  317. package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
  318. package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
  319. package/tools/backends/compiler-corpus-execution.mjs +3324 -0
  320. package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
  321. package/tools/backends/compiler-corpus-generations.mjs +208 -0
  322. package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
  323. package/tools/backends/compiler-corpus-host-context.mjs +550 -0
  324. package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
  325. package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
  326. package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
  327. package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
  328. package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
  329. package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
  330. package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
  331. package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
  332. package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
  333. package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
  334. package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
  335. package/tools/backends/compiler-corpus-matchers.mjs +173 -0
  336. package/tools/backends/compiler-corpus-original-program.mjs +612 -0
  337. package/tools/backends/compiler-corpus-process.mjs +765 -0
  338. package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
  339. package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
  340. package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
  341. package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
  342. package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
  343. package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
  344. package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
  345. package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
  346. package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
  347. package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
  348. package/tools/backends/compiler-corpus-reference.mjs +241 -0
  349. package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
  350. package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
  351. package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
  352. package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
  353. package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
  354. package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
  355. package/tools/backends/compiler-corpus.mjs +2054 -0
  356. package/tools/backends/compiler-debug.mjs +142 -0
  357. package/tools/backends/compiler-matrix.mjs +1955 -0
  358. package/tools/backends/compiler-metadata.mjs +203 -0
  359. package/tools/backends/compiler-package-browser.mjs +120 -0
  360. package/tools/backends/compiler-package-legacy.mjs +654 -0
  361. package/tools/backends/compiler-package.mjs +464 -0
  362. package/tools/backends/compiler-project.mjs +126 -0
  363. package/tools/backends/compiler-session.mjs +843 -0
  364. package/tools/backends/compiler-sha256.mjs +152 -0
  365. package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
  366. package/tools/backends/compiler-worker.mjs +573 -0
  367. package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
  368. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
  369. package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
  370. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
  371. package/tools/backends/dist/record-grid.mjs +1256 -0
  372. package/tools/backends/dist/record-grid.mjs.map +1 -0
  373. package/tools/backends/dist/release-cli.mjs +462 -0
  374. package/tools/backends/dist/release-cli.mjs.map +1 -0
  375. package/tools/backends/dist/run-artifact.mjs +517 -0
  376. package/tools/backends/dist/run-artifact.mjs.map +1 -0
  377. package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
  378. package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
  379. package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
  380. package/tools/backends/managed-foreign-binding.mjs +497 -0
  381. package/tools/backends/managed-host-legacy.mjs +1181 -0
  382. package/tools/backends/managed-host-lifecycle.mjs +310 -0
  383. package/tools/backends/managed-host-object-provider.mjs +155 -0
  384. package/tools/backends/managed-host-object-realm.mjs +797 -0
  385. package/tools/backends/managed-host-proxy.mjs +71 -0
  386. package/tools/backends/managed-host-runtime.mjs +5868 -0
  387. package/tools/backends/managed-host.mjs +716 -0
  388. package/tools/backends/managed-module-graph-legacy.mjs +308 -0
  389. package/tools/backends/managed-module-graph.mjs +694 -0
  390. package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
  391. package/tools/backends/managed-runtime.mjs +939 -0
  392. package/tools/backends/managed-source-view-legacy.mjs +332 -0
  393. package/tools/backends/managed-source-view.mjs +959 -0
  394. package/tools/backends/memory-runtime.mjs +100 -0
  395. package/tools/backends/native-benchmark.mjs +88 -0
  396. package/tools/backends/native-managed-runtime.mjs +677 -0
  397. package/tools/backends/native-memory.mjs +768 -0
  398. package/tools/backends/native-node-memory.mjs +142 -0
  399. package/tools/backends/native-node-runner.mjs +99 -0
  400. package/tools/backends/native-node-watchdog.mjs +19 -0
  401. package/tools/backends/native-node-worker.mjs +75 -0
  402. package/tools/backends/stage3-targets.mjs +493 -0
  403. package/tools/bootstrap-command.el +13 -0
  404. package/tools/bootstrap-runtime.el +101 -0
  405. package/tools/bootstrap-seed.el +55 -0
  406. package/tools/project/check-cli.eli +31 -0
  407. package/tools/project/project-cli.eli +42 -0
  408. package/tools/project/project.eli +122 -0
  409. package/tools/runtime/unicode-case-profiles.mjs +13 -0
  410. package/tools/runtime/unicode-case-runtime.el +57 -0
  411. package/tools/testing/source-debugging-corpus-host.eli +16 -0
  412. package/tools/testing/source-debugging.eli +139 -0
  413. package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
  414. package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
  415. package/tools/testing/stdlib-bit.eli +104 -0
  416. package/tools/testing/stdlib-bit.mjs +255 -0
  417. package/bin/eliscript-bootstrap +0 -15
@@ -0,0 +1,298 @@
1
+ import {posix} from 'node:path';
2
+ import {createHash} from 'node:crypto';
3
+ import {originalSourceCaseLocators} from './compiler-corpus-managed-cases.mjs';
4
+
5
+ export const originalIdentityValueSuites=Object.freeze([
6
+ 'tests/wasm-managed-host-identity.test.mjs',
7
+ 'tests/managed-stdlib-value-json.test.mjs',
8
+ ]);
9
+
10
+ // Recipes transport the original programs and assertions. They do not execute
11
+ // a fixture or use a JavaScript implementation in place of a selected compiler.
12
+ function region(source, begin, end, from = 0) {
13
+ const start = source.indexOf(begin, from), finish = start < 0 ? -1 : source.indexOf(end, start + begin.length);
14
+ if (start < 0 || finish < 0) throw new TypeError('original identity/value source boundary changed: ' + begin);
15
+ const code = source.slice(start, finish);
16
+ return {text: code, start, end: finish, byteStart: Buffer.byteLength(source.slice(0, start)),
17
+ byteEnd: Buffer.byteLength(source.slice(0, finish)), sha256: createHash('sha256').update(code).digest('hex')};
18
+ }
19
+ function proof(item) {const {text, ...identity} = item;return identity;}
20
+ function originalTitles(source,file) {
21
+ // Use the same complete source inventory as the full-suite replay. Auxiliary
22
+ // helper execution regions are provenance, not additional test registrations.
23
+ return originalIdentityValueCaseLocators(file,source)
24
+ .filter(locator=>!locator.originalExecution).map(locator=>locator.originalCase.title);
25
+ }
26
+
27
+ function sourceRegion(source,start,end){
28
+ const text=source.slice(start,end);
29
+ return{text,start,end,byteStart:Buffer.byteLength(source.slice(0,start)),
30
+ byteEnd:Buffer.byteLength(source.slice(0,end)),sha256:createHash('sha256').update(text).digest('hex')};
31
+ }
32
+
33
+ export function originalIdentityValueCaseLocators(file,source){
34
+ if(!originalIdentityValueSuites.includes(file))throw new TypeError('unregistered original identity/value source suite');
35
+ const cases=originalSourceCaseLocators(file,source);
36
+ if(file!=='tests/wasm-managed-host-identity.test.mjs')return cases;
37
+ const title='Given linked modules with opposite encounter orders when imported aliases and closures are called then defining-module identity tables remain separate';
38
+ const owners=cases.filter(locator=>locator.originalCase.title===title);
39
+ if(owners.length!==1)throw new TypeError('original module-order helper lost its unique registered caller');
40
+ const owner=owners[0];
41
+ const helper=region(source,'async function project(){','\nfunction encounters(a,p)');
42
+ const assertion="assert.deepEqual(Uint8Array.from(b.managed.emit_managed_project_wasm([...modules].reverse(),'main.mjs',rt)),bytes);";
43
+ const start=source.indexOf(assertion,helper.start);
44
+ if(start<helper.start||start+assertion.length>helper.end)
45
+ throw new TypeError('original project module-order assertion left its helper');
46
+ const executed=sourceRegion(source,start,start+assertion.length);
47
+ const caller=sourceRegion(source,owner.originalCase.span.start,owner.originalCase.span.end);
48
+ const invocation='const p=await project();',callStart=caller.text.indexOf(invocation);
49
+ if(callStart<0)throw new TypeError('original registered case no longer invokes its module-order helper');
50
+ const call=sourceRegion(source,caller.start+callStart,caller.start+callStart+invocation.length);
51
+ return [...cases,{id:'stable-compatibility:source-region:'+file+':project-module-order:0',
52
+ file,kind:'test',contains:executed.text,originalCase:structuredClone(owner.originalCase),
53
+ originalExecution:{record:'original-identity-value:host-token-module-order',
54
+ span:{start:executed.start,end:executed.end},byteStart:executed.byteStart,byteEnd:executed.byteEnd,sha256:executed.sha256,
55
+ helper:{name:'project',...proof(helper)},invocation:proof(call)}}];
56
+ }
57
+
58
+ async function sourceGraph({text, file}, entry, filename) {
59
+ const modules = new Map(), pending = [{id: entry, filename}];
60
+ while (pending.length) {
61
+ const input = pending.shift();if (modules.has(input.id)) continue;
62
+ const source = await text(input.filename);await file(input.filename);
63
+ modules.set(input.id, {...input, source});
64
+ for (const match of source.matchAll(/\(import(?:-portable)?\s+"([^"\n]+)"/g)) {
65
+ const specifier = match[1];
66
+ if (!specifier.startsWith('.')) throw new TypeError('original Value/JSON graph gained an undeclared external dependency');
67
+ const path = posix.normalize(posix.join(posix.dirname(input.id), specifier));
68
+ if (!path.startsWith('stdlib/')) throw new TypeError('original Value/JSON dependency escapes the stdlib graph');
69
+ const id = path.endsWith('.eli') ? path.slice(0, -4) + '.mjs' : path;
70
+ pending.push({id, filename: path.endsWith('.mjs') ? path.slice(0, -4) + '.eli' : path});
71
+ }
72
+ }
73
+ return [...modules.values()];
74
+ }
75
+
76
+ const hostPrelude = String.raw`
77
+ import assert from 'node:assert/strict';
78
+ import {readFile} from 'node:fs/promises';
79
+ import {resolve} from 'node:path';
80
+ import {pathToFileURL} from 'node:url';
81
+ import {spawnSync} from 'node:child_process';
82
+ const root=process.env.ELISCRIPT_ORIGINAL_SOURCE_ROOT,referenceDirectory=process.env.ELISCRIPT_ORIGINAL_REFERENCE_PRODUCT_ROOT;
83
+ if(!root||!referenceDirectory)throw new Error('identity/value corpus requires its actual original source and independent reference');
84
+ const [product,entry]=process.argv.slice(2);
85
+ const originalEntry=pathToFileURL(resolve(referenceDirectory,entry)).href;
86
+ const reference=await import(originalEntry),m=await import(pathToFileURL(resolve(product,entry)).href);
87
+ const configuration=process.env.ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT;
88
+ const {readCompilerMetadata}=await import(pathToFileURL(resolve(root,'tools/backends/compiler-metadata.mjs')).href);
89
+ const selected=configuration?await readCompilerMetadata(configuration):null;
90
+ const binary=process.env.ELISCRIPT_ORIGINAL_TARGET!=='javascript';
91
+ if(binary&&!selected)throw new Error('identity/value corpus lost its selected binary artifact');
92
+ function observe(script,engine,args=[]){
93
+ const env={...process.env};delete env.ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT;delete env.ELISCRIPT_ORIGINAL_TARGET;
94
+ const preloadURL=pathToFileURL(resolve(root,'tools/backends/compiler-corpus-host-context.mjs')).href;
95
+ if(env.NODE_OPTIONS)env.NODE_OPTIONS=env.NODE_OPTIONS.split(/\s+/).filter(value=>value!=='--import='+preloadURL).join(' ');
96
+ const preload=engine==='bun'?['--preload',resolve(root,'tests/fixtures/compiled-eli-bun-preload.mjs')]:['--experimental-loader',resolve(root,'tests/fixtures/compiled-eli-node-loader.mjs')];
97
+ const child=spawnSync(engine==='bun'?(process.env.BUN??'bun'):(process.env.NODE??'node'),[...preload,'--input-type=module','--eval',script,...args],{cwd:root,env,encoding:'utf8',timeout:30000});
98
+ assert.equal(child.error,undefined);assert.equal(child.signal,null);assert.equal(child.status,0,child.stderr+child.stdout);
99
+ return JSON.parse(child.stdout);
100
+ }
101
+ async function freshRuntime(){
102
+ if(!selected)throw new Error('a raw managed heap requires its actual selected binary');
103
+ const options={...selected.memory,...selected.runtimeOptions,initializeModule:false,nativeTarget:selected.nativeTarget};
104
+ let a;
105
+ if(selected.target==='wasm'){
106
+ const bytes=new Uint8Array(await readFile(selected.path));assert.deepEqual(WebAssembly.Module.imports(new WebAssembly.Module(bytes)),[]);
107
+ const {instantiateManagedRuntime}=await import(pathToFileURL(resolve(root,'tools/backends/managed-runtime.mjs')).href);
108
+ a=instantiateManagedRuntime(bytes,options);
109
+ }else{
110
+ const {instantiateNativeManagedRuntime}=await import(pathToFileURL(resolve(root,'tools/backends/native-managed-runtime.mjs')).href);
111
+ a=await instantiateNativeManagedRuntime(selected.path,{typed:selected.typed,descriptor:selected.descriptor},options);
112
+ }
113
+ try{a.initializeModule();a.auto(selected.runtimeOptions.auto);return a;}
114
+ catch(error){try{a.close?.();}catch{}throw error;}
115
+ }
116
+ function plain(value){return JSON.parse(JSON.stringify(value));}
117
+ `;
118
+
119
+ export async function addOriginalIdentityValueAdapters({add, locators, text, file, stableFiles}) {
120
+ async function addProgram(plan) {
121
+ const suiteIdentity = await file(plan.suite);
122
+ const coverage = [plan.fixture && stableFiles.has(plan.fixture) ? 'stable-compatibility:' + plan.fixture : null,
123
+ ...locators.filter(locator => locator.file === plan.suite && typeof locator.contains === 'string' &&
124
+ !locator.originalCase &&
125
+ (plan.titles.some(title => title.includes(locator.contains)) || plan.assertions.includes(locator.contains))).map(locator => locator.id)].filter(Boolean);
126
+ const originalCases=locators.filter(locator=>locator.file===plan.suite&&locator.originalCase&&!locator.originalExecution&&
127
+ plan.titles.includes(locator.originalCase.title)).map(locator=>({id:locator.id,...structuredClone(locator.originalCase)}));
128
+ if(!coverage.length)throw new TypeError('original identity/value product has no executed source coverage: '+plan.name);
129
+ for (const auto of plan.autos ?? [1]) for (const hostRuntime of ['node', 'bun']) {
130
+ add({id: 'original-identity-value:' + plan.name + ':' + hostRuntime + ':auto-' + auto,
131
+ kind: 'project', coverage: [...new Set(coverage)], modules: structuredClone(plan.modules), entry: plan.entry,
132
+ auto, memory: structuredClone(plan.memory ?? {initialPages: 1, maximumPages: 256}),
133
+ request: {operation: 'project', resolveImports: true, phased: true, sourceMap: true},
134
+ execution: {kind: 'original-program', host: 'tests/__eliscript_identity_value_' + plan.name + '_' + hostRuntime + '_' + auto + '.mjs',
135
+ hostSource: hostPrelude + '\n' + plan.hostSource, hostRuntime, arguments: [{directory: true}, {literal: plan.entry}],
136
+ aliases: true, referenceArtifact: true, zeroImports: true, childProcesses: 'inherit-selected-artifact',
137
+ timeoutByTarget: {javascript: plan.timeout ?? 30000, wasm: plan.timeout ?? 30000, native: 120000},
138
+ runtimeOptions: {...structuredClone(plan.budget), auto}},
139
+ expected: {kind: 'seed-program', oracleRequired: true},
140
+ original: {manifest: 'stable-compatibility', suite: plan.suite, fixture: plan.fixture ?? null,
141
+ host: plan.suite, sourceSha256: suiteIdentity.sha256, originalAssertion: plan.titles,
142
+ originalCases,completeOriginalCaseCoverage:false,
143
+ completeCases:'the unchanged original suite runs with its selected compiler and original deadlines',
144
+ regions: (plan.regions ?? []).map(proof), graph: plan.graph ?? null,
145
+ targetSpecificAssertions: {javascript: 'original source-level observations in the original Node/Bun host',
146
+ binary: 'original raw-handle assertions, unchanged per-heap capacity, GC and cleanup on the actual selected binary'}}});
147
+ }
148
+ }
149
+
150
+ const stdlibFixture = 'tests/fixtures/managed-stdlib-value-json.eli', stdlibSuite = 'tests/managed-stdlib-value-json.test.mjs';
151
+ if (stableFiles.has(stdlibFixture)) {
152
+ const original = await text(stdlibSuite), helper = 'tests/helpers/managed-stdlib-corpus.mjs';await file(helper);
153
+ const raw = region(original, 'function read(a,v)', "\ntest('Given complete original Value");
154
+ const assertions = region(original, ' assert.deepEqual(expected.errors[0]', '\n},120000);');
155
+ const modules = await sourceGraph({text, file}, 'entry.mjs', stdlibFixture);
156
+ const opaque = region(original, 'const results=[],errors=[];', '},30000);', original.indexOf("test('Given an ordinary source function"));
157
+ const corpus = `
158
+ const {inputs,parseBoundaryCases,encodeBoundaryCases,parseCases,encodeInputs}=await import(pathToFileURL(resolve(root,${JSON.stringify(helper)})).href);
159
+ const script=[parseBoundaryCases.toString(),encodeBoundaryCases.toString(),'const m=await import(process.argv[1]);console.log(JSON.stringify({values:m.values(),identities:m.identities(),json:'+JSON.stringify(inputs)+'.map(x=>m.json_case(x)),boundaries:m.json_boundaries(),order:m.order_and_identity(),errors:parseBoundaryCases().map(x=>m.parse_report(...x)),encoded:encodeBoundaryCases().map(x=>m.encode_report(x))}));'].join('\\n');
160
+ const expected=observe(script,'node',[originalEntry]);assert.deepEqual(observe(script,'bun',[originalEntry]),expected);
161
+ ${assertions.text}
162
+ ${raw.text}
163
+ if(binary){const a=await freshRuntime();try{checkAll(a);}finally{try{finish(a);}finally{a.close?.();}}}
164
+ else{
165
+ const actual={values:m.values(),identities:m.identities(),json:inputs.map(x=>m.json_case(x)),boundaries:m.json_boundaries(),order:m.order_and_identity(),errors:parseCases.map(x=>m.parse_report(...x)),encoded:encodeInputs.map(x=>m.encode_report(x))};
166
+ assert.deepEqual(plain(actual),expected);
167
+ }
168
+ if(binary){const a=await freshRuntime();a.auto(1);try{${opaque.text}}finally{a.close?.();}}
169
+ else{
170
+ for(let mode=0;mode<5;mode++){const out=m.opaque_probe(mode);if(mode<3)assert.deepEqual(out,['function',false,null][mode]);if(mode===3)assert.equal(typeof out,'number');if(mode===4)assert.equal(out,false);}
171
+ }
172
+ console.log(JSON.stringify(expected));
173
+ `;
174
+ await addProgram({name: 'stdlib-value-json', fixture: stdlibFixture, suite: stdlibSuite, entry: 'entry.mjs', modules,
175
+ autos: [65536, 1], memory: {initialPages: 4, maximumPages: 1024}, budget: {maxSlots: 8192, initialBytes: 262144, maxBytes: 16777216},
176
+ titles: originalTitles(original,stdlibSuite), assertions: raw.text + assertions.text + opaque.text, regions: [raw, assertions, opaque], hostSource: corpus});
177
+ }
178
+
179
+ const identityFixture = 'tests/fixtures/wasm-managed-host-identity.eli', projectsFixture = 'tests/fixtures/managed-host-identity-projects.json';
180
+ if (!stableFiles.has(identityFixture) && !stableFiles.has(projectsFixture)) return;
181
+ const suite = 'tests/wasm-managed-host-identity.test.mjs', original = await text(suite), data = JSON.parse(await text(projectsFixture));
182
+ await file(identityFixture);await file(projectsFixture);
183
+ if (!data || Object.keys(data).some(key => !['project', 'cycle', 'cycleOperands'].includes(key)) ||
184
+ ['project', 'cycle', 'cycleOperands'].some(key => !data[key] || typeof data[key] !== 'object' || Array.isArray(data[key])))
185
+ throw new TypeError('original identity project fixture shape changed');
186
+ const helpers = region(original, 'function read(a,v)', "\ntest('Given the existing intrinsic");
187
+ const encounters = region(original, 'function encounters(a,p)', "\ntest('Given linked modules");
188
+ const isolation = region(original, 'function heapIsolation(first,second)', "\ntest('Given two heaps");
189
+ const budget = {maxSlots: 2048, initialBytes: 65536, maxBytes: 16777216};
190
+ const titlesInSource=originalTitles(original,suite);
191
+ const nativeTitle = titlesInSource.find(title => title.includes('true native module and linked project'));
192
+ const entry = 'main.mjs', single = [{id: entry, filename: 'host-identity.eli', source: await text(identityFixture)}];
193
+ const singleTitles = titlesInSource.filter(title => !/wrong source|no intrinsic|linked modules with|cyclic|Node calls imported aliases/.test(title));
194
+ const scalar = region(original, 'const values=[null,undefined,false,true,a.number(-0)', "\ntest('Given wrong source", original.indexOf("test('Given scalar inputs"));
195
+ if(!scalar.text.endsWith('}});'))throw new TypeError('original scalar identity test closure changed');
196
+ const scalarCode=scalar.text.slice(0,-3);
197
+ const code = `
198
+ ${helpers.text}
199
+ ${isolation.text}
200
+ const scalarExpected=[null,undefined,false,true,-0,NaN,''].map(x=>reference.safe(x));
201
+ const referenceScript='const m=await import(process.argv[1]);const x={},y={};const first=m.token(x);const out={tokens:[first,m.alias(x),m.nested(x),m.token(y)],effects:m.effects(),abrupt:m.abrupt(),conversion:m.no_conversion()};const s=m.symbol_case(),f=m.function_case();out.symbols=[s[0]===s[2],s[0]!==s[1]];out.functions=[f[0]===f[2],f[0]!==f[1]];console.log(JSON.stringify(out));';
202
+ const expected=observe(referenceScript,'node',[originalEntry]);assert.deepEqual(observe(referenceScript,'bun',[originalEntry]),expected);
203
+ assert.deepEqual(expected,{tokens:[1,1,1,2],effects:[true,[1,2]],abrupt:[true,[1]],conversion:[],symbols:[true,true],functions:[true,true]});
204
+ if(binary){
205
+ identities(await freshRuntime());
206
+ {const a=await freshRuntime();a.auto(1);${scalarCode}}
207
+ const first=await freshRuntime(),second=await freshRuntime();heapIsolation(first,second);
208
+ const a=await freshRuntime();a.auto(1);try{assert.deepEqual(value(a,'effects'),[true,[1,2]]);assert.deepEqual(value(a,'abrupt'),[true,[1]]);}finally{finish(a);}
209
+ }else{
210
+ const firstModule=await import(pathToFileURL(resolve(product,entry)).href+'?identity-isolation=first');
211
+ const secondModule=await import(pathToFileURL(resolve(product,entry)).href+'?identity-isolation=second');
212
+ const firstObject={},secondObject={};assert.equal(firstModule.token(firstObject),1);assert.equal(secondModule.token(secondObject),1);
213
+ assert.equal(firstModule.token(firstObject),1);assert.equal(secondModule.token(secondObject),1);
214
+ const x={},y={},first=m.token(x);assert.equal(first,1);assert.equal(m.alias(x),first);assert.equal(m.nested(x),first);assert.equal(m.token(y),2);
215
+ for(let i=0;i<8;i++)assert.equal(m.token(x),first);
216
+ assert.deepEqual(m.effects(),[true,[1,2]]);assert.deepEqual(m.abrupt(),[true,[1]]);assert.deepEqual(m.no_conversion(),[]);
217
+ const symbols=m.symbol_case(),functions=m.function_case();assert.equal(symbols[0],symbols[2]);assert.notEqual(symbols[0],symbols[1]);assert.equal(functions[0],functions[2]);assert.notEqual(functions[0],functions[1]);
218
+ assert.deepEqual([null,undefined,false,true,-0,NaN,''].map(x=>m.safe(x)),scalarExpected);
219
+ }
220
+ console.log(JSON.stringify(expected));
221
+ `;
222
+ await addProgram({name: 'host-token-single', suite, fixture: identityFixture, entry, modules: single, budget,
223
+ titles: singleTitles, assertions: helpers.text + isolation.text + scalar.text, regions: [helpers, isolation, scalar], hostSource: code});
224
+
225
+ for (const [name, sources] of Object.entries(data)) {
226
+ const modules = Object.entries(sources).map(([id, source]) => {
227
+ if (typeof source !== 'string' || !/^[a-z][a-z0-9-]*\.mjs$/.test(id)) throw new TypeError('original identity module declaration changed');
228
+ return {id, filename: id.replace(/\.mjs$/, '.eli'), source};
229
+ });
230
+ if (!modules.some(item => item.id === entry)) throw new TypeError('original identity graph lost its entry');
231
+ let hostSource, titles;
232
+ if (name === 'project') {
233
+ const script = 'const m=await import(process.argv[1]);const x={},y={};console.log(JSON.stringify({values:m.encounters(x,y),same:m.left===m.left_copy}));';
234
+ hostSource = helpers.text + '\n' + encounters.text + `
235
+ const expected=observe(${JSON.stringify(script)},'node',[originalEntry]);assert.deepEqual(observe(${JSON.stringify(script)},'bun',[originalEntry]),expected);
236
+ assert.deepEqual(expected.values,[1,2,1,2,1,1,2]);
237
+ if(binary)encounters(await freshRuntime(),{expected});else{
238
+ const x={},y={};assert.equal(m.left===m.left_copy,expected.same);assert.deepEqual(m.encounters(x,y),expected.values);
239
+ assert.equal(m.left(x),1);assert.equal(m.right(x),2);assert.equal(m.closure(x),1);assert.equal(m.own(x),2);
240
+ }
241
+ console.log(JSON.stringify(expected));\n`;
242
+ titles = titlesInSource.filter(title => /linked modules with|Node calls imported aliases/.test(title));if (nativeTitle) titles.push(nativeTitle);
243
+ } else {
244
+ const script = 'const m=await import(process.argv[1]);console.log(JSON.stringify(m.early));';
245
+ const expected = name === 'cycle' ? 'ReferenceError' : ['ReferenceError', false, []];
246
+ hostSource = helpers.text + `
247
+ const expected=observe(${JSON.stringify(script)},'node',[originalEntry]);assert.deepEqual(observe(${JSON.stringify(script)},'bun',[originalEntry]),expected);
248
+ assert.deepEqual(expected,${JSON.stringify(expected)});
249
+ if(binary){const a=await freshRuntime();a.auto(1);try{const early=a.getExport('early');try{assert.deepEqual(read(a,early),expected);}finally{a.release(early);}}finally{finish(a);}}
250
+ else assert.deepEqual(plain(m.early),expected);
251
+ console.log(JSON.stringify(expected));\n`;
252
+ titles = titlesInSource.filter(title => name === 'cycle' ? title.includes('cyclic modules before') : title.includes('cyclic early helper call'));
253
+ }
254
+ const caseRegions=locators.filter(locator=>locator.file===suite&&locator.originalCase&&!locator.originalExecution&&
255
+ titles.includes(locator.originalCase.title)).map(locator=>sourceRegion(original,locator.originalCase.span.start,locator.originalCase.span.end));
256
+ await addProgram({name: 'host-token-' + name, suite, fixture: projectsFixture, graph: name, entry, modules, budget,
257
+ titles, assertions: hostSource, regions: name==='project'?[helpers,encounters]:[helpers,...caseRegions], hostSource});
258
+ if(name==='project'){
259
+ const order=locators.filter(locator=>locator.file===suite&&
260
+ locator.originalExecution?.record==='original-identity-value:host-token-module-order');
261
+ if(order.length!==1)throw new TypeError('original module-order recipe requires its exact helper assertion');
262
+ const bound=order.map(locator=>locator.id);
263
+ add({id:'original-identity-value:host-token-module-order',kind:'sequence',coverage:bound,
264
+ memory:{initialPages:1,maximumPages:256},expected:{kind:'sequence'},steps:[
265
+ {id:'original-order',request:{operation:'project',entry,modules:structuredClone(modules),resolveImports:true}},
266
+ {id:'reversed-order',request:{operation:'project',entry,modules:structuredClone([...modules].reverse()),resolveImports:true},
267
+ sameProductAs:'original-order'},
268
+ ],original:{manifest:'stable-compatibility',suite,fixture:projectsFixture,graph:name,
269
+ sourceSha256:(await file(suite)).sha256,originalAssertion:'project module order does not change emitted bytes',
270
+ originalCase:structuredClone(order[0].originalCase),originalExecution:structuredClone(order[0].originalExecution)}});
271
+ }
272
+ }
273
+
274
+ const arityTitle = titlesInSource.find(title => title.includes('wrong source and IR arity'));
275
+ const plainTitle = titlesInSource.find(title => title.includes('no intrinsic'));
276
+ const coverage = locators.filter(locator => locator.file === suite && typeof locator.contains === 'string' &&
277
+ [arityTitle, plainTitle].some(title => title?.includes(locator.contains))).map(locator => locator.id);
278
+ if(!coverage.length)throw new TypeError('original identity rejection recipe has no registered source cases');
279
+ const valid = '(defun token (x) (host-identity-token x))', identity = '(defun identity (x) x) (export identity)';
280
+ const steps = [
281
+ ...['(host-identity-token)', '(host-identity-token 1 2)'].map((source, index) => ({id: 'source-arity-' + index,
282
+ request: {operation: 'compile', source, filename: 'arity.eli'}, error: {}})),
283
+ {id: 'valid-intrinsic-ir', request: {operation: 'compile-ir', source: valid, filename: 'arity.eli'}},
284
+ ...[0, 2].map(count => ({id: 'ir-arity-' + count, request: {operation: 'emit-ir', target: 'wasm',
285
+ ir: {$compilerCorpusJsonPatch: [{$compilerCorpusRef: 'valid-intrinsic-ir.ir'}, [{path: ['body', 0, 'children', 1, 'children'],
286
+ ...(count === 0 ? {value: []} : {duplicateIndex: 0})}]]}}, error: {code: 'ELI-B0001'}})),
287
+ {id: 'plain-ir', request: {operation: 'compile-ir', source: identity, filename: 'plain.eli'}},
288
+ {id: 'plain-descriptor', request: {operation: 'emit-ir', target: 'wasm', ir: {$compilerCorpusRef: 'plain-ir.ir'}},
289
+ expectFields: [{path: ['descriptor', 'abi'], value: 'managed-control-v1'}, {path: ['descriptor', 'module'], value: undefined}]},
290
+ {id: 'recovered-ir', request: {operation: 'compile-ir', source: valid, filename: 'arity.eli'}, sameFieldsAs: {step: 'valid-intrinsic-ir', fields: ['ir']}},
291
+ ];
292
+ add({id: 'original-identity-value:host-token-rejections', kind: 'sequence', coverage, steps,
293
+ expected: {kind: 'sequence'}, original: {manifest: 'stable-compatibility', suite,
294
+ sourceSha256: (await file(suite)).sha256, originalAssertion: [arityTitle, plainTitle],
295
+ originalCases:locators.filter(locator=>coverage.includes(locator.id)&&locator.originalCase)
296
+ .map(locator=>({id:locator.id,...structuredClone(locator.originalCase)})),
297
+ fixture: identityFixture, originalIRMutation: 'only host-identity-token operands are removed or duplicated'}});
298
+ }
@@ -0,0 +1,69 @@
1
+ // Generated by Eliscript. Do not edit.
2
+ import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
3
+ var __eliscript_tdz_ready_0;
4
+ function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("originalIdentityValueSuites"); return originalIdentityValueSuites; }
5
+ function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("originalIdentityValueSuites"); return __eliscript_const_error(); }
6
+ var __eliscript_tdz_ready_1;
7
+ function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("originalIdentityValueCaseLocators"); return originalIdentityValueCaseLocators; }
8
+ function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("originalIdentityValueCaseLocators"); return __eliscript_const_error(); }
9
+ import "eliscript/runtime/unicode-case.mjs";
10
+ const __eliscript_truthy = (value) => value !== false && value != null;
11
+
12
+ import {createHash} from "node:crypto";
13
+ import {Buffer} from "node:buffer";
14
+ import * as legacy from "./compiler-corpus-identity-value-adapters-legacy.mjs";
15
+ import {readOriginalProcessHostDependency, bindOriginalProcessHostDependency} from "./compiler-corpus-process.mjs";
16
+ const originalIdentityValueSuites = (legacy)["originalIdentityValueSuites"];
17
+ __eliscript_tdz_ready_0 = true;
18
+ const originalIdentityValueCaseLocators = (legacy)["originalIdentityValueCaseLocators"];
19
+ __eliscript_tdz_ready_1 = true;
20
+ async function addOriginalIdentityValueAdapters(options) {
21
+ return (await (async (text) => {
22
+ return (await (async (file) => {
23
+ return (await (async (source_path) => {
24
+ return (await (async (generated_path) => {
25
+ return (await (async (host_source) => {
26
+ return (await (async (source_identity) => {
27
+ return (await (async (generated_identity) => {
28
+ return (await (async (dependency) => {
29
+ return (await (async (publish) => {
30
+ return (await (async (forwarded) => {
31
+ return (await (async () => {
32
+ if ((!((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(host_source) === "string") && ((generated_identity)["file"] === generated_path) && ((source_identity)["file"] === source_path) && ((generated_identity)["bytes"] === Buffer.byteLength(host_source, "utf8")) && ((generated_identity)["sha256"] === ((createHash("sha256"))["update"](host_source))["digest"]("hex"))))) {
33
+ ((__eliscript_value_1) => { throw __eliscript_value_1; })(new (globalThis.TypeError)("original identity host text differs from its generated source asset"));
34
+ }
35
+ ((forwarded)["add"] = ((record) => {
36
+ if (__eliscript_truthy(((record)["id"])["startsWith"]("original-identity-value:host-token-single:"))) {
37
+ {
38
+ let original = (record)["original"];
39
+ let modules = (record)["modules"];
40
+ let execution = (record)["execution"];
41
+ if ((!(((original)["fixture"] === "tests/fixtures/wasm-managed-host-identity.eli") && (((modules) ?? []).length === 1) && (((modules)[0])["id"] === (record)["entry"])))) {
42
+ ((__eliscript_value_2) => { throw __eliscript_value_2; })(new (globalThis.TypeError)("original single-module identity replay lost its actual source boundary"));
43
+ }
44
+ {
45
+ let proofs = [({"file": source_path, "sourceSha256": (source_identity)["sha256"], "bytes": (source_identity)["bytes"]}), ({"file": generated_path, "sourceSha256": (generated_identity)["sha256"], "bytes": (generated_identity)["bytes"]})];
46
+ let assets = (((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? __eliscript_value_3 : []))((original)["sourceAssets"]))["concat"](proofs);
47
+ let selected = Object.assign(({}), record, ({"execution": Object.assign(({}), execution, ({"hostSource": host_source, "javascriptHostSource": host_source})), "original": Object.assign(({}), original, ({"sourceAssets": assets}))}));
48
+ return publish(bindOriginalProcessHostDependency(selected, dependency));
49
+ }
50
+ }
51
+ } else {
52
+ return publish(record);
53
+ }
54
+ }));
55
+ return await ((legacy)["addOriginalIdentityValueAdapters"](forwarded));
56
+ })());
57
+ })(Object.assign(({}), options)));
58
+ })((options)["add"]));
59
+ })(await (readOriginalProcessHostDependency(options))));
60
+ })(await (file(generated_path))));
61
+ })(await (file(source_path))));
62
+ })(await (text(generated_path))));
63
+ })("tools/backends/compiler-corpus-identity-host.mjs"));
64
+ })("tools/backends/eliscript/compiler-corpus-identity-host.eli"));
65
+ })((options)["file"]));
66
+ })((options)["text"]));
67
+ }
68
+ export {originalIdentityValueSuites, originalIdentityValueCaseLocators, addOriginalIdentityValueAdapters};
69
+ //# sourceMappingURL=compiler-corpus-identity-value-adapters.mjs.map
@@ -0,0 +1,21 @@
1
+ // Generated by Eliscript. Do not edit.
2
+ import "eliscript/runtime/unicode-case.mjs";
3
+ const __eliscript_truthy = (value) => value !== false && value != null;
4
+
5
+ import {readFile} from "node:fs/promises";
6
+ import {saveCompilerMetadata} from "./compiler-bootstrap.mjs";
7
+ import {executeIsolatedCompilerCorpusExports} from "./compiler-corpus-execution.mjs";
8
+ async function main() {
9
+ return (await (async (argv) => {
10
+ return (await (async (input) => {
11
+ return (await (async (result) => {
12
+ return await (saveCompilerMetadata((argv)[3], result));
13
+ })(await (executeIsolatedCompilerCorpusExports(input))));
14
+ })(JSON.parse(await (readFile((argv)[2], "utf8")))));
15
+ })((globalThis.process)["argv"]));
16
+ }
17
+ (main())["catch"](((error) => {
18
+ console.error(error);
19
+ return ((globalThis.process)["exitCode"] = 1);
20
+ }));
21
+ //# sourceMappingURL=compiler-corpus-isolated-exports.mjs.map