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,55 @@
|
|
|
1
|
+
;;; bootstrap-seed.el --- Seed compiler modules in one process -*- lexical-binding: t; -*-
|
|
2
|
+
|
|
3
|
+
;;; Commentary:
|
|
4
|
+
;; This private build entry uses the same file compiler as the seed CLI.
|
|
5
|
+
;; Outputs remain independent modules with their original source maps.
|
|
6
|
+
|
|
7
|
+
;;; Code:
|
|
8
|
+
|
|
9
|
+
(eval-and-compile
|
|
10
|
+
(let ((source (or load-file-name buffer-file-name
|
|
11
|
+
(and (boundp 'byte-compile-current-file)
|
|
12
|
+
(symbol-value 'byte-compile-current-file)))))
|
|
13
|
+
(when source
|
|
14
|
+
(add-to-list 'load-path
|
|
15
|
+
(expand-file-name "../compiler"
|
|
16
|
+
(file-name-directory source)))
|
|
17
|
+
(add-to-list 'load-path (file-name-directory source)))))
|
|
18
|
+
(require 'eliscript)
|
|
19
|
+
(require 'eliscript-bootstrap-runtime "bootstrap-runtime")
|
|
20
|
+
|
|
21
|
+
(defun eliscript-bootstrap-seed-main (arguments)
|
|
22
|
+
"Compile the compiler modules named by ARGUMENTS using the normal seed API."
|
|
23
|
+
(when (equal (car arguments) "--")
|
|
24
|
+
(setq arguments (cdr arguments)))
|
|
25
|
+
(let ((root (pop arguments))
|
|
26
|
+
(output (pop arguments)))
|
|
27
|
+
(unless (and root output arguments)
|
|
28
|
+
(error "bootstrap seed requires project, output and module names"))
|
|
29
|
+
;; Validate the complete request before publishing runtime files or even
|
|
30
|
+
;; creating OUTPUT. A malformed later name cannot leave a partial seed.
|
|
31
|
+
(dolist (name arguments)
|
|
32
|
+
(unless (string-match-p "\\`[a-z][a-z-]*\\'" name)
|
|
33
|
+
(error "invalid bootstrap module name: %s" name)))
|
|
34
|
+
(make-directory output t)
|
|
35
|
+
(eliscript-bootstrap-prepare-runtime root output)
|
|
36
|
+
;; An independent seed owns OUTPUT. Do not replace an already installed
|
|
37
|
+
;; stage3 host/runtime in ROOT while creating an unrelated compiler fixture.
|
|
38
|
+
(eliscript-bootstrap-prepare-project-host
|
|
39
|
+
root (not (equal (file-truename output)
|
|
40
|
+
(file-truename (expand-file-name "dist/bootstrap" root)))))
|
|
41
|
+
(dolist (name arguments)
|
|
42
|
+
(eliscript-compile-file-with-source-map
|
|
43
|
+
(expand-file-name (concat "bootstrap/compiler/" name ".eli") root)
|
|
44
|
+
(expand-file-name (concat name ".mjs") output)))))
|
|
45
|
+
|
|
46
|
+
(let ((arguments command-line-args-left))
|
|
47
|
+
(setq command-line-args-left nil)
|
|
48
|
+
(condition-case error-data
|
|
49
|
+
(eliscript-bootstrap-seed-main arguments)
|
|
50
|
+
(error
|
|
51
|
+
(message "eliscript: %s"
|
|
52
|
+
(eliscript-diagnostic-condition-message error-data))
|
|
53
|
+
(kill-emacs 1))))
|
|
54
|
+
|
|
55
|
+
;;; bootstrap-seed.el ends here
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
(module tools.project.check-cli
|
|
2
|
+
(import "node:fs" readFileSync)
|
|
3
|
+
(import "node:path" resolve)
|
|
4
|
+
(import "node:url" fileURLToPath)
|
|
5
|
+
(import "./check-cli-legacy.mjs" :as legacy)
|
|
6
|
+
(import "./bun.mjs" diagnosticFromError renderDiagnostic requestedDiagnosticFormat)
|
|
7
|
+
(defconst parseArguments (get legacy :parseArguments))
|
|
8
|
+
(defasync execute (arguments &rest supplied)
|
|
9
|
+
(let* ((arguments (Array/from arguments))
|
|
10
|
+
(options (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0))) (js-object) (aref supplied 0)))
|
|
11
|
+
(parsed (parseArguments arguments)))
|
|
12
|
+
(when (and (not (undefined? (get parsed :stdinFile))) (nullish? (get options :stdinSource)))
|
|
13
|
+
(setq options (Object/assign (js-object) options (js-object :stdinSource (readFileSync 0 "utf8")))))
|
|
14
|
+
(await (js-call legacy :execute arguments options))))
|
|
15
|
+
(defasync main (&rest supplied)
|
|
16
|
+
(let* ((arguments (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0)))
|
|
17
|
+
(js-call (get globalThis.process :argv) :slice 2) (aref supplied 0)))
|
|
18
|
+
(execution (await (execute arguments))))
|
|
19
|
+
(if (get execution :help) (await (js-call legacy :main arguments))
|
|
20
|
+
(js-call (get globalThis.process :stdout) :write
|
|
21
|
+
(str (if (get execution :jsonReport) (JSON/stringify (get (get execution :result) :report))
|
|
22
|
+
(str "Checked " (get (get (get (get execution :result) :report) :counts) :modules) " modules.")) "\n")))))
|
|
23
|
+
(let ((entry (aref (get globalThis.process :argv) 1)))
|
|
24
|
+
(when (and (not (undefined? entry)) (= (resolve entry) (fileURLToPath (js* "import.meta.url"))))
|
|
25
|
+
(let ((format (requestedDiagnosticFormat (js-call (get globalThis.process :argv) :slice 2))))
|
|
26
|
+
(js-call (main) :catch (lambda (error)
|
|
27
|
+
(let ((diagnostic (diagnosticFromError error)))
|
|
28
|
+
(if (= format "json") (console/error (JSON/stringify diagnostic))
|
|
29
|
+
(console/error (str "eliscript-check: " (renderDiagnostic diagnostic))))
|
|
30
|
+
(put globalThis.process :exitCode 1)))))))
|
|
31
|
+
(export parseArguments execute main))
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
(module tools.project.project-cli
|
|
2
|
+
(import "node:fs" readFileSync)
|
|
3
|
+
(import "node:path" resolve)
|
|
4
|
+
(import "node:url" fileURLToPath)
|
|
5
|
+
(import "./project-cli-legacy.mjs" :as legacy)
|
|
6
|
+
(import "./bun.mjs" diagnosticFromError renderDiagnostic requestedDiagnosticFormat)
|
|
7
|
+
(defconst parseConfigurationJson (get legacy :parseConfigurationJson))
|
|
8
|
+
(defconst parseArguments (get legacy :parseArguments))
|
|
9
|
+
(defconst readProjectConfiguration (get legacy :readProjectConfiguration))
|
|
10
|
+
(defconst usage "Usage: eliscript-build [OPTIONS] [ENTRY ...]\n\nOptions:\n --out-dir DIR Write the generated module tree to DIR\n --config FILE Read a versioned project request from FILE\n --root DIR Contain local source imports below DIR\n --portable NAME Emit NAME and its transitive portable closure\n --stdin-file FILE Use standard input as the current contents of FILE\n --no-cache Disable cache reads for this build\n --json Print the versioned build decision report\n --diagnostic-format human|json\n Select human-readable or JSON failures\n -h, --help Show this help\n")
|
|
11
|
+
(defasync execute (arguments &rest supplied)
|
|
12
|
+
(let* ((options (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0)))
|
|
13
|
+
(js-object) (aref supplied 0)))
|
|
14
|
+
;; Consume an arbitrary argument iterable once, just as the original
|
|
15
|
+
;; parser's spread did. Both parses then see the same plain snapshot.
|
|
16
|
+
(arguments (Array/from arguments))
|
|
17
|
+
(parsed (funcall parseArguments arguments)))
|
|
18
|
+
(when (and (not (undefined? (get parsed :stdinFile)))
|
|
19
|
+
(nullish? (get options :stdinSource)))
|
|
20
|
+
;; fs/promises.readFile accepts a path or FileHandle, not numeric fd 0.
|
|
21
|
+
;; The synchronous fs API preserves UTF8 decoding and real EOF, while
|
|
22
|
+
;; an explicitly supplied source (including "") must never consume fd0.
|
|
23
|
+
(setq options (Object/assign (js-object) options
|
|
24
|
+
(js-object :stdinSource (readFileSync 0 "utf8")))))
|
|
25
|
+
(await (js-call legacy :execute arguments options))))
|
|
26
|
+
(defasync main (&rest arguments)
|
|
27
|
+
(let* ((arguments (if (or (= (js-length arguments) 0) (undefined? (aref arguments 0)))
|
|
28
|
+
(js-call (get globalThis.process :argv) :slice 2) (aref arguments 0)))
|
|
29
|
+
(execution (await (execute arguments))))
|
|
30
|
+
(if (get execution :help) (js-call (get globalThis.process :stdout) :write usage)
|
|
31
|
+
(js-call (get globalThis.process :stdout) :write
|
|
32
|
+
(str (if (get execution :jsonReport) (JSON/stringify (get (get execution :result) :report))
|
|
33
|
+
(js-call (get (get execution :result) :entryOutputs) :join "\n")) "\n")))))
|
|
34
|
+
(let ((entry (aref (get globalThis.process :argv) 1)))
|
|
35
|
+
(when (and (not (undefined? entry)) (= (resolve entry) (fileURLToPath (js* "import.meta.url"))))
|
|
36
|
+
(let ((format (requestedDiagnosticFormat (js-call (get globalThis.process :argv) :slice 2))))
|
|
37
|
+
(js-call (main) :catch (lambda (error)
|
|
38
|
+
(let ((diagnostic (diagnosticFromError error)))
|
|
39
|
+
(if (= format "json") (console/error (JSON/stringify diagnostic))
|
|
40
|
+
(console/error (str "eliscript-build: " (renderDiagnostic diagnostic))))
|
|
41
|
+
(put globalThis.process :exitCode 1)))))))
|
|
42
|
+
(export parseConfigurationJson parseArguments readProjectConfiguration execute main))
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
(module tools.project.project
|
|
2
|
+
(import "node:crypto" createHash)
|
|
3
|
+
(import "node:fs" lstatSync mkdirSync readFileSync realpathSync writeFileSync)
|
|
4
|
+
(import "node:path" basename dirname resolve)
|
|
5
|
+
(import "node:url" fileURLToPath)
|
|
6
|
+
(import "node:buffer" Buffer)
|
|
7
|
+
(import "node:module" createRequire)
|
|
8
|
+
(import "./project-legacy.mjs" :as legacy)
|
|
9
|
+
|
|
10
|
+
(defconst checkProject (get legacy :checkProject))
|
|
11
|
+
(defconst source-root (resolve (dirname (fileURLToPath (js* "import.meta.url"))) "../.."))
|
|
12
|
+
(defconst capsules (js-array "math" "unicode-case" "unicode-case-data"))
|
|
13
|
+
(defun digest (bytes) (js-call (js-call (createHash "sha256") :update bytes) :digest "hex"))
|
|
14
|
+
(defun project-error (message filename)
|
|
15
|
+
(let ((error (new globalThis.Error message)))
|
|
16
|
+
(put error :eliscriptDiagnostic (js-object :format "eliscript-diagnostic" :version 1
|
|
17
|
+
:code "ELI-B0001" :severity "error" :phase "project-build" :message message
|
|
18
|
+
:location (js-object :file filename)))
|
|
19
|
+
(throw error)))
|
|
20
|
+
(defun attributes (path)
|
|
21
|
+
(try (lstatSync path)
|
|
22
|
+
(catch error (if (= (get error :code) "ENOENT") undefined (throw error)))))
|
|
23
|
+
(defun plain-directory (out-dir relative-path)
|
|
24
|
+
(let* ((path (resolve out-dir relative-path)) (value (attributes path)))
|
|
25
|
+
(when value
|
|
26
|
+
(when (js-call value :isSymbolicLink)
|
|
27
|
+
(project-error (str "project runtime support contains a symlink: " relative-path) path))
|
|
28
|
+
(unless (js-call value :isDirectory)
|
|
29
|
+
(project-error (str "project runtime support is not a directory: " relative-path) path)))))
|
|
30
|
+
(defun check-target (base record)
|
|
31
|
+
(let* ((relative-path (get record :path)) (path (resolve base relative-path))
|
|
32
|
+
(value (attributes path)))
|
|
33
|
+
(when value
|
|
34
|
+
(when (js-call value :isSymbolicLink)
|
|
35
|
+
(project-error (str "project runtime support contains a symlink: " relative-path) path))
|
|
36
|
+
(unless (and (js-call value :isFile) (js-call (readFileSync path) :equals (get record :content)))
|
|
37
|
+
(project-error (str "project runtime support conflicts with existing output: " relative-path) path)))
|
|
38
|
+
(not (undefined? value))))
|
|
39
|
+
(defun reject-source-alias (base record inputs)
|
|
40
|
+
(let* ((path (resolve base (get record :path))) (value (attributes path)))
|
|
41
|
+
(when value
|
|
42
|
+
(js-call inputs :forEach (lambda (input)
|
|
43
|
+
(when (and (= (get value :dev) (get input :dev))
|
|
44
|
+
(= (get value :ino) (get input :ino)))
|
|
45
|
+
(project-error (str "project runtime output aliases a source: " (get record :path)) path)))))))
|
|
46
|
+
(defun asset (path content)
|
|
47
|
+
(js-object :path path :bytes (js-length content) :sha256 (digest content)))
|
|
48
|
+
(defun runtime-inputs ()
|
|
49
|
+
(let ((files (js-array)) (identities (js-array)) (inputs (js-array)))
|
|
50
|
+
(js-call capsules :forEach (lambda (name)
|
|
51
|
+
(let* ((source-path (str "runtime/" name ".eli"))
|
|
52
|
+
(module-path (str "runtime/" name ".mjs")) (map-path (str module-path ".map"))
|
|
53
|
+
(source (readFileSync (resolve source-root source-path)))
|
|
54
|
+
(module (readFileSync (resolve source-root module-path)))
|
|
55
|
+
(mapping (readFileSync (resolve source-root map-path)))
|
|
56
|
+
(map (JSON/parse (js-call mapping :toString "utf8"))))
|
|
57
|
+
(js-call (js-array source-path module-path map-path) :forEach (lambda (path)
|
|
58
|
+
(js-call inputs :push (lstatSync (realpathSync (resolve source-root path))))))
|
|
59
|
+
;; The source module and its map are one real generator pair. Keep
|
|
60
|
+
;; every original map coordinate and byte; dist/runtime is another
|
|
61
|
+
;; producer and is never a fallback for either half of this pair.
|
|
62
|
+
(unless (and (= (get map :version) 3) (= (value-type (get map :file)) "string")
|
|
63
|
+
(= (basename (get map :file)) (str name ".mjs"))
|
|
64
|
+
(Array/isArray (get map :sourcesContent)) (= (js-length (get map :sourcesContent)) 1)
|
|
65
|
+
(= (aref (get map :sourcesContent) 0) (js-call source :toString "utf8")))
|
|
66
|
+
(project-error (str "project runtime source and map identity differ: " module-path)
|
|
67
|
+
(resolve source-root map-path)))
|
|
68
|
+
(js-call files :push (js-object :path module-path :content module)
|
|
69
|
+
(js-object :path map-path :content mapping))
|
|
70
|
+
(js-call identities :push (js-object :source (asset source-path source)
|
|
71
|
+
:module (asset module-path module) :sourceMap (asset map-path mapping))))))
|
|
72
|
+
(let ((exports (js-object)))
|
|
73
|
+
(js-call capsules :forEach (lambda (name)
|
|
74
|
+
(put exports (str "./runtime/" name ".mjs") (str "./runtime/" name ".mjs"))))
|
|
75
|
+
(js-call files :push (js-object :path "package.json" :content
|
|
76
|
+
(js-call Buffer :from (str (JSON/stringify (js-object :name "eliscript" :type "module"
|
|
77
|
+
:private t :exports exports)) "\n") "utf8"))))
|
|
78
|
+
(js-call files :push (js-object :path "eliscript-runtime.json" :content
|
|
79
|
+
(js-call Buffer :from (str (JSON/stringify (js-object :format "eliscript-project-runtime"
|
|
80
|
+
:version 1 :capsules identities)) "\n") "utf8")))
|
|
81
|
+
(js-object :files files :inputs inputs)))
|
|
82
|
+
(defun existing-runtime-route (out-dir)
|
|
83
|
+
;; Preserve an already available complete package and its actual provider
|
|
84
|
+
;; identities. A second package with equal bytes is not the same runtime.
|
|
85
|
+
(let ((require (createRequire (resolve out-dir "__eliscript_runtime_scope.mjs"))))
|
|
86
|
+
(try
|
|
87
|
+
(js-call capsules :every (lambda (name)
|
|
88
|
+
(js-call (js-array ".mjs" ".mjs.map") :every (lambda (suffix)
|
|
89
|
+
(= (realpathSync (js-call require :resolve (str "eliscript/runtime/" name suffix)))
|
|
90
|
+
(realpathSync (resolve source-root (str "runtime/" name suffix))))))))
|
|
91
|
+
(catch error false))))
|
|
92
|
+
(defun complete-runtime (result)
|
|
93
|
+
(let* ((out-dir (get result :outDir)) (base (resolve out-dir "node_modules/eliscript"))
|
|
94
|
+
(runtime (runtime-inputs)) (files (get runtime :files))
|
|
95
|
+
(directories (js-array "node_modules" "node_modules/eliscript" "node_modules/eliscript/runtime")))
|
|
96
|
+
;; All source authentication and all user-output conflicts precede the
|
|
97
|
+
;; first support write. The original project manifest/result stay exact.
|
|
98
|
+
(js-call directories :forEach (lambda (path) (plain-directory out-dir path)))
|
|
99
|
+
(unless (and (undefined? (attributes base)) (existing-runtime-route out-dir))
|
|
100
|
+
(js-call files :forEach (lambda (record)
|
|
101
|
+
(check-target base record)
|
|
102
|
+
(reject-source-alias base record (get runtime :inputs))))
|
|
103
|
+
(js-call directories :forEach (lambda (path)
|
|
104
|
+
(plain-directory out-dir path)
|
|
105
|
+
(try (mkdirSync (resolve out-dir path))
|
|
106
|
+
(catch error (unless (= (get error :code) "EEXIST") (throw error))))
|
|
107
|
+
(plain-directory out-dir path)))
|
|
108
|
+
(js-call files :forEach (lambda (record)
|
|
109
|
+
(js-call directories :forEach (lambda (path) (plain-directory out-dir path)))
|
|
110
|
+
(reject-source-alias base record (get runtime :inputs))
|
|
111
|
+
(unless (check-target base record)
|
|
112
|
+
(try (writeFileSync (resolve base (get record :path)) (get record :content) (js-object :flag "wx"))
|
|
113
|
+
(catch error
|
|
114
|
+
(if (= (get error :code) "EEXIST") (check-target base record) (throw error))))))))
|
|
115
|
+
result))
|
|
116
|
+
|
|
117
|
+
(defasync buildProject (options)
|
|
118
|
+
;; Preserve legacy option reads, validation, root isolation, cache, reports,
|
|
119
|
+
;; errors and its frozen return identity. Deployment is only post-success.
|
|
120
|
+
(complete-runtime (await (js-call legacy :buildProject options))))
|
|
121
|
+
|
|
122
|
+
(export checkProject buildProject))
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Generated by unicode-case-data.mjs from pinned Unicode data; Unicode-3.0.
|
|
2
|
+
// Compare only version-dependent behavior once per JS realm, never per WASM call.
|
|
3
|
+
const points = [411,612,661,2199,6863,6864,6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,6880,6881,6882,6883,6884,6885,6886,6887,6888,6889,6890,6891,7305,7306,42955,42956,42957,42958,42959,42962,42963,42964,42965,42970,42971,42972,42993,68942,68944,68945,68946,68947,68948,68949,68950,68951,68952,68953,68954,68955,68956,68957,68958,68959,68960,68961,68962,68963,68964,68965,68969,68970,68971,68972,68973,68975,68976,68977,68978,68979,68980,68981,68982,68983,68984,68985,68986,68987,68988,68989,68990,68991,68992,68993,68994,68995,68996,68997,69317,69370,69371,69372,70587,70588,70589,70590,70591,70592,70606,70608,70610,70625,70626,71454,72544,72546,72547,72548,72550,73177,73562,90398,90399,90400,90401,90402,90403,90404,90405,90406,90407,90408,90409,90413,90414,90415,93504,93505,93506,93547,93548,93856,93857,93858,93859,93860,93861,93862,93863,93864,93865,93866,93867,93868,93869,93870,93871,93872,93873,93874,93875,93876,93877,93878,93879,93880,93883,93884,93885,93886,93887,93888,93889,93890,93891,93892,93893,93894,93895,93896,93897,93898,93899,93900,93901,93902,93903,93904,93905,93906,93907,94194,94195,124398,124399,124643,124646,124654,124655,124661,124671];
|
|
4
|
+
const profiles = [[151,["ƛ\u0000ɤ\u0000ʕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ꟓ\u0000\u0000ꟕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000𑜞\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","ƛ\u0000ɤ\u0000ʕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ꟓ\u0000\u0000ꟕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000𑜞\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","11100000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","00011111111111111111111111111111111111101011111111111111111111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"]],[160,["\u0000\u0000ʕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ꟓ\u0000\u0000ꟕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000𑜞\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","ƛ\u0000ɤ\u0000ʕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ɤ\u0000\u0000\u0000\u0000\u0000\u0000ꟓ\u0000\u0000ꟕ\u0000\u0000\u0000ƛ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000𑜞\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","11100000000000000000000000000001111100010111100111111111111111111111100000011111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","00001111111111111111111111111110000011101000010000000000000000000000000000000000000000000000000001110000000000001111111000000000000000000000111111111111111111111111111111111111111111111111111100111111"]],[170,["\u0000\u0000ʕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000𑜞\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","ƛ\u0000ɤ\u0000ʕ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000ɤ\u0000\u0000\u0000\u0000\u0000ꟓ\u0000ꟓ\u0000ꟕ\u0000ꟕ\u0000\u0000\u0000ƛ\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000𑜞\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","11000000000000000000000000000001111111111111100111111111111111111111100000011111111111111111111110000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111110000000000","00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"]]];
|
|
5
|
+
let cached;
|
|
6
|
+
export function hostUnicodeCaseVersion() {
|
|
7
|
+
if (cached !== undefined) return cached;
|
|
8
|
+
const chars = points.map(p => String.fromCodePoint(p));
|
|
9
|
+
const actual = [chars.map(s => s.toUpperCase()).join('\0'), chars.map(s => s.toLowerCase()).join('\0'), chars.map(s => Number((s + 'Σ').toLowerCase().endsWith('ς'))).join(''), chars.map(s => Number(('AΣ' + s + 'A').toLowerCase().startsWith('aς'))).join('')];
|
|
10
|
+
const profile = profiles.find(([, expected]) => expected.every((s, i) => s === actual[i]));
|
|
11
|
+
if (!profile) throw new Error('unsupported host Unicode case data; select an explicit supported unicodeVersion');
|
|
12
|
+
return cached = profile[0];
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
;;; unicode-case-runtime.el --- Derive JS-profile tables from owned runtime data -*- lexical-binding: t; -*-
|
|
2
|
+
|
|
3
|
+
(require 'cl-lib)
|
|
4
|
+
|
|
5
|
+
(defun eliscript-unicode-case-runtime-rename (form)
|
|
6
|
+
"Translate only the pure numeric table vocabulary in FORM."
|
|
7
|
+
(cond ((consp form) (mapcar #'eliscript-unicode-case-runtime-rename form))
|
|
8
|
+
((eq form 'word-and) 'bit-and)
|
|
9
|
+
((and (symbolp form) (string-prefix-p "heap-unicode-" (symbol-name form)))
|
|
10
|
+
(intern (concat "unicode-case-data-" (substring (symbol-name form) 13))))
|
|
11
|
+
(t form)))
|
|
12
|
+
|
|
13
|
+
(defun eliscript-generate-unicode-case-runtime-data (root)
|
|
14
|
+
"Generate ignored Eli data from ROOT's sole maintained Unicode case region."
|
|
15
|
+
(let* ((source (expand-file-name "bootstrap/runtime/memory.eli" root))
|
|
16
|
+
(destination (expand-file-name "runtime/unicode-case-data.eli" root))
|
|
17
|
+
(begin " ;; BEGIN GENERATED UNICODE CASE DATA")
|
|
18
|
+
(end " ;; END GENERATED UNICODE CASE DATA")
|
|
19
|
+
region declarations names)
|
|
20
|
+
(with-temp-buffer
|
|
21
|
+
(let ((coding-system-for-read 'utf-8-unix)) (insert-file-contents source))
|
|
22
|
+
(goto-char (point-min))
|
|
23
|
+
(unless (search-forward begin nil t) (error "Unicode case source region is missing"))
|
|
24
|
+
(let ((start (- (point) (length begin))))
|
|
25
|
+
(unless (search-forward end nil t) (error "Unicode case source region is incomplete"))
|
|
26
|
+
(setq region (buffer-substring-no-properties start (point)))))
|
|
27
|
+
(with-temp-buffer
|
|
28
|
+
(insert region) (goto-char (point-min))
|
|
29
|
+
(condition-case nil
|
|
30
|
+
(while t
|
|
31
|
+
(let ((form (read (current-buffer))))
|
|
32
|
+
(unless (and (consp form) (eq (car form) 'defun))
|
|
33
|
+
(error "Unicode case region contains a nonfunction form"))
|
|
34
|
+
(when (string-match-p
|
|
35
|
+
"\\`heap-unicode-\\(?:\\(?:upper\\|lower\\)-[012]\\|cased\\|case-ignorable\\)-\\(?:17\\|160\\|151\\)\\'"
|
|
36
|
+
(symbol-name (cadr form)))
|
|
37
|
+
(let ((translated (eliscript-unicode-case-runtime-rename form)))
|
|
38
|
+
(push translated declarations) (push (cadr translated) names)))))
|
|
39
|
+
(end-of-file nil)))
|
|
40
|
+
(unless (= (length declarations) 24)
|
|
41
|
+
(error "Unicode case source must provide all 24 pure per-version functions"))
|
|
42
|
+
(let* ((print-length nil) (print-level nil) (print-circle nil)
|
|
43
|
+
(digest (secure-hash 'sha256 (encode-coding-string region 'utf-8-unix)))
|
|
44
|
+
(text (concat
|
|
45
|
+
";; Generated from bootstrap/runtime/memory.eli; do not edit.\n"
|
|
46
|
+
";; Unicode 15.1 / 16 / 17, Unicode-3.0: https://www.unicode.org/license.txt\n"
|
|
47
|
+
"(module eliscript.runtime.unicode-case-data\n"
|
|
48
|
+
" (defconst unicodeCaseDataSourceSha256 " (prin1-to-string digest) ")\n"
|
|
49
|
+
(mapconcat (lambda (form) (concat " " (prin1-to-string form))) (nreverse declarations) "\n")
|
|
50
|
+
"\n (export unicodeCaseDataSourceSha256 "
|
|
51
|
+
(mapconcat #'symbol-name (nreverse names) " ") "))\n")))
|
|
52
|
+
(make-directory (file-name-directory destination) t)
|
|
53
|
+
(let ((coding-system-for-write 'utf-8-unix))
|
|
54
|
+
(with-temp-file destination (insert text)))
|
|
55
|
+
destination)))
|
|
56
|
+
|
|
57
|
+
(provide 'unicode-case-runtime)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
(module tools.testing.source-debugging-corpus-host
|
|
2
|
+
(import "node:path" resolve)
|
|
3
|
+
(import "./source-debugging.mjs" runSourceDebuggingAcceptance)
|
|
4
|
+
(defasync main ()
|
|
5
|
+
(let* ((root (get (get globalThis.process :env) :ELISCRIPT_ORIGINAL_SOURCE_ROOT))
|
|
6
|
+
(product (aref (get globalThis.process :argv) 2)))
|
|
7
|
+
(unless (and (= (value-type root) "string") (> (js-length root) 0)
|
|
8
|
+
(= (value-type product) "string") (> (js-length product) 0))
|
|
9
|
+
(throw (new globalThis.TypeError "source debugging requires its real source root and selected compiler product")))
|
|
10
|
+
(await (runSourceDebuggingAcceptance (js-object :compilerDirectory (resolve product "bootstrap/compiler"))))))
|
|
11
|
+
(defconst completion (main))
|
|
12
|
+
(js-call completion :catch (lambda (error)
|
|
13
|
+
(console/error (get error :stack error)) (put globalThis.process :exitCode 1)))
|
|
14
|
+
(defun then (fulfill reject)
|
|
15
|
+
(js-call completion :then (lambda (ignored) (funcall fulfill undefined)) reject))
|
|
16
|
+
(export then))
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
(module tools.testing.source-debugging
|
|
2
|
+
(import "node:assert/strict" :default assert)
|
|
3
|
+
(import "node:fs/promises" mkdtemp readFile rm)
|
|
4
|
+
(import "node:path" resolve)
|
|
5
|
+
(import "node:timers" setTimeout clearTimeout)
|
|
6
|
+
(import "../../bootstrap/host/bun.mjs" loadCompiler)
|
|
7
|
+
(import "../../bootstrap/host/evaluation.mjs" EvaluationSession)
|
|
8
|
+
(import "../../runtime/source-mapping.mjs" SourceMappingError mapSourceFrames parseJavaScriptStack sourceMapDescriptor)
|
|
9
|
+
(import "../debugging/check.mjs" checkSourceDebuggingCorpus SourceDebuggingCorpusError validateSourceDebuggingCorpus)
|
|
10
|
+
(import "./fixture-environment.mjs" prepareFixtureEnvironment)
|
|
11
|
+
(import "../backends/build.mjs" :as backend)
|
|
12
|
+
;; A selected program keeps its emitted compiler directory, while fixtures,
|
|
13
|
+
;; package scope and original assertions belong to its authenticated sources.
|
|
14
|
+
(defconst root (get (get globalThis.process :env) :ELISCRIPT_ORIGINAL_SOURCE_ROOT
|
|
15
|
+
(get backend :root)))
|
|
16
|
+
(defconst sourceDebuggingCaseTitles (js-array
|
|
17
|
+
"source mapping decodes V8 and browser stack dialects without a host API"
|
|
18
|
+
"compiler failure preserves its complete Eliscript source span"
|
|
19
|
+
"runtime failure maps through persistent evaluation"
|
|
20
|
+
"browser event and async rejection map under Bun and Node"
|
|
21
|
+
"source debugging corpus is complete and rejects evidence drift"))
|
|
22
|
+
(defconst case-ids (js-array "stack" "compiler" "runtime" "browser" "corpus"))
|
|
23
|
+
(defun options-from (arguments) (if (undefined? (aref arguments 0)) (js-object) (aref arguments 0)))
|
|
24
|
+
(defasync contract () (JSON/parse (await (readFile (resolve root "contracts/source-debugging-corpus.json") "utf8"))))
|
|
25
|
+
(defun acceptance-case (value id)
|
|
26
|
+
(let ((entry (js-call (get value :cases) :find (lambda (candidate) (= (get candidate :id) id)))))
|
|
27
|
+
(unless entry (throw (new globalThis.Error (str "missing source debugging case " id)))) entry))
|
|
28
|
+
(defun presentDebuggingCommandResult (command result &rest arguments)
|
|
29
|
+
(let ((expected (if (undefined? (aref arguments 0)) 0 (aref arguments 0))))
|
|
30
|
+
(unless (= (get result :exitCode) expected)
|
|
31
|
+
(let ((error (new globalThis.Error (str "source debugging child " (JSON/stringify command)
|
|
32
|
+
" exited with " (get result :exitCode) "; expected " expected
|
|
33
|
+
"\nchild stderr:\n" (get result :stderr) "\nchild stdout:\n" (get result :stdout)))))
|
|
34
|
+
(put error :childResult result) (throw error))) result))
|
|
35
|
+
(defasync run-command (command options &rest arguments)
|
|
36
|
+
(let* ((requested (options-from arguments))
|
|
37
|
+
(environment (Object/assign (js-object) (get globalThis.process :env) (get requested :env)))
|
|
38
|
+
(directory (get options :compilerDirectory)))
|
|
39
|
+
(when (and (= (aref command 0) "./bin/eliscript") (not (undefined? directory)))
|
|
40
|
+
(put environment :ELISCRIPT_BOOTSTRAP_MODULE_DIR directory))
|
|
41
|
+
(let* ((child (Bun/spawn command (js-object :cwd root :stdout "pipe" :stderr "pipe" :env environment)))
|
|
42
|
+
(values (await (Promise/all (js-array (get child :exited)
|
|
43
|
+
(js-call (new globalThis.Response (get child :stdout)) :text)
|
|
44
|
+
(js-call (new globalThis.Response (get child :stderr)) :text)))))
|
|
45
|
+
(result (js-object :exitCode (aref values 0) :stdout (aref values 1) :stderr (aref values 2))))
|
|
46
|
+
(presentDebuggingCommandResult command result (get requested :expectedExit)))))
|
|
47
|
+
(defun stack-case ()
|
|
48
|
+
(let* ((descriptor (sourceMapDescriptor (js-object :generatedFile "https://example.test/program.mjs"
|
|
49
|
+
:sources (js-array "https://example.test/program.eli") :mappings "AAAA")))
|
|
50
|
+
(frames (parseJavaScriptStack (js-call (js-array "Error: broken"
|
|
51
|
+
" at run (https://example.test/program.mjs?rev=1:1:1)"
|
|
52
|
+
"event@https://example.test/program.mjs#loaded:1:1") :join "\n"))))
|
|
53
|
+
(js-call assert :deepStrictEqual (mapSourceFrames frames (js-array descriptor)) (js-array
|
|
54
|
+
(js-object :function "run" :file "https://example.test/program.eli" :line 1 :column 1
|
|
55
|
+
:generated (js-object :file "https://example.test/program.mjs?rev=1" :line 1 :column 1))
|
|
56
|
+
(js-object :function "event" :file "https://example.test/program.eli" :line 1 :column 1
|
|
57
|
+
:generated (js-object :file "https://example.test/program.mjs#loaded" :line 1 :column 1))))
|
|
58
|
+
(js-call assert :throws (lambda () (sourceMapDescriptor
|
|
59
|
+
(js-object :generatedFile "broken.mjs" :sources (js-array "broken.eli") :mappings "!"))) SourceMappingError)))
|
|
60
|
+
(defasync compiler-case (options)
|
|
61
|
+
(let* ((value (await (contract))) (entry (acceptance-case value "compiler"))
|
|
62
|
+
(result (await (run-command (js-array "./bin/eliscript" "--diagnostic-format" "json" (get entry :source))
|
|
63
|
+
options (js-object :expectedExit 1))))
|
|
64
|
+
(diagnostic (JSON/parse (get result :stderr))))
|
|
65
|
+
(js-call assert :strictEqual (get result :exitCode) 1)
|
|
66
|
+
(js-call assert :strictEqual (get result :stdout) "")
|
|
67
|
+
(js-call assert :strictEqual (get (get diagnostic :location) :file) (resolve root (get entry :source)))
|
|
68
|
+
(js-call assert :deepStrictEqual (get (get diagnostic :location) :start) (get (get entry :location) :start))
|
|
69
|
+
(js-call assert :deepStrictEqual (get (get diagnostic :location) :end) (get (get entry :location) :end))))
|
|
70
|
+
(defasync runtime-case (options)
|
|
71
|
+
(let* ((value (await (contract))) (entry (acceptance-case value "runtime"))
|
|
72
|
+
(compiler (await (loadCompiler (get options :compilerDirectory))))
|
|
73
|
+
(session (await (js-call EvaluationSession :create (js-object :compiler compiler))))
|
|
74
|
+
(fixture (resolve root "tests/fixtures/evaluation-session/main.eli")))
|
|
75
|
+
(try
|
|
76
|
+
(let ((source (await (readFile fixture "utf8"))))
|
|
77
|
+
(js-call assert :strictEqual (get (await (js-call session :execute
|
|
78
|
+
(js-object :id 1 :operation "load" :source source :filename fixture :root root))) :status) "ok")
|
|
79
|
+
(let ((failure (await (js-call session :execute (js-object :id 2 :operation "evaluate" :source "(explode)" :filename fixture)))))
|
|
80
|
+
(js-call assert :strictEqual (get failure :status) "error")
|
|
81
|
+
(js-call assert :deepStrictEqual (get (get failure :diagnostic) :location)
|
|
82
|
+
(Object/assign (js-object :file (resolve root (get entry :source))) (get entry :location)))
|
|
83
|
+
(js-call assert :strictEqual (js-call (get (get (get failure :diagnostic) :location) :file) :endsWith ".mjs") false)))
|
|
84
|
+
(finally (js-call session :close)))))
|
|
85
|
+
(defasync browser-case (options)
|
|
86
|
+
(let* ((value (await (contract)))
|
|
87
|
+
(fixture (prepareFixtureEnvironment root (get globalThis.process :env)))
|
|
88
|
+
(directory (await (mkdtemp (resolve (get fixture :directory) "eliscript-source-debugging-")))))
|
|
89
|
+
(try
|
|
90
|
+
(let* ((module-file (resolve directory "source-debugging.mjs"))
|
|
91
|
+
(built (await (run-command (js-array "./bin/eliscript" "--source-map" "--output" module-file
|
|
92
|
+
(resolve root "tests/fixtures/source-debugging.eli")) options)))
|
|
93
|
+
(environment (Object/assign (js-object) (get globalThis.process :env)
|
|
94
|
+
(js-object :ELISCRIPT_DEBUG_MODULE module-file :ELISCRIPT_DEBUG_SOURCE_MAP (str module-file ".map"))))
|
|
95
|
+
(host (resolve root "tests/fixtures/source-debugging-host.mjs"))
|
|
96
|
+
(results (await (Promise/all (js-array
|
|
97
|
+
(run-command (js-array (get globalThis.process :execPath) host) options (js-object :env environment))
|
|
98
|
+
(run-command (js-array "node" host) options (js-object :env environment)))))))
|
|
99
|
+
(js-call assert :strictEqual (get built :exitCode) 0)
|
|
100
|
+
(js-call assert :strictEqual (get built :stderr) "")
|
|
101
|
+
(js-call results :forEach (lambda (result)
|
|
102
|
+
(js-call assert :strictEqual (get result :exitCode) 0)
|
|
103
|
+
(js-call assert :strictEqual (get result :stderr) "")
|
|
104
|
+
(let ((failures (JSON/parse (get result :stdout))))
|
|
105
|
+
(js-call assert :deepStrictEqual (js-call failures :map (lambda (item) (get item :kind)))
|
|
106
|
+
(js-array "browser-event" "async-rejection"))
|
|
107
|
+
(js-call failures :forEach (lambda (item)
|
|
108
|
+
(let* ((entry (acceptance-case value (get item :kind))) (location (get (get item :failure) :location))
|
|
109
|
+
(expected (Object/assign (js-object :file (resolve root (get entry :source))) (get entry :location))))
|
|
110
|
+
(js-call (Object/keys expected) :forEach (lambda (key)
|
|
111
|
+
(js-call assert :deepStrictEqual (get location key) (get expected key))))
|
|
112
|
+
(js-call assert :ok (js-call (get (get location :generated) :file) :includes ".mjs"))
|
|
113
|
+
(js-call assert :strictEqual (js-call (get location :file) :endsWith ".eli") t))))))))
|
|
114
|
+
(finally (await (rm directory (js-object :recursive t :force t))) (js-call fixture :close)))))
|
|
115
|
+
(defasync corpus-case ()
|
|
116
|
+
(let ((checked (await (checkSourceDebuggingCorpus (js-object :root root)))))
|
|
117
|
+
(js-call assert :deepStrictEqual (js-call (get checked :cases) :map (lambda (entry) (get entry :id)))
|
|
118
|
+
(js-array "compiler" "runtime" "browser-event" "async-rejection" "worker")))
|
|
119
|
+
(let ((changed (await (contract))))
|
|
120
|
+
(js-call (get changed :cases) :pop)
|
|
121
|
+
(await (js-call assert :rejects (validateSourceDebuggingCorpus changed (js-object :root root)) SourceDebuggingCorpusError))))
|
|
122
|
+
(defasync runSourceDebuggingCase (id &rest arguments)
|
|
123
|
+
(let ((options (options-from arguments)))
|
|
124
|
+
(cond ((= id "stack") (stack-case)) ((= id "compiler") (await (compiler-case options)))
|
|
125
|
+
((= id "runtime") (await (runtime-case options))) ((= id "browser") (await (browser-case options)))
|
|
126
|
+
((= id "corpus") (await (corpus-case)))
|
|
127
|
+
(t (throw (new globalThis.TypeError (str "unknown original source debugging case " id)))))))
|
|
128
|
+
(defasync runSourceDebuggingAcceptance (&rest arguments)
|
|
129
|
+
(let ((options (options-from arguments)) (index 0))
|
|
130
|
+
(while (< index (js-length case-ids))
|
|
131
|
+
(let ((timer undefined))
|
|
132
|
+
(try
|
|
133
|
+
(await (Promise/race (js-array (runSourceDebuggingCase (aref case-ids index) options)
|
|
134
|
+
(new globalThis.Promise (lambda (accept reject)
|
|
135
|
+
(setq timer (setTimeout (lambda () (funcall reject (new globalThis.Error
|
|
136
|
+
(str (aref sourceDebuggingCaseTitles index) " exceeded its original 5000 ms timeout")))) 5000)))))))
|
|
137
|
+
(finally (clearTimeout timer))))
|
|
138
|
+
(setq index (1+ index)))))
|
|
139
|
+
(export sourceDebuggingCaseTitles presentDebuggingCommandResult runSourceDebuggingCase runSourceDebuggingAcceptance))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(module tools.testing.stdlib-bit-corpus-host
|
|
2
|
+
(import "node:path" resolve)
|
|
3
|
+
(import "node:url" fileURLToPath)
|
|
4
|
+
(import "./stdlib-bit.mjs" runStdlibBitAcceptance)
|
|
5
|
+
(defasync main ()
|
|
6
|
+
(let* ((environment (get globalThis.process :env))
|
|
7
|
+
(source-root (get environment :ELISCRIPT_ORIGINAL_SOURCE_ROOT))
|
|
8
|
+
(reference-root (get environment :ELISCRIPT_ORIGINAL_REFERENCE_PRODUCT_ROOT))
|
|
9
|
+
(product (aref (get globalThis.process :argv) 2)))
|
|
10
|
+
(unless (and (= (value-type source-root) "string") (> (js-length source-root) 0)
|
|
11
|
+
(= (value-type reference-root) "string") (> (js-length reference-root) 0)
|
|
12
|
+
(= (value-type product) "string") (> (js-length product) 0))
|
|
13
|
+
(throw (new globalThis.TypeError "complete original bit host requires its selected and independent Seed products")))
|
|
14
|
+
(await (runStdlibBitAcceptance (js-object :sourceRoot source-root
|
|
15
|
+
:selectedDirectory (resolve product "bootstrap/compiler")
|
|
16
|
+
:referenceDirectory (resolve reference-root "bootstrap/compiler"))))))
|
|
17
|
+
(when (and (not (undefined? (aref (get globalThis.process :argv) 1)))
|
|
18
|
+
(= (resolve (aref (get globalThis.process :argv) 1)) (fileURLToPath (js* "import.meta.url"))))
|
|
19
|
+
(js-call (main) :catch (lambda (error)
|
|
20
|
+
(js-call (get globalThis.process :stderr) :write (str (get error :stack error) "\n"))
|
|
21
|
+
(put globalThis.process :exitCode 1)))))
|