eliscript 0.1.3 → 0.1.4
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/COPYING.RUNTIME +93 -0
- package/README.md +15 -3
- package/bin/eliscript-test +29 -0
- package/bootstrap/backends/README.md +5 -4
- package/bootstrap/backends/binary.eli +89 -22
- package/bootstrap/backends/capabilities.eli +9 -4
- package/bootstrap/backends/managed-layout.eli +93 -81
- package/bootstrap/backends/managed.eli +651 -125
- package/bootstrap/backends/native.eli +1791 -324
- package/bootstrap/backends/numeric.eli +71 -7
- package/bootstrap/backends/sha256.eli +165 -68
- package/bootstrap/backends/wasm.eli +461 -52
- package/bootstrap/compiler/analyzer.eli +692 -2
- package/bootstrap/compiler/compiler.eli +16 -3
- package/bootstrap/compiler/emitter.eli +80 -35
- package/bootstrap/compiler/project.eli +175 -1
- package/bootstrap/compiler/transient-analysis.eli +2 -2
- package/bootstrap/host/build.eli +1 -0
- package/bootstrap/host/build.mjs +1 -1
- package/bootstrap/host/build.mjs.map +1 -1
- package/bootstrap/host/bun.mjs +7 -9
- package/bootstrap/host/bun.mjs.map +1 -1
- package/bootstrap/host/check-cli-ground.eli +47 -5
- package/bootstrap/host/check-cli-ground.mjs +60 -19
- package/bootstrap/host/check-cli-ground.mjs.map +1 -1
- package/bootstrap/host/check-cli.mjs +41 -1
- package/bootstrap/host/check-cli.mjs.map +1 -1
- package/bootstrap/host/compiler-session.eli +136 -22
- package/bootstrap/host/eliscript-cli.mjs +1 -1
- package/bootstrap/host/eliscript-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation-cli.eli +33 -1
- package/bootstrap/host/evaluation-cli.mjs +65 -28
- package/bootstrap/host/evaluation-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation.eli +651 -42
- package/bootstrap/host/evaluation.mjs +884 -72
- package/bootstrap/host/evaluation.mjs.map +1 -1
- package/bootstrap/host/project-cli-ground.eli +6 -1
- package/bootstrap/host/project-cli-ground.mjs +33 -32
- package/bootstrap/host/project-cli-ground.mjs.map +1 -1
- package/bootstrap/host/project-cli.mjs +1 -1
- package/bootstrap/host/project-cli.mjs.map +1 -1
- package/bootstrap/host/project-ground.eli +266 -45
- package/bootstrap/host/project-ground.mjs +429 -159
- package/bootstrap/host/project-ground.mjs.map +1 -1
- package/bootstrap/host/project.mjs +30 -40
- package/bootstrap/host/project.mjs.map +1 -1
- package/bootstrap/host/test-cli.eli +379 -0
- package/bootstrap/host/test-cli.mjs +494 -0
- package/bootstrap/host/test-cli.mjs.map +1 -0
- package/browser/README.md +7 -0
- package/browser/host.mjs +21 -29
- package/browser/host.mjs.map +1 -1
- package/browser/worker.mjs +7 -9
- package/browser/worker.mjs.map +1 -1
- package/compiler/eliscript-analyzer.el +694 -0
- package/compiler/eliscript-cli.el +66 -22
- package/compiler/eliscript-emitter.el +67 -43
- package/compiler/eliscript-ir-emitter.el +71 -36
- package/compiler/eliscript-project.el +360 -80
- package/compiler/eliscript-transient-analysis.el +5 -5
- package/compiler/eliscript.el +6 -0
- package/dist/backends/binary.mjs +148 -26
- package/dist/backends/binary.mjs.map +1 -1
- package/dist/backends/capabilities.mjs +11 -4
- package/dist/backends/capabilities.mjs.map +1 -1
- package/dist/backends/elf.mjs +4 -4
- package/dist/backends/elf.mjs.map +1 -1
- package/dist/backends/managed-layout.mjs +53 -56
- package/dist/backends/managed-layout.mjs.map +1 -1
- package/dist/backends/managed.mjs +1116 -375
- package/dist/backends/managed.mjs.map +1 -1
- package/dist/backends/memory.mjs +24 -26
- package/dist/backends/memory.mjs.map +1 -1
- package/dist/backends/native.mjs +2529 -434
- package/dist/backends/native.mjs.map +1 -1
- package/dist/backends/numeric.mjs +140 -33
- package/dist/backends/numeric.mjs.map +1 -1
- package/dist/backends/optimize.mjs +2 -2
- package/dist/backends/optimize.mjs.map +1 -1
- package/dist/backends/regexp.mjs +33 -35
- package/dist/backends/regexp.mjs.map +1 -1
- package/dist/backends/sha256.mjs +159 -59
- package/dist/backends/sha256.mjs.map +1 -1
- package/dist/backends/wasm.mjs +609 -73
- package/dist/backends/wasm.mjs.map +1 -1
- package/dist/bootstrap/analyzer.mjs +1018 -2
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +30 -23
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +206 -161
- package/dist/bootstrap/emitter.mjs.macro-origins.json +16 -16
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +27 -31
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +22 -24
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/project.mjs +246 -1
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +2 -2
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/source-map.mjs +34 -48
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +2 -2
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +106 -106
- package/dist/browser/host.mjs +21 -29
- package/dist/browser/loader.js +1 -1
- package/dist/browser/worker.mjs +95 -95
- package/dist/compiler-artifact.json +1 -1
- package/dist/host/compiler-session.mjs +405 -228
- package/dist/host/compiler-session.mjs.map +1 -1
- package/dist/host/compiler-tools.mjs +44 -46
- package/dist/host/compiler-tools.mjs.map +1 -1
- package/dist/literal-sources/runtime/core/array-map.eli +45 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +22 -2
- package/dist/literal-sources/runtime/core/collection.eli +282 -23
- package/dist/literal-sources/runtime/core/data-text.eli +196 -13
- package/dist/literal-sources/runtime/core/data.eli +1 -1
- package/dist/literal-sources/runtime/core/identifier.eli +1 -1
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +822 -44
- package/dist/literal-sources/runtime/core/list.eli +1 -1
- package/dist/literal-sources/runtime/core/map.eli +1 -1
- package/dist/literal-sources/runtime/core/metadata-internals.eli +2 -2
- package/dist/literal-sources/runtime/core/metadata.eli +2 -2
- package/dist/literal-sources/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/dist/literal-sources/runtime/core/object.eli +1 -1
- package/dist/literal-sources/runtime/core/order.eli +3 -3
- package/dist/literal-sources/runtime/core/persistent-kind.eli +1 -1
- package/dist/literal-sources/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/protocol.eli +5 -3
- package/dist/literal-sources/runtime/core/queue.eli +1 -1
- package/dist/literal-sources/runtime/core/record.eli +3 -3
- package/dist/literal-sources/runtime/core/regex.eli +2 -2
- package/dist/literal-sources/runtime/core/sequence.eli +1 -1
- package/dist/literal-sources/runtime/core/set-algebra.eli +1 -1
- package/dist/literal-sources/runtime/core/set.eli +1 -1
- package/dist/literal-sources/runtime/core/sorted.eli +4 -4
- package/dist/literal-sources/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/text.eli +1 -1
- package/dist/literal-sources/runtime/core/transducer.eli +24 -2
- package/dist/literal-sources/runtime/core/transient.eli +7 -5
- package/dist/literal-sources/runtime/core/type.eli +1 -1
- package/dist/literal-sources/runtime/core/value-internals.eli +3 -3
- package/dist/literal-sources/runtime/core/value.eli +2 -2
- package/dist/literal-sources/runtime/core/vector.eli +5 -2
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-queue-state.eli +1 -1
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-sorted-state.eli +1 -1
- package/dist/literal-sources/runtime/managed/managed-transient-state.eli +1206 -0
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-value-state.eli +30 -6
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/dist/literal-sources/runtime/wire/http-rpc.eli +1 -1
- package/dist/literal-sources/runtime/wire/markdown.eli +1 -1
- package/dist/literal-sources/runtime/wire/schema.eli +1 -1
- package/dist/literal-sources/stdlib/bit.eli +89 -1
- package/dist/literal-sources/stdlib/data.eli +522 -0
- package/dist/literal-sources/stdlib/interop/object.eli +39 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +60 -21
- package/dist/literal-sources/stdlib/persistent-map.eli +335 -324
- package/dist/literal-sources/stdlib/persistent-set.eli +8 -6
- package/dist/literal-sources/stdlib/persistent-vector.eli +18 -18
- package/dist/literal-sources/stdlib/protocol.eli +63 -0
- package/{stdlib/core → dist/literal-sources/stdlib}/set.eli +8 -8
- package/dist/literal-sources/stdlib/string.eli +362 -0
- package/dist/runtime/lisp/async-runtime.mjs +55 -59
- package/dist/runtime/lisp/async-runtime.mjs.map +1 -1
- package/dist/runtime/lisp/builtins.mjs +232 -280
- package/dist/runtime/lisp/builtins.mjs.map +1 -1
- package/dist/runtime/lisp/cli.mjs +159 -167
- package/dist/runtime/lisp/cli.mjs.map +1 -1
- package/dist/runtime/lisp/compiler.mjs +359 -419
- package/dist/runtime/lisp/compiler.mjs.map +1 -1
- package/dist/runtime/lisp/core.mjs +24 -24
- package/dist/runtime/lisp/core.mjs.map +1 -1
- package/dist/runtime/lisp/evaluator.mjs +315 -385
- package/dist/runtime/lisp/evaluator.mjs.map +1 -1
- package/dist/runtime/lisp/extensions.mjs +85 -103
- package/dist/runtime/lisp/extensions.mjs.map +1 -1
- package/dist/runtime/lisp/host-io.mjs +106 -122
- package/dist/runtime/lisp/host-io.mjs.map +1 -1
- package/dist/runtime/lisp/io-worker.mjs +117 -135
- package/dist/runtime/lisp/io-worker.mjs.map +1 -1
- package/dist/runtime/lisp/keymap.mjs +5 -5
- package/dist/runtime/lisp/keymap.mjs.map +1 -1
- package/dist/runtime/lisp/macros-forms.mjs +49 -51
- package/dist/runtime/lisp/macros-forms.mjs.map +1 -1
- package/dist/runtime/lisp/reader-format.mjs +31 -31
- package/dist/runtime/lisp/reader-format.mjs.map +1 -1
- package/dist/runtime/lisp/regexp-buffer.mjs +9 -9
- package/dist/runtime/lisp/regexp-buffer.mjs.map +1 -1
- package/dist/runtime/math.mjs +32 -38
- package/dist/runtime/math.mjs.map +1 -1
- package/dist/runtime/number-radix.mjs +5 -7
- package/dist/runtime/number-radix.mjs.map +1 -1
- package/dist/runtime/primitives.mjs +81 -46
- package/dist/runtime/primitives.mjs.macro-origins.json +294 -44
- package/dist/runtime/primitives.mjs.map +1 -1
- package/dist/runtime/unicode-case.mjs +6 -6
- package/dist/runtime/unicode-case.mjs.map +1 -1
- package/dist/runtime.eli +3068 -1882
- package/dist/stage3-release.json +1 -1
- package/dist/stdlib/async.mjs +1838 -0
- package/dist/stdlib/bit.mjs +116 -0
- package/dist/stdlib/collection.mjs +193 -0
- package/dist/stdlib/core.mjs +28 -0
- package/dist/stdlib/data-text.mjs +54 -0
- package/dist/stdlib/data.mjs +601 -0
- package/dist/stdlib/devtools.mjs +565 -0
- package/dist/stdlib/diff.mjs +180 -0
- package/dist/stdlib/fn.mjs +164 -0
- package/dist/stdlib/hierarchy.mjs +189 -0
- package/dist/stdlib/identifier.mjs +33 -0
- package/dist/stdlib/interop/js.mjs +706 -0
- package/dist/stdlib/interop/object.mjs +40 -0
- package/dist/stdlib/json.mjs +843 -0
- package/dist/stdlib/lazy-sequence.mjs +117 -0
- package/dist/stdlib/math.mjs +386 -0
- package/dist/stdlib/meta.mjs +21 -0
- package/dist/stdlib/multimethod.mjs +345 -0
- package/dist/stdlib/numeric.mjs +327 -0
- package/dist/stdlib/order.mjs +194 -0
- package/dist/stdlib/persistent-list.mjs +171 -0
- package/dist/stdlib/persistent-map.mjs +781 -0
- package/dist/stdlib/persistent-queue.mjs +44 -0
- package/dist/stdlib/persistent-set.mjs +225 -0
- package/dist/stdlib/persistent-vector.mjs +316 -0
- package/dist/stdlib/portable/data-text.mjs +1094 -0
- package/dist/stdlib/portable/data.mjs +62 -0
- package/dist/stdlib/portable/identifier.mjs +179 -0
- package/dist/stdlib/portable/metadata.mjs +63 -0
- package/dist/stdlib/portable/object.mjs +140 -0
- package/dist/stdlib/portable/sequence.mjs +142 -0
- package/dist/stdlib/portable/text.mjs +111 -0
- package/dist/stdlib/pprint.mjs +807 -0
- package/dist/stdlib/protocol.mjs +61 -0
- package/dist/stdlib/record.mjs +25 -0
- package/dist/stdlib/regex.mjs +115 -0
- package/dist/stdlib/result.mjs +198 -0
- package/dist/stdlib/schema.mjs +2828 -0
- package/dist/stdlib/seq.mjs +913 -0
- package/dist/stdlib/set.mjs +317 -0
- package/dist/stdlib/sorted.mjs +56 -0
- package/dist/stdlib/state.mjs +451 -0
- package/dist/stdlib/string.mjs +494 -0
- package/dist/stdlib/tap.mjs +187 -0
- package/dist/stdlib/test.mjs +669 -0
- package/dist/stdlib/time.mjs +522 -0
- package/dist/stdlib/transducer.mjs +85 -0
- package/dist/stdlib/transient.mjs +32 -0
- package/dist/stdlib/type.mjs +28 -0
- package/dist/stdlib/uuid.mjs +377 -0
- package/dist/stdlib/value.mjs +334 -0
- package/dist/stdlib/walk.mjs +243 -0
- package/dist/stdlib/wire/gepo.mjs +28 -0
- package/dist/stdlib/wire/mdp.mjs +13 -0
- package/dist/stdlib/wire/mds.mjs +10 -0
- package/dist/stdlib/zipper.mjs +1025 -0
- package/editor/README.md +15 -0
- package/editor/eliscript-data.el +221 -8
- package/editor/eliscript-mode.el +207 -48
- package/editor/eliscript-runtime.el +6 -3
- package/package.json +49 -15
- package/platform/README.md +6 -0
- package/platform/browser.mjs +10 -12
- package/platform/browser.mjs.map +1 -1
- package/runtime/README.md +12 -5
- package/runtime/core/array-map.eli +538 -0
- package/runtime/core/array-map.mjs +651 -0
- package/runtime/core/array-map.mjs.map +1 -0
- package/runtime/core/collection-internals.eli +85 -33
- package/runtime/core/collection-internals.mjs +245 -193
- package/runtime/core/collection-internals.mjs.map +1 -1
- package/runtime/core/collection.eli +105 -3
- package/runtime/core/collection.mjs +190 -53
- package/runtime/core/collection.mjs.map +1 -1
- package/runtime/core/data-text.eli +224 -16
- package/runtime/core/data-text.mjs +345 -83
- package/runtime/core/data-text.mjs.map +1 -1
- package/runtime/core/data.eli +50 -33
- package/runtime/core/data.mjs +72 -36
- package/runtime/core/data.mjs.map +1 -1
- package/runtime/core/identifier.mjs +15 -19
- package/runtime/core/identifier.mjs.map +1 -1
- package/runtime/core/lazy-sequence.eli +885 -15
- package/runtime/core/lazy-sequence.mjs +1265 -38
- package/runtime/core/lazy-sequence.mjs.map +1 -1
- package/runtime/core/map-internals.eli +209 -1
- package/runtime/core/map-internals.mjs +359 -71
- package/runtime/core/map-internals.mjs.map +1 -1
- package/runtime/core/map.eli +75 -7
- package/runtime/core/map.mjs +122 -47
- package/runtime/core/map.mjs.map +1 -1
- package/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/runtime/core/object-impl.mjs +5 -5
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/order.eli +15 -3
- package/runtime/core/order.mjs +23 -8
- package/runtime/core/order.mjs.map +1 -1
- package/runtime/core/persistent-kind.mjs +9 -13
- package/runtime/core/persistent-kind.mjs.map +1 -1
- package/runtime/core/protocol-error.mjs +9 -11
- package/runtime/core/protocol-error.mjs.map +1 -1
- package/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/runtime/core/protocol-impl.mjs +10 -10
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/queue.mjs +14 -16
- package/runtime/core/queue.mjs.map +1 -1
- package/runtime/core/record.eli +2 -2
- package/runtime/core/record.mjs +13 -17
- package/runtime/core/record.mjs.map +1 -1
- package/runtime/core/regex.mjs +18 -22
- package/runtime/core/regex.mjs.map +1 -1
- package/runtime/core/sequence.eli +33 -31
- package/runtime/core/sequence.mjs +60 -93
- package/runtime/core/sequence.mjs.map +1 -1
- package/runtime/core/set.eli +53 -27
- package/runtime/core/set.mjs +113 -82
- package/runtime/core/set.mjs.map +1 -1
- package/runtime/core/sorted.mjs +91 -108
- package/runtime/core/sorted.mjs.map +1 -1
- package/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/runtime/core/text-impl.mjs +1 -1
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/transducer.eli +24 -0
- package/runtime/core/transducer.mjs +27 -1
- package/runtime/core/transducer.mjs.map +1 -1
- package/runtime/core/transient-internals.eli +12 -4
- package/runtime/core/transient-internals.mjs +19 -6
- package/runtime/core/transient-internals.mjs.map +1 -1
- package/runtime/core/transient.eli +31 -0
- package/runtime/core/transient.mjs +33 -2
- package/runtime/core/transient.mjs.map +1 -1
- package/runtime/core/value-internals.mjs +29 -35
- package/runtime/core/value-internals.mjs.map +1 -1
- package/runtime/core/vector.eli +73 -20
- package/runtime/core/vector.mjs +159 -156
- package/runtime/core/vector.mjs.map +1 -1
- package/runtime/literals.eli +16 -9
- package/runtime/literals.mjs +25 -9
- package/runtime/literals.mjs.map +1 -1
- package/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-queue-state.eli +1 -1
- package/runtime/managed/managed-runtime-array-map.eli +45 -0
- package/{stdlib → runtime/managed}/managed-runtime-collection-internals.eli +22 -2
- package/{stdlib → runtime/managed}/managed-runtime-collection.eli +282 -23
- package/{stdlib → runtime/managed}/managed-runtime-data-text.eli +196 -13
- package/{stdlib → runtime/managed}/managed-runtime-data.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-identifier.eli +1 -1
- package/runtime/managed/managed-runtime-lazy-sequence.eli +935 -0
- package/{stdlib → runtime/managed}/managed-runtime-list.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-map.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-metadata-internals.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-metadata.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-object.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-order.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-persistent-kind.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-protocol.eli +5 -3
- package/{stdlib → runtime/managed}/managed-runtime-queue.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-record.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-regex.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-sequence.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set-algebra.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-sorted.eli +4 -4
- package/{stdlib → runtime/managed}/managed-runtime-text.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-transducer.eli +24 -2
- package/{stdlib → runtime/managed}/managed-runtime-transient.eli +7 -5
- package/{stdlib → runtime/managed}/managed-runtime-type.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-value-internals.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-value.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-vector.eli +5 -2
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-sorted-state.eli +1 -1
- package/runtime/managed/managed-transient-state.eli +1206 -0
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-value-state.eli +30 -6
- package/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-http-rpc.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-markdown.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-schema.eli +1 -1
- package/runtime/math.mjs +32 -38
- package/runtime/math.mjs.map +1 -1
- package/runtime/number-radix.mjs +5 -7
- package/runtime/number-radix.mjs.map +1 -1
- package/runtime/primitives.eli +19 -6
- package/runtime/primitives.mjs +81 -46
- package/runtime/primitives.mjs.map +1 -1
- package/runtime/source-mapping.mjs +17 -23
- package/runtime/source-mapping.mjs.map +1 -1
- package/runtime/testing/map.eli +70 -41
- package/runtime/testing/map.mjs +57 -34
- package/runtime/testing/map.mjs.map +1 -1
- package/runtime/unicode-case.mjs +6 -6
- package/runtime/unicode-case.mjs.map +1 -1
- package/runtime/wire/http-rpc.mjs +12 -18
- package/runtime/wire/http-rpc.mjs.map +1 -1
- package/runtime/wire/markdown.mjs +42 -42
- package/runtime/wire/markdown.mjs.map +1 -1
- package/runtime/wire/schema.mjs +13 -13
- package/runtime/wire/schema.mjs.map +1 -1
- package/runtime/worker-value-codec.mjs +5 -7
- package/runtime/worker-value-codec.mjs.map +1 -1
- package/runtime/worker-value-stream.mjs +128 -135
- package/runtime/worker-value-stream.mjs.map +1 -1
- package/runtime/worker.mjs +75 -89
- package/runtime/worker.mjs.map +1 -1
- package/stdlib/README.md +25 -18
- package/stdlib/async.eli +1245 -0
- package/stdlib/bit.eli +89 -1
- package/stdlib/bit.mjs +89 -2
- package/stdlib/bit.mjs.map +1 -1
- package/stdlib/{core/collection.eli → collection.eli} +39 -4
- package/stdlib/core.eli +956 -0
- package/stdlib/data-text.eli +62 -1091
- package/stdlib/data.eli +517 -37
- package/stdlib/devtools.eli +399 -0
- package/stdlib/diff.eli +134 -0
- package/stdlib/{function.eli → fn.eli} +1 -1
- package/stdlib/identifier.eli +21 -136
- package/stdlib/interop/object.eli +39 -0
- package/stdlib/{core/lazy-sequence.eli → lazy-sequence.eli} +28 -2
- package/stdlib/math.eli +267 -0
- package/stdlib/{core/metadata.eli → meta.eli} +2 -2
- package/stdlib/{core/order.eli → order.eli} +6 -6
- package/stdlib/persistent-list.eli +60 -21
- package/stdlib/persistent-map.eli +335 -324
- package/stdlib/persistent-set.eli +8 -6
- package/stdlib/persistent-vector.eli +18 -18
- package/stdlib/portable/data-text.eli +1092 -0
- package/stdlib/portable/data.eli +42 -0
- package/stdlib/portable/identifier.eli +147 -0
- package/stdlib/{metadata.eli → portable/metadata.eli} +5 -5
- package/stdlib/{object.eli → portable/object.eli} +1 -1
- package/stdlib/{sequence.eli → portable/sequence.eli} +1 -1
- package/stdlib/{text.eli → portable/text.eli} +1 -1
- package/stdlib/pprint.eli +588 -0
- package/stdlib/protocol.eli +63 -0
- package/stdlib/{core/record.eli → record.eli} +2 -2
- package/stdlib/regex.eli +70 -0
- package/stdlib/result.eli +53 -44
- package/stdlib/schema.eli +1886 -0
- package/stdlib/{core/seq.eli → seq.eli} +97 -90
- package/{dist/literal-sources/stdlib/core → stdlib}/set.eli +8 -8
- package/stdlib/{core/sorted.eli → sorted.eli} +2 -2
- package/stdlib/{state/atom.eli → state.eli} +137 -7
- package/stdlib/string.eli +362 -0
- package/stdlib/tap.eli +135 -0
- package/stdlib/test.eli +566 -0
- package/stdlib/time.eli +419 -0
- package/stdlib/{core/transducer.eli → transducer.eli} +4 -2
- package/stdlib/{core/transient.eli → transient.eli} +11 -5
- package/stdlib/{core/type.eli → type.eli} +2 -2
- package/stdlib/uuid.eli +288 -0
- package/stdlib/{core/walk.eli → walk.eli} +6 -6
- package/stdlib/{gepo.eli → wire/gepo.eli} +2 -2
- package/stdlib/{mdp.eli → wire/mdp.eli} +2 -2
- package/stdlib/{mds.eli → wire/mds.eli} +2 -2
- package/stdlib/{core/zipper.eli → zipper.eli} +179 -138
- package/tests/helpers/wasm-managed-math-node.mjs +495 -582
- package/tools/acceptance/check-ground.mjs +106 -132
- package/tools/acceptance/check.mjs +16 -16
- package/tools/acceptance/retained-performance-snapshot.mjs +265 -149
- package/tools/acceptance/retained-soak.mjs +5 -7
- package/tools/acceptance/retained-transient.mjs +5 -7
- package/tools/backends/build.mjs +373 -95
- package/tools/backends/compiler-bootstrap.mjs +271 -317
- package/tools/backends/compiler-browser.mjs +7 -9
- package/tools/backends/compiler-build.mjs +77 -97
- package/tools/backends/compiler-cli-ground.mjs +47 -47
- package/tools/backends/compiler-data-transport.mjs +27 -31
- package/tools/backends/compiler-host-iteration.mjs +13 -21
- package/tools/backends/compiler-host-record.mjs +28 -34
- package/tools/backends/compiler-metadata.mjs +145 -53
- package/tools/backends/compiler-package-ground.mjs +39 -47
- package/tools/backends/compiler-package-loader.mjs +164 -206
- package/tools/backends/compiler-session.mjs +432 -324
- package/tools/backends/compiler-worker.mjs +79 -89
- package/tools/backends/dist/bootstrap-js-stages.mjs +17 -19
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
- package/tools/backends/dist/release-cli.mjs +151 -22
- package/tools/backends/dist/release-cli.mjs.map +1 -1
- package/tools/backends/dist/run-artifact.mjs +54 -76
- package/tools/backends/dist/run-artifact.mjs.map +1 -1
- package/tools/backends/managed-foreign-binding.mjs +370 -114
- package/tools/backends/managed-host-ground.mjs +14 -17
- package/tools/backends/managed-host-lifecycle.mjs +42 -53
- package/tools/backends/managed-host-object-realm.mjs +121 -111
- package/tools/backends/managed-host-proxy.mjs +5 -7
- package/tools/backends/managed-host-runtime.mjs +6295 -4350
- package/tools/backends/managed-host.mjs +234 -188
- package/tools/backends/managed-layout.mjs +53 -56
- package/tools/backends/managed-module-graph-ground.mjs +488 -568
- package/tools/backends/managed-module-graph.mjs +62 -76
- package/tools/backends/managed-runtime-host-ground.mjs +352 -400
- package/tools/backends/managed-runtime.mjs +227 -266
- package/tools/backends/managed-source-view-ground.mjs +165 -161
- package/tools/backends/managed-source-view.mjs +415 -154
- package/tools/backends/native-managed-runtime.mjs +96 -138
- package/tools/backends/native-memory.mjs +1122 -742
- package/tools/backends/native-node-ffi.mjs +2439 -0
- package/tools/backends/native-node-memory.mjs +793 -383
- package/tools/backends/native-node-runner.mjs +1458 -579
- package/tools/backends/native-node-watchdog.mjs +12 -14
- package/tools/backends/native-node-worker.mjs +46 -50
- package/tools/backends/stage3-targets.mjs +2 -2
- package/tools/bootstrap-runtime.el +4 -4
- package/tools/collections/transient-builder-benchmark.mjs +17 -17
- package/tools/project/check-cli.eli +27 -3
- package/tools/project/project-cli.eli +1 -1
- package/tools/testing/maintained-suite-source.mjs +5 -7
- package/tools/testing/maintained-suite-source.mjs.map +1 -1
- package/dist/literal-sources/stdlib/core/data.eli +0 -306
- package/dist/literal-sources/stdlib/managed-transient-state.eli +0 -353
- package/stdlib/core/data-text.eli +0 -16
- package/stdlib/core/data.eli +0 -306
- package/stdlib/core/identifier.eli +0 -32
- package/stdlib/core/regex.eli +0 -17
- package/stdlib/deferred.eli +0 -70
- package/stdlib/managed-runtime-lazy-sequence.eli +0 -157
- package/stdlib/managed-transient-state.eli +0 -353
- /package/{stdlib → runtime/managed}/managed-protocol-error.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-literals.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-truth.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-testing-value.eli +0 -0
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
// Generated by Eliscript. Do not edit.
|
|
2
|
+
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "eliscript/runtime/errors.mjs";
|
|
3
|
+
var __eliscript_tdz_ready_0;
|
|
4
|
+
var __eliscript_tdz_ready_1;
|
|
5
|
+
var __eliscript_tdz_ready_2;
|
|
6
|
+
var __eliscript_tdz_ready_3;
|
|
7
|
+
var __eliscript_tdz_ready_4;
|
|
8
|
+
var __eliscript_tdz_ready_5;
|
|
9
|
+
var __eliscript_tdz_ready_6;
|
|
10
|
+
var __eliscript_tdz_ready_7;
|
|
11
|
+
var __eliscript_tdz_ready_8;
|
|
12
|
+
var __eliscript_tdz_ready_9;
|
|
13
|
+
var __eliscript_tdz_ready_10;
|
|
14
|
+
var __eliscript_tdz_ready_11;
|
|
15
|
+
var __eliscript_tdz_ready_12;
|
|
16
|
+
var __eliscript_tdz_ready_13;
|
|
17
|
+
var __eliscript_tdz_ready_14;
|
|
18
|
+
var __eliscript_tdz_ready_15;
|
|
19
|
+
var __eliscript_tdz_ready_16;
|
|
20
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
21
|
+
import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
22
|
+
import { valueType as __eliscript_value_type } from "eliscript/runtime/primitives.mjs";
|
|
23
|
+
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
24
|
+
|
|
25
|
+
import {persistent_list_QMARK_, persistent_list_from_array, persistent_list_to_array} from "../persistent-list.mjs";
|
|
26
|
+
import {persistent_vector_QMARK_, persistent_vector_count, persistent_vector_from_array, persistent_vector_nth} from "../persistent-vector.mjs";
|
|
27
|
+
import {persistent_map_QMARK_, persistent_map_assoc, persistent_map_has_QMARK_, persistent_map_reduce} from "../persistent-map.mjs";
|
|
28
|
+
import {persistent_set_QMARK_, persistent_set_conj, persistent_set_has_QMARK_, persistent_set_reduce} from "../persistent-set.mjs";
|
|
29
|
+
import {empty_value_map, empty_value_set} from "../value.mjs";
|
|
30
|
+
import * as RuntimeVector from "../../../runtime/core/vector.mjs";
|
|
31
|
+
import * as RuntimeMap from "../../../runtime/core/map.mjs";
|
|
32
|
+
import * as RuntimeSet from "../../../runtime/core/set.mjs";
|
|
33
|
+
const interop_array_predicate = Array.isArray;
|
|
34
|
+
__eliscript_tdz_ready_0 = true;
|
|
35
|
+
const interop_map_predicate = ((sentinel) => {
|
|
36
|
+
return ((value) => {
|
|
37
|
+
try {
|
|
38
|
+
__eliscript_at(((globalThis.Map)["prototype"])["has"], "call")(value, sentinel);
|
|
39
|
+
return true;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
})((globalThis.Object)["freeze"](({})));
|
|
45
|
+
__eliscript_tdz_ready_1 = true;
|
|
46
|
+
const interop_set_predicate = ((sentinel) => {
|
|
47
|
+
return ((value) => {
|
|
48
|
+
try {
|
|
49
|
+
__eliscript_at(((globalThis.Set)["prototype"])["has"], "call")(value, sentinel);
|
|
50
|
+
return true;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
})((globalThis.Object)["freeze"](({})));
|
|
56
|
+
__eliscript_tdz_ready_2 = true;
|
|
57
|
+
const interop_object_predicate = ((value) => {
|
|
58
|
+
if (((value === null) || (typeof value !== "object"))) {
|
|
59
|
+
return false;
|
|
60
|
+
} else {
|
|
61
|
+
try {
|
|
62
|
+
{
|
|
63
|
+
let prototype = (globalThis.Object)["getPrototypeOf"](value);
|
|
64
|
+
return ((prototype === null) || ((globalThis.Object)["getPrototypeOf"](prototype) === null));
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
__eliscript_tdz_ready_3 = true;
|
|
72
|
+
const interop_safe_integer_predicate = Number.isSafeInteger;
|
|
73
|
+
__eliscript_tdz_ready_4 = true;
|
|
74
|
+
const interop_map_factory = (() => {
|
|
75
|
+
return new (globalThis.Map)();
|
|
76
|
+
});
|
|
77
|
+
__eliscript_tdz_ready_5 = true;
|
|
78
|
+
const interop_set_factory = (() => {
|
|
79
|
+
return new (globalThis.Set)();
|
|
80
|
+
});
|
|
81
|
+
__eliscript_tdz_ready_6 = true;
|
|
82
|
+
const interop_object_factory = (() => {
|
|
83
|
+
return ({});
|
|
84
|
+
});
|
|
85
|
+
__eliscript_tdz_ready_7 = true;
|
|
86
|
+
const interop_map_entries = ((value) => {
|
|
87
|
+
return (globalThis.Array)["from"](__eliscript_at(((globalThis.Map)["prototype"])["entries"], "call")(value));
|
|
88
|
+
});
|
|
89
|
+
__eliscript_tdz_ready_8 = true;
|
|
90
|
+
const interop_set_values = ((value) => {
|
|
91
|
+
return (globalThis.Array)["from"](__eliscript_at(((globalThis.Set)["prototype"])["values"], "call")(value));
|
|
92
|
+
});
|
|
93
|
+
__eliscript_tdz_ready_9 = true;
|
|
94
|
+
const interop_iterable_values = ((value) => {
|
|
95
|
+
return (globalThis.Array)["from"](value);
|
|
96
|
+
});
|
|
97
|
+
__eliscript_tdz_ready_10 = true;
|
|
98
|
+
const interop_json_string = JSON.stringify;
|
|
99
|
+
__eliscript_tdz_ready_11 = true;
|
|
100
|
+
const interop_enumerable_own_keys = ((value) => {
|
|
101
|
+
{
|
|
102
|
+
let keys = (globalThis.Reflect)["ownKeys"](value);
|
|
103
|
+
let result = [];
|
|
104
|
+
let index = 0;
|
|
105
|
+
while (__eliscript_numeric_relation("<", index, ((keys) ?? []).length)) {
|
|
106
|
+
{
|
|
107
|
+
let key = ((((keys) ?? [])[index]) ?? null);
|
|
108
|
+
let descriptor = (globalThis.Object)["getOwnPropertyDescriptor"](value, key);
|
|
109
|
+
if ((!((descriptor === undefined)) && __eliscript_truthy((descriptor)["enumerable"]))) {
|
|
110
|
+
(result)["push"](key);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
((index = (index + 1)));
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
__eliscript_tdz_ready_12 = true;
|
|
119
|
+
const interop_own_data_property = ((value, key) => {
|
|
120
|
+
{
|
|
121
|
+
let descriptor = (globalThis.Object)["getOwnPropertyDescriptor"](value, key);
|
|
122
|
+
if ((!((descriptor === undefined)) && __eliscript_truthy(__eliscript_at(((globalThis.Object)["prototype"])["hasOwnProperty"], "call")(descriptor, "value")))) {
|
|
123
|
+
return ({"ok": true, "value": (descriptor)["value"]});
|
|
124
|
+
} else {
|
|
125
|
+
return ({"ok": false, "value": undefined});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
__eliscript_tdz_ready_13 = true;
|
|
130
|
+
const interop_define_property = ((target, key, value) => {
|
|
131
|
+
(globalThis.Object)["defineProperty"](target, key, ({"value": value, "enumerable": true, "configurable": true, "writable": true}));
|
|
132
|
+
return target;
|
|
133
|
+
});
|
|
134
|
+
__eliscript_tdz_ready_14 = true;
|
|
135
|
+
const interop_map_set = ((target, key, value) => {
|
|
136
|
+
__eliscript_at(((globalThis.Map)["prototype"])["set"], "call")(target, key, value);
|
|
137
|
+
return target;
|
|
138
|
+
});
|
|
139
|
+
__eliscript_tdz_ready_15 = true;
|
|
140
|
+
const interop_set_add = ((target, value) => {
|
|
141
|
+
__eliscript_at(((globalThis.Set)["prototype"])["add"], "call")(target, value);
|
|
142
|
+
return target;
|
|
143
|
+
});
|
|
144
|
+
__eliscript_tdz_ready_16 = true;
|
|
145
|
+
function interop_fail(code, message, path, origin = null) {
|
|
146
|
+
return ((__eliscript_value_1) => { throw __eliscript_value_1; })(({"kind": "eliscript/interop-error", "code": code, "message": message, "path": path, "origin": origin}));
|
|
147
|
+
}
|
|
148
|
+
function array_QMARK_(value) {
|
|
149
|
+
return (__eliscript_tdz_ready_0 === true ? interop_array_predicate : __eliscript_tdz_error("interop_array_predicate"))(value);
|
|
150
|
+
}
|
|
151
|
+
function object_QMARK_(value) {
|
|
152
|
+
return (__eliscript_tdz_ready_3 === true ? interop_object_predicate : __eliscript_tdz_error("interop_object_predicate"))(value);
|
|
153
|
+
}
|
|
154
|
+
function js_map_QMARK_(value) {
|
|
155
|
+
return (__eliscript_tdz_ready_1 === true ? interop_map_predicate : __eliscript_tdz_error("interop_map_predicate"))(value);
|
|
156
|
+
}
|
|
157
|
+
function js_set_QMARK_(value) {
|
|
158
|
+
return (__eliscript_tdz_ready_2 === true ? interop_set_predicate : __eliscript_tdz_error("interop_set_predicate"))(value);
|
|
159
|
+
}
|
|
160
|
+
function js_array(...values) {
|
|
161
|
+
return values;
|
|
162
|
+
}
|
|
163
|
+
function js_object(...key_values) {
|
|
164
|
+
if ((__eliscript_numeric_rem(((key_values) ?? []).length, 2) !== 0)) {
|
|
165
|
+
interop_fail("ELI-INTEROP-INVALID-ENTRY", "js-object requires an even number of key/value arguments", "$");
|
|
166
|
+
}
|
|
167
|
+
{
|
|
168
|
+
let result = (__eliscript_tdz_ready_7 === true ? interop_object_factory : __eliscript_tdz_error("interop_object_factory"))();
|
|
169
|
+
let index = 0;
|
|
170
|
+
while (__eliscript_numeric_relation("<", index, ((key_values) ?? []).length)) {
|
|
171
|
+
{
|
|
172
|
+
let key = ((((key_values) ?? [])[index]) ?? null);
|
|
173
|
+
if (!((__eliscript_value_type(key) === "string"))) {
|
|
174
|
+
interop_fail("ELI-INTEROP-INVALID-KEY", "js-object keys must be strings", (String("$[") + String(index) + String("]")));
|
|
175
|
+
}
|
|
176
|
+
(__eliscript_tdz_ready_14 === true ? interop_define_property : __eliscript_tdz_error("interop_define_property"))(result, key, ((((key_values) ?? [])[(index + 1)]) ?? null));
|
|
177
|
+
}
|
|
178
|
+
((index = (index + 2)));
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function js_map(...entries) {
|
|
184
|
+
{
|
|
185
|
+
let result = (__eliscript_tdz_ready_5 === true ? interop_map_factory : __eliscript_tdz_error("interop_map_factory"))();
|
|
186
|
+
let index = 0;
|
|
187
|
+
while (__eliscript_numeric_relation("<", index, ((entries) ?? []).length)) {
|
|
188
|
+
{
|
|
189
|
+
let entry = ((((entries) ?? [])[index]) ?? null);
|
|
190
|
+
if (!((__eliscript_truthy(array_QMARK_(entry)) && (((entry) ?? []).length === 2)))) {
|
|
191
|
+
interop_fail("ELI-INTEROP-INVALID-ENTRY", "js-map entries must be two-value native arrays", (String("$[") + String(index) + String("]")));
|
|
192
|
+
}
|
|
193
|
+
(__eliscript_tdz_ready_15 === true ? interop_map_set : __eliscript_tdz_error("interop_map_set"))(result, ((((entry) ?? [])[0]) ?? null), ((((entry) ?? [])[1]) ?? null));
|
|
194
|
+
}
|
|
195
|
+
((index = (index + 1)));
|
|
196
|
+
}
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function js_set(...values) {
|
|
201
|
+
{
|
|
202
|
+
let result = (__eliscript_tdz_ready_6 === true ? interop_set_factory : __eliscript_tdz_error("interop_set_factory"))();
|
|
203
|
+
let index = 0;
|
|
204
|
+
while (__eliscript_numeric_relation("<", index, ((values) ?? []).length)) {
|
|
205
|
+
(__eliscript_tdz_ready_16 === true ? interop_set_add : __eliscript_tdz_error("interop_set_add"))(result, ((((values) ?? [])[index]) ?? null));
|
|
206
|
+
((index = (index + 1)));
|
|
207
|
+
}
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function interop_option_value(options, key, fallback) {
|
|
212
|
+
if (!(__eliscript_truthy(Object.prototype.hasOwnProperty.call((options) ?? {}, key)))) {
|
|
213
|
+
return fallback;
|
|
214
|
+
} else {
|
|
215
|
+
{
|
|
216
|
+
let property = (__eliscript_tdz_ready_13 === true ? interop_own_data_property : __eliscript_tdz_error("interop_own_data_property"))(options, key);
|
|
217
|
+
if (!(__eliscript_truthy(((property)["ok"] ?? false)))) {
|
|
218
|
+
interop_fail("ELI-INTEROP-ACCESSOR", "interop option accessors are not evaluated", interop_object_path("$", key));
|
|
219
|
+
}
|
|
220
|
+
return ((property)["value"] ?? null);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function interop_options(options) {
|
|
225
|
+
if ((options == null)) {
|
|
226
|
+
return ({"deep": false, "max-depth": 256, "max-values": 1000000});
|
|
227
|
+
} else {
|
|
228
|
+
if (!(__eliscript_truthy(object_QMARK_(options)))) {
|
|
229
|
+
interop_fail("ELI-INTEROP-INVALID-OPTIONS", "interop options must be a plain object or nil", "$");
|
|
230
|
+
}
|
|
231
|
+
{
|
|
232
|
+
let keys = (__eliscript_tdz_ready_12 === true ? interop_enumerable_own_keys : __eliscript_tdz_error("interop_enumerable_own_keys"))(options);
|
|
233
|
+
let index = 0;
|
|
234
|
+
while (__eliscript_numeric_relation("<", index, ((keys) ?? []).length)) {
|
|
235
|
+
{
|
|
236
|
+
let key = ((((keys) ?? [])[index]) ?? null);
|
|
237
|
+
if (!(((key === "deep") || (key === "maxDepth") || (key === "maxValues")))) {
|
|
238
|
+
interop_fail("ELI-INTEROP-INVALID-OPTIONS", ((__eliscript_value_type(key) === "string") ? (String("unknown interop option: ") + String(key)) : "unknown interop Symbol option"), "$");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
((index = (index + 1)));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
{
|
|
245
|
+
let deep = interop_option_value(options, "deep", false);
|
|
246
|
+
let max_depth = interop_option_value(options, "maxDepth", 256);
|
|
247
|
+
let max_values = interop_option_value(options, "maxValues", 1000000);
|
|
248
|
+
if (!((__eliscript_value_type(deep) === "boolean"))) {
|
|
249
|
+
interop_fail("ELI-INTEROP-INVALID-OPTIONS", "deep must be a boolean", "$");
|
|
250
|
+
}
|
|
251
|
+
if (!((__eliscript_truthy((__eliscript_tdz_ready_4 === true ? interop_safe_integer_predicate : __eliscript_tdz_error("interop_safe_integer_predicate"))(max_depth)) && __eliscript_numeric_relation(">=", max_depth, 0)))) {
|
|
252
|
+
interop_fail("ELI-INTEROP-INVALID-OPTIONS", "maxDepth must be a non-negative safe integer", "$");
|
|
253
|
+
}
|
|
254
|
+
if (!((__eliscript_truthy((__eliscript_tdz_ready_4 === true ? interop_safe_integer_predicate : __eliscript_tdz_error("interop_safe_integer_predicate"))(max_values)) && __eliscript_numeric_relation(">", max_values, 0)))) {
|
|
255
|
+
interop_fail("ELI-INTEROP-INVALID-OPTIONS", "maxValues must be a positive safe integer", "$");
|
|
256
|
+
}
|
|
257
|
+
return ({"deep": deep, "max-depth": max_depth, "max-values": max_values});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function interop_context(options, direction) {
|
|
262
|
+
{
|
|
263
|
+
let normalized = interop_options(options);
|
|
264
|
+
return ({"deep": ((normalized)["deep"] ?? false), "max-depth": ((normalized)["max-depth"] ?? 256), "max-values": ((normalized)["max-values"] ?? 1000000), "count": 0, "direction": direction, "memo": (__eliscript_tdz_ready_5 === true ? interop_map_factory : __eliscript_tdz_error("interop_map_factory"))(), "active": (__eliscript_tdz_ready_5 === true ? interop_map_factory : __eliscript_tdz_error("interop_map_factory"))()});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function interop_step(context, path, depth, index = null) {
|
|
268
|
+
if (__eliscript_numeric_relation(">", depth, ((context)["max-depth"] ?? 256))) {
|
|
269
|
+
interop_fail("ELI-INTEROP-DEPTH-LIMIT", "deep conversion exceeded maxDepth", ((index === null) ? path : interop_index_path(path, index)));
|
|
270
|
+
}
|
|
271
|
+
{
|
|
272
|
+
let count = (((context)["count"] ?? 0) + 1);
|
|
273
|
+
((context)["count"] = count);
|
|
274
|
+
if (__eliscript_numeric_relation(">", count, ((context)["max-values"] ?? 1000000))) {
|
|
275
|
+
return interop_fail("ELI-INTEROP-VALUE-LIMIT", "deep conversion exceeded maxValues", ((index === null) ? path : interop_index_path(path, index)));
|
|
276
|
+
} else {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function interop_scalar_QMARK_(value) {
|
|
282
|
+
{
|
|
283
|
+
let type = __eliscript_value_type(value);
|
|
284
|
+
return ((type === "null") || (type === "undefined") || (type === "boolean") || (type === "number") || (type === "bigint") || (type === "string") || (type === "keyword") || (type === "symbol"));
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function interop_kind(value) {
|
|
288
|
+
if (__eliscript_truthy(persistent_list_QMARK_(value))) {
|
|
289
|
+
return "portable-list";
|
|
290
|
+
} else {
|
|
291
|
+
if (__eliscript_truthy(persistent_vector_QMARK_(value))) {
|
|
292
|
+
return "portable-vector";
|
|
293
|
+
} else {
|
|
294
|
+
if (__eliscript_truthy(persistent_map_QMARK_(value))) {
|
|
295
|
+
return "portable-map";
|
|
296
|
+
} else {
|
|
297
|
+
if (__eliscript_truthy(persistent_set_QMARK_(value))) {
|
|
298
|
+
return "portable-set";
|
|
299
|
+
} else {
|
|
300
|
+
if (__eliscript_truthy(RuntimeVector.isPersistentVector(value))) {
|
|
301
|
+
return "runtime-vector";
|
|
302
|
+
} else {
|
|
303
|
+
if (__eliscript_truthy(RuntimeMap.isPersistentHashMap(value))) {
|
|
304
|
+
return "runtime-map";
|
|
305
|
+
} else {
|
|
306
|
+
if (__eliscript_truthy(RuntimeSet.isPersistentHashSet(value))) {
|
|
307
|
+
return "runtime-set";
|
|
308
|
+
} else {
|
|
309
|
+
if (__eliscript_truthy(array_QMARK_(value))) {
|
|
310
|
+
return "host-array";
|
|
311
|
+
} else {
|
|
312
|
+
if (__eliscript_truthy(js_map_QMARK_(value))) {
|
|
313
|
+
return "host-map";
|
|
314
|
+
} else {
|
|
315
|
+
if (__eliscript_truthy(js_set_QMARK_(value))) {
|
|
316
|
+
return "host-set";
|
|
317
|
+
} else {
|
|
318
|
+
if (__eliscript_truthy(object_QMARK_(value))) {
|
|
319
|
+
return "host-object";
|
|
320
|
+
} else {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
function interop_persistent_kind_QMARK_(kind) {
|
|
335
|
+
return ((kind === "portable-list") || (kind === "portable-vector") || (kind === "portable-map") || (kind === "portable-set") || (kind === "runtime-vector") || (kind === "runtime-map") || (kind === "runtime-set"));
|
|
336
|
+
}
|
|
337
|
+
function interop_index_path(path, index) {
|
|
338
|
+
return (String(path) + String("[") + String(index) + String("]"));
|
|
339
|
+
}
|
|
340
|
+
function interop_map_key_path(path, index) {
|
|
341
|
+
return (String(path) + String("<key:") + String(index) + String(">"));
|
|
342
|
+
}
|
|
343
|
+
function interop_map_value_path(path, index) {
|
|
344
|
+
return (String(path) + String("<value:") + String(index) + String(">"));
|
|
345
|
+
}
|
|
346
|
+
function interop_set_path(path, index) {
|
|
347
|
+
return (String(path) + String("<set:") + String(index) + String(">"));
|
|
348
|
+
}
|
|
349
|
+
function interop_object_path(path, key) {
|
|
350
|
+
return (String(path) + String("[") + String((__eliscript_tdz_ready_11 === true ? interop_json_string : __eliscript_tdz_error("interop_json_string"))(key)) + String("]"));
|
|
351
|
+
}
|
|
352
|
+
function interop_convert_container(source, context, path, convert) {
|
|
353
|
+
{
|
|
354
|
+
let memo = ((context)["memo"] ?? null);
|
|
355
|
+
let active = ((context)["active"] ?? null);
|
|
356
|
+
if (__eliscript_truthy((active)["has"](source))) {
|
|
357
|
+
interop_fail("ELI-INTEROP-CYCLE", "deep conversion encountered a cycle", path, (active)["get"](source));
|
|
358
|
+
}
|
|
359
|
+
if (__eliscript_truthy((memo)["has"](source))) {
|
|
360
|
+
return (memo)["get"](source);
|
|
361
|
+
} else {
|
|
362
|
+
(active)["set"](source, path);
|
|
363
|
+
try {
|
|
364
|
+
{
|
|
365
|
+
let result = convert();
|
|
366
|
+
(memo)["set"](source, result);
|
|
367
|
+
return result;
|
|
368
|
+
}
|
|
369
|
+
} finally {
|
|
370
|
+
(active)["delete"](source);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function interop_sequence_source(source, kind) {
|
|
376
|
+
if ((kind === "portable-list")) {
|
|
377
|
+
return persistent_list_to_array(source);
|
|
378
|
+
} else {
|
|
379
|
+
if ((kind === "portable-vector")) {
|
|
380
|
+
{
|
|
381
|
+
let values = [];
|
|
382
|
+
let index = 0;
|
|
383
|
+
while (__eliscript_numeric_relation("<", index, persistent_vector_count(source))) {
|
|
384
|
+
(values)["push"](persistent_vector_nth(source, index, null));
|
|
385
|
+
((index = (index + 1)));
|
|
386
|
+
}
|
|
387
|
+
return values;
|
|
388
|
+
}
|
|
389
|
+
} else {
|
|
390
|
+
if ((kind === "runtime-vector")) {
|
|
391
|
+
return (__eliscript_tdz_ready_10 === true ? interop_iterable_values : __eliscript_tdz_error("interop_iterable_values"))(source);
|
|
392
|
+
} else {
|
|
393
|
+
return source;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function interop_map_source(source, kind, context, path) {
|
|
399
|
+
if ((kind === "portable-map")) {
|
|
400
|
+
return persistent_map_reduce(((entries, key, value) => {
|
|
401
|
+
(entries)["push"]([key, value]);
|
|
402
|
+
return entries;
|
|
403
|
+
}), [], source);
|
|
404
|
+
} else {
|
|
405
|
+
if ((kind === "runtime-map")) {
|
|
406
|
+
return (__eliscript_tdz_ready_10 === true ? interop_iterable_values : __eliscript_tdz_error("interop_iterable_values"))(source);
|
|
407
|
+
} else {
|
|
408
|
+
if ((kind === "host-map")) {
|
|
409
|
+
return (__eliscript_tdz_ready_8 === true ? interop_map_entries : __eliscript_tdz_error("interop_map_entries"))(source);
|
|
410
|
+
} else {
|
|
411
|
+
{
|
|
412
|
+
let keys = (__eliscript_tdz_ready_12 === true ? interop_enumerable_own_keys : __eliscript_tdz_error("interop_enumerable_own_keys"))(source);
|
|
413
|
+
let entries = [];
|
|
414
|
+
let index = 0;
|
|
415
|
+
while (__eliscript_numeric_relation("<", index, ((keys) ?? []).length)) {
|
|
416
|
+
{
|
|
417
|
+
let key = ((((keys) ?? [])[index]) ?? null);
|
|
418
|
+
let _valid_key = (!((__eliscript_value_type(key) === "string")) ? interop_fail("ELI-INTEROP-INVALID-KEY", "plain object keys must be strings", path) : null);
|
|
419
|
+
let key_path = interop_object_path(path, key);
|
|
420
|
+
let property = (__eliscript_tdz_ready_13 === true ? interop_own_data_property : __eliscript_tdz_error("interop_own_data_property"))(source, key);
|
|
421
|
+
if (!(__eliscript_truthy(((property)["ok"] ?? false)))) {
|
|
422
|
+
interop_fail("ELI-INTEROP-ACCESSOR", "plain object accessors are not converted", key_path);
|
|
423
|
+
}
|
|
424
|
+
(entries)["push"]([key, ((property)["value"] ?? null)]);
|
|
425
|
+
}
|
|
426
|
+
((index = (index + 1)));
|
|
427
|
+
}
|
|
428
|
+
return entries;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function interop_set_source(source, kind) {
|
|
435
|
+
if ((kind === "portable-set")) {
|
|
436
|
+
return persistent_set_reduce(((values, value) => {
|
|
437
|
+
(values)["push"](value);
|
|
438
|
+
return values;
|
|
439
|
+
}), [], source);
|
|
440
|
+
} else {
|
|
441
|
+
if ((kind === "runtime-set")) {
|
|
442
|
+
return (__eliscript_tdz_ready_10 === true ? interop_iterable_values : __eliscript_tdz_error("interop_iterable_values"))(source);
|
|
443
|
+
} else {
|
|
444
|
+
return (__eliscript_tdz_ready_9 === true ? interop_set_values : __eliscript_tdz_error("interop_set_values"))(source);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function interop_child_to_js(value, context, path, depth) {
|
|
449
|
+
if (__eliscript_truthy(((context)["deep"] ?? false))) {
|
|
450
|
+
return interop_to_js_node(value, context, path, depth);
|
|
451
|
+
} else {
|
|
452
|
+
return value;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function interop_child_from_js(value, context, path, depth) {
|
|
456
|
+
if (__eliscript_truthy(((context)["deep"] ?? false))) {
|
|
457
|
+
return interop_from_js_node(value, context, path, depth);
|
|
458
|
+
} else {
|
|
459
|
+
return value;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function interop_sequence_child(value, context, path, index, depth, convert) {
|
|
463
|
+
if (!(__eliscript_truthy(((context)["deep"] ?? false)))) {
|
|
464
|
+
return value;
|
|
465
|
+
} else {
|
|
466
|
+
if (__eliscript_truthy(interop_scalar_QMARK_(value))) {
|
|
467
|
+
interop_step(context, path, depth, index);
|
|
468
|
+
return value;
|
|
469
|
+
} else {
|
|
470
|
+
return convert(value, context, interop_index_path(path, index), depth);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
function interop_to_js_sequence(source, kind, context, path, depth) {
|
|
475
|
+
{
|
|
476
|
+
let source_values = interop_sequence_source(source, kind);
|
|
477
|
+
let result = [];
|
|
478
|
+
let index = 0;
|
|
479
|
+
while (__eliscript_numeric_relation("<", index, ((source_values) ?? []).length)) {
|
|
480
|
+
(result)["push"](interop_sequence_child(((((source_values) ?? [])[index]) ?? null), context, path, index, (depth + 1), interop_to_js_node));
|
|
481
|
+
((index = (index + 1)));
|
|
482
|
+
}
|
|
483
|
+
return result;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function interop_to_js_map(source, kind, context, path, depth) {
|
|
487
|
+
{
|
|
488
|
+
let entries = interop_map_source(source, kind, context, path);
|
|
489
|
+
let result = (__eliscript_tdz_ready_5 === true ? interop_map_factory : __eliscript_tdz_error("interop_map_factory"))();
|
|
490
|
+
let index = 0;
|
|
491
|
+
while (__eliscript_numeric_relation("<", index, ((entries) ?? []).length)) {
|
|
492
|
+
{
|
|
493
|
+
let entry = ((((entries) ?? [])[index]) ?? null);
|
|
494
|
+
(__eliscript_tdz_ready_15 === true ? interop_map_set : __eliscript_tdz_error("interop_map_set"))(result, interop_child_to_js(((((entry) ?? [])[0]) ?? null), context, interop_map_key_path(path, index), (depth + 1)), interop_child_to_js(((((entry) ?? [])[1]) ?? null), context, interop_map_value_path(path, index), (depth + 1)));
|
|
495
|
+
}
|
|
496
|
+
((index = (index + 1)));
|
|
497
|
+
}
|
|
498
|
+
return result;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function interop_to_js_set(source, kind, context, path, depth) {
|
|
502
|
+
{
|
|
503
|
+
let values = interop_set_source(source, kind);
|
|
504
|
+
let result = (__eliscript_tdz_ready_6 === true ? interop_set_factory : __eliscript_tdz_error("interop_set_factory"))();
|
|
505
|
+
let index = 0;
|
|
506
|
+
while (__eliscript_numeric_relation("<", index, ((values) ?? []).length)) {
|
|
507
|
+
(__eliscript_tdz_ready_16 === true ? interop_set_add : __eliscript_tdz_error("interop_set_add"))(result, interop_child_to_js(((((values) ?? [])[index]) ?? null), context, interop_set_path(path, index), (depth + 1)));
|
|
508
|
+
((index = (index + 1)));
|
|
509
|
+
}
|
|
510
|
+
return result;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function interop_to_js_plain_object(source, context, path, depth) {
|
|
514
|
+
{
|
|
515
|
+
let entries = interop_map_source(source, "host-object", context, path);
|
|
516
|
+
let result = (__eliscript_tdz_ready_7 === true ? interop_object_factory : __eliscript_tdz_error("interop_object_factory"))();
|
|
517
|
+
let index = 0;
|
|
518
|
+
while (__eliscript_numeric_relation("<", index, ((entries) ?? []).length)) {
|
|
519
|
+
{
|
|
520
|
+
let entry = ((((entries) ?? [])[index]) ?? null);
|
|
521
|
+
let key = ((((entry) ?? [])[0]) ?? null);
|
|
522
|
+
(__eliscript_tdz_ready_14 === true ? interop_define_property : __eliscript_tdz_error("interop_define_property"))(result, key, interop_child_to_js(((((entry) ?? [])[1]) ?? null), context, interop_object_path(path, key), (depth + 1)));
|
|
523
|
+
}
|
|
524
|
+
((index = (index + 1)));
|
|
525
|
+
}
|
|
526
|
+
return result;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function interop_to_js_node(value, context, path, depth) {
|
|
530
|
+
interop_step(context, path, depth);
|
|
531
|
+
if (__eliscript_truthy(interop_scalar_QMARK_(value))) {
|
|
532
|
+
return value;
|
|
533
|
+
} else {
|
|
534
|
+
{
|
|
535
|
+
let kind = interop_kind(value);
|
|
536
|
+
if ((kind === null)) {
|
|
537
|
+
if (__eliscript_truthy(((context)["deep"] ?? false))) {
|
|
538
|
+
return interop_fail("ELI-INTEROP-UNSUPPORTED", (String("unsupported deep to-js value: ") + String(__eliscript_value_type(value))), path);
|
|
539
|
+
} else {
|
|
540
|
+
return value;
|
|
541
|
+
}
|
|
542
|
+
} else {
|
|
543
|
+
if ((!(__eliscript_truthy(((context)["deep"] ?? false))) && ((kind === "host-array") || (kind === "host-map") || (kind === "host-set") || (kind === "host-object")))) {
|
|
544
|
+
return value;
|
|
545
|
+
} else {
|
|
546
|
+
return interop_convert_container(value, context, path, (() => {
|
|
547
|
+
if (((kind === "portable-list") || (kind === "portable-vector") || (kind === "runtime-vector") || (kind === "host-array"))) {
|
|
548
|
+
return interop_to_js_sequence(value, kind, context, path, depth);
|
|
549
|
+
} else {
|
|
550
|
+
if (((kind === "portable-map") || (kind === "runtime-map") || (kind === "host-map"))) {
|
|
551
|
+
return interop_to_js_map(value, kind, context, path, depth);
|
|
552
|
+
} else {
|
|
553
|
+
if (((kind === "portable-set") || (kind === "runtime-set") || (kind === "host-set"))) {
|
|
554
|
+
return interop_to_js_set(value, kind, context, path, depth);
|
|
555
|
+
} else {
|
|
556
|
+
return interop_to_js_plain_object(value, context, path, depth);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}));
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function interop_from_js_sequence(source, kind, context, path, depth) {
|
|
567
|
+
{
|
|
568
|
+
let source_values = interop_sequence_source(source, kind);
|
|
569
|
+
let values = [];
|
|
570
|
+
let index = 0;
|
|
571
|
+
while (__eliscript_numeric_relation("<", index, ((source_values) ?? []).length)) {
|
|
572
|
+
(values)["push"](interop_sequence_child(((((source_values) ?? [])[index]) ?? null), context, path, index, (depth + 1), interop_from_js_node));
|
|
573
|
+
((index = (index + 1)));
|
|
574
|
+
}
|
|
575
|
+
if ((kind === "portable-list")) {
|
|
576
|
+
return persistent_list_from_array(values);
|
|
577
|
+
} else {
|
|
578
|
+
if ((kind === "portable-vector")) {
|
|
579
|
+
return persistent_vector_from_array(values);
|
|
580
|
+
} else {
|
|
581
|
+
return RuntimeVector.persistentVector(...(values ?? []));
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function interop_from_js_map(source, kind, context, path, depth) {
|
|
587
|
+
{
|
|
588
|
+
let entries = interop_map_source(source, kind, context, path);
|
|
589
|
+
let portable = (kind === "portable-map");
|
|
590
|
+
let result = ((kind === "portable-map") ? empty_value_map() : RuntimeMap.EMPTY_MAP);
|
|
591
|
+
let index = 0;
|
|
592
|
+
while (__eliscript_numeric_relation("<", index, ((entries) ?? []).length)) {
|
|
593
|
+
{
|
|
594
|
+
let entry = ((((entries) ?? [])[index]) ?? null);
|
|
595
|
+
let key_path = ((kind === "host-object") ? interop_object_path(path, ((((entry) ?? [])[0]) ?? null)) : interop_map_key_path(path, index));
|
|
596
|
+
let value_path = ((kind === "host-object") ? interop_object_path(path, ((((entry) ?? [])[0]) ?? null)) : interop_map_value_path(path, index));
|
|
597
|
+
let key = interop_child_from_js(((((entry) ?? [])[0]) ?? null), context, key_path, (depth + 1));
|
|
598
|
+
let item_value = interop_child_from_js(((((entry) ?? [])[1]) ?? null), context, value_path, (depth + 1));
|
|
599
|
+
let present = (__eliscript_truthy(portable) ? persistent_map_has_QMARK_(result, key) : (result)["has"](key));
|
|
600
|
+
if (__eliscript_truthy(present)) {
|
|
601
|
+
interop_fail("ELI-INTEROP-DUPLICATE", "converted Map contains duplicate value-equal keys", key_path);
|
|
602
|
+
}
|
|
603
|
+
((result = (__eliscript_truthy(portable) ? persistent_map_assoc(result, key, item_value) : (result)["assoc"](key, item_value))));
|
|
604
|
+
}
|
|
605
|
+
((index = (index + 1)));
|
|
606
|
+
}
|
|
607
|
+
return result;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function interop_from_js_set(source, kind, context, path, depth) {
|
|
611
|
+
{
|
|
612
|
+
let values = interop_set_source(source, kind);
|
|
613
|
+
let portable = (kind === "portable-set");
|
|
614
|
+
let result = ((kind === "portable-set") ? empty_value_set() : RuntimeSet.EMPTY_SET);
|
|
615
|
+
let index = 0;
|
|
616
|
+
while (__eliscript_numeric_relation("<", index, ((values) ?? []).length)) {
|
|
617
|
+
{
|
|
618
|
+
let value = interop_child_from_js(((((values) ?? [])[index]) ?? null), context, interop_set_path(path, index), (depth + 1));
|
|
619
|
+
let present = (__eliscript_truthy(portable) ? persistent_set_has_QMARK_(result, value) : (result)["has"](value));
|
|
620
|
+
if (__eliscript_truthy(present)) {
|
|
621
|
+
interop_fail("ELI-INTEROP-DUPLICATE", "converted Set contains duplicate value-equal members", interop_set_path(path, index));
|
|
622
|
+
}
|
|
623
|
+
((result = (__eliscript_truthy(portable) ? persistent_set_conj(result, value) : (result)["conj"](value))));
|
|
624
|
+
}
|
|
625
|
+
((index = (index + 1)));
|
|
626
|
+
}
|
|
627
|
+
return result;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
function interop_from_js_node(value, context, path, depth) {
|
|
631
|
+
interop_step(context, path, depth);
|
|
632
|
+
if (__eliscript_truthy(interop_scalar_QMARK_(value))) {
|
|
633
|
+
return value;
|
|
634
|
+
} else {
|
|
635
|
+
{
|
|
636
|
+
let kind = interop_kind(value);
|
|
637
|
+
if ((kind === null)) {
|
|
638
|
+
if (__eliscript_truthy(((context)["deep"] ?? false))) {
|
|
639
|
+
return interop_fail("ELI-INTEROP-UNSUPPORTED", (String("unsupported deep from-js value: ") + String(__eliscript_value_type(value))), path);
|
|
640
|
+
} else {
|
|
641
|
+
return value;
|
|
642
|
+
}
|
|
643
|
+
} else {
|
|
644
|
+
if ((!(__eliscript_truthy(((context)["deep"] ?? false))) && __eliscript_truthy(interop_persistent_kind_QMARK_(kind)))) {
|
|
645
|
+
return value;
|
|
646
|
+
} else {
|
|
647
|
+
return interop_convert_container(value, context, path, (() => {
|
|
648
|
+
if (((kind === "portable-list") || (kind === "portable-vector") || (kind === "runtime-vector") || (kind === "host-array"))) {
|
|
649
|
+
return interop_from_js_sequence(value, kind, context, path, depth);
|
|
650
|
+
} else {
|
|
651
|
+
if (((kind === "portable-map") || (kind === "runtime-map") || (kind === "host-map") || (kind === "host-object"))) {
|
|
652
|
+
return interop_from_js_map(value, kind, context, path, depth);
|
|
653
|
+
} else {
|
|
654
|
+
return interop_from_js_set(value, kind, context, path, depth);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}));
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
function interop_to_js_object_map(source, kind, context, path, depth) {
|
|
664
|
+
{
|
|
665
|
+
let entries = interop_map_source(source, kind, context, path);
|
|
666
|
+
let result = (__eliscript_tdz_ready_7 === true ? interop_object_factory : __eliscript_tdz_error("interop_object_factory"))();
|
|
667
|
+
let index = 0;
|
|
668
|
+
while (__eliscript_numeric_relation("<", index, ((entries) ?? []).length)) {
|
|
669
|
+
{
|
|
670
|
+
let entry = ((((entries) ?? [])[index]) ?? null);
|
|
671
|
+
let key = ((((entry) ?? [])[0]) ?? null);
|
|
672
|
+
if (!((__eliscript_value_type(key) === "string"))) {
|
|
673
|
+
interop_fail("ELI-INTEROP-INVALID-KEY", "to-js-object requires string Map keys", interop_map_key_path(path, index));
|
|
674
|
+
}
|
|
675
|
+
(__eliscript_tdz_ready_14 === true ? interop_define_property : __eliscript_tdz_error("interop_define_property"))(result, key, interop_child_to_js(((((entry) ?? [])[1]) ?? null), context, interop_object_path(path, key), (depth + 1)));
|
|
676
|
+
}
|
|
677
|
+
((index = (index + 1)));
|
|
678
|
+
}
|
|
679
|
+
return result;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
function to_js(value, options = null) {
|
|
683
|
+
return interop_to_js_node(value, interop_context(options, "to-js"), "$", 0);
|
|
684
|
+
}
|
|
685
|
+
function to_js_object(value, options = null) {
|
|
686
|
+
{
|
|
687
|
+
let context = interop_context(options, "to-js-object");
|
|
688
|
+
let kind = interop_kind(value);
|
|
689
|
+
interop_step(context, "$", 0);
|
|
690
|
+
if (!(((kind === "portable-map") || (kind === "runtime-map") || (kind === "host-map") || (kind === "host-object")))) {
|
|
691
|
+
interop_fail("ELI-INTEROP-UNSUPPORTED", "to-js-object requires a persistent Map, native Map, or plain object", "$");
|
|
692
|
+
}
|
|
693
|
+
return interop_convert_container(value, context, "$", (() => {
|
|
694
|
+
if ((kind === "host-object")) {
|
|
695
|
+
return interop_to_js_plain_object(value, context, "$", 0);
|
|
696
|
+
} else {
|
|
697
|
+
return interop_to_js_object_map(value, kind, context, "$", 0);
|
|
698
|
+
}
|
|
699
|
+
}));
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
function from_js(value, options = null) {
|
|
703
|
+
return interop_from_js_node(value, interop_context(options, "from-js"), "$", 0);
|
|
704
|
+
}
|
|
705
|
+
export {array_QMARK_, from_js, js_array, js_map, js_map_QMARK_, js_object, js_set, js_set_QMARK_, object_QMARK_, to_js, to_js_object};
|
|
706
|
+
//# sourceMappingURL=js.mjs.map
|