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.
- package/README.md +61 -0
- package/bootstrap/README.md +26 -0
- package/bootstrap/backends/README.md +515 -0
- package/bootstrap/backends/async.eli +230 -0
- package/bootstrap/backends/binary.eli +173 -0
- package/bootstrap/backends/capabilities.eli +74 -0
- package/bootstrap/backends/elf.eli +246 -0
- package/bootstrap/backends/managed.eli +5976 -0
- package/bootstrap/backends/memory.eli +100 -0
- package/bootstrap/backends/native.eli +2000 -0
- package/bootstrap/backends/numeric.eli +1362 -0
- package/bootstrap/backends/optimize.eli +79 -0
- package/bootstrap/backends/regexp.eli +2263 -0
- package/bootstrap/backends/sha256.eli +138 -0
- package/bootstrap/backends/wasm.eli +1161 -0
- package/bootstrap/compiler/analyzer.eli +165 -77
- package/bootstrap/compiler/compiler.eli +43 -19
- package/bootstrap/compiler/emitter.eli +780 -170
- package/bootstrap/compiler/expander.eli +136 -45
- package/bootstrap/compiler/formatter.eli +8 -1
- package/bootstrap/compiler/ir.eli +148 -45
- package/bootstrap/compiler/lower.eli +29 -2
- package/bootstrap/compiler/project.eli +51 -21
- package/bootstrap/compiler/reader.eli +128 -36
- package/bootstrap/compiler/source-map.eli +46 -4
- package/bootstrap/compiler/symbol.eli +2 -1
- package/bootstrap/compiler/syntax.eli +47 -12
- package/bootstrap/compiler/transient-analysis.eli +40 -4
- package/bootstrap/host/check-cli-legacy.mjs +163 -0
- package/bootstrap/host/check-cli.mjs +59 -158
- package/bootstrap/host/check-cli.mjs.map +1 -0
- package/bootstrap/host/compiler-session.eli +1579 -0
- package/bootstrap/host/compiler-tools.eli +513 -0
- package/bootstrap/host/eliscript-cli.mjs +53 -33
- package/bootstrap/host/eliscript-cli.mjs.map +1 -0
- package/bootstrap/host/project-cli-legacy.mjs +295 -0
- package/bootstrap/host/project-cli.mjs +74 -289
- package/bootstrap/host/project-cli.mjs.map +1 -0
- package/bootstrap/host/project-legacy.mjs +1080 -0
- package/bootstrap/host/project.mjs +210 -1060
- package/bootstrap/host/project.mjs.map +1 -0
- package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
- package/bootstrap/runtime/memory.eli +30379 -0
- package/browser/host.mjs +732 -11
- package/browser/worker.mjs +6 -3
- package/compiler/eliscript-analyzer.el +371 -4
- package/compiler/eliscript-cli.el +84 -1
- package/compiler/eliscript-emitter.el +1189 -256
- package/compiler/eliscript-expander.el +147 -10
- package/compiler/eliscript-ir-emitter.el +725 -208
- package/compiler/eliscript-lower.el +127 -1
- package/compiler/eliscript-portable.el +177 -51
- package/compiler/eliscript-project.el +20 -2
- package/compiler/eliscript-reader.el +141 -57
- package/compiler/eliscript-source-map.el +26 -12
- package/compiler/eliscript-transient-analysis.el +382 -19
- package/dist/backends/async.mjs +561 -0
- package/dist/backends/async.mjs.macro-origins.json +1 -0
- package/dist/backends/async.mjs.map +1 -0
- package/dist/backends/binary.mjs +381 -0
- package/dist/backends/binary.mjs.macro-origins.json +1 -0
- package/dist/backends/binary.mjs.map +1 -0
- package/dist/backends/capabilities.mjs +237 -0
- package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
- package/dist/backends/capabilities.mjs.map +1 -0
- package/dist/backends/elf.mjs +540 -0
- package/dist/backends/elf.mjs.macro-origins.json +1 -0
- package/dist/backends/elf.mjs.map +1 -0
- package/dist/backends/managed.mjs +10616 -0
- package/dist/backends/managed.mjs.macro-origins.json +1 -0
- package/dist/backends/managed.mjs.map +1 -0
- package/dist/backends/memory.mjs +278 -0
- package/dist/backends/memory.mjs.macro-origins.json +1 -0
- package/dist/backends/memory.mjs.map +1 -0
- package/dist/backends/native.mjs +4099 -0
- package/dist/backends/native.mjs.macro-origins.json +1 -0
- package/dist/backends/native.mjs.map +1 -0
- package/dist/backends/numeric.mjs +2458 -0
- package/dist/backends/numeric.mjs.macro-origins.json +1 -0
- package/dist/backends/numeric.mjs.map +1 -0
- package/dist/backends/optimize.mjs +204 -0
- package/dist/backends/optimize.mjs.macro-origins.json +1 -0
- package/dist/backends/optimize.mjs.map +1 -0
- package/dist/backends/regexp.mjs +2033 -0
- package/dist/backends/regexp.mjs.macro-origins.json +1 -0
- package/dist/backends/regexp.mjs.map +1 -0
- package/dist/backends/sha256.mjs +310 -0
- package/dist/backends/sha256.mjs.macro-origins.json +1 -0
- package/dist/backends/sha256.mjs.map +1 -0
- package/dist/backends/wasm.mjs +2258 -0
- package/dist/backends/wasm.mjs.macro-origins.json +1 -0
- package/dist/backends/wasm.mjs.map +1 -0
- package/dist/bootstrap/analyzer.mjs +1908 -776
- package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +450 -142
- package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +3083 -909
- package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +2887 -1233
- package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +582 -218
- package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +670 -116
- package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +866 -257
- package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/package.json +1 -0
- package/dist/bootstrap/project.mjs +1168 -498
- package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +674 -175
- package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/runtime/math.mjs +1117 -0
- package/dist/bootstrap/runtime/math.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
- package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +430 -119
- package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +229 -53
- package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +205 -7
- package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1185 -489
- package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +199 -6478
- package/dist/browser/host.mjs +1078 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +63 -0
- package/dist/compiler-artifact.json +1 -0
- package/dist/host/compiler-session.mjs +2980 -0
- package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-session.mjs.map +1 -0
- package/dist/host/compiler-tools.mjs +1084 -0
- package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-tools.mjs.map +1 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
- package/dist/literal-sources/runtime/core/collection.eli +639 -0
- package/dist/literal-sources/runtime/core/data-text.eli +290 -0
- package/dist/literal-sources/runtime/core/data.eli +22 -0
- package/dist/literal-sources/runtime/core/identifier.eli +44 -0
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
- package/dist/literal-sources/runtime/core/list.eli +19 -0
- package/dist/literal-sources/runtime/core/map.eli +9 -0
- package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
- package/dist/literal-sources/runtime/core/metadata.eli +40 -0
- package/dist/literal-sources/runtime/core/object.eli +8 -0
- package/dist/literal-sources/runtime/core/order.eli +123 -0
- package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
- package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
- package/dist/literal-sources/runtime/core/protocol.eli +28 -0
- package/dist/literal-sources/runtime/core/queue.eli +9 -0
- package/dist/literal-sources/runtime/core/record.eli +191 -0
- package/dist/literal-sources/runtime/core/regex.eli +158 -0
- package/dist/literal-sources/runtime/core/sequence.eli +305 -0
- package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
- package/dist/literal-sources/runtime/core/set.eli +9 -0
- package/dist/literal-sources/runtime/core/sorted.eli +408 -0
- package/dist/literal-sources/runtime/core/text.eli +14 -0
- package/dist/literal-sources/runtime/core/transducer.eli +268 -0
- package/dist/literal-sources/runtime/core/transient.eli +17 -0
- package/dist/literal-sources/runtime/core/truth.eli +4 -0
- package/dist/literal-sources/runtime/core/type.eli +232 -0
- package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
- package/dist/literal-sources/runtime/core/value.eli +19 -0
- package/dist/literal-sources/runtime/core/vector.eli +25 -0
- package/dist/literal-sources/runtime/literals.eli +23 -0
- package/dist/literal-sources/runtime/testing/value.eli +6 -0
- package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
- package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
- package/dist/literal-sources/runtime/wire/schema.eli +193 -0
- package/dist/literal-sources/stdlib/bit.eli +36 -0
- package/dist/literal-sources/stdlib/core/data.eli +306 -0
- package/dist/literal-sources/stdlib/core/object.eli +89 -0
- package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
- package/dist/literal-sources/stdlib/core/set.eli +312 -0
- package/dist/literal-sources/stdlib/core/text.eli +103 -0
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +494 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1469 -0
- package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
- package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
- package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
- package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
- package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
- package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
- package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
- package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
- package/dist/literal-sources/stdlib/value.eli +325 -0
- package/dist/package.json +10 -0
- package/dist/runtime/math.mjs +1116 -0
- package/dist/runtime/math.mjs.macro-origins.json +1 -0
- package/dist/runtime/math.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +10124 -0
- package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/runtime/unicode-case.mjs +280 -0
- package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case.mjs.map +1 -0
- package/dist/runtime.eli +30379 -0
- package/dist/stage3-release.json +1 -0
- package/editor/README.md +1 -1
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +106 -11
- package/platform/http.mjs +20 -0
- package/runtime/array-text.mjs +159 -0
- package/runtime/core/map-internals.mjs +27 -9
- package/runtime/core/object-impl.mjs +26 -17
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/protocol-impl.mjs +682 -255
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/protocol.mjs +4 -0
- package/runtime/core/record.mjs +23 -2
- package/runtime/core/regex.mjs +4 -0
- package/runtime/core/sorted.mjs +53 -0
- package/runtime/core/text-impl.mjs +167 -48
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/type.mjs +75 -3
- package/runtime/core/vector.mjs +6 -0
- package/runtime/math.eli +429 -0
- package/runtime/math.mjs +1116 -0
- package/runtime/math.mjs.map +1 -0
- package/runtime/number-radix.mjs +105 -0
- package/runtime/unicode-case-data.eli +29 -0
- package/runtime/unicode-case-data.mjs +10124 -0
- package/runtime/unicode-case-data.mjs.map +1 -0
- package/runtime/unicode-case.eli +100 -0
- package/runtime/unicode-case.mjs +280 -0
- package/runtime/unicode-case.mjs.map +1 -0
- package/runtime/wire/http-rpc.mjs +168 -0
- package/runtime/wire/markdown.mjs +196 -0
- package/runtime/wire/schema.mjs +109 -0
- package/stdlib/README.md +54 -0
- package/stdlib/core/protocol.eli +81 -17
- package/stdlib/core/seq.eli +1 -1
- package/stdlib/core/zipper.eli +172 -72
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +494 -0
- package/stdlib/managed-literals.eli +1469 -0
- package/stdlib/managed-protocol-error.eli +32 -0
- package/stdlib/managed-queue-state.eli +65 -0
- package/stdlib/managed-runtime-collection-internals.eli +60 -0
- package/stdlib/managed-runtime-collection.eli +639 -0
- package/stdlib/managed-runtime-data-text.eli +290 -0
- package/stdlib/managed-runtime-data.eli +22 -0
- package/stdlib/managed-runtime-identifier.eli +44 -0
- package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
- package/stdlib/managed-runtime-list.eli +19 -0
- package/stdlib/managed-runtime-literals.eli +23 -0
- package/stdlib/managed-runtime-map.eli +9 -0
- package/stdlib/managed-runtime-metadata-internals.eli +6 -0
- package/stdlib/managed-runtime-metadata.eli +40 -0
- package/stdlib/managed-runtime-object.eli +8 -0
- package/stdlib/managed-runtime-order.eli +123 -0
- package/stdlib/managed-runtime-persistent-kind.eli +28 -0
- package/stdlib/managed-runtime-protocol.eli +28 -0
- package/stdlib/managed-runtime-queue.eli +9 -0
- package/stdlib/managed-runtime-record.eli +191 -0
- package/stdlib/managed-runtime-regex.eli +158 -0
- package/stdlib/managed-runtime-sequence.eli +305 -0
- package/stdlib/managed-runtime-set-algebra.eli +28 -0
- package/stdlib/managed-runtime-set.eli +9 -0
- package/stdlib/managed-runtime-sorted.eli +408 -0
- package/stdlib/managed-runtime-text.eli +14 -0
- package/stdlib/managed-runtime-transducer.eli +268 -0
- package/stdlib/managed-runtime-transient.eli +17 -0
- package/stdlib/managed-runtime-truth.eli +4 -0
- package/stdlib/managed-runtime-type.eli +232 -0
- package/stdlib/managed-runtime-value-internals.eli +13 -0
- package/stdlib/managed-runtime-value.eli +19 -0
- package/stdlib/managed-runtime-vector.eli +25 -0
- package/stdlib/managed-sorted-state.eli +233 -0
- package/stdlib/managed-testing-value.eli +6 -0
- package/stdlib/managed-transient-state.eli +348 -0
- package/stdlib/managed-value-state.eli +153 -0
- package/stdlib/managed-vector-view-state.eli +102 -0
- package/stdlib/managed-wire-http-rpc.eli +362 -0
- package/stdlib/managed-wire-markdown.eli +275 -0
- package/stdlib/managed-wire-schema.eli +193 -0
- package/stdlib/mdp.eli +7 -0
- package/stdlib/mds.eli +4 -0
- package/stdlib/persistent-vector.eli +23 -6
- package/tools/acceptance/check-legacy.mjs +687 -0
- package/tools/acceptance/check.eli +431 -0
- package/tools/acceptance/compile-evidence.el +49 -0
- package/tools/acceptance/finalize-legacy.mjs +498 -0
- package/tools/acceptance/finalize.eli +270 -0
- package/tools/backends/benchmark.mjs +175 -0
- package/tools/backends/build.mjs +135 -0
- package/tools/backends/compile.mjs +94 -0
- package/tools/backends/compiler-bootstrap.mjs +1001 -0
- package/tools/backends/compiler-browser.mjs +361 -0
- package/tools/backends/compiler-build.mjs +1628 -0
- package/tools/backends/compiler-cli-legacy.mjs +334 -0
- package/tools/backends/compiler-cli.mjs +29 -0
- package/tools/backends/compiler-corpus-bit.mjs +234 -0
- package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
- package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
- package/tools/backends/compiler-corpus-debugging.mjs +221 -0
- package/tools/backends/compiler-corpus-emitter.mjs +324 -0
- package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
- package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
- package/tools/backends/compiler-corpus-execution.mjs +3324 -0
- package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
- package/tools/backends/compiler-corpus-generations.mjs +208 -0
- package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
- package/tools/backends/compiler-corpus-host-context.mjs +550 -0
- package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
- package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
- package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
- package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
- package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
- package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
- package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
- package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
- package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
- package/tools/backends/compiler-corpus-matchers.mjs +173 -0
- package/tools/backends/compiler-corpus-original-program.mjs +612 -0
- package/tools/backends/compiler-corpus-process.mjs +765 -0
- package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
- package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
- package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
- package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
- package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
- package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
- package/tools/backends/compiler-corpus-reference.mjs +241 -0
- package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
- package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
- package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
- package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
- package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
- package/tools/backends/compiler-corpus.mjs +2054 -0
- package/tools/backends/compiler-debug.mjs +142 -0
- package/tools/backends/compiler-matrix.mjs +1955 -0
- package/tools/backends/compiler-metadata.mjs +203 -0
- package/tools/backends/compiler-package-browser.mjs +120 -0
- package/tools/backends/compiler-package-legacy.mjs +654 -0
- package/tools/backends/compiler-package.mjs +464 -0
- package/tools/backends/compiler-project.mjs +126 -0
- package/tools/backends/compiler-session.mjs +843 -0
- package/tools/backends/compiler-sha256.mjs +152 -0
- package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
- package/tools/backends/compiler-worker.mjs +573 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
- package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
- package/tools/backends/dist/record-grid.mjs +1256 -0
- package/tools/backends/dist/record-grid.mjs.map +1 -0
- package/tools/backends/dist/release-cli.mjs +462 -0
- package/tools/backends/dist/release-cli.mjs.map +1 -0
- package/tools/backends/dist/run-artifact.mjs +517 -0
- package/tools/backends/dist/run-artifact.mjs.map +1 -0
- package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
- package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
- package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
- package/tools/backends/managed-foreign-binding.mjs +497 -0
- package/tools/backends/managed-host-legacy.mjs +1181 -0
- package/tools/backends/managed-host-lifecycle.mjs +310 -0
- package/tools/backends/managed-host-object-provider.mjs +155 -0
- package/tools/backends/managed-host-object-realm.mjs +797 -0
- package/tools/backends/managed-host-proxy.mjs +71 -0
- package/tools/backends/managed-host-runtime.mjs +5868 -0
- package/tools/backends/managed-host.mjs +716 -0
- package/tools/backends/managed-module-graph-legacy.mjs +308 -0
- package/tools/backends/managed-module-graph.mjs +694 -0
- package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
- package/tools/backends/managed-runtime.mjs +939 -0
- package/tools/backends/managed-source-view-legacy.mjs +332 -0
- package/tools/backends/managed-source-view.mjs +959 -0
- package/tools/backends/memory-runtime.mjs +100 -0
- package/tools/backends/native-benchmark.mjs +88 -0
- package/tools/backends/native-managed-runtime.mjs +677 -0
- package/tools/backends/native-memory.mjs +768 -0
- package/tools/backends/native-node-memory.mjs +142 -0
- package/tools/backends/native-node-runner.mjs +99 -0
- package/tools/backends/native-node-watchdog.mjs +19 -0
- package/tools/backends/native-node-worker.mjs +75 -0
- package/tools/backends/stage3-targets.mjs +493 -0
- package/tools/bootstrap-command.el +13 -0
- package/tools/bootstrap-runtime.el +101 -0
- package/tools/bootstrap-seed.el +55 -0
- package/tools/project/check-cli.eli +31 -0
- package/tools/project/project-cli.eli +42 -0
- package/tools/project/project.eli +122 -0
- package/tools/runtime/unicode-case-profiles.mjs +13 -0
- package/tools/runtime/unicode-case-runtime.el +57 -0
- package/tools/testing/source-debugging-corpus-host.eli +16 -0
- package/tools/testing/source-debugging.eli +139 -0
- package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
- package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
- package/tools/testing/stdlib-bit.eli +104 -0
- package/tools/testing/stdlib-bit.mjs +255 -0
- package/bin/eliscript-bootstrap +0 -15
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import {createHash} from 'node:crypto';
|
|
2
|
+
import {spawn} from 'node:child_process';
|
|
3
|
+
import {mkdir, mkdtemp, readFile, readdir, writeFile, lstat, symlink, rm} from 'node:fs/promises';
|
|
4
|
+
import {resolve, relative, sep, isAbsolute, dirname, basename} from 'node:path';
|
|
5
|
+
|
|
6
|
+
const digest = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
7
|
+
|
|
8
|
+
function relativePath(value, label) {
|
|
9
|
+
if (typeof value !== 'string' || !value || isAbsolute(value) || /[\\:\u0000]/.test(value) ||
|
|
10
|
+
value.split('/').some(part => !part || part === '.' || part === '..')) {
|
|
11
|
+
throw new TypeError(label + ' must be a relative path inside the reference artifact');
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function localPath(directory, path) {
|
|
17
|
+
const result = relative(directory, path);
|
|
18
|
+
if (!result || isAbsolute(result) || result === '..' || result.startsWith('..' + sep)) {
|
|
19
|
+
throw new TypeError('independent reference must remain in its original case archive');
|
|
20
|
+
}
|
|
21
|
+
return result.split(sep).join('/');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function aborted(signal) {
|
|
25
|
+
if (signal?.aborted) throw signal.reason ?? new Error('independent original reference aborted');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function put(directory, id, bytes) {
|
|
29
|
+
relativePath(id, 'reference file');
|
|
30
|
+
let parent = directory;
|
|
31
|
+
for (const part of id.split('/').slice(0, -1)) {
|
|
32
|
+
parent = resolve(parent, part);
|
|
33
|
+
await mkdir(parent, {recursive: true});
|
|
34
|
+
const info = await lstat(parent);
|
|
35
|
+
if (!info.isDirectory() || info.isSymbolicLink()) throw new TypeError('reference file traverses a directory alias');
|
|
36
|
+
}
|
|
37
|
+
const path = resolve(directory, id);
|
|
38
|
+
await writeFile(path, bytes, {flag: 'wx'});
|
|
39
|
+
return path;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function seedCompile(sourceRoot, input, output, portableEntries, options, signal) {
|
|
43
|
+
aborted(signal);
|
|
44
|
+
const args = ['--source-map', ...portableEntries.flatMap(name => ['--portable', name]), '--output', output, input];
|
|
45
|
+
return new Promise(accept => {
|
|
46
|
+
const stdout = [], stderr = [];
|
|
47
|
+
let failure, child;
|
|
48
|
+
try {
|
|
49
|
+
child = spawn(resolve(sourceRoot, 'bin/eliscript-seed'), args, {
|
|
50
|
+
cwd: sourceRoot, signal, stdio: ['ignore', 'pipe', 'pipe'],
|
|
51
|
+
env: {...process.env, EMACS: options.emacs ?? process.env.EMACS ?? 'emacs'},
|
|
52
|
+
});
|
|
53
|
+
} catch (error) {
|
|
54
|
+
accept({exitCode: null, signal: null, error, stdout: Buffer.alloc(0), stderr: Buffer.alloc(0)});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
child.stdout.on('data', bytes => stdout.push(bytes));
|
|
58
|
+
child.stderr.on('data', bytes => stderr.push(bytes));
|
|
59
|
+
child.once('error', error => {failure = error;});
|
|
60
|
+
child.once('close', (exitCode, terminationSignal) => accept({exitCode, signal: terminationSignal,
|
|
61
|
+
error: failure, stdout: Buffer.concat(stdout), stderr: Buffer.concat(stderr)}));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function seedIdentity(sourceRoot) {
|
|
66
|
+
const files = ['bin/eliscript-seed', ...(await readdir(resolve(sourceRoot, 'compiler')))
|
|
67
|
+
.filter(name => name.endsWith('.el')).sort().map(name => 'compiler/' + name)];
|
|
68
|
+
const records = [];
|
|
69
|
+
for (const file of files) {
|
|
70
|
+
const bytes = await readFile(resolve(sourceRoot, file));
|
|
71
|
+
records.push({file, bytes: bytes.length, sha256: digest(bytes)});
|
|
72
|
+
}
|
|
73
|
+
return {implementation: 'emacs-seed', files: records, sha256: digest(JSON.stringify(records))};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function referenceEnvironment(directory, sourceRoot, modules, providers) {
|
|
77
|
+
const files = [];
|
|
78
|
+
for (const module of modules) {
|
|
79
|
+
// Retain the same .eli ESM transport used by the original host runner. This
|
|
80
|
+
// transports imports only; all compiler implementation bytes came from Seed.
|
|
81
|
+
const alias = module.id.slice(0, -4) + '.eli';
|
|
82
|
+
const specifier = './' + basename(module.id);
|
|
83
|
+
const source = 'export * from ' + JSON.stringify(specifier) + ';\n';
|
|
84
|
+
await put(directory, alias, source);
|
|
85
|
+
files.push({path: alias, role: 'original-eli-import-transport', bytes: Buffer.byteLength(source), sha256: digest(source)});
|
|
86
|
+
}
|
|
87
|
+
for (const provider of providers) {
|
|
88
|
+
await put(directory, provider.id, provider.source);
|
|
89
|
+
files.push({path: provider.id, role: 'original-host-provider', filename: provider.filename,
|
|
90
|
+
bytes: Buffer.byteLength(provider.source), sha256: digest(provider.source)});
|
|
91
|
+
}
|
|
92
|
+
// Runtime imports resolve to the real repository package, exactly as in the
|
|
93
|
+
// original Seed oracle; this is an explicit environment dependency, not a
|
|
94
|
+
// substituted compiler or a copied provider implementation.
|
|
95
|
+
const packageDirectory = resolve(directory, 'node_modules');
|
|
96
|
+
await mkdir(packageDirectory, {recursive: true});
|
|
97
|
+
await symlink(sourceRoot, resolve(packageDirectory, 'eliscript'), 'dir');
|
|
98
|
+
const runtimePath = resolve(directory, 'runtime');
|
|
99
|
+
try {await symlink(resolve(sourceRoot, 'runtime'), runtimePath, 'dir');}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (error.code !== 'EEXIST') throw error;
|
|
102
|
+
// An emitted runtime/ module graph takes precedence over this convenience
|
|
103
|
+
// alias. Do not replace actual emitted modules with repository JavaScript.
|
|
104
|
+
const details = await lstat(runtimePath);
|
|
105
|
+
if (details.isSymbolicLink() || !details.isDirectory()) throw new TypeError('independent reference runtime path conflicts with its source graph');
|
|
106
|
+
}
|
|
107
|
+
return files;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Each call creates fresh Seed output and a distinct import directory. In
|
|
111
|
+
// particular the selected-program invocation and its independent Seed oracle
|
|
112
|
+
// must call this separately; neither a selected session nor an imported module
|
|
113
|
+
// cache can supply the reference implementation.
|
|
114
|
+
export async function prepareOriginalReferenceArtifact(context) {
|
|
115
|
+
if (context.record?.execution?.referenceArtifact !== true) return undefined;
|
|
116
|
+
const {record, signal} = context;
|
|
117
|
+
const sourceRoot = resolve(context.sourceRoot ?? record.sourceRoot);
|
|
118
|
+
if (typeof context.directory !== 'string') throw new TypeError('independent reference requires its original case directory');
|
|
119
|
+
const directory = resolve(context.directory), options = context.options ?? {};
|
|
120
|
+
const modules = record.modules ?? record.request?.modules;
|
|
121
|
+
const entry = relativePath(record.entry ?? record.request?.entry, 'reference entry');
|
|
122
|
+
if (!Array.isArray(modules) || !modules.length) throw new TypeError('independent reference requires the complete original module graph');
|
|
123
|
+
// The original Seed CLI has no capability-context input. Never silently
|
|
124
|
+
// replace capability-bearing module semantics with its default environment.
|
|
125
|
+
if (record.request?.macroContext !== undefined || modules.some(module => module?.macroContext !== undefined) ||
|
|
126
|
+
record.request?.portable === true) {
|
|
127
|
+
throw new TypeError('independent reference Seed CLI cannot transport this explicit macro or implicit portable context');
|
|
128
|
+
}
|
|
129
|
+
const portableEntries = record.request?.portableEntries ?? [];
|
|
130
|
+
if (!Array.isArray(portableEntries) || portableEntries.some(name => typeof name !== 'string' || !name || name.includes('\u0000'))) {
|
|
131
|
+
throw new TypeError('independent reference portable entries must retain explicit function names');
|
|
132
|
+
}
|
|
133
|
+
const ids = new Set(), filenames = new Map(), outputPaths = new Set();
|
|
134
|
+
for (const module of modules) {
|
|
135
|
+
relativePath(module?.id, 'reference module id');
|
|
136
|
+
relativePath(module?.filename, 'reference source filename');
|
|
137
|
+
if (!module.id.endsWith('.mjs') || typeof module.source !== 'string' || ids.has(module.id) ||
|
|
138
|
+
filenames.has(module.filename) && filenames.get(module.filename) !== module.source) {
|
|
139
|
+
throw new TypeError('independent reference requires distinct complete source modules');
|
|
140
|
+
}
|
|
141
|
+
ids.add(module.id); filenames.set(module.filename, module.source);
|
|
142
|
+
for (const path of [module.id, module.id + '.map', module.id.slice(0, -4) + '.eli']) {
|
|
143
|
+
if (outputPaths.has(path)) throw new TypeError('independent reference output paths overlap');
|
|
144
|
+
outputPaths.add(path);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (!ids.has(entry)) throw new TypeError('independent reference entry is outside the original graph');
|
|
148
|
+
const providers = record.request?.hostSources ?? [];
|
|
149
|
+
if (!Array.isArray(providers)) throw new TypeError('independent reference host sources must retain the original provider array');
|
|
150
|
+
for (const provider of providers) {
|
|
151
|
+
relativePath(provider?.id, 'reference provider id');
|
|
152
|
+
relativePath(provider?.filename, 'reference provider filename');
|
|
153
|
+
if (typeof provider.source !== 'string' || outputPaths.has(provider.id)) throw new TypeError('independent reference provider conflicts with emitted modules');
|
|
154
|
+
outputPaths.add(provider.id);
|
|
155
|
+
}
|
|
156
|
+
aborted(signal);
|
|
157
|
+
const compiler = await seedIdentity(sourceRoot);
|
|
158
|
+
await mkdir(directory, {recursive: true});
|
|
159
|
+
const work = await mkdtemp(resolve(directory, 'original-independent-reference-'));
|
|
160
|
+
const instance = basename(work), sourcesDirectory = resolve(work, 'sources'), emitted = resolve(work, 'seed-output');
|
|
161
|
+
const sourceIdentity = modules.map(module => ({id: module.id, filename: module.filename,
|
|
162
|
+
bytes: Buffer.byteLength(module.source), sha256: digest(module.source),
|
|
163
|
+
utf16Sha256: digest(Buffer.from(module.source, 'utf16le'))}));
|
|
164
|
+
const manifestPath = resolve(work, 'reference.json');
|
|
165
|
+
const manifest = {format: 'eliscript-original-independent-reference', version: 1,
|
|
166
|
+
role: 'independent-reference', producer: 'emacs-seed', selectedTarget: context.target,
|
|
167
|
+
entry, compiler, sourceIdentity: {modules: sourceIdentity, sha256: digest(JSON.stringify(sourceIdentity))},
|
|
168
|
+
instance, portableEntries: [...portableEntries], status: 'compiling', verification: 'unverified',
|
|
169
|
+
staging: {ownership: 'reference-preparation', sources: 'sources', emitted: 'seed-output', status: 'pending'},
|
|
170
|
+
modules: [], environmentFiles: [], invocations: []};
|
|
171
|
+
const save = () => writeFile(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
|
|
172
|
+
const clearStaging = async () => {
|
|
173
|
+
// Delete only the two directories created by this invocation. The actual
|
|
174
|
+
// archived product, original logs and source identities belong to the
|
|
175
|
+
// caller's case archive and remain available to its host process.
|
|
176
|
+
let failure;
|
|
177
|
+
for (const path of [sourcesDirectory, emitted]) {
|
|
178
|
+
try {await rm(path, {recursive: true, force: true});} catch (error) {failure ??= error;}
|
|
179
|
+
}
|
|
180
|
+
manifest.staging.status = failure ? 'cleanup-failed' : 'removed';
|
|
181
|
+
if (failure) throw failure;
|
|
182
|
+
};
|
|
183
|
+
await save();
|
|
184
|
+
try {
|
|
185
|
+
await mkdir(sourcesDirectory); await mkdir(emitted);
|
|
186
|
+
manifest.staging.status = 'active';
|
|
187
|
+
// Stage the whole original source graph before the first compiler call.
|
|
188
|
+
for (const [filename, source] of filenames) await put(sourcesDirectory, filename, source);
|
|
189
|
+
const response = {target: 'javascript', entry, modules: []};
|
|
190
|
+
for (const [index, module] of modules.entries()) {
|
|
191
|
+
const input = resolve(sourcesDirectory, module.filename), output = resolve(emitted, module.id);
|
|
192
|
+
await mkdir(dirname(output), {recursive: true});
|
|
193
|
+
const modulePortableEntries = module.id === entry ? portableEntries : [];
|
|
194
|
+
const invocation = await seedCompile(sourceRoot, input, output, modulePortableEntries, options, signal);
|
|
195
|
+
const stdoutPath = 'invocation-' + index + '.stdout.log', stderrPath = 'invocation-' + index + '.stderr.log';
|
|
196
|
+
await put(work, stdoutPath, invocation.stdout); await put(work, stderrPath, invocation.stderr);
|
|
197
|
+
manifest.invocations.push({module: module.id, command: 'bin/eliscript-seed',
|
|
198
|
+
arguments: ['--source-map', ...modulePortableEntries.flatMap(name => ['--portable', name]), '--output', localPath(work, output), localPath(work, input)],
|
|
199
|
+
exitCode: invocation.exitCode, signal: invocation.signal,
|
|
200
|
+
...(invocation.error ? {error: {name: invocation.error.name, message: invocation.error.message}} : {}),
|
|
201
|
+
stdout: {path: stdoutPath, bytes: invocation.stdout.length, sha256: digest(invocation.stdout)},
|
|
202
|
+
stderr: {path: stderrPath, bytes: invocation.stderr.length, sha256: digest(invocation.stderr)}});
|
|
203
|
+
await save();
|
|
204
|
+
if (invocation.error) {invocation.error.moduleId = module.id; throw invocation.error;}
|
|
205
|
+
aborted(signal);
|
|
206
|
+
if (invocation.exitCode !== 0 || invocation.signal !== null) {
|
|
207
|
+
const error = new Error(invocation.stderr.toString('utf8').trim() || 'independent reference Seed exited with ' + invocation.exitCode);
|
|
208
|
+
error.code = 'ELISCRIPT_ORIGINAL_REFERENCE_COMPILE'; error.moduleId = module.id; throw error;
|
|
209
|
+
}
|
|
210
|
+
const javascriptBytes = await readFile(output), mapBytes = await readFile(output + '.map');
|
|
211
|
+
response.modules.push({id: module.id, javascript: javascriptBytes.toString('utf8'), sourceMap: mapBytes.toString('utf8')});
|
|
212
|
+
manifest.modules.push({id: module.id, filename: module.filename,
|
|
213
|
+
javascript: {bytes: javascriptBytes.length, sha256: digest(javascriptBytes)},
|
|
214
|
+
sourceMap: {bytes: mapBytes.length, sha256: digest(mapBytes)}});
|
|
215
|
+
}
|
|
216
|
+
const archive = context.archiveProduct ?? (async (value, name, target) => {
|
|
217
|
+
const {archiveProduct} = await import('./compiler-matrix.mjs');
|
|
218
|
+
return archiveProduct(value, target, resolve(work, 'product'));
|
|
219
|
+
});
|
|
220
|
+
const artifact = await archive(response, instance + '-product', 'javascript');
|
|
221
|
+
if (artifact.target !== 'javascript' || typeof artifact.directory !== 'string' ||
|
|
222
|
+
artifact.directory === context.artifact?.directory || artifact.path === context.artifact?.path ||
|
|
223
|
+
!Array.isArray(artifact.modules) || artifact.modules.length !== modules.length ||
|
|
224
|
+
typeof artifact.identitySha256 !== 'string') throw new Error('independent reference archive must contain its own complete JavaScript implementation');
|
|
225
|
+
const actual = new Map(artifact.modules.map(module => [module.id, module]));
|
|
226
|
+
if (actual.size !== modules.length) throw new Error('independent reference archive repeated a module');
|
|
227
|
+
for (const expected of manifest.modules) {
|
|
228
|
+
const module = actual.get(expected.id);
|
|
229
|
+
if (!module || typeof module.path !== 'string' || typeof module.sourceMapPath !== 'string' ||
|
|
230
|
+
digest(await readFile(module.path)) !== expected.javascript.sha256 ||
|
|
231
|
+
digest(await readFile(module.sourceMapPath)) !== expected.sourceMap.sha256) {
|
|
232
|
+
throw new Error('independent reference archive changed emitted Seed bytes');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
manifest.environmentFiles = await referenceEnvironment(artifact.directory, sourceRoot, modules, providers);
|
|
236
|
+
manifest.environmentDependencies = [{role: 'original-runtime-package', specifier: 'eliscript', implementation: 'original-source-root'}];
|
|
237
|
+
manifest.product = {directory: localPath(directory, artifact.directory), identitySha256: artifact.identitySha256};
|
|
238
|
+
manifest.status = 'prepared';
|
|
239
|
+
// Detect a Seed edit during generation instead of recording mixed compiler
|
|
240
|
+
// implementations under one provenance identity.
|
|
241
|
+
if ((await seedIdentity(sourceRoot)).sha256 !== compiler.sha256) throw new Error('independent Seed compiler changed during reference generation');
|
|
242
|
+
await clearStaging();
|
|
243
|
+
await save();
|
|
244
|
+
const manifestBytes = await readFile(manifestPath);
|
|
245
|
+
return {directory: artifact.directory, manifestPath, supportingProducts: [{
|
|
246
|
+
role: 'original-independent-reference', producer: 'emacs-seed', target: 'javascript',
|
|
247
|
+
selectedTarget: context.target, directory: localPath(directory, artifact.directory),
|
|
248
|
+
identitySha256: artifact.identitySha256, sourceIdentitySha256: manifest.sourceIdentity.sha256,
|
|
249
|
+
manifest: localPath(directory, manifestPath), manifestSha256: digest(manifestBytes),
|
|
250
|
+
verification: 'unverified',
|
|
251
|
+
}]};
|
|
252
|
+
} catch (error) {
|
|
253
|
+
manifest.status = 'failed';
|
|
254
|
+
manifest.failure = {name: error?.name ?? 'Error', message: error?.message ?? String(error),
|
|
255
|
+
...(error?.moduleId ? {module: error.moduleId} : {})};
|
|
256
|
+
try {await clearStaging();} catch (cleanupError) {
|
|
257
|
+
manifest.staging.failure = {name: cleanupError?.name ?? 'Error', message: cleanupError?.message ?? String(cleanupError)};
|
|
258
|
+
if (error && typeof error === 'object') error.referenceCleanupFailure = cleanupError;
|
|
259
|
+
}
|
|
260
|
+
try {await save();} catch (saveError) {if (error && typeof error === 'object') error.referenceArchiveFailure = saveError;}
|
|
261
|
+
throw error;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// Generated by Eliscript. Do not edit.
|
|
2
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
3
|
+
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
4
|
+
const __eliscript_number_intrinsic = globalThis.Number;
|
|
5
|
+
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
6
|
+
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
7
|
+
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
8
|
+
const __eliscript_numeric_error = globalThis.TypeError;
|
|
9
|
+
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
10
|
+
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
11
|
+
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
12
|
+
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
13
|
+
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
14
|
+
const __eliscript_numeric_primitive = (value) => {
|
|
15
|
+
if (!__eliscript_numeric_object(value)) return value;
|
|
16
|
+
const exotic = value[__eliscript_numeric_symbol];
|
|
17
|
+
if (exotic !== void 0 && exotic !== null) {
|
|
18
|
+
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
19
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
20
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
21
|
+
}
|
|
22
|
+
for (let index = 0; index < 2; index++) {
|
|
23
|
+
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
24
|
+
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
25
|
+
const result = __eliscript_numeric_apply(method, value, []);
|
|
26
|
+
if (!__eliscript_numeric_object(result)) return result;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
30
|
+
};
|
|
31
|
+
const __eliscript_to_number = (value) => {
|
|
32
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
33
|
+
if (typeof primitive === "string") {
|
|
34
|
+
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
35
|
+
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
36
|
+
let first = 2;
|
|
37
|
+
while (first < text.length && text[first] === "0") first++;
|
|
38
|
+
if (first === text.length) return 0;
|
|
39
|
+
const prefix = text[1];
|
|
40
|
+
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
41
|
+
if (text.length - first > limit) return 1 / 0;
|
|
42
|
+
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
43
|
+
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return __eliscript_number_intrinsic(primitive);
|
|
47
|
+
};
|
|
48
|
+
const __eliscript_numeric = (value) => {
|
|
49
|
+
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
50
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
51
|
+
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
52
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
53
|
+
};
|
|
54
|
+
const __eliscript_implicit_number = (value) => {
|
|
55
|
+
if (typeof value === "number") return value;
|
|
56
|
+
const primitive = __eliscript_numeric_primitive(value);
|
|
57
|
+
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
58
|
+
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
59
|
+
};
|
|
60
|
+
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
61
|
+
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
62
|
+
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
63
|
+
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
64
|
+
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
65
|
+
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
66
|
+
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
67
|
+
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
68
|
+
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
69
|
+
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
70
|
+
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
71
|
+
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
72
|
+
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
73
|
+
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
74
|
+
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
75
|
+
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
76
|
+
if (typeof left === "number" && typeof right === "number") {
|
|
77
|
+
if (operator === "<") return left < right;
|
|
78
|
+
if (operator === "<=") return left <= right;
|
|
79
|
+
if (operator === ">") return left > right;
|
|
80
|
+
return left >= right;
|
|
81
|
+
}
|
|
82
|
+
let a = __eliscript_numeric_primitive(left);
|
|
83
|
+
let b = __eliscript_numeric_primitive(right);
|
|
84
|
+
const x = typeof a, y = typeof b;
|
|
85
|
+
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
86
|
+
a = __eliscript_numeric(a);
|
|
87
|
+
b = __eliscript_numeric(b);
|
|
88
|
+
}
|
|
89
|
+
if (operator === "<") return a < b;
|
|
90
|
+
if (operator === "<=") return a <= b;
|
|
91
|
+
if (operator === ">") return a > b;
|
|
92
|
+
return a >= b;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
import {readFile, writeFile, readdir, lstat, realpath, rename, symlink, unlink} from "node:fs/promises";
|
|
96
|
+
import {resolve, relative} from "node:path";
|
|
97
|
+
import {createHash} from "node:crypto";
|
|
98
|
+
import * as legacy from "./compiler-corpus-reference-legacy.mjs";
|
|
99
|
+
function optional(value, key) {
|
|
100
|
+
if ((value == null)) {
|
|
101
|
+
return undefined;
|
|
102
|
+
} else {
|
|
103
|
+
return (value)[key];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function runtime_files(directory, prefix) {
|
|
107
|
+
return (await (async (entries, result, index) => {
|
|
108
|
+
(await (async () => {
|
|
109
|
+
while (__eliscript_numeric_relation("<", index, ((entries) ?? []).length)) {
|
|
110
|
+
(await (async (entry) => {
|
|
111
|
+
return (await (async (name) => {
|
|
112
|
+
return (await (async (id) => {
|
|
113
|
+
return (__eliscript_truthy((entry)["isDirectory"]()) ? ((result = (result)["concat"](await (runtime_files(resolve(directory, name), id))))) : (__eliscript_truthy(((__eliscript_value_1) => (__eliscript_truthy(__eliscript_value_1) ? (name)["endsWith"](".mjs") : __eliscript_value_1))((entry)["isFile"]())) ? (result)["push"](id) : null));
|
|
114
|
+
})((prefix + "/" + name)));
|
|
115
|
+
})((entry)["name"]));
|
|
116
|
+
})((entries)[index]));
|
|
117
|
+
((index = (index + 1)));
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
})());
|
|
121
|
+
return result;
|
|
122
|
+
})(await (readdir(directory, ({"withFileTypes": true}))), [], 0));
|
|
123
|
+
}
|
|
124
|
+
async function shared_runtime(context) {
|
|
125
|
+
return (await (async (record) => {
|
|
126
|
+
return (await (async (sources) => {
|
|
127
|
+
return (await (async (artifact) => {
|
|
128
|
+
return (await (async (declared) => {
|
|
129
|
+
return (__eliscript_truthy(((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? Array.isArray(sources) : __eliscript_value_2))(((context)["target"] === "javascript"))) ? (await (async () => {
|
|
130
|
+
(sources)["forEach"](((source) => {
|
|
131
|
+
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; } })((source)["id"]) === "string") && (((__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; } })((source)["source"]) === "string"))) {
|
|
132
|
+
return (declared)["set"]((source)["id"], (source)["source"]);
|
|
133
|
+
} else {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}));
|
|
137
|
+
return (__eliscript_truthy(((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? (declared)["has"]("runtime/core/data-text.mjs") : __eliscript_value_3))((declared)["has"]("runtime/literals.mjs"))) ? (await (async (files) => {
|
|
138
|
+
return (__eliscript_truthy((files)["every"](((id) => {
|
|
139
|
+
return (declared)["has"](id);
|
|
140
|
+
}))) ? (await (async (directory) => {
|
|
141
|
+
return (await (async (index) => {
|
|
142
|
+
return (await (async () => {
|
|
143
|
+
(await (async () => {
|
|
144
|
+
while (__eliscript_numeric_relation("<", index, ((files) ?? []).length)) {
|
|
145
|
+
(await (async (id) => {
|
|
146
|
+
return (await (async (path) => {
|
|
147
|
+
return (await (async (details) => {
|
|
148
|
+
return ((!__eliscript_truthy((await (async (__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? (await (async (__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? (await (readFile(path, "utf8")) === (declared)["get"](id)) : __eliscript_value_5))((!__eliscript_truthy((details)["isSymbolicLink"]())))) : __eliscript_value_4))((details)["isFile"]())))) ? ((__eliscript_value_6) => { throw __eliscript_value_6; })(new (globalThis.Error)("independent reference shared runtime differs from declared source")) : null);
|
|
149
|
+
})(await (lstat(path))));
|
|
150
|
+
})(resolve(directory, id)));
|
|
151
|
+
})((files)[index]));
|
|
152
|
+
((index = (index + 1)));
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
})());
|
|
156
|
+
return ({"directory": directory, "files": files, "declared": declared, "packageSource": await (readFile(resolve(directory, "package.json"), "utf8"))});
|
|
157
|
+
})());
|
|
158
|
+
})(0));
|
|
159
|
+
})((((artifact)["directory"] === undefined) ? resolve((artifact)["path"], "..") : (artifact)["directory"]))) : null);
|
|
160
|
+
})(await (runtime_files(resolve((context)["sourceRoot"], "runtime"), "runtime")))) : null);
|
|
161
|
+
})()) : null);
|
|
162
|
+
})(new (globalThis.Map)()));
|
|
163
|
+
})((context)["artifact"]));
|
|
164
|
+
})(optional((record)["request"], "hostSources")));
|
|
165
|
+
})((context)["record"]));
|
|
166
|
+
}
|
|
167
|
+
async function prepareOriginalReferenceArtifact(context) {
|
|
168
|
+
return (await (async (sharing) => {
|
|
169
|
+
return (await (async (result) => {
|
|
170
|
+
return (await (async () => {
|
|
171
|
+
(__eliscript_truthy(((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? result : __eliscript_value_7))(sharing)) ? (await (async (directory) => {
|
|
172
|
+
return (await (async (selected) => {
|
|
173
|
+
return (await (async (files) => {
|
|
174
|
+
return (await (async (declared) => {
|
|
175
|
+
return (await (async (index) => {
|
|
176
|
+
return (await (async () => {
|
|
177
|
+
(await (async () => {
|
|
178
|
+
while (__eliscript_numeric_relation("<", index, ((files) ?? []).length)) {
|
|
179
|
+
(await (async (id) => {
|
|
180
|
+
return ((!(await (readFile(resolve(directory, id), "utf8")) === (declared)["get"](id))) ? ((__eliscript_value_8) => { throw __eliscript_value_8; })(new (globalThis.Error)("independent reference runtime differs from original declared source")) : null);
|
|
181
|
+
})((files)[index]));
|
|
182
|
+
((index = (index + 1)));
|
|
183
|
+
}
|
|
184
|
+
return null;
|
|
185
|
+
})());
|
|
186
|
+
(await (async (path) => {
|
|
187
|
+
return (await (async (details) => {
|
|
188
|
+
return (await (async () => {
|
|
189
|
+
if ((!__eliscript_truthy(((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? (!__eliscript_truthy((details)["isSymbolicLink"]())) : __eliscript_value_9))((details)["isDirectory"]())))) {
|
|
190
|
+
((__eliscript_value_10) => { throw __eliscript_value_10; })(new (globalThis.Error)("independent reference runtime is not its original declared graph"));
|
|
191
|
+
}
|
|
192
|
+
await (rename(path, resolve(directory, "runtime-original-declared")));
|
|
193
|
+
return await (symlink(await (realpath(resolve(selected, "runtime"))), path, "dir"));
|
|
194
|
+
})());
|
|
195
|
+
})(await (lstat(path))));
|
|
196
|
+
})(resolve(directory, "runtime")));
|
|
197
|
+
(await (async (path) => {
|
|
198
|
+
return (await (async (details) => {
|
|
199
|
+
return (await (async () => {
|
|
200
|
+
if ((!__eliscript_truthy((details)["isSymbolicLink"]()))) {
|
|
201
|
+
((__eliscript_value_11) => { throw __eliscript_value_11; })(new (globalThis.Error)("independent reference package environment conflicts with declared runtime"));
|
|
202
|
+
}
|
|
203
|
+
await (unlink(path));
|
|
204
|
+
return await (symlink(selected, path, "dir"));
|
|
205
|
+
})());
|
|
206
|
+
})(await (lstat(path))));
|
|
207
|
+
})(resolve(directory, "node_modules/eliscript")));
|
|
208
|
+
await (writeFile(resolve(directory, "package.json"), (sharing)["packageSource"], ({"flag": "wx"})));
|
|
209
|
+
return (await (async (path) => {
|
|
210
|
+
return (await (async (manifest) => {
|
|
211
|
+
return (await (async (dependency) => {
|
|
212
|
+
return (await (async () => {
|
|
213
|
+
((manifest)["environmentDependencies"] = [dependency]);
|
|
214
|
+
((manifest)["environmentFiles"] = ((manifest)["environmentFiles"])["concat"]([({"path": "package.json", "role": "original-runtime-package-self-reference", "bytes": (((new (globalThis.TextEncoder)())["encode"]((sharing)["packageSource"])) ?? []).length, "sha256": ((createHash("sha256"))["update"]((sharing)["packageSource"]))["digest"]("hex")})]));
|
|
215
|
+
return (await (async (bytes) => {
|
|
216
|
+
await (writeFile(path, bytes));
|
|
217
|
+
return ((result)["supportingProducts"])["forEach"](((product) => {
|
|
218
|
+
if (((product)["role"] === "original-independent-reference")) {
|
|
219
|
+
return ((product)["manifestSha256"] = ((createHash("sha256"))["update"](bytes))["digest"]("hex"));
|
|
220
|
+
} else {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
}));
|
|
224
|
+
})((JSON.stringify(manifest, null, 2) + "\n")));
|
|
225
|
+
})());
|
|
226
|
+
})(({"role": "original-runtime-package", "specifier": "eliscript", "implementation": "original-declared-runtime-shared-realpath", "directory": relative((context)["directory"], resolve(selected, "runtime"))})));
|
|
227
|
+
})(JSON.parse(await (readFile(path, "utf8")))));
|
|
228
|
+
})((result)["manifestPath"]));
|
|
229
|
+
})());
|
|
230
|
+
})(0));
|
|
231
|
+
})((sharing)["declared"]));
|
|
232
|
+
})((sharing)["files"]));
|
|
233
|
+
})((sharing)["directory"]));
|
|
234
|
+
})((result)["directory"])) : null);
|
|
235
|
+
return result;
|
|
236
|
+
})());
|
|
237
|
+
})(await ((legacy)["prepareOriginalReferenceArtifact"](context))));
|
|
238
|
+
})(((optional(((context)["record"])["execution"], "referenceArtifact") === true) ? await (shared_runtime(context)) : null)));
|
|
239
|
+
}
|
|
240
|
+
export {prepareOriginalReferenceArtifact};
|
|
241
|
+
//# sourceMappingURL=compiler-corpus-reference.mjs.map
|