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,843 @@
|
|
|
1
|
+
import {createHash} from 'node:crypto';
|
|
2
|
+
import {originalSourceCaseLocators} from './compiler-corpus-managed-cases.mjs';
|
|
3
|
+
|
|
4
|
+
// Additional selected-product regions are not necessarily named by the older
|
|
5
|
+
// stable-feature manifest. Bind each actual transported region, rather than
|
|
6
|
+
// borrowing a sibling test's identity or declaring its whole suite covered.
|
|
7
|
+
const runtimeRegionPlans=Object.freeze([
|
|
8
|
+
{file:'tests/persistent-zipper.test.mjs',id:'zipper-indexed-ascent',record:'original-program:persistent-zipper-indexed-ascent',
|
|
9
|
+
title:'deep zipper ascent reads indexed ancestor slots without reducing wide parent vectors',
|
|
10
|
+
begin:' const script = `',end:'\n `;'},
|
|
11
|
+
{file:'tests/literal-runtime.test.mjs',id:'host-only-shape',record:'original-program:literal-runtime-host-only',
|
|
12
|
+
title:'explicit host-only modules do not link the persistent runtime',
|
|
13
|
+
begin:' expect(seed).not.toContain(',end:'\n } finally {'},
|
|
14
|
+
{file:'tests/literal-runtime.test.mjs',id:'portable-codec',record:'original-program:literal-runtime-portable-codec',
|
|
15
|
+
title:'portable closures produce persistent values for the versioned worker codec',
|
|
16
|
+
begin:' const seedModule = await import(seedOutput);',end:'\n await Bun.write('},
|
|
17
|
+
{file:'tests/literal-runtime.test.mjs',id:'incomplete-map-input',record:'original-sequence:literal-runtime-invalid-inputs',
|
|
18
|
+
title:'hash-map rejects incomplete pairs in both compilers',
|
|
19
|
+
begin:' await Bun.write(source, ',end:');\n'},
|
|
20
|
+
{file:'tests/literal-runtime.test.mjs',id:'unbound-portable-input',record:'original-sequence:literal-runtime-invalid-inputs',
|
|
21
|
+
title:'portable closures produce persistent values for the versioned worker codec',
|
|
22
|
+
begin:'await Bun.write(\n invalid,',end:'\n );'},
|
|
23
|
+
{file:'tests/language-equality.test.mjs',id:'identity-source-shape',record:'original-program:language-equality-identity-only',
|
|
24
|
+
title:'language equal uses value semantics across compilers and local hosts',
|
|
25
|
+
begin:' expect(identity).not.toContain(',end:'\n } finally {'},
|
|
26
|
+
{file:'tests/core-set.test.mjs',id:'source-map',record:'original-program:core-set-source-map',
|
|
27
|
+
title:'Eliscript-authored set algebra compiles and agrees across local hosts',
|
|
28
|
+
begin:' const sourceMap = JSON.parse(await readFile(`${setModule}.map`, "utf8"));',end:'\n } finally {'},
|
|
29
|
+
{file:'tests/core-stdlib.test.mjs',id:'complete-protocols',record:'original-program:core-stdlib-complete-protocols',
|
|
30
|
+
title:'Eliscript core modules compile and execute against runtime protocols',
|
|
31
|
+
begin:' const usage = await import(pathToFileURL(usageModule).href);',end:'\n } finally {'},
|
|
32
|
+
...[
|
|
33
|
+
['core','stable protocol and core algorithms build as one project across Bun and Node'],
|
|
34
|
+
['utility','stable portable utility modules build as one project across Bun and Node'],
|
|
35
|
+
['persistent-values','persistent value library builds as one project and executes under Bun and Node'],
|
|
36
|
+
['value-text','identifier metadata and data text build as one project across Bun and Node'],
|
|
37
|
+
['public','public state interop result JSON and numeric modules build across hosts'],
|
|
38
|
+
].map(([id,title])=>({file:'tests/core-stdlib.test.mjs',id:'core-project-'+id,
|
|
39
|
+
record:'original-program:core-project-'+id,title,
|
|
40
|
+
begin:' expect(report).toMatchObject({',end:'\n } finally {'})),
|
|
41
|
+
]);
|
|
42
|
+
export const originalRuntimeSourceSuites=Object.freeze([...new Set(runtimeRegionPlans.map(plan=>plan.file))]);
|
|
43
|
+
|
|
44
|
+
export function originalRuntimeCaseLocators(file,source){
|
|
45
|
+
if(!originalRuntimeSourceSuites.includes(file))throw new TypeError('unregistered original runtime source suite');
|
|
46
|
+
const cases=originalSourceCaseLocators(file,source),locators=[];
|
|
47
|
+
for(const plan of runtimeRegionPlans.filter(item=>item.file===file)){
|
|
48
|
+
const matches=cases.filter(item=>item.originalCase.title===plan.title);
|
|
49
|
+
if(!matches.length)throw new TypeError('original runtime region lost its source case: '+plan.id);
|
|
50
|
+
for(const[index,locator]of matches.entries()){
|
|
51
|
+
const bound=locator.originalCase;
|
|
52
|
+
const start=source.indexOf(plan.begin,bound.span.start);
|
|
53
|
+
const end=start<0?-1:source.indexOf(plan.end,start+plan.begin.length);
|
|
54
|
+
if(start<bound.span.start||end<start||end+plan.end.length>bound.span.end)
|
|
55
|
+
throw new TypeError('original runtime region left its registered case: '+plan.id);
|
|
56
|
+
const contains=source.slice(start,end);
|
|
57
|
+
locators.push({id:'stable-compatibility:source-region:'+file+':'+plan.id+':'+index,
|
|
58
|
+
file,kind:'test',contains,originalCase:structuredClone(bound),
|
|
59
|
+
originalExecution:{record:plan.record,span:{start,end},
|
|
60
|
+
byteStart:Buffer.byteLength(source.slice(0,start)),byteEnd:Buffer.byteLength(source.slice(0,end)),
|
|
61
|
+
sha256:createHash('sha256').update(contains).digest('hex')}});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return locators;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Original host-only runtime checks remain mandatory original gate evidence.
|
|
68
|
+
// They do not represent execution of a compiled WASM or native algorithm.
|
|
69
|
+
const hostRuntimeFiles = new Set([
|
|
70
|
+
'tests/core-order.test.mjs', 'tests/collection-protocol.test.mjs', 'tests/data-text.test.mjs',
|
|
71
|
+
'tests/fixtures/value-hashes.json',
|
|
72
|
+
'tests/identifier.test.mjs', 'tests/metadata.test.mjs',
|
|
73
|
+
'tests/persistent-list.test.mjs', 'tests/persistent-map.test.mjs',
|
|
74
|
+
'tests/persistent-queue.test.mjs', 'tests/persistent-set.test.mjs',
|
|
75
|
+
'tests/persistent-vector.test.mjs', 'tests/protocol.test.mjs',
|
|
76
|
+
'tests/record.test.mjs', 'tests/transducer.test.mjs',
|
|
77
|
+
'tests/transient.test.mjs', 'tests/type.test.mjs',
|
|
78
|
+
'tests/value-semantics.test.mjs',
|
|
79
|
+
...['collection-protocol', 'core-stdlib', 'data-text', 'metadata',
|
|
80
|
+
'persistent-list', 'persistent-map', 'persistent-queue', 'persistent-set',
|
|
81
|
+
'persistent-vector', 'protocol', 'transducer', 'transient', 'value-hash']
|
|
82
|
+
.map(name => 'tests/fixtures/' + name + '-host.mjs'),
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
export function isOriginalRuntimeHostOnly(filename, source) {
|
|
86
|
+
if (!hostRuntimeFiles.has(filename) || typeof source !== 'string') return false;
|
|
87
|
+
if (filename === 'tests/fixtures/value-hashes.json') return true;
|
|
88
|
+
if (!/from\s+["'](?:\.\.\/)+runtime\/[^"']+["']/.test(source)) return false;
|
|
89
|
+
// Refuse this classification if an original host grows a compiler or actual
|
|
90
|
+
// language-product injection path. It must then receive a selected adapter.
|
|
91
|
+
return !/(?:bin\/eliscript|buildBackends|buildProject|checkProject|seedCompilerFixture|compile_ir_string|compile_string|\.eli["'`]|process\.argv|ELISCRIPT_.*(?:MODULE|COMPILER))/.test(source);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const mixedRuntimeBoundaries=new Map([
|
|
95
|
+
['tests/persistent-queue.test.mjs','Eliscript persistent queue API compiles and runs on both hosts'],
|
|
96
|
+
['tests/lazy-sequence.test.mjs','Eliscript lazy sequences agree across compilers and local hosts'],
|
|
97
|
+
['tests/persistent-sorted.test.mjs','Eliscript sorted API agrees across compilers and local hosts'],
|
|
98
|
+
['tests/regex.test.mjs','Eliscript regex APIs agree across compilers and local hosts'],
|
|
99
|
+
['tests/core-text-object.test.mjs','core text/object production artifacts are fixed-point and cross-host'],
|
|
100
|
+
['tests/core-set.test.mjs','Eliscript-authored set algebra compiles and agrees across local hosts'],
|
|
101
|
+
['tests/core-stdlib.test.mjs','Eliscript core modules compile and execute against runtime protocols'],
|
|
102
|
+
]);
|
|
103
|
+
|
|
104
|
+
const mixedRuntimeCaseTitles=new Map([
|
|
105
|
+
['tests/persistent-queue.test.mjs',new Set([
|
|
106
|
+
'persistent queue preserves FIFO order and immutable front operations',
|
|
107
|
+
'persistent queue implements collection value and metadata protocols',
|
|
108
|
+
'persistent queue promotes its rear without traversal or node allocation',
|
|
109
|
+
'persistent queue agrees with a mutable FIFO reference model',
|
|
110
|
+
'persistent queue stays iterative at one million values',
|
|
111
|
+
'persistent queue runtime agrees under Bun and Node',
|
|
112
|
+
])],
|
|
113
|
+
['tests/lazy-sequence.test.mjs',new Set([
|
|
114
|
+
'lazy sequences start on demand and share one realized prefix',
|
|
115
|
+
'lazy sequence failures are cached at one stable realization position',
|
|
116
|
+
'lazy cons defers tails and remains stack safe for recursive streams',
|
|
117
|
+
'transducer sequence pulls only enough input and memoizes output',
|
|
118
|
+
'transducer sequence honors zero input and completion output',
|
|
119
|
+
'transducer sequence closes its input when transformation fails',
|
|
120
|
+
'lazy combinators compose infinite inputs without eager realization',
|
|
121
|
+
'lazy combinator family preserves transducer semantics',
|
|
122
|
+
'lazy combinators validate before consuming their inputs',
|
|
123
|
+
'lazy sequence APIs reject malformed producers and calls',
|
|
124
|
+
])],
|
|
125
|
+
['tests/persistent-sorted.test.mjs',new Set([
|
|
126
|
+
'persistent sorted maps preserve order immutability and comparator identity',
|
|
127
|
+
'persistent sorted sets retain canonical comparator-equivalent values',
|
|
128
|
+
'sorted collections implement collection value metadata and text protocols',
|
|
129
|
+
'hash and sorted collections share exact logical value semantics',
|
|
130
|
+
'sorted range queries honor inclusive bounds and direction',
|
|
131
|
+
'persistent sorted trees agree with a randomized mutable model',
|
|
132
|
+
'persistent sorted trees keep height work and copying logarithmic',
|
|
133
|
+
])],
|
|
134
|
+
['tests/regex.test.mjs',new Set([
|
|
135
|
+
'regex patterns are immutable deterministic values',
|
|
136
|
+
'regex matching preserves captures absence and start offsets',
|
|
137
|
+
'regex sequences are memoized and advance zero-width Unicode matches',
|
|
138
|
+
'regex replacement is global literal and callback driven',
|
|
139
|
+
'regex APIs reject mutable host patterns and malformed calls',
|
|
140
|
+
])],
|
|
141
|
+
['tests/core-set.test.mjs',new Set([
|
|
142
|
+
'set conversion and union accept protocol sources with value semantics',
|
|
143
|
+
'intersection and difference preserve left metadata and immutable inputs',
|
|
144
|
+
'set relations are value-semantic and enforce complete arity',
|
|
145
|
+
'relational projection and selection preserve value semantics and metadata',
|
|
146
|
+
'relational rename and inversion handle swaps and traversal collisions',
|
|
147
|
+
'relational indexing drives natural and mapped joins',
|
|
148
|
+
'relational set operations enforce arity and predicate contracts',
|
|
149
|
+
])],
|
|
150
|
+
['tests/core-stdlib.test.mjs',new Set([
|
|
151
|
+
'sequence algorithms use protocols and Eliscript truthiness',
|
|
152
|
+
'sequence composition partitioning and tree traversal use protocol sources',
|
|
153
|
+
'finite sequence selection is single-pass, bounded, and nullish-safe',
|
|
154
|
+
'replayable sequence heads and tails preserve bounded source semantics',
|
|
155
|
+
'replayable sequence sources compose lazily with bounded reduction',
|
|
156
|
+
'removing and dropping compose with fresh reduction state',
|
|
157
|
+
'data algorithms return persistent value-semantic maps and vectors',
|
|
158
|
+
'associative data algorithms preserve nested and value-semantic behavior',
|
|
159
|
+
'indexBy uses a transient HAMT builder at scale',
|
|
160
|
+
'protocol standard-library algorithms agree under Bun and Node',
|
|
161
|
+
])],
|
|
162
|
+
['tests/core-text-object.test.mjs',new Set([
|
|
163
|
+
'protocol-driven text and object algorithms preserve value boundaries',
|
|
164
|
+
'external protocol values reuse text and keyed algorithms',
|
|
165
|
+
'core object transforms use transient persistent-map construction',
|
|
166
|
+
])],
|
|
167
|
+
]);
|
|
168
|
+
|
|
169
|
+
export function originalRuntimeOnlyCase(filename,source,contains){
|
|
170
|
+
const boundary=mixedRuntimeBoundaries.get(filename);
|
|
171
|
+
if(!boundary||typeof contains!=='string'||contains.length===0||
|
|
172
|
+
!/from\s+["'](?:\.\.\/)+runtime\//.test(source))return null;
|
|
173
|
+
const end=source.indexOf('test('+JSON.stringify(boundary)+',');
|
|
174
|
+
if(end<0)return null;
|
|
175
|
+
const starts=[...source.matchAll(/^test\(/gm)].map(match=>match.index);
|
|
176
|
+
const candidates=[];
|
|
177
|
+
for(let index=0;index<starts.length;index++){
|
|
178
|
+
const start=starts[index],finish=starts[index+1]??source.length;
|
|
179
|
+
if(start===end)continue;
|
|
180
|
+
const code=source.slice(start,finish);
|
|
181
|
+
if(!code.includes(contains))continue;
|
|
182
|
+
const header=/^test\(("(?:[^"\\]|\\.)*")\s*,/.exec(code);
|
|
183
|
+
if(!header||!mixedRuntimeCaseTitles.get(filename)?.has(JSON.parse(header[1])))continue;
|
|
184
|
+
let occurrence=source.indexOf(contains);
|
|
185
|
+
while(occurrence>=0){
|
|
186
|
+
if(occurrence<start||occurrence+contains.length>finish)return null;
|
|
187
|
+
occurrence=source.indexOf(contains,occurrence+1);
|
|
188
|
+
}
|
|
189
|
+
// This classification applies only to a complete pre-existing runtime case,
|
|
190
|
+
// never the mixed file or a compiler setup helper shared by both regions.
|
|
191
|
+
if(/(?:bin\/eliscript|\.eli["'`]|compileFamily|compile_ir_string|compile_string|seedCompilerFixture|buildBackends|buildProject|checkProject|importGeneratedModule|generatedModules)/.test(code))return null;
|
|
192
|
+
candidates.push({start,end:finish});
|
|
193
|
+
}
|
|
194
|
+
return candidates.length===1?candidates[0]:null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const captureModuleOutput = `async function originalModuleOutput(filename) {
|
|
198
|
+
const chunks = [];
|
|
199
|
+
const stream = new Writable({write(chunk, encoding, complete) {chunks.push(Buffer.from(chunk));complete();}});
|
|
200
|
+
const previous = globalThis.console;
|
|
201
|
+
globalThis.console = new Console({stdout:stream,stderr:process.stderr,colorMode:false});
|
|
202
|
+
try {await import(pathToFileURL(filename).href);}
|
|
203
|
+
finally {globalThis.console = previous;stream.end();}
|
|
204
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
205
|
+
}`;
|
|
206
|
+
|
|
207
|
+
function writtenOriginalSource(original,variable,from,region){
|
|
208
|
+
const escaped=variable.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');
|
|
209
|
+
const opening=new RegExp('await Bun[.]write\\(\\s*'+escaped+',\\s*').exec(original.slice(from));
|
|
210
|
+
if(!opening)throw new TypeError('original inline source write changed: '+variable);
|
|
211
|
+
const start=from+opening.index,tail=original.slice(start+opening[0].length);
|
|
212
|
+
const closing=/\n\s*\);/.exec(tail);
|
|
213
|
+
if(!closing)throw new TypeError('original inline source write has no closing boundary');
|
|
214
|
+
const bound=region(original,opening[0],closing[0],start);
|
|
215
|
+
const expression=bound.text.slice(opening[0].length).trim().replace(/,$/,'');
|
|
216
|
+
const tokens=expression.match(/"(?:[^"\\]|\\.)*"/g)??[];
|
|
217
|
+
if(!tokens.length||expression.replace(/"(?:[^"\\]|\\.)*"/g,'').replace(/\s+/g,'')!=='+'.repeat(tokens.length-1))
|
|
218
|
+
throw new TypeError('original inline source is not a frozen string concatenation');
|
|
219
|
+
return{source:tokens.map(value=>JSON.parse(value)).join(''),region:bound};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Compilation setup is performed by the selected compiler session. This host
|
|
223
|
+
// retains every original output, own-property, callback and physical-map check.
|
|
224
|
+
export async function addOriginalStdlibRuntimeAdapters({add, records, locators, text, file, region, data,bootstrapSources}) {
|
|
225
|
+
const publish=add,byLocator=new Map(locators.map(locator=>[locator.id,locator]));
|
|
226
|
+
add=record=>{
|
|
227
|
+
record.coverage=record.coverage.filter(id=>{
|
|
228
|
+
const execution=byLocator.get(id)?.originalExecution;
|
|
229
|
+
return !execution||execution.record===record.id;
|
|
230
|
+
});
|
|
231
|
+
for(const locator of locators)if(locator.originalExecution?.record===record.id&&!record.coverage.includes(locator.id))
|
|
232
|
+
throw new TypeError('original runtime record omitted its exact executed region: '+record.id);
|
|
233
|
+
if(!record.coverage.length)throw new TypeError('original runtime record has no executed source coverage: '+record.id);
|
|
234
|
+
publish(record);
|
|
235
|
+
};
|
|
236
|
+
const plans = [
|
|
237
|
+
{name:'sequence',library:'sequence',assertion:'portable sequence library compiles and executes as an ESM module'},
|
|
238
|
+
{name:'object',library:'object',assertion:'portable object and data libraries preserve immutable own-property semantics'},
|
|
239
|
+
{name:'text',library:'text',assertion:'portable text library compiles and executes as an ESM module'},
|
|
240
|
+
];
|
|
241
|
+
const mapped = [];
|
|
242
|
+
for (const plan of plans) {
|
|
243
|
+
const suite = 'tests/stdlib-' + plan.name + '.test.mjs';
|
|
244
|
+
if (!locators.some(item => item.file === suite)) continue;
|
|
245
|
+
const original = await text(suite);
|
|
246
|
+
const body = region(original, ' expect(JSON.parse(executed)).toEqual(', '\n } finally {');
|
|
247
|
+
const coverage = locators.filter(item => item.file === suite && typeof item.contains === 'string' &&
|
|
248
|
+
(plan.assertion + '\n' + body.text).includes(item.contains)).map(item => item.id);
|
|
249
|
+
if (!coverage.length) throw new TypeError('original stdlib host has no bound assertion locator: ' + suite);
|
|
250
|
+
const source = 'tests/fixtures/' + plan.name + '-usage.eli';
|
|
251
|
+
const originalPlan = records.find(record => record.id === 'stable-compatibility:program:' + source);
|
|
252
|
+
if (!originalPlan) throw new Error('original stdlib program graph is unavailable: ' + source);
|
|
253
|
+
const hostSource = [
|
|
254
|
+
'import {expect} from "bun:test";',
|
|
255
|
+
'import {resolve} from "node:path";',
|
|
256
|
+
'import {pathToFileURL} from "node:url";',
|
|
257
|
+
'import {Console} from "node:console";',
|
|
258
|
+
'import {Writable} from "node:stream";',
|
|
259
|
+
'const directory=resolve(process.argv[2],"tests/fixtures");',
|
|
260
|
+
'const usageModule=resolve(directory,' + JSON.stringify(plan.name + '-usage.mjs') + ');',
|
|
261
|
+
'const ' + plan.library + 'Module=resolve(directory,' + JSON.stringify(plan.library + '.mjs') + ');',
|
|
262
|
+
...(plan.name === 'object' ? ['const dataModule=resolve(directory,"data.mjs");'] : []),
|
|
263
|
+
captureModuleOutput,
|
|
264
|
+
'const executed=await originalModuleOutput(usageModule);',
|
|
265
|
+
body.text,
|
|
266
|
+
'',
|
|
267
|
+
].join('\n');
|
|
268
|
+
add({id:'original-program:stdlib-' + plan.name + '-complete-host',kind:'project',coverage,
|
|
269
|
+
modules:structuredClone(originalPlan.modules),entry:originalPlan.entry,
|
|
270
|
+
request:{...structuredClone(originalPlan.request),phased:true},
|
|
271
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_stdlib_' + plan.name + '.mjs',
|
|
272
|
+
hostSource,arguments:[{directory:true}],aliases:true,requiresBun:true,compilerSourceMaps:true},
|
|
273
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
274
|
+
original:{manifest:'stable-compatibility',suite,fixture:source,host:suite,
|
|
275
|
+
sourceSha256:(await file(suite)).sha256,
|
|
276
|
+
regions:[body].map(({start,end,byteStart,byteEnd,sha256}) => ({start,end,byteStart,byteEnd,sha256})),
|
|
277
|
+
originalAssertion:plan.assertion,
|
|
278
|
+
setupAssertions:'original compiler CLI silence and project transport remain required by the original gate'},
|
|
279
|
+
});
|
|
280
|
+
mapped.push(suite);
|
|
281
|
+
}
|
|
282
|
+
for (const plan of [
|
|
283
|
+
{name:'function',assertions:[
|
|
284
|
+
'portable function combinators compile and agree across local hosts',
|
|
285
|
+
'predicate combinators preserve Lisp truth and short-circuit order',
|
|
286
|
+
],directBodies:2},
|
|
287
|
+
{name:'deferred',assertions:[
|
|
288
|
+
'deferred computations compile and agree across local hosts',
|
|
289
|
+
'delay and memoize retry failures without caching partial state',
|
|
290
|
+
],directBodies:1},
|
|
291
|
+
]) {
|
|
292
|
+
const suite='tests/stdlib-'+plan.name+'.test.mjs';
|
|
293
|
+
if(!locators.some(item=>item.file===suite))continue;
|
|
294
|
+
const original=await text(suite),source='tests/fixtures/'+plan.name+'-usage.eli';
|
|
295
|
+
const originalPlan=records.find(record=>record.id==='stable-compatibility:program:'+source);
|
|
296
|
+
if(!originalPlan)throw new Error('original stdlib program graph is unavailable: '+source);
|
|
297
|
+
const expectedRegion=region(original,' const expected = {',';\n for (const host');
|
|
298
|
+
const expected=data(expectedRegion.text.slice(' const expected = '.length));
|
|
299
|
+
const bodies=[];let offset=0;
|
|
300
|
+
for(let index=0;index<plan.directBodies;index++){
|
|
301
|
+
const body=region(original,' const module = await import(', '\n } finally {',offset);
|
|
302
|
+
bodies.push(body);offset=body.end;
|
|
303
|
+
}
|
|
304
|
+
const allCode=plan.assertions.join('\n')+'\n'+expectedRegion.text+'\n'+bodies.map(body=>body.text).join('\n');
|
|
305
|
+
const coverage=locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&allCode.includes(item.contains)).map(item=>item.id);
|
|
306
|
+
if(!coverage.length)throw new TypeError('original stdlib host has no bound assertion locator: '+suite);
|
|
307
|
+
const origin={manifest:'stable-compatibility',suite,fixture:source,host:suite,sourceSha256:(await file(suite)).sha256,
|
|
308
|
+
regions:[expectedRegion,...bodies].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256})),
|
|
309
|
+
setupAssertions:'original project build-report and compiler CLI setup remain required by the original gate'};
|
|
310
|
+
for(const hostRuntime of ['bun','node'])add({
|
|
311
|
+
id:'original-program:stdlib-'+plan.name+'-output-'+hostRuntime,kind:'project',coverage,
|
|
312
|
+
modules:structuredClone(originalPlan.modules),entry:originalPlan.entry,request:{...structuredClone(originalPlan.request),phased:true},
|
|
313
|
+
execution:{kind:'original-program',host:null,hostRuntime,aliases:true,requiresBun:hostRuntime==='bun'},
|
|
314
|
+
expected:{kind:'seed-program',oracleRequired:true,stdoutJSON:structuredClone(expected)},original:structuredClone(origin),
|
|
315
|
+
});
|
|
316
|
+
add({id:'original-program:stdlib-'+plan.name+'-complete-callables',kind:'project',coverage,
|
|
317
|
+
modules:structuredClone(originalPlan.modules),entry:originalPlan.entry,
|
|
318
|
+
request:{...structuredClone(originalPlan.request),phased:true},
|
|
319
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_stdlib_'+plan.name+'_callables.mjs',
|
|
320
|
+
hostSource:[
|
|
321
|
+
'import {expect} from "bun:test";',
|
|
322
|
+
'import {resolve} from "node:path";',
|
|
323
|
+
'import {pathToFileURL} from "node:url";',
|
|
324
|
+
'const outputRoot=resolve(process.argv[2],"tests/fixtures/stdlib");',
|
|
325
|
+
...bodies.map(body=>'{\n'+body.text+'\n}'),'',
|
|
326
|
+
].join('\n'),arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun'},
|
|
327
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},original:structuredClone(origin),
|
|
328
|
+
});
|
|
329
|
+
mapped.push(suite);
|
|
330
|
+
}
|
|
331
|
+
for(const plan of [
|
|
332
|
+
{name:'value',suite:'portable-value-semantics',helperStart:'function nextRandom(state)',multiModules:true,tests:[
|
|
333
|
+
'portable persistent collections preserve nested undefined values',
|
|
334
|
+
'optimized and portable persistent Lists share frozen hash semantics',
|
|
335
|
+
'Eliscript-authored value semantics preserve generated cross-family invariants',
|
|
336
|
+
'Eliscript-authored value hashing traverses one million persistent values',
|
|
337
|
+
]},
|
|
338
|
+
{name:'persistent-list',helperStart:'function nextRandom(state)',tests:[
|
|
339
|
+
'Eliscript-authored persistent list preserves generated history',
|
|
340
|
+
'Eliscript-authored persistent list shares a million-node suffix',
|
|
341
|
+
]},
|
|
342
|
+
{name:'persistent-vector',helperStart:'function nodeCount(node, level)',vector:true,tests:[
|
|
343
|
+
'Eliscript-authored persistent vector preserves generated history',
|
|
344
|
+
'Eliscript-authored persistent vector keeps million-value trie bounds',
|
|
345
|
+
]},
|
|
346
|
+
{name:'persistent-map',helperStart:'function integerHash(value)',tests:[
|
|
347
|
+
'Eliscript-authored HAMT Map preserves generated value-key histories',
|
|
348
|
+
'Eliscript-authored HAMT Map promotes and demotes measured layouts',
|
|
349
|
+
'Eliscript-authored HAMT Map shares the million-key update path',
|
|
350
|
+
]},
|
|
351
|
+
{name:'persistent-set',helperStart:'function integerHash(value)',tests:[
|
|
352
|
+
'Eliscript-authored persistent Set preserves generated value-key histories',
|
|
353
|
+
'Eliscript-authored persistent Set preserves algebra and HAMT layouts',
|
|
354
|
+
'Eliscript-authored persistent Set shares the million-member update path',
|
|
355
|
+
]},
|
|
356
|
+
]){
|
|
357
|
+
const suite='tests/'+(plan.suite??'portable-'+plan.name)+'.test.mjs';
|
|
358
|
+
if(!locators.some(item=>item.file===suite))continue;
|
|
359
|
+
const original=await text(suite),helpers=region(original,plan.helperStart,'\ntest(');
|
|
360
|
+
const originalPlan=records.find(record=>record.id==='stable-compatibility:program:stdlib/'+plan.name+'.eli');
|
|
361
|
+
if(!originalPlan)throw new Error('original portable collection graph is unavailable: '+plan.name);
|
|
362
|
+
for(const assertion of plan.tests){
|
|
363
|
+
const prefix='test('+JSON.stringify(assertion)+', async () => {\n';
|
|
364
|
+
const body=region(original,prefix,'\n}, '),suffix=original.slice(body.end);
|
|
365
|
+
const deadline=/^\n}, ([0-9_]+)\);/.exec(suffix);
|
|
366
|
+
if(!deadline)throw new TypeError('original portable collection deadline changed: '+assertion);
|
|
367
|
+
const timeoutMs=Number(deadline[1].replaceAll('_',''));
|
|
368
|
+
let code=body.text.slice(prefix.length);const regions=[helpers,body];
|
|
369
|
+
if(plan.vector){
|
|
370
|
+
const modulePath=region(code,' const modulePath = resolve(','\n const vectorModule = await import(');
|
|
371
|
+
code=code.slice(0,modulePath.start)+' const modulePath=selectedModulePath;'+code.slice(modulePath.end);
|
|
372
|
+
// The complete original body remains bound even though its module
|
|
373
|
+
// location is transported from the actual selected product.
|
|
374
|
+
}
|
|
375
|
+
const coverage=locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
376
|
+
(assertion+'\n'+helpers.text+'\n'+body.text).includes(item.contains)).map(item=>item.id);
|
|
377
|
+
if(!coverage.length)throw new TypeError('original collection case has no bound assertion locator: '+assertion);
|
|
378
|
+
add({id:'original-program:portable-'+plan.name+'-'+plan.tests.indexOf(assertion),kind:'project',coverage,
|
|
379
|
+
modules:structuredClone(originalPlan.modules),entry:originalPlan.entry,
|
|
380
|
+
request:{...structuredClone(originalPlan.request),phased:true},
|
|
381
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_'+plan.name+'_'+plan.tests.indexOf(assertion)+'.mjs',
|
|
382
|
+
hostSource:[
|
|
383
|
+
'import {expect} from "bun:test";',
|
|
384
|
+
'import {resolve} from "node:path";',
|
|
385
|
+
'import {pathToFileURL} from "node:url";',
|
|
386
|
+
'const selectedModulePath=resolve(process.argv[2],'+JSON.stringify(originalPlan.entry)+');',
|
|
387
|
+
'async function importGeneratedModule(label){return import(pathToFileURL(selectedModulePath).href+"?original="+encodeURIComponent(label));}',
|
|
388
|
+
...(plan.multiModules?[
|
|
389
|
+
'const runtimeRoot=process.env.ELISCRIPT_ORIGINAL_SOURCE_ROOT;',
|
|
390
|
+
'const {persistentList:runtimePersistentList}=await import(pathToFileURL(resolve(runtimeRoot,"runtime/core/list.mjs")).href);',
|
|
391
|
+
'const {hashValue:runtimeHashValue}=await import(pathToFileURL(resolve(runtimeRoot,"runtime/core/value.mjs")).href);',
|
|
392
|
+
'async function generatedModules(label){const result={};for(const name of ["bit","persistent-list","persistent-vector","persistent-map","persistent-set","value"]){result[name]=await import(pathToFileURL(resolve(process.argv[2],name+".mjs")).href+"?original="+encodeURIComponent(label));}return result;}',
|
|
393
|
+
]:[]),
|
|
394
|
+
helpers.text,code,'',
|
|
395
|
+
].join('\n'),arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',timeoutMs},
|
|
396
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
397
|
+
original:{manifest:'stable-compatibility',suite,fixture:'stdlib/'+plan.name+'.eli',host:suite,
|
|
398
|
+
sourceSha256:(await file(suite)).sha256,originalAssertion:assertion,
|
|
399
|
+
regions:regions.map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
for(const plan of [
|
|
404
|
+
{name:'persistent-list',suite:'portable-persistent-list',assertion:'Eliscript-authored persistent list compiles and agrees across hosts',begin:' for (const report of reports) {'},
|
|
405
|
+
{name:'persistent-vector',suite:'portable-persistent-vector',assertion:'Eliscript-authored persistent vector compiles and agrees across hosts',begin:' for (const report of hostReports) {'},
|
|
406
|
+
{name:'persistent-map',suite:'portable-persistent-map',assertion:'Eliscript-authored HAMT Map compiles and agrees across hosts'},
|
|
407
|
+
{name:'persistent-set',suite:'portable-persistent-set',assertion:'Eliscript-authored persistent Set compiles and agrees across hosts'},
|
|
408
|
+
{name:'numeric',suite:'portable-numeric',assertion:'portable numeric functions preserve exact Number and safe-integer contracts'},
|
|
409
|
+
{name:'json',suite:'portable-json',assertion:'portable JSON values are strict, canonical, bounded, and self-hosted'},
|
|
410
|
+
{name:'result',suite:'portable-result',assertion:'portable Result values are byte-identical and short-circuit at scale'},
|
|
411
|
+
{name:'metadata',suite:'portable-metadata',assertion:'Eliscript-authored metadata is byte-identical and portable'},
|
|
412
|
+
{name:'data-text',suite:'portable-data-text',assertion:'portable canonical data text is byte-identical and host-independent'},
|
|
413
|
+
{name:'value',suite:'portable-value-semantics',assertion:'Eliscript-authored value semantics compile and agree across hosts'},
|
|
414
|
+
{name:'persistent-queue',suite:'persistent-queue',assertion:'Eliscript persistent queue API compiles and runs on both hosts',begin:' expect(reports[1]).toEqual(reports[0]);',maps:false},
|
|
415
|
+
{name:'lazy-sequence',suite:'lazy-sequence',source:'tests/fixtures/lazy-sequence.eli',assertion:'Eliscript lazy sequences agree across compilers and local hosts',maps:false},
|
|
416
|
+
{name:'persistent-sorted',suite:'persistent-sorted',source:'tests/fixtures/persistent-sorted.eli',assertion:'Eliscript sorted API agrees across compilers and local hosts',maps:false},
|
|
417
|
+
{name:'regex',suite:'regex',source:'tests/fixtures/regex.eli',assertion:'Eliscript regex APIs agree across compilers and local hosts',maps:false},
|
|
418
|
+
{name:'persistent-tree-walk',suite:'persistent-tree-walk',source:'tests/fixtures/persistent-tree-walk.eli',assertion:'persistent tree walk is stack safe and agrees across compilers and hosts',maps:false},
|
|
419
|
+
{name:'persistent-zipper',suite:'persistent-zipper',source:'tests/fixtures/persistent-zipper.eli',assertion:'persistent zippers navigate edit and rebuild stack-safe trees',maps:false},
|
|
420
|
+
{name:'core-text-object',suite:'core-text-object',source:'stdlib/core/text.eli',assertion:'core text/object production artifacts are fixed-point and cross-host',maps:false},
|
|
421
|
+
{name:'interop-js',suite:'interop-js',source:'stdlib/interop/js.eli',mapRoot:'stdlib',assertion:'Eliscript JS interop preserves explicit host and persistent boundaries'},
|
|
422
|
+
{name:'declarative-protocol',suite:'declarative-protocol',source:'tests/fixtures/declarative-protocol.eli',assertion:'declarative protocols preserve protocol identity and host dispatch'},
|
|
423
|
+
{name:'declarative-record',suite:'declarative-record',source:'tests/fixtures/declarative-record.eli',assertion:'defrecord is identical across seed and self-hosted compilers',maps:false},
|
|
424
|
+
{name:'declarative-type',suite:'declarative-type',source:'tests/fixtures/declarative-type.eli',assertion:'deftype and reify agree across compilers and hosts',maps:false},
|
|
425
|
+
{name:'multimethod',suite:'multimethod',assertion:'Eliscript multimethods dispatch on values with persistent method snapshots'},
|
|
426
|
+
{name:'core-expression-forms',suite:'core-expression-forms',source:'tests/fixtures/core-expression-forms.eli',assertion:'core expression forms preserve threading and single-evaluation semantics',maps:false},
|
|
427
|
+
{name:'local-recursive-functions',suite:'local-recursive-functions',source:'tests/fixtures/local-recursive-functions.eli',assertion:'local recursive functions agree across compilers and local hosts',maps:false},
|
|
428
|
+
{name:'multi-arity',suite:'multi-arity',source:'tests/fixtures/multi-arity.eli',assertion:'multi-arity functions agree across compilers and local hosts',maps:false},
|
|
429
|
+
{name:'value-dispatch',suite:'value-dispatch',source:'tests/fixtures/value-dispatch.eli',assertion:'case and condp agree across compilers and local hosts',maps:false},
|
|
430
|
+
{name:'literal-runtime',suite:'literal-runtime',source:'tests/fixtures/literal-runtime.eli',assertion:'persistent literals and quoted data preserve language value categories',begin:' expect(nodeReport).toEqual(bunReport);'},
|
|
431
|
+
{name:'atom',suite:'atom',source:'stdlib/state/atom.eli',assertion:'Eliscript Atom preserves ordered single-transition state semantics'},
|
|
432
|
+
{name:'eliscript-protocol',suite:'eliscript-protocol',source:'stdlib/core/protocol.eli',assertion:'Eliscript-authored protocol policy preserves open dispatch semantics'},
|
|
433
|
+
...['vector','map','set'].map(collection=>({name:'persistent-core-exit-'+collection,suite:'persistent-core-exit',source:'stdlib/value.eli',baseId:'persistent-core-exit-'+collection,idSuffix:collection,locals:'const collection='+JSON.stringify(collection)+';',assertion:'persistent collection core closes its all-host million-value exit gate',begin:' expect(reports[1]).toEqual(reports[0]);',end:'\n }\n } finally {',maps:false})),
|
|
434
|
+
{name:'language-equality',suite:'language-equality',source:'tests/fixtures/language-equality.eli',assertion:'language equal uses value semantics across compilers and local hosts',begin:' const expected = {',end:' const identitySource ='},
|
|
435
|
+
]){
|
|
436
|
+
const suite='tests/'+plan.suite+'.test.mjs';
|
|
437
|
+
if(!locators.some(item=>item.file===suite))continue;
|
|
438
|
+
const original=await text(suite),testStart=original.indexOf('test('+JSON.stringify(plan.assertion)+',');
|
|
439
|
+
if(testStart<0)throw new TypeError('original portable host assertion changed: '+suite);
|
|
440
|
+
const body=region(original,plan.begin??' for (const report of reports) expect(report).toEqual(reports[0]);',plan.end??'\n } finally {',testStart);
|
|
441
|
+
const firstEnd=original.slice(body.end),deadline=/^[\s\S]*?\n}, ([0-9_]+)\);/.exec(firstEnd);
|
|
442
|
+
if(!deadline)throw new TypeError('original portable host deadline changed: '+suite);
|
|
443
|
+
const source=plan.source??'stdlib/'+plan.name+'.eli';
|
|
444
|
+
const originalPlan=records.find(record=>record.id==='stable-compatibility:program:'+(plan.baseId??source));
|
|
445
|
+
if(!originalPlan?.execution.host||typeof originalPlan.execution.hostSource!=='string')throw new Error('original portable host graph is unavailable: '+plan.name);
|
|
446
|
+
const fixture=originalPlan.execution.host;
|
|
447
|
+
let assertionCode=body.text;
|
|
448
|
+
let assertionPrefix='';
|
|
449
|
+
const transportRegions=[];
|
|
450
|
+
if(plan.name==='literal-runtime'){
|
|
451
|
+
const shape=region(original,' const javascript =',' const bunReport =',testStart);
|
|
452
|
+
assertionPrefix=shape.text.replace('readFile(seedOutput, "utf8")',
|
|
453
|
+
'readFile(resolve(javascriptProductRoot,'+JSON.stringify(originalPlan.entry)+'), "utf8")');
|
|
454
|
+
transportRegions.push(shape);
|
|
455
|
+
}
|
|
456
|
+
if(plan.name==='language-equality'){
|
|
457
|
+
const shape=region(original,' expect(seed.match(', '\n const expected =',testStart);
|
|
458
|
+
assertionPrefix='{const seed=await readFile(resolve(javascriptProductRoot,'+JSON.stringify(originalPlan.entry)+'),"utf8");\n'+shape.text+'\n}';
|
|
459
|
+
transportRegions.push(shape);
|
|
460
|
+
}
|
|
461
|
+
if(plan.name==='eliscript-protocol')assertionCode=assertionCode.replace('`${seed}.map`','`${seedModule}.map`');
|
|
462
|
+
if(plan.name==='multimethod')assertionCode=assertionCode
|
|
463
|
+
.replace('"multimethod.eli.map"','"multimethod.mjs.map"')
|
|
464
|
+
.replace('"hierarchy.eli.map"','"hierarchy.mjs.map"');
|
|
465
|
+
if(['numeric','json','result'].includes(plan.name)){
|
|
466
|
+
const compileStart=assertionCode.indexOf(' await runSuccessful([\n projectBuilder,');
|
|
467
|
+
const prunedStart=assertionCode.indexOf(' const pruned =',compileStart);
|
|
468
|
+
const mapStart=assertionCode.indexOf(' const sourceMap =',prunedStart);
|
|
469
|
+
if(compileStart<0||prunedStart<0||mapStart<0)throw new TypeError('original portable pruning boundaries changed: '+suite);
|
|
470
|
+
const pruning=region(original,' const pruned =',' const sourceMap =',body.start+compileStart);
|
|
471
|
+
const portableEntry={numeric:'gcd',json:'parse-json',result:'unwrap-or'}[plan.name];
|
|
472
|
+
const pruningCoverage=locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
473
|
+
(plan.assertion+'\n'+pruning.text).includes(item.contains)).map(item=>item.id);
|
|
474
|
+
add({id:'original-program:'+plan.suite+'-pruned',kind:'project',coverage:pruningCoverage,
|
|
475
|
+
modules:structuredClone(originalPlan.modules),entry:originalPlan.entry,
|
|
476
|
+
request:{...structuredClone(originalPlan.request),phased:true,portableEntries:[portableEntry]},
|
|
477
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_'+plan.suite+'_pruned.mjs',
|
|
478
|
+
hostSource:[
|
|
479
|
+
'import {expect} from "bun:test";',
|
|
480
|
+
'import {resolve} from "node:path";',
|
|
481
|
+
'const prunedDirectory=process.env.ELISCRIPT_ORIGINAL_JAVASCRIPT_PRODUCT_ROOT;',
|
|
482
|
+
'if(!prunedDirectory)throw new Error("original pruning assertions require the actual selected compiler JavaScript artifact");',
|
|
483
|
+
pruning.text,'',
|
|
484
|
+
].join('\n'),arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',
|
|
485
|
+
compilerSourceMaps:true,timeoutMs:Number(deadline[1].replaceAll('_',''))},
|
|
486
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
487
|
+
original:{manifest:'stable-compatibility',suite,fixture:source,host:suite,
|
|
488
|
+
sourceSha256:(await file(suite)).sha256,originalAssertion:plan.assertion,
|
|
489
|
+
regions:[pruning].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
490
|
+
});
|
|
491
|
+
assertionCode=assertionCode.slice(0,compileStart)+assertionCode.slice(mapStart);
|
|
492
|
+
if(plan.name==='json')assertionCode=assertionCode.replace(
|
|
493
|
+
'resolve(seedDirectory, "json.mjs")','resolve(javascriptProductRoot, "json.mjs")');
|
|
494
|
+
}
|
|
495
|
+
const runtimeImports=[...original.matchAll(/^import\s+[^;]+;/gm)]
|
|
496
|
+
.map(match=>match[0]).filter(code=>/from\s+["']\.\.\/runtime\//.test(code));
|
|
497
|
+
const coverage=locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
498
|
+
(plan.assertion+'\n'+body.text).includes(item.contains)).map(item=>item.id);
|
|
499
|
+
if(!coverage.length)throw new TypeError('original portable host has no bound assertion locator: '+suite);
|
|
500
|
+
const originalArguments=originalPlan.execution.arguments??(originalPlan.execution.argumentModules??[originalPlan.entry]).map(module=>({module}));
|
|
501
|
+
const hostSource=[
|
|
502
|
+
'import {expect} from "bun:test";',
|
|
503
|
+
'import {resolve,dirname} from "node:path";',
|
|
504
|
+
'import {readFile} from "node:fs/promises";',
|
|
505
|
+
'const root=process.env.ELISCRIPT_ORIGINAL_SOURCE_ROOT;',
|
|
506
|
+
...runtimeImports,
|
|
507
|
+
'if(!root)throw new Error("original portable host requires its source root");',
|
|
508
|
+
'const product=process.argv[2];',
|
|
509
|
+
'const fixture=resolve(product,'+JSON.stringify(fixture)+');',
|
|
510
|
+
'const moduleArguments='+JSON.stringify(originalArguments)+'.map(item=>item.directory===true?product:Object.hasOwn(item,"literal")?item.literal:resolve(product,item.module));',
|
|
511
|
+
...(plan.locals?[plan.locals]:[]),
|
|
512
|
+
'const seedModule=resolve(product,'+JSON.stringify(originalPlan.entry)+');',
|
|
513
|
+
'const seed=seedModule,seedSet=seedModule,seedDirectory=resolve(product,'+JSON.stringify(plan.mapRoot??'.')+');',
|
|
514
|
+
'const javascriptProductRoot=process.env.ELISCRIPT_ORIGINAL_JAVASCRIPT_PRODUCT_ROOT;',
|
|
515
|
+
'const originalChildren=new Set();',
|
|
516
|
+
'for(const signal of ["SIGINT","SIGTERM"])process.once(signal,()=>{for(const child of originalChildren)child.kill(signal);process.exitCode=signal==="SIGINT"?130:143;});',
|
|
517
|
+
'async function originalReport(host){',
|
|
518
|
+
' const bun=host==="bun",args=bun?["--preload",resolve(root,"tests/fixtures/compiled-eli-bun-preload.mjs")]:["--experimental-loader",resolve(root,"tests/fixtures/compiled-eli-node-loader.mjs")];',
|
|
519
|
+
' if(bun&&process.env.ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT)args.push("--preload",resolve(root,"tools/backends/compiler-corpus-host-context.mjs"));',
|
|
520
|
+
' args.push(fixture,...moduleArguments);',
|
|
521
|
+
' const child=Bun.spawn([bun?"bun":process.env.NODE??"node",...args],{cwd:root,env:process.env,stdout:"pipe",stderr:"pipe"});',
|
|
522
|
+
' originalChildren.add(child);',
|
|
523
|
+
' const [status,stdout,stderr]=await Promise.all([child.exited,new Response(child.stdout).text(),new Response(child.stderr).text()]).finally(()=>originalChildren.delete(child));',
|
|
524
|
+
' if(status!==0)throw new Error(stderr.trim()||stdout.trim()||"original portable host exited with "+status);',
|
|
525
|
+
' return JSON.parse(stdout);',
|
|
526
|
+
'}',
|
|
527
|
+
'const reports=[await originalReport("bun"),await originalReport("node")],hostReports=reports;',
|
|
528
|
+
'const bunReport=reports[0],nodeReport=reports[1];',
|
|
529
|
+
'const BUN="bun",NODE="node",seedOutput=seedModule,selfOutput=seedModule;',
|
|
530
|
+
'async function execute(host){return reports[host==="bun"?0:1];}',
|
|
531
|
+
assertionPrefix,assertionCode,
|
|
532
|
+
'console.log(JSON.stringify(reports));','',
|
|
533
|
+
].join('\n');
|
|
534
|
+
add({id:'original-program:'+plan.suite+'-complete-hosts'+(plan.idSuffix?'-'+plan.idSuffix:''),kind:'project',coverage,
|
|
535
|
+
modules:structuredClone(originalPlan.modules),entry:originalPlan.entry,
|
|
536
|
+
request:{...structuredClone(originalPlan.request),phased:true,
|
|
537
|
+
hostSources:[...(originalPlan.request.hostSources??[]),{id:fixture,filename:fixture,source:originalPlan.execution.hostSource}]},
|
|
538
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_'+plan.suite+'.mjs',hostSource,
|
|
539
|
+
arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',
|
|
540
|
+
compilerSourceMaps:plan.maps!==false,childProcesses:'inherit-selected-artifact',timeoutMs:Number(deadline[1].replaceAll('_',''))},
|
|
541
|
+
expected:{kind:'seed-program',oracleRequired:true},
|
|
542
|
+
original:{manifest:'stable-compatibility',suite,fixture:source,host:fixture,
|
|
543
|
+
sourceSha256:(await file(suite)).sha256,originalAssertion:plan.assertion,
|
|
544
|
+
regions:[body,...transportRegions].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256})),
|
|
545
|
+
setupAssertions:'original compiler and portable CLI byte/map equality remain required by the original gate'},
|
|
546
|
+
});
|
|
547
|
+
mapped.push(suite);
|
|
548
|
+
}
|
|
549
|
+
{
|
|
550
|
+
const suite='tests/persistent-zipper.test.mjs';
|
|
551
|
+
const assertion='deep zipper ascent reads indexed ancestor slots without reducing wide parent vectors';
|
|
552
|
+
if(locators.some(item=>item.file===suite)){
|
|
553
|
+
const original=await text(suite),start=original.indexOf('test('+JSON.stringify(assertion)+',');
|
|
554
|
+
if(start<0)throw new TypeError('original indexed zipper assertion changed');
|
|
555
|
+
const script=region(original,' const script = `','\n `;',start);
|
|
556
|
+
let code=script.text.slice(' const script = `'.length);
|
|
557
|
+
// Only original filesystem specifiers are transported. Every original
|
|
558
|
+
// indexed-ascent operation, monkeypatch, depth and assertion stays intact.
|
|
559
|
+
code=code.replace(/import (\{[^}]+\}) from \$\{JSON\.stringify\(resolve\(root,"(runtime\/[^"\n]+)"\)\)\};/g,
|
|
560
|
+
(_,bindings,path)=>'const '+bindings+'=await import(pathToFileURL(resolve(product,'+JSON.stringify(path)+')).href);');
|
|
561
|
+
code=code.replace('${JSON.stringify(resolve(seedDirectory,"stdlib/core/zipper.eli"))}',
|
|
562
|
+
'pathToFileURL(resolve(product,"stdlib/core/zipper.mjs")).href');
|
|
563
|
+
const source='tests/fixtures/persistent-zipper.eli';
|
|
564
|
+
const originalPlan=records.find(record=>record.id==='stable-compatibility:program:'+source);
|
|
565
|
+
if(!originalPlan)throw new Error('original indexed zipper graph is unavailable');
|
|
566
|
+
const tail=original.slice(script.end),deadline=/^\n `;[\s\S]*?\n}, ([0-9_]+)\);/.exec(tail);
|
|
567
|
+
if(!deadline)throw new TypeError('original indexed zipper deadline changed');
|
|
568
|
+
const coverage=locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
569
|
+
(assertion+'\n'+script.text).includes(item.contains)).map(item=>item.id);
|
|
570
|
+
add({id:'original-program:persistent-zipper-indexed-ascent',kind:'project',coverage,
|
|
571
|
+
modules:structuredClone(originalPlan.modules),entry:originalPlan.entry,
|
|
572
|
+
request:{...structuredClone(originalPlan.request),phased:true},
|
|
573
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_zipper_indexed_ascent.mjs',
|
|
574
|
+
hostSource:'import {resolve} from "node:path";\nimport {pathToFileURL} from "node:url";\nconst product=process.argv[2];\n'+code+'\n',
|
|
575
|
+
arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',
|
|
576
|
+
timeoutMs:Number(deadline[1].replaceAll('_',''))},
|
|
577
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
578
|
+
original:{manifest:'stable-compatibility',suite,fixture:source,host:suite,
|
|
579
|
+
originalAssertion:assertion,sourceSha256:(await file(suite)).sha256,
|
|
580
|
+
regions:[script].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
{
|
|
585
|
+
const suite='tests/literal-runtime.test.mjs';
|
|
586
|
+
if(locators.some(item=>item.file===suite)){
|
|
587
|
+
const original=await text(suite),base=records.find(record=>record.id==='stable-compatibility:program:tests/fixtures/literal-runtime.eli');
|
|
588
|
+
if(!base)throw new Error('original literal runtime graph is unavailable');
|
|
589
|
+
const sourceOnlyAssertion='explicit host-only modules do not link the persistent runtime';
|
|
590
|
+
const sourceOnlyStart=original.indexOf('test('+JSON.stringify(sourceOnlyAssertion)+',');
|
|
591
|
+
const sourceOnly=writtenOriginalSource(original,'source',sourceOnlyStart,region);
|
|
592
|
+
const sourceOnlyBody=region(original,' expect(seed).not.toContain(', '\n } finally {',sourceOnly.region.end);
|
|
593
|
+
const entry='tests/fixtures/host-only.mjs';
|
|
594
|
+
const coverage=locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
595
|
+
(sourceOnlyAssertion+'\n'+sourceOnlyBody.text).includes(item.contains)).map(item=>item.id);
|
|
596
|
+
add({id:'original-program:literal-runtime-host-only',kind:'project',coverage,
|
|
597
|
+
modules:[{id:entry,filename:'host-only.eli',source:sourceOnly.source}],entry,
|
|
598
|
+
request:{...structuredClone(base.request),entries:[entry]},
|
|
599
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_host_only_shape.mjs',
|
|
600
|
+
hostSource:[
|
|
601
|
+
'import {expect} from "bun:test";',
|
|
602
|
+
'import {resolve} from "node:path";',
|
|
603
|
+
'import {readFile} from "node:fs/promises";',
|
|
604
|
+
'const companion=process.env.ELISCRIPT_ORIGINAL_JAVASCRIPT_PRODUCT_ROOT;',
|
|
605
|
+
'if(!companion)throw new Error("original source assertions require the actual selected compiler JavaScript artifact");',
|
|
606
|
+
'const seed=await readFile(resolve(companion,'+JSON.stringify(entry)+'),"utf8");',
|
|
607
|
+
sourceOnlyBody.text,'',
|
|
608
|
+
].join('\n'),arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',
|
|
609
|
+
compilerSourceMaps:true,timeoutMs:60000},expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
610
|
+
original:{manifest:'stable-compatibility',suite,host:suite,originalAssertion:sourceOnlyAssertion,
|
|
611
|
+
sourceSha256:(await file(suite)).sha256,
|
|
612
|
+
regions:[sourceOnly.region,sourceOnlyBody].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
613
|
+
});
|
|
614
|
+
const assertion='portable closures produce persistent values for the versioned worker codec';
|
|
615
|
+
const start=original.indexOf('test('+JSON.stringify(assertion)+',');
|
|
616
|
+
const portable=writtenOriginalSource(original,'source',start,region);
|
|
617
|
+
const invalid=writtenOriginalSource(original,'invalid',portable.region.end,region);
|
|
618
|
+
const incompleteAssertion='hash-map rejects incomplete pairs in both compilers';
|
|
619
|
+
const incompleteStart=original.indexOf('test('+JSON.stringify(incompleteAssertion)+',');
|
|
620
|
+
if(incompleteStart<0)throw new TypeError('original incomplete map assertion changed');
|
|
621
|
+
const incompletePrefix=' await Bun.write(source, ';
|
|
622
|
+
const incomplete=region(original,incompletePrefix,');\n',incompleteStart);
|
|
623
|
+
const incompleteSource=data(incomplete.text.slice(incompletePrefix.length));
|
|
624
|
+
if(typeof incompleteSource!=='string')throw new TypeError('original incomplete map input is not source text');
|
|
625
|
+
const body=region(original,' const seedModule = await import(seedOutput);','\n await Bun.write(',portable.region.end);
|
|
626
|
+
const shape=region(original,' expect(await readFile(seedOutput, "utf8"))\n .toContain(', ' const seedModule =',portable.region.end);
|
|
627
|
+
const moduleId='tests/fixtures/portable.mjs';
|
|
628
|
+
const runtimeImports=[...original.matchAll(/^import\s+[^;]+;/gm)]
|
|
629
|
+
.map(match=>match[0]).filter(code=>/from\s+["']\.\.\/runtime\//.test(code));
|
|
630
|
+
add({id:'original-program:literal-runtime-portable-codec',kind:'project',
|
|
631
|
+
coverage:locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
632
|
+
(assertion+'\n'+body.text).includes(item.contains)).map(item=>item.id),
|
|
633
|
+
modules:[{id:moduleId,filename:'portable.eli',source:portable.source}],entry:moduleId,
|
|
634
|
+
request:{...structuredClone(base.request),entries:[moduleId],portableEntries:['build']},
|
|
635
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_portable_codec.mjs',
|
|
636
|
+
hostSource:[
|
|
637
|
+
'import {expect} from "bun:test";',
|
|
638
|
+
'import {resolve} from "node:path";',
|
|
639
|
+
'import {pathToFileURL} from "node:url";',
|
|
640
|
+
'import {readFile} from "node:fs/promises";',
|
|
641
|
+
...runtimeImports,
|
|
642
|
+
'const referenceRoot=process.env.ELISCRIPT_ORIGINAL_REFERENCE_PRODUCT_ROOT;',
|
|
643
|
+
'if(!referenceRoot)throw new Error("original dual-compiler assertions require an independently emitted reference artifact");',
|
|
644
|
+
'const seedOutput=pathToFileURL(resolve(referenceRoot,'+JSON.stringify(moduleId)+')).href;',
|
|
645
|
+
'const selfOutput=pathToFileURL(resolve(process.argv[2],'+JSON.stringify(moduleId)+')).href;',
|
|
646
|
+
'{const seedOutput=resolve(process.env.ELISCRIPT_ORIGINAL_JAVASCRIPT_PRODUCT_ROOT,'+JSON.stringify(moduleId)+');\n'+shape.text+'\n}',body.text,'',
|
|
647
|
+
].join('\n'),arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',referenceArtifact:true,compilerSourceMaps:true,timeoutMs:60000},
|
|
648
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
649
|
+
original:{manifest:'stable-compatibility',suite,host:suite,originalAssertion:assertion,
|
|
650
|
+
sourceSha256:(await file(suite)).sha256,
|
|
651
|
+
regions:[portable.region,shape,body].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
652
|
+
});
|
|
653
|
+
add({id:'original-sequence:literal-runtime-invalid-inputs',kind:'sequence',
|
|
654
|
+
coverage:locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
655
|
+
(incompleteAssertion+'\n'+assertion+'\n'+incomplete.text+'\n'+invalid.region.text).includes(item.contains)).map(item=>item.id),
|
|
656
|
+
original:{manifest:'stable-compatibility',suite,sourceSha256:(await file(suite)).sha256,
|
|
657
|
+
regions:[incomplete,invalid.region].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
658
|
+
steps:[
|
|
659
|
+
{id:'incomplete-map',request:{operation:'compile',source:incompleteSource,filename:'invalid.eli'},
|
|
660
|
+
error:{contains:'hash-map expects complete key/value pairs'}},
|
|
661
|
+
{id:'unbound-portable',request:{operation:'compile',source:invalid.source,filename:'invalid.eli',portableEntries:['build']},
|
|
662
|
+
error:{contains:'unbound symbol missing'}},
|
|
663
|
+
],expected:{kind:'sequence'},
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
{
|
|
668
|
+
const suite='tests/language-equality.test.mjs';
|
|
669
|
+
if(locators.some(item=>item.file===suite)){
|
|
670
|
+
const original=await text(suite),start=original.indexOf(' const identitySource =');
|
|
671
|
+
const source=writtenOriginalSource(original,'identitySource',start,region);
|
|
672
|
+
const body=region(original,' expect(identity).not.toContain(', '\n } finally {',source.region.end);
|
|
673
|
+
const entry='tests/fixtures/identity.mjs';
|
|
674
|
+
const base=records.find(record=>record.id==='stable-compatibility:program:tests/fixtures/language-equality.eli');
|
|
675
|
+
if(!base)throw new Error('original identity graph is unavailable');
|
|
676
|
+
add({id:'original-program:language-equality-identity-only',kind:'project',
|
|
677
|
+
coverage:locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&body.text.includes(item.contains)).map(item=>item.id),
|
|
678
|
+
modules:[{id:entry,filename:'identity-only.eli',source:source.source}],entry,
|
|
679
|
+
request:{...structuredClone(base.request),entries:[entry]},
|
|
680
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_identity_shape.mjs',
|
|
681
|
+
hostSource:[
|
|
682
|
+
'import {expect} from "bun:test";',
|
|
683
|
+
'import {resolve} from "node:path";',
|
|
684
|
+
'import {readFile} from "node:fs/promises";',
|
|
685
|
+
'const companion=process.env.ELISCRIPT_ORIGINAL_JAVASCRIPT_PRODUCT_ROOT;',
|
|
686
|
+
'if(!companion)throw new Error("original identity source assertions require the actual selected compiler JavaScript artifact");',
|
|
687
|
+
'const identity=await readFile(resolve(companion,'+JSON.stringify(entry)+'),"utf8");',
|
|
688
|
+
body.text,'',
|
|
689
|
+
].join('\n'),arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',compilerSourceMaps:true,timeoutMs:60000},
|
|
690
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
691
|
+
original:{manifest:'stable-compatibility',suite,host:suite,sourceSha256:(await file(suite)).sha256,
|
|
692
|
+
regions:[source.region,body].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
{
|
|
697
|
+
const suite='tests/core-set.test.mjs';
|
|
698
|
+
if(locators.some(item=>item.file===suite)){
|
|
699
|
+
const original=await text(suite),start=original.indexOf('test("Eliscript-authored set algebra compiles and agrees across local hosts",');
|
|
700
|
+
const title='Eliscript-authored set algebra compiles and agrees across local hosts';
|
|
701
|
+
const body=region(original,' const expected = {','\n } finally {',start);
|
|
702
|
+
const runner=region(original,'async function runSuccessful(command) {','\nasync function compile(');
|
|
703
|
+
const host=region(original,'async function runUsageHost(command, module) {','\ntest(');
|
|
704
|
+
const environment=region(original,'const EMACS =','const COMPILER =');
|
|
705
|
+
const sourceCase=originalRuntimeCaseLocators(suite,original).find(item=>item.originalExecution.record==='original-program:core-set-source-map').originalCase;
|
|
706
|
+
const base=records.find(record=>record.id==='stable-compatibility:program:tests/fixtures/core-set-usage.eli');
|
|
707
|
+
if(!base)throw new Error('original set algebra graph is unavailable');
|
|
708
|
+
add({id:'original-program:core-set-source-map',kind:'project',
|
|
709
|
+
coverage:locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
710
|
+
(title+'\n'+body.text+'\n'+host.text).includes(item.contains)).map(item=>item.id),
|
|
711
|
+
modules:structuredClone(base.modules),entry:base.entry,request:structuredClone(base.request),
|
|
712
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_core_set_map.mjs',
|
|
713
|
+
hostSource:[
|
|
714
|
+
'import {expect} from "bun:test";',
|
|
715
|
+
'import {resolve} from "node:path";',
|
|
716
|
+
'import {readFile} from "node:fs/promises";',
|
|
717
|
+
'import {pathToFileURL} from "node:url";',
|
|
718
|
+
'const ROOT=process.argv[2],setModule=resolve(ROOT,"stdlib/core/set.mjs"),usageModule=resolve(ROOT,"core-set-usage.mjs");',
|
|
719
|
+
environment.text,runner.text,host.text,body.text,'',
|
|
720
|
+
].join('\n'),arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',compilerSourceMaps:true,
|
|
721
|
+
childProcesses:'inherit-selected-artifact',timeoutMs:sourceCase.timeoutMs},expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
722
|
+
original:{manifest:'stable-compatibility',suite,sourceSha256:(await file(suite)).sha256,
|
|
723
|
+
originalAssertion:title,
|
|
724
|
+
regions:[environment,runner,host,body].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256}))},
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
await addOriginalCoreRuntimeProgram({add,locators,text,file,region,records});
|
|
729
|
+
for(const suite of await addOriginalCoreProjectPrograms({add,locators,text,file,region,bootstrapSources,records}))mapped.push(suite);
|
|
730
|
+
return mapped;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
async function addOriginalCoreRuntimeProgram({add,locators,text,file,region,records}){
|
|
734
|
+
const suite='tests/core-stdlib.test.mjs';
|
|
735
|
+
if(!locators.some(item=>item.file===suite))return;
|
|
736
|
+
const original=await text(suite),title='Eliscript core modules compile and execute against runtime protocols';
|
|
737
|
+
const start=original.indexOf('test('+JSON.stringify(title)+',');
|
|
738
|
+
if(start<0)throw new TypeError('original complete core runtime case changed');
|
|
739
|
+
const body=region(original,' const usage = await import(pathToFileURL(usageModule).href);','\n } finally {',start);
|
|
740
|
+
const imports=region(original,'import { expect, test } from "bun:test";','const ROOT =');
|
|
741
|
+
const runner=region(original,'async function runSuccessful(command) {','\nasync function compile(');
|
|
742
|
+
const environment=region(original,'const EMACS =','const COMPILER =');
|
|
743
|
+
const bound=originalRuntimeCaseLocators(suite,original).find(item=>item.originalExecution.record==='original-program:core-stdlib-complete-protocols');
|
|
744
|
+
const base=records.find(record=>record.id==='stable-compatibility:program:tests/fixtures/core-stdlib-usage.eli');
|
|
745
|
+
if(!base)throw new Error('original complete core runtime graph is unavailable');
|
|
746
|
+
const bindings={usageModule:'core-stdlib-usage.mjs',apiUsageModule:'core-language-api-usage.mjs',
|
|
747
|
+
protocolModule:'stdlib/core/protocol.mjs',identifierModule:'stdlib/core/identifier.mjs',
|
|
748
|
+
dataTextModule:'stdlib/core/data-text.mjs',metadataModule:'stdlib/core/metadata.mjs',
|
|
749
|
+
collectionModule:'stdlib/core/collection.mjs',transientModule:'stdlib/core/transient.mjs',
|
|
750
|
+
transducerModule:'stdlib/core/transducer.mjs',seqModule:'stdlib/core/seq.mjs',dataModule:'stdlib/core/data.mjs'};
|
|
751
|
+
for(const id of Object.values(bindings))if(!base.modules.some(module=>module.id===id))
|
|
752
|
+
throw new TypeError('original complete core runtime module is missing: '+id);
|
|
753
|
+
// Preserve the entire original body, including the independent Node program,
|
|
754
|
+
// external protocol object, 50,000-value transient metrics and every map
|
|
755
|
+
// assertion. The only replacement is its compilation/setup directory.
|
|
756
|
+
add({id:'original-program:core-stdlib-complete-protocols',kind:'project',
|
|
757
|
+
coverage:locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
758
|
+
(title+'\n'+body.text).includes(item.contains)).map(item=>item.id),
|
|
759
|
+
modules:structuredClone(base.modules),entry:base.entry,request:structuredClone(base.request),
|
|
760
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_core_stdlib_complete.mjs',
|
|
761
|
+
hostSource:[imports.text,'const ROOT=process.argv[2];',
|
|
762
|
+
...Object.entries(bindings).map(([name,id])=>'const '+name+'=resolve(ROOT,'+JSON.stringify(id)+');'),
|
|
763
|
+
environment.text,runner.text,body.text,''].join('\n'),
|
|
764
|
+
arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',
|
|
765
|
+
compilerSourceMaps:true,childProcesses:'inherit-selected-artifact',timeoutMs:bound.originalCase.timeoutMs},
|
|
766
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
767
|
+
original:{manifest:'stable-compatibility',suite,sourceSha256:(await file(suite)).sha256,originalAssertion:title,
|
|
768
|
+
regions:[imports,environment,runner,body].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256})),
|
|
769
|
+
setupReplacement:{kind:'selected-compiler-and-selected-library-artifacts',
|
|
770
|
+
libraryAlgorithms:'complete original selected core and usage modules',
|
|
771
|
+
sourceMaps:'actual selected compiler companion JavaScript source maps; selected binary algorithms remain selected'}},
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
async function addOriginalCoreProjectPrograms({add,locators,text,file,region,bootstrapSources,records}){
|
|
776
|
+
const suite='tests/core-stdlib.test.mjs';
|
|
777
|
+
if(!locators.some(item=>item.file===suite))return[];
|
|
778
|
+
if(!Array.isArray(bootstrapSources)||bootstrapSources.length!==13)throw new TypeError('original core project adapters require the complete compiler source manifest');
|
|
779
|
+
const original=await text(suite),identity=await file(suite);
|
|
780
|
+
const hosts=region(original,'async function runBuiltCoreProjectHost(', '\ntest(');
|
|
781
|
+
const runner=region(original,'async function runSuccessful(command) {','\nasync function compile(');
|
|
782
|
+
const compilerModules=[];
|
|
783
|
+
for(const filename of bootstrapSources)compilerModules.push({id:filename.slice(0,-4)+'.mjs',filename,source:await text(filename)});
|
|
784
|
+
const runtimePlan=records.find(record=>record.id==='stable-compatibility:program:stdlib/core/text.eli');
|
|
785
|
+
if(!runtimePlan)throw new Error('original core project runtime graph is unavailable');
|
|
786
|
+
for(const plan of [
|
|
787
|
+
{id:'core',assertion:'stable protocol and core algorithms build as one project across Bun and Node',
|
|
788
|
+
declaration:' const sources = [',names:['protocol','collection','transient','transducer','seq','data','set','order','text','object'].map(name=>'core/'+name)},
|
|
789
|
+
{id:'utility',assertion:'stable portable utility modules build as one project across Bun and Node',
|
|
790
|
+
declaration:' const modules = [',names:['sequence','text','object','data']},
|
|
791
|
+
{id:'persistent-values',assertion:'persistent value library builds as one project and executes under Bun and Node',
|
|
792
|
+
declaration:' const sourceNames = [',names:['bit','persistent-list','persistent-vector','persistent-map','persistent-set','value']},
|
|
793
|
+
{id:'value-text',assertion:'identifier metadata and data text build as one project across Bun and Node',
|
|
794
|
+
declaration:' const entries = [',names:['bit','data-text','identifier','metadata','persistent-list','persistent-map','persistent-set','persistent-vector','value'],entries:['identifier','metadata','data-text']},
|
|
795
|
+
{id:'public',assertion:'public state interop result JSON and numeric modules build across hosts',
|
|
796
|
+
declaration:' const entries = [',names:['bit','interop/js','json','numeric','persistent-list','persistent-map','persistent-set','persistent-vector','result','state/atom','value'],entries:['state/atom','interop/js','result','json','numeric']},
|
|
797
|
+
]){
|
|
798
|
+
const start=original.indexOf('test('+JSON.stringify(plan.assertion)+',');
|
|
799
|
+
if(start<0)throw new TypeError('original complete core project assertion changed: '+plan.assertion);
|
|
800
|
+
const declarations=region(original,plan.declaration,'\n try {',start);
|
|
801
|
+
const body=region(original,' expect(report).toMatchObject({','\n } finally {',declarations.end);
|
|
802
|
+
const deadline=/^[\s\S]*?\n}, ([0-9_]+)\);/.exec(original.slice(body.end));
|
|
803
|
+
if(!deadline)throw new TypeError('original complete core project deadline changed');
|
|
804
|
+
const modules=structuredClone(compilerModules);
|
|
805
|
+
for(const name of plan.names){const filename='stdlib/'+name+'.eli';modules.push({id:name+'.mjs',filename,source:await text(filename)});}
|
|
806
|
+
const entries=(plan.entries??plan.names).map(name=>'stdlib/'+name+'.eli');
|
|
807
|
+
const hostSource=[
|
|
808
|
+
'import {expect} from "bun:test";',
|
|
809
|
+
'import {resolve,dirname} from "node:path";',
|
|
810
|
+
'import {pathToFileURL} from "node:url";',
|
|
811
|
+
'import {mkdtemp,rm,readFile} from "node:fs/promises";',
|
|
812
|
+
'import {tmpdir} from "node:os";',
|
|
813
|
+
'const ROOT=process.env.ELISCRIPT_ORIGINAL_SOURCE_ROOT;',
|
|
814
|
+
'if(!ROOT)throw new Error("original core project requires its source root");',
|
|
815
|
+
'const EMACS=process.env.EMACS??"emacs";',
|
|
816
|
+
'const product=process.argv[2],outputRoot=product;',
|
|
817
|
+
'const {buildProject}=await import(pathToFileURL(resolve(ROOT,"bootstrap/host/project.mjs")).href);',
|
|
818
|
+
'const selectedCompiler=await import(pathToFileURL(resolve(product,"bootstrap/compiler/compiler.mjs")).href);',
|
|
819
|
+
'const directory=await mkdtemp(resolve(tmpdir(),"eliscript-original-core-project-"));',
|
|
820
|
+
declarations.text,runner.text,hosts.text,
|
|
821
|
+
'try{',
|
|
822
|
+
'const build=await buildProject({root:resolve(ROOT,"stdlib"),outDir:resolve(directory,"report"),useCache:false,entries:'+JSON.stringify(entries)+'.map(name=>resolve(ROOT,name)),moduleDirectory:resolve(product,"bootstrap/compiler"),compiler:selectedCompiler});',
|
|
823
|
+
'const report=build.report;',
|
|
824
|
+
body.text,
|
|
825
|
+
'}finally{await rm(directory,{recursive:true,force:true});}','',
|
|
826
|
+
].join('\n');
|
|
827
|
+
add({id:'original-program:core-project-'+plan.id,kind:'project',
|
|
828
|
+
coverage:locators.filter(item=>item.file===suite&&typeof item.contains==='string'&&
|
|
829
|
+
(plan.assertion+'\n'+declarations.text+'\n'+body.text+'\n'+hosts.text).includes(item.contains)).map(item=>item.id),
|
|
830
|
+
modules,entry:plan.names[0]+'.mjs',
|
|
831
|
+
request:{...structuredClone(runtimePlan.request),entries:modules.map(module=>module.id),resolveImports:true,phased:true,sourceMap:true},
|
|
832
|
+
execution:{kind:'original-program',host:'tests/__eliscript_original_core_project_'+plan.id+'.mjs',hostSource,
|
|
833
|
+
arguments:[{directory:true}],aliases:true,requiresBun:true,hostRuntime:'bun',
|
|
834
|
+
childProcesses:'inherit-selected-artifact',runtimeLaunchers:true,compilerSourceMaps:true,runtimeProfile:'compiler',
|
|
835
|
+
timeoutMs:Number(deadline[1].replaceAll('_',''))},
|
|
836
|
+
expected:{kind:'seed-program',oracleRequired:true,stdout:''},
|
|
837
|
+
original:{manifest:'stable-compatibility',suite,host:suite,originalAssertion:plan.assertion,sourceSha256:identity.sha256,
|
|
838
|
+
regions:[declarations,runner,hosts,body].map(({start,end,byteStart,byteEnd,sha256})=>({start,end,byteStart,byteEnd,sha256})),
|
|
839
|
+
setupReplacement:{kind:'selected-compiler-and-selected-library-artifacts',reportCompiler:'actual selected target compiler',libraryAlgorithms:'actual selected target modules'}},
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
return[];
|
|
843
|
+
}
|