eliscript 0.0.1 → 0.0.2
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 +59 -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-legacy.mjs +37 -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 +89 -0
- 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 +446 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +60 -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 +579 -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 +23 -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 +20 -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 +483 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1414 -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 +97 -10
- 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 +114 -47
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +483 -0
- package/stdlib/managed-literals.eli +1414 -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 +579 -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 +23 -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 +20 -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 +460 -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 +486 -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,270 @@
|
|
|
1
|
+
(module tools.acceptance.finalize
|
|
2
|
+
(import "node:crypto" createHash)
|
|
3
|
+
(import "node:buffer" Buffer)
|
|
4
|
+
(import "node:fs/promises" mkdir readFile stat writeFile)
|
|
5
|
+
(import "node:path" :as path)
|
|
6
|
+
(import "node:process" :default process)
|
|
7
|
+
(import "node:url" fileURLToPath)
|
|
8
|
+
(import "./check.mjs" verifyAcceptanceRun)
|
|
9
|
+
(import "./retained-soak.mjs" validateRefreshedWorkerSoak)
|
|
10
|
+
(import "./retained-transient.mjs" validateRefreshedTransientBuilder)
|
|
11
|
+
(import "./retained-performance-snapshot.mjs" retainedGitSnapshotBytes)
|
|
12
|
+
(import "./finalize-legacy.mjs" :as legacy)
|
|
13
|
+
|
|
14
|
+
(defconst DEFAULT_ROOT (js-call path :resolve
|
|
15
|
+
(js-call path :dirname (fileURLToPath (js* "import.meta.url"))) "../.."))
|
|
16
|
+
(defconst FinalAcceptanceError (get legacy :FinalAcceptanceError))
|
|
17
|
+
(defconst validateDefectRegister (get legacy :validateDefectRegister))
|
|
18
|
+
(defconst humanFinalAcceptanceReport (get legacy :humanFinalAcceptanceReport))
|
|
19
|
+
(defconst validateFinalManifest (get legacy :validateFinalManifest))
|
|
20
|
+
(defconst humanFinalAcceptanceSummary (get legacy :humanFinalAcceptanceSummary))
|
|
21
|
+
(defconst contract-file "contracts/final-acceptance.json")
|
|
22
|
+
(defconst fuzz-file "tests/reader-program-fuzz.test.mjs")
|
|
23
|
+
(defconst expected-source (js-object :run "acceptance/runs/m13-01.json" :report "acceptance/runs/m13-01.md"))
|
|
24
|
+
(defconst expected-outputs (js-object :manifest "acceptance/manifest.json" :report "acceptance/report.md"))
|
|
25
|
+
(defconst expected-groups (js-array "benchmark" "fuzz" "scale" "soak" "test"))
|
|
26
|
+
(defconst revision-pattern (new globalThis.RegExp "^[0-9a-f]{40}$"))
|
|
27
|
+
(defconst digest-pattern (new globalThis.RegExp "^[0-9a-f]{64}$"))
|
|
28
|
+
(defun fail (message) (throw (new FinalAcceptanceError (js-array message))))
|
|
29
|
+
(defun field (object key &rest defaults)
|
|
30
|
+
(if (nullish? object) (aref defaults 0) (get object key (aref defaults 0))))
|
|
31
|
+
(defun call-options (arguments)
|
|
32
|
+
(if (undefined? (aref arguments 0)) (js-object) (aref arguments 0)))
|
|
33
|
+
(defun nullish (value fallback) (if (nullish? value) fallback value))
|
|
34
|
+
(defun plain-object (value)
|
|
35
|
+
(and (not (nullish? value)) (= (value-type value) "object") (not (Array/isArray value))))
|
|
36
|
+
(defun same (left right) (= (JSON/stringify left) (JSON/stringify right)))
|
|
37
|
+
(defun sha256 (value) (js-call (js-call (createHash "sha256") :update value) :digest "hex"))
|
|
38
|
+
(defun safe-relative (value)
|
|
39
|
+
(and (= (value-type value) "string") (> (js-length value) 0)
|
|
40
|
+
(not (js-call path :isAbsolute value))
|
|
41
|
+
(not (js-call (js-call value :split "/") :includes ".."))
|
|
42
|
+
(= (js-call (get path :posix) :normalize value) value)))
|
|
43
|
+
(defun sorted-strings (values)
|
|
44
|
+
(and (Array/isArray values) (> (js-length values) 0)
|
|
45
|
+
(js-call values :every (lambda (value) (and (= (value-type value) "string") (> (js-length value) 0))))
|
|
46
|
+
(= (get (new globalThis.Set values) :size) (js-length values))
|
|
47
|
+
(same values (js-call (js-call values :slice) :sort))))
|
|
48
|
+
(defasync read-json (root file) (JSON/parse (await (readFile (js-call path :join root file) "utf8"))))
|
|
49
|
+
(defasync regular-file (root file)
|
|
50
|
+
(try (js-call (await (stat (js-call path :join root file))) :isFile)
|
|
51
|
+
(catch error false)))
|
|
52
|
+
(defun git-text (root arguments)
|
|
53
|
+
(js-call (new globalThis.TextDecoder) :decode (retainedGitSnapshotBytes root arguments)))
|
|
54
|
+
|
|
55
|
+
;; This authenticates the original source run only. It never certifies the
|
|
56
|
+
;; current fuzz implementation, changes its digest, or executes its workload.
|
|
57
|
+
(defasync verifyHistoricalFuzzArtifact (root filename run)
|
|
58
|
+
(unless (= filename fuzz-file) (fail "only the retained reader/program fuzz artifact has historical source authentication"))
|
|
59
|
+
(let* ((source (field run "source")) (commit (field source "commit")) (tree (field source "tree"))
|
|
60
|
+
(artifacts (field run "artifacts")))
|
|
61
|
+
(unless (and (= (value-type commit) "string") (js-call revision-pattern :test commit)
|
|
62
|
+
(= (value-type tree) "string") (js-call revision-pattern :test tree))
|
|
63
|
+
(fail "historical fuzz source must identify a full Git commit and tree"))
|
|
64
|
+
(unless (Array/isArray artifacts) (fail "historical fuzz artifact inventory is missing"))
|
|
65
|
+
(let* ((bound (js-call artifacts :filter (lambda (entry) (= (field entry "file") filename))))
|
|
66
|
+
(digest (field (aref bound 0) "sha256")))
|
|
67
|
+
(unless (and (= (js-length bound) 1) (= (value-type digest) "string") (js-call digest-pattern :test digest))
|
|
68
|
+
(fail "historical fuzz artifact must be uniquely bound by the source run"))
|
|
69
|
+
(try
|
|
70
|
+
(unless (= (js-call (git-text root (js-array "rev-parse" (str commit "^{tree}"))) :trim) tree)
|
|
71
|
+
(fail "historical fuzz source tree does not belong to its source commit"))
|
|
72
|
+
(unless (= (sha256 (retainedGitSnapshotBytes root (js-array "show" (str commit ":" filename)))) digest)
|
|
73
|
+
(fail "historical fuzz artifact differs from its accepted Git snapshot"))
|
|
74
|
+
(catch error
|
|
75
|
+
(if (js-call (get FinalAcceptanceError :prototype) :isPrototypeOf error) (throw error)
|
|
76
|
+
(fail (str "historical fuzz Git source authentication failed: " (get error :message))))))
|
|
77
|
+
(js-object :artifact filename :artifactSha256 digest :sourceCommit commit :sourceTree tree
|
|
78
|
+
:historicalSourcesVerified t :currentSourceAcceptance "not-asserted" :currentSourceClaim false))))
|
|
79
|
+
|
|
80
|
+
(defun record-refresh (options result)
|
|
81
|
+
(let ((items (get options :deferredPerformanceAcceptance)))
|
|
82
|
+
(when (and (not (eq result t)) (Array/isArray items)
|
|
83
|
+
(not (js-call items :some (lambda (item) (= (get item :report) (get result :report))))))
|
|
84
|
+
(js-call items :push result))))
|
|
85
|
+
(defun record-history (options result)
|
|
86
|
+
(let ((items (get options :historicalSourceEvidence)))
|
|
87
|
+
(when (and (Array/isArray items)
|
|
88
|
+
(not (js-call items :some (lambda (item) (= (get item :artifact) (get result :artifact))))))
|
|
89
|
+
(js-call items :push result))))
|
|
90
|
+
|
|
91
|
+
(defasync validateFinalAcceptanceContract (contract run &rest arguments)
|
|
92
|
+
(let* ((options (call-options arguments)) (root (js-call path :resolve (nullish (get options :root) DEFAULT_ROOT)))
|
|
93
|
+
(errors (js-array)))
|
|
94
|
+
(unless (and (plain-object contract) (= (get contract :schemaVersion) 1)
|
|
95
|
+
(= (get contract :format) "eliscript-final-acceptance-contract") (= (get contract :version) 1))
|
|
96
|
+
(fail "contract must use eliscript-final-acceptance-contract version 1"))
|
|
97
|
+
(unless (same (get contract :source) expected-source)
|
|
98
|
+
(js-call errors :push "contract source must identify the retained core run and report"))
|
|
99
|
+
(unless (= (get contract :defects) "acceptance/defects.json")
|
|
100
|
+
(js-call errors :push "contract defects must identify acceptance/defects.json"))
|
|
101
|
+
(unless (same (get contract :outputs) expected-outputs)
|
|
102
|
+
(js-call errors :push "contract outputs must be the canonical acceptance artifacts"))
|
|
103
|
+
(unless (same (get contract :blockingSeverities) (js-array 1 2))
|
|
104
|
+
(js-call errors :push "blocking severities must be exactly 1 and 2"))
|
|
105
|
+
(let* ((groups (if (Array/isArray (get contract :evidenceGroups)) (get contract :evidenceGroups) (js-array)))
|
|
106
|
+
(criterion-ids (new globalThis.Set (js-call (get run :criteria) :map (lambda (criterion) (get criterion :id)))))
|
|
107
|
+
(artifacts (new globalThis.Map (js-call (get run :artifacts) :map
|
|
108
|
+
(lambda (artifact) (js-array (get artifact :file) (get artifact :sha256))))))
|
|
109
|
+
(index 0))
|
|
110
|
+
(unless (same (js-call groups :map (lambda (group) (field group "id"))) expected-groups)
|
|
111
|
+
(js-call errors :push "evidence groups must be exactly benchmark fuzz scale soak and test"))
|
|
112
|
+
(while (< index (js-length groups))
|
|
113
|
+
(let* ((group (aref groups index)) (label (nullish (field group "id") (str "evidence group " index))))
|
|
114
|
+
(if (not (and (plain-object group) (sorted-strings (get group :criteria)) (sorted-strings (get group :artifacts))))
|
|
115
|
+
(js-call errors :push (str label " must declare sorted unique criteria and artifacts"))
|
|
116
|
+
(progn
|
|
117
|
+
(when (and (js-call (get group :criteria) :includes "*") (not (same (get group :criteria) (js-array "*"))))
|
|
118
|
+
(js-call errors :push (str label " wildcard criterion must be the only criterion")))
|
|
119
|
+
(js-call (get group :criteria) :forEach (lambda (id)
|
|
120
|
+
(when (and (/= id "*") (not (js-call criterion-ids :has id)))
|
|
121
|
+
(js-call errors :push (str label " references unknown criterion " id)))))
|
|
122
|
+
(let ((files (get group :artifacts)) (file-index 0))
|
|
123
|
+
(while (< file-index (js-length files))
|
|
124
|
+
(let ((file (aref files file-index)))
|
|
125
|
+
(cond
|
|
126
|
+
((not (safe-relative file))
|
|
127
|
+
(js-call errors :push (str label " has unsafe artifact path " (JSON/stringify file))))
|
|
128
|
+
((not (js-call artifacts :has file))
|
|
129
|
+
(js-call errors :push (str label " artifact is not bound by the source run: " file)))
|
|
130
|
+
((not (await (regular-file root file)))
|
|
131
|
+
(js-call errors :push (str label " artifact is missing: " file)))
|
|
132
|
+
(t
|
|
133
|
+
(let ((bytes (await (readFile (js-call path :join root file)))))
|
|
134
|
+
(unless (= (sha256 bytes) (js-call artifacts :get file))
|
|
135
|
+
(let ((refresh-options (js-object :deferPerformanceAcceptance (eq (get options :deferPerformanceAcceptance) t))))
|
|
136
|
+
(cond
|
|
137
|
+
((= file "benchmarks/worker-lifecycle-soak-macos-arm64.json")
|
|
138
|
+
(try (record-refresh options (await (validateRefreshedWorkerSoak root file bytes run refresh-options)))
|
|
139
|
+
(catch error (js-call errors :push (str label " artifact changed after the source run: " file ": " (get error :message))))))
|
|
140
|
+
((= file "benchmarks/transient-builder-macos-arm64.json")
|
|
141
|
+
(try (record-refresh options (await (validateRefreshedTransientBuilder root file bytes run refresh-options)))
|
|
142
|
+
(catch error (js-call errors :push (str label " artifact changed after the source run: " file ": " (get error :message))))))
|
|
143
|
+
((and (= file fuzz-file) (eq (get options :deferPerformanceAcceptance) t))
|
|
144
|
+
(try (record-history options (await (verifyHistoricalFuzzArtifact root file run)))
|
|
145
|
+
(catch error (js-call errors :push (str label " artifact changed after the source run: " file ": " (get error :message))))))
|
|
146
|
+
(t (js-call errors :push (str label " artifact changed after the source run: " file))))))))))
|
|
147
|
+
(setq file-index (1+ file-index)))))))
|
|
148
|
+
(setq index (1+ index))))
|
|
149
|
+
(when (> (js-length errors) 0) (throw (new FinalAcceptanceError errors)))
|
|
150
|
+
contract))
|
|
151
|
+
|
|
152
|
+
(defun result-counts (criteria)
|
|
153
|
+
(let ((result (js-object :pass 0 :incomplete 0 :fail 0 :total (js-length criteria))))
|
|
154
|
+
(js-call criteria :forEach (lambda (criterion)
|
|
155
|
+
(let ((key (get criterion :result))) (put result key (1+ (get result key))))))
|
|
156
|
+
result))
|
|
157
|
+
(defun evidence-records (contract run)
|
|
158
|
+
(let* ((all (js-call (get run :criteria) :map (lambda (criterion) (get criterion :id))))
|
|
159
|
+
(criteria (new globalThis.Map (js-call (get run :criteria) :map
|
|
160
|
+
(lambda (criterion) (js-array (get criterion :id) (get criterion :result))))))
|
|
161
|
+
(artifacts (new globalThis.Map (js-call (get run :artifacts) :map
|
|
162
|
+
(lambda (artifact) (js-array (get artifact :file) (get artifact :sha256)))))))
|
|
163
|
+
(js-call (get contract :evidenceGroups) :map (lambda (group)
|
|
164
|
+
(let ((ids (if (same (get group :criteria) (js-array "*")) all (get group :criteria))))
|
|
165
|
+
(js-object :id (get group :id) :complete t
|
|
166
|
+
:criteria (js-call ids :map (lambda (id) (js-object :id id :result (js-call criteria :get id))))
|
|
167
|
+
:artifacts (js-call (get group :artifacts) :map
|
|
168
|
+
(lambda (file) (js-object :file file :sha256 (js-call artifacts :get file))))))))))
|
|
169
|
+
|
|
170
|
+
(defasync buildFinalAcceptance (&rest arguments)
|
|
171
|
+
(let* ((options (call-options arguments)) (root (js-call path :resolve (nullish (get options :root) DEFAULT_ROOT)))
|
|
172
|
+
(contract (if (nullish? (get options :contract)) (await (read-json root contract-file)) (get options :contract)))
|
|
173
|
+
(run (if (nullish? (get options :run))
|
|
174
|
+
(await (verifyAcceptanceRun (get (get contract :source) :run)
|
|
175
|
+
(js-object :root root :markdownFile (get (get contract :source) :report)))) (get options :run))))
|
|
176
|
+
(await (validateFinalAcceptanceContract contract run (js-object :root root
|
|
177
|
+
:deferPerformanceAcceptance (eq (get options :deferPerformanceAcceptance) t)
|
|
178
|
+
:deferredPerformanceAcceptance (get options :deferredPerformanceAcceptance)
|
|
179
|
+
:historicalSourceEvidence (get options :historicalSourceEvidence))))
|
|
180
|
+
(let* ((defects (await (validateDefectRegister
|
|
181
|
+
(if (nullish? (get options :defects)) (await (read-json root (get contract :defects))) (get options :defects))
|
|
182
|
+
(js-object :root root))))
|
|
183
|
+
(run-bytes (await (readFile (js-call path :join root (get (get contract :source) :run)))))
|
|
184
|
+
(report-bytes (await (readFile (js-call path :join root (get (get contract :source) :report)))))
|
|
185
|
+
(defect-bytes (if (get options :defects) (js-call Buffer :from (str (JSON/stringify defects nil 2) "\n"))
|
|
186
|
+
(await (readFile (js-call path :join root (get contract :defects))))))
|
|
187
|
+
(evidence (evidence-records contract run))
|
|
188
|
+
(contract-bytes (await (readFile (js-call path :join root contract-file))))
|
|
189
|
+
(blocking (js-length (js-call (get defects :unresolved) :filter
|
|
190
|
+
(lambda (defect) (js-call (get contract :blockingSeverities) :includes (get defect :severity))))))
|
|
191
|
+
(complete (js-call evidence :every (lambda (group) (get group :complete))))
|
|
192
|
+
(counts (result-counts (get run :criteria))))
|
|
193
|
+
(js-object :schemaVersion 1 :format "eliscript-1.0-acceptance-manifest" :version 1
|
|
194
|
+
:generatedAt (get run :generatedAt) :source (get run :source) :environment (get run :environment)
|
|
195
|
+
:contract (js-object :file contract-file :sha256 (sha256 contract-bytes))
|
|
196
|
+
:sourceRun (js-object :json (get (get contract :source) :run) :jsonSha256 (sha256 run-bytes)
|
|
197
|
+
:markdown (get (get contract :source) :report) :markdownSha256 (sha256 report-bytes))
|
|
198
|
+
:commands (get run :commands) :criteria (get run :criteria) :artifacts (get run :artifacts) :evidence evidence
|
|
199
|
+
:defects (js-object :register (get contract :defects) :registerSha256 (sha256 defect-bytes)
|
|
200
|
+
:blockingSeverities (get contract :blockingSeverities) :unresolved (get defects :unresolved) :blockingCount blocking)
|
|
201
|
+
:applications (get run :applications)
|
|
202
|
+
:summary (js-object :criteria counts :corpusComplete (get (get run :summary) :corpusComplete)
|
|
203
|
+
:operationalSuccess (get (get run :summary) :operationalSuccess) :evidenceComplete complete :blockingDefects blocking
|
|
204
|
+
:acceptancePass (and (get (get run :summary) :acceptancePass) complete (= blocking 0)))))))
|
|
205
|
+
|
|
206
|
+
(defasync generateFinalAcceptance (&rest arguments)
|
|
207
|
+
(let* ((options (call-options arguments)) (root (js-call path :resolve (nullish (get options :root) DEFAULT_ROOT))))
|
|
208
|
+
(when (eq (get options :deferPerformanceAcceptance) t)
|
|
209
|
+
(fail "cannot generate acceptance artifacts while current performance acceptance is deferred"))
|
|
210
|
+
(let* ((contract (if (nullish? (get options :contract)) (await (read-json root contract-file)) (get options :contract)))
|
|
211
|
+
(manifest (await (buildFinalAcceptance (Object/assign (js-object) options (js-object :root root :contract contract))))))
|
|
212
|
+
(await (mkdir (js-call path :dirname (js-call path :join root (get (get contract :outputs) :manifest)))
|
|
213
|
+
(js-object :recursive t)))
|
|
214
|
+
(await (writeFile (js-call path :join root (get (get contract :outputs) :manifest)) (str (JSON/stringify manifest nil 2) "\n")))
|
|
215
|
+
(await (writeFile (js-call path :join root (get (get contract :outputs) :report)) (humanFinalAcceptanceReport manifest)))
|
|
216
|
+
manifest)))
|
|
217
|
+
(defasync verifyFinalAcceptance (&rest arguments)
|
|
218
|
+
(let* ((options (call-options arguments)) (root (js-call path :resolve (nullish (get options :root) DEFAULT_ROOT)))
|
|
219
|
+
(contract (if (nullish? (get options :contract)) (await (read-json root contract-file)) (get options :contract)))
|
|
220
|
+
(expected (await (buildFinalAcceptance (Object/assign (js-object) options (js-object :root root :contract contract)))))
|
|
221
|
+
(manifest (if (nullish? (get options :manifest)) (await (read-json root (get (get contract :outputs) :manifest))) (get options :manifest)))
|
|
222
|
+
(markdown (if (nullish? (get options :markdown))
|
|
223
|
+
(await (readFile (js-call path :join root (get (get contract :outputs) :report)) "utf8")) (get options :markdown))))
|
|
224
|
+
(validateFinalManifest manifest expected)
|
|
225
|
+
(unless (= markdown (humanFinalAcceptanceReport manifest))
|
|
226
|
+
(fail "human acceptance report does not match the machine-readable manifest"))
|
|
227
|
+
(when (and (get options :requirePass) (not (get (get manifest :summary) :acceptancePass)))
|
|
228
|
+
(fail "the canonical artifacts are valid, but final acceptance has not been reached"))
|
|
229
|
+
(when (and (get options :requirePass) (eq (get options :deferPerformanceAcceptance) t))
|
|
230
|
+
(fail "current performance acceptance is deferred and has not passed"))
|
|
231
|
+
manifest))
|
|
232
|
+
|
|
233
|
+
(defun parse-arguments (arguments)
|
|
234
|
+
(let ((options (js-object)) (index 0))
|
|
235
|
+
(while (< index (js-length arguments))
|
|
236
|
+
(let ((argument (aref arguments index)))
|
|
237
|
+
(cond ((= argument "--generate") (put options :generate t))
|
|
238
|
+
((= argument "--verify") (put options :verify t))
|
|
239
|
+
((= argument "--require-pass") (put options :requirePass t))
|
|
240
|
+
(t (fail (str "unknown argument " argument)))))
|
|
241
|
+
(setq index (1+ index)))
|
|
242
|
+
(when (eq (get options :generate) (get options :verify)) (fail "choose exactly one of --generate or --verify"))
|
|
243
|
+
options))
|
|
244
|
+
(defasync main ()
|
|
245
|
+
(let* ((options (parse-arguments (js-call (get process :argv) :slice 2)))
|
|
246
|
+
(deferred (= (get (get process :env) :ELISCRIPT_DEFER_PERFORMANCE_ACCEPTANCE) "1")))
|
|
247
|
+
(put options :deferPerformanceAcceptance deferred)
|
|
248
|
+
(put options :deferredPerformanceAcceptance (js-array))
|
|
249
|
+
(put options :historicalSourceEvidence (js-array))
|
|
250
|
+
(let* ((manifest (if (get options :generate) (await (generateFinalAcceptance options)) (await (verifyFinalAcceptance options))))
|
|
251
|
+
(summary (humanFinalAcceptanceSummary manifest)))
|
|
252
|
+
(js-call (get process :stdout) :write (str (if deferred
|
|
253
|
+
(js-call summary :replace (new globalThis.RegExp "^Final acceptance:" "mu") "Historical final acceptance:") summary) "\n"))
|
|
254
|
+
(when deferred
|
|
255
|
+
(js-call (get process :stdout) :write "Current performance acceptance: DEFERRED / NOT ACCEPTED\n")
|
|
256
|
+
(js-call (get options :deferredPerformanceAcceptance) :forEach (lambda (item)
|
|
257
|
+
(js-call (get process :stdout) :write (str " " (get item :report) ": measured Git snapshot "
|
|
258
|
+
(get (get item :measuredSource) :commit) " verified; current source comparison not performed\n"))))
|
|
259
|
+
(js-call (get options :historicalSourceEvidence) :forEach (lambda (item)
|
|
260
|
+
(js-call (get process :stdout) :write (str "Historical fuzz source: " (get item :artifact) " at "
|
|
261
|
+
(get item :sourceCommit) " verified; current fuzz acceptance is provided by the independent complete functional run\n")))))
|
|
262
|
+
(when (and (get options :requirePass) (not (get (get manifest :summary) :acceptancePass)))
|
|
263
|
+
(fail "the canonical artifacts are valid, but final acceptance has not been reached")))))
|
|
264
|
+
(when (js* "import.meta.main")
|
|
265
|
+
(js-call (main) :catch (lambda (error)
|
|
266
|
+
(js-call (get process :stderr) :write (str (nullish (get error :stack) error) "\n"))
|
|
267
|
+
(put process :exitCode 1))))
|
|
268
|
+
(export DEFAULT_ROOT FinalAcceptanceError validateFinalAcceptanceContract verifyHistoricalFuzzArtifact
|
|
269
|
+
validateDefectRegister buildFinalAcceptance humanFinalAcceptanceReport validateFinalManifest
|
|
270
|
+
generateFinalAcceptance verifyFinalAcceptance humanFinalAcceptanceSummary))
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { readFile, writeFile, mkdtemp, rm, mkdir, readdir } from "node:fs/promises";
|
|
4
|
+
import { cpus, platform, arch } from "node:os";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
import { spawnSync } from "node:child_process";
|
|
8
|
+
import { pathToFileURL, fileURLToPath } from "node:url";
|
|
9
|
+
import { createServer } from "node:http";
|
|
10
|
+
import { chromium } from "playwright-core";
|
|
11
|
+
import { buildBackends, backendModules, root } from "./build.mjs";
|
|
12
|
+
|
|
13
|
+
const reportPath = resolve(root, "tools/backends/results/direct-wasm-macos-arm64.json");
|
|
14
|
+
const inputs = [
|
|
15
|
+
{ name: "recurrence-batch", fn: "recurrence_batch", wasmFn: "recurrence-batch", args: [1_000_000, .123, 2] },
|
|
16
|
+
{ name: "escape-grid-batch", fn: "escape_grid_batch", wasmFn: "escape-grid-batch", args: [160, 64, 2] },
|
|
17
|
+
{ name: "recurrence-tiny-batch", fn: "recurrence_batch", wasmFn: "recurrence-batch", args: [1, .123, 2_000_000] },
|
|
18
|
+
];
|
|
19
|
+
const parameters = { sessions: 3, warmups: 5, samples: 9, minimumSpeedup: 1 };
|
|
20
|
+
const sourceFiles = [
|
|
21
|
+
...backendModules.map(name => `bootstrap/backends/${name}.eli`),
|
|
22
|
+
...(await readdir(resolve(root, "bootstrap/compiler"))).filter(f => f.endsWith(".eli")).sort().map(f => `bootstrap/compiler/${f}`),
|
|
23
|
+
"tools/experiments/native-wasm/kernels.eli", "tools/backends/batches.eli",
|
|
24
|
+
"tools/backends/build.mjs", "tools/backends/benchmark.mjs", "tools/bootstrap-seed.el",
|
|
25
|
+
];
|
|
26
|
+
const hash = bytes => createHash("sha256").update(bytes).digest("hex");
|
|
27
|
+
const median = values => [...values].sort((a, b) => a - b)[Math.floor(values.length / 2)];
|
|
28
|
+
|
|
29
|
+
async function sourceHashes() {
|
|
30
|
+
return Object.fromEntries(await Promise.all(sourceFiles.map(async file => [file, hash(await readFile(resolve(root, file)))])));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Shared measurement code executes in fresh Node/Bun processes and pages.
|
|
34
|
+
// Samples include only hot execution, not startup, download or instantiation.
|
|
35
|
+
function measure(js, wasm, session, inputs, parameters, now) {
|
|
36
|
+
const results = [];
|
|
37
|
+
const order = session & 1 ? ["wasm", "js"] : ["js", "wasm"];
|
|
38
|
+
for (const input of inputs) {
|
|
39
|
+
const measurements = {};
|
|
40
|
+
const expected = js[input.fn](...input.args);
|
|
41
|
+
for (const mode of order) {
|
|
42
|
+
const fn = mode === "js" ? js[input.fn] : wasm[input.wasmFn];
|
|
43
|
+
for (let i = 0; i < parameters.warmups; i++) fn(...input.args);
|
|
44
|
+
const samplesMs = [], checksums = [];
|
|
45
|
+
for (let i = 0; i < parameters.samples; i++) {
|
|
46
|
+
const start = now();
|
|
47
|
+
const checksum = fn(...input.args);
|
|
48
|
+
samplesMs.push(now() - start);
|
|
49
|
+
if (!Object.is(checksum, expected)) throw new Error(`${mode} checksum mismatch: ${input.name}`);
|
|
50
|
+
checksums.push(checksum);
|
|
51
|
+
}
|
|
52
|
+
measurements[mode] = { samplesMs, checksums };
|
|
53
|
+
}
|
|
54
|
+
results.push({ name: input.name, measurements });
|
|
55
|
+
}
|
|
56
|
+
return results;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function validateDirectWasmReport(report, { verifySources = true } = {}) {
|
|
60
|
+
assert.equal(report.format, "eliscript-direct-wasm-performance");
|
|
61
|
+
assert.equal(report.scope, "numeric-f64 whole-program hot execution; not complete compiler performance");
|
|
62
|
+
assert.deepEqual(report.parameters, parameters, "budgets and sample policy are fixed before measurement");
|
|
63
|
+
assert.deepEqual(report.inputs, inputs);
|
|
64
|
+
if (verifySources) assert.deepEqual(report.sourceHashes, await sourceHashes());
|
|
65
|
+
for (const engine of ["node", "bun", "chromium"]) {
|
|
66
|
+
const sessions = report.sessions.filter(s => s.engine === engine);
|
|
67
|
+
assert.equal(sessions.length, parameters.sessions);
|
|
68
|
+
assert.deepEqual(sessions.map(s => s.session).sort(), [0, 1, 2]);
|
|
69
|
+
for (const session of sessions) {
|
|
70
|
+
assert.equal(session.results.length, inputs.length);
|
|
71
|
+
for (const input of inputs) {
|
|
72
|
+
const result = session.results.find(r => r.name === input.name);
|
|
73
|
+
for (const mode of ["js", "wasm"]) {
|
|
74
|
+
const value = result.measurements[mode];
|
|
75
|
+
assert.equal(value.samplesMs.length, parameters.samples);
|
|
76
|
+
assert.equal(value.checksums.length, parameters.samples);
|
|
77
|
+
assert(value.samplesMs.every(n => Number.isFinite(n) && n > 0));
|
|
78
|
+
assert(value.checksums.every(n => Object.is(n, report.expected[input.name])));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const expectedSummary = summarize(report.sessions);
|
|
84
|
+
assert.deepEqual(report.summary, expectedSummary);
|
|
85
|
+
assert.deepEqual(report.decision, {
|
|
86
|
+
productionPassed: expectedSummary.every(item => item.speedup >= parameters.minimumSpeedup),
|
|
87
|
+
minimumSpeedup: parameters.minimumSpeedup,
|
|
88
|
+
});
|
|
89
|
+
assert.equal(report.artifacts.wasmImports, 0);
|
|
90
|
+
assert.equal(report.artifacts.externalBackend, false);
|
|
91
|
+
for (const key of ["javascriptSha256", "wasmSha256"]) assert.match(report.artifacts[key], /^[a-f0-9]{64}$/);
|
|
92
|
+
return report;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function summarize(sessions) {
|
|
96
|
+
return ["node", "bun", "chromium"].flatMap(engine => inputs.map(input => {
|
|
97
|
+
const samples = mode => sessions.filter(s => s.engine === engine)
|
|
98
|
+
.flatMap(s => s.results.find(r => r.name === input.name).measurements[mode].samplesMs);
|
|
99
|
+
const jsMs = median(samples("js")), wasmMs = median(samples("wasm"));
|
|
100
|
+
return { engine, name: input.name, jsMs, wasmMs, speedup: jsMs / wasmMs };
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export async function runDirectWasmBenchmark() {
|
|
105
|
+
const directory = await mkdtemp(resolve(tmpdir(), "eliscript-direct-wasm-perf-"));
|
|
106
|
+
let server;
|
|
107
|
+
try {
|
|
108
|
+
const { compiler, numeric, wasm } = await buildBackends({ outputRoot: directory });
|
|
109
|
+
const source = await readFile(resolve(root, "tools/experiments/native-wasm/kernels.eli"), "utf8") + "\n" + await readFile(resolve(root, "tools/backends/batches.eli"), "utf8");
|
|
110
|
+
const program = compiler.compile_ir_string(source, "direct-batches.eli");
|
|
111
|
+
const javascript = numeric.emit_numeric_javascript(program);
|
|
112
|
+
const bytes = Uint8Array.from(wasm.emit_numeric_wasm(program));
|
|
113
|
+
const jsPath = resolve(directory, "batches.mjs"), wasmPath = resolve(directory, "batches.wasm");
|
|
114
|
+
await writeFile(jsPath, javascript); await writeFile(wasmPath, bytes);
|
|
115
|
+
const runner = resolve(directory, "run.mjs");
|
|
116
|
+
await writeFile(runner, `import{readFile}from'node:fs/promises';const js=await import(process.argv[2]);const wasm=(await WebAssembly.instantiate(await readFile(process.argv[3]))).instance.exports;const results=(${measure.toString()})(js,wasm,Number(process.argv[4]),${JSON.stringify(inputs)},${JSON.stringify(parameters)},()=>performance.now());console.log(JSON.stringify({version:process.version,results}));`);
|
|
117
|
+
server = createServer((request, response) => {
|
|
118
|
+
response.setHeader("Cross-Origin-Opener-Policy", "same-origin");
|
|
119
|
+
response.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
|
|
120
|
+
response.setHeader("Content-Type", request.url === "/batches.mjs" ? "text/javascript" : request.url === "/batches.wasm" ? "application/wasm" : "text/html");
|
|
121
|
+
response.end(request.url === "/batches.mjs" ? javascript : request.url === "/batches.wasm" ? bytes : "<!doctype html><title>Direct WASM benchmark</title>");
|
|
122
|
+
});
|
|
123
|
+
await new Promise(r => server.listen(0, "127.0.0.1", r));
|
|
124
|
+
const sessions = [];
|
|
125
|
+
for (let session = 0; session < parameters.sessions; session++) {
|
|
126
|
+
for (const engine of session & 1 ? ["bun", "node"] : ["node", "bun"]) {
|
|
127
|
+
const result = spawnSync(engine, [runner, pathToFileURL(jsPath).href, wasmPath, String(session)], { encoding: "utf8", timeout: 120_000 });
|
|
128
|
+
assert.equal(result.status, 0, result.stderr);
|
|
129
|
+
sessions.push({ engine, session, ...JSON.parse(result.stdout) });
|
|
130
|
+
}
|
|
131
|
+
const browser = await chromium.launch();
|
|
132
|
+
try {
|
|
133
|
+
const page = await browser.newPage();
|
|
134
|
+
await page.goto(`http://127.0.0.1:${server.address().port}`);
|
|
135
|
+
const results = await page.evaluate(async ({ code, session, inputs, parameters }) => {
|
|
136
|
+
const js = await import("/batches.mjs");
|
|
137
|
+
const wasm = (await WebAssembly.instantiate(await (await fetch("/batches.wasm")).arrayBuffer())).instance.exports;
|
|
138
|
+
return (0, eval)(`(${code})`)(js, wasm, session, inputs, parameters, () => performance.now());
|
|
139
|
+
}, { code: measure.toString(), session, inputs, parameters });
|
|
140
|
+
sessions.push({ engine: "chromium", session, version: browser.version(), results });
|
|
141
|
+
} finally { await browser.close(); }
|
|
142
|
+
}
|
|
143
|
+
const module = new WebAssembly.Module(bytes);
|
|
144
|
+
const instance = new WebAssembly.Instance(module);
|
|
145
|
+
const report = {
|
|
146
|
+
format: "eliscript-direct-wasm-performance", generatedAt: new Date().toISOString(),
|
|
147
|
+
scope: "numeric-f64 whole-program hot execution; not complete compiler performance",
|
|
148
|
+
environment: { platform: platform(), arch: arch(), cpu: cpus()[0].model },
|
|
149
|
+
parameters, inputs, sourceHashes: await sourceHashes(),
|
|
150
|
+
artifacts: { javascriptSha256: hash(javascript), wasmSha256: hash(bytes), wasmBytes: bytes.length,
|
|
151
|
+
wasmImports: WebAssembly.Module.imports(module).length, externalBackend: false },
|
|
152
|
+
expected: Object.fromEntries(inputs.map(input => [input.name, instance.exports[input.wasmFn](...input.args)])),
|
|
153
|
+
sessions, summary: summarize(sessions),
|
|
154
|
+
};
|
|
155
|
+
report.decision = { productionPassed: report.summary.every(s => s.speedup >= parameters.minimumSpeedup), minimumSpeedup: parameters.minimumSpeedup };
|
|
156
|
+
return await validateDirectWasmReport(report);
|
|
157
|
+
} finally {
|
|
158
|
+
if (server) await new Promise(r => server.close(r));
|
|
159
|
+
await rm(directory, { recursive: true, force: true });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
164
|
+
const args = process.argv.slice(2);
|
|
165
|
+
assert(args.every(a => ["--verify", "--require-production"].includes(a)), "unknown benchmark argument");
|
|
166
|
+
const report = args.length
|
|
167
|
+
? await validateDirectWasmReport(JSON.parse(await readFile(reportPath, "utf8")))
|
|
168
|
+
: await runDirectWasmBenchmark();
|
|
169
|
+
if (!args.length) {
|
|
170
|
+
await mkdir(resolve(root, "tools/backends/results"), { recursive: true });
|
|
171
|
+
await writeFile(reportPath, JSON.stringify(report, null, 2) + "\n");
|
|
172
|
+
}
|
|
173
|
+
console.log(JSON.stringify({ summary: report.summary, decision: report.decision }, null, 2));
|
|
174
|
+
if (args.includes("--require-production") && !report.decision.productionPassed) process.exitCode = 1;
|
|
175
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { mkdir, readFile, readdir, writeFile, symlink, realpath } from "node:fs/promises";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { resolve, dirname, relative } from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
|
|
6
|
+
export const root = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
7
|
+
export const backendModules = Object.freeze((await readdir(resolve(root, "bootstrap/backends")))
|
|
8
|
+
.filter(name => /^[a-z][a-z0-9-]*[.]eli$/.test(name)).sort().map(name => name.slice(0, -4)));
|
|
9
|
+
|
|
10
|
+
export async function loadLiteralSources({sourceRoot = root} = {}) {
|
|
11
|
+
const records = [];
|
|
12
|
+
const inputs = ['bit', 'persistent-list', 'persistent-vector', 'persistent-map', 'persistent-set', 'value',
|
|
13
|
+
'managed-queue-state', 'managed-vector-view-state', 'managed-transient-state', 'managed-sorted-state',
|
|
14
|
+
'managed-value-state'].map(name => ({
|
|
15
|
+
id: 'stdlib/' + name + '.mjs', filename: 'stdlib/' + name + '.eli',
|
|
16
|
+
}));
|
|
17
|
+
inputs.push(
|
|
18
|
+
{id: 'runtime/core/protocol-error.mjs', filename: 'stdlib/managed-protocol-error.eli'},
|
|
19
|
+
{id: 'stdlib/core/protocol.mjs', filename: 'stdlib/core/protocol.eli'},
|
|
20
|
+
{id: 'stdlib/core/text.mjs', filename: 'stdlib/core/text.eli'},
|
|
21
|
+
{id: 'stdlib/core/object.mjs', filename: 'stdlib/core/object.eli'},
|
|
22
|
+
{id: 'stdlib/core/set.mjs', filename: 'stdlib/core/set.eli'},
|
|
23
|
+
{id: 'stdlib/core/data.mjs', filename: 'stdlib/core/data.eli'},
|
|
24
|
+
{id: 'stdlib/managed-literal-protocols.mjs', filename: 'stdlib/managed-literal-protocols.eli'},
|
|
25
|
+
{id: 'stdlib/managed-literals.mjs', filename: 'stdlib/managed-literals.eli'},
|
|
26
|
+
);
|
|
27
|
+
for (const name of ['list', 'vector', 'map', 'set', 'queue', 'identifier', 'record', 'value', 'metadata', 'collection', 'transient', 'protocol', 'type',
|
|
28
|
+
'order', 'sorted', 'regex', 'transducer', 'lazy-sequence', 'truth', 'text', 'object', 'sequence',
|
|
29
|
+
'set-algebra', 'collection-internals', 'metadata-internals', 'persistent-kind', 'data', 'data-text', 'value-internals']) {
|
|
30
|
+
inputs.push({id: 'runtime/core/' + name + '.mjs', filename: 'stdlib/managed-runtime-' + name + '.eli'});
|
|
31
|
+
}
|
|
32
|
+
inputs.push({id: 'runtime/literals.mjs', filename: 'stdlib/managed-runtime-literals.eli'});
|
|
33
|
+
inputs.push(
|
|
34
|
+
{id: 'runtime/wire/markdown.mjs', filename: 'stdlib/managed-wire-markdown.eli'},
|
|
35
|
+
{id: 'runtime/wire/schema.mjs', filename: 'stdlib/managed-wire-schema.eli'},
|
|
36
|
+
{id: 'runtime/wire/http-rpc.mjs', filename: 'stdlib/managed-wire-http-rpc.eli'},
|
|
37
|
+
{id: 'runtime/testing/value.mjs', filename: 'stdlib/managed-testing-value.eli'},
|
|
38
|
+
);
|
|
39
|
+
for (const {id, filename} of inputs) {
|
|
40
|
+
const source = new TextDecoder('utf-8', {fatal: true, ignoreBOM: true})
|
|
41
|
+
.decode(await readFile(resolve(sourceRoot, filename)));
|
|
42
|
+
records.push({id, filename, source});
|
|
43
|
+
}
|
|
44
|
+
return records;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// This adapter only loads files and runs the bootstrap seed when requested.
|
|
48
|
+
// Optimization, typed lowering, WASM and native encoding live in the .eli modules.
|
|
49
|
+
export async function buildBackends({ outputRoot = resolve(root, "dist"), seed = false, frontend } = {}) {
|
|
50
|
+
const compilerDirectory = resolve(outputRoot, "bootstrap");
|
|
51
|
+
const directory = resolve(outputRoot, "backends");
|
|
52
|
+
// Seed-produced modules may import the public persistent-literal runtime.
|
|
53
|
+
// An out-of-tree bootstrap needs the same actual package as in-tree output.
|
|
54
|
+
const packageDirectory = resolve(outputRoot, "node_modules");
|
|
55
|
+
const packageLink = resolve(packageDirectory, "eliscript");
|
|
56
|
+
await mkdir(packageDirectory, { recursive: true });
|
|
57
|
+
try {await symlink(root, packageLink, "dir");}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error.code !== "EEXIST") throw error;
|
|
60
|
+
if (await realpath(packageLink) !== await realpath(root)) {
|
|
61
|
+
throw new Error("backend bootstrap resolves a different Eliscript runtime package");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const modules = (await readdir(resolve(root, "bootstrap/compiler")))
|
|
65
|
+
.filter(name => /^[a-z][a-z0-9-]*[.]eli$/.test(name)).sort()
|
|
66
|
+
.map(name => name.slice(0, -4));
|
|
67
|
+
if (!modules.includes("compiler")) throw new Error("bootstrap compiler module is missing");
|
|
68
|
+
await mkdir(compilerDirectory, { recursive: true });
|
|
69
|
+
if (!frontend) {
|
|
70
|
+
const result = spawnSync(process.env.EMACS ?? "emacs", [
|
|
71
|
+
"--batch", "-Q", "--script", resolve(root, "tools/bootstrap-seed.el"),
|
|
72
|
+
"--", root, compilerDirectory, ...modules,
|
|
73
|
+
], {
|
|
74
|
+
cwd: root, encoding: "utf8", timeout: 120_000,
|
|
75
|
+
env: { ...process.env },
|
|
76
|
+
});
|
|
77
|
+
if (result.status !== 0) throw new Error(result.stderr || String(result.error));
|
|
78
|
+
} else {
|
|
79
|
+
// Backends import sibling bootstrap modules (including IR validation).
|
|
80
|
+
// Emit the complete dependency graph with the caller's compiler itself;
|
|
81
|
+
// a supplied frontend must never silently select a seed for these files.
|
|
82
|
+
for (const name of modules) {
|
|
83
|
+
const sourcePath = resolve(root, `bootstrap/compiler/${name}.eli`);
|
|
84
|
+
const source = await readFile(sourcePath, "utf8");
|
|
85
|
+
const emission = frontend.compile_string_with_source_map(source, sourcePath,
|
|
86
|
+
`${name}.mjs`, relative(compilerDirectory, sourcePath));
|
|
87
|
+
await writeFile(resolve(compilerDirectory, `${name}.mjs`),
|
|
88
|
+
`${emission.javascript}//# sourceMappingURL=${name}.mjs.map\n`);
|
|
89
|
+
await writeFile(resolve(compilerDirectory, `${name}.mjs.map`), emission.sourceMap);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const compiler = frontend ?? await import(pathToFileURL(resolve(compilerDirectory, "compiler.mjs")).href);
|
|
93
|
+
await mkdir(directory, { recursive: true });
|
|
94
|
+
for (const name of backendModules) {
|
|
95
|
+
const sourcePath = resolve(root, `bootstrap/backends/${name}.eli`);
|
|
96
|
+
const outputPath = resolve(directory, `${name}.mjs`);
|
|
97
|
+
if (seed) {
|
|
98
|
+
const child = spawnSync(resolve(root, "bin/eliscript-seed"), ["--source-map", "--output", outputPath, sourcePath], {
|
|
99
|
+
cwd: root, encoding: "utf8", timeout: 120_000,
|
|
100
|
+
});
|
|
101
|
+
if (child.status !== 0) {
|
|
102
|
+
const failure = new Error(`Seed backend ${name} (${sourcePath}): ${child.stderr || String(child.error)}`,
|
|
103
|
+
{cause: child.error});
|
|
104
|
+
failure.compilerModule = name;failure.sourcePath = sourcePath;
|
|
105
|
+
failure.exitCode = child.status;failure.signal = child.signal;
|
|
106
|
+
throw failure;
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
const source = await readFile(sourcePath, "utf8");
|
|
110
|
+
const emission = compiler.compile_string_with_source_map(source, sourcePath, `${name}.mjs`, relative(directory, sourcePath));
|
|
111
|
+
await writeFile(outputPath, `${emission.javascript}//# sourceMappingURL=${name}.mjs.map\n`);
|
|
112
|
+
await writeFile(`${outputPath}.map`, emission.sourceMap);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
compiler, directory,
|
|
117
|
+
async loadLiteralModules() {
|
|
118
|
+
const literalSources = await loadLiteralSources();
|
|
119
|
+
return {literalSources, literalModules: literalSources.map(record => ({id: record.id,
|
|
120
|
+
program: compiler.compile_ir_string(record.source, record.filename)}))};
|
|
121
|
+
},
|
|
122
|
+
optimizer: await import(pathToFileURL(resolve(directory, "optimize.mjs")).href),
|
|
123
|
+
numeric: await import(pathToFileURL(resolve(directory, "numeric.mjs")).href),
|
|
124
|
+
wasm: await import(pathToFileURL(resolve(directory, "wasm.mjs")).href),
|
|
125
|
+
native: await import(pathToFileURL(resolve(directory, "native.mjs")).href),
|
|
126
|
+
sha256: await import(pathToFileURL(resolve(directory, "sha256.mjs")).href),
|
|
127
|
+
regexp: await import(pathToFileURL(resolve(directory, "regexp.mjs")).href),
|
|
128
|
+
managed: await import(pathToFileURL(resolve(directory, "managed.mjs")).href),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
133
|
+
const result = await buildBackends();
|
|
134
|
+
process.stdout.write(`${result.directory}\n`);
|
|
135
|
+
}
|