eliscript 0.0.4 → 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-abi.el +170 -0
- package/editor/eliscript-async.el +375 -0
- package/editor/eliscript-bind.el +822 -0
- package/editor/eliscript-compat.el +346 -0
- package/editor/eliscript-contract.el +334 -0
- package/editor/eliscript-data.el +1544 -0
- package/editor/eliscript-js.el +318 -0
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-module.el +340 -0
- package/editor/eliscript-repl.el +1 -1
- package/package.json +4 -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 -0
- package/runtime/emacs-compat.mjs +13734 -0
- 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
|
@@ -1,98 +1,8 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import "eliscript/runtime/unicode-case.mjs";
|
|
3
3
|
import "eliscript/runtime/math.mjs";
|
|
4
|
-
import {
|
|
4
|
+
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";
|
|
5
5
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
6
|
-
const __eliscript_number_intrinsic = globalThis.Number;
|
|
7
|
-
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
8
|
-
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
9
|
-
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
10
|
-
const __eliscript_numeric_error = globalThis.TypeError;
|
|
11
|
-
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
12
|
-
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
13
|
-
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
14
|
-
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
15
|
-
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
16
|
-
const __eliscript_numeric_primitive = (value) => {
|
|
17
|
-
if (!__eliscript_numeric_object(value)) return value;
|
|
18
|
-
const exotic = value[__eliscript_numeric_symbol];
|
|
19
|
-
if (exotic !== void 0 && exotic !== null) {
|
|
20
|
-
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
21
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
22
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
23
|
-
}
|
|
24
|
-
for (let index = 0; index < 2; index++) {
|
|
25
|
-
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
26
|
-
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
27
|
-
const result = __eliscript_numeric_apply(method, value, []);
|
|
28
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
32
|
-
};
|
|
33
|
-
const __eliscript_to_number = (value) => {
|
|
34
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
35
|
-
if (typeof primitive === "string") {
|
|
36
|
-
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
37
|
-
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
38
|
-
let first = 2;
|
|
39
|
-
while (first < text.length && text[first] === "0") first++;
|
|
40
|
-
if (first === text.length) return 0;
|
|
41
|
-
const prefix = text[1];
|
|
42
|
-
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
43
|
-
if (text.length - first > limit) return 1 / 0;
|
|
44
|
-
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
45
|
-
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return __eliscript_number_intrinsic(primitive);
|
|
49
|
-
};
|
|
50
|
-
const __eliscript_numeric = (value) => {
|
|
51
|
-
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
52
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
53
|
-
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
54
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
55
|
-
};
|
|
56
|
-
const __eliscript_implicit_number = (value) => {
|
|
57
|
-
if (typeof value === "number") return value;
|
|
58
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
59
|
-
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
60
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
61
|
-
};
|
|
62
|
-
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
63
|
-
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
64
|
-
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
65
|
-
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
66
|
-
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
67
|
-
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
68
|
-
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
69
|
-
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
70
|
-
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
71
|
-
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
72
|
-
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
73
|
-
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
74
|
-
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
75
|
-
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
76
|
-
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
77
|
-
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
78
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
79
|
-
if (operator === "<") return left < right;
|
|
80
|
-
if (operator === "<=") return left <= right;
|
|
81
|
-
if (operator === ">") return left > right;
|
|
82
|
-
return left >= right;
|
|
83
|
-
}
|
|
84
|
-
let a = __eliscript_numeric_primitive(left);
|
|
85
|
-
let b = __eliscript_numeric_primitive(right);
|
|
86
|
-
const x = typeof a, y = typeof b;
|
|
87
|
-
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
88
|
-
a = __eliscript_numeric(a);
|
|
89
|
-
b = __eliscript_numeric(b);
|
|
90
|
-
}
|
|
91
|
-
if (operator === "<") return a < b;
|
|
92
|
-
if (operator === "<=") return a <= b;
|
|
93
|
-
if (operator === ">") return a > b;
|
|
94
|
-
return a >= b;
|
|
95
|
-
};
|
|
96
6
|
|
|
97
7
|
import assert from "node:assert/strict";
|
|
98
8
|
import {readFile, realpath} from "node:fs/promises";
|
|
@@ -1,97 +1,7 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import "eliscript/runtime/unicode-case.mjs";
|
|
3
|
-
import {
|
|
3
|
+
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";
|
|
4
4
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
5
|
-
const __eliscript_number_intrinsic = globalThis.Number;
|
|
6
|
-
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
7
|
-
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
8
|
-
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
9
|
-
const __eliscript_numeric_error = globalThis.TypeError;
|
|
10
|
-
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
11
|
-
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
12
|
-
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
13
|
-
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
14
|
-
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
15
|
-
const __eliscript_numeric_primitive = (value) => {
|
|
16
|
-
if (!__eliscript_numeric_object(value)) return value;
|
|
17
|
-
const exotic = value[__eliscript_numeric_symbol];
|
|
18
|
-
if (exotic !== void 0 && exotic !== null) {
|
|
19
|
-
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
20
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
21
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
22
|
-
}
|
|
23
|
-
for (let index = 0; index < 2; index++) {
|
|
24
|
-
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
25
|
-
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
26
|
-
const result = __eliscript_numeric_apply(method, value, []);
|
|
27
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
31
|
-
};
|
|
32
|
-
const __eliscript_to_number = (value) => {
|
|
33
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
34
|
-
if (typeof primitive === "string") {
|
|
35
|
-
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
36
|
-
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
37
|
-
let first = 2;
|
|
38
|
-
while (first < text.length && text[first] === "0") first++;
|
|
39
|
-
if (first === text.length) return 0;
|
|
40
|
-
const prefix = text[1];
|
|
41
|
-
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
42
|
-
if (text.length - first > limit) return 1 / 0;
|
|
43
|
-
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
44
|
-
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return __eliscript_number_intrinsic(primitive);
|
|
48
|
-
};
|
|
49
|
-
const __eliscript_numeric = (value) => {
|
|
50
|
-
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
51
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
52
|
-
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
53
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
54
|
-
};
|
|
55
|
-
const __eliscript_implicit_number = (value) => {
|
|
56
|
-
if (typeof value === "number") return value;
|
|
57
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
58
|
-
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
59
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
60
|
-
};
|
|
61
|
-
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
62
|
-
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
63
|
-
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
64
|
-
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
65
|
-
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
66
|
-
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
67
|
-
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
68
|
-
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
69
|
-
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
70
|
-
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
71
|
-
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
72
|
-
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
73
|
-
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
74
|
-
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
75
|
-
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
76
|
-
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
77
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
78
|
-
if (operator === "<") return left < right;
|
|
79
|
-
if (operator === "<=") return left <= right;
|
|
80
|
-
if (operator === ">") return left > right;
|
|
81
|
-
return left >= right;
|
|
82
|
-
}
|
|
83
|
-
let a = __eliscript_numeric_primitive(left);
|
|
84
|
-
let b = __eliscript_numeric_primitive(right);
|
|
85
|
-
const x = typeof a, y = typeof b;
|
|
86
|
-
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
87
|
-
a = __eliscript_numeric(a);
|
|
88
|
-
b = __eliscript_numeric(b);
|
|
89
|
-
}
|
|
90
|
-
if (operator === "<") return a < b;
|
|
91
|
-
if (operator === "<=") return a <= b;
|
|
92
|
-
if (operator === ">") return a > b;
|
|
93
|
-
return a >= b;
|
|
94
|
-
};
|
|
95
5
|
|
|
96
6
|
import {mkdir, readFile, readdir, lstat, open, symlink, realpath} from "node:fs/promises";
|
|
97
7
|
import {resolve, dirname, relative, isAbsolute, sep} from "node:path";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-js-stages.mjs","sources":["../eliscript/bootstrap-js-stages.eli"],"sourcesContent":["(module tools.backends.bootstrap-js-stages\n (import \"node:fs/promises\" mkdir readFile readdir lstat open symlink realpath)\n (import \"node:path\" resolve dirname relative isAbsolute sep)\n (import \"node:crypto\" createHash)\n (import \"node:util\" isDeepStrictEqual)\n (import \"../build.mjs\" root)\n (import \"../compiler-build.mjs\" loadCompilerSources buildIndependentCompiler\n independentCompilerProductIdentity writeCompilerMetadata)\n (import \"../compiler-metadata.mjs\" readCompilerMetadata)\n (import \"../compiler-bootstrap.mjs\" compilerSourceIdentity assertCompilerArtifactSources\n archiveCompilerSources openCompilerArtifact compilerFailure)\n\n (defun fail (message) (throw (new globalThis.Error message)))\n (defun plain (value)\n (and (not (nullish? value)) (= (value-type value) \"object\") (not (Array/isArray value))))\n (defun same (left right message)\n (unless (isDeepStrictEqual left right) (fail message)))\n (defun ordered (records)\n (js-call (Array/from records) :sort (lambda (left right)\n (cond ((< (get left :path) (get right :path)) -1)\n ((> (get left :path) (get right :path)) 1) (t 0)))))\n (defun portable (base path)\n (js-call (js-call (relative base path) :split sep) :join \"/\"))\n (defun safe-path (path)\n (unless (and (= (value-type path) \"string\") (> (js-length path) 0)\n (not (isAbsolute path)) (not (js-call path :includes \"\\\\\"))\n (not (js-call (js-call path :split \"/\") :some\n (lambda (part) (or (= part \"\") (= part \".\") (= part \"..\"))))))\n (fail \"bootstrap product contains an invalid relative path\")) path)\n (defun stopped (signal)\n (when (and (not (nullish? signal)) (get signal :aborted)) (throw (get signal :reason))))\n (defun observe (observer stage phase &optional detail)\n (when (= (value-type observer) \"function\")\n (try\n (let ((event (js-object :stage stage :host \"javascript\" :target \"javascript\" :phase phase)))\n (unless (nullish? detail)\n (js-call (js-array \"count\" \"moduleCount\" \"fileCount\" \"byteLength\" \"id\") :forEach\n (lambda (key)\n (let ((value (get detail key)))\n (when (or (= (value-type value) \"string\") (= (value-type value) \"number\"))\n (put event key value))))))\n (funcall observer (Object/freeze event)))\n (catch ignored nil))))\n\n (defasync artifact (metadata-path)\n (unless (= (value-type metadata-path) \"string\")\n (throw (new globalThis.TypeError \"compiler metadata path is required\")))\n (let* ((path (resolve metadata-path)) (record (await (readCompilerMetadata path))))\n (unless (plain record) (fail \"compiler artifact metadata must be an object\"))\n (put record :directory (dirname path)) (put record :metadataPath path)\n (unless (and (= (get record :host) \"javascript\") (= (get record :target) \"javascript\"))\n (fail \"JavaScript bootstrap requires a JavaScript compiler artifact\"))\n record))\n\n (defasync regular-file (base path)\n (safe-path path)\n (let ((parts (js-call path :split \"/\")) (current base) (index 0))\n (while (< index (js-length parts))\n (setq current (resolve current (aref parts index)))\n (let ((stat (await (lstat current))))\n (unless (if (= index (1- (js-length parts))) (js-call stat :isFile) (js-call stat :isDirectory))\n (fail (+ \"bootstrap product contains a nonregular entry: \" path))))\n (setq index (1+ index))))\n (resolve base path))\n\n (defasync file-digest (path)\n (let ((file (await (open path \"r\"))) (hash (createHash \"sha256\"))\n (buffer (new globalThis.Uint8Array 65536)) (bytes 0) (failed false) (done false))\n (try\n (while (not done)\n (let ((count (get (await (js-call file :read buffer 0 (js-length buffer) nil)) :bytesRead)))\n (if (= count 0) (setq done t)\n (progn (js-call hash :update (js-call buffer :subarray 0 count)) (setq bytes (+ bytes count))))))\n (js-object :bytes bytes :sha256 (js-call hash :digest \"hex\"))\n (catch error (setq failed t) (throw error))\n (finally (try (await (js-call file :close)) (catch error (unless failed (throw error))))))))\n\n (defasync product-paths (directory prefix)\n (let ((entries (await (readdir (resolve directory prefix) (js-object :withFileTypes t))))\n (paths (js-array)) (index 0))\n (while (< index (js-length entries))\n (let* ((entry (aref entries index)) (name (get entry :name))\n (path (if (= prefix \"\") name (+ prefix \"/\" name))))\n ;; These two names are control receipts defined before comparison.\n ;; No executable, map, macro, source asset or IR is excluded.\n (unless (or (= path \"compiler-artifact.json\") (= path \"ir/runtime-checkpoint.json\"))\n (cond\n ((js-call entry :isDirectory)\n (setq paths (js-call paths :concat (await (product-paths directory path)))))\n ((js-call entry :isFile) (js-call paths :push path))\n (t (fail (+ \"bootstrap product contains a nonregular entry: \" path))))))\n (setq index (1+ index)))\n (js-call paths :sort)))\n\n (defasync verify-product (value strict-inventory)\n (let* ((identity (get value :artifactIdentity)) (records (get identity :files))\n (seen (new globalThis.Set)) (files (js-array)) (index 0))\n (unless (and (= (get identity :algorithm) \"sha256\") (Array/isArray records) (> (js-length records) 0))\n (fail \"compiler artifact has no complete emitted file identity\"))\n (while (< index (js-length records))\n (let* ((record (aref records index)) (path (safe-path (get record :path))))\n (when (js-call seen :has path) (fail \"compiler artifact repeats an emitted file\"))\n (js-call seen :add path)\n (let* ((actual (await (file-digest (await (regular-file (get value :directory) path)))))\n (expected (js-object :bytes (get record :bytes) :sha256 (get record :sha256))))\n (same actual expected (+ \"compiler artifact changed after emission: \" path))\n (js-call files :push (js-object :path path :bytes (get actual :bytes) :sha256 (get actual :sha256)))))\n (setq index (1+ index)))\n (unless (js-call seen :has (safe-path (get value :path))) (fail \"compiler entry is absent from product files\"))\n (unless (and (Array/isArray (get value :modules)) (> (js-length (get value :modules)) 0))\n (fail \"compiler artifact has no JavaScript module graph\"))\n (let ((ids (new globalThis.Set)))\n (js-call (get value :modules) :forEach (lambda (record)\n (when (or (js-call ids :has (get record :id)) (not (js-call seen :has (get record :path))))\n (fail \"compiler JavaScript module graph is incomplete or repeated\"))\n (js-call ids :add (get record :id))\n (js-call (js-array \"sourceMapPath\" \"macroOriginsPath\") :forEach (lambda (key)\n (when (Object/hasOwn record key)\n (unless (js-call seen :has (get record key)) (fail \"compiler map or macro origins are undeclared\"))))))))\n (when strict-inventory\n (same (await (product-paths (get value :directory) \"\")) (js-call (Array/from seen) :sort)\n \"compiler artifact contains extra or missing product files\"))\n (same (independentCompilerProductIdentity (js-object :host \"javascript\" :files files))\n (get value :productIdentity) \"compiler product identity differs from its actual files\")\n (ordered files)))\n\n (defun source-record (item)\n (js-object :id (get item :id) :filename (get item :filename) :sha256 (get item :sha256)))\n (defun source-order (items)\n (js-call (Array/from items) :sort (lambda (left right)\n (cond ((< (get left :id) (get right :id)) -1) ((> (get left :id) (get right :id)) 1) (t 0)))))\n (defun bind-sources (value identity)\n (unless (and (plain identity) (= (get identity :encoding) \"utf16le\")\n (= (value-type (get identity :sha256)) \"string\")\n (Array/isArray (get identity :modules)) (plain (get identity :runtime)))\n (fail \"complete bootstrap source identity is required\"))\n (let ((body (js-object)))\n (js-call (Object/keys identity) :forEach (lambda (key)\n (unless (= key \"sha256\") (put body key (get identity key)))))\n (same (get identity :sha256)\n (js-call (js-call (createHash \"sha256\") :update (JSON/stringify body) \"utf16le\") :digest \"hex\")\n \"bootstrap source identity has an invalid digest\"))\n (let ((actual (get value :sourceIdentity)))\n (unless (and (= (get actual :algorithm) \"sha256\") (= (get actual :encoding) \"utf16le\")\n (= (get value :entry) (get identity :entry)))\n (fail \"compiler artifact has no complete UTF-16 source identity\"))\n (same (source-order (get actual :modules))\n (source-order (js-call (get identity :modules) :map source-record)) \"compiler source modules differ\")\n (same (get actual :runtime) (js-object :filename (get (get identity :runtime) :filename)\n :sha256 (get (get identity :runtime) :sha256)) \"compiler runtime source differs\")\n (js-call (js-array \"literalSources\" \"hostSources\") :forEach (lambda (key)\n (if (Object/hasOwn identity key)\n (same (source-order (get actual key)) (source-order (js-call (get identity key) :map source-record))\n (+ \"compiler \" key \" source inventory differs\"))\n (when (Object/hasOwn actual key) (fail \"compiler artifact contains undeclared source assets\"))))))\n value)\n\n (defasync exact-bytes (left-path right-path)\n (let ((left (await (open left-path \"r\"))) (right nil) (failed false)\n (a (new globalThis.Uint8Array 65536)) (b (new globalThis.Uint8Array 65536)) (position 0) (done false))\n (try\n (setq right (await (open right-path \"r\")))\n (while (not done)\n ;; Explicit positions and bounded filling handle legal short reads\n ;; without manufacturing a difference between identical files.\n (let ((counts (js-array 0 0)) (which 0))\n (while (< which 2)\n (let ((file (if (= which 0) left right)) (buffer (if (= which 0) a b))\n (count 0) (eof false))\n (while (and (< count (js-length buffer)) (not eof))\n (let ((read (get (await (js-call file :read buffer count (- (js-length buffer) count) (+ position count))) :bytesRead)))\n (if (= read 0) (setq eof t) (setq count (+ count read)))))\n (put counts which count))\n (setq which (1+ which)))\n (unless (= (aref counts 0) (aref counts 1)) (fail \"JavaScript fixed point has different file lengths\"))\n (let ((index 0) (count (aref counts 0)))\n (while (< index count)\n (unless (= (aref a index) (aref b index)) (fail \"JavaScript fixed point has different original bytes\"))\n (setq index (1+ index)))\n (setq position (+ position count))\n (when (= count 0) (setq done t)))))\n (catch error (setq failed t) (throw error))\n (finally\n (let ((close-failed false) (close-error undefined))\n (try (await (js-call left :close)) (catch error (setq close-failed t close-error error)))\n (when right (try (await (js-call right :close))\n (catch error (unless close-failed (setq close-failed t close-error error)))))\n (when (and close-failed (not failed)) (throw close-error)))))))\n\n (defasync compareJsFixedPoint (input)\n (unless (plain input) (throw (new globalThis.TypeError \"fixed point options are required\")))\n (let* ((identity (get input :sourceIdentity))\n (second (await (artifact (get input :stage2)))) (third (await (artifact (get input :stage3))))\n (files nil) (other nil) (index 0))\n (bind-sources second identity) (bind-sources third identity)\n ;; Compiler configuration is a product input even when it happens not\n ;; to alter a particular emitted byte. Control paths are not compared.\n (js-call (js-array \"profile\" \"budget\" \"memory\" \"auto\" \"debugEnabled\" \"capabilities\") :forEach (lambda (key)\n (same (get second key) (get third key) (+ \"JavaScript fixed point configuration differs: \" key))))\n (setq files (await (verify-product second t)) other (await (verify-product third t)))\n (same files other \"JavaScript fixed point has a different complete file inventory\")\n (same (get second :productIdentity) (get third :productIdentity) \"JavaScript fixed point product identities differ\")\n (while (< index (js-length files))\n (let ((path (get (aref files index) :path)))\n (await (exact-bytes (resolve (get second :directory) path) (resolve (get third :directory) path))))\n (setq index (1+ index)))\n (js-object :format \"eliscript-js-fixed-point\" :version 1 :status \"identical\" :from 2 :to 3\n :sourceIdentity identity :stage2ProductIdentity (get second :productIdentity)\n :stage3ProductIdentity (get third :productIdentity) :files files)))\n\n (defasync verify-seed (receipt source-root sources)\n (unless (and (= (get receipt :format) \"eliscript-js-stage0\") (= (get receipt :version) 1)\n (= (get receipt :status) \"built\") (= (get receipt :host) \"javascript\")\n (= (get receipt :target) \"javascript\") (= (get receipt :producer) \"emacs-lisp\"))\n (fail \"stage0 must be an authentic completed Emacs Lisp bootstrap\"))\n (same (get receipt :formalSourceIdentity) (compilerSourceIdentity sources) \"stage0 formal source identity differs\")\n (let* ((records (get receipt :seedSourceIdentity))\n (names (js-call (await (readdir (resolve source-root \"compiler\"))) :filter\n (lambda (name) (js-call name :endsWith \".el\"))))\n (expected (js-call (js-array \"tools/backends/bootstrap.el\" \"tools/runtime/unicode-case-runtime.el\") :concat\n (js-call (js-call names :sort) :map (lambda (name) (+ \"compiler/\" name)))))\n (index 0))\n (unless (Array/isArray records) (fail \"stage0 has no maintained Emacs source identity\"))\n (same (js-call records :map (lambda (record) (get record :path))) expected \"stage0 seed source inventory differs\")\n (while (< index (js-length records))\n (let* ((record (aref records index)) (actual (await (file-digest\n (await (regular-file source-root (get record :path)))))))\n (same actual (js-object :bytes (get record :bytes) :sha256 (get record :sha256))\n (+ \"stage0 seed source changed: \" (get record :path))))\n (setq index (1+ index)))))\n\n (defasync install-runtime-package (source-root directory)\n (let ((candidate (resolve source-root \"node_modules/eliscript\")) (package source-root))\n (try (await (lstat (resolve source-root \"package.json\")))\n (catch error\n (if (= (get error :code) \"ENOENT\") (setq package (await (realpath candidate))) (throw error))))\n (await (mkdir (resolve directory \"node_modules\") (js-object :recursive t)))\n (let ((link (resolve directory \"node_modules/eliscript\")))\n (try (await (symlink package link \"dir\"))\n (catch error\n (unless (= (get error :code) \"EEXIST\") (throw error))\n (same (await (realpath link)) (await (realpath package)) \"bootstrap runtime package resolves to a different source\"))))))\n\n (defasync reuse-completed (path identity seed initial-path sources signal observer)\n (let ((record undefined))\n (try (setq record (await (readCompilerMetadata path)))\n (catch error (unless (= (get error :code) \"ENOENT\") (throw error))))\n (if (undefined? record) nil\n (let ((base (dirname path)) (stages (get record :stages)) (index 0) (last nil))\n ;; An interrupted/failed invocation remains evidence. It cannot be\n ;; silently changed into a new successful invocation at the same path.\n (unless (and (= (get record :format) \"eliscript-js-bootstrap\") (= (get record :version) 1)\n (= (get record :status) \"accepted\") (Array/isArray stages) (= (js-length stages) 4))\n (fail \"bootstrap output already contains an incomplete or failed invocation; preserve it and use a new outputRoot\"))\n (same (get record :formalSourceIdentity) identity \"completed bootstrap source identity changed\")\n (same (get record :seedSourceIdentity) seed \"completed bootstrap seed identity changed\")\n (same (get record :configuration)\n (js-object :host \"javascript\" :target \"javascript\" :profile \"full-compiler\" :retainIR t :debug t)\n \"completed bootstrap configuration changed\")\n (same (await (realpath (resolve base (get (aref stages 0) :metadataPath))))\n (await (realpath initial-path)) \"completed bootstrap uses a different stage0\")\n (while (< index 4)\n (stopped signal)\n (let* ((stage (aref stages index))\n (value (await (artifact (resolve base (get stage :metadataPath))))))\n (unless (and (= (get stage :stage) index) (= (get stage :host) \"javascript\")\n (= (get stage :target) \"javascript\") (= (get stage :status) \"built\")\n (= (get stage :producer) (if (= index 0) \"emacs-lisp\" (+ \"stage\" (1- index)))))\n (fail \"completed bootstrap stage provenance changed\"))\n (same (get stage :inputIdentity) identity \"completed bootstrap stage input changed\")\n (assertCompilerArtifactSources value sources)\n (await (verify-product value (> index 0)))\n (same (get stage :productIdentity) (get value :productIdentity) \"completed bootstrap stage product changed\")\n (when (> index 0)\n (unless (and (= (get (get value :provenance) :mode) \"session\")\n (= (get (get value :provenance) :producerHost) \"javascript\"))\n (fail \"completed bootstrap stage has an invalid producer\")))\n (setq last value))\n (setq index (1+ index)))\n (unless (and (= (get (get record :fixedPoint) :from) 2) (= (get (get record :fixedPoint) :to) 3)\n (= (get (get record :fixedPoint) :status) \"identical\"))\n (fail \"completed bootstrap has no stage2-stage3 fixed point\"))\n (let* ((actual (await (compareJsFixedPoint (js-object\n :stage2 (resolve base (get (aref stages 2) :metadataPath))\n :stage3 (get last :metadataPath) :sourceIdentity identity))))\n (saved (await (readCompilerMetadata (resolve base (get (get record :fixedPoint) :comparisonPath))))))\n (same actual saved \"completed bootstrap fixed-point receipt changed\"))\n (observe observer 3 \"candidate-reuse-initialize\")\n (let ((session (await (openCompilerArtifact last))) (failed false))\n (try\n (unless (= (get (await (js-call session :request (js-object :operation \"capabilities\")\n (js-object :signal signal))) :format) \"eliscript-compiler-capabilities\")\n (fail \"completed stage3 returned invalid capabilities\"))\n (catch error (setq failed t) (throw error))\n (finally (try (await (js-call session :close)) (catch error (unless failed (throw error)))))))\n (js-object :manifestPath path :stage3MetadataPath (get last :metadataPath))))))\n\n (defasync bootstrapJsStages (input)\n (unless (plain input) (throw (new globalThis.TypeError \"JavaScript bootstrap options are required\")))\n ;; Read only the declared API fields. Neither producer functions, binary\n ;; hosts, skip flags nor arbitrary caller records can authorize a stage.\n (let* ((stage0-path (get input :stage0ManifestPath))\n (source-root (get input :sourceRoot)) (output-root (get input :outputRoot))\n (signal (get input :signal)) (observer (get input :onStage)))\n (unless (and (= (value-type stage0-path) \"string\") (= (value-type output-root) \"string\"))\n (throw (new globalThis.TypeError \"stage0ManifestPath and outputRoot are required\")))\n (unless (or (undefined? observer) (= (value-type observer) \"function\"))\n (throw (new globalThis.TypeError \"bootstrap stage observer must be a function\")))\n (when (nullish? source-root) (setq source-root root))\n (setq source-root (resolve source-root) stage0-path (resolve stage0-path) output-root (resolve output-root))\n (stopped signal)\n (observe observer 0 \"sources-start\")\n (let* ((sources (await (loadCompilerSources (js-object :sourceRoot source-root))))\n (identity (compilerSourceIdentity sources))\n (receipt (await (readCompilerMetadata stage0-path)))\n (initial-path (resolve (dirname stage0-path) (safe-path (get receipt :metadataPath))))\n (initial (await (artifact initial-path)))\n (manifest-path (resolve output-root \"bootstrap.json\"))\n (record (js-object :format \"eliscript-js-bootstrap\" :version 1 :status \"created\"\n :seedSourceIdentity (get receipt :seedSourceIdentity) :formalSourceIdentity identity\n :configuration (js-object :host \"javascript\" :target \"javascript\" :profile \"full-compiler\" :retainIR t :debug t)\n :stages (js-array)\n :fixedPoint (js-object :from 2 :to 3 :status \"pending\" :comparisonPath nil)\n :finalAcceptance (js-object :status \"pending\" :targets (js-array \"javascript\" \"wasm\" \"native\") :reportPath nil)))\n (previous initial) (previous-path initial-path) (index 1) (active nil)\n (current nil) (failed false) (primary undefined) (reused nil))\n (await (verify-seed receipt source-root sources))\n (assertCompilerArtifactSources initial sources)\n (unless (= (get (get initial :provenance) :mode) \"emacs-lisp\") (fail \"stage0 compiler provenance differs\"))\n (await (verify-product initial false))\n (same (get receipt :productIdentity) (get initial :productIdentity) \"stage0 product identity differs\")\n (setq reused (await (reuse-completed manifest-path identity (get receipt :seedSourceIdentity)\n initial-path sources signal observer)))\n (if reused reused\n (progn\n ;; All three stages receive this one owned immutable source snapshot.\n (js-call (get sources :modules) :forEach Object/freeze)\n (js-call (get sources :literalSources) :forEach Object/freeze)\n (Object/freeze (get sources :modules)) (Object/freeze (get sources :literalSources))\n (Object/freeze (get sources :runtime)) (Object/freeze sources)\n (await (mkdir output-root (js-object :recursive t)))\n (await (install-runtime-package source-root output-root))\n (await (archiveCompilerSources sources (resolve output-root \"sources\")))\n (js-call (get record :stages) :push (js-object :stage 0 :host \"javascript\" :target \"javascript\"\n :producer \"emacs-lisp\" :status \"built\" :metadataPath (portable output-root initial-path)\n :inputIdentity identity :productIdentity (get initial :productIdentity)))\n (while (<= index 3)\n (js-call (get record :stages) :push (js-object :stage index :host \"javascript\" :target \"javascript\"\n :producer (+ \"stage\" (1- index)) :status \"pending\" :metadataPath nil\n :inputIdentity identity :productIdentity nil))\n (setq index (1+ index)))\n (setq index 1)\n (await (writeCompilerMetadata manifest-path record))\n (try\n (put record :status \"building\")\n (while (<= index 3)\n (stopped signal)\n (setq current (aref (get record :stages) index))\n (put current :status \"building\")\n (await (writeCompilerMetadata manifest-path record))\n (observe observer index \"producer-open\")\n (setq active (await (openCompilerArtifact previous)))\n (let ((stage-failed false) (stage-error undefined) (next nil))\n (try\n (same (get active :host) \"javascript\" \"bootstrap producer changed its host\")\n (stopped signal)\n (observe observer index \"capabilities-start\")\n (unless (= (get (await (js-call active :request (js-object :operation \"capabilities\")\n (js-object :signal signal))) :format) \"eliscript-compiler-capabilities\")\n (fail \"bootstrap producer returned invalid capabilities\"))\n (observe observer index \"capabilities-complete\")\n (setq next (await (buildIndependentCompiler\n (js-object :host \"javascript\" :session active :sourceRoot source-root :sources sources\n :outputRoot (resolve output-root (+ \"stage\" index)) :profile \"full-compiler\"\n :retainIR t :debug t :signal signal\n :onPhase (lambda (phase detail) (observe observer index phase detail))))))\n (assertCompilerArtifactSources next sources)\n (unless (and (= (get (get next :provenance) :mode) \"session\")\n (= (get (get next :provenance) :producerHost) \"javascript\"))\n (fail \"bootstrap successor was not compiled by the active JavaScript producer\"))\n (same (get (get next :provenance) :compiledModuleIds)\n (js-call (get sources :modules) :map (lambda (item) (get item :id))) \"bootstrap omitted formal source modules\")\n ;; Persistence returns absolute paths; read the saved metadata\n ;; back to authenticate its actual declared product boundary.\n (setq next (await (artifact (get next :metadataPath))))\n (await (verify-product next t))\n (put current :metadataPath (portable output-root (get next :metadataPath)))\n (put current :productIdentity (get next :productIdentity))\n (catch error (setq stage-failed t stage-error error))\n (finally\n (observe observer index \"producer-close-start\")\n (try (await (js-call active :close))\n (catch error\n (put current :closeError (compilerFailure error))\n (unless stage-failed (setq stage-failed t stage-error error))))\n (setq active nil)\n (observe observer index \"producer-close-complete\")))\n (when stage-failed (throw stage-error))\n (put current :status \"built\")\n (setq previous next previous-path (get next :metadataPath))\n (await (writeCompilerMetadata manifest-path record))\n (observe observer index \"stage-complete\")\n (setq index (1+ index))))\n ;; Stage3 must itself initialize successfully before it can become a\n ;; release candidate. Its three output targets are a separate gate.\n (stopped signal)\n (observe observer 3 \"candidate-initialize\")\n (setq active (await (openCompilerArtifact previous)))\n (let ((initialization-failed false) (initialization-error undefined))\n (try\n (unless (= (get (await (js-call active :request (js-object :operation \"capabilities\")\n (js-object :signal signal))) :format) \"eliscript-compiler-capabilities\")\n (fail \"stage3 returned invalid capabilities\"))\n (catch error (setq initialization-failed t initialization-error error))\n (finally\n (try (await (js-call active :close))\n (catch error\n (put current :closeError (compilerFailure error))\n (unless initialization-failed (setq initialization-failed t initialization-error error))))\n (setq active nil)))\n (when initialization-failed (throw initialization-error)))\n (observe observer 3 \"fixed-point-start\")\n (let* ((second (aref (get record :stages) 2))\n (comparison (await (compareJsFixedPoint (js-object\n :stage2 (resolve output-root (get second :metadataPath)) :stage3 previous-path :sourceIdentity identity))))\n (path (resolve output-root \"fixed-point.json\")))\n (await (writeCompilerMetadata path comparison))\n (put record :fixedPoint (js-object :from 2 :to 3 :status \"identical\" :comparisonPath (portable output-root path))))\n (put record :status \"accepted\")\n (await (writeCompilerMetadata manifest-path record))\n (observe observer 3 \"fixed-point-complete\")\n (js-object :manifestPath manifest-path :stage3MetadataPath previous-path)\n (catch error\n (setq failed t primary error)\n (let ((cancelled (and (not (nullish? signal)) (get signal :aborted))))\n (put record :status (if cancelled \"cancelled\" \"failed\"))\n (when current (put current :status (if cancelled \"cancelled\" \"failed\"))\n (put current :error (compilerFailure error)))\n (put record :error (compilerFailure error))\n (when (> index 3) (put (get record :fixedPoint) :status \"failed\")))\n (try (await (writeCompilerMetadata manifest-path record)) (catch ignored nil))\n (throw error))\n (finally\n (when active\n (try (await (js-call active :close))\n (catch error (unless failed (throw error))))\n (setq active nil))\n (setq previous nil sources nil))))))))\n\n (export bootstrapJsStages compareJsFixedPoint))\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACE,QAA2B,OAAM,UAAS,SAAQ,OAAM,MAAK,SAAQ;AACrE,QAAoB,SAAQ,SAAQ,UAAS,YAAW;AACxD,QAAsB;AACtB,QAAoB;AACpB,QAAuB;AACvB,QAAgC,qBAAoB,0BAClD,oCAAmC;AACrC,QAAmC;AACnC,QAAoC,wBAAuB,+BACzD,wBAAuB,sBAAqB;AAE9C,cAAa;EAAS,OAAA,0DAAO,KAAK,kBAAiB;;AACnD,eAAc;EACZ,OAAA,CAAK,EAAK,CAAU,mBAAQ,CAAG,s7BAAY,WAAO,aAAU,qBAAM,cAAc;;AAClF,cAAa,MAAK,OAAM;EACtB,yBAAS,kBAAkB,MAAK;IAAO,OAAC,KAAK;;;;;AAC/C,iBAAgB;EACd,OAAA,CAAU,WAAW,UAAS,QAAM,EAAS,MAAK;IAC1C,IAAC,k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AAS,CAAU,cAAa,QAAO,WAAU,cAAY;2BAN7F,QAAQ,aAAY;yBAD3B,OAAQ,SAAS;uBADX,QAAS,QAAQ,cAAc,UAAU,CAAK,SAAQ;qBAD5D,OAAQ,qBAAqB;mBAD3B,uBAAuB;iBADzB,OAAQ,oBAAoB,EAAW,cAAY;;aATvB,CAAK,OAAM;WAA1C,CAAK,OAAM;SADgC,CAAK,OAAM;OAAjD,CAAK,OAAM;KADX,CAAK,OAAM;;AAoJjC,QAAQ,mBAAkB"}
|
|
1
|
+
{"version":3,"file":"bootstrap-js-stages.mjs","sources":["../eliscript/bootstrap-js-stages.eli"],"sourcesContent":["(module tools.backends.bootstrap-js-stages\n (import \"node:fs/promises\" mkdir readFile readdir lstat open symlink realpath)\n (import \"node:path\" resolve dirname relative isAbsolute sep)\n (import \"node:crypto\" createHash)\n (import \"node:util\" isDeepStrictEqual)\n (import \"../build.mjs\" root)\n (import \"../compiler-build.mjs\" loadCompilerSources buildIndependentCompiler\n independentCompilerProductIdentity writeCompilerMetadata)\n (import \"../compiler-metadata.mjs\" readCompilerMetadata)\n (import \"../compiler-bootstrap.mjs\" compilerSourceIdentity assertCompilerArtifactSources\n archiveCompilerSources openCompilerArtifact compilerFailure)\n\n (defun fail (message) (throw (new globalThis.Error message)))\n (defun plain (value)\n (and (not (nullish? value)) (= (value-type value) \"object\") (not (Array/isArray value))))\n (defun same (left right message)\n (unless (isDeepStrictEqual left right) (fail message)))\n (defun ordered (records)\n (js-call (Array/from records) :sort (lambda (left right)\n (cond ((< (get left :path) (get right :path)) -1)\n ((> (get left :path) (get right :path)) 1) (t 0)))))\n (defun portable (base path)\n (js-call (js-call (relative base path) :split sep) :join \"/\"))\n (defun safe-path (path)\n (unless (and (= (value-type path) \"string\") (> (js-length path) 0)\n (not (isAbsolute path)) (not (js-call path :includes \"\\\\\"))\n (not (js-call (js-call path :split \"/\") :some\n (lambda (part) (or (= part \"\") (= part \".\") (= part \"..\"))))))\n (fail \"bootstrap product contains an invalid relative path\")) path)\n (defun stopped (signal)\n (when (and (not (nullish? signal)) (get signal :aborted)) (throw (get signal :reason))))\n (defun observe (observer stage phase &optional detail)\n (when (= (value-type observer) \"function\")\n (try\n (let ((event (js-object :stage stage :host \"javascript\" :target \"javascript\" :phase phase)))\n (unless (nullish? detail)\n (js-call (js-array \"count\" \"moduleCount\" \"fileCount\" \"byteLength\" \"id\") :forEach\n (lambda (key)\n (let ((value (get detail key)))\n (when (or (= (value-type value) \"string\") (= (value-type value) \"number\"))\n (put event key value))))))\n (funcall observer (Object/freeze event)))\n (catch ignored nil))))\n\n (defasync artifact (metadata-path)\n (unless (= (value-type metadata-path) \"string\")\n (throw (new globalThis.TypeError \"compiler metadata path is required\")))\n (let* ((path (resolve metadata-path)) (record (await (readCompilerMetadata path))))\n (unless (plain record) (fail \"compiler artifact metadata must be an object\"))\n (put record :directory (dirname path)) (put record :metadataPath path)\n (unless (and (= (get record :host) \"javascript\") (= (get record :target) \"javascript\"))\n (fail \"JavaScript bootstrap requires a JavaScript compiler artifact\"))\n record))\n\n (defasync regular-file (base path)\n (safe-path path)\n (let ((parts (js-call path :split \"/\")) (current base) (index 0))\n (while (< index (js-length parts))\n (setq current (resolve current (aref parts index)))\n (let ((stat (await (lstat current))))\n (unless (if (= index (1- (js-length parts))) (js-call stat :isFile) (js-call stat :isDirectory))\n (fail (+ \"bootstrap product contains a nonregular entry: \" path))))\n (setq index (1+ index))))\n (resolve base path))\n\n (defasync file-digest (path)\n (let ((file (await (open path \"r\"))) (hash (createHash \"sha256\"))\n (buffer (new globalThis.Uint8Array 65536)) (bytes 0) (failed false) (done false))\n (try\n (while (not done)\n (let ((count (get (await (js-call file :read buffer 0 (js-length buffer) nil)) :bytesRead)))\n (if (= count 0) (setq done t)\n (progn (js-call hash :update (js-call buffer :subarray 0 count)) (setq bytes (+ bytes count))))))\n (js-object :bytes bytes :sha256 (js-call hash :digest \"hex\"))\n (catch error (setq failed t) (throw error))\n (finally (try (await (js-call file :close)) (catch error (unless failed (throw error))))))))\n\n (defasync product-paths (directory prefix)\n (let ((entries (await (readdir (resolve directory prefix) (js-object :withFileTypes t))))\n (paths (js-array)) (index 0))\n (while (< index (js-length entries))\n (let* ((entry (aref entries index)) (name (get entry :name))\n (path (if (= prefix \"\") name (+ prefix \"/\" name))))\n ;; These two names are control receipts defined before comparison.\n ;; No executable, map, macro, source asset or IR is excluded.\n (unless (or (= path \"compiler-artifact.json\") (= path \"ir/runtime-checkpoint.json\"))\n (cond\n ((js-call entry :isDirectory)\n (setq paths (js-call paths :concat (await (product-paths directory path)))))\n ((js-call entry :isFile) (js-call paths :push path))\n (t (fail (+ \"bootstrap product contains a nonregular entry: \" path))))))\n (setq index (1+ index)))\n (js-call paths :sort)))\n\n (defasync verify-product (value strict-inventory)\n (let* ((identity (get value :artifactIdentity)) (records (get identity :files))\n (seen (new globalThis.Set)) (files (js-array)) (index 0))\n (unless (and (= (get identity :algorithm) \"sha256\") (Array/isArray records) (> (js-length records) 0))\n (fail \"compiler artifact has no complete emitted file identity\"))\n (while (< index (js-length records))\n (let* ((record (aref records index)) (path (safe-path (get record :path))))\n (when (js-call seen :has path) (fail \"compiler artifact repeats an emitted file\"))\n (js-call seen :add path)\n (let* ((actual (await (file-digest (await (regular-file (get value :directory) path)))))\n (expected (js-object :bytes (get record :bytes) :sha256 (get record :sha256))))\n (same actual expected (+ \"compiler artifact changed after emission: \" path))\n (js-call files :push (js-object :path path :bytes (get actual :bytes) :sha256 (get actual :sha256)))))\n (setq index (1+ index)))\n (unless (js-call seen :has (safe-path (get value :path))) (fail \"compiler entry is absent from product files\"))\n (unless (and (Array/isArray (get value :modules)) (> (js-length (get value :modules)) 0))\n (fail \"compiler artifact has no JavaScript module graph\"))\n (let ((ids (new globalThis.Set)))\n (js-call (get value :modules) :forEach (lambda (record)\n (when (or (js-call ids :has (get record :id)) (not (js-call seen :has (get record :path))))\n (fail \"compiler JavaScript module graph is incomplete or repeated\"))\n (js-call ids :add (get record :id))\n (js-call (js-array \"sourceMapPath\" \"macroOriginsPath\") :forEach (lambda (key)\n (when (Object/hasOwn record key)\n (unless (js-call seen :has (get record key)) (fail \"compiler map or macro origins are undeclared\"))))))))\n (when strict-inventory\n (same (await (product-paths (get value :directory) \"\")) (js-call (Array/from seen) :sort)\n \"compiler artifact contains extra or missing product files\"))\n (same (independentCompilerProductIdentity (js-object :host \"javascript\" :files files))\n (get value :productIdentity) \"compiler product identity differs from its actual files\")\n (ordered files)))\n\n (defun source-record (item)\n (js-object :id (get item :id) :filename (get item :filename) :sha256 (get item :sha256)))\n (defun source-order (items)\n (js-call (Array/from items) :sort (lambda (left right)\n (cond ((< (get left :id) (get right :id)) -1) ((> (get left :id) (get right :id)) 1) (t 0)))))\n (defun bind-sources (value identity)\n (unless (and (plain identity) (= (get identity :encoding) \"utf16le\")\n (= (value-type (get identity :sha256)) \"string\")\n (Array/isArray (get identity :modules)) (plain (get identity :runtime)))\n (fail \"complete bootstrap source identity is required\"))\n (let ((body (js-object)))\n (js-call (Object/keys identity) :forEach (lambda (key)\n (unless (= key \"sha256\") (put body key (get identity key)))))\n (same (get identity :sha256)\n (js-call (js-call (createHash \"sha256\") :update (JSON/stringify body) \"utf16le\") :digest \"hex\")\n \"bootstrap source identity has an invalid digest\"))\n (let ((actual (get value :sourceIdentity)))\n (unless (and (= (get actual :algorithm) \"sha256\") (= (get actual :encoding) \"utf16le\")\n (= (get value :entry) (get identity :entry)))\n (fail \"compiler artifact has no complete UTF-16 source identity\"))\n (same (source-order (get actual :modules))\n (source-order (js-call (get identity :modules) :map source-record)) \"compiler source modules differ\")\n (same (get actual :runtime) (js-object :filename (get (get identity :runtime) :filename)\n :sha256 (get (get identity :runtime) :sha256)) \"compiler runtime source differs\")\n (js-call (js-array \"literalSources\" \"hostSources\") :forEach (lambda (key)\n (if (Object/hasOwn identity key)\n (same (source-order (get actual key)) (source-order (js-call (get identity key) :map source-record))\n (+ \"compiler \" key \" source inventory differs\"))\n (when (Object/hasOwn actual key) (fail \"compiler artifact contains undeclared source assets\"))))))\n value)\n\n (defasync exact-bytes (left-path right-path)\n (let ((left (await (open left-path \"r\"))) (right nil) (failed false)\n (a (new globalThis.Uint8Array 65536)) (b (new globalThis.Uint8Array 65536)) (position 0) (done false))\n (try\n (setq right (await (open right-path \"r\")))\n (while (not done)\n ;; Explicit positions and bounded filling handle legal short reads\n ;; without manufacturing a difference between identical files.\n (let ((counts (js-array 0 0)) (which 0))\n (while (< which 2)\n (let ((file (if (= which 0) left right)) (buffer (if (= which 0) a b))\n (count 0) (eof false))\n (while (and (< count (js-length buffer)) (not eof))\n (let ((read (get (await (js-call file :read buffer count (- (js-length buffer) count) (+ position count))) :bytesRead)))\n (if (= read 0) (setq eof t) (setq count (+ count read)))))\n (put counts which count))\n (setq which (1+ which)))\n (unless (= (aref counts 0) (aref counts 1)) (fail \"JavaScript fixed point has different file lengths\"))\n (let ((index 0) (count (aref counts 0)))\n (while (< index count)\n (unless (= (aref a index) (aref b index)) (fail \"JavaScript fixed point has different original bytes\"))\n (setq index (1+ index)))\n (setq position (+ position count))\n (when (= count 0) (setq done t)))))\n (catch error (setq failed t) (throw error))\n (finally\n (let ((close-failed false) (close-error undefined))\n (try (await (js-call left :close)) (catch error (setq close-failed t close-error error)))\n (when right (try (await (js-call right :close))\n (catch error (unless close-failed (setq close-failed t close-error error)))))\n (when (and close-failed (not failed)) (throw close-error)))))))\n\n (defasync compareJsFixedPoint (input)\n (unless (plain input) (throw (new globalThis.TypeError \"fixed point options are required\")))\n (let* ((identity (get input :sourceIdentity))\n (second (await (artifact (get input :stage2)))) (third (await (artifact (get input :stage3))))\n (files nil) (other nil) (index 0))\n (bind-sources second identity) (bind-sources third identity)\n ;; Compiler configuration is a product input even when it happens not\n ;; to alter a particular emitted byte. Control paths are not compared.\n (js-call (js-array \"profile\" \"budget\" \"memory\" \"auto\" \"debugEnabled\" \"capabilities\") :forEach (lambda (key)\n (same (get second key) (get third key) (+ \"JavaScript fixed point configuration differs: \" key))))\n (setq files (await (verify-product second t)) other (await (verify-product third t)))\n (same files other \"JavaScript fixed point has a different complete file inventory\")\n (same (get second :productIdentity) (get third :productIdentity) \"JavaScript fixed point product identities differ\")\n (while (< index (js-length files))\n (let ((path (get (aref files index) :path)))\n (await (exact-bytes (resolve (get second :directory) path) (resolve (get third :directory) path))))\n (setq index (1+ index)))\n (js-object :format \"eliscript-js-fixed-point\" :version 1 :status \"identical\" :from 2 :to 3\n :sourceIdentity identity :stage2ProductIdentity (get second :productIdentity)\n :stage3ProductIdentity (get third :productIdentity) :files files)))\n\n (defasync verify-seed (receipt source-root sources)\n (unless (and (= (get receipt :format) \"eliscript-js-stage0\") (= (get receipt :version) 1)\n (= (get receipt :status) \"built\") (= (get receipt :host) \"javascript\")\n (= (get receipt :target) \"javascript\") (= (get receipt :producer) \"emacs-lisp\"))\n (fail \"stage0 must be an authentic completed Emacs Lisp bootstrap\"))\n (same (get receipt :formalSourceIdentity) (compilerSourceIdentity sources) \"stage0 formal source identity differs\")\n (let* ((records (get receipt :seedSourceIdentity))\n (names (js-call (await (readdir (resolve source-root \"compiler\"))) :filter\n (lambda (name) (js-call name :endsWith \".el\"))))\n (expected (js-call (js-array \"tools/backends/bootstrap.el\" \"tools/runtime/unicode-case-runtime.el\") :concat\n (js-call (js-call names :sort) :map (lambda (name) (+ \"compiler/\" name)))))\n (index 0))\n (unless (Array/isArray records) (fail \"stage0 has no maintained Emacs source identity\"))\n (same (js-call records :map (lambda (record) (get record :path))) expected \"stage0 seed source inventory differs\")\n (while (< index (js-length records))\n (let* ((record (aref records index)) (actual (await (file-digest\n (await (regular-file source-root (get record :path)))))))\n (same actual (js-object :bytes (get record :bytes) :sha256 (get record :sha256))\n (+ \"stage0 seed source changed: \" (get record :path))))\n (setq index (1+ index)))))\n\n (defasync install-runtime-package (source-root directory)\n (let ((candidate (resolve source-root \"node_modules/eliscript\")) (package source-root))\n (try (await (lstat (resolve source-root \"package.json\")))\n (catch error\n (if (= (get error :code) \"ENOENT\") (setq package (await (realpath candidate))) (throw error))))\n (await (mkdir (resolve directory \"node_modules\") (js-object :recursive t)))\n (let ((link (resolve directory \"node_modules/eliscript\")))\n (try (await (symlink package link \"dir\"))\n (catch error\n (unless (= (get error :code) \"EEXIST\") (throw error))\n (same (await (realpath link)) (await (realpath package)) \"bootstrap runtime package resolves to a different source\"))))))\n\n (defasync reuse-completed (path identity seed initial-path sources signal observer)\n (let ((record undefined))\n (try (setq record (await (readCompilerMetadata path)))\n (catch error (unless (= (get error :code) \"ENOENT\") (throw error))))\n (if (undefined? record) nil\n (let ((base (dirname path)) (stages (get record :stages)) (index 0) (last nil))\n ;; An interrupted/failed invocation remains evidence. It cannot be\n ;; silently changed into a new successful invocation at the same path.\n (unless (and (= (get record :format) \"eliscript-js-bootstrap\") (= (get record :version) 1)\n (= (get record :status) \"accepted\") (Array/isArray stages) (= (js-length stages) 4))\n (fail \"bootstrap output already contains an incomplete or failed invocation; preserve it and use a new outputRoot\"))\n (same (get record :formalSourceIdentity) identity \"completed bootstrap source identity changed\")\n (same (get record :seedSourceIdentity) seed \"completed bootstrap seed identity changed\")\n (same (get record :configuration)\n (js-object :host \"javascript\" :target \"javascript\" :profile \"full-compiler\" :retainIR t :debug t)\n \"completed bootstrap configuration changed\")\n (same (await (realpath (resolve base (get (aref stages 0) :metadataPath))))\n (await (realpath initial-path)) \"completed bootstrap uses a different stage0\")\n (while (< index 4)\n (stopped signal)\n (let* ((stage (aref stages index))\n (value (await (artifact (resolve base (get stage :metadataPath))))))\n (unless (and (= (get stage :stage) index) (= (get stage :host) \"javascript\")\n (= (get stage :target) \"javascript\") (= (get stage :status) \"built\")\n (= (get stage :producer) (if (= index 0) \"emacs-lisp\" (+ \"stage\" (1- index)))))\n (fail \"completed bootstrap stage provenance changed\"))\n (same (get stage :inputIdentity) identity \"completed bootstrap stage input changed\")\n (assertCompilerArtifactSources value sources)\n (await (verify-product value (> index 0)))\n (same (get stage :productIdentity) (get value :productIdentity) \"completed bootstrap stage product changed\")\n (when (> index 0)\n (unless (and (= (get (get value :provenance) :mode) \"session\")\n (= (get (get value :provenance) :producerHost) \"javascript\"))\n (fail \"completed bootstrap stage has an invalid producer\")))\n (setq last value))\n (setq index (1+ index)))\n (unless (and (= (get (get record :fixedPoint) :from) 2) (= (get (get record :fixedPoint) :to) 3)\n (= (get (get record :fixedPoint) :status) \"identical\"))\n (fail \"completed bootstrap has no stage2-stage3 fixed point\"))\n (let* ((actual (await (compareJsFixedPoint (js-object\n :stage2 (resolve base (get (aref stages 2) :metadataPath))\n :stage3 (get last :metadataPath) :sourceIdentity identity))))\n (saved (await (readCompilerMetadata (resolve base (get (get record :fixedPoint) :comparisonPath))))))\n (same actual saved \"completed bootstrap fixed-point receipt changed\"))\n (observe observer 3 \"candidate-reuse-initialize\")\n (let ((session (await (openCompilerArtifact last))) (failed false))\n (try\n (unless (= (get (await (js-call session :request (js-object :operation \"capabilities\")\n (js-object :signal signal))) :format) \"eliscript-compiler-capabilities\")\n (fail \"completed stage3 returned invalid capabilities\"))\n (catch error (setq failed t) (throw error))\n (finally (try (await (js-call session :close)) (catch error (unless failed (throw error)))))))\n (js-object :manifestPath path :stage3MetadataPath (get last :metadataPath))))))\n\n (defasync bootstrapJsStages (input)\n (unless (plain input) (throw (new globalThis.TypeError \"JavaScript bootstrap options are required\")))\n ;; Read only the declared API fields. Neither producer functions, binary\n ;; hosts, skip flags nor arbitrary caller records can authorize a stage.\n (let* ((stage0-path (get input :stage0ManifestPath))\n (source-root (get input :sourceRoot)) (output-root (get input :outputRoot))\n (signal (get input :signal)) (observer (get input :onStage)))\n (unless (and (= (value-type stage0-path) \"string\") (= (value-type output-root) \"string\"))\n (throw (new globalThis.TypeError \"stage0ManifestPath and outputRoot are required\")))\n (unless (or (undefined? observer) (= (value-type observer) \"function\"))\n (throw (new globalThis.TypeError \"bootstrap stage observer must be a function\")))\n (when (nullish? source-root) (setq source-root root))\n (setq source-root (resolve source-root) stage0-path (resolve stage0-path) output-root (resolve output-root))\n (stopped signal)\n (observe observer 0 \"sources-start\")\n (let* ((sources (await (loadCompilerSources (js-object :sourceRoot source-root))))\n (identity (compilerSourceIdentity sources))\n (receipt (await (readCompilerMetadata stage0-path)))\n (initial-path (resolve (dirname stage0-path) (safe-path (get receipt :metadataPath))))\n (initial (await (artifact initial-path)))\n (manifest-path (resolve output-root \"bootstrap.json\"))\n (record (js-object :format \"eliscript-js-bootstrap\" :version 1 :status \"created\"\n :seedSourceIdentity (get receipt :seedSourceIdentity) :formalSourceIdentity identity\n :configuration (js-object :host \"javascript\" :target \"javascript\" :profile \"full-compiler\" :retainIR t :debug t)\n :stages (js-array)\n :fixedPoint (js-object :from 2 :to 3 :status \"pending\" :comparisonPath nil)\n :finalAcceptance (js-object :status \"pending\" :targets (js-array \"javascript\" \"wasm\" \"native\") :reportPath nil)))\n (previous initial) (previous-path initial-path) (index 1) (active nil)\n (current nil) (failed false) (primary undefined) (reused nil))\n (await (verify-seed receipt source-root sources))\n (assertCompilerArtifactSources initial sources)\n (unless (= (get (get initial :provenance) :mode) \"emacs-lisp\") (fail \"stage0 compiler provenance differs\"))\n (await (verify-product initial false))\n (same (get receipt :productIdentity) (get initial :productIdentity) \"stage0 product identity differs\")\n (setq reused (await (reuse-completed manifest-path identity (get receipt :seedSourceIdentity)\n initial-path sources signal observer)))\n (if reused reused\n (progn\n ;; All three stages receive this one owned immutable source snapshot.\n (js-call (get sources :modules) :forEach Object/freeze)\n (js-call (get sources :literalSources) :forEach Object/freeze)\n (Object/freeze (get sources :modules)) (Object/freeze (get sources :literalSources))\n (Object/freeze (get sources :runtime)) (Object/freeze sources)\n (await (mkdir output-root (js-object :recursive t)))\n (await (install-runtime-package source-root output-root))\n (await (archiveCompilerSources sources (resolve output-root \"sources\")))\n (js-call (get record :stages) :push (js-object :stage 0 :host \"javascript\" :target \"javascript\"\n :producer \"emacs-lisp\" :status \"built\" :metadataPath (portable output-root initial-path)\n :inputIdentity identity :productIdentity (get initial :productIdentity)))\n (while (<= index 3)\n (js-call (get record :stages) :push (js-object :stage index :host \"javascript\" :target \"javascript\"\n :producer (+ \"stage\" (1- index)) :status \"pending\" :metadataPath nil\n :inputIdentity identity :productIdentity nil))\n (setq index (1+ index)))\n (setq index 1)\n (await (writeCompilerMetadata manifest-path record))\n (try\n (put record :status \"building\")\n (while (<= index 3)\n (stopped signal)\n (setq current (aref (get record :stages) index))\n (put current :status \"building\")\n (await (writeCompilerMetadata manifest-path record))\n (observe observer index \"producer-open\")\n (setq active (await (openCompilerArtifact previous)))\n (let ((stage-failed false) (stage-error undefined) (next nil))\n (try\n (same (get active :host) \"javascript\" \"bootstrap producer changed its host\")\n (stopped signal)\n (observe observer index \"capabilities-start\")\n (unless (= (get (await (js-call active :request (js-object :operation \"capabilities\")\n (js-object :signal signal))) :format) \"eliscript-compiler-capabilities\")\n (fail \"bootstrap producer returned invalid capabilities\"))\n (observe observer index \"capabilities-complete\")\n (setq next (await (buildIndependentCompiler\n (js-object :host \"javascript\" :session active :sourceRoot source-root :sources sources\n :outputRoot (resolve output-root (+ \"stage\" index)) :profile \"full-compiler\"\n :retainIR t :debug t :signal signal\n :onPhase (lambda (phase detail) (observe observer index phase detail))))))\n (assertCompilerArtifactSources next sources)\n (unless (and (= (get (get next :provenance) :mode) \"session\")\n (= (get (get next :provenance) :producerHost) \"javascript\"))\n (fail \"bootstrap successor was not compiled by the active JavaScript producer\"))\n (same (get (get next :provenance) :compiledModuleIds)\n (js-call (get sources :modules) :map (lambda (item) (get item :id))) \"bootstrap omitted formal source modules\")\n ;; Persistence returns absolute paths; read the saved metadata\n ;; back to authenticate its actual declared product boundary.\n (setq next (await (artifact (get next :metadataPath))))\n (await (verify-product next t))\n (put current :metadataPath (portable output-root (get next :metadataPath)))\n (put current :productIdentity (get next :productIdentity))\n (catch error (setq stage-failed t stage-error error))\n (finally\n (observe observer index \"producer-close-start\")\n (try (await (js-call active :close))\n (catch error\n (put current :closeError (compilerFailure error))\n (unless stage-failed (setq stage-failed t stage-error error))))\n (setq active nil)\n (observe observer index \"producer-close-complete\")))\n (when stage-failed (throw stage-error))\n (put current :status \"built\")\n (setq previous next previous-path (get next :metadataPath))\n (await (writeCompilerMetadata manifest-path record))\n (observe observer index \"stage-complete\")\n (setq index (1+ index))))\n ;; Stage3 must itself initialize successfully before it can become a\n ;; release candidate. Its three output targets are a separate gate.\n (stopped signal)\n (observe observer 3 \"candidate-initialize\")\n (setq active (await (openCompilerArtifact previous)))\n (let ((initialization-failed false) (initialization-error undefined))\n (try\n (unless (= (get (await (js-call active :request (js-object :operation \"capabilities\")\n (js-object :signal signal))) :format) \"eliscript-compiler-capabilities\")\n (fail \"stage3 returned invalid capabilities\"))\n (catch error (setq initialization-failed t initialization-error error))\n (finally\n (try (await (js-call active :close))\n (catch error\n (put current :closeError (compilerFailure error))\n (unless initialization-failed (setq initialization-failed t initialization-error error))))\n (setq active nil)))\n (when initialization-failed (throw initialization-error)))\n (observe observer 3 \"fixed-point-start\")\n (let* ((second (aref (get record :stages) 2))\n (comparison (await (compareJsFixedPoint (js-object\n :stage2 (resolve output-root (get second :metadataPath)) :stage3 previous-path :sourceIdentity identity))))\n (path (resolve output-root \"fixed-point.json\")))\n (await (writeCompilerMetadata path comparison))\n (put record :fixedPoint (js-object :from 2 :to 3 :status \"identical\" :comparisonPath (portable output-root path))))\n (put record :status \"accepted\")\n (await (writeCompilerMetadata manifest-path record))\n (observe observer 3 \"fixed-point-complete\")\n (js-object :manifestPath manifest-path :stage3MetadataPath previous-path)\n (catch error\n (setq failed t primary error)\n (let ((cancelled (and (not (nullish? signal)) (get signal :aborted))))\n (put record :status (if cancelled \"cancelled\" \"failed\"))\n (when current (put current :status (if cancelled \"cancelled\" \"failed\"))\n (put current :error (compilerFailure error)))\n (put record :error (compilerFailure error))\n (when (> index 3) (put (get record :fixedPoint) :status \"failed\")))\n (try (await (writeCompilerMetadata manifest-path record)) (catch ignored nil))\n (throw error))\n (finally\n (when active\n (try (await (js-call active :close))\n (catch error (unless failed (throw error))))\n (setq active nil))\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DAAS,QAAO;wDAAQ,OAAA;;;oDACzE,OAAA,4DAAO;mDACT;oDACE,oBAAM;sDACJ;;0DAAK,OAAA,OAAO,CAAS,QAAO;yDAC1B,QAAO;0DAAM,yBAAQ;4DAAO,OAAA,4DAAO;;;;;;sDACrC,OAAA,CAAM,CAAA,SAAO;;oDACf,CAAM,CAAA,WAAS,OAAI,CAAA,UAAQ;;;;;6CA1H+B;2CAAnB;yCAAhB;uCAAb;qCADyD;mCAAX;iCAArB;+BAAxB;6BANF,EAAW,UAAQ,0BAAyB,WAAS,GAAE,UAAQ,WACrE,sBAAoB,CAAK,SAAQ,uBAAqB,wBAAsB,UAC5E,iBAAe,EAAW,QAAM,cAAa,UAAQ,cAAa,WAAS,iBAAgB,YAAU,MAAE,SAAO,QAC9G,UAAQ,IACR,cAAY,EAAW,QAAM,GAAE,MAAI,GAAE,UAAQ,WAAU,kBAAgB,QACvE,mBAAiB,EAAW,UAAQ,WAAU,WAAS,CAAU,cAAa,QAAO,WAAU,cAAY;2BAN7F,QAAQ,aAAY;yBAD3B,OAAQ,SAAS;uBADX,QAAS,QAAQ,cAAc,UAAU,CAAK,SAAQ;qBAD5D,OAAQ,qBAAqB;mBAD3B,uBAAuB;iBADzB,OAAQ,oBAAoB,EAAW,cAAY;;aATvB,CAAK,OAAM;WAA1C,CAAK,OAAM;SADgC,CAAK,OAAM;OAAjD,CAAK,OAAM;KADX,CAAK,OAAM;;AAoJjC,QAAQ,mBAAkB"}
|
|
@@ -1,97 +1,7 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import "eliscript/runtime/unicode-case.mjs";
|
|
3
|
-
import {
|
|
3
|
+
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";
|
|
4
4
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
5
|
-
const __eliscript_number_intrinsic = globalThis.Number;
|
|
6
|
-
const __eliscript_bigint_intrinsic = globalThis.BigInt;
|
|
7
|
-
const __eliscript_numeric_apply = globalThis.Reflect.apply;
|
|
8
|
-
const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
|
|
9
|
-
const __eliscript_numeric_error = globalThis.TypeError;
|
|
10
|
-
const __eliscript_numeric_trim = globalThis.String.prototype.trim;
|
|
11
|
-
const __eliscript_numeric_slice = globalThis.String.prototype.slice;
|
|
12
|
-
const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
|
|
13
|
-
const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
|
|
14
|
-
const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
|
|
15
|
-
const __eliscript_numeric_primitive = (value) => {
|
|
16
|
-
if (!__eliscript_numeric_object(value)) return value;
|
|
17
|
-
const exotic = value[__eliscript_numeric_symbol];
|
|
18
|
-
if (exotic !== void 0 && exotic !== null) {
|
|
19
|
-
const result = __eliscript_numeric_apply(exotic, value, ["number"]);
|
|
20
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
21
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
22
|
-
}
|
|
23
|
-
for (let index = 0; index < 2; index++) {
|
|
24
|
-
const method = value[index === 0 ? "valueOf" : "toString"];
|
|
25
|
-
if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
|
|
26
|
-
const result = __eliscript_numeric_apply(method, value, []);
|
|
27
|
-
if (!__eliscript_numeric_object(result)) return result;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
throw new __eliscript_numeric_error("Cannot convert object to primitive value");
|
|
31
|
-
};
|
|
32
|
-
const __eliscript_to_number = (value) => {
|
|
33
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
34
|
-
if (typeof primitive === "string") {
|
|
35
|
-
const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
|
|
36
|
-
if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
|
|
37
|
-
let first = 2;
|
|
38
|
-
while (first < text.length && text[first] === "0") first++;
|
|
39
|
-
if (first === text.length) return 0;
|
|
40
|
-
const prefix = text[1];
|
|
41
|
-
const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
|
|
42
|
-
if (text.length - first > limit) return 1 / 0;
|
|
43
|
-
const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
|
|
44
|
-
return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return __eliscript_number_intrinsic(primitive);
|
|
48
|
-
};
|
|
49
|
-
const __eliscript_numeric = (value) => {
|
|
50
|
-
if (typeof value === "number" || typeof value === "bigint") return value;
|
|
51
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
52
|
-
if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
|
|
53
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
54
|
-
};
|
|
55
|
-
const __eliscript_implicit_number = (value) => {
|
|
56
|
-
if (typeof value === "number") return value;
|
|
57
|
-
const primitive = __eliscript_numeric_primitive(value);
|
|
58
|
-
if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
|
|
59
|
-
return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
|
|
60
|
-
};
|
|
61
|
-
const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
|
|
62
|
-
const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
|
|
63
|
-
const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
|
|
64
|
-
const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
|
|
65
|
-
const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
|
|
66
|
-
const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
|
|
67
|
-
const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
|
|
68
|
-
const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
|
|
69
|
-
const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
|
|
70
|
-
const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
|
|
71
|
-
const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
|
|
72
|
-
const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
|
|
73
|
-
const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
|
|
74
|
-
const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
|
|
75
|
-
const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
|
|
76
|
-
const __eliscript_numeric_relation = (operator, left, right) => {
|
|
77
|
-
if (typeof left === "number" && typeof right === "number") {
|
|
78
|
-
if (operator === "<") return left < right;
|
|
79
|
-
if (operator === "<=") return left <= right;
|
|
80
|
-
if (operator === ">") return left > right;
|
|
81
|
-
return left >= right;
|
|
82
|
-
}
|
|
83
|
-
let a = __eliscript_numeric_primitive(left);
|
|
84
|
-
let b = __eliscript_numeric_primitive(right);
|
|
85
|
-
const x = typeof a, y = typeof b;
|
|
86
|
-
if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
|
|
87
|
-
a = __eliscript_numeric(a);
|
|
88
|
-
b = __eliscript_numeric(b);
|
|
89
|
-
}
|
|
90
|
-
if (operator === "<") return a < b;
|
|
91
|
-
if (operator === "<=") return a <= b;
|
|
92
|
-
if (operator === ">") return a > b;
|
|
93
|
-
return a >= b;
|
|
94
|
-
};
|
|
95
5
|
|
|
96
6
|
import {readFile, writeFile} from "node:fs/promises";
|
|
97
7
|
import {resolve, basename, posix} from "node:path";
|