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,464 @@
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("retained_transports"); return retained_transports; }
5
+ function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("retained_transports"); 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("frontend_support"); return frontend_support; }
8
+ function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("frontend_support"); return __eliscript_const_error(); }
9
+ import "eliscript/runtime/unicode-case.mjs";
10
+ import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3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pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
11
+ const __eliscript_truthy = (value) => value !== false && value != null;
12
+ const __eliscript_number_intrinsic = globalThis.Number;
13
+ const __eliscript_bigint_intrinsic = globalThis.BigInt;
14
+ const __eliscript_numeric_apply = globalThis.Reflect.apply;
15
+ const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
16
+ const __eliscript_numeric_error = globalThis.TypeError;
17
+ const __eliscript_numeric_trim = globalThis.String.prototype.trim;
18
+ const __eliscript_numeric_slice = globalThis.String.prototype.slice;
19
+ const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
20
+ const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
21
+ const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
22
+ const __eliscript_numeric_primitive = (value) => {
23
+ if (!__eliscript_numeric_object(value)) return value;
24
+ const exotic = value[__eliscript_numeric_symbol];
25
+ if (exotic !== void 0 && exotic !== null) {
26
+ const result = __eliscript_numeric_apply(exotic, value, ["number"]);
27
+ if (!__eliscript_numeric_object(result)) return result;
28
+ throw new __eliscript_numeric_error("Cannot convert object to primitive value");
29
+ }
30
+ for (let index = 0; index < 2; index++) {
31
+ const method = value[index === 0 ? "valueOf" : "toString"];
32
+ if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
33
+ const result = __eliscript_numeric_apply(method, value, []);
34
+ if (!__eliscript_numeric_object(result)) return result;
35
+ }
36
+ }
37
+ throw new __eliscript_numeric_error("Cannot convert object to primitive value");
38
+ };
39
+ const __eliscript_to_number = (value) => {
40
+ const primitive = __eliscript_numeric_primitive(value);
41
+ if (typeof primitive === "string") {
42
+ const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
43
+ if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
44
+ let first = 2;
45
+ while (first < text.length && text[first] === "0") first++;
46
+ if (first === text.length) return 0;
47
+ const prefix = text[1];
48
+ const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
49
+ if (text.length - first > limit) return 1 / 0;
50
+ const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
51
+ return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
52
+ }
53
+ }
54
+ return __eliscript_number_intrinsic(primitive);
55
+ };
56
+ const __eliscript_numeric = (value) => {
57
+ if (typeof value === "number" || typeof value === "bigint") return value;
58
+ const primitive = __eliscript_numeric_primitive(value);
59
+ if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
60
+ return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
61
+ };
62
+ const __eliscript_implicit_number = (value) => {
63
+ if (typeof value === "number") return value;
64
+ const primitive = __eliscript_numeric_primitive(value);
65
+ if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
66
+ return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
67
+ };
68
+ const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
69
+ const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
70
+ const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
71
+ const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
72
+ const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
73
+ const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
74
+ const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
75
+ const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
76
+ const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
77
+ const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
78
+ const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
79
+ const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
80
+ const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
81
+ const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
82
+ const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
83
+ const __eliscript_numeric_relation = (operator, left, right) => {
84
+ if (typeof left === "number" && typeof right === "number") {
85
+ if (operator === "<") return left < right;
86
+ if (operator === "<=") return left <= right;
87
+ if (operator === ">") return left > right;
88
+ return left >= right;
89
+ }
90
+ let a = __eliscript_numeric_primitive(left);
91
+ let b = __eliscript_numeric_primitive(right);
92
+ const x = typeof a, y = typeof b;
93
+ if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
94
+ a = __eliscript_numeric(a);
95
+ b = __eliscript_numeric(b);
96
+ }
97
+ if (operator === "<") return a < b;
98
+ if (operator === "<=") return a <= b;
99
+ if (operator === ">") return a > b;
100
+ return a >= b;
101
+ };
102
+
103
+ import {copyFile, open, mkdir, readFile, writeFile} from "node:fs/promises";
104
+ import {resolve, basename, dirname} from "node:path";
105
+ import {createHash} from "node:crypto";
106
+ import {parseArgs} from "node:util";
107
+ import {spawn} from "node:child_process";
108
+ import {root} from "./build.mjs";
109
+ import {writeCompilerMetadata} from "./compiler-build.mjs";
110
+ import * as legacy from "./compiler-package-legacy.mjs";
111
+ const retained_transports = [["tools/backends/managed-host-object-realm.mjs", "transport/backends/managed-host-object-realm.mjs", "transport/backends/managed-host.mjs"], ["tools/backends/managed-host-object-provider.mjs", "transport/backends/managed-host-object-provider.mjs", "transport/backends/managed-host-object-realm.mjs"], ["tools/backends/managed-host-proxy.mjs", "transport/backends/managed-host-proxy.mjs", "transport/backends/managed-source-view.mjs"], ["tools/backends/managed-foreign-binding.mjs", "transport/backends/managed-foreign-binding.mjs", "transport/backends/managed-host.mjs"], ["tools/backends/managed-host-lifecycle.mjs", "transport/backends/managed-host-lifecycle.mjs", "transport/backends/managed-host.mjs"], ["tools/backends/managed-host-runtime.mjs", "transport/backends/managed-host-runtime.mjs", "transport/backends/managed-host.mjs"], ["tools/backends/managed-host-runtime.mjs.map", "transport/backends/managed-host-runtime.mjs.map", "transport/backends/managed-host-runtime.mjs"], ["tools/backends/managed-host-legacy.mjs", "transport/backends/managed-host-legacy.mjs", "transport/backends/managed-host.mjs"], ["tools/backends/managed-runtime-host-legacy.mjs", "transport/backends/managed-runtime-host-legacy.mjs", "transport/backends/managed-runtime.mjs"], ["tools/backends/managed-module-graph-legacy.mjs", "transport/backends/managed-module-graph-legacy.mjs", "transport/backends/managed-module-graph.mjs"], ["tools/backends/managed-source-view-legacy.mjs", "transport/backends/managed-source-view-legacy.mjs", "transport/backends/managed-source-view.mjs"]];
112
+ __eliscript_tdz_ready_0 = true;
113
+ function package_default(value, fallback) {
114
+ if ((value === undefined)) {
115
+ return fallback;
116
+ } else {
117
+ return value;
118
+ }
119
+ }
120
+ const frontend_support = (["analyzer", "compiler", "emitter", "expander", "formatter", "ir", "lower", "project", "reader", "source-map", "symbol", "syntax", "transient-analysis"])["flatMap"](((name) => {
121
+ return [(String("dist/bootstrap/") + String(name) + String(".mjs")), (String("dist/bootstrap/") + String(name) + String(".mjs.map"))];
122
+ }));
123
+ __eliscript_tdz_ready_1 = true;
124
+ async function record_support(result, path) {
125
+ return (await (async (files) => {
126
+ return ((record) => {
127
+ return ((index) => {
128
+ return (__eliscript_numeric_relation("<", index, 0) ? (files)["push"](record) : ((files)[index] = record));
129
+ })((files)["findIndex"](((item) => {
130
+ return ((item)["path"] === path);
131
+ })));
132
+ })(await (transport_identity(resolve((result)["directory"], path), path)));
133
+ })(((result)["manifest"])["files"]));
134
+ }
135
+ async function copy_support(result, source, path) {
136
+ return (await (async (destination) => {
137
+ await (mkdir(dirname(destination), ({"recursive": true})));
138
+ await (copyFile(source, destination));
139
+ return await (record_support(result, path));
140
+ })(resolve((result)["directory"], path)));
141
+ }
142
+ async function publish_runtime_scope(result, path, exports) {
143
+ return (await (async (destination) => {
144
+ return (await (async (files) => {
145
+ return (await (async (existing) => {
146
+ return (await (async (certified) => {
147
+ return (await (async (scope) => {
148
+ return (await (async (text) => {
149
+ return (__eliscript_truthy(existing) ? (await (async (bytes) => {
150
+ return ((actual) => {
151
+ return ((declared) => {
152
+ return ((!__eliscript_truthy(((__eliscript_value_1) => (__eliscript_truthy(__eliscript_value_1) ? ((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? ((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? (Object.keys(exports))["every"](((name) => {
153
+ return (((declared)["exports"])[name] === (exports)[name]);
154
+ })) : __eliscript_value_5))((declared)["exports"]) : __eliscript_value_4))(((declared)["type"] === "module")) : __eliscript_value_3))(((declared)["name"] === "eliscript")) : __eliscript_value_2))(((existing)["sha256"] === (actual)["sha256"])) : __eliscript_value_1))(((existing)["bytes"] === (actual)["bytes"])))) ? ((__eliscript_value_6) => { throw __eliscript_value_6; })(new (globalThis.Error)("compiler package runtime scope conflicts with its certified artifact")) : null);
155
+ })(JSON.parse(__eliscript_at_direct(bytes, "toString", "utf8")));
156
+ })(await (transport_identity(destination, path)));
157
+ })(await (readFile(destination)))) : (await (async () => {
158
+ if (__eliscript_truthy(certified)) {
159
+ if ((!(((certified)["bytes"] === globalThis.Buffer.byteLength(text, "utf8")) && ((certified)["sha256"] === ((createHash("sha256"))["update"](text, "utf8"))["digest"]("hex"))))) {
160
+ ((__eliscript_value_7) => { throw __eliscript_value_7; })(new (globalThis.Error)("compiler package runtime scope conflicts with its certified artifact"));
161
+ }
162
+ }
163
+ (await (async () => {
164
+ try {
165
+ return await (writeFile(destination, text, ({"flag": "wx"})));
166
+ } catch (error) {
167
+ return ((!(await (async (__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? (await (readFile(destination, "utf8")) === text) : __eliscript_value_8))(((error)["code"] === "EEXIST")))) ? ((__eliscript_value_9) => { throw __eliscript_value_9; })(error) : null);
168
+ }
169
+ })());
170
+ return await (record_support(result, path));
171
+ })()));
172
+ })((String(JSON.stringify(scope, null, 2)) + String("\n"))));
173
+ })(({"name": "eliscript", "type": "module", "private": true, "exports": exports})));
174
+ })((__eliscript_truthy((path)["startsWith"]("artifact/")) ? ((((result)["manifest"])["artifactIdentity"])["files"])["find"](((item) => {
175
+ return ((item)["path"] === (path)["slice"]((("artifact/") ?? []).length));
176
+ })) : null)));
177
+ })((files)["find"](((item) => {
178
+ return ((item)["path"] === path);
179
+ }))));
180
+ })(((result)["manifest"])["files"]));
181
+ })(resolve((result)["directory"], path)));
182
+ }
183
+ async function complete_frontend_support(result, source_root) {
184
+ (await (async (index) => {
185
+ return (await (async () => {
186
+ while (__eliscript_numeric_relation("<", index, (((__eliscript_tdz_read_1())) ?? []).length)) {
187
+ (await (async (path) => {
188
+ return await (copy_support(result, resolve(source_root, path), path));
189
+ })(((__eliscript_tdz_read_1()))[index]));
190
+ ((index = (index + 1)));
191
+ }
192
+ return null;
193
+ })());
194
+ })(0));
195
+ (await (async (prefixes, index, files) => {
196
+ return (await (async () => {
197
+ while (__eliscript_numeric_relation("<", index, ((prefixes) ?? []).length)) {
198
+ (await (async (capsules, offset) => {
199
+ return (await (async () => {
200
+ while (__eliscript_numeric_relation("<", offset, ((capsules) ?? []).length)) {
201
+ (await (async (suffix) => {
202
+ return (await (async (path) => {
203
+ return (await (async (map_path) => {
204
+ return (await (async (existing) => {
205
+ return (await (async (existing_map) => {
206
+ return ((!__eliscript_truthy(existing)) ? (await (async () => {
207
+ if (__eliscript_truthy(existing_map)) {
208
+ ((__eliscript_value_10) => { throw __eliscript_value_10; })(new (globalThis.Error)("compiler package runtime map has no matching certified module"));
209
+ }
210
+ await (copy_support(result, resolve(source_root, suffix), path));
211
+ return await (copy_support(result, resolve(source_root, (String(suffix) + String(".map"))), map_path));
212
+ })()) : null);
213
+ })((files)["find"](((item) => {
214
+ return ((item)["path"] === map_path);
215
+ }))));
216
+ })((files)["find"](((item) => {
217
+ return ((item)["path"] === path);
218
+ }))));
219
+ })((String(path) + String(".map"))));
220
+ })((String((prefixes)[index]) + String(suffix))));
221
+ })((String("runtime/") + String((capsules)[offset]) + String(".mjs"))));
222
+ ((offset = (offset + 1)));
223
+ }
224
+ return null;
225
+ })());
226
+ })(["math", "unicode-case", "unicode-case-data"], 0));
227
+ ((index = (index + 1)));
228
+ }
229
+ return null;
230
+ })());
231
+ })(["dist/", "", "artifact/", "transport/"], 0, ((result)["manifest"])["files"]));
232
+ (await (async (scopes, index) => {
233
+ return (await (async () => {
234
+ while (__eliscript_numeric_relation("<", index, ((scopes) ?? []).length)) {
235
+ (await (async (path) => {
236
+ return await (publish_runtime_scope(result, path, ((path === "runtime/package.json") ? ({"./runtime/math.mjs": "./math.mjs", "./runtime/unicode-case.mjs": "./unicode-case.mjs", "./runtime/unicode-case-data.mjs": "./unicode-case-data.mjs"}) : ({"./runtime/math.mjs": "./runtime/math.mjs", "./runtime/unicode-case.mjs": "./runtime/unicode-case.mjs", "./runtime/unicode-case-data.mjs": "./runtime/unicode-case-data.mjs"}))));
237
+ })((scopes)[index]));
238
+ ((index = (index + 1)));
239
+ }
240
+ return null;
241
+ })());
242
+ })(["dist/package.json", "artifact/package.json", "transport/package.json", "runtime/package.json"], 0));
243
+ return (await (async (path) => {
244
+ return (await (async (package$) => {
245
+ return (await (async () => {
246
+ if ((!__eliscript_truthy(((package$)["files"])["includes"]("dist")))) {
247
+ ((package$)["files"])["push"]("dist");
248
+ }
249
+ await (writeFile(path, (String(JSON.stringify(package$, null, 2)) + String("\n"))));
250
+ return await (record_support(result, "package.json"));
251
+ })());
252
+ })(JSON.parse(await (readFile(path, "utf8")))));
253
+ })(resolve((result)["directory"], "package.json")));
254
+ }
255
+ async function bundleCompilerBrowserTransport(entry, output, source_root) {
256
+ await (mkdir(dirname(output), ({"recursive": true})));
257
+ return await (new (globalThis.Promise)(((accept, reject) => {
258
+ {
259
+ let command = package_default(((globalThis.process)["env"])["BUN"], "bun");
260
+ let child = spawn(command, ["build", entry, "--target=browser", "--format=esm", "--sourcemap=external", "--outdir", dirname(output), "--entry-naming", basename(output)], ({"cwd": source_root, "stdio": ["ignore", "ignore", "inherit"]}));
261
+ (child)["once"]("error", reject);
262
+ return (child)["once"]("close", ((code, signal) => {
263
+ if (((code === 0) && (signal === null))) {
264
+ return accept();
265
+ } else {
266
+ return reject(new (globalThis.Error)((String("compiler browser bundle failed: ") + String(code) + String(" ") + String(signal))));
267
+ }
268
+ }));
269
+ }
270
+ })));
271
+ }
272
+ async function complete_browser_support(result, source_root) {
273
+ return (await (async (base) => {
274
+ return (await (async (manifest) => {
275
+ return (((manifest)["host"] === "javascript") ? (await (async (original) => {
276
+ return (await (async (browser_root) => {
277
+ return (await (async (assets) => {
278
+ return (await (async (seen) => {
279
+ return (await (async (copy_asset) => {
280
+ return (await (async () => {
281
+ await (bundleCompilerBrowserTransport(resolve(source_root, "tools/backends/compiler-package-browser.mjs"), resolve(browser_root, "compiler-browser.mjs"), source_root));
282
+ await (bundleCompilerBrowserTransport(resolve(source_root, "tools/backends/compiler-worker.mjs"), resolve(browser_root, "compiler-worker.mjs"), source_root));
283
+ await (bundleCompilerBrowserTransport(resolve(base, "artifact", (original)["path"]), resolve(browser_root, "compiler.mjs"), source_root));
284
+ (await (async (bundles, index) => {
285
+ return (await (async () => {
286
+ while (__eliscript_numeric_relation("<", index, ((bundles) ?? []).length)) {
287
+ (await (async (path) => {
288
+ await (record_support(result, (String("browser/") + String(path))));
289
+ await (record_support(result, (String("browser/") + String(path) + String(".map"))));
290
+ return ((path === "compiler.mjs") ? (await (async () => {
291
+ (assets)["push"](await (transport_identity(resolve(browser_root, path), path)));
292
+ return (assets)["push"](await (transport_identity(resolve(browser_root, (String(path) + String(".map"))), (String(path) + String(".map")))));
293
+ })()) : null);
294
+ })((bundles)[index]));
295
+ ((index = (index + 1)));
296
+ }
297
+ return null;
298
+ })());
299
+ })(["compiler-browser.mjs", "compiler-worker.mjs", "compiler.mjs"], 0));
300
+ await (copy_asset((original)["runtimePath"]));
301
+ (await (async (literals, index) => {
302
+ return ((!(literals === undefined)) ? (await (async () => {
303
+ while (__eliscript_numeric_relation("<", index, ((literals) ?? []).length)) {
304
+ await (copy_asset(((literals)[index])["path"]));
305
+ ((index = (index + 1)));
306
+ }
307
+ return null;
308
+ })()) : null);
309
+ })((original)["literalSources"], 0));
310
+ ((!((original)["debugPath"] == null)) ? await (copy_asset((original)["debugPath"])) : null);
311
+ (await (async (provenance) => {
312
+ return (await (async (derived) => {
313
+ return (await (async () => {
314
+ if (__eliscript_truthy(Object.hasOwn(original, "productIdentity"))) {
315
+ ((provenance)["originalProductIdentity"] = (original)["productIdentity"]);
316
+ }
317
+ (["runtimeEncoding", "literalSources", "memory", "budget", "auto", "debugPath", "capabilities"])["forEach"](((field) => {
318
+ if (__eliscript_truthy(Object.hasOwn(original, field))) {
319
+ return ((derived)[field] = (original)[field]);
320
+ } else {
321
+ return null;
322
+ }
323
+ }));
324
+ await (writeCompilerMetadata(resolve(browser_root, "compiler-artifact.json"), derived));
325
+ return await (record_support(result, "browser/compiler-artifact.json"));
326
+ })());
327
+ })(({"host": "javascript", "target": "javascript", "entry": "compiler.mjs", "path": "compiler.mjs", "modules": [({"id": "compiler.mjs", "path": "compiler.mjs", "sourceMapPath": "compiler.mjs.map"})], "sourceIdentity": (original)["sourceIdentity"], "provenance": provenance, "runtimePath": (original)["runtimePath"], "artifactIdentity": ({"algorithm": "sha256", "files": assets})})));
328
+ })(({"kind": "eliscript-browser-bundle", "originalArtifact": "artifact/compiler-artifact.json", "originalArtifactIdentity": (original)["artifactIdentity"], "originalProvenance": (original)["provenance"]})));
329
+ ((manifest)["browserArtifact"] = "browser/compiler-artifact.json");
330
+ ((manifest)["browser"] = "browser/compiler-browser.mjs");
331
+ ((manifest)["worker"] = "browser/compiler-worker.mjs");
332
+ return (await (async (path) => {
333
+ return (await (async (package$) => {
334
+ return (await (async () => {
335
+ (((package$)["exports"])["./browser"] = "./browser/compiler-browser.mjs");
336
+ (((package$)["exports"])["./worker"] = "./browser/compiler-worker.mjs");
337
+ if ((!__eliscript_truthy(((package$)["files"])["includes"]("browser")))) {
338
+ ((package$)["files"])["push"]("browser");
339
+ }
340
+ await (writeFile(path, (String(JSON.stringify(package$, null, 2)) + String("\n"))));
341
+ return await (record_support(result, "package.json"));
342
+ })());
343
+ })(JSON.parse(await (readFile(path, "utf8")))));
344
+ })(resolve(base, "package.json")));
345
+ })());
346
+ })((async (path) => {
347
+ return ((!__eliscript_truthy((seen)["has"](path))) ? (await (async () => {
348
+ (seen)["add"](path);
349
+ await (copy_support(result, resolve(base, "artifact", path), (String("browser/") + String(path))));
350
+ return (assets)["push"](await (transport_identity(resolve(browser_root, path), path)));
351
+ })()) : null);
352
+ })));
353
+ })(new (globalThis.Set)()));
354
+ })([]));
355
+ })(resolve(base, "browser")));
356
+ })(JSON.parse(await (readFile(resolve(base, "artifact/compiler-artifact.json"), "utf8"))))) : null);
357
+ })((result)["manifest"]));
358
+ })((result)["directory"]));
359
+ }
360
+ async function transport_identity(path, relative_path) {
361
+ return (await (async (file, hash, buffer, bytes, failed) => {
362
+ return (await (async () => {
363
+ try {
364
+ return (await (async () => {
365
+ (await (async (reading) => {
366
+ return (await (async () => {
367
+ while (__eliscript_truthy(reading)) {
368
+ ((count) => {
369
+ if ((count === 0)) {
370
+ return ((reading = false));
371
+ } else {
372
+ (hash)["update"]((buffer)["subarray"](0, count));
373
+ return ((bytes = (bytes + count)));
374
+ }
375
+ })((await ((file)["read"](buffer, 0, ((buffer) ?? []).length, null)))["bytesRead"]);
376
+ }
377
+ return null;
378
+ })());
379
+ })(true));
380
+ return ({"path": relative_path, "bytes": bytes, "sha256": (hash)["digest"]("hex")});
381
+ })());
382
+ } catch (error) {
383
+ ((failed = true));
384
+ return ((__eliscript_value_11) => { throw __eliscript_value_11; })(error);
385
+ } finally {
386
+ (await (async () => {
387
+ try {
388
+ return await ((file)["close"]());
389
+ } catch (error) {
390
+ if ((!__eliscript_truthy(failed))) {
391
+ return ((__eliscript_value_12) => { throw __eliscript_value_12; })(error);
392
+ } else {
393
+ return null;
394
+ }
395
+ }
396
+ })());
397
+ }
398
+ })());
399
+ })(await (open(path, "r")), createHash("sha256"), new (globalThis.Uint8Array)(65536), 0, false));
400
+ }
401
+ async function packageIndependentCompiler(...arguments$) {
402
+ return (await (async (options) => {
403
+ return (await (async (artifact) => {
404
+ return (await (async (output_root) => {
405
+ return (await (async (source_root) => {
406
+ return (await (async (name) => {
407
+ return (await (async (result) => {
408
+ return (await (async (files) => {
409
+ return (await (async (index) => {
410
+ return (await (async () => {
411
+ (await (async () => {
412
+ while (__eliscript_numeric_relation("<", index, (((__eliscript_tdz_read_0())) ?? []).length)) {
413
+ (await (async (item) => {
414
+ return (await (async (path) => {
415
+ return (await (async (target) => {
416
+ return (await (async (position) => {
417
+ return (await (async () => {
418
+ if (__eliscript_numeric_relation("<", position, 0)) {
419
+ ((__eliscript_value_13) => { throw __eliscript_value_13; })(new (globalThis.Error)("compiler package transport importer is missing"));
420
+ }
421
+ await (copyFile(resolve(source_root, (item)[0]), target));
422
+ return (files)["splice"]((position + 1), 0, await (transport_identity(target, path)));
423
+ })());
424
+ })((files)["findIndex"](((record) => {
425
+ return ((record)["path"] === (item)[2]);
426
+ }))));
427
+ })(resolve((result)["directory"], path)));
428
+ })((item)[1]));
429
+ })(((__eliscript_tdz_read_0()))[index]));
430
+ ((index = (index + 1)));
431
+ }
432
+ return null;
433
+ })());
434
+ await (complete_frontend_support(result, source_root));
435
+ await (complete_browser_support(result, source_root));
436
+ await (writeCompilerMetadata((result)["manifestPath"], (result)["manifest"]));
437
+ return result;
438
+ })());
439
+ })(0));
440
+ })(((result)["manifest"])["files"]));
441
+ })(await ((legacy)["packageIndependentCompiler"](({"artifact": artifact, "outputRoot": output_root, "sourceRoot": source_root, "name": name})))));
442
+ })(package_default((options)["name"], "eliscript-independent-compiler")));
443
+ })(package_default((options)["sourceRoot"], root)));
444
+ })((options)["outputRoot"]));
445
+ })((options)["artifact"]));
446
+ })(package_default((__eliscript_numeric_relation(">", ((arguments$) ?? []).length, 0) ? (arguments$)[0] : undefined), ({}))));
447
+ }
448
+ async function main(...arguments$) {
449
+ return (await (async (args) => {
450
+ return (await (async (parsed) => {
451
+ return (await (async (values) => {
452
+ return (__eliscript_truthy((values)["help"]) ? ((globalThis.process)["stdout"])["write"]("Usage: compiler-package.mjs --artifact compiler-artifact.json --output DIRECTORY [--name PACKAGE]\n") : ((result) => {
453
+ return ((globalThis.process)["stdout"])["write"](((result)["manifestPath"] + "\n"));
454
+ })(await (packageIndependentCompiler(({"artifact": (values)["artifact"], "outputRoot": (values)["output"], "name": (values)["name"]})))));
455
+ })((parsed)["values"]));
456
+ })(parseArgs(({"args": args, "strict": true, "options": ({"artifact": ({"type": "string"}), "output": ({"type": "string", "short": "o"}), "name": ({"type": "string"}), "help": ({"type": "boolean", "short": "h"})})}))));
457
+ })(package_default((__eliscript_numeric_relation(">", ((arguments$) ?? []).length, 0) ? (arguments$)[0] : undefined), ((globalThis.process)["argv"])["slice"](2))));
458
+ }
459
+ ((__eliscript_numeric_relation(">", (((globalThis.process)["argv"]) ?? []).length, 1) && (basename(((globalThis.process)["argv"])[1]) === "compiler-package.mjs")) ? (main())["catch"](((error) => {
460
+ ((globalThis.process)["stderr"])["write"](((((error)["stack"] == null) ? globalThis.String(error) : (error)["stack"]) + "\n"));
461
+ return ((globalThis.process)["exitCode"] = 1);
462
+ })) : null);
463
+ export {packageIndependentCompiler, main, bundleCompilerBrowserTransport};
464
+ //# sourceMappingURL=compiler-package.mjs.map
@@ -0,0 +1,126 @@
1
+ import {readdir, realpath, stat, open} from 'node:fs/promises';
2
+ import {constants} from 'node:fs';
3
+ import {resolve, relative, isAbsolute, sep} from 'node:path';
4
+
5
+ const excludedDirectories = new Set([
6
+ '.git', 'node_modules', 'dist', 'build', 'target', 'coverage',
7
+ '.cache', '.eliscript-cache', '.next', '.nuxt', '.turbo', '.parcel-cache',
8
+ ]);
9
+
10
+ function inside(root, path) {
11
+ const part = relative(root, path);
12
+ return part === '' || (!isAbsolute(part) && part !== '..' && !part.startsWith('..' + sep));
13
+ }
14
+ function virtualPath(root, path) {
15
+ return relative(root, path).split(sep).join('/');
16
+ }
17
+ async function authorizedPath(root, path) {
18
+ const actual = await realpath(path);
19
+ if (!inside(root, actual)) throw new Error('project path escapes the authorized root');
20
+ return actual;
21
+ }
22
+ async function sourceText(root, path) {
23
+ const actual = await authorizedPath(root, path);
24
+ const handle = await open(actual, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
25
+ let failed = false;
26
+ try {
27
+ const current = await authorizedPath(root, path);
28
+ const opened = await handle.stat(), named = await stat(current);
29
+ if (!opened.isFile() || opened.dev !== named.dev || opened.ino !== named.ino) {
30
+ throw new Error('project source changed while opening');
31
+ }
32
+ const bytes = await handle.readFile();
33
+ // Reject invalid UTF8 instead of silently changing source text. Keeping the
34
+ // BOM in the string also keeps all existing scalar source offsets intact.
35
+ return new TextDecoder('utf-8', {fatal: true, ignoreBOM: true}).decode(bytes);
36
+ } catch (error) {failed = true; throw error;}
37
+ finally {try {await handle.close();} catch (error) {if (!failed) throw error;}}
38
+ }
39
+ function macroSpecifier(value) {
40
+ if (typeof value !== 'string' || !value || value.includes('\\') || value.startsWith('/') || /^[a-z][a-z0-9+.-]*:/i.test(value)) {
41
+ throw new TypeError('macro dependency specifier must be a relative string');
42
+ }
43
+ let depth = 0;
44
+ for (const part of value.split('/')) {
45
+ if (part === '..') {if (--depth < 0) throw new TypeError('macro dependency specifier escapes its virtual root');}
46
+ else if (part !== '' && part !== '.') depth++;
47
+ }
48
+ return value;
49
+ }
50
+
51
+ // Filesystem transport only: import discovery and rewriting belong to the
52
+ // selected compiler session, after its own reader/analyzer/lowering stages.
53
+ export async function loadCompilerProject({
54
+ root, entry, target = 'javascript', sourceMap = false, debug = false,
55
+ macroCapabilities = [], macroDependencies = [], memory,
56
+ hostModules = [], literalSources,
57
+ nativeTarget = process.platform === 'linux' ? 'arm64-linux' : 'arm64-macos', nativeFormat = 'library',
58
+ } = {}) {
59
+ if (typeof root !== 'string' || !root || typeof entry !== 'string' || !entry) {
60
+ throw new TypeError('project input requires an explicit root and entry');
61
+ }
62
+ if (target === 'js') target = 'javascript';
63
+ if (!['javascript', 'wasm', 'native'].includes(target)) throw new TypeError('unknown project target');
64
+ if (!['arm64-macos', 'arm64-linux'].includes(nativeTarget) || !['library', 'object'].includes(nativeFormat)) {
65
+ throw new TypeError('unsupported native project output');
66
+ }
67
+ const logicalRoot = resolve(root), authorizedRoot = await realpath(logicalRoot);
68
+ if (!(await stat(authorizedRoot)).isDirectory()) throw new TypeError('project root is not a directory');
69
+ const entryPath = resolve(logicalRoot, entry);
70
+ if (!inside(logicalRoot, entryPath) || !entryPath.endsWith('.eli')) throw new TypeError('project entry must be an .eli file inside root');
71
+ await authorizedPath(authorizedRoot, entryPath);
72
+ const modules = [],hostSources=[];
73
+ if(!Array.isArray(hostModules))throw new TypeError('host module declarations must be an array');
74
+ async function walk(path, ancestors) {
75
+ const actual = await authorizedPath(authorizedRoot, path);
76
+ if (ancestors.has(actual)) return;
77
+ const next = new Set(ancestors); next.add(actual);
78
+ const entries = await readdir(actual, {withFileTypes: true});
79
+ entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
80
+ for (const child of entries) {
81
+ if (excludedDirectories.has(child.name)) continue;
82
+ const file = resolve(path, child.name);
83
+ const resolved = await authorizedPath(authorizedRoot, file);
84
+ const details = await stat(resolved);
85
+ if (details.isDirectory()) await walk(file, next);
86
+ else if (details.isFile() && child.name.endsWith('.eli')) {
87
+ const filename = virtualPath(logicalRoot, file);
88
+ modules.push({id: filename.slice(0, -4) + '.mjs', filename, source: await sourceText(authorizedRoot, file)});
89
+ } else if(details.isFile()&&child.name.endsWith('.mjs')){
90
+ const filename=virtualPath(logicalRoot,file);
91
+ hostSources.push({id:filename,filename,source:await sourceText(authorizedRoot,file)});
92
+ }
93
+ }
94
+ }
95
+ await walk(logicalRoot, new Set());
96
+ const entryFilename = virtualPath(logicalRoot, entryPath);
97
+ if (!modules.some(module => module.filename === entryFilename)) throw new Error('project entry is excluded or missing from the source graph');
98
+ if (!Array.isArray(macroCapabilities) || !Array.isArray(macroDependencies)) throw new TypeError('macro capabilities and dependencies must be arrays');
99
+ const capabilities = [...new Set(macroCapabilities)];
100
+ if (capabilities.some(value => value !== 'read-file')) throw new TypeError('unsupported macro capability');
101
+ if (macroDependencies.length && !capabilities.includes('read-file')) {
102
+ throw new Error('macro dependencies require explicit read-file capability');
103
+ }
104
+ const files = [], specifiers = new Set();
105
+ for (const dependency of macroDependencies) {
106
+ const specifier = macroSpecifier(dependency?.specifier);
107
+ if (specifiers.has(specifier)) throw new TypeError('duplicate macro dependency specifier');
108
+ if (typeof dependency.path !== 'string' || !dependency.path) throw new TypeError('macro dependency requires a path');
109
+ const path = resolve(logicalRoot, dependency.path);
110
+ if (!inside(logicalRoot, path)) throw new Error('macro dependency escapes the authorized root');
111
+ files.push({specifier, content: await sourceText(authorizedRoot, path)});
112
+ specifiers.add(specifier);
113
+ }
114
+ return {
115
+ operation: 'project', modules,
116
+ ...(hostSources.length?{hostSources}:{}),
117
+ ...(hostModules.length?{hostModules}:{}),
118
+ ...(literalSources === undefined ? {} : {literalSources}),
119
+ entry: entryFilename.slice(0, -4) + '.mjs', target, resolveImports: true,
120
+ sourceMap: Boolean(sourceMap),
121
+ debug: Boolean(debug),
122
+ ...(capabilities.length || files.length ? {macroContext: {capabilities, files}} : {}),
123
+ ...(memory ? {memory} : {}),
124
+ nativeTarget, nativeFormat,
125
+ };
126
+ }