functionalscript 0.18.0 → 0.20.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 (242) hide show
  1. package/fs/asn.1/module.f.js +7 -8
  2. package/fs/asn.1/{test.f.d.ts → proof.f.d.ts} +1 -2
  3. package/fs/asn.1/{test.f.js → proof.f.js} +12 -13
  4. package/fs/base128/proof.f.d.ts +1 -0
  5. package/fs/base128/{test.f.js → proof.f.js} +1 -1
  6. package/fs/bnf/data/{test.f.d.ts → proof.f.d.ts} +1 -2
  7. package/fs/bnf/data/{test.f.js → proof.f.js} +1 -1
  8. package/fs/bnf/proof.f.d.ts +3 -0
  9. package/fs/bnf/{test.f.js → proof.f.js} +1 -1
  10. package/fs/cas/module.f.js +2 -12
  11. package/fs/cas/proof.f.d.ts +1 -0
  12. package/fs/cas/proof.f.js +1 -0
  13. package/fs/cbase32/{test.f.d.ts → proof.f.d.ts} +1 -2
  14. package/fs/cbase32/{test.f.js → proof.f.js} +1 -1
  15. package/fs/ci/config/module.f.d.ts +4 -4
  16. package/fs/ci/config/module.f.js +4 -4
  17. package/fs/ci/node/module.f.js +12 -7
  18. package/fs/ci/{test.f.d.ts → proof.f.d.ts} +1 -2
  19. package/fs/ci/{test.f.js → proof.f.js} +1 -1
  20. package/fs/crypto/hmac/{test.f.d.ts → proof.f.d.ts} +1 -2
  21. package/fs/crypto/hmac/{test.f.js → proof.f.js} +1 -1
  22. package/fs/crypto/secp/{test.f.d.ts → proof.f.d.ts} +1 -2
  23. package/fs/crypto/secp/{test.f.js → proof.f.js} +1 -1
  24. package/fs/crypto/sha2/{test.f.d.ts → proof.f.d.ts} +1 -2
  25. package/fs/crypto/sha2/{test.f.js → proof.f.js} +1 -1
  26. package/fs/crypto/sign/module.f.js +3 -3
  27. package/fs/crypto/sign/{test.f.d.ts → proof.f.d.ts} +1 -2
  28. package/fs/crypto/sign/{test.f.js → proof.f.js} +1 -1
  29. package/fs/dev/module.f.d.ts +28 -2
  30. package/fs/dev/module.f.js +38 -22
  31. package/fs/dev/{test.f.d.ts → proof.f.d.ts} +5 -2
  32. package/fs/dev/{test.f.js → proof.f.js} +25 -2
  33. package/fs/dev/tf/module.d.ts +1 -2
  34. package/fs/dev/tf/module.f.d.ts +70 -7
  35. package/fs/dev/tf/module.f.js +115 -27
  36. package/fs/dev/tf/module.js +4 -103
  37. package/fs/dev/tf/{test.f.d.ts → proof.f.d.ts} +26 -0
  38. package/fs/dev/tf/{test.f.js → proof.f.js} +85 -38
  39. package/fs/dev/tf/scenarios/all.d.ts +1 -0
  40. package/fs/dev/tf/scenarios/all.js +3 -0
  41. package/fs/dev/tf/scenarios/async-subtests.fail.d.ts +4 -0
  42. package/fs/dev/tf/scenarios/async-subtests.fail.js +7 -0
  43. package/fs/dev/tf/scenarios/async-subtests.pass.d.ts +4 -0
  44. package/fs/dev/tf/scenarios/async-subtests.pass.js +7 -0
  45. package/fs/dev/tf/scenarios/async.fail.d.ts +1 -0
  46. package/fs/dev/tf/scenarios/async.fail.js +4 -0
  47. package/fs/dev/tf/scenarios/async.pass.d.ts +1 -0
  48. package/fs/dev/tf/scenarios/async.pass.js +3 -0
  49. package/fs/dev/tf/scenarios/fail.fail.f.d.ts +1 -0
  50. package/fs/dev/tf/scenarios/fail.fail.f.js +1 -0
  51. package/fs/dev/tf/scenarios/return-value.pass.f.d.ts +1 -0
  52. package/fs/dev/tf/scenarios/return-value.pass.f.js +2 -0
  53. package/fs/dev/tf/scenarios/thenable.pass.d.ts +3 -0
  54. package/fs/dev/tf/scenarios/thenable.pass.js +9 -0
  55. package/fs/dev/tf/scenarios/thenable2.pass.f.d.ts +3 -0
  56. package/fs/dev/tf/scenarios/thenable2.pass.f.js +3 -0
  57. package/fs/{bnf/test.f.d.ts → dev/tf/scenarios/throw.pass.f.d.ts} +3 -1
  58. package/fs/dev/tf/scenarios/throw.pass.f.js +3 -0
  59. package/fs/dev/version/proof.f.d.ts +3 -0
  60. package/fs/dev/version/{test.f.js → proof.f.js} +1 -1
  61. package/fs/djs/ast/{test.f.d.ts → proof.f.d.ts} +1 -2
  62. package/fs/djs/ast/{test.f.js → proof.f.js} +1 -1
  63. package/fs/djs/parser/{test.f.d.ts → proof.f.d.ts} +1 -2
  64. package/fs/djs/parser/{test.f.js → proof.f.js} +1 -1
  65. package/fs/djs/{test.f.d.ts → proof.f.d.ts} +1 -2
  66. package/fs/djs/{test.f.js → proof.f.js} +1 -1
  67. package/fs/djs/serializer/module.f.d.ts +2 -2
  68. package/fs/djs/serializer/module.f.js +47 -79
  69. package/fs/djs/serializer/{test.f.d.ts → proof.f.d.ts} +1 -2
  70. package/fs/djs/serializer/{test.f.js → proof.f.js} +8 -8
  71. package/fs/djs/tokenizer/{test.f.d.ts → proof.f.d.ts} +1 -2
  72. package/fs/djs/tokenizer/{test.f.js → proof.f.js} +1 -1
  73. package/fs/djs/tokenizer-new/{test.f.d.ts → proof.f.d.ts} +1 -2
  74. package/fs/djs/tokenizer-new/{test.f.js → proof.f.js} +1 -1
  75. package/fs/djs/transpiler/module.f.d.ts +15 -0
  76. package/fs/djs/transpiler/module.f.js +10 -2
  77. package/fs/djs/transpiler/{test.f.d.ts → proof.f.d.ts} +1 -2
  78. package/fs/djs/transpiler/{test.f.js → proof.f.js} +1 -1
  79. package/fs/fsc/{test.f.d.ts → proof.f.d.ts} +1 -2
  80. package/fs/fsc/{test.f.js → proof.f.js} +1 -1
  81. package/fs/fsm/proof.f.d.ts +4 -0
  82. package/fs/fsm/{test.f.js → proof.f.js} +1 -1
  83. package/fs/html/{test.f.d.ts → proof.f.d.ts} +1 -2
  84. package/fs/html/{test.f.js → proof.f.js} +1 -1
  85. package/fs/io/module.d.ts +1 -1
  86. package/fs/io/module.f.d.ts +8 -3
  87. package/fs/io/module.f.js +12 -12
  88. package/fs/io/module.js +43 -5
  89. package/fs/js/tokenizer/{test.f.d.ts → proof.f.d.ts} +1 -2
  90. package/fs/js/tokenizer/{test.f.js → proof.f.js} +1 -1
  91. package/fs/json/parser/{test.f.d.ts → proof.f.d.ts} +1 -2
  92. package/fs/json/parser/{test.f.js → proof.f.js} +1 -1
  93. package/fs/json/{test.f.d.ts → proof.f.d.ts} +1 -2
  94. package/fs/json/{test.f.js → proof.f.js} +1 -1
  95. package/fs/json/serializer/{test.f.d.ts → proof.f.d.ts} +1 -2
  96. package/fs/json/serializer/{test.f.js → proof.f.js} +1 -1
  97. package/fs/json/tokenizer/{test.f.d.ts → proof.f.d.ts} +1 -2
  98. package/fs/json/tokenizer/{test.f.js → proof.f.js} +1 -1
  99. package/fs/path/proof.f.d.ts +5 -0
  100. package/fs/path/{test.f.js → proof.f.js} +4 -3
  101. package/fs/sul/id/module.f.js +3 -4
  102. package/fs/sul/id/{test.f.d.ts → proof.f.d.ts} +1 -2
  103. package/fs/sul/id/{test.f.js → proof.f.js} +1 -1
  104. package/fs/sul/level/hash/{test.f.d.ts → proof.f.d.ts} +1 -2
  105. package/fs/sul/level/hash/{test.f.js → proof.f.js} +1 -1
  106. package/fs/sul/level/literal/module.f.js +3 -3
  107. package/fs/sul/level/literal/{test.f.d.ts → proof.f.d.ts} +1 -2
  108. package/fs/sul/level/literal/{test.f.js → proof.f.js} +1 -1
  109. package/fs/sul/{test.f.d.ts → proof.f.d.ts} +1 -2
  110. package/fs/sul/{test.f.js → proof.f.js} +1 -1
  111. package/fs/text/ascii/proof.f.d.ts +3 -0
  112. package/fs/text/ascii/{test.f.js → proof.f.js} +1 -1
  113. package/fs/text/code_point/module.f.d.ts +28 -0
  114. package/fs/text/code_point/module.f.js +31 -0
  115. package/fs/text/{test.f.d.ts → proof.f.d.ts} +1 -2
  116. package/fs/text/{test.f.js → proof.f.js} +1 -1
  117. package/fs/text/sgr/proof.f.d.ts +1 -0
  118. package/fs/text/sgr/proof.f.js +23 -0
  119. package/fs/text/utf16/module.f.js +3 -53
  120. package/fs/text/utf16/{test.f.d.ts → proof.f.d.ts} +1 -2
  121. package/fs/text/utf16/{test.f.js → proof.f.js} +1 -1
  122. package/fs/text/utf8/module.f.js +3 -25
  123. package/fs/text/utf8/{test.f.d.ts → proof.f.d.ts} +1 -2
  124. package/fs/text/utf8/{test.f.js → proof.f.js} +1 -1
  125. package/fs/types/array/{test.f.d.ts → proof.f.d.ts} +1 -2
  126. package/fs/types/array/{test.f.js → proof.f.js} +1 -1
  127. package/fs/types/bigfloat/{test.f.d.ts → proof.f.d.ts} +1 -2
  128. package/fs/types/bigfloat/{test.f.js → proof.f.js} +1 -1
  129. package/fs/types/bigint/{test.f.d.ts → proof.f.d.ts} +1 -2
  130. package/fs/types/bigint/{test.f.js → proof.f.js} +1 -1
  131. package/fs/types/bit_vec/module.f.d.ts +9 -4
  132. package/fs/types/bit_vec/module.f.js +7 -9
  133. package/fs/types/bit_vec/{test.f.d.ts → proof.f.d.ts} +1 -2
  134. package/fs/types/bit_vec/{test.f.js → proof.f.js} +1 -1
  135. package/fs/types/btree/find/proof.f.d.ts +1 -0
  136. package/fs/types/btree/find/{test.f.js → proof.f.js} +1 -1
  137. package/fs/types/btree/{test.f.d.ts → proof.f.d.ts} +1 -2
  138. package/fs/types/btree/{test.f.js → proof.f.js} +1 -1
  139. package/fs/types/btree/remove/module.f.d.ts +1 -1
  140. package/fs/types/btree/remove/module.f.js +7 -2
  141. package/fs/types/btree/remove/proof.f.d.ts +4 -0
  142. package/fs/types/btree/remove/{test.f.js → proof.f.js} +1 -1
  143. package/fs/types/btree/set/module.f.d.ts +1 -1
  144. package/fs/types/btree/set/module.f.js +7 -2
  145. package/fs/types/btree/set/proof.f.d.ts +1 -0
  146. package/fs/types/btree/set/{test.f.js → proof.f.js} +1 -1
  147. package/fs/types/btree/types/module.f.d.ts +9 -0
  148. package/fs/types/btree/types/module.f.js +9 -1
  149. package/fs/types/byte_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  150. package/fs/types/byte_set/{test.f.js → proof.f.js} +1 -1
  151. package/fs/types/effects/module.f.d.ts +17 -0
  152. package/fs/types/effects/module.f.js +17 -0
  153. package/fs/types/effects/node/module.f.d.ts +66 -4
  154. package/fs/types/effects/node/module.f.js +5 -1
  155. package/fs/types/effects/node/{test.f.d.ts → proof.f.d.ts} +1 -2
  156. package/fs/types/effects/node/{test.f.js → proof.f.js} +1 -1
  157. package/fs/types/effects/node/virtual/module.f.d.ts +2 -1
  158. package/fs/types/effects/node/virtual/module.f.js +2 -0
  159. package/fs/types/effects/proof.f.d.ts +11 -0
  160. package/fs/types/effects/proof.f.js +57 -0
  161. package/fs/types/function/compare/proof.f.d.ts +1 -0
  162. package/fs/types/function/compare/{test.f.js → proof.f.js} +1 -1
  163. package/fs/types/function/operator/proof.f.d.ts +12 -0
  164. package/fs/types/function/operator/{test.f.js → proof.f.js} +11 -10
  165. package/fs/types/function/proof.f.d.ts +1 -0
  166. package/fs/types/function/{test.f.js → proof.f.js} +1 -1
  167. package/fs/types/list/{test.f.d.ts → proof.f.d.ts} +1 -2
  168. package/fs/types/list/{test.f.js → proof.f.js} +1 -1
  169. package/fs/types/map/proof.f.d.ts +4 -0
  170. package/fs/types/map/{test.f.js → proof.f.js} +1 -1
  171. package/fs/types/monoid/{test.f.d.ts → proof.f.d.ts} +1 -2
  172. package/fs/types/monoid/{test.f.js → proof.f.js} +1 -1
  173. package/fs/types/nibble_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  174. package/fs/types/nibble_set/{test.f.js → proof.f.js} +1 -1
  175. package/fs/types/nominal/proof.f.d.ts +4 -0
  176. package/fs/types/nominal/{test.f.js → proof.f.js} +1 -1
  177. package/fs/types/nullable/proof.f.d.ts +1 -0
  178. package/fs/types/nullable/{test.f.js → proof.f.js} +11 -2
  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/{test.f.d.ts → proof.f.d.ts} +1 -2
  182. package/fs/types/object/{test.f.js → proof.f.js} +1 -1
  183. package/fs/types/ordered_map/{test.f.d.ts → proof.f.d.ts} +1 -2
  184. package/fs/types/ordered_map/{test.f.js → proof.f.js} +1 -1
  185. package/fs/types/patricia_trie/{test.f.d.ts → proof.f.d.ts} +1 -2
  186. package/fs/types/patricia_trie/{test.f.js → proof.f.js} +1 -1
  187. package/fs/types/prime_field/{test.f.d.ts → proof.f.d.ts} +1 -2
  188. package/fs/types/prime_field/{test.f.js → proof.f.js} +1 -1
  189. package/fs/types/range/proof.f.d.ts +1 -0
  190. package/fs/types/range/{test.f.js → proof.f.js} +1 -1
  191. package/fs/types/range_map/{test.f.d.ts → proof.f.d.ts} +1 -2
  192. package/fs/types/range_map/{test.f.js → proof.f.js} +1 -1
  193. package/fs/types/result/proof.f.d.ts +5 -0
  194. package/fs/types/result/{test.f.js → proof.f.js} +18 -2
  195. package/fs/types/rtti/parse/{test.f.d.ts → proof.f.d.ts} +1 -2
  196. package/fs/types/rtti/parse/{test.f.js → proof.f.js} +1 -1
  197. package/fs/types/rtti/{test.f.d.ts → proof.f.d.ts} +1 -2
  198. package/fs/types/rtti/{test.f.js → proof.f.js} +1 -1
  199. package/fs/types/rtti/ts/{test.f.d.ts → proof.f.d.ts} +1 -2
  200. package/fs/types/rtti/ts/{test.f.js → proof.f.js} +1 -1
  201. package/fs/types/rtti/validate/{test.f.d.ts → proof.f.d.ts} +1 -2
  202. package/fs/types/rtti/validate/{test.f.js → proof.f.js} +1 -1
  203. package/fs/types/sorted_list/{test.f.d.ts → proof.f.d.ts} +1 -2
  204. package/fs/types/sorted_list/{test.f.js → proof.f.js} +1 -1
  205. package/fs/types/sorted_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  206. package/fs/types/sorted_set/{test.f.js → proof.f.js} +1 -1
  207. package/fs/types/string/{test.f.d.ts → proof.f.d.ts} +1 -2
  208. package/fs/types/string/{test.f.js → proof.f.js} +1 -1
  209. package/fs/types/string_set/{test.f.d.ts → proof.f.d.ts} +1 -2
  210. package/fs/types/string_set/{test.f.js → proof.f.js} +1 -1
  211. package/fs/types/ts/{test.f.d.ts → proof.f.d.ts} +20 -0
  212. package/fs/types/ts/{test.f.js → proof.f.js} +1 -0
  213. package/fs/types/uint8array/{test.f.d.ts → proof.f.d.ts} +1 -2
  214. package/fs/types/uint8array/{test.f.js → proof.f.js} +1 -1
  215. package/issues/demo/sample/{test.f.js → proof.f.js} +1 -1
  216. package/issues/{test.f.d.ts → proof.f.d.ts} +1 -2
  217. package/issues/{test.f.js → proof.f.js} +1 -1
  218. package/nanvm-lib/tests/{test.f.d.ts → proof.f.d.ts} +1 -2
  219. package/nanvm-lib/tests/{test.f.js → proof.f.js} +1 -1
  220. package/nanvm-lib/tests/vm/{test.f.d.ts → proof.f.d.ts} +1 -2
  221. package/nanvm-lib/tests/vm/{test.f.js → proof.f.js} +1 -1
  222. package/package.json +5 -5
  223. package/fs/base128/test.f.d.ts +0 -2
  224. package/fs/cas/test.f.d.ts +0 -2
  225. package/fs/cas/test.f.js +0 -1
  226. package/fs/dev/version/test.f.d.ts +0 -4
  227. package/fs/fsm/test.f.d.ts +0 -5
  228. package/fs/path/test.f.d.ts +0 -3
  229. package/fs/text/ascii/test.f.d.ts +0 -4
  230. package/fs/text/sgr/test.f.d.ts +0 -2
  231. package/fs/text/sgr/test.f.js +0 -8
  232. package/fs/types/btree/find/test.f.d.ts +0 -2
  233. package/fs/types/btree/remove/test.f.d.ts +0 -5
  234. package/fs/types/btree/set/test.f.d.ts +0 -2
  235. package/fs/types/function/compare/test.f.d.ts +0 -2
  236. package/fs/types/function/operator/test.f.d.ts +0 -10
  237. package/fs/types/function/test.f.d.ts +0 -2
  238. package/fs/types/map/test.f.d.ts +0 -5
  239. package/fs/types/nominal/test.f.d.ts +0 -5
  240. package/fs/types/nullable/test.f.d.ts +0 -2
  241. package/fs/types/range/test.f.d.ts +0 -2
  242. package/fs/types/result/test.f.d.ts +0 -2
@@ -5,19 +5,18 @@
5
5
  * @module
6
6
  */
7
7
  import { bitLength, max } from "../types/bigint/module.f.js";
8
- import { empty, isVec, length, listToVec, msb, uint, unpack, vec, vec8 } from "../types/bit_vec/module.f.js";
8
+ import { empty, isVec, length, msb, uint, unpack, vec, vec8 } from "../types/bit_vec/module.f.js";
9
9
  import { identity } from "../types/function/module.f.js";
10
10
  import { encode as b128encode, decode as b128decode } from "../base128/module.f.js";
11
- const pop = msb.popFront;
11
+ const { popFront: pop, listToVec } = msb;
12
12
  const pop8 = pop(8n);
13
- const concat = listToVec(msb);
14
13
  const classPcMask = 224n;
15
14
  const tagNumberMask = 31n;
16
15
  const parsedTagEncode = ([classPc, number]) => {
17
16
  const [firstByteNumber, rest] = number < tagNumberMask
18
17
  ? [number, empty]
19
18
  : [tagNumberMask, b128encode(number)];
20
- return concat([vec8(classPc | firstByteNumber), rest]);
19
+ return listToVec([vec8(classPc | firstByteNumber), rest]);
21
20
  };
22
21
  const parsedTagDecode = (v) => {
23
22
  const [firstByte, rest] = pop8(v);
@@ -86,7 +85,7 @@ const lenEncode = (uint) => {
86
85
  return vec8(uint);
87
86
  }
88
87
  const { byteLen, v } = round8({ length: bitLength(uint), uint });
89
- return concat([vec8(0x80n | byteLen), v]);
88
+ return listToVec([vec8(0x80n | byteLen), v]);
90
89
  };
91
90
  /**
92
91
  * Decodes the length field of an ASN.1 TLV and returns the length in bits and the remaining input.
@@ -104,7 +103,7 @@ const lenDecode = (v) => {
104
103
  export const encodeRaw = ([tag, value]) => {
105
104
  const tagVec = tagEncode(tag);
106
105
  const { byteLen, v } = round8(unpack(value));
107
- return concat([tagVec, lenEncode(byteLen), v]);
106
+ return listToVec([tagVec, lenEncode(byteLen), v]);
108
107
  };
109
108
  /** Decodes a raw ASN.1 TLV tuple and returns the remaining input. */
110
109
  export const decodeRaw = (v) => {
@@ -139,7 +138,7 @@ export const decodeOctetString = (v) => v;
139
138
  export const encodeObjectIdentifier = (oid) => {
140
139
  const [first, second, ...rest] = oid;
141
140
  const firstByte = first * 40n + second;
142
- return concat([vec8(firstByte), ...rest.map(b128encode)]);
141
+ return listToVec([vec8(firstByte), ...rest.map(b128encode)]);
143
142
  };
144
143
  /** Decodes an OBJECT IDENTIFIER value. */
145
144
  export const decodeObjectIdentifier = (v) => {
@@ -155,7 +154,7 @@ export const decodeObjectIdentifier = (v) => {
155
154
  }
156
155
  return result;
157
156
  };
158
- const genericEncodeSequence = (map) => (...records) => concat(map(records.map(encode)));
157
+ const genericEncodeSequence = (map) => (...records) => listToVec(map(records.map(encode)));
159
158
  /** Encodes a SEQUENCE payload from ordered records. */
160
159
  export const encodeSequence = genericEncodeSequence(identity);
161
160
  /** Decodes a SEQUENCE payload into records. */
@@ -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;
@@ -1,8 +1,7 @@
1
- import { empty, length, listToVec, msb, uint, unpack, vec, vec8 } from "../types/bit_vec/module.f.js";
1
+ import { empty, length, msb, uint, unpack, vec, vec8 } from "../types/bit_vec/module.f.js";
2
2
  import { asBase } from "../types/nominal/module.f.js";
3
3
  import { decodeRaw, decodeInteger, encodeRaw, encodeInteger, integer, encode, decode, constructedSequence, octetString, boolean, constructedSet } from "./module.f.js";
4
- const { concat, popFront: pop } = msb;
5
- const cat = listToVec(msb);
4
+ const { concat, popFront: pop, listToVec } = msb;
6
5
  const pop8 = pop(8n);
7
6
  const check = (tag, v, rest) => {
8
7
  const s = encodeRaw([tag, v]);
@@ -46,7 +45,7 @@ const ch = (r, v) => {
46
45
  ch0(r, v, vec8(0x23n));
47
46
  ch0(r, v, vec(16n)(0x2345n));
48
47
  };
49
- export default {
48
+ export const proof = {
50
49
  encodeSmall: () => {
51
50
  const v = vec8(0x13n);
52
51
  const x = encodeRaw([integer, v]);
@@ -244,19 +243,19 @@ export default {
244
243
  },
245
244
  encodeDecode: {
246
245
  integer: () => {
247
- ch([integer, 0n], cat([vec8(BigInt(integer)), vec8(1n), vec8(0n)]));
248
- ch([integer, 1n], cat([vec8(BigInt(integer)), vec8(1n), vec8(1n)]));
246
+ ch([integer, 0n], listToVec([vec8(BigInt(integer)), vec8(1n), vec8(0n)]));
247
+ ch([integer, 1n], listToVec([vec8(BigInt(integer)), vec8(1n), vec8(1n)]));
249
248
  },
250
249
  sequence: () => {
251
- ch([constructedSequence, []], cat([vec8(BigInt(constructedSequence)), vec8(0n)]));
252
- ch([constructedSequence, [[integer, 0n]]], cat([vec8(BigInt(constructedSequence)), vec8(3n), encode([integer, 0n])]));
253
- ch([constructedSequence, [[integer, 1n], [integer, 2n]]], cat([
250
+ ch([constructedSequence, []], listToVec([vec8(BigInt(constructedSequence)), vec8(0n)]));
251
+ ch([constructedSequence, [[integer, 0n]]], listToVec([vec8(BigInt(constructedSequence)), vec8(3n), encode([integer, 0n])]));
252
+ ch([constructedSequence, [[integer, 1n], [integer, 2n]]], listToVec([
254
253
  vec8(BigInt(constructedSequence)),
255
254
  vec8(6n),
256
255
  encode([integer, 1n]),
257
256
  encode([integer, 2n])
258
257
  ]));
259
- ch([constructedSequence, [[octetString, vec8(0x23n)], [boolean, true], [boolean, false]]], cat([
258
+ ch([constructedSequence, [[octetString, vec8(0x23n)], [boolean, true], [boolean, false]]], listToVec([
260
259
  vec8(BigInt(constructedSequence)),
261
260
  vec8(9n),
262
261
  encode([octetString, vec8(0x23n)]),
@@ -265,7 +264,7 @@ export default {
265
264
  ]));
266
265
  },
267
266
  set: () => {
268
- ch([constructedSet, [[integer, 2n], [integer, 1n]]], cat([
267
+ ch([constructedSet, [[integer, 2n], [integer, 1n]]], listToVec([
269
268
  vec8(BigInt(constructedSet)),
270
269
  vec8(6n),
271
270
  encode([integer, 1n]),
@@ -276,7 +275,7 @@ export default {
276
275
  raw: [
277
276
  () => {
278
277
  const e = encodeRaw([0x00n, vec8(0x23n)]);
279
- if (e !== cat([vec8(0x00n), vec8(1n), vec8(0x23n)])) {
278
+ if (e !== listToVec([vec8(0x00n), vec8(1n), vec8(0x23n)])) {
280
279
  throw `encode: ${length(e)}: ${uint(e).toString(2)}`;
281
280
  }
282
281
  const [[tag, value], rest] = decodeRaw(e);
@@ -292,7 +291,7 @@ export default {
292
291
  },
293
292
  () => {
294
293
  const e = encodeRaw([0x1f20n, vec(16n)(0x1234n)]);
295
- if (e !== cat([vec8(0x1fn), vec8(0x20n), vec8(2n), vec(16n)(0x1234n)])) {
294
+ if (e !== listToVec([vec8(0x1fn), vec8(0x20n), vec8(2n), vec(16n)(0x1234n)])) {
296
295
  const l = length(e);
297
296
  const u = uint(e);
298
297
  throw `encode: ${l}: ${u.toString(16)}`;
@@ -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,7 +6,7 @@
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";
9
+ import { begin, forEachStep, pure } from "../types/effects/module.f.js";
10
10
  import { error, 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";
@@ -111,17 +111,7 @@ export const main = (args) => {
111
111
  case 'list': {
112
112
  return begin
113
113
  .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
- })
114
+ .step(forEachStep(j => log(vecToCBase32(j))))
125
115
  .step(() => pure(0));
126
116
  }
127
117
  case undefined: {
@@ -0,0 +1 @@
1
+ export declare const proof: () => void;
@@ -0,0 +1 @@
1
+ export const proof = () => { };
@@ -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));
@@ -20,13 +20,13 @@ export declare const images: {
20
20
  };
21
21
  };
22
22
  export declare const bun = "1.3.14";
23
- export declare const deno = "2.8.0";
23
+ export declare const deno = "2.8.1";
24
24
  export declare const playwright = "1.60.0";
25
25
  export declare const rust = "1.95.0";
26
26
  export declare const node: {
27
27
  readonly default: "26.2.0";
28
- readonly others: readonly ["22.22.3", "24.16.0"];
28
+ readonly others: readonly ["24.16.0"];
29
29
  };
30
- export declare const wasmtime = "44.0.1";
30
+ export declare const wasmtime = "45.0.0";
31
31
  export declare const wasmer = "7.1.0";
32
- export declare const tsgo = "7.0.0-dev.20260526.1";
32
+ export declare const tsgo = "7.0.0-dev.20260527.1";
@@ -23,7 +23,7 @@ export const images = {
23
23
  // https://bun.sh/
24
24
  export const bun = '1.3.14';
25
25
  // https://deno.com/
26
- export const deno = '2.8.0';
26
+ export const deno = '2.8.1';
27
27
  // https://www.npmjs.com/package/playwright
28
28
  export const playwright = '1.60.0';
29
29
  // https://rust-lang.org/
@@ -31,11 +31,11 @@ export const rust = '1.95.0';
31
31
  // https://nodejs.org/en/download
32
32
  export const node = {
33
33
  default: '26.2.0',
34
- others: ['22.22.3', '24.16.0'],
34
+ others: ['24.16.0'],
35
35
  };
36
36
  // https://github.com/bytecodealliance/wasmtime/releases
37
- export const wasmtime = '44.0.1';
37
+ export const wasmtime = '45.0.0';
38
38
  // https://github.com/wasmerio/wasmer/releases
39
39
  export const wasmer = '7.1.0';
40
40
  // https://www.npmjs.com/package/@typescript/native-preview?activeTab=versions
41
- export const tsgo = '7.0.0-dev.20260526.1';
41
+ export const tsgo = '7.0.0-dev.20260527.1';
@@ -8,20 +8,25 @@ import { node, tsgo } from "../config/module.f.js";
8
8
  import { clean, findTgz, install, test, ubuntu } from "../common/module.f.js";
9
9
  export const major = (v) => v.split('.')[0];
10
10
  const installNode = (version) => ({ uses: 'actions/setup-node@v6', with: { 'node-version': version } });
11
- export const basicNode = (version) => (extra) => clean([
12
- install(installNode(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)}`,
@@ -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;
@@ -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
  },
@@ -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,5 +1,5 @@
1
1
  import { bitLength, divUp, roundUp } from "../../types/bigint/module.f.js";
2
- import { empty, length, listToVec, msb, repeat, unpack, vec, vec8 } from "../../types/bit_vec/module.f.js";
2
+ import { empty, length, msb, repeat, unpack, vec, vec8 } from "../../types/bit_vec/module.f.js";
3
3
  import { hmac } from "../hmac/module.f.js";
4
4
  import { computeSync } from "../sha2/module.f.js";
5
5
  // qlen to rlen
@@ -34,8 +34,8 @@ export const all = (q) => {
34
34
  export const fromCurve = (c) => all(c.nf.p);
35
35
  const x01 = vec8(0x01n);
36
36
  const x00 = vec8(0x00n);
37
- const ltov = listToVec(msb);
38
- export const concat = (...x) => ltov(x);
37
+ const { listToVec } = msb;
38
+ export const concat = (...x) => listToVec(x);
39
39
  /**
40
40
  * Computes deterministic ECDSA nonce `k` as described by RFC6979.
41
41
  */
@@ -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");
@@ -10,14 +10,40 @@ export declare const todo: () => never;
10
10
  export declare const assert: (v: boolean, msg?: unknown) => asserts v;
11
11
  export declare const assertEq: <T>(a: T, b: T) => void;
12
12
  export type Module = {
13
- readonly default?: unknown;
13
+ readonly proof?: unknown;
14
14
  readonly [k: string]: unknown;
15
15
  };
16
16
  export type ModuleMap = {
17
17
  readonly [k in string]: Module;
18
18
  };
19
19
  export declare const env: (io: Io) => (v: string) => string | undefined;
20
- export declare const allFiles: (s: string) => Effect<Readdir | All, readonly string[]>;
20
+ /**
21
+ * Returns `true` if the file should be loaded for proof discovery.
22
+ *
23
+ * All FunctionalScript modules (`.f.ts` / `.f.js`) are safe to bulk-load by
24
+ * construction — they have no import side effects. For vanilla TS/JS the
25
+ * load gate stays opt-in by filename: any file ending in `proof.ts`,
26
+ * `proof.js`, `proof.mts`, or `proof.mjs` is included.
27
+ *
28
+ * Whether a loaded module actually _contains_ a proof is determined at
29
+ * runtime by checking for an exported `proof` property.
30
+ */
31
+ export declare const shouldLoad: (s: string) => boolean;
32
+ /** The effect operations required to discover and load a module map. */
21
33
  export type LoadModuleOperations = Access | Import | All | Readdir;
34
+ /**
35
+ * Discovers all source files under `INIT_CWD` (or `.` if unset) that match
36
+ * `predicate`, imports them, and returns a map from relative path to module
37
+ * exports.
38
+ *
39
+ * The `predicate` is propagated into `allFiles` so that non-matching files
40
+ * are excluded before any `import()` is attempted — no wasted I/O.
41
+ * The default matches all JS/TS source files (`.js`, `.ts`, `.mts`, `.mjs`).
42
+ * `loadFile`'s own guards (`.f.js`, `.f.ts`, `shouldLoad`) still apply on
43
+ * top; the predicate only controls which files are discovered.
44
+ *
45
+ * The result is sorted by path key using `string.cmp` so the order is
46
+ * deterministic regardless of filesystem traversal order.
47
+ */
22
48
  export declare const loadModuleMap: (env: Env) => Effect<LoadModuleOperations, ModuleMap>;
23
49
  export declare const index4: NodeProgram;
@@ -1,5 +1,6 @@
1
1
  import { updateVersion } from "./version/module.f.js";
2
2
  import { access, all, both, import_, readdir, readFile, writeFile } from "../types/effects/node/module.f.js";
3
+ import { cmp as strCmp } from "../types/string/module.f.js";
3
4
  import { utf8, utf8ToString } from "../text/module.f.js";
4
5
  import { unwrap } from "../types/result/module.f.js";
5
6
  import { begin, pure } from "../types/effects/module.f.js";
@@ -13,14 +14,28 @@ export const assert = (v, msg = 'assertion failed') => {
13
14
  throw msg;
14
15
  };
15
16
  export const assertEq = (a, b) => assert(a === b, [a, b]);
16
- const cmp = ([a], [b]) => a < b ? -1 : a > b ? 1 : 0;
17
17
  export const env = ({ process: { env } }) => a => {
18
18
  const r = Object.getOwnPropertyDescriptor(env, a);
19
19
  return r === undefined ? undefined :
20
20
  typeof r.get === 'function' ? r.get() :
21
21
  r.value;
22
22
  };
23
- export const allFiles = (s) => {
23
+ /**
24
+ * Returns `true` if the file should be loaded for proof discovery.
25
+ *
26
+ * All FunctionalScript modules (`.f.ts` / `.f.js`) are safe to bulk-load by
27
+ * construction — they have no import side effects. For vanilla TS/JS the
28
+ * load gate stays opt-in by filename: any file ending in `proof.ts`,
29
+ * `proof.js`, `proof.mts`, or `proof.mjs` is included.
30
+ *
31
+ * Whether a loaded module actually _contains_ a proof is determined at
32
+ * runtime by checking for an exported `proof` property.
33
+ */
34
+ export const shouldLoad = (s) => s.endsWith('.f.ts') || s.endsWith('.f.js') ||
35
+ s.endsWith('proof.ts') || s.endsWith('proof.js') ||
36
+ s.endsWith('proof.mts') || s.endsWith('proof.mjs');
37
+ const isSourceFile = (path) => path.endsWith('.js') || path.endsWith('.ts') || path.endsWith('.mts') || path.endsWith('.mjs');
38
+ const allFiles = (s, predicate) => {
24
39
  const load = (p) => begin
25
40
  .step(() => readdir(p, {}))
26
41
  .step(d => {
@@ -38,7 +53,7 @@ export const allFiles = (s) => {
38
53
  result = [...result, load(file)];
39
54
  continue;
40
55
  }
41
- if (name.endsWith('.js') || name.endsWith('.ts')) {
56
+ if (predicate(file)) {
42
57
  result = [...result, pure([file])];
43
58
  }
44
59
  }
@@ -47,18 +62,22 @@ export const allFiles = (s) => {
47
62
  .step(v => pure(v.flat()));
48
63
  return load(s);
49
64
  };
50
- const loadFile = (f) => {
51
- const doImport = import_(f).step(r => pure([[f, unwrap(r)]]));
52
- if (f.endsWith('.f.js')) {
53
- return doImport;
54
- }
55
- if (f.endsWith('.f.ts')) {
56
- return access(f.substring(0, f.length - 3) + '.js')
57
- .step(r => r[0] === 'ok' ? pure([]) : doImport);
58
- }
59
- return pure([]);
60
- };
65
+ const loadFile = (f) => import_(f).step(r => pure([[f, unwrap(r)]]));
61
66
  const { fromEntries } = Object;
67
+ /**
68
+ * Discovers all source files under `INIT_CWD` (or `.` if unset) that match
69
+ * `predicate`, imports them, and returns a map from relative path to module
70
+ * exports.
71
+ *
72
+ * The `predicate` is propagated into `allFiles` so that non-matching files
73
+ * are excluded before any `import()` is attempted — no wasted I/O.
74
+ * The default matches all JS/TS source files (`.js`, `.ts`, `.mts`, `.mjs`).
75
+ * `loadFile`'s own guards (`.f.js`, `.f.ts`, `shouldLoad`) still apply on
76
+ * top; the predicate only controls which files are discovered.
77
+ *
78
+ * The result is sorted by path key using `string.cmp` so the order is
79
+ * deterministic regardless of filesystem traversal order.
80
+ */
62
81
  export const loadModuleMap = (env) => {
63
82
  const initCwd = env['INIT_CWD'];
64
83
  const s = initCwd === undefined ? '.' : `${initCwd.replaceAll('\\', '/')}`;
@@ -67,24 +86,21 @@ export const loadModuleMap = (env) => {
67
86
  // we should consider optimize them by ALIQ technique or something similar.
68
87
  // For example, we should be able to write it like `allFiles(s).flatMap(loadFile)`,
69
88
  // then an effect runner can batch all file loading operations together.
70
- return allFiles(s)
89
+ return allFiles(s, shouldLoad)
71
90
  .step(files => all(...files.map(loadFile)))
72
91
  .step(entries => pure(fromEntries(entries
73
92
  .flat()
74
93
  .map(([k, v]) => [relativize(prefix, k), v])
75
- .toSorted(cmp))));
94
+ .toSorted(([a], [b]) => strCmp(a)(b)))));
76
95
  };
77
96
  const denoJson = './deno.json';
78
97
  const parseDenoJson = rttiParse(record(rttiUnknown));
79
- const index2 = begin
80
- .step(() => updateVersion)
98
+ const index2 = updateVersion
81
99
  .step(() => readFile(denoJson))
82
100
  .step(v => pure(unwrap(parseDenoJson(jsonParse(utf8ToString(unwrap(v)))))));
83
- const allFiles2aa = begin
84
- .step(() => allFiles('.'))
101
+ const allFiles2aa = allFiles('.', v => v.endsWith('/module.f.ts') || v.endsWith('/module.ts'))
85
102
  .step(files => {
86
- const list = files.filter(v => v.endsWith('/module.f.ts') || v.endsWith('/module.ts'));
87
- const exportsA = list.map(v => [v, `./${v.substring(2)}`]);
103
+ const exportsA = files.map(v => [v, `./${v.substring(2)}`]);
88
104
  return pure(Object.fromEntries(exportsA));
89
105
  });
90
106
  const index3 = both(index2)(allFiles2aa)
@@ -1,4 +1,7 @@
1
- declare const _default: {
1
+ export declare const proof: {
2
+ shouldPass: () => {
3
+ then: () => undefined;
4
+ };
2
5
  ctor: () => void;
3
6
  ctorEmpty: () => void;
4
7
  ctorUndefined: () => void;
@@ -6,5 +9,5 @@ declare const _default: {
6
9
  properties: () => void;
7
10
  getOwnPropertyDescriptor: () => void;
8
11
  throw: () => void;
12
+ env: () => void;
9
13
  };
10
- export default _default;