functionalscript 0.19.0 → 0.21.0

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.
Files changed (256) hide show
  1. package/fs/asn.1/{test.f.d.ts → proof.f.d.ts} +1 -2
  2. package/fs/asn.1/{test.f.js → proof.f.js} +1 -1
  3. package/fs/asserts/module.f.d.ts +4 -0
  4. package/fs/asserts/module.f.js +6 -0
  5. package/fs/base128/proof.f.d.ts +1 -0
  6. package/fs/base128/{test.f.js → proof.f.js} +1 -1
  7. package/fs/bnf/data/{test.f.d.ts → proof.f.d.ts} +1 -2
  8. package/fs/bnf/data/{test.f.js → proof.f.js} +1 -1
  9. package/fs/bnf/proof.f.d.ts +3 -0
  10. package/fs/bnf/{test.f.js → proof.f.js} +1 -1
  11. package/fs/cas/module.f.js +9 -23
  12. package/fs/cas/proof.f.d.ts +4 -0
  13. package/fs/cas/proof.f.js +37 -0
  14. package/fs/cbase32/{test.f.d.ts → proof.f.d.ts} +1 -2
  15. package/fs/cbase32/{test.f.js → proof.f.js} +1 -1
  16. package/fs/ci/bun/module.f.js +2 -7
  17. package/fs/ci/common/module.f.d.ts +2 -1
  18. package/fs/ci/common/module.f.js +7 -9
  19. package/fs/ci/config/module.f.d.ts +12 -3
  20. package/fs/ci/config/module.f.js +24 -4
  21. package/fs/ci/deno/module.f.js +2 -5
  22. package/fs/ci/node/module.f.js +14 -9
  23. package/fs/ci/playwright/module.f.js +5 -8
  24. package/fs/ci/{test.f.d.ts → proof.f.d.ts} +1 -2
  25. package/fs/ci/{test.f.js → proof.f.js} +2 -2
  26. package/fs/ci/rust/module.f.js +3 -9
  27. package/fs/crypto/hmac/{test.f.d.ts → proof.f.d.ts} +1 -2
  28. package/fs/crypto/hmac/{test.f.js → proof.f.js} +1 -1
  29. package/fs/crypto/secp/{test.f.d.ts → proof.f.d.ts} +1 -2
  30. package/fs/crypto/secp/{test.f.js → proof.f.js} +1 -1
  31. package/fs/crypto/sha2/{test.f.d.ts → proof.f.d.ts} +1 -2
  32. package/fs/crypto/sha2/{test.f.js → proof.f.js} +1 -1
  33. package/fs/crypto/sign/{test.f.d.ts → proof.f.d.ts} +1 -2
  34. package/fs/crypto/sign/{test.f.js → proof.f.js} +1 -1
  35. package/fs/dev/module.f.d.ts +28 -5
  36. package/fs/dev/module.f.js +38 -28
  37. package/fs/dev/{test.f.d.ts → proof.f.d.ts} +5 -2
  38. package/fs/dev/{test.f.js → proof.f.js} +26 -2
  39. package/fs/dev/version/proof.f.d.ts +3 -0
  40. package/fs/dev/version/{test.f.js → proof.f.js} +1 -1
  41. package/fs/djs/ast/{test.f.d.ts → proof.f.d.ts} +1 -2
  42. package/fs/djs/ast/{test.f.js → proof.f.js} +1 -1
  43. package/fs/djs/parser/{test.f.d.ts → proof.f.d.ts} +1 -2
  44. package/fs/djs/parser/{test.f.js → proof.f.js} +1 -1
  45. package/fs/djs/{test.f.d.ts → proof.f.d.ts} +1 -2
  46. package/fs/djs/{test.f.js → proof.f.js} +1 -1
  47. package/fs/djs/serializer/module.f.d.ts +2 -2
  48. package/fs/djs/serializer/module.f.js +47 -79
  49. package/fs/djs/serializer/{test.f.d.ts → proof.f.d.ts} +1 -2
  50. package/fs/djs/serializer/{test.f.js → proof.f.js} +8 -8
  51. package/fs/djs/tokenizer/{test.f.d.ts → proof.f.d.ts} +1 -2
  52. package/fs/djs/tokenizer/{test.f.js → proof.f.js} +1 -1
  53. package/fs/djs/tokenizer-new/module.f.js +1 -1
  54. package/fs/djs/tokenizer-new/{test.f.d.ts → proof.f.d.ts} +1 -2
  55. package/fs/djs/tokenizer-new/{test.f.js → proof.f.js} +1 -1
  56. package/fs/djs/transpiler/module.f.d.ts +15 -0
  57. package/fs/djs/transpiler/module.f.js +10 -2
  58. package/fs/djs/transpiler/{test.f.d.ts → proof.f.d.ts} +1 -2
  59. package/fs/djs/transpiler/{test.f.js → proof.f.js} +1 -1
  60. package/fs/{dev/tf → emergent-testing}/module.f.d.ts +66 -8
  61. package/fs/{dev/tf → emergent-testing}/module.f.js +101 -34
  62. package/fs/{dev/tf → emergent-testing}/module.js +2 -2
  63. package/fs/{dev/tf/test.f.d.ts → emergent-testing/proof.f.d.ts} +28 -0
  64. package/fs/{dev/tf/test.f.js → emergent-testing/proof.f.js} +119 -40
  65. package/fs/emergent-testing/scenarios/async-subtests.fail.d.ts +6 -0
  66. package/fs/emergent-testing/scenarios/async-subtests.fail.js +9 -0
  67. package/fs/emergent-testing/scenarios/async-subtests.pass.d.ts +6 -0
  68. package/fs/emergent-testing/scenarios/async-subtests.pass.js +9 -0
  69. package/fs/emergent-testing/scenarios/async.fail.d.ts +3 -0
  70. package/fs/emergent-testing/scenarios/async.fail.js +6 -0
  71. package/fs/emergent-testing/scenarios/async.pass.d.ts +3 -0
  72. package/fs/emergent-testing/scenarios/async.pass.js +5 -0
  73. package/fs/emergent-testing/scenarios/fail.fail.d.ts +3 -0
  74. package/fs/emergent-testing/scenarios/fail.fail.js +3 -0
  75. package/fs/emergent-testing/scenarios/return-value.pass.d.ts +3 -0
  76. package/fs/emergent-testing/scenarios/return-value.pass.js +4 -0
  77. package/fs/emergent-testing/scenarios/thenable.pass.d.ts +5 -0
  78. package/fs/emergent-testing/scenarios/thenable.pass.js +11 -0
  79. package/fs/emergent-testing/scenarios/thenable2.pass.d.ts +5 -0
  80. package/fs/emergent-testing/scenarios/thenable2.pass.js +3 -0
  81. package/fs/emergent-testing/scenarios/throw.pass.d.ts +5 -0
  82. package/fs/{dev/tf/scenarios/throw.pass.f.js → emergent-testing/scenarios/throw.pass.js} +1 -1
  83. package/fs/fjs/module.f.js +4 -5
  84. package/fs/fsc/{test.f.d.ts → proof.f.d.ts} +1 -2
  85. package/fs/fsc/{test.f.js → proof.f.js} +1 -1
  86. package/fs/fsm/proof.f.d.ts +4 -0
  87. package/fs/fsm/{test.f.js → proof.f.js} +1 -1
  88. package/fs/html/{test.f.d.ts → proof.f.d.ts} +1 -2
  89. package/fs/html/{test.f.js → proof.f.js} +1 -1
  90. package/fs/io/module.d.ts +1 -1
  91. package/fs/io/module.f.d.ts +3 -2
  92. package/fs/io/module.f.js +4 -3
  93. package/fs/io/module.js +19 -11
  94. package/fs/js/tokenizer/{test.f.d.ts → proof.f.d.ts} +1 -2
  95. package/fs/js/tokenizer/{test.f.js → proof.f.js} +1 -1
  96. package/fs/json/parser/{test.f.d.ts → proof.f.d.ts} +1 -2
  97. package/fs/json/parser/{test.f.js → proof.f.js} +1 -1
  98. package/fs/json/{test.f.d.ts → proof.f.d.ts} +1 -2
  99. package/fs/json/{test.f.js → proof.f.js} +1 -1
  100. package/fs/json/serializer/{test.f.d.ts → proof.f.d.ts} +1 -2
  101. package/fs/json/serializer/{test.f.js → proof.f.js} +1 -1
  102. package/fs/json/tokenizer/{test.f.d.ts → proof.f.d.ts} +1 -2
  103. package/fs/json/tokenizer/{test.f.js → proof.f.js} +1 -1
  104. package/fs/path/proof.f.d.ts +5 -0
  105. package/fs/path/{test.f.js → proof.f.js} +4 -3
  106. package/fs/sul/id/module.f.js +1 -1
  107. package/fs/sul/id/{test.f.d.ts → proof.f.d.ts} +1 -2
  108. package/fs/sul/id/{test.f.js → proof.f.js} +2 -2
  109. package/fs/sul/level/hash/{test.f.d.ts → proof.f.d.ts} +1 -2
  110. package/fs/sul/level/hash/{test.f.js → proof.f.js} +2 -2
  111. package/fs/sul/level/literal/{test.f.d.ts → proof.f.d.ts} +1 -2
  112. package/fs/sul/level/literal/{test.f.js → proof.f.js} +1 -1
  113. package/fs/sul/{test.f.d.ts → proof.f.d.ts} +1 -2
  114. package/fs/sul/{test.f.js → proof.f.js} +2 -2
  115. package/fs/text/ascii/proof.f.d.ts +3 -0
  116. package/fs/text/ascii/{test.f.js → proof.f.js} +1 -1
  117. package/fs/text/code_point/module.f.d.ts +28 -0
  118. package/fs/text/code_point/module.f.js +31 -0
  119. package/fs/text/{test.f.d.ts → proof.f.d.ts} +1 -2
  120. package/fs/text/{test.f.js → proof.f.js} +1 -1
  121. package/fs/text/sgr/proof.f.d.ts +1 -0
  122. package/fs/text/sgr/{test.f.js → proof.f.js} +1 -1
  123. package/fs/text/utf16/module.f.js +3 -53
  124. package/fs/text/utf16/{test.f.d.ts → proof.f.d.ts} +1 -2
  125. package/fs/text/utf16/{test.f.js → proof.f.js} +1 -1
  126. package/fs/text/utf8/module.f.js +3 -25
  127. package/fs/text/utf8/{test.f.d.ts → proof.f.d.ts} +1 -2
  128. package/fs/text/utf8/{test.f.js → proof.f.js} +1 -1
  129. package/fs/types/array/module.f.js +2 -5
  130. package/fs/types/array/{test.f.d.ts → proof.f.d.ts} +1 -2
  131. package/fs/types/array/{test.f.js → proof.f.js} +1 -1
  132. package/fs/types/bigfloat/{test.f.d.ts → proof.f.d.ts} +1 -2
  133. package/fs/types/bigfloat/{test.f.js → proof.f.js} +1 -1
  134. package/fs/types/bigint/{test.f.d.ts → proof.f.d.ts} +1 -2
  135. package/fs/types/bigint/{test.f.js → proof.f.js} +1 -1
  136. package/fs/types/bit_vec/{test.f.d.ts → proof.f.d.ts} +1 -2
  137. package/fs/types/bit_vec/{test.f.js → proof.f.js} +1 -1
  138. package/fs/types/btree/find/proof.f.d.ts +1 -0
  139. package/fs/types/btree/find/{test.f.js → proof.f.js} +1 -1
  140. package/fs/types/btree/{test.f.d.ts → proof.f.d.ts} +1 -2
  141. package/fs/types/btree/{test.f.js → proof.f.js} +1 -1
  142. package/fs/types/btree/remove/proof.f.d.ts +4 -0
  143. package/fs/types/btree/remove/{test.f.js → proof.f.js} +1 -1
  144. package/fs/types/btree/set/proof.f.d.ts +1 -0
  145. package/fs/types/btree/set/{test.f.js → proof.f.js} +1 -1
  146. package/fs/types/btree/types/module.f.d.ts +8 -0
  147. package/fs/types/btree/types/module.f.js +8 -0
  148. package/fs/types/byte_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  149. package/fs/types/byte_set/{test.f.js → proof.f.js} +1 -1
  150. package/fs/types/effects/module.f.d.ts +17 -0
  151. package/fs/types/effects/module.f.js +17 -0
  152. package/fs/types/effects/node/module.f.d.ts +60 -5
  153. package/fs/types/effects/node/module.f.js +12 -1
  154. package/fs/types/effects/node/{test.f.d.ts → proof.f.d.ts} +1 -2
  155. package/fs/types/effects/node/{test.f.js → proof.f.js} +1 -1
  156. package/fs/types/effects/node/virtual/module.f.js +2 -1
  157. package/fs/types/effects/proof.f.d.ts +11 -0
  158. package/fs/types/effects/proof.f.js +57 -0
  159. package/fs/types/function/compare/proof.f.d.ts +1 -0
  160. package/fs/types/function/compare/{test.f.js → proof.f.js} +1 -1
  161. package/fs/types/function/operator/proof.f.d.ts +12 -0
  162. package/fs/types/function/operator/{test.f.js → proof.f.js} +11 -10
  163. package/fs/types/function/proof.f.d.ts +1 -0
  164. package/fs/types/function/{test.f.js → proof.f.js} +1 -1
  165. package/fs/types/list/{test.f.d.ts → proof.f.d.ts} +2 -2
  166. package/fs/types/list/{test.f.js → proof.f.js} +15 -1
  167. package/fs/types/map/proof.f.d.ts +4 -0
  168. package/fs/types/map/{test.f.js → proof.f.js} +1 -1
  169. package/fs/types/monoid/{test.f.d.ts → proof.f.d.ts} +1 -2
  170. package/fs/types/monoid/{test.f.js → proof.f.js} +1 -1
  171. package/fs/types/nibble_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  172. package/fs/types/nibble_set/{test.f.js → proof.f.js} +1 -1
  173. package/fs/types/nominal/proof.f.d.ts +4 -0
  174. package/fs/types/nominal/{test.f.js → proof.f.js} +1 -1
  175. package/fs/types/nullable/module.f.d.ts +7 -0
  176. package/fs/types/nullable/module.f.js +7 -0
  177. package/fs/types/nullable/proof.f.d.ts +1 -0
  178. package/fs/types/nullable/{test.f.js → proof.f.js} +20 -3
  179. package/fs/types/number/{test.f.d.ts → proof.f.d.ts} +1 -2
  180. package/fs/types/number/{test.f.js → proof.f.js} +1 -1
  181. package/fs/types/object/module.f.js +2 -4
  182. package/fs/types/object/{test.f.d.ts → proof.f.d.ts} +1 -2
  183. package/fs/types/object/{test.f.js → proof.f.js} +1 -1
  184. package/fs/types/ordered_map/{test.f.d.ts → proof.f.d.ts} +1 -2
  185. package/fs/types/ordered_map/{test.f.js → proof.f.js} +1 -1
  186. package/fs/types/patricia_trie/{test.f.d.ts → proof.f.d.ts} +1 -2
  187. package/fs/types/patricia_trie/{test.f.js → proof.f.js} +2 -2
  188. package/fs/types/prime_field/{test.f.d.ts → proof.f.d.ts} +1 -2
  189. package/fs/types/prime_field/{test.f.js → proof.f.js} +1 -1
  190. package/fs/types/range/proof.f.d.ts +1 -0
  191. package/fs/types/range/{test.f.js → proof.f.js} +1 -1
  192. package/fs/types/range_map/{test.f.d.ts → proof.f.d.ts} +1 -2
  193. package/fs/types/range_map/{test.f.js → proof.f.js} +1 -1
  194. package/fs/types/result/proof.f.d.ts +5 -0
  195. package/fs/types/result/{test.f.js → proof.f.js} +18 -2
  196. package/fs/types/rtti/parse/{test.f.d.ts → proof.f.d.ts} +1 -2
  197. package/fs/types/rtti/parse/{test.f.js → proof.f.js} +1 -1
  198. package/fs/types/rtti/{test.f.d.ts → proof.f.d.ts} +1 -2
  199. package/fs/types/rtti/{test.f.js → proof.f.js} +1 -1
  200. package/fs/types/rtti/ts/{test.f.d.ts → proof.f.d.ts} +1 -2
  201. package/fs/types/rtti/ts/{test.f.js → proof.f.js} +1 -1
  202. package/fs/types/rtti/validate/{test.f.d.ts → proof.f.d.ts} +1 -2
  203. package/fs/types/rtti/validate/{test.f.js → proof.f.js} +1 -1
  204. package/fs/types/sorted_list/{test.f.d.ts → proof.f.d.ts} +1 -2
  205. package/fs/types/sorted_list/{test.f.js → proof.f.js} +1 -1
  206. package/fs/types/sorted_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  207. package/fs/types/sorted_set/{test.f.js → proof.f.js} +1 -1
  208. package/fs/types/string/{test.f.d.ts → proof.f.d.ts} +1 -2
  209. package/fs/types/string/{test.f.js → proof.f.js} +1 -1
  210. package/fs/types/string_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  211. package/fs/types/string_set/{test.f.js → proof.f.js} +1 -1
  212. package/fs/types/ts/module.f.d.ts +0 -1
  213. package/fs/types/ts/{test.f.d.ts → proof.f.d.ts} +20 -0
  214. package/fs/types/ts/{test.f.js → proof.f.js} +1 -0
  215. package/fs/types/uint8array/{test.f.d.ts → proof.f.d.ts} +1 -2
  216. package/fs/types/uint8array/{test.f.js → proof.f.js} +1 -1
  217. package/fs/website/proof.f.d.ts +3 -0
  218. package/fs/website/proof.f.js +9 -0
  219. package/issues/demo/sample/{test.f.js → proof.f.js} +1 -1
  220. package/issues/{test.f.d.ts → proof.f.d.ts} +1 -2
  221. package/issues/{test.f.js → proof.f.js} +1 -1
  222. package/nanvm-lib/tests/{test.f.d.ts → proof.f.d.ts} +1 -2
  223. package/nanvm-lib/tests/{test.f.js → proof.f.js} +1 -1
  224. package/nanvm-lib/tests/vm/{test.f.d.ts → proof.f.d.ts} +1 -2
  225. package/nanvm-lib/tests/vm/{test.f.js → proof.f.js} +1 -1
  226. package/package.json +2 -2
  227. package/fs/base128/test.f.d.ts +0 -2
  228. package/fs/bnf/test.f.d.ts +0 -4
  229. package/fs/cas/test.f.d.ts +0 -2
  230. package/fs/cas/test.f.js +0 -1
  231. package/fs/dev/tf/scenarios/fail.fail.f.d.ts +0 -1
  232. package/fs/dev/tf/scenarios/fail.fail.f.js +0 -1
  233. package/fs/dev/tf/scenarios/return-value.pass.f.d.ts +0 -1
  234. package/fs/dev/tf/scenarios/return-value.pass.f.js +0 -2
  235. package/fs/dev/tf/scenarios/throw.pass.f.d.ts +0 -6
  236. package/fs/dev/version/test.f.d.ts +0 -4
  237. package/fs/fsm/test.f.d.ts +0 -5
  238. package/fs/path/test.f.d.ts +0 -3
  239. package/fs/text/ascii/test.f.d.ts +0 -4
  240. package/fs/text/sgr/test.f.d.ts +0 -2
  241. package/fs/types/btree/find/test.f.d.ts +0 -2
  242. package/fs/types/btree/remove/test.f.d.ts +0 -5
  243. package/fs/types/btree/set/test.f.d.ts +0 -2
  244. package/fs/types/function/compare/test.f.d.ts +0 -2
  245. package/fs/types/function/operator/test.f.d.ts +0 -10
  246. package/fs/types/function/test.f.d.ts +0 -2
  247. package/fs/types/map/test.f.d.ts +0 -5
  248. package/fs/types/nominal/test.f.d.ts +0 -5
  249. package/fs/types/nullable/test.f.d.ts +0 -2
  250. package/fs/types/range/test.f.d.ts +0 -2
  251. package/fs/types/result/test.f.d.ts +0 -2
  252. /package/fs/{dev/tf → emergent-testing}/all.test.d.ts +0 -0
  253. /package/fs/{dev/tf → emergent-testing}/all.test.js +0 -0
  254. /package/fs/{dev/tf → emergent-testing}/module.d.ts +0 -0
  255. /package/fs/{dev/tf → emergent-testing}/scenarios/all.d.ts +0 -0
  256. /package/fs/{dev/tf → emergent-testing}/scenarios/all.js +0 -0
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  encodeSmall: () => void;
3
3
  encode7F: () => void;
4
4
  encode80: () => void;
@@ -41,4 +41,3 @@ declare const _default: {
41
41
  };
42
42
  raw: (() => void)[];
43
43
  };
44
- export default _default;
@@ -45,7 +45,7 @@ const ch = (r, v) => {
45
45
  ch0(r, v, vec8(0x23n));
46
46
  ch0(r, v, vec(16n)(0x2345n));
47
47
  };
48
- export default {
48
+ export const proof = {
49
49
  encodeSmall: () => {
50
50
  const v = vec8(0x13n);
51
51
  const x = encodeRaw([integer, v]);
@@ -0,0 +1,4 @@
1
+ export declare const todo: () => never;
2
+ export declare const assert: (v: boolean, msg?: unknown) => asserts v;
3
+ export declare const assertEq: <T>(a: T, b: T) => void;
4
+ export type Assert<T extends true> = T;
@@ -0,0 +1,6 @@
1
+ export const todo = () => { throw 'not implemented'; };
2
+ export const assert = (v, msg = 'assertion failed') => {
3
+ if (!v)
4
+ throw msg;
5
+ };
6
+ export const assertEq = (a, b) => assert(a === b, [a, b]);
@@ -0,0 +1 @@
1
+ export declare const proof: () => void;
@@ -14,7 +14,7 @@ const test = (a, b) => {
14
14
  throw `rest: ${asBase(rest).toString(16)}, expected: ${asBase(empty).toString(16)}`;
15
15
  }
16
16
  };
17
- export default () => {
17
+ export const proof = () => {
18
18
  test(0n, vec8(0n));
19
19
  test(1n, vec8(1n));
20
20
  test(0x7fn, vec8(0x7fn));
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  rangeDecode: () => void;
3
3
  rangeEncode: () => void;
4
4
  toData: (() => void)[];
@@ -12,4 +12,3 @@ declare const _default: {
12
12
  repeatParser: (() => void)[];
13
13
  example: () => void;
14
14
  };
15
- export default _default;
@@ -11,7 +11,7 @@ const descentParserCpOnly = (m, name, cp) => {
11
11
  const cpm = toArray(map(mapCodePoint)(cp));
12
12
  return m(name, cpm);
13
13
  };
14
- export default {
14
+ export const proof = {
15
15
  rangeDecode: () => {
16
16
  const decoded1 = stringify(sort)(rangeDecode(0x000079_000087));
17
17
  if (decoded1 !== '[121,135]') {
@@ -0,0 +1,3 @@
1
+ export declare const proof: {
2
+ test: () => void;
3
+ };
@@ -1,5 +1,5 @@
1
1
  import { classic, deterministic } from "./testlib.f.js";
2
- export default {
2
+ export const proof = {
3
3
  test: () => {
4
4
  classic();
5
5
  deterministic();
@@ -6,8 +6,8 @@
6
6
  import { computeSync, sha256 } from "../crypto/sha2/module.f.js";
7
7
  import { parse } from "../path/module.f.js";
8
8
  import { cBase32ToVec, vecToCBase32 } from "../cbase32/module.f.js";
9
- import { begin, pure } from "../types/effects/module.f.js";
10
- import { error, log, mkdir, readdir, readFile, writeFile } from "../types/effects/node/module.f.js";
9
+ import { begin, forEachStep, pure } from "../types/effects/module.f.js";
10
+ import { errorExit, log, mkdir, readdir, readFile, writeFile } from "../types/effects/node/module.f.js";
11
11
  import { toOption } from "../types/nullable/module.f.js";
12
12
  import { unwrap } from "../types/result/module.f.js";
13
13
  const o = { withFileTypes: true };
@@ -61,10 +61,6 @@ export const cas = (sha2) => {
61
61
  list,
62
62
  });
63
63
  };
64
- /** Prints an error message and returns exit code `1`. */
65
- const e = (s) => begin
66
- .step(() => error(s))
67
- .step(() => pure(1));
68
64
  /**
69
65
  * Runs the CAS CLI.
70
66
  *
@@ -79,7 +75,7 @@ export const main = (args) => {
79
75
  switch (cmd) {
80
76
  case 'add': {
81
77
  if (options.length !== 1) {
82
- return e("'cas add' expects one parameter");
78
+ return errorExit("'cas add' expects one parameter");
83
79
  }
84
80
  const [path] = options;
85
81
  return begin
@@ -90,18 +86,18 @@ export const main = (args) => {
90
86
  }
91
87
  case 'get': {
92
88
  if (options.length !== 2) {
93
- return e("'cas get' expects two parameters");
89
+ return errorExit("'cas get' expects two parameters");
94
90
  }
95
91
  const [hashCBase32, path] = options;
96
92
  const hash = cBase32ToVec(hashCBase32);
97
93
  if (hash === null) {
98
- return e(`invalid hash format: ${hashCBase32}`);
94
+ return errorExit(`invalid hash format: ${hashCBase32}`);
99
95
  }
100
96
  return begin
101
97
  .step(() => c.read(hash))
102
98
  .step(v => {
103
99
  const result = v === undefined
104
- ? e(`no such hash: ${hashCBase32}`)
100
+ ? errorExit(`no such hash: ${hashCBase32}`)
105
101
  : begin
106
102
  .step(() => writeFile(path, v))
107
103
  .step(() => pure(0));
@@ -111,23 +107,13 @@ export const main = (args) => {
111
107
  case 'list': {
112
108
  return begin
113
109
  .step(() => c.list())
114
- .step(v => {
115
- // TODO: make it lazy.
116
- let i = begin;
117
- for (const j of v) {
118
- const prev = i;
119
- i = begin
120
- .step(() => prev)
121
- .step(() => log(vecToCBase32(j)));
122
- }
123
- return i;
124
- })
110
+ .step(forEachStep(j => log(vecToCBase32(j))))
125
111
  .step(() => pure(0));
126
112
  }
127
113
  case undefined: {
128
- return e('Error: CAS command requires subcommand');
114
+ return errorExit('Error: CAS command requires subcommand');
129
115
  }
130
116
  default:
131
- return e(`Error: Unknown CAS subcommand "${args[0]}"`);
117
+ return errorExit(`Error: Unknown CAS subcommand "${args[0]}"`);
132
118
  }
133
119
  };
@@ -0,0 +1,4 @@
1
+ export declare const proof: {
2
+ casWrite: () => void;
3
+ casReadPassthrough: () => void;
4
+ };
@@ -0,0 +1,37 @@
1
+ import { cas } from "./module.f.js";
2
+ import { sha256 } from "../crypto/sha2/module.f.js";
3
+ import { empty, length } from "../types/bit_vec/module.f.js";
4
+ import { pure } from "../types/effects/module.f.js";
5
+ import { run } from "../types/effects/mock/module.f.js";
6
+ export const proof = {
7
+ casWrite: () => {
8
+ const store = {
9
+ read: (_key) => pure(undefined),
10
+ write: (_key, _value) => pure(undefined),
11
+ list: () => pure([]),
12
+ };
13
+ const c = cas(sha256)(store);
14
+ const [, hash] = run({})(undefined)(c.write(empty));
15
+ // sha256 of empty input produces a 256-bit hash
16
+ if (length(hash) !== 256n) {
17
+ throw ['expected 256-bit hash', length(hash)];
18
+ }
19
+ },
20
+ casReadPassthrough: () => {
21
+ const stored = empty;
22
+ const store = {
23
+ read: (_key) => pure(stored),
24
+ write: (_key, _value) => pure(undefined),
25
+ list: () => pure([stored]),
26
+ };
27
+ const c = cas(sha256)(store);
28
+ const [, readResult] = run({})(undefined)(c.read(empty));
29
+ if (readResult !== stored) {
30
+ throw ['read should pass through', readResult];
31
+ }
32
+ const [, listResult] = run({})(undefined)(c.list());
33
+ if (listResult.length !== 1) {
34
+ throw ['list should pass through', listResult];
35
+ }
36
+ },
37
+ };
@@ -1,7 +1,6 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  roundtrip5x: () => void;
3
3
  roundtrip: () => void;
4
4
  unalignedBits: () => void;
5
5
  caseInsensitive: () => void;
6
6
  };
7
- export default _default;
@@ -22,7 +22,7 @@ const check = (s, v) => {
22
22
  throw [vr, v];
23
23
  }
24
24
  };
25
- export default {
25
+ export const proof = {
26
26
  roundtrip5x: () => {
27
27
  check5x("", empty);
28
28
  check5x("0", vec(5n)(0n));
@@ -5,17 +5,12 @@
5
5
  * @module
6
6
  */
7
7
  import { bun } from "../config/module.f.js";
8
- import { clean, install, test } from "../common/module.f.js";
8
+ import { clean, install, test, uses } from "../common/module.f.js";
9
9
  const installOnWindowsArm = ({ def, name, path }) => (v) => (a) => install(v === 'windows' && a === 'arm'
10
10
  ? { run: `irm ${path}/install.ps1 | iex; "$env:USERPROFILE\\.${name}\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append` }
11
11
  : def);
12
12
  const installBun = installOnWindowsArm({
13
- def: {
14
- uses: 'oven-sh/setup-bun@v2',
15
- with: {
16
- 'bun-version': bun
17
- },
18
- },
13
+ def: uses('oven-sh/setup-bun', { 'bun-version': bun }),
19
14
  name: 'bun',
20
15
  path: 'bun.sh',
21
16
  });
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import { images } from '../config/module.f.ts';
8
+ import { actions, images } from '../config/module.f.ts';
9
9
  import { type Ts } from '../../types/rtti/ts/module.f.ts';
10
10
  export declare const os: readonly ["ubuntu", "macos", "windows"];
11
11
  export type Os = typeof os[number];
@@ -76,6 +76,7 @@ export type MetaStep = {
76
76
  readonly type: 'apt-get';
77
77
  readonly package: string;
78
78
  };
79
+ export declare const uses: (name: keyof typeof actions, w?: Record<string, string>) => Step;
79
80
  export declare const install: (step: Step) => MetaStep;
80
81
  export declare const test: (step: Step) => MetaStep;
81
82
  export declare const clean: (steps: readonly MetaStep[]) => readonly MetaStep[];
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import { images, rust } from "../config/module.f.js";
8
+ import { actions, images } from "../config/module.f.js";
9
9
  import { option, array, record, string } from "../../types/rtti/module.f.js";
10
10
  import {} from "../../types/rtti/ts/module.f.js";
11
11
  import { parse as rttiParse } from "../../types/rtti/parse/module.f.js";
@@ -27,6 +27,10 @@ export const gitHubActionSchema = {
27
27
  jobs: jobsSchema
28
28
  };
29
29
  export const parseGitHubAction = rttiParse(gitHubActionSchema);
30
+ export const uses = (name, w) => ({
31
+ uses: `${name}@${actions[name]}`,
32
+ ...(w === undefined ? {} : { with: w })
33
+ });
30
34
  export const install = (step) => ({ type: 'install', step });
31
35
  export const test = (step) => ({ type: 'test', step });
32
36
  export const clean = (steps) => [
@@ -40,15 +44,9 @@ export const toSteps = (m) => {
40
44
  const targets = m.flatMap(v => v.type === 'rust' && v.target !== undefined ? [v.target] : []).join(',');
41
45
  return [
42
46
  ...(aptGet !== '' ? [{ run: `sudo apt-get update && sudo apt-get install -y ${aptGet}` }] : []),
43
- ...(needRust ? [{
44
- uses: `dtolnay/rust-toolchain@${rust}`,
45
- with: {
46
- components: 'rustfmt,clippy',
47
- targets
48
- }
49
- }] : []),
47
+ ...(needRust ? [uses('dtolnay/rust-toolchain', { components: 'rustfmt,clippy', targets })] : []),
50
48
  ...filter('install'),
51
- { uses: 'actions/checkout@v5' },
49
+ uses('actions/checkout'),
52
50
  ...filter('test'),
53
51
  ];
54
52
  };
@@ -22,11 +22,20 @@ export declare const images: {
22
22
  export declare const bun = "1.3.14";
23
23
  export declare const deno = "2.8.1";
24
24
  export declare const playwright = "1.60.0";
25
- export declare const rust = "1.95.0";
26
25
  export declare const node: {
27
- readonly default: "26.2.0";
26
+ readonly default: "26.3.0";
28
27
  readonly others: readonly ["24.16.0"];
29
28
  };
30
29
  export declare const wasmtime = "45.0.0";
31
30
  export declare const wasmer = "7.1.0";
32
- export declare const tsgo = "7.0.0-dev.20260527.1";
31
+ export declare const tsgo = "7.0.0-dev.20260601.1";
32
+ export declare const actions: {
33
+ readonly 'actions/checkout': "v6";
34
+ readonly 'actions/setup-node': "v6";
35
+ readonly 'actions/cache': "v5";
36
+ readonly 'denoland/setup-deno': "v2";
37
+ readonly 'oven-sh/setup-bun': "v2";
38
+ readonly 'bytecodealliance/actions/wasmtime/setup': "v1";
39
+ readonly 'wasmerio/setup-wasmer': "v3.1";
40
+ readonly 'dtolnay/rust-toolchain': "1.95.0";
41
+ };
@@ -26,11 +26,9 @@ export const bun = '1.3.14';
26
26
  export const deno = '2.8.1';
27
27
  // https://www.npmjs.com/package/playwright
28
28
  export const playwright = '1.60.0';
29
- // https://rust-lang.org/
30
- export const rust = '1.95.0';
31
29
  // https://nodejs.org/en/download
32
30
  export const node = {
33
- default: '26.2.0',
31
+ default: '26.3.0',
34
32
  others: ['24.16.0'],
35
33
  };
36
34
  // https://github.com/bytecodealliance/wasmtime/releases
@@ -38,4 +36,26 @@ export const wasmtime = '45.0.0';
38
36
  // https://github.com/wasmerio/wasmer/releases
39
37
  export const wasmer = '7.1.0';
40
38
  // https://www.npmjs.com/package/@typescript/native-preview?activeTab=versions
41
- export const tsgo = '7.0.0-dev.20260527.1';
39
+ export const tsgo = '7.0.0-dev.20260601.1';
40
+ // GitHub Action versions used by CI step builders. The key is the action
41
+ // `owner/name`; call sites compose the full ref as
42
+ // `` `${name}@${actions[name]}` ``.
43
+ // Note: dtolnay/rust-toolchain value is a Rust version, not an action version.
44
+ export const actions = {
45
+ // https://github.com/marketplace/actions/checkout
46
+ 'actions/checkout': 'v6',
47
+ // https://github.com/marketplace/actions/setup-node-js-environment
48
+ 'actions/setup-node': 'v6',
49
+ // https://github.com/marketplace/actions/cache
50
+ 'actions/cache': 'v5',
51
+ // https://github.com/marketplace/actions/setup-deno
52
+ 'denoland/setup-deno': 'v2',
53
+ // https://github.com/marketplace/actions/setup-bun
54
+ 'oven-sh/setup-bun': 'v2',
55
+ // https://github.com/bytecodealliance/actions
56
+ 'bytecodealliance/actions/wasmtime/setup': 'v1',
57
+ // https://github.com/wasmerio/setup-wasmer
58
+ 'wasmerio/setup-wasmer': 'v3.1',
59
+ // https://rust-lang.org/ - value is Rust version, not action version
60
+ 'dtolnay/rust-toolchain': '1.95.0',
61
+ };
@@ -5,12 +5,9 @@
5
5
  * @module
6
6
  */
7
7
  import { deno } from "../config/module.f.js";
8
- import { clean, install, test } from "../common/module.f.js";
8
+ import { clean, install, test, uses } from "../common/module.f.js";
9
9
  export const denoSteps = (extra) => clean([
10
- install({
11
- uses: 'denoland/setup-deno@v2',
12
- with: { 'deno-version': deno },
13
- }),
10
+ install(uses('denoland/setup-deno', { 'deno-version': deno })),
14
11
  test({ run: 'deno install' }),
15
12
  test({ run: 'deno task test' }),
16
13
  ...extra,
@@ -5,23 +5,28 @@
5
5
  * @module
6
6
  */
7
7
  import { node, tsgo } from "../config/module.f.js";
8
- import { clean, findTgz, install, test, ubuntu } from "../common/module.f.js";
8
+ import { clean, findTgz, install, test, ubuntu, uses } from "../common/module.f.js";
9
9
  export const major = (v) => v.split('.')[0];
10
- const installNode = (version) => ({ uses: 'actions/setup-node@v6', with: { 'node-version': version } });
11
- export const basicNode = (version) => (extra) => clean([
12
- install(installNode(version)),
10
+ const installNode = (version) => uses('actions/setup-node', { 'node-version': version });
11
+ const nodeInstall = (v) => [
12
+ install(installNode(v)),
13
13
  test({ run: 'npm ci' }),
14
+ ];
15
+ export const basicNode = (version) => (extra) => clean([
16
+ ...nodeInstall(version),
14
17
  ...extra,
15
18
  ]);
16
- export const nodeTests = (version) => (extra) => basicNode(version)([
17
- test({ run: 'npm test' }),
19
+ const basicTests = [
20
+ test({ run: 'npm t' }),
18
21
  test({ run: 'npm run fst' }),
22
+ ];
23
+ export const nodeTests = (version) => (extra) => basicNode(version)([
24
+ ...basicTests,
19
25
  ...extra,
20
26
  ]);
21
27
  const nodeSteps = (v) => [
22
- install(installNode(v)),
23
- test({ run: 'npm ci' }),
24
- test({ run: 'npm t' }),
28
+ ...nodeInstall(v),
29
+ ...basicTests,
25
30
  ];
26
31
  export const nodeVersions = Object.fromEntries(node.others.map(v => [
27
32
  `node${major(v)}`,
@@ -5,19 +5,16 @@
5
5
  * @module
6
6
  */
7
7
  import { images, node, playwright } from "../config/module.f.js";
8
- import { install, test, toSteps } from "../common/module.f.js";
8
+ import { install, test, toSteps, uses } from "../common/module.f.js";
9
9
  import { basicNode } from "../node/module.f.js";
10
10
  const playwrightImage = images.ubuntu.intel;
11
11
  export const playwrightJob = {
12
12
  'runs-on': playwrightImage,
13
13
  steps: toSteps(basicNode(node.default)([
14
- install({
15
- uses: 'actions/cache@v4',
16
- with: {
17
- path: '~/.cache/ms-playwright',
18
- key: `${playwrightImage}-playwright-${playwright}`,
19
- },
20
- }),
14
+ install(uses('actions/cache', {
15
+ path: '~/.cache/ms-playwright',
16
+ key: `${playwrightImage}-playwright-${playwright}`,
17
+ })),
21
18
  install({ run: `npm install -g playwright@${playwright}` }),
22
19
  install({ run: 'playwright install-deps' }),
23
20
  install({ run: 'playwright install' }),
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  rust: () => void;
3
3
  noRust: () => void;
4
4
  extra: {
@@ -6,4 +6,3 @@ declare const _default: {
6
6
  osSpecific: () => void;
7
7
  };
8
8
  };
9
- export default _default;
@@ -2,7 +2,7 @@ import { ci } from "./module.f.js";
2
2
  import { utf8ToString } from "../text/module.f.js";
3
3
  import { isVec } from "../types/bit_vec/module.f.js";
4
4
  import { test, parseGitHubAction } from "./common/module.f.js";
5
- import { assert } from "../dev/module.f.js";
5
+ import { assert } from "../asserts/module.f.js";
6
6
  import { emptyState, virtual } from "../types/effects/node/virtual/module.f.js";
7
7
  import { parse as jsonParse } from "../json/module.f.js";
8
8
  import { unwrap } from "../types/result/module.f.js";
@@ -23,7 +23,7 @@ const run = (rust, nodeExtra = () => []) => {
23
23
  assert(isVec(file), file);
24
24
  return unwrap(parseGitHubAction(jsonParse(utf8ToString(file))));
25
25
  };
26
- export default {
26
+ export const proof = {
27
27
  rust: () => {
28
28
  assert(hasRun('cargo')(run(true)), 'expected Rust steps');
29
29
  },
@@ -6,7 +6,7 @@
6
6
  * @module
7
7
  */
8
8
  import { wasmer, wasmtime } from "../config/module.f.js";
9
- import { install, test } from "../common/module.f.js";
9
+ import { install, test, uses } from "../common/module.f.js";
10
10
  const cargoTest = (target, config) => {
11
11
  const to = target ? ` --target ${target}` : '';
12
12
  const co = config ? ` --config ${config}` : '';
@@ -40,14 +40,8 @@ export const rustSteps = (v, a) => [
40
40
  test({ run: 'cargo fmt -- --check' }),
41
41
  test({ run: 'cargo clippy -- -D warnings' }),
42
42
  ...cargoTest(),
43
- install({
44
- uses: 'bytecodealliance/actions/wasmtime/setup@v1',
45
- with: { version: wasmtime }
46
- }),
47
- install({
48
- uses: 'wasmerio/setup-wasmer@v3.1',
49
- with: { version: `v${wasmer}` },
50
- }),
43
+ install(uses('bytecodealliance/actions/wasmtime/setup', { version: wasmtime })),
44
+ install(uses('wasmerio/setup-wasmer', { version: `v${wasmer}` })),
51
45
  ...wasmTarget('wasm32-wasip1'),
52
46
  ...wasmTarget('wasm32-wasip2'),
53
47
  ...wasmTarget('wasm32-unknown-unknown'),
@@ -1,7 +1,6 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  example: () => void;
3
3
  sha256: () => void;
4
4
  sha384: () => void;
5
5
  sha512: () => void;
6
6
  };
7
- export default _default;
@@ -2,7 +2,7 @@ import { utf8 } from "../../text/module.f.js";
2
2
  import { uint, vec } from "../../types/bit_vec/module.f.js";
3
3
  import { sha256, sha384, sha512 } from "../sha2/module.f.js";
4
4
  import { hmac } from "./module.f.js";
5
- export default {
5
+ export const proof = {
6
6
  example: () => {
7
7
  const r = hmac(sha256)(utf8('key'))(utf8('The quick brown fox jumps over the lazy dog'));
8
8
  if (r !== vec(256n)(0xf7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8n)) {
@@ -1,8 +1,7 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  example: () => void;
3
3
  test: () => void;
4
4
  poker: () => {
5
5
  [k: string]: () => void;
6
6
  };
7
7
  };
8
- export default _default;
@@ -53,7 +53,7 @@ const poker = (param) => () => {
53
53
  ++m;
54
54
  }
55
55
  };
56
- export default {
56
+ export const proof = {
57
57
  example: () => {
58
58
  const curveParams = {
59
59
  p: 23n,
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  base: {
3
3
  b32: () => {
4
4
  s256: () => void;
@@ -28,4 +28,3 @@ declare const _default: {
28
28
  overflow: () => void;
29
29
  };
30
30
  };
31
- export default _default;
@@ -12,7 +12,7 @@ const checkEmpty = ({ init, end, hashLength }) => (x) => {
12
12
  // https://en.wikipedia.org/wiki/SHA-2#Test_vectors
13
13
  //
14
14
  // https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/Secure-Hashing
15
- export default {
15
+ export const proof = {
16
16
  base: {
17
17
  b32: () => {
18
18
  const { fromV8, compress, chunkLength } = base32;
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
2
  bits2int: () => void;
3
3
  int2octets: () => void;
4
4
  bit2octets: () => void;
@@ -9,4 +9,3 @@ declare const _default: {
9
9
  a2: () => void;
10
10
  a2s: () => void;
11
11
  };
12
- export default _default;
@@ -13,7 +13,7 @@ const v256 = vec(256n);
13
13
  const v600 = vec(600n);
14
14
  const r32 = repeat(32n);
15
15
  const hmac256 = hmac(sha256);
16
- export default {
16
+ export const proof = {
17
17
  bits2int: () => {
18
18
  if (all(7n).bits2int(vec(5n)(20n)) !== 5n) {
19
19
  throw new Error("fail");
@@ -6,18 +6,41 @@
6
6
  import type { Io } from '../io/module.f.ts';
7
7
  import { type Access, type All, type Env, type Import, type NodeProgram, type Readdir } from '../types/effects/node/module.f.ts';
8
8
  import { type Effect } from '../types/effects/module.f.ts';
9
- export declare const todo: () => never;
10
- export declare const assert: (v: boolean, msg?: unknown) => asserts v;
11
- export declare const assertEq: <T>(a: T, b: T) => void;
12
9
  export type Module = {
13
- readonly default?: unknown;
10
+ readonly proof?: unknown;
14
11
  readonly [k: string]: unknown;
15
12
  };
16
13
  export type ModuleMap = {
17
14
  readonly [k in string]: Module;
18
15
  };
19
16
  export declare const env: (io: Io) => (v: string) => string | undefined;
20
- export declare const allFiles: (s: string) => Effect<Readdir | All, readonly string[]>;
17
+ /**
18
+ * Returns `true` if the file should be loaded for proof discovery.
19
+ *
20
+ * All FunctionalScript modules (`.f.ts` / `.f.js`) are safe to bulk-load by
21
+ * construction — they have no import side effects. For vanilla TS/JS the
22
+ * load gate stays opt-in by filename: any file ending in `proof.ts`,
23
+ * `proof.js`, `proof.mts`, or `proof.mjs` is included.
24
+ *
25
+ * Whether a loaded module actually _contains_ a proof is determined at
26
+ * runtime by checking for an exported `proof` property.
27
+ */
28
+ export declare const shouldLoad: (s: string) => boolean;
29
+ /** The effect operations required to discover and load a module map. */
21
30
  export type LoadModuleOperations = Access | Import | All | Readdir;
31
+ /**
32
+ * Discovers all source files under `INIT_CWD` (or `.` if unset) that match
33
+ * `predicate`, imports them, and returns a map from relative path to module
34
+ * exports.
35
+ *
36
+ * The `predicate` is propagated into `allFiles` so that non-matching files
37
+ * are excluded before any `import()` is attempted — no wasted I/O.
38
+ * The default matches all JS/TS source files (`.js`, `.ts`, `.mts`, `.mjs`).
39
+ * `loadFile`'s own guards (`.f.js`, `.f.ts`, `shouldLoad`) still apply on
40
+ * top; the predicate only controls which files are discovered.
41
+ *
42
+ * The result is sorted by path key using `string.cmp` so the order is
43
+ * deterministic regardless of filesystem traversal order.
44
+ */
22
45
  export declare const loadModuleMap: (env: Env) => Effect<LoadModuleOperations, ModuleMap>;
23
46
  export declare const index4: NodeProgram;