eliscript 0.1.0 → 0.1.1
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 +9 -8
- package/bootstrap/compiler/emitter.eli +161 -63
- package/bootstrap/host/check-cli.mjs +0 -1
- package/bootstrap/host/check-cli.mjs.map +1 -1
- package/bootstrap/host/compiler-session.eli +2 -1
- package/bootstrap/host/eliscript-cli.mjs +2 -9
- package/bootstrap/host/eliscript-cli.mjs.map +1 -1
- package/bootstrap/host/project-cli.mjs +1 -11
- package/bootstrap/host/project-cli.mjs.map +1 -1
- package/bootstrap/host/project.mjs +2 -8
- package/bootstrap/host/project.mjs.map +1 -1
- package/browser/README.md +1 -1
- package/compiler/README.md +2 -2
- package/compiler/eliscript-emitter.el +229 -85
- package/compiler/eliscript-ir-emitter.el +64 -34
- package/compiler/eliscript-project.el +20 -5
- package/dist/backends/async.mjs +1 -90
- package/dist/backends/async.mjs.map +1 -1
- package/dist/backends/binary.mjs +1 -91
- package/dist/backends/binary.mjs.map +1 -1
- package/dist/backends/capabilities.mjs +1 -90
- package/dist/backends/capabilities.mjs.map +1 -1
- package/dist/backends/elf.mjs +1 -90
- package/dist/backends/elf.mjs.map +1 -1
- package/dist/backends/managed.mjs +1 -94
- package/dist/backends/managed.mjs.map +1 -1
- package/dist/backends/memory.mjs +1 -90
- package/dist/backends/memory.mjs.map +1 -1
- package/dist/backends/native.mjs +1 -91
- package/dist/backends/native.mjs.map +1 -1
- package/dist/backends/numeric.mjs +1 -90
- package/dist/backends/numeric.mjs.map +1 -1
- package/dist/backends/optimize.mjs +1 -90
- package/dist/backends/optimize.mjs.map +1 -1
- package/dist/backends/regexp.mjs +1 -91
- package/dist/backends/regexp.mjs.map +1 -1
- package/dist/backends/sha256.mjs +2 -96
- package/dist/backends/sha256.mjs.map +1 -1
- package/dist/backends/wasm.mjs +1 -90
- package/dist/backends/wasm.mjs.map +1 -1
- package/dist/bootstrap/analyzer.mjs +1 -95
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +1 -105
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +848 -807
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +1 -96
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +1 -104
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +18 -172
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +1 -92
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/project.mjs +23 -209
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +1 -96
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/source-map.mjs +7 -112
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +7 -114
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +10 -176
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1 -93
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +105 -104
- package/dist/browser/loader.js +1 -1
- package/dist/browser/loader.mjs +5 -124
- package/dist/compiler-artifact.json +1 -1
- package/dist/host/compiler-session.mjs +205 -297
- package/dist/host/compiler-session.mjs.map +1 -1
- package/dist/host/compiler-tools.mjs +1 -91
- package/dist/host/compiler-tools.mjs.map +1 -1
- package/dist/literal-sources/runtime/core/order.eli +32 -10
- package/dist/literal-sources/runtime/core/sequence.eli +69 -28
- package/dist/literal-sources/runtime/core/vector.eli +2 -4
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +5 -5
- package/dist/literal-sources/stdlib/managed-literals.eli +1 -1
- package/dist/package.json +1 -0
- package/dist/runtime/math.mjs +62 -252
- package/dist/runtime/math.mjs.map +1 -1
- package/dist/runtime/prelude.mjs +95 -0
- package/dist/runtime/prelude.mjs.macro-origins.json +1 -0
- package/dist/runtime/prelude.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +1 -95
- package/dist/runtime/unicode-case-data.mjs.map +1 -1
- package/dist/runtime/unicode-case.mjs +3 -97
- package/dist/runtime/unicode-case.mjs.map +1 -1
- package/dist/stage3-release.json +1 -1
- package/editor/README.md +9 -4
- package/editor/eliscript-compat.el +164 -2
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +2 -1
- package/runtime/README.md +21 -1
- package/runtime/core/protocol-impl.mjs +1 -115
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/text-impl.mjs +1 -90
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/vector.eli +1 -1
- package/runtime/core/vector.mjs +0 -9
- package/runtime/emacs-compat.eli +5957 -2
- package/runtime/emacs-compat.mjs +13522 -2295
- package/runtime/emacs-compat.mjs.map +1 -0
- package/runtime/math.mjs +62 -252
- package/runtime/math.mjs.map +1 -1
- package/runtime/prelude.eli +4 -0
- package/runtime/prelude.mjs +95 -0
- package/runtime/prelude.mjs.map +1 -0
- package/runtime/unicode-case-data.mjs +1 -95
- package/runtime/unicode-case-data.mjs.map +1 -1
- package/runtime/unicode-case.mjs +3 -97
- package/runtime/unicode-case.mjs.map +1 -1
- package/stdlib/managed-literals.eli +1 -1
- package/stdlib/managed-runtime-vector.eli +2 -4
- package/tools/backends/compiler-build.mjs +3 -93
- package/tools/backends/compiler-cli.mjs +2 -15
- package/tools/backends/compiler-corpus-bit.mjs +2 -95
- package/tools/backends/compiler-corpus-cli-adapters.mjs +1 -97
- package/tools/backends/compiler-corpus-debugging.mjs +2 -95
- package/tools/backends/compiler-corpus-emitter.mjs +1 -97
- package/tools/backends/compiler-corpus-execution.mjs +2 -108
- package/tools/backends/compiler-corpus-fuzz.mjs +2 -95
- package/tools/backends/compiler-corpus-host-context.mjs +2 -99
- package/tools/backends/compiler-corpus-identity-host.mjs +18 -123
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +0 -9
- package/tools/backends/compiler-corpus-literal-provider.mjs +1 -91
- package/tools/backends/compiler-corpus-managed-adapters.mjs +1 -99
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +2 -113
- package/tools/backends/compiler-corpus-matchers.mjs +3 -106
- package/tools/backends/compiler-corpus-original-program.mjs +1 -91
- package/tools/backends/compiler-corpus-process.mjs +1 -92
- package/tools/backends/compiler-corpus-program-driver.mjs +1 -3
- package/tools/backends/compiler-corpus-project-adapters.mjs +1 -95
- package/tools/backends/compiler-corpus-project-entry-host.mjs +2 -92
- package/tools/backends/compiler-corpus-project-transport.mjs +1 -90
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1 -91
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1 -92
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +1 -91
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +1 -91
- package/tools/backends/compiler-corpus-reference.mjs +1 -90
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +2 -110
- package/tools/backends/compiler-corpus-tools-cli.mjs +1 -95
- package/tools/backends/compiler-corpus-tools-reference.mjs +22 -163
- package/tools/backends/compiler-corpus.mjs +3 -125
- package/tools/backends/compiler-matrix.mjs +1 -92
- package/tools/backends/compiler-package-browser.mjs +1 -90
- package/tools/backends/compiler-package.mjs +3 -95
- package/tools/backends/compiler-unicode-profile-host.mjs +1 -91
- package/tools/backends/dist/bootstrap-js-stages.mjs +1 -91
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs +1 -91
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
- package/tools/backends/dist/record-grid.mjs +1 -91
- package/tools/backends/dist/record-grid.mjs.map +1 -1
- package/tools/backends/dist/release-cli.mjs +4 -94
- package/tools/backends/dist/release-cli.mjs.map +1 -1
- package/tools/backends/dist/run-artifact.mjs +1 -91
- package/tools/backends/dist/run-artifact.mjs.map +1 -1
- package/tools/backends/eliscript/compiler-corpus-bit.eli +1 -0
- package/tools/backends/managed-foreign-binding.mjs +1 -95
- package/tools/backends/managed-host-lifecycle.mjs +1 -91
- package/tools/backends/managed-host-object-provider.mjs +18 -59
- package/tools/backends/managed-host-object-realm.mjs +1 -91
- package/tools/backends/managed-host-proxy.mjs +9 -18
- package/tools/backends/managed-host-runtime.mjs +3 -105
- package/tools/backends/managed-host.mjs +1 -104
- package/tools/backends/managed-module-graph.mjs +1 -97
- package/tools/backends/managed-runtime.mjs +1 -96
- package/tools/backends/managed-source-view.mjs +13 -108
- package/tools/backends/native-managed-runtime.mjs +1 -91
- package/tools/backends/native-memory.mjs +1 -91
- package/tools/backends/stage3-targets.mjs +1 -91
- package/tools/bootstrap-runtime.el +3 -2
- package/tools/project/project.eli +1 -1
- package/tools/testing/stdlib-bit-corpus-host.mjs +1 -90
- package/tools/testing/stdlib-bit.mjs +1 -90
- package/dist/bootstrap/package.json +0 -1
- package/dist/bootstrap/runtime/math.mjs +0 -1117
- package/dist/bootstrap/runtime/math.mjs.map +0 -1
- package/dist/bootstrap/runtime/unicode-case-data.mjs +0 -10125
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +0 -1
- package/dist/bootstrap/runtime/unicode-case.mjs +0 -281
- package/dist/bootstrap/runtime/unicode-case.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ modules, and bootstraps a compiler written in Eliscript itself.
|
|
|
15
15
|
[Core documentation](docs/README.md) ·
|
|
16
16
|
[Getting started](docs/getting-started.md) ·
|
|
17
17
|
[Language reference](docs/language-reference.md) ·
|
|
18
|
+
[Emacs-compatible syntax (0.1.0)](docs/emacs-compatible-syntax.md) ·
|
|
18
19
|
[Library API](https://liuchong.org/eliscript/pages/api.html) ·
|
|
19
20
|
[Playground](https://liuchong.org/eliscript/pages/playground.html) ·
|
|
20
21
|
[Roadmap](specs/0040-maturity-roadmap.md) ·
|
|
@@ -56,7 +57,7 @@ without a build server or repository files. Include `dist/browser/loader.js`
|
|
|
56
57
|
and use either `data-eliscript` or `<script type="text/eliscript">` tags:
|
|
57
58
|
|
|
58
59
|
```html
|
|
59
|
-
<script defer src="https://unpkg.com/eliscript@0.0
|
|
60
|
+
<script defer src="https://unpkg.com/eliscript@0.1.0/dist/browser/loader.js"></script>
|
|
60
61
|
<script type="text/eliscript">
|
|
61
62
|
(module app.live
|
|
62
63
|
(print "Hello from in-browser Eliscript!"))
|
|
@@ -75,12 +76,12 @@ alongside explicit `.mjs`).
|
|
|
75
76
|
|
|
76
77
|
| Area | State |
|
|
77
78
|
| --- | --- |
|
|
78
|
-
| Compiler | Emacs Lisp seed, reproducible self-hosted compiler, deterministic formatter, versioned canonical IR, Source Maps that name `.eli` files |
|
|
79
|
-
| Language |
|
|
80
|
-
| Data |
|
|
81
|
-
| Runtime | Host-free runtime semantics,
|
|
82
|
-
| Browser | An in-memory multi-file compile host, a module worker, and a compiler bundled for the browser — the [playground](https://liuchong.org/eliscript/pages/playground.html) compiles and runs Eliscript in the page |
|
|
83
|
-
| Editor | [`eliscript-mode`](editor/README.md)
|
|
79
|
+
| Compiler | Emacs Lisp seed, reproducible stage0–stage3 self-hosted compiler, deterministic formatter, versioned canonical IR, Source Maps that name `.eli` files, plus zero-glue WASM and ARM64 Native `:abi` backends |
|
|
80
|
+
| Language | 100% Emacs Lisp-compatible core (`eliscript-compat`) + `1+5+2` extension packs (`defun-case`, `let-bind`/`defun-bind`/`pcase-value`, `let-const`, `defmodule`, `defmacro-checked`, `with-async-scope`, `async-channel`), tail-safe `loop`/`recur` (50,000+ depth), protocols, records, `deftype`/`reify`, `case`/`condp`, and portable functions |
|
|
81
|
+
| Data | 7 persistent collection types (List, Vector, HAMT Map/Set, Queue, AVL Sorted Map/Set), `cl-defstruct-persistent` with Schema validation and JSON Schema round-trip, `state-cell`, transients, lazy sequences, and transducers |
|
|
82
|
+
| Runtime | Host-free runtime semantics, `eliscript/runtime/emacs-compat` dual-host compatibility runtime, lossless JS sentinels (`js-false`/`js-null`/`js-undefined`), cross-engine handle revocation, and a long-lived Emacs-to-JavaScript worker |
|
|
83
|
+
| Browser | An in-memory multi-file compile host, a module worker, standalone `dist/browser/loader.js`, and a compiler bundled for the browser — the [playground](https://liuchong.org/eliscript/pages/playground.html) compiles and runs Eliscript in the page |
|
|
84
|
+
| Editor | [`eliscript-mode`](editor/README.md), an evaluation REPL, and the `editor/eliscript-{compat,contract,data,bind,module,async,js,abi}.el` Emacs Lisp libraries |
|
|
84
85
|
| Applications | The [proving-ground site](https://liuchong.org/eliscript/examples/dogfood/_site/) and the packaged Action built from it, plus React, Org, and Vite probes as replaceable application evidence |
|
|
85
86
|
|
|
86
87
|
Experimental direct backends and the zero-import managed WASM heap are described
|
|
@@ -88,7 +89,7 @@ in the [backend runtime reference](tools/backends/README.md). The current delive
|
|
|
88
89
|
uses a JavaScript-hosted stage0–stage3 compiler chain that emits JavaScript,
|
|
89
90
|
WASM and native programs, with 12,000-depth persistent zipper traversal and
|
|
90
91
|
edited ascent verified across all three output targets:
|
|
91
|
-
[active plan](docs/bootstrap-0.0
|
|
92
|
+
[active plan](docs/bootstrap-0.1.0-plan.md).
|
|
92
93
|
|
|
93
94
|
## Project Status
|
|
94
95
|
|
|
@@ -28,8 +28,6 @@
|
|
|
28
28
|
"import { get as __eliscript_get } from \"eliscript/runtime/core/collection.mjs\";\nconst __eliscript_binding_missing = Symbol(\"eliscript.binding.missing\");\nconst __eliscript_binding_get = (value, key, notFound) => { if (value == null) return notFound; const prototype = typeof value === \"object\" ? Object.getPrototypeOf(value) : undefined; if (prototype === Object.prototype || prototype === null) { const type = key && Object.getOwnPropertyDescriptor(key, Symbol.for(\"eliscript.value.type\")); if (type?.value === \"keyword\" || type?.value === \"symbol\") key = key.qualifiedName; } return __eliscript_get(value, key, notFound); };\n")
|
|
29
29
|
(defconst number-conversion-intrinsics
|
|
30
30
|
"const __eliscript_number_intrinsic = globalThis.Number;\nconst __eliscript_bigint_intrinsic = globalThis.BigInt;\nconst __eliscript_numeric_apply = globalThis.Reflect.apply;\nconst __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;\nconst __eliscript_numeric_error = globalThis.TypeError;\nconst __eliscript_numeric_trim = globalThis.String.prototype.trim;\nconst __eliscript_numeric_slice = globalThis.String.prototype.slice;\nconst __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;\n")
|
|
31
|
-
(defconst number-conversion-capsule
|
|
32
|
-
"import { __eliscript_number_intrinsic, __eliscript_bigint_intrinsic, __eliscript_numeric_apply, __eliscript_numeric_symbol, __eliscript_numeric_error, __eliscript_numeric_trim, __eliscript_numeric_slice, __eliscript_numeric_exec } from \"data:text/javascript;base64,ZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X251bWJlcl9pbnRyaW5zaWMgPSBnbG9iYWxUaGlzLk51bWJlcjsKZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X2JpZ2ludF9pbnRyaW5zaWMgPSBnbG9iYWxUaGlzLkJpZ0ludDsKZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X251bWVyaWNfYXBwbHkgPSBnbG9iYWxUaGlzLlJlZmxlY3QuYXBwbHk7CmV4cG9ydCBjb25zdCBfX2VsaXNjcmlwdF9udW1lcmljX3N5bWJvbCA9IGdsb2JhbFRoaXMuU3ltYm9sLnRvUHJpbWl0aXZlOwpleHBvcnQgY29uc3QgX19lbGlzY3JpcHRfbnVtZXJpY19lcnJvciA9IGdsb2JhbFRoaXMuVHlwZUVycm9yOwpleHBvcnQgY29uc3QgX19lbGlzY3JpcHRfbnVtZXJpY190cmltID0gZ2xvYmFsVGhpcy5TdHJpbmcucHJvdG90eXBlLnRyaW07CmV4cG9ydCBjb25zdCBfX2VsaXNjcmlwdF9udW1lcmljX3NsaWNlID0gZ2xvYmFsVGhpcy5TdHJpbmcucHJvdG90eXBlLnNsaWNlOwpleHBvcnQgY29uc3QgX19lbGlzY3JpcHRfbnVtZXJpY19leGVjID0gZ2xvYmFsVGhpcy5SZWdFeHAucHJvdG90eXBlLmV4ZWM7Cg==\";\n")
|
|
33
31
|
(defconst number-conversion-body
|
|
34
32
|
"const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;\nconst __eliscript_numeric_object = (value) => value !== null && (typeof value === \"object\" || typeof value === \"function\" || (typeof value === \"undefined\" && value !== void 0));\nconst __eliscript_numeric_primitive = (value) => {\n if (!__eliscript_numeric_object(value)) return value;\n const exotic = value[__eliscript_numeric_symbol];\n if (exotic !== void 0 && exotic !== null) {\n const result = __eliscript_numeric_apply(exotic, value, [\"number\"]);\n if (!__eliscript_numeric_object(result)) return result;\n throw new __eliscript_numeric_error(\"Cannot convert object to primitive value\");\n }\n for (let index = 0; index < 2; index++) {\n const method = value[index === 0 ? \"valueOf\" : \"toString\"];\n if (typeof method === \"function\" || (typeof method === \"undefined\" && method !== void 0)) {\n const result = __eliscript_numeric_apply(method, value, []);\n if (!__eliscript_numeric_object(result)) return result;\n }\n }\n throw new __eliscript_numeric_error(\"Cannot convert object to primitive value\");\n};\nconst __eliscript_to_number = (value) => {\n const primitive = __eliscript_numeric_primitive(value);\n if (typeof primitive === \"string\") {\n const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);\n if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {\n let first = 2;\n while (first < text.length && text[first] === \"0\") first++;\n if (first === text.length) return 0;\n const prefix = text[1];\n const limit = prefix === \"x\" || prefix === \"X\" ? 256 : prefix === \"b\" || prefix === \"B\" ? 1024 : 342;\n if (text.length - first > limit) return 1 / 0;\n const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);\n return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));\n }\n }\n return __eliscript_number_intrinsic(primitive);\n};\n")
|
|
35
33
|
(defconst number-conversion-helper
|
|
@@ -38,10 +36,36 @@
|
|
|
38
36
|
"const __eliscript_numeric = (value) => {\n if (typeof value === \"number\" || typeof value === \"bigint\") return value;\n const primitive = __eliscript_numeric_primitive(value);\n if (typeof primitive === \"number\" || typeof primitive === \"bigint\") return primitive;\n return typeof primitive === \"string\" ? __eliscript_to_number(primitive) : +primitive;\n};\nconst __eliscript_implicit_number = (value) => {\n if (typeof value === \"number\") return value;\n const primitive = __eliscript_numeric_primitive(value);\n if (typeof primitive === \"bigint\") throw new __eliscript_numeric_error(\"Cannot convert a BigInt value to a number\");\n return typeof primitive === \"string\" ? __eliscript_to_number(primitive) : +primitive;\n};\nconst __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;\nconst __eliscript_numeric_sub = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };\nconst __eliscript_numeric_mul = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };\nconst __eliscript_numeric_div = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };\nconst __eliscript_numeric_rem = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };\nconst __eliscript_numeric_and = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };\nconst __eliscript_numeric_or = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };\nconst __eliscript_numeric_xor = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };\nconst __eliscript_numeric_shl = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };\nconst __eliscript_numeric_shr = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };\nconst __eliscript_numeric_ushr = (a, b) => { if (typeof a === \"number\" && typeof b === \"number\") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };\nconst __eliscript_numeric_neg = (a) => typeof a === \"number\" ? -a : -__eliscript_numeric(a);\nconst __eliscript_numeric_int32 = (a) => typeof a === \"number\" ? a | 0 : __eliscript_numeric(a) | 0;\nconst __eliscript_numeric_uint32 = (a) => typeof a === \"number\" ? a >>> 0 : __eliscript_numeric(a) >>> 0;\nconst __eliscript_numeric_not = (a) => typeof a === \"number\" ? ~a : ~__eliscript_numeric(a);\nconst __eliscript_numeric_relation = (operator, left, right) => {\n if (typeof left === \"number\" && typeof right === \"number\") {\n if (operator === \"<\") return left < right;\n if (operator === \"<=\") return left <= right;\n if (operator === \">\") return left > right;\n return left >= right;\n }\n let a = __eliscript_numeric_primitive(left);\n let b = __eliscript_numeric_primitive(right);\n const x = typeof a, y = typeof b;\n if (!((x === \"string\" && y === \"string\") || (x === \"bigint\" && y === \"string\") || (x === \"string\" && y === \"bigint\"))) {\n a = __eliscript_numeric(a);\n b = __eliscript_numeric(b);\n }\n if (operator === \"<\") return a < b;\n if (operator === \"<=\") return a <= b;\n if (operator === \">\") return a > b;\n return a >= b;\n};\n")
|
|
39
37
|
(defconst imul-intrinsic
|
|
40
38
|
"const __eliscript_numeric_imul_intrinsic = globalThis.Math.imul;\n")
|
|
41
|
-
(defconst imul-capsule
|
|
42
|
-
"import { __eliscript_numeric_imul_intrinsic } from \"data:text/javascript;base64,ZXhwb3J0IGNvbnN0IF9fZWxpc2NyaXB0X251bWVyaWNfaW11bF9pbnRyaW5zaWMgPSBnbG9iYWxUaGlzLk1hdGguaW11bDsK\";\n")
|
|
43
39
|
(defconst imul-operator-helper
|
|
44
40
|
"const __eliscript_numeric_imul = (a, b) => __eliscript_numeric_imul_intrinsic(__eliscript_implicit_number(a), __eliscript_implicit_number(b));\n")
|
|
41
|
+
;; One compiled runtime module owns every shared helper. Its own module scope
|
|
42
|
+
;; never binds globalThis, so captured intrinsics need no separate capsule.
|
|
43
|
+
(defconst prelude-array-text-names (js-array "__eliscript_at" "__eliscript_at_direct"))
|
|
44
|
+
(defconst prelude-number-conversion-names (js-array "__eliscript_to_number"))
|
|
45
|
+
(defconst prelude-numeric-coercion-names
|
|
46
|
+
(js-array "__eliscript_numeric_decrement" "__eliscript_numeric_relation"
|
|
47
|
+
"__eliscript_numeric_sub" "__eliscript_numeric_mul" "__eliscript_numeric_div"
|
|
48
|
+
"__eliscript_numeric_rem" "__eliscript_numeric_and" "__eliscript_numeric_or"
|
|
49
|
+
"__eliscript_numeric_xor" "__eliscript_numeric_shl" "__eliscript_numeric_shr"
|
|
50
|
+
"__eliscript_numeric_ushr" "__eliscript_numeric_neg" "__eliscript_numeric_int32"
|
|
51
|
+
"__eliscript_numeric_uint32" "__eliscript_numeric_not"))
|
|
52
|
+
(defconst prelude-imul-names (js-array "__eliscript_numeric_imul"))
|
|
53
|
+
(defconst prelude-module
|
|
54
|
+
(str "// Generated by Eliscript. Do not edit.\n"
|
|
55
|
+
"export" (js-call array-text-import :slice 6)
|
|
56
|
+
number-conversion-helper numeric-operator-helper imul-intrinsic imul-operator-helper
|
|
57
|
+
"export { "
|
|
58
|
+
(js-call (js-call prelude-number-conversion-names :concat
|
|
59
|
+
prelude-numeric-coercion-names prelude-imul-names) :join ", ")
|
|
60
|
+
" };\n"))
|
|
61
|
+
(defun prelude-import (array-text number-conversion numeric-coercion imul)
|
|
62
|
+
(let ((names (js-call (js-array) :concat
|
|
63
|
+
(if array-text prelude-array-text-names (js-array))
|
|
64
|
+
(if number-conversion prelude-number-conversion-names (js-array))
|
|
65
|
+
(if numeric-coercion prelude-numeric-coercion-names (js-array))
|
|
66
|
+
(if imul prelude-imul-names (js-array)))))
|
|
67
|
+
(if (= (js-length names) 0) ""
|
|
68
|
+
(str "import { " (js-call names :join ", ") " } from \"eliscript/runtime/prelude.mjs\";\n"))))
|
|
45
69
|
(defvar numeric-emission-profile false)
|
|
46
70
|
(defconst host-identity-token-helper
|
|
47
71
|
"const __eliscript_host_identity_token = (() => { const objects = new WeakMap(); const symbols = new Map(); let next = 1; return (value) => { const type = typeof value; if ((type !== \"object\" || value === null) && type !== \"function\" && type !== \"symbol\") throw new TypeError(\"host-identity-token expects an object, function, or symbol\"); const identities = type === \"symbol\" ? symbols : objects; const cached = identities.get(value); if (cached !== undefined) return cached; if (next > Number.MAX_SAFE_INTEGER) throw new RangeError(\"host identity token space exhausted\"); const token = next; next += 1; identities.set(value, token); return token; }; })();\n")
|
|
@@ -107,29 +131,96 @@
|
|
|
107
131
|
(defun tdz-defaults (node scope state)
|
|
108
132
|
(when (ir-property node "pattern")
|
|
109
133
|
(tdz-pattern-defaults (js-nth 0 (children node)) scope state)))
|
|
110
|
-
(defun tdz-
|
|
134
|
+
(defun tdz-statements (nodes statements)
|
|
111
135
|
(js-call nodes :forEach
|
|
112
136
|
(lambda (node)
|
|
113
|
-
(
|
|
137
|
+
(if (= (ir-kind node) "module-declaration")
|
|
138
|
+
(tdz-statements (children node) statements)
|
|
139
|
+
(js-call statements :push node))))
|
|
140
|
+
statements)
|
|
141
|
+
(defun tdz-predeclare (statements scope state)
|
|
142
|
+
(js-call statements :forEach
|
|
143
|
+
(lambda (node)
|
|
144
|
+
(let ((kind (ir-kind node)) (name (ir-value node)))
|
|
114
145
|
(cond
|
|
115
|
-
((= kind "module-declaration") (tdz-predeclare (children node) scope state))
|
|
116
146
|
((= kind "variable-declaration")
|
|
117
|
-
(let ((record (js-object :name
|
|
147
|
+
(let ((record (js-object :name name :index (js-length (get state :variables))
|
|
148
|
+
:mutable (ir-property node "mutable") :statement (get state :position)
|
|
149
|
+
:read false :write false)))
|
|
118
150
|
(js-call (get state :variables) :push record)
|
|
119
151
|
(js-call (get state :declarations) :set node record)
|
|
120
|
-
(js-call (get scope :names) :set (binding-name
|
|
121
|
-
((= kind "function-declaration")
|
|
152
|
+
(js-call (get scope :names) :set (binding-name name) record)))
|
|
153
|
+
((= kind "function-declaration")
|
|
154
|
+
(let ((key (binding-name name)))
|
|
155
|
+
(js-call (get state :functions) :add key)
|
|
156
|
+
(js-call (get scope :names) :set key (js-object :function key))
|
|
157
|
+
(when (ir-property node "portable") (js-call (get state :exported) :push key))))
|
|
158
|
+
((= kind "export-declaration")
|
|
159
|
+
(js-call (children node) :forEach
|
|
160
|
+
(lambda (reference) (js-call (get state :exported) :push (binding-name (ir-value reference))))))
|
|
122
161
|
((= kind "import-declaration")
|
|
162
|
+
(put state :imports t)
|
|
123
163
|
(js-call (children node) :forEach
|
|
124
|
-
(lambda (child) (js-call (get scope :names) :set (binding-name (ir-value child)) nil))))))
|
|
164
|
+
(lambda (child) (js-call (get scope :names) :set (binding-name (ir-value child)) nil))))))
|
|
165
|
+
(put state :position (1+ (get state :position))))))
|
|
166
|
+
(defun tdz-variable-p (record)
|
|
167
|
+
(and record (= (value-type (get record :index)) "number")))
|
|
168
|
+
(defun tdz-guarded-p (record)
|
|
169
|
+
(and record (or (get record :read) (get record :write))))
|
|
170
|
+
(defun tdz-reference (state record)
|
|
171
|
+
(let ((owner (get state :owner)) (references (get state :references)))
|
|
172
|
+
(unless (js-call references :has owner) (js-call references :set owner (js-array)))
|
|
173
|
+
(js-call (js-call references :get owner) :push (get record :function))))
|
|
174
|
+
(defun tdz-site (state kind record node)
|
|
175
|
+
(js-call (get state :sites) :push
|
|
176
|
+
(js-object :kind kind :record record :owner (get state :owner) :node node)))
|
|
177
|
+
;; A top-level statement runs at its own position. A function can first run
|
|
178
|
+
;; when a statement or earlier function references it; with imports an
|
|
179
|
+
;; exported function can run through a cycle before this module, and raw
|
|
180
|
+
;; JavaScript can call any function. Only accesses that can run before their
|
|
181
|
+
;; declaration completes are guarded.
|
|
182
|
+
(defun tdz-finalize (state)
|
|
183
|
+
(let ((functions (get state :functions)) (references (get state :references))
|
|
184
|
+
(raw (get state :raw)) (early (new globalThis.Map)) (pending (js-array))
|
|
185
|
+
(never (get state :position)) (all (get state :position)))
|
|
186
|
+
(let ((lower
|
|
187
|
+
(lambda (key index)
|
|
188
|
+
(when (and (js-call functions :has key)
|
|
189
|
+
(< index (if (js-call early :has key) (js-call early :get key) never)))
|
|
190
|
+
(js-call early :set key index)
|
|
191
|
+
(js-call pending :push key)))))
|
|
192
|
+
(when (get state :imports)
|
|
193
|
+
(js-call (get state :exported) :forEach (lambda (key) (funcall lower key -1))))
|
|
194
|
+
(js-call references :forEach
|
|
195
|
+
(lambda (keys owner)
|
|
196
|
+
(when (= (value-type owner) "number")
|
|
197
|
+
(js-call keys :forEach (lambda (key) (funcall lower key owner))))))
|
|
198
|
+
(js-call raw :forEach
|
|
199
|
+
(lambda (owner) (when (and (= (value-type owner) "number") (< owner all)) (setq all owner))))
|
|
200
|
+
(while (> (js-length pending) 0)
|
|
201
|
+
(let* ((key (js-call pending :pop)) (index (js-call early :get key)))
|
|
202
|
+
(when (and (js-call raw :has key) (< index all)) (setq all index))
|
|
203
|
+
(when (js-call references :has key)
|
|
204
|
+
(js-call (js-call references :get key) :forEach (lambda (callee) (funcall lower callee index)))))))
|
|
205
|
+
(js-call (get state :sites) :forEach
|
|
206
|
+
(lambda (site)
|
|
207
|
+
(let* ((record (get site :record)) (owner (get site :owner)) (read (= (get site :kind) "read"))
|
|
208
|
+
(start (if (js-call early :has owner) (js-call early :get owner) never))
|
|
209
|
+
(time (if (= (value-type owner) "number") owner (if (< all start) all start))))
|
|
210
|
+
(when (or (and (not read) (not (get record :mutable))) (<= time (get record :statement)))
|
|
211
|
+
(if read
|
|
212
|
+
(progn (put record :read t) (js-call (get state :reads) :set (get site :node) record))
|
|
213
|
+
(progn (put record :write t) (js-call (get state :writes) :set (get site :node) record)))))))))
|
|
125
214
|
(defun tdz-walk (node scope state)
|
|
126
215
|
(let ((kind (ir-kind node)) (nodes (children node)))
|
|
127
216
|
(cond
|
|
128
217
|
((or (= kind "reference") (= kind "assignment-pair"))
|
|
129
218
|
(let ((record (tdz-find scope (tdz-root-name (ir-value node)))))
|
|
130
|
-
(
|
|
131
|
-
|
|
219
|
+
(cond ((tdz-variable-p record)
|
|
220
|
+
(tdz-site state (if (= kind "reference") "read" "write") record node))
|
|
221
|
+
((and record (= kind "reference")) (tdz-reference state record))))
|
|
132
222
|
(js-call nodes :forEach (lambda (child) (tdz-walk child scope state))))
|
|
223
|
+
((= kind "raw-javascript") (js-call (get state :raw) :add (get state :owner)))
|
|
133
224
|
((or (= kind "function-declaration") (= kind "function-expression"))
|
|
134
225
|
(let ((child (tdz-scope scope)) (count (ir-property node "parameterCount")) (index 0))
|
|
135
226
|
(while (< index count) (tdz-defaults (js-nth index nodes) scope state) (setq index (1+ index)))
|
|
@@ -154,32 +245,46 @@
|
|
|
154
245
|
(let ((child (tdz-scope scope)) (binding (js-nth 0 nodes)) (index 1))
|
|
155
246
|
(tdz-defaults binding scope state) (tdz-bind binding child)
|
|
156
247
|
(while (< index (js-length nodes)) (tdz-walk (js-nth index nodes) child state) (setq index (1+ index)))))
|
|
157
|
-
((or (= kind "quoted-literal") (= kind "
|
|
248
|
+
((or (= kind "quoted-literal") (= kind "import-declaration") (= kind "export-declaration")) nil)
|
|
158
249
|
(t (js-call nodes :forEach (lambda (child) (tdz-walk child scope state)))))))
|
|
159
250
|
(defun tdz-prepare (program)
|
|
160
|
-
(let ((state (js-object :variables (js-array) :declarations (new globalThis.Map)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
251
|
+
(let* ((state (js-object :variables (js-array) :declarations (new globalThis.Map)
|
|
252
|
+
:reads (new globalThis.Map) :writes (new globalThis.Map)
|
|
253
|
+
:functions (new globalThis.Set) :references (new globalThis.Map) :raw (new globalThis.Set)
|
|
254
|
+
:exported (js-array) :imports false :sites (js-array) :position 0 :owner nil))
|
|
255
|
+
(scope (tdz-scope nil))
|
|
256
|
+
(statements (tdz-statements (program-body program) (js-array))))
|
|
257
|
+
(tdz-predeclare statements scope state)
|
|
164
258
|
;; With no tracked module variable, every possible lookup is absent.
|
|
165
259
|
;; Function-only modules therefore need no TDZ traversal of their bodies.
|
|
166
260
|
(when (> (js-length (get state :variables)) 0)
|
|
167
|
-
(js-call
|
|
261
|
+
(js-call statements :forEach
|
|
262
|
+
(lambda (node position)
|
|
263
|
+
(put state :owner
|
|
264
|
+
(if (= (ir-kind node) "function-declaration") (binding-name (ir-value node)) position))
|
|
265
|
+
(tdz-walk node scope state)))
|
|
266
|
+
(tdz-finalize state))
|
|
267
|
+
state))
|
|
168
268
|
(defun tdz-reader-name (record) (str "__eliscript_tdz_read_" (get record :index)))
|
|
169
269
|
(defun tdz-writer-name (record) (str "__eliscript_tdz_write_" (get record :index)))
|
|
170
270
|
(defun tdz-prologue ()
|
|
171
|
-
(
|
|
172
|
-
(
|
|
173
|
-
(
|
|
174
|
-
(
|
|
175
|
-
(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
271
|
+
(let ((records (if (nil? tdz-state) (js-array) (js-call (get tdz-state :variables) :filter tdz-guarded-p))))
|
|
272
|
+
(if (= (js-length records) 0) ""
|
|
273
|
+
(str tdz-import
|
|
274
|
+
(js-call (js-call records :map
|
|
275
|
+
(lambda (record)
|
|
276
|
+
(let ((ready (tdz-ready-name record)) (name (binding-name (get record :name)))
|
|
277
|
+
(argument (str "__eliscript_tdz_value_" (get record :index))))
|
|
278
|
+
(str "var " ready ";\n"
|
|
279
|
+
(if (get record :read)
|
|
280
|
+
(str "function " (tdz-reader-name record) "() { if (" ready
|
|
281
|
+
" !== true) __eliscript_tdz_error(" (json-string name) "); return " name "; }\n")
|
|
282
|
+
"")
|
|
283
|
+
(if (get record :write)
|
|
284
|
+
(str "function " (tdz-writer-name record) "(" argument ") { if (" ready
|
|
285
|
+
" !== true) __eliscript_tdz_error(" (json-string name) "); "
|
|
286
|
+
(if (get record :mutable) (str "return (" name " = " argument ");") "return __eliscript_const_error();") " }\n")
|
|
287
|
+
""))))) :join "")))))
|
|
183
288
|
(defun tdz-read (node)
|
|
184
289
|
(let ((record (and tdz-state (js-call (get tdz-state :reads) :get node))))
|
|
185
290
|
(if (not record) (text-fragment (reference-name (ir-value node)))
|
|
@@ -1844,7 +1949,7 @@
|
|
|
1844
1949
|
"null")
|
|
1845
1950
|
";"
|
|
1846
1951
|
(let ((record (and tdz-state (js-call (get tdz-state :declarations) :get node))))
|
|
1847
|
-
(if record (str "\n" (tdz-ready-name record) " = true;") "")))))
|
|
1952
|
+
(if (tdz-guarded-p record) (str "\n" (tdz-ready-name record) " = true;") "")))))
|
|
1848
1953
|
((= kind "function-declaration")
|
|
1849
1954
|
(let* ((parts (split-counted-children node "parameterCount"))
|
|
1850
1955
|
(parameters (js-nth 0 parts))
|
|
@@ -2216,43 +2321,36 @@
|
|
|
2216
2321
|
", ")
|
|
2217
2322
|
"]));"))))))
|
|
2218
2323
|
|
|
2219
|
-
;; An embedded module gives captured intrinsics their own lexical scope when
|
|
2220
|
-
;; user source binds globalThis. It requires no host package or dynamic eval.
|
|
2221
|
-
(defun node-names-global-root-p (node)
|
|
2222
|
-
(or (and (= (ir-value node) "globalThis")
|
|
2223
|
-
(not (= (ir-kind node) "literal"))
|
|
2224
|
-
(not (= (ir-kind node) "raw-javascript")))
|
|
2225
|
-
(js-call (children node) :some node-names-global-root-p)))
|
|
2226
|
-
|
|
2227
|
-
(defun number-conversion-prologue (program)
|
|
2228
|
-
(if (js-call (program-body program) :some node-names-global-root-p)
|
|
2229
|
-
(str number-conversion-capsule number-conversion-body)
|
|
2230
|
-
number-conversion-helper))
|
|
2231
|
-
|
|
2232
|
-
(defun imul-prologue (program)
|
|
2233
|
-
(str (if (js-call (program-body program) :some node-names-global-root-p)
|
|
2234
|
-
imul-capsule imul-intrinsic) imul-operator-helper))
|
|
2235
|
-
|
|
2236
2324
|
(defun emit-module-artifact-in-profile (program)
|
|
2237
|
-
(
|
|
2238
|
-
|
|
2239
|
-
(
|
|
2240
|
-
(
|
|
2241
|
-
|
|
2242
|
-
|
|
2325
|
+
(if (prelude-capsule-p program)
|
|
2326
|
+
(text-fragment prelude-module)
|
|
2327
|
+
(let ((previous tdz-state))
|
|
2328
|
+
(setq tdz-state (tdz-prepare program))
|
|
2329
|
+
(try (emit-module-artifact-in-profile-ready program)
|
|
2330
|
+
(finally (setq tdz-state previous))))))
|
|
2331
|
+
|
|
2332
|
+
(defun runtime-capsule-p (program entries)
|
|
2243
2333
|
(let* ((filename (program-filename program)) (body (program-body program))
|
|
2244
2334
|
(module (if (= (js-length body) 1) (aref body 0) nil)))
|
|
2245
2335
|
(and module (= (ir-kind module) "module-declaration")
|
|
2246
2336
|
(= (value-type filename) "string")
|
|
2247
|
-
(js-call
|
|
2248
|
-
(js-array "runtime/unicode-case.eli" "eliscript.runtime.unicode-case")
|
|
2249
|
-
(js-array "runtime/unicode-case-data.eli" "eliscript.runtime.unicode-case-data"))
|
|
2337
|
+
(js-call entries
|
|
2250
2338
|
:some (lambda (entry)
|
|
2251
2339
|
(and (= (ir-value module) (aref entry 1))
|
|
2252
2340
|
(or (= filename (aref entry 0))
|
|
2253
2341
|
(and (js-call filename :startsWith "/")
|
|
2254
2342
|
(js-call filename :endsWith (+ "/" (aref entry 0)))))))))))
|
|
2255
2343
|
|
|
2344
|
+
(defun unicode-bootstrap-capsule-p (program)
|
|
2345
|
+
(runtime-capsule-p program
|
|
2346
|
+
(js-array
|
|
2347
|
+
(js-array "runtime/unicode-case.eli" "eliscript.runtime.unicode-case")
|
|
2348
|
+
(js-array "runtime/unicode-case-data.eli" "eliscript.runtime.unicode-case-data"))))
|
|
2349
|
+
|
|
2350
|
+
(defun prelude-capsule-p (program)
|
|
2351
|
+
(and (runtime-capsule-p program (js-array (js-array "runtime/prelude.eli" "eliscript.runtime.prelude")))
|
|
2352
|
+
(= (js-length (children (aref (program-body program) 0))) 0)))
|
|
2353
|
+
|
|
2256
2354
|
(defun emit-module-artifact-in-profile-ready (program)
|
|
2257
2355
|
(setq temporary-counter 0)
|
|
2258
2356
|
(setq binding-temporaries (new globalThis.Map))
|
|
@@ -2267,7 +2365,11 @@
|
|
|
2267
2365
|
(tdz-prologue)
|
|
2268
2366
|
(if (unicode-bootstrap-capsule-p program) "" "import \"eliscript/runtime/unicode-case.mjs\";\n")
|
|
2269
2367
|
(if (get requirements :math) "import \"eliscript/runtime/math.mjs\";\n" "")
|
|
2270
|
-
(
|
|
2368
|
+
(let ((numeric-coercion (and (not numeric-emission-profile) (get requirements :numericCoercion))))
|
|
2369
|
+
(prelude-import (get requirements :arrayText)
|
|
2370
|
+
(or (get requirements :numberConversion) numeric-coercion)
|
|
2371
|
+
numeric-coercion
|
|
2372
|
+
(and (not numeric-emission-profile) (get requirements :imul))))
|
|
2271
2373
|
(if (get requirements :literal)
|
|
2272
2374
|
literal-runtime-import
|
|
2273
2375
|
"")
|
|
@@ -2284,10 +2386,6 @@
|
|
|
2284
2386
|
value-runtime-import
|
|
2285
2387
|
"")
|
|
2286
2388
|
"const __eliscript_truthy = (value) => value !== false && value != null;\n"
|
|
2287
|
-
(if (or (get requirements :numberConversion)
|
|
2288
|
-
(and (not numeric-emission-profile) (get requirements :numericCoercion))) (number-conversion-prologue program) "")
|
|
2289
|
-
(if (and (not numeric-emission-profile) (get requirements :numericCoercion)) numeric-operator-helper "")
|
|
2290
|
-
(if (and (not numeric-emission-profile) (get requirements :imul)) (imul-prologue program) "")
|
|
2291
2389
|
(if (get requirements :hostIdentityToken)
|
|
2292
2390
|
host-identity-token-helper
|
|
2293
2391
|
"")
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
|
|
3
3
|
var __eliscript_tdz_ready_0;
|
|
4
4
|
function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("parseArguments"); return parseArguments; }
|
|
5
|
-
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("parseArguments"); return __eliscript_const_error(); }
|
|
6
5
|
import "eliscript/runtime/unicode-case.mjs";
|
|
7
6
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
8
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-cli.mjs","sources":["../../tools/project/check-cli.eli"],"sourcesContent":["(module tools.project.check-cli\n (import \"node:fs\" readFileSync)\n (import \"node:path\" resolve)\n (import \"node:url\" fileURLToPath)\n (import \"./check-cli-legacy.mjs\" :as legacy)\n (import \"./bun.mjs\" diagnosticFromError renderDiagnostic requestedDiagnosticFormat)\n (defconst parseArguments (get legacy :parseArguments))\n (defasync execute (arguments &rest supplied)\n (let* ((arguments (Array/from arguments))\n (options (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0))) (js-object) (aref supplied 0)))\n (parsed (parseArguments arguments)))\n (when (and (not (undefined? (get parsed :stdinFile))) (nullish? (get options :stdinSource)))\n (setq options (Object/assign (js-object) options (js-object :stdinSource (readFileSync 0 \"utf8\")))))\n (await (js-call legacy :execute arguments options))))\n (defasync main (&rest supplied)\n (let* ((arguments (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0)))\n (js-call (get globalThis.process :argv) :slice 2) (aref supplied 0)))\n (execution (await (execute arguments))))\n (if (get execution :help) (await (js-call legacy :main arguments))\n (js-call (get globalThis.process :stdout) :write\n (str (if (get execution :jsonReport) (JSON/stringify (get (get execution :result) :report))\n (str \"Checked \" (get (get (get (get execution :result) :report) :counts) :modules) \" modules.\")) \"\\n\")))))\n (let ((entry (aref (get globalThis.process :argv) 1)))\n (when (and (not (undefined? entry)) (= (resolve entry) (fileURLToPath (js* \"import.meta.url\"))))\n (let ((format (requestedDiagnosticFormat (js-call (get globalThis.process :argv) :slice 2))))\n (js-call (main) :catch (lambda (error)\n (let ((diagnostic (diagnosticFromError error)))\n (if (= format \"json\") (console/error (JSON/stringify diagnostic))\n (console/error (str \"eliscript-check: \" (renderDiagnostic diagnostic))))\n (put globalThis.process :exitCode 1)))))))\n (export parseArguments execute main))\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check-cli.mjs","sources":["../../tools/project/check-cli.eli"],"sourcesContent":["(module tools.project.check-cli\n (import \"node:fs\" readFileSync)\n (import \"node:path\" resolve)\n (import \"node:url\" fileURLToPath)\n (import \"./check-cli-legacy.mjs\" :as legacy)\n (import \"./bun.mjs\" diagnosticFromError renderDiagnostic requestedDiagnosticFormat)\n (defconst parseArguments (get legacy :parseArguments))\n (defasync execute (arguments &rest supplied)\n (let* ((arguments (Array/from arguments))\n (options (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0))) (js-object) (aref supplied 0)))\n (parsed (parseArguments arguments)))\n (when (and (not (undefined? (get parsed :stdinFile))) (nullish? (get options :stdinSource)))\n (setq options (Object/assign (js-object) options (js-object :stdinSource (readFileSync 0 \"utf8\")))))\n (await (js-call legacy :execute arguments options))))\n (defasync main (&rest supplied)\n (let* ((arguments (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0)))\n (js-call (get globalThis.process :argv) :slice 2) (aref supplied 0)))\n (execution (await (execute arguments))))\n (if (get execution :help) (await (js-call legacy :main arguments))\n (js-call (get globalThis.process :stdout) :write\n (str (if (get execution :jsonReport) (JSON/stringify (get (get execution :result) :report))\n (str \"Checked \" (get (get (get (get execution :result) :report) :counts) :modules) \" modules.\")) \"\\n\")))))\n (let ((entry (aref (get globalThis.process :argv) 1)))\n (when (and (not (undefined? entry)) (= (resolve entry) (fileURLToPath (js* \"import.meta.url\"))))\n (let ((format (requestedDiagnosticFormat (js-call (get globalThis.process :argv) :slice 2))))\n (js-call (main) :catch (lambda (error)\n (let ((diagnostic (diagnosticFromError error)))\n (if (= format \"json\") (console/error (JSON/stringify diagnostic))\n (console/error (str \"eliscript-check: \" (renderDiagnostic diagnostic))))\n (put globalThis.process :exitCode 1)))))))\n (export parseArguments execute main))\n"],"names":[],"mappings":";;;;;;;AACE,QAAkB;AAClB,QAAoB;AACpB,QAAmB;AACnB,YAAqC;AACrC,QAAoB,qBAAoB,kBAAiB;AACzD,uBAAyB,CAAK,QAAO;;AACrC,uBAAmB,eAAgB;EACjC,OAAA,eAAO;0BACA;4BACA;;UACL,IAAM,CAAK,EAAK,CAAY,CAAK,QAAO,gCAAc,CAAU,CAAK,SAAQ;YAC3E,CAAM,CAAA,UAAS,cAAc,MAAY,SAAQ,EAAW,eAAc,aAAa,GAAE;;UAC3F,OAAA,OAAO,CAAS,QAAO,WAAS,YAAU;;SAH5B,2BAAe;OADf,CAAI,CAAI,CAAG,EAAW,4BAAU,MAAG,CAAY,CAAM,UAAS,qBAAK,OAAY,CAAM,UAAS;KAD3F,WAAW;;AAMhC,uBAAsB;EACpB,OAAA,eAAO;0BAEA;aACL,oBAAI,CAAK,WAAU,WAAO,OAAO,CAAS,QAAO,QAAM,eACrD,CAAS,CAAK,oBAAmB,WAAS,SACxC,QAAK,oBAAI,CAAK,WAAU,iBAAc,eAAe,CAAK,CAAK,WAAU,WAAS,aAChF,QAAK,qBAAW,CAAK,CAAK,CAAK,CAAK,WAAU,WAAS,WAAS,WAAS,qBAAU,yBAAc;OAJvF,OAAQ,QAAQ;KAFhB,CAAI,CAAI,CAAG,EAAW,4BAAU,MAAG,CAAY,CAAM,UAAS,qBAC7D,CAAS,CAAK,oBAAmB,SAAO,SAAO,KAAG,CAAM,UAAS;;AAMtF,EAAM;EACJ,IAAM,CAAK,EAAK,CAAY,yBAAQ,CAAI,QAAQ,WAAQ,cAAc;IACpE;kCAAe,0BAA0B,CAAS,CAAK,oBAAmB,SAAO,SAAO;;YAAlF;QACJ,OAAA,CAAU,QAAM,SAAO,EAAS;UAC9B;wCAAmB,oBAAoB;;kBAAjC;cACJ,IAAI,CAAG,WAAO;gBAAS,cAAe,eAAe;;gBAClD,cAAc,QAAK,8BAAqB,iBAAiB;;cAC5D,OAAA,EAAK,oBAAmB,cAAU;;;;;;;;;GAP/B,CAAM,CAAK,oBAAmB,SAAO;AAQlD,QAAQ,gBAAe,SAAQ"}
|
|
@@ -951,7 +951,8 @@
|
|
|
951
951
|
(unless (= (get (get node :properties (js-object)) :portable false) t)
|
|
952
952
|
(session-portable-import-fail "portable project contains a non-portable import" (get item :filename)))
|
|
953
953
|
(let ((specifier (get node :value)))
|
|
954
|
-
(unless (and (js-call specifier :startsWith ".")
|
|
954
|
+
(unless (and (js-call specifier :startsWith ".")
|
|
955
|
+
(or (js-call specifier :endsWith ".eli") (js-call specifier :endsWith ".el")))
|
|
955
956
|
(session-portable-import-fail (+ "portable import must be a relative .eli module: " specifier)
|
|
956
957
|
(get item :filename)))
|
|
957
958
|
(let ((parts (js-call (get item :filename) :split "/")))
|
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
|
|
4
4
|
var __eliscript_tdz_ready_0;
|
|
5
5
|
function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("here"); return here; }
|
|
6
|
-
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("here"); return __eliscript_const_error(); }
|
|
7
|
-
var __eliscript_tdz_ready_1;
|
|
8
|
-
function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("root"); return root; }
|
|
9
|
-
function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("root"); return __eliscript_const_error(); }
|
|
10
6
|
var __eliscript_tdz_ready_2;
|
|
11
7
|
function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("environment"); return environment; }
|
|
12
|
-
function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("environment"); return __eliscript_const_error(); }
|
|
13
8
|
var __eliscript_tdz_ready_3;
|
|
14
9
|
function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("commands"); return commands; }
|
|
15
|
-
function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("commands"); return __eliscript_const_error(); }
|
|
16
10
|
import "eliscript/runtime/unicode-case.mjs";
|
|
17
11
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
18
12
|
|
|
@@ -22,11 +16,10 @@ import {createRequire} from "node:module";
|
|
|
22
16
|
import {runReleaseCLI} from "../../tools/backends/dist/release-cli.mjs";
|
|
23
17
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
24
18
|
__eliscript_tdz_ready_0 = true;
|
|
25
|
-
const root = resolve(
|
|
26
|
-
__eliscript_tdz_ready_1 = true;
|
|
19
|
+
const root = resolve(here, "../..");
|
|
27
20
|
const environment = (globalThis.process)["env"];
|
|
28
21
|
__eliscript_tdz_ready_2 = true;
|
|
29
|
-
(((
|
|
22
|
+
(((environment)["ELISCRIPT_BOOTSTRAP_MODULE_DIR"] == null) ? ((environment)["ELISCRIPT_BOOTSTRAP_MODULE_DIR"] = resolve(root, "dist/bootstrap")) : null);
|
|
30
23
|
const commands = ({"eliscript": ["bun.mjs", "eliscript"], "eliscript-build": ["project-cli.mjs", "eliscript-build"], "eliscript-check": ["check-cli.mjs", "eliscript-check"], "eliscript-format": ["format-cli.mjs", "eliscript-format"], "eliscript-eval": ["evaluation-cli.mjs", "eliscript-eval"], "eliscript-watch": ["watch-cli.mjs", "eliscript-watch"], "eliscript-compiler": ["../../tools/backends/compiler-cli.mjs", "eliscript-compiler"]});
|
|
31
24
|
__eliscript_tdz_ready_3 = true;
|
|
32
25
|
async function main() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eliscript-cli.mjs","sources":["../../tools/backends/eliscript/package-cli-entry.eli"],"sourcesContent":["(module tools.backends.package-cli-entry\n (import \"node:path\" basename dirname resolve)\n (import \"node:url\" fileURLToPath)\n (import \"node:module\" createRequire)\n (import \"../../tools/backends/dist/release-cli.mjs\" runReleaseCLI)\n\n ;; This file is emitted at bootstrap/host/eliscript-cli.mjs. Installed bin\n ;; symlinks may have another name; locate runtime assets beside this module.\n (defconst here (dirname (fileURLToPath (js* \"import.meta.url\"))))\n (defconst root (resolve here \"../..\"))\n (defconst environment (get globalThis.process :env))\n (when (nullish? (get environment :ELISCRIPT_BOOTSTRAP_MODULE_DIR))\n (put environment :ELISCRIPT_BOOTSTRAP_MODULE_DIR (resolve root \"dist/bootstrap\")))\n (defconst commands\n (js-object\n :eliscript (js-array \"bun.mjs\" \"eliscript\")\n :eliscript-build (js-array \"project-cli.mjs\" \"eliscript-build\")\n :eliscript-check (js-array \"check-cli.mjs\" \"eliscript-check\")\n :eliscript-format (js-array \"format-cli.mjs\" \"eliscript-format\")\n :eliscript-eval (js-array \"evaluation-cli.mjs\" \"eliscript-eval\")\n :eliscript-watch (js-array \"watch-cli.mjs\" \"eliscript-watch\")\n :eliscript-compiler (js-array \"../../tools/backends/compiler-cli.mjs\" \"eliscript-compiler\")))\n\n (defasync main ()\n (let* ((arguments (get globalThis.process :argv))\n (invoked (basename (if (nullish? (aref arguments 1)) \"\" (aref arguments 1))))\n (found (get commands invoked))\n (selected (if (nullish? found) (get commands :eliscript) found))\n (entry (resolve here (aref selected 0))))\n (when (nullish? (get environment :ELISCRIPT_COMMAND_NAME))\n (put environment :ELISCRIPT_COMMAND_NAME (aref selected 1)))\n ;; The compiler entry has asynchronous ESM dependencies. Its static\n ;; import completes before main; the six established handlers still\n ;; capture their command environment only when their namespace loads.\n (if (= invoked \"eliscript-compiler\")\n (await (runReleaseCLI (js-call arguments :slice 2)))\n (let ((namespace (funcall (createRequire (resolve here \"eliscript-cli.mjs\")) entry)))\n (await (js-call namespace :main (js-call arguments :slice 2)))))))\n\n (js-call (main) :catch (lambda (error)\n (js-call globalThis.console :error error)\n (put globalThis.process :exitCode 1))))\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"eliscript-cli.mjs","sources":["../../tools/backends/eliscript/package-cli-entry.eli"],"sourcesContent":["(module tools.backends.package-cli-entry\n (import \"node:path\" basename dirname resolve)\n (import \"node:url\" fileURLToPath)\n (import \"node:module\" createRequire)\n (import \"../../tools/backends/dist/release-cli.mjs\" runReleaseCLI)\n\n ;; This file is emitted at bootstrap/host/eliscript-cli.mjs. Installed bin\n ;; symlinks may have another name; locate runtime assets beside this module.\n (defconst here (dirname (fileURLToPath (js* \"import.meta.url\"))))\n (defconst root (resolve here \"../..\"))\n (defconst environment (get globalThis.process :env))\n (when (nullish? (get environment :ELISCRIPT_BOOTSTRAP_MODULE_DIR))\n (put environment :ELISCRIPT_BOOTSTRAP_MODULE_DIR (resolve root \"dist/bootstrap\")))\n (defconst commands\n (js-object\n :eliscript (js-array \"bun.mjs\" \"eliscript\")\n :eliscript-build (js-array \"project-cli.mjs\" \"eliscript-build\")\n :eliscript-check (js-array \"check-cli.mjs\" \"eliscript-check\")\n :eliscript-format (js-array \"format-cli.mjs\" \"eliscript-format\")\n :eliscript-eval (js-array \"evaluation-cli.mjs\" \"eliscript-eval\")\n :eliscript-watch (js-array \"watch-cli.mjs\" \"eliscript-watch\")\n :eliscript-compiler (js-array \"../../tools/backends/compiler-cli.mjs\" \"eliscript-compiler\")))\n\n (defasync main ()\n (let* ((arguments (get globalThis.process :argv))\n (invoked (basename (if (nullish? (aref arguments 1)) \"\" (aref arguments 1))))\n (found (get commands invoked))\n (selected (if (nullish? found) (get commands :eliscript) found))\n (entry (resolve here (aref selected 0))))\n (when (nullish? (get environment :ELISCRIPT_COMMAND_NAME))\n (put environment :ELISCRIPT_COMMAND_NAME (aref selected 1)))\n ;; The compiler entry has asynchronous ESM dependencies. Its static\n ;; import completes before main; the six established handlers still\n ;; capture their command environment only when their namespace loads.\n (if (= invoked \"eliscript-compiler\")\n (await (runReleaseCLI (js-call arguments :slice 2)))\n (let ((namespace (funcall (createRequire (resolve here \"eliscript-cli.mjs\")) entry)))\n (await (js-call namespace :main (js-call arguments :slice 2)))))))\n\n (js-call (main) :catch (lambda (error)\n (js-call globalThis.console :error error)\n (put globalThis.process :exitCode 1))))\n"],"names":[],"mappings":";;;;;;;;;;;;AACE,QAAoB,UAAS,SAAQ;AACrC,QAAmB;AACnB,QAAsB;AACtB,QAAoD;AAIpD,aAAgB,QAAS,cAAc;;AACvC,aAAgB,QAAQ,MAAK;AAC7B,oBAAsB,CAAK,oBAAmB;;AAC9C,CAAM,CAAU,CAAK,aAAY,6CAC/B,EAAK,aAAY,oCAAiC,QAAQ,MAAK;AACjE,iBACE,EACE,aAAW,CAAU,WAAU,cAC/B,mBAAiB,CAAU,mBAAkB,oBAC7C,mBAAiB,CAAU,iBAAgB,oBAC3C,oBAAkB,CAAU,kBAAiB,qBAC7C,kBAAgB,CAAU,sBAAqB,mBAC/C,mBAAiB,CAAU,iBAAgB,oBAC3C,sBAAoB,CAAU,yCAAwC;;AAE1E;EACE,OAAA,eAAO;0BACA;4BACA;8BACA;gCACA;;cACL,IAAM,CAAU,CAAK,4BAAY;gBAC/B,EAAK,4BAAY,4BAAwB,CAAM,UAAS;;cAI1D,OAAA,CAAI,CAAG,YAAQ,wBACb,OAAQ,cAAc,CAAS,YAAU,SAAO,OAChD,eAAM;gBACJ,OAAA,OAAO,CAAS,WAAU,QAAM,CAAS,YAAU,SAAO;iBAD3C,CAAU,cAAe,QAAQ,4BAAK,uBAAsB;;aARlE,QAAQ,4BAAK,CAAM,UAAS;WAD1B,CAAI,CAAU,iBAAO,CAAK,4BAAS,eAAY;SADlD,CAAK,4BAAS;OADX,SAAS,CAAI,CAAU,CAAM,YAAU,cAAI,KAAG,CAAM,YAAU;KAD7D,CAAK,oBAAmB;;AAe5C,CAAU,QAAM,SAAO,EAAS;EAC9B,CAAS,oBAAmB,SAAO;EACnC,OAAA,EAAK,oBAAmB,cAAU"}
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
|
|
3
|
-
var __eliscript_tdz_ready_0;
|
|
4
|
-
function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("parseConfigurationJson"); return parseConfigurationJson; }
|
|
5
|
-
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("parseConfigurationJson"); return __eliscript_const_error(); }
|
|
6
3
|
var __eliscript_tdz_ready_1;
|
|
7
4
|
function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("parseArguments"); return parseArguments; }
|
|
8
|
-
function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("parseArguments"); return __eliscript_const_error(); }
|
|
9
|
-
var __eliscript_tdz_ready_2;
|
|
10
|
-
function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("readProjectConfiguration"); return readProjectConfiguration; }
|
|
11
|
-
function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("readProjectConfiguration"); return __eliscript_const_error(); }
|
|
12
5
|
var __eliscript_tdz_ready_3;
|
|
13
6
|
function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("usage"); return usage; }
|
|
14
|
-
function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("usage"); return __eliscript_const_error(); }
|
|
15
7
|
import "eliscript/runtime/unicode-case.mjs";
|
|
16
|
-
import {
|
|
8
|
+
import { __eliscript_at, __eliscript_at_direct } from "eliscript/runtime/prelude.mjs";
|
|
17
9
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
18
10
|
|
|
19
11
|
import {readFileSync} from "node:fs";
|
|
@@ -22,11 +14,9 @@ import {fileURLToPath} from "node:url";
|
|
|
22
14
|
import * as legacy from "./project-cli-legacy.mjs";
|
|
23
15
|
import {diagnosticFromError, renderDiagnostic, requestedDiagnosticFormat} from "./bun.mjs";
|
|
24
16
|
const parseConfigurationJson = (legacy)["parseConfigurationJson"];
|
|
25
|
-
__eliscript_tdz_ready_0 = true;
|
|
26
17
|
const parseArguments = (legacy)["parseArguments"];
|
|
27
18
|
__eliscript_tdz_ready_1 = true;
|
|
28
19
|
const readProjectConfiguration = (legacy)["readProjectConfiguration"];
|
|
29
|
-
__eliscript_tdz_ready_2 = true;
|
|
30
20
|
const usage = "Usage: eliscript-build [OPTIONS] [ENTRY ...]\n\nOptions:\n --out-dir DIR Write the generated module tree to DIR\n --config FILE Read a versioned project request from FILE\n --root DIR Contain local source imports below DIR\n --portable NAME Emit NAME and its transitive portable closure\n --stdin-file FILE Use standard input as the current contents of FILE\n --no-cache Disable cache reads for this build\n --json Print the versioned build decision report\n --diagnostic-format human|json\n Select human-readable or JSON failures\n -h, --help Show this help\n";
|
|
31
21
|
__eliscript_tdz_ready_3 = true;
|
|
32
22
|
async function execute(arguments$, ...supplied) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-cli.mjs","sources":["../../tools/project/project-cli.eli"],"sourcesContent":["(module tools.project.project-cli\n (import \"node:fs\" readFileSync)\n (import \"node:path\" resolve)\n (import \"node:url\" fileURLToPath)\n (import \"./project-cli-legacy.mjs\" :as legacy)\n (import \"./bun.mjs\" diagnosticFromError renderDiagnostic requestedDiagnosticFormat)\n (defconst parseConfigurationJson (get legacy :parseConfigurationJson))\n (defconst parseArguments (get legacy :parseArguments))\n (defconst readProjectConfiguration (get legacy :readProjectConfiguration))\n (defconst usage \"Usage: eliscript-build [OPTIONS] [ENTRY ...]\\n\\nOptions:\\n --out-dir DIR Write the generated module tree to DIR\\n --config FILE Read a versioned project request from FILE\\n --root DIR Contain local source imports below DIR\\n --portable NAME Emit NAME and its transitive portable closure\\n --stdin-file FILE Use standard input as the current contents of FILE\\n --no-cache Disable cache reads for this build\\n --json Print the versioned build decision report\\n --diagnostic-format human|json\\n Select human-readable or JSON failures\\n -h, --help Show this help\\n\")\n (defasync execute (arguments &rest supplied)\n (let* ((options (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0)))\n (js-object) (aref supplied 0)))\n ;; Consume an arbitrary argument iterable once, just as the original\n ;; parser's spread did. Both parses then see the same plain snapshot.\n (arguments (Array/from arguments))\n (parsed (funcall parseArguments arguments)))\n (when (and (not (undefined? (get parsed :stdinFile)))\n (nullish? (get options :stdinSource)))\n ;; fs/promises.readFile accepts a path or FileHandle, not numeric fd 0.\n ;; The synchronous fs API preserves UTF8 decoding and real EOF, while\n ;; an explicitly supplied source (including \"\") must never consume fd0.\n (setq options (Object/assign (js-object) options\n (js-object :stdinSource (readFileSync 0 \"utf8\")))))\n (await (js-call legacy :execute arguments options))))\n (defasync main (&rest arguments)\n (let* ((arguments (if (or (= (js-length arguments) 0) (undefined? (aref arguments 0)))\n (js-call (get globalThis.process :argv) :slice 2) (aref arguments 0)))\n (execution (await (execute arguments))))\n (if (get execution :help) (js-call (get globalThis.process :stdout) :write usage)\n (js-call (get globalThis.process :stdout) :write\n (str (if (get execution :jsonReport) (JSON/stringify (get (get execution :result) :report))\n (js-call (get (get execution :result) :entryOutputs) :join \"\\n\")) \"\\n\")))))\n (let ((entry (aref (get globalThis.process :argv) 1)))\n (when (and (not (undefined? entry)) (= (resolve entry) (fileURLToPath (js* \"import.meta.url\"))))\n (let ((format (requestedDiagnosticFormat (js-call (get globalThis.process :argv) :slice 2))))\n (js-call (main) :catch (lambda (error)\n (let ((diagnostic (diagnosticFromError error)))\n (if (= format \"json\") (console/error (JSON/stringify diagnostic))\n (console/error (str \"eliscript-build: \" (renderDiagnostic diagnostic))))\n (put globalThis.process :exitCode 1)))))))\n (export parseConfigurationJson parseArguments readProjectConfiguration execute main))\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project-cli.mjs","sources":["../../tools/project/project-cli.eli"],"sourcesContent":["(module tools.project.project-cli\n (import \"node:fs\" readFileSync)\n (import \"node:path\" resolve)\n (import \"node:url\" fileURLToPath)\n (import \"./project-cli-legacy.mjs\" :as legacy)\n (import \"./bun.mjs\" diagnosticFromError renderDiagnostic requestedDiagnosticFormat)\n (defconst parseConfigurationJson (get legacy :parseConfigurationJson))\n (defconst parseArguments (get legacy :parseArguments))\n (defconst readProjectConfiguration (get legacy :readProjectConfiguration))\n (defconst usage \"Usage: eliscript-build [OPTIONS] [ENTRY ...]\\n\\nOptions:\\n --out-dir DIR Write the generated module tree to DIR\\n --config FILE Read a versioned project request from FILE\\n --root DIR Contain local source imports below DIR\\n --portable NAME Emit NAME and its transitive portable closure\\n --stdin-file FILE Use standard input as the current contents of FILE\\n --no-cache Disable cache reads for this build\\n --json Print the versioned build decision report\\n --diagnostic-format human|json\\n Select human-readable or JSON failures\\n -h, --help Show this help\\n\")\n (defasync execute (arguments &rest supplied)\n (let* ((options (if (or (= (js-length supplied) 0) (undefined? (aref supplied 0)))\n (js-object) (aref supplied 0)))\n ;; Consume an arbitrary argument iterable once, just as the original\n ;; parser's spread did. Both parses then see the same plain snapshot.\n (arguments (Array/from arguments))\n (parsed (funcall parseArguments arguments)))\n (when (and (not (undefined? (get parsed :stdinFile)))\n (nullish? (get options :stdinSource)))\n ;; fs/promises.readFile accepts a path or FileHandle, not numeric fd 0.\n ;; The synchronous fs API preserves UTF8 decoding and real EOF, while\n ;; an explicitly supplied source (including \"\") must never consume fd0.\n (setq options (Object/assign (js-object) options\n (js-object :stdinSource (readFileSync 0 \"utf8\")))))\n (await (js-call legacy :execute arguments options))))\n (defasync main (&rest arguments)\n (let* ((arguments (if (or (= (js-length arguments) 0) (undefined? (aref arguments 0)))\n (js-call (get globalThis.process :argv) :slice 2) (aref arguments 0)))\n (execution (await (execute arguments))))\n (if (get execution :help) (js-call (get globalThis.process :stdout) :write usage)\n (js-call (get globalThis.process :stdout) :write\n (str (if (get execution :jsonReport) (JSON/stringify (get (get execution :result) :report))\n (js-call (get (get execution :result) :entryOutputs) :join \"\\n\")) \"\\n\")))))\n (let ((entry (aref (get globalThis.process :argv) 1)))\n (when (and (not (undefined? entry)) (= (resolve entry) (fileURLToPath (js* \"import.meta.url\"))))\n (let ((format (requestedDiagnosticFormat (js-call (get globalThis.process :argv) :slice 2))))\n (js-call (main) :catch (lambda (error)\n (let ((diagnostic (diagnosticFromError error)))\n (if (= format \"json\") (console/error (JSON/stringify diagnostic))\n (console/error (str \"eliscript-build: \" (renderDiagnostic diagnostic))))\n (put globalThis.process :exitCode 1)))))))\n (export parseConfigurationJson parseArguments readProjectConfiguration execute main))\n"],"names":[],"mappings":";;;;;;;;;;AACE,QAAkB;AAClB,QAAoB;AACpB,QAAmB;AACnB,YAAuC;AACvC,QAAoB,qBAAoB,kBAAiB;AACzD,+BAAiC,CAAK,QAAO;AAC7C,uBAAyB,CAAK,QAAO;;AACrC,iCAAmC,CAAK,QAAO;AAC/C,cAAgB;;AAChB,uBAAmB,eAAgB;EACjC,OAAA,eAAO;0BAIA;4BACA;;UACL,IAAM,CAAK,EAAK,CAAY,CAAK,QAAO,gCAC7B,CAAU,CAAK,SAAQ;YAIhC,CAAM,CAAA,UAAS,cAAc,MAAY,SACvC,EAAW,eAAc,aAAa,GAAE;;UAC5C,OAAA,OAAO,CAAS,QAAO,WAAS,YAAU;;SARpB,2BAAe;OADpB,WAAW;KAJd,CAAI,CAAI,CAAG,EAAW,4BAAU,MAAG,CAAY,CAAM,UAAS,qBAC1D,OAAY,CAAM,UAAS;;AAajD,uBAAsB;EACpB,OAAA,eAAO;aAEA;aACL,oBAAI,CAAK,WAAU,WAAO,CAAS,CAAK,oBAAmB,WAAS,SAAO,8BACzE,CAAS,CAAK,oBAAmB,WAAS,SACxC,QAAK,oBAAI,CAAK,WAAU,iBAAc,eAAe,CAAK,CAAK,WAAU,WAAS,aAC3E,sBAAS,CAAK,CAAK,WAAU,WAAS,iBAAe,QAAM,iBAAO;OAJ7D,OAAQ,QAAQ;KAFhB,CAAI,CAAI,CAAG,EAAW,8BAAW,MAAG,CAAY,CAAM,YAAU,qBAC7D,CAAS,CAAK,oBAAmB,SAAO,SAAO,KAAG,CAAM,YAAU;;AAMzF,EAAM;EACJ,IAAM,CAAK,EAAK,CAAY,yBAAQ,CAAI,QAAQ,WAAQ,cAAc;IACpE;kCAAe,0BAA0B,CAAS,CAAK,oBAAmB,SAAO,SAAO;;YAAlF;QACJ,OAAA,CAAU,QAAM,SAAO,EAAS;UAC9B;wCAAmB,oBAAoB;;kBAAjC;cACJ,IAAI,CAAG,WAAO;gBAAS,cAAe,eAAe;;gBAClD,cAAc,QAAK,8BAAqB,iBAAiB;;cAC5D,OAAA,EAAK,oBAAmB,cAAU;;;;;;;;;GAP/B,CAAM,CAAK,oBAAmB,SAAO;AAQlD,QAAQ,wBAAuB,gBAAe,0BAAyB,SAAQ"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
|
|
3
|
-
var __eliscript_tdz_ready_0;
|
|
4
|
-
function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("checkProject"); return checkProject; }
|
|
5
|
-
function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("checkProject"); return __eliscript_const_error(); }
|
|
6
3
|
var __eliscript_tdz_ready_1;
|
|
7
4
|
function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("source_root"); return source_root; }
|
|
8
|
-
function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("source_root"); return __eliscript_const_error(); }
|
|
9
5
|
var __eliscript_tdz_ready_2;
|
|
10
6
|
function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("capsules"); return capsules; }
|
|
11
|
-
function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("capsules"); return __eliscript_const_error(); }
|
|
12
7
|
import "eliscript/runtime/unicode-case.mjs";
|
|
13
|
-
import {
|
|
8
|
+
import { __eliscript_at, __eliscript_at_direct } from "eliscript/runtime/prelude.mjs";
|
|
14
9
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
15
10
|
|
|
16
11
|
import {createHash} from "node:crypto";
|
|
@@ -21,10 +16,9 @@ import {Buffer} from "node:buffer";
|
|
|
21
16
|
import {createRequire} from "node:module";
|
|
22
17
|
import * as legacy from "./project-legacy.mjs";
|
|
23
18
|
const checkProject = (legacy)["checkProject"];
|
|
24
|
-
__eliscript_tdz_ready_0 = true;
|
|
25
19
|
const source_root = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
26
20
|
__eliscript_tdz_ready_1 = true;
|
|
27
|
-
const capsules = ["math", "unicode-case", "unicode-case-data"];
|
|
21
|
+
const capsules = ["math", "prelude", "unicode-case", "unicode-case-data"];
|
|
28
22
|
__eliscript_tdz_ready_2 = true;
|
|
29
23
|
function digest(bytes) {
|
|
30
24
|
return ((createHash("sha256"))["update"](bytes))["digest"]("hex");
|