lawspec 0.15.0 → 0.15.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/CHANGELOG.md +501 -0
- package/README.md +60 -741
- package/api.mjs +1 -1
- package/bin/lawspec.mjs +4 -2
- package/build.json +13 -15
- package/core.wasm +0 -0
- package/doctor.mjs +1 -0
- package/examples-command.mjs +1 -0
- package/files.mjs +1 -0
- package/index.d.ts +1 -1
- package/launcher.mjs +26 -16
- package/native-examples.mjs +1 -0
- package/package.json +33 -6
- package/read-only-hpack.mjs +1 -0
- package/scalars.mjs +1 -0
- package/templates.mjs +112 -219
- package/API-MIGRATION.md +0 -339
- package/GO.md +0 -144
- package/HASKELL.md +0 -172
- package/JAVA.md +0 -113
- package/KOTLIN.md +0 -219
- package/LANGUAGE.md +0 -692
- package/NATIVE-BINDINGS.md +0 -1051
- package/PRIMITIVES.md +0 -150
- package/PYTHON.md +0 -152
- package/REFINEMENTS.md +0 -449
- package/RELEASE-0.10.md +0 -60
- package/RELEASE-0.11.md +0 -62
- package/RELEASE-0.12.md +0 -47
- package/RELEASE-0.13.md +0 -97
- package/RELEASE-0.14.md +0 -52
- package/RELEASE-0.15.md +0 -44
- package/RELEASE-0.9.md +0 -61
- package/RUST.md +0 -211
- package/WEB.md +0 -144
package/api.mjs
CHANGED
package/bin/lawspec.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// Generated from templates/npm/bin/lawspec.mjs by lawspec-dev generate. Do not edit.
|
|
2
3
|
import { readFile, mkdir, readdir, stat } from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { createCompiler } from "../api.mjs";
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
atomicWrite,
|
|
14
15
|
safePath,
|
|
15
16
|
} from "../files.mjs";
|
|
17
|
+
const VERSION = "0.15.1";
|
|
16
18
|
const args = process.argv.slice(2);
|
|
17
19
|
const verb = args.shift();
|
|
18
20
|
const options = {};
|
|
@@ -242,13 +244,13 @@ async function main() {
|
|
|
242
244
|
}
|
|
243
245
|
if (!verb || ["help", "--help", "-h"].includes(verb)) {
|
|
244
246
|
output(
|
|
245
|
-
"LawSpec
|
|
247
|
+
"LawSpec " + VERSION + "\nUsage: lawspec init --target <language> [--project <directory>] [--minify]\n lawspec check | doctor | explain <unit>::<law> | generate\n lawspec evidence [<unit> | <unit>::<declaration>]\n lawspec package [--project <package directory>]\n lawspec examples [--example payments] [--target <language>] [--output <directory>]\nOptions: --config <path>, --target <language>, --machine-bits <32|64>, --json\nGeneration: --dry-run, --check, --minify\nTargets: " +
|
|
246
248
|
targets.join(", "),
|
|
247
249
|
);
|
|
248
250
|
return;
|
|
249
251
|
}
|
|
250
252
|
if (verb === "--version") {
|
|
251
|
-
output(
|
|
253
|
+
output(VERSION);
|
|
252
254
|
return;
|
|
253
255
|
}
|
|
254
256
|
if (positional.length > (["explain", "evidence"].includes(verb) ? 1 : 0))
|
package/build.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"compilerSources": [
|
|
4
|
+
"dev/Gen/Embed.hs",
|
|
4
5
|
"lawspec.cabal",
|
|
5
6
|
"package.yaml",
|
|
6
7
|
"runtime/LawSpecCodecs.hs",
|
|
@@ -64,7 +65,6 @@
|
|
|
64
65
|
"src/LawSpec/Emit.hs",
|
|
65
66
|
"src/LawSpec/Eval.hs",
|
|
66
67
|
"src/LawSpec/Frontend.hs",
|
|
67
|
-
"src/LawSpec/Gen.hs",
|
|
68
68
|
"src/LawSpec/GoData.hs",
|
|
69
69
|
"src/LawSpec/GoDefinitions.hs",
|
|
70
70
|
"src/LawSpec/GoExpr.hs",
|
|
@@ -127,15 +127,15 @@
|
|
|
127
127
|
"src/LawSpec/WebTypes.hs",
|
|
128
128
|
"stack.yaml",
|
|
129
129
|
"stack.yaml.lock",
|
|
130
|
-
"tools/embed-runtimes.py",
|
|
131
130
|
"wasm/app/Exports.hs",
|
|
132
131
|
"wasm/cabal.project",
|
|
133
132
|
"wasm/cabal.project.freeze",
|
|
134
133
|
"wasm/lawspec-wasm.cabal"
|
|
135
134
|
],
|
|
136
135
|
"digests": {
|
|
137
|
-
"
|
|
138
|
-
"
|
|
136
|
+
"dev/Gen/Embed.hs": "fd79909790f2026ff40a6de58897a934141e5eba1ca31b2d8cd3b128335def55",
|
|
137
|
+
"lawspec.cabal": "ca830fac0e43b0d4f879a8c283e34cf4c4352245a4808e974e82c60762f32217",
|
|
138
|
+
"package.yaml": "8566732125bcaab57ddecbe06e12e073a327df60fb71e97a16201586b7333a6b",
|
|
139
139
|
"runtime/LawSpecCodecs.hs": "90cb1ed15d7ab664a17a054580c849408d77cfd2b2adcb4a3228b05132caeaca",
|
|
140
140
|
"runtime/LawSpecDataStrategies.hs": "cbe9f1946228db1076c19cd3158e8798fe32766cfdbea3f66b63d22d3d217508",
|
|
141
141
|
"runtime/LawSpecDataStrategies.java": "e3416efe8a0d7b1276cb4d1a8105fd01b1f5f3f02a803bf55d955d9e3ec39095",
|
|
@@ -159,9 +159,9 @@
|
|
|
159
159
|
"runtime/lawspec_schema.mjs": "60eb4204461eaa2c207fc7c3394014e2a814e4383b7045c065b4dae7c7a202c2",
|
|
160
160
|
"runtime/lawspec_schema.py": "b6967ef1a33fe6a1a180d5573ec37cd8bb2079c06e961ac2eeb05f23cffcdd07",
|
|
161
161
|
"runtime/lawspec_strategies.rs": "cac9ca301d4614fff9acfe61e7cc5678fabc044edadfa89ec11599b6780dc5f3",
|
|
162
|
-
"runtime/rust/Cargo.lock": "
|
|
163
|
-
"runtime/rust/Cargo.toml": "
|
|
164
|
-
"src/LawSpec/Api.hs": "
|
|
162
|
+
"runtime/rust/Cargo.lock": "0b1ebb624714087ee18ff2faf8b8299e6758e769fda82ff2861019c331c234ca",
|
|
163
|
+
"runtime/rust/Cargo.toml": "27b9680d77513379a8d9aa200adfe22437fcdab8baf8659d2cf6cfb6fd3c0215",
|
|
164
|
+
"src/LawSpec/Api.hs": "b7315b30890e3e38382c7e4d60afdfc6c7c3647f056636c230a91c16047f9944",
|
|
165
165
|
"src/LawSpec/Backend.hs": "03c3b0cd62467ca677c88d29d7b12b2ab505cc0076d93d1f48fbddb0e9bcf133",
|
|
166
166
|
"src/LawSpec/Capabilities.hs": "e43d4fc3a4481fbb8aa3ff1c3f41f7e7fca5db01bfe256a30162a45d75a00c1c",
|
|
167
167
|
"src/LawSpec/Code/Doc.hs": "9e3b70f85deb1dcbce385af1d0cd4bea2dfa8a2d806d54745d4bb437406673e5",
|
|
@@ -190,14 +190,13 @@
|
|
|
190
190
|
"src/LawSpec/Data.hs": "9dbeafa120276b114dad790ec69e617f7ad0c632e3c718962f2f7faf8ca327f4",
|
|
191
191
|
"src/LawSpec/DataNames.hs": "f10da6137dade8ac369fabb9231d87bf0d801655eb6756e816369102d147b4c0",
|
|
192
192
|
"src/LawSpec/DefinitionTotality.hs": "7671b7efb0cac5d796b074d48b2c10940e5bd0b5df082b926aee694903285efa",
|
|
193
|
-
"src/LawSpec/Discharge.hs": "
|
|
193
|
+
"src/LawSpec/Discharge.hs": "4b0a5692b31be7620239a4ac5175a0ef2950fc223f708b34895a7cde17a98e95",
|
|
194
194
|
"src/LawSpec/Domain.hs": "222d15f0012ae630802238a6d7e1ee78d1e718b599f5ebb5a1ddc4e8d29d68c3",
|
|
195
195
|
"src/LawSpec/DomainModel.hs": "3be67117c44e66a39d42d7ce094c2940c48ea1541017b64027afa6ea4b77092f",
|
|
196
196
|
"src/LawSpec/Elaboration.hs": "86e3ef77a977cb1b55985e2939648135acd0c2c015afe76e34e09615d555f53e",
|
|
197
197
|
"src/LawSpec/Emit.hs": "9f34f5765915a2a12a66a6dca647ddaef9289372956802c6d99cf0cfec447c7a",
|
|
198
198
|
"src/LawSpec/Eval.hs": "b0872ba8a6974463b32776653c2939826a6be87318c15641401f913f6b139de2",
|
|
199
199
|
"src/LawSpec/Frontend.hs": "fbf091b9c96f5b5361dbf4f65819634c0f8526ff98550d97c434c0d47af7839e",
|
|
200
|
-
"src/LawSpec/Gen.hs": "534c994a500c8af40b5750a6a25505d346b928afa771453466f1980925bae9d8",
|
|
201
200
|
"src/LawSpec/GoData.hs": "1b1882906ba676cdd37c744b91d271c7d25279b137f0c5ba5863f4423729bc86",
|
|
202
201
|
"src/LawSpec/GoDefinitions.hs": "3cb55c22f28443fff73e73c59780bf1977ab9260b8d66c7f19d1b94b40d1397e",
|
|
203
202
|
"src/LawSpec/GoExpr.hs": "da3a7cc0e3d2906886dc44f6b990e72098bb351558bbb31ee335da7382fac58a",
|
|
@@ -242,7 +241,7 @@
|
|
|
242
241
|
"src/LawSpec/PythonNativeBinding.hs": "4e35ff8781062d0f614e45ea45f98038c8d609ab78bd671cb0a239eaa9db1690",
|
|
243
242
|
"src/LawSpec/PythonTypes.hs": "61c7271279e33b59f5b70cdee6363e0c0efb53a2f58c3256950dbec522ad7f10",
|
|
244
243
|
"src/LawSpec/Refinement.hs": "3bbdc090f9ebce60d99254dbe93dec6e11bd838df8537df828fd9c768c79d126",
|
|
245
|
-
"src/LawSpec/RuntimeSources.hs": "
|
|
244
|
+
"src/LawSpec/RuntimeSources.hs": "a880283705bac3840b3039322f70923829298d8f05754c7fa51a4a3875baba57",
|
|
246
245
|
"src/LawSpec/RustData.hs": "0d28ff5b35c5085c55604ef1eea366dec737b29d3352ef1576bb82c7421b615c",
|
|
247
246
|
"src/LawSpec/RustDefinitions.hs": "8c289e2779d7ed623f3578f20974dd9e2016c67734ee1447ed7f4b7c22caedf9",
|
|
248
247
|
"src/LawSpec/RustEmit.hs": "d08797ca26180b6ed2884c0576ec7b0265cadc2236a95d8754cfea89bb2940e0",
|
|
@@ -260,14 +259,13 @@
|
|
|
260
259
|
"src/LawSpec/WebTypes.hs": "f74c6e346e3e3922223f8738a8f85e2b036e8f0469d9d7f027400e2f60f6957e",
|
|
261
260
|
"stack.yaml": "20ccf4d599e355e60b7aa4f814a7cd4299fe2048616cc2e6dbdc22a7bd8cec73",
|
|
262
261
|
"stack.yaml.lock": "ae222b9c81af920c56e50fa4596fa57786e7fa5a7b461390362b2b2ff63818c7",
|
|
263
|
-
"tools/embed-runtimes.py": "91a05197fc542a65387f3ccf4614a4817c850031eb4b84196c621b8baf344865",
|
|
264
262
|
"wasm/app/Exports.hs": "4ecbdac8faa2449e6fc61b93c82e6278fa14374154f29b4dacf0eef433f06a47",
|
|
265
263
|
"wasm/cabal.project": "021e560afdc5eb4cb7169e7119ecb8f92c9ee170245af909c94b612941bff5cc",
|
|
266
264
|
"wasm/cabal.project.freeze": "733dbed3d2ecccb26e874fd58f136296dad772184deb1658c196b5d54a0814dc",
|
|
267
|
-
"wasm/lawspec-wasm.cabal": "
|
|
268
|
-
"npm/core.wasm": "
|
|
265
|
+
"wasm/lawspec-wasm.cabal": "251c6b297505fdcda2520c05ea01eec1e1bd1674babde621f3be777808a65afe",
|
|
266
|
+
"npm/core.wasm": "fd43be00cd2681e53c2422ff03a04eb1f0e351e4b091bf865c3be16f6f21dccd",
|
|
269
267
|
"npm/core_jsffi.js": "88d136efe92f7cff5758c8fec8d9b6bbc9707fe37741cebeeb415fe34ce3d72b",
|
|
270
|
-
"npm/api.mjs": "
|
|
271
|
-
"npm/index.d.ts": "
|
|
268
|
+
"npm/api.mjs": "19e1624f91258c1397f3212faf65b407c62671b0fc5b118520e6a91f7ad7c6ba",
|
|
269
|
+
"npm/index.d.ts": "2215087cc6628a2ddbdd573210c4f9021cffeb00c142d4f3ae1314fd59a397f6"
|
|
272
270
|
}
|
|
273
271
|
}
|
package/core.wasm
CHANGED
|
Binary file
|
package/doctor.mjs
CHANGED
package/examples-command.mjs
CHANGED
package/files.mjs
CHANGED
package/index.d.ts
CHANGED
package/launcher.mjs
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
+
// Generated from templates/npm/launcher.mjs by lawspec-dev generate. Do not edit.
|
|
1
2
|
import { readFile } from "node:fs/promises";
|
|
2
3
|
let compiled;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
compiled ??= readFile(new URL("./core.wasm", import.meta.url)).then(
|
|
8
|
-
WebAssembly.compile,
|
|
9
|
-
);
|
|
10
|
-
const wasi = new WASI({
|
|
11
|
-
version: "preview1",
|
|
12
|
-
args: ["lawspec"],
|
|
13
|
-
env: { PWD: "/" },
|
|
14
|
-
preopens: { "/": process.cwd() },
|
|
15
|
-
});
|
|
4
|
+
|
|
5
|
+
// Instantiate the compiler core with a platform's WASI preview1 imports and
|
|
6
|
+
// serialize calls: the core handles one JSON request at a time.
|
|
7
|
+
async function instantiateCore(module, wasiImports, initialize) {
|
|
16
8
|
const exports = {};
|
|
17
9
|
const jsffi = (await import("./core_jsffi.js")).default;
|
|
18
|
-
const instance = await WebAssembly.instantiate(
|
|
19
|
-
wasi_snapshot_preview1:
|
|
10
|
+
const instance = await WebAssembly.instantiate(module, {
|
|
11
|
+
wasi_snapshot_preview1: wasiImports,
|
|
20
12
|
ghc_wasm_jsffi: jsffi(exports),
|
|
21
13
|
});
|
|
22
14
|
Object.assign(exports, instance.exports);
|
|
23
|
-
|
|
15
|
+
initialize(instance);
|
|
24
16
|
let pending = Promise.resolve();
|
|
25
17
|
return (input) => {
|
|
26
18
|
const result = pending.then(async () =>
|
|
@@ -30,3 +22,21 @@ export async function loadCore() {
|
|
|
30
22
|
return result;
|
|
31
23
|
};
|
|
32
24
|
}
|
|
25
|
+
|
|
26
|
+
export async function loadCore() {
|
|
27
|
+
const { WASI } = await import("node:wasi");
|
|
28
|
+
if (Number(process.versions.node.split(".")[0]) < 22)
|
|
29
|
+
throw new Error("LawSpec requires Node 22+");
|
|
30
|
+
compiled ??= readFile(new URL("./core.wasm", import.meta.url)).then(
|
|
31
|
+
WebAssembly.compile,
|
|
32
|
+
);
|
|
33
|
+
const wasi = new WASI({
|
|
34
|
+
version: "preview1",
|
|
35
|
+
args: ["lawspec"],
|
|
36
|
+
env: { PWD: "/" },
|
|
37
|
+
preopens: { "/": process.cwd() },
|
|
38
|
+
});
|
|
39
|
+
return instantiateCore(await compiled, wasi.wasiImport, (instance) =>
|
|
40
|
+
wasi.initialize(instance),
|
|
41
|
+
);
|
|
42
|
+
}
|
package/native-examples.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lawspec",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "State the law once. Check it everywhere.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/brain-fuel/lawspec.git"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
|
-
"engines": {
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=22"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"lawspec": "bin/lawspec.mjs"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"import": "./api.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
10
23
|
"types": "index.d.ts",
|
|
11
|
-
"files": [
|
|
12
|
-
|
|
24
|
+
"files": [
|
|
25
|
+
"*.mjs",
|
|
26
|
+
"*.json",
|
|
27
|
+
"index.d.ts",
|
|
28
|
+
"bin",
|
|
29
|
+
"core.wasm",
|
|
30
|
+
"core_jsffi.js",
|
|
31
|
+
"README.md",
|
|
32
|
+
"CHANGELOG.md",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"starter.lawspec",
|
|
35
|
+
"examples"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"test": "node --test test/*.test.mjs"
|
|
39
|
+
}
|
|
13
40
|
}
|
package/read-only-hpack.mjs
CHANGED
package/scalars.mjs
CHANGED