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,446 @@
|
|
|
1
|
+
// In-memory compile host for browsers and workers.
|
|
2
|
+
//
|
|
3
|
+
// The command-line host in `bootstrap/host/project.mjs` answers the project
|
|
4
|
+
// planner from the filesystem. This host answers the same questions from a map
|
|
5
|
+
// of sources, so a project compiles without a server process, and it rewrites
|
|
6
|
+
// every specifier the emitted modules carry so they can run from blob URLs.
|
|
7
|
+
//
|
|
8
|
+
// Every import in this file is relative. A worker has no document and therefore
|
|
9
|
+
// no import map, so this module and the compiler bundle it loads must never
|
|
10
|
+
// depend on one.
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
compile_ir_string,
|
|
14
|
+
emit_ir_string_with_source_map,
|
|
15
|
+
project_plan,
|
|
16
|
+
} from "./compiler.js";
|
|
17
|
+
|
|
18
|
+
const SOURCE_EXTENSION = ".eli";
|
|
19
|
+
const OUTPUT_EXTENSION = ".mjs";
|
|
20
|
+
|
|
21
|
+
/* ------------------------------------------------------------------ paths */
|
|
22
|
+
|
|
23
|
+
function splitPath(path) {
|
|
24
|
+
return path.split("/").filter((part) => part !== "" && part !== ".");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function normalizePath(path) {
|
|
28
|
+
const parts = [];
|
|
29
|
+
for (const part of splitPath(path)) {
|
|
30
|
+
if (part === "..") {
|
|
31
|
+
if (parts.length === 0) {
|
|
32
|
+
throw new Error(`path escapes the project root: ${path}`);
|
|
33
|
+
}
|
|
34
|
+
parts.pop();
|
|
35
|
+
} else {
|
|
36
|
+
parts.push(part);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return parts.join("/");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function dirname(path) {
|
|
43
|
+
const parts = splitPath(path);
|
|
44
|
+
parts.pop();
|
|
45
|
+
return parts.join("/");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function resolvePath(importer, specifier) {
|
|
49
|
+
const base = dirname(importer);
|
|
50
|
+
return normalizePath(base === "" ? specifier : `${base}/${specifier}`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function outputPathFor(source) {
|
|
54
|
+
if (!source.endsWith(SOURCE_EXTENSION)) {
|
|
55
|
+
throw new Error(`source module must end with ${SOURCE_EXTENSION}: ${source}`);
|
|
56
|
+
}
|
|
57
|
+
return `${source.slice(0, -SOURCE_EXTENSION.length)}${OUTPUT_EXTENSION}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function relativePath(from, to) {
|
|
61
|
+
const fromParts = splitPath(dirname(from));
|
|
62
|
+
const toParts = splitPath(to);
|
|
63
|
+
let common = 0;
|
|
64
|
+
while (common < fromParts.length && common < toParts.length &&
|
|
65
|
+
fromParts[common] === toParts[common]) {
|
|
66
|
+
common += 1;
|
|
67
|
+
}
|
|
68
|
+
const parts = [
|
|
69
|
+
...fromParts.slice(common).map(() => ".."),
|
|
70
|
+
...toParts.slice(common),
|
|
71
|
+
];
|
|
72
|
+
const joined = parts.join("/");
|
|
73
|
+
return joined.startsWith(".") ? joined : `./${joined}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* ------------------------------------------------------------------ graph */
|
|
77
|
+
|
|
78
|
+
// The planner hands back discovery order, but a module's imports must exist
|
|
79
|
+
// before it does, so execution needs a dependency-first order.
|
|
80
|
+
export function dependencyOrder(modules) {
|
|
81
|
+
const byId = new Map(modules.map((module) => [module.id, module]));
|
|
82
|
+
const order = [];
|
|
83
|
+
const state = new Map();
|
|
84
|
+
for (const module of modules) visit(module.id);
|
|
85
|
+
return order;
|
|
86
|
+
|
|
87
|
+
function visit(id) {
|
|
88
|
+
const seen = state.get(id);
|
|
89
|
+
if (seen === "done") return;
|
|
90
|
+
if (seen === "visiting") throw new Error(`import cycle through ${id}`);
|
|
91
|
+
state.set(id, "visiting");
|
|
92
|
+
for (const dependency of byId.get(id)?.dependencies ?? []) visit(dependency);
|
|
93
|
+
state.set(id, "done");
|
|
94
|
+
order.push(id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function walkProgram(program, visit) {
|
|
99
|
+
const pending = [...program.body];
|
|
100
|
+
while (pending.length > 0) {
|
|
101
|
+
const node = pending.pop();
|
|
102
|
+
visit(node);
|
|
103
|
+
const children = node.children;
|
|
104
|
+
if (children === undefined || children === null) continue;
|
|
105
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
106
|
+
pending.push(children[index]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function localSourceSpecifier(specifier) {
|
|
112
|
+
return specifier.startsWith(".") && specifier.endsWith(SOURCE_EXTENSION);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function importSpecifiers(program) {
|
|
116
|
+
const specifiers = [];
|
|
117
|
+
walkProgram(program, (node) => {
|
|
118
|
+
if (node.kind === "import-declaration") specifiers.push(node);
|
|
119
|
+
});
|
|
120
|
+
return specifiers;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// A source map names its source relative to the map beside it, which is a bare
|
|
124
|
+
// relative path rather than an import specifier.
|
|
125
|
+
function mapSourcePath(output, source) {
|
|
126
|
+
const path = relativePath(`${output}.map`, source);
|
|
127
|
+
return path.startsWith("./") ? path.slice(2) : path;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// The emitter injects runtime imports of its own for literals, collection
|
|
131
|
+
// helpers, list operations, and value equality. Those are not import nodes in
|
|
132
|
+
// the program, so they survive the IR rewrite above and must be resolved in the
|
|
133
|
+
// emitted text or every module that uses a vector keeps a bare specifier.
|
|
134
|
+
function rewriteEmittedExternals(code, source, resolveExternal) {
|
|
135
|
+
if (resolveExternal === undefined) return code;
|
|
136
|
+
const rewrite = (whole, prefix, quoted) => {
|
|
137
|
+
const specifier = quoted.slice(1, -1);
|
|
138
|
+
if (specifier.startsWith(".") || specifier.startsWith("/") ||
|
|
139
|
+
specifier.includes("://")) {
|
|
140
|
+
return whole;
|
|
141
|
+
}
|
|
142
|
+
const external = resolveExternal(specifier, source);
|
|
143
|
+
return typeof external === "string" && external.length > 0
|
|
144
|
+
? `${prefix}"${external}"`
|
|
145
|
+
: whole;
|
|
146
|
+
};
|
|
147
|
+
return code
|
|
148
|
+
.replace(/(\bfrom\s+)("[^"]+")/gu, rewrite)
|
|
149
|
+
.replace(/(\bimport\s+)("[^"]+")/gu, rewrite);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function diagnosticOf(error, filename) {
|
|
153
|
+
return error?.eliscriptDiagnostic ?? {
|
|
154
|
+
format: "eliscript-diagnostic",
|
|
155
|
+
version: 1,
|
|
156
|
+
code: "ELI-BROWSER-0001",
|
|
157
|
+
severity: "error",
|
|
158
|
+
phase: "browser-host",
|
|
159
|
+
message: error?.message ?? String(error),
|
|
160
|
+
location: { file: filename },
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export class BrowserCompileError extends Error {
|
|
165
|
+
constructor(diagnostics) {
|
|
166
|
+
super(diagnostics.map((diagnostic) => diagnostic.message).join("; "));
|
|
167
|
+
this.name = "BrowserCompileError";
|
|
168
|
+
this.diagnostics = diagnostics;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function failure(code, message, filename) {
|
|
173
|
+
return new BrowserCompileError([{
|
|
174
|
+
format: "eliscript-diagnostic",
|
|
175
|
+
version: 1,
|
|
176
|
+
code,
|
|
177
|
+
severity: "error",
|
|
178
|
+
phase: "browser-host",
|
|
179
|
+
message,
|
|
180
|
+
location: { file: filename },
|
|
181
|
+
}]);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* ---------------------------------------------------------------- compile */
|
|
185
|
+
|
|
186
|
+
// Rewrites every specifier an emitted module carries:
|
|
187
|
+
// - a local `.eli` import becomes the relative path of its emitted module;
|
|
188
|
+
// - a bare specifier is offered to `resolveExternal`, so an application can
|
|
189
|
+
// point the runtime at a served directory without an import map;
|
|
190
|
+
// - anything `resolveExternal` declines stays as written, which is what a
|
|
191
|
+
// third-party package import needs.
|
|
192
|
+
function rewriteSpecifiers(program, source, resolveExternal) {
|
|
193
|
+
for (const node of importSpecifiers(program)) {
|
|
194
|
+
const specifier = node.value;
|
|
195
|
+
if (localSourceSpecifier(specifier)) {
|
|
196
|
+
node.value = relativePath(
|
|
197
|
+
outputPathFor(source),
|
|
198
|
+
outputPathFor(resolvePath(source, specifier)),
|
|
199
|
+
);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (specifier.startsWith(".") || specifier.startsWith("/")) continue;
|
|
203
|
+
const external = resolveExternal?.(specifier, source);
|
|
204
|
+
if (typeof external === "string" && external.length > 0) node.value = external;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Compiles one module.
|
|
210
|
+
*
|
|
211
|
+
* @returns {{ javascript: string, sourceMap: object }}
|
|
212
|
+
*/
|
|
213
|
+
export function compileSource(
|
|
214
|
+
source,
|
|
215
|
+
filename = `module${SOURCE_EXTENSION}`,
|
|
216
|
+
options = {},
|
|
217
|
+
) {
|
|
218
|
+
const program = compile_ir_string(source, filename, options.macroContext ?? null);
|
|
219
|
+
rewriteSpecifiers(program, filename, options.resolveExternal);
|
|
220
|
+
const output = outputPathFor(filename);
|
|
221
|
+
const emission = emit_ir_string_with_source_map(
|
|
222
|
+
program,
|
|
223
|
+
source,
|
|
224
|
+
output,
|
|
225
|
+
mapSourcePath(output, filename),
|
|
226
|
+
);
|
|
227
|
+
return {
|
|
228
|
+
javascript: rewriteEmittedExternals(
|
|
229
|
+
emission.javascript,
|
|
230
|
+
filename,
|
|
231
|
+
options.resolveExternal,
|
|
232
|
+
),
|
|
233
|
+
sourceMap: emission.sourceMap,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Compiles a whole project from a map of sources.
|
|
239
|
+
*
|
|
240
|
+
* @param {object} request
|
|
241
|
+
* @param {Record<string, string>} request.files relative `.eli` path to source
|
|
242
|
+
* @param {string} request.entry relative `.eli` path to compile from
|
|
243
|
+
* @returns {{ plan: object, modules: Record<string, object> }}
|
|
244
|
+
*/
|
|
245
|
+
export function compileProject({
|
|
246
|
+
files,
|
|
247
|
+
entry,
|
|
248
|
+
macroContext = null,
|
|
249
|
+
resolveExternal,
|
|
250
|
+
}) {
|
|
251
|
+
for (const path of Object.keys(files)) outputPathFor(path);
|
|
252
|
+
if (files[entry] === undefined) {
|
|
253
|
+
throw failure("ELI-BROWSER-0002", `entry is not in the project: ${entry}`, entry);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const programs = new Map();
|
|
257
|
+
const programFor = (id) => {
|
|
258
|
+
if (programs.has(id)) return programs.get(id);
|
|
259
|
+
if (files[id] === undefined) {
|
|
260
|
+
throw failure("ELI-BROWSER-0003", `missing source for import: ${id}`, id);
|
|
261
|
+
}
|
|
262
|
+
let program;
|
|
263
|
+
try {
|
|
264
|
+
program = compile_ir_string(files[id], id, macroContext);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
throw new BrowserCompileError([diagnosticOf(error, id)]);
|
|
267
|
+
}
|
|
268
|
+
programs.set(id, program);
|
|
269
|
+
return program;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const plan = project_plan([entry], (id) => importSpecifiers(programFor(id))
|
|
273
|
+
.filter((node) => localSourceSpecifier(node.value))
|
|
274
|
+
.map((node) => resolvePath(id, node.value)));
|
|
275
|
+
|
|
276
|
+
const modules = {};
|
|
277
|
+
for (const id of dependencyOrder(plan.modules)) {
|
|
278
|
+
const output = outputPathFor(id);
|
|
279
|
+
const program = programFor(id);
|
|
280
|
+
rewriteSpecifiers(program, id, resolveExternal);
|
|
281
|
+
const emission = emit_ir_string_with_source_map(
|
|
282
|
+
program,
|
|
283
|
+
files[id],
|
|
284
|
+
output,
|
|
285
|
+
mapSourcePath(output, id),
|
|
286
|
+
);
|
|
287
|
+
modules[output] = {
|
|
288
|
+
id,
|
|
289
|
+
source: files[id],
|
|
290
|
+
javascript: rewriteEmittedExternals(emission.javascript, id, resolveExternal),
|
|
291
|
+
sourceMap: emission.sourceMap,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
return { plan, modules };
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* ---------------------------------------------------------------- execute */
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Turns compiled modules into importable blob URLs, dependencies first.
|
|
301
|
+
*
|
|
302
|
+
* A blob module has no directory, so its relative imports cannot resolve. Each
|
|
303
|
+
* local specifier was therefore rewritten to a relative path during compilation
|
|
304
|
+
* and is replaced here by the blob URL of the module it names. Only import
|
|
305
|
+
* specifiers are touched, never a string literal that resembles one.
|
|
306
|
+
*
|
|
307
|
+
* @returns {{ entryUrl: string, urls: Record<string, string>, release: () => void }}
|
|
308
|
+
*/
|
|
309
|
+
export function moduleGraphUrls(modules, entry) {
|
|
310
|
+
const urls = {};
|
|
311
|
+
const created = [];
|
|
312
|
+
const outputs = Object.keys(modules);
|
|
313
|
+
|
|
314
|
+
const targetOf = (from, specifier) => {
|
|
315
|
+
const parts = splitPath(dirname(from));
|
|
316
|
+
for (const part of specifier.split("/")) {
|
|
317
|
+
if (part === "" || part === ".") continue;
|
|
318
|
+
if (part === "..") parts.pop();
|
|
319
|
+
else parts.push(part);
|
|
320
|
+
}
|
|
321
|
+
return parts.join("/");
|
|
322
|
+
};
|
|
323
|
+
const rewritePattern = (code, from, pattern) => code.replace(
|
|
324
|
+
pattern,
|
|
325
|
+
(whole, prefix, quoted) => {
|
|
326
|
+
const specifier = quoted.slice(1, -1);
|
|
327
|
+
if (!specifier.startsWith(".")) return whole;
|
|
328
|
+
const url = urls[targetOf(from, specifier)];
|
|
329
|
+
return url === undefined ? whole : `${prefix}"${url}"`;
|
|
330
|
+
},
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
for (const outputPath of outputs) {
|
|
334
|
+
let code = modules[outputPath].javascript;
|
|
335
|
+
code = rewritePattern(code, outputPath, /(\bfrom\s+)("[^"]+")/gu);
|
|
336
|
+
code = rewritePattern(code, outputPath, /(\bimport\s+)("[^"]+")/gu);
|
|
337
|
+
urls[outputPath] = URL.createObjectURL(
|
|
338
|
+
new Blob([code], { type: "text/javascript" }),
|
|
339
|
+
);
|
|
340
|
+
created.push(urls[outputPath]);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const entryUrl = urls[outputPathFor(entry)];
|
|
344
|
+
if (entryUrl === undefined) {
|
|
345
|
+
for (const url of created) URL.revokeObjectURL(url);
|
|
346
|
+
throw failure("ELI-BROWSER-0004", `compiled entry is missing: ${entry}`, entry);
|
|
347
|
+
}
|
|
348
|
+
const release = () => {
|
|
349
|
+
for (const url of created) URL.revokeObjectURL(url);
|
|
350
|
+
};
|
|
351
|
+
return { entryUrl, urls, release };
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Compiles one Eliscript module in memory and executes it immediately via a
|
|
356
|
+
* temporary Blob URL.
|
|
357
|
+
*
|
|
358
|
+
* @param {string} source Eliscript source text
|
|
359
|
+
* @param {string} [filename="module.eli"] virtual filename for diagnostics/maps
|
|
360
|
+
* @param {object} [options={}] compilation options (e.g., resolveExternal)
|
|
361
|
+
* @returns {Promise<{ module: object, javascript: string, sourceMap: string }>}
|
|
362
|
+
*/
|
|
363
|
+
export async function runSource(
|
|
364
|
+
source,
|
|
365
|
+
filename = `module${SOURCE_EXTENSION}`,
|
|
366
|
+
options = {},
|
|
367
|
+
) {
|
|
368
|
+
const compiled = compileSource(source, filename, options);
|
|
369
|
+
const url = URL.createObjectURL(
|
|
370
|
+
new Blob([compiled.javascript], { type: "text/javascript" }),
|
|
371
|
+
);
|
|
372
|
+
try {
|
|
373
|
+
const module = await import(url);
|
|
374
|
+
return {
|
|
375
|
+
module,
|
|
376
|
+
javascript: compiled.javascript,
|
|
377
|
+
sourceMap: compiled.sourceMap,
|
|
378
|
+
};
|
|
379
|
+
} finally {
|
|
380
|
+
URL.revokeObjectURL(url);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function scriptFilename(script, index) {
|
|
385
|
+
const explicit = script?.getAttribute?.("data-filename") || script?.dataset?.filename;
|
|
386
|
+
if (typeof explicit === "string" && explicit.trim().length > 0) {
|
|
387
|
+
const name = explicit.trim();
|
|
388
|
+
return name.endsWith(SOURCE_EXTENSION) ? name : `${name}${SOURCE_EXTENSION}`;
|
|
389
|
+
}
|
|
390
|
+
if (typeof script?.src === "string" && script.src.length > 0) {
|
|
391
|
+
try {
|
|
392
|
+
const url = new URL(script.src, globalThis.location?.href ?? "http://localhost/");
|
|
393
|
+
const tail = url.pathname.split("/").filter(Boolean).pop();
|
|
394
|
+
if (tail && tail.endsWith(SOURCE_EXTENSION)) return tail;
|
|
395
|
+
} catch {}
|
|
396
|
+
}
|
|
397
|
+
return `inline-${index + 1}${SOURCE_EXTENSION}`;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Scans a DOM root for `<script type="text/eliscript">` elements (both inline
|
|
402
|
+
* and external `src="..."`) and compiles + executes each one in document order.
|
|
403
|
+
*
|
|
404
|
+
* @param {ParentNode} [root=globalThis.document]
|
|
405
|
+
* @param {object} [options={}]
|
|
406
|
+
* @returns {Promise<Array<{ script: Element, filename: string, module: object, javascript: string, sourceMap: string }>>}
|
|
407
|
+
*/
|
|
408
|
+
export async function mountEliscriptScripts(
|
|
409
|
+
root = globalThis.document,
|
|
410
|
+
options = {},
|
|
411
|
+
) {
|
|
412
|
+
if (!root || typeof root.querySelectorAll !== "function") return [];
|
|
413
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
414
|
+
const scripts = Array.from(root.querySelectorAll('script[type="text/eliscript"]'));
|
|
415
|
+
const mounted = [];
|
|
416
|
+
for (let index = 0; index < scripts.length; index += 1) {
|
|
417
|
+
const script = scripts[index];
|
|
418
|
+
if (script.dataset?.eliscriptMounted === "true") continue;
|
|
419
|
+
if (script.dataset) script.dataset.eliscriptMounted = "true";
|
|
420
|
+
const filename = scriptFilename(script, index);
|
|
421
|
+
let source = script.textContent ?? "";
|
|
422
|
+
if (typeof script.src === "string" && script.src.length > 0) {
|
|
423
|
+
const response = await fetchImpl(script.src);
|
|
424
|
+
if (!response.ok) {
|
|
425
|
+
throw failure(
|
|
426
|
+
"ELI-BROWSER-0005",
|
|
427
|
+
`failed to fetch ${script.src}: ${response.status}`,
|
|
428
|
+
filename,
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
source = await response.text();
|
|
432
|
+
}
|
|
433
|
+
const executed = await runSource(source, filename, options);
|
|
434
|
+
mounted.push({
|
|
435
|
+
script,
|
|
436
|
+
filename,
|
|
437
|
+
...executed,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
return mounted;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export const browserHostSurface = Object.freeze({
|
|
444
|
+
sourceExtension: SOURCE_EXTENSION,
|
|
445
|
+
outputExtension: OUTPUT_EXTENSION,
|
|
446
|
+
});
|